tandem-editor 0.6.2 → 0.6.3
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.
- package/CHANGELOG.md +22 -0
- package/dist/channel/index.js.map +1 -1
- package/dist/cli/index.js +167 -46
- package/dist/cli/index.js.map +1 -1
- package/dist/client/assets/index-B1Cd5UGT.js +349 -0
- package/dist/client/index.html +48 -1
- package/dist/monitor/index.js +1 -0
- package/dist/monitor/index.js.map +1 -1
- package/dist/server/index.js +60501 -59641
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/index-mo5ZOPfU.js +0 -349
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
var yz=Object.defineProperty;var bz=(t,e,n)=>e in t?yz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Hf=(t,e,n)=>bz(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function Zp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Py={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 iC;function xz(){if(iC)return Jc;iC=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var l=null;if(s!==void 0&&(l=""+s),i.key!==void 0&&(l=""+i.key),"key"in i){s={};for(var c in i)c!=="key"&&(s[c]=i[c])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:l,ref:i!==void 0?i:null,props:s}}return Jc.Fragment=e,Jc.jsx=n,Jc.jsxs=n,Jc}var sC;function vz(){return sC||(sC=1,Py.exports=xz()),Py.exports}var k=vz(),$y={exports:{}},Ue={};/**
|
|
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 oC;function Sz(){if(oC)return Ue;oC=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),g=Symbol.iterator;function b(D){return D===null||typeof D!="object"?null:(D=g&&D[g]||D["@@iterator"],typeof D=="function"?D:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,C={};function E(D,H,T){this.props=D,this.context=H,this.refs=C,this.updater=T||v}E.prototype.isReactComponent={},E.prototype.setState=function(D,H){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,H,"setState")},E.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function I(){}I.prototype=E.prototype;function j(D,H,T){this.props=D,this.context=H,this.refs=C,this.updater=T||v}var Q=j.prototype=new I;Q.constructor=j,w(Q,E.prototype),Q.isPureReactComponent=!0;var V=Array.isArray;function _(){}var N={H:null,A:null,T:null,S:null},Z=Object.prototype.hasOwnProperty;function Y(D,H,T){var F=T.ref;return{$$typeof:t,type:D,key:H,ref:F!==void 0?F:null,props:T}}function ce(D,H){return Y(D.type,H,D.props)}function ie(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function se(D){var H={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(T){return H[T]})}var xe=/\/+/g;function pe(D,H){return typeof D=="object"&&D!==null&&D.key!=null?se(""+D.key):H.toString(36)}function U(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(_,_):(D.status="pending",D.then(function(H){D.status==="pending"&&(D.status="fulfilled",D.value=H)},function(H){D.status==="pending"&&(D.status="rejected",D.reason=H)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function L(D,H,T,F,ue){var le=typeof D;(le==="undefined"||le==="boolean")&&(D=null);var Re=!1;if(D===null)Re=!0;else switch(le){case"bigint":case"string":case"number":Re=!0;break;case"object":switch(D.$$typeof){case t:case e:Re=!0;break;case p:return Re=D._init,L(Re(D._payload),H,T,F,ue)}}if(Re)return ue=ue(D),Re=F===""?"."+pe(D,0):F,V(ue)?(T="",Re!=null&&(T=Re.replace(xe,"$&/")+"/"),L(ue,H,T,"",function(Xe){return Xe})):ue!=null&&(ie(ue)&&(ue=ce(ue,T+(ue.key==null||D&&D.key===ue.key?"":(""+ue.key).replace(xe,"$&/")+"/")+Re)),H.push(ue)),1;Re=0;var Be=F===""?".":F+":";if(V(D))for(var Ie=0;Ie<D.length;Ie++)F=D[Ie],le=Be+pe(F,Ie),Re+=L(F,H,T,le,ue);else if(Ie=b(D),typeof Ie=="function")for(D=Ie.call(D),Ie=0;!(F=D.next()).done;)F=F.value,le=Be+pe(F,Ie++),Re+=L(F,H,T,le,ue);else if(le==="object"){if(typeof D.then=="function")return L(U(D),H,T,F,ue);throw H=String(D),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return Re}function G(D,H,T){if(D==null)return D;var F=[],ue=0;return L(D,F,"","",function(le){return H.call(T,le,ue++)}),F}function me(D){if(D._status===-1){var H=D._result;H=H(),H.then(function(T){(D._status===0||D._status===-1)&&(D._status=1,D._result=T)},function(T){(D._status===0||D._status===-1)&&(D._status=2,D._result=T)}),D._status===-1&&(D._status=0,D._result=H)}if(D._status===1)return D._result.default;throw D._result}var Ae=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},M={map:G,forEach:function(D,H,T){G(D,function(){H.apply(this,arguments)},T)},count:function(D){var H=0;return G(D,function(){H++}),H},toArray:function(D){return G(D,function(H){return H})||[]},only:function(D){if(!ie(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ue.Activity=m,Ue.Children=M,Ue.Component=E,Ue.Fragment=n,Ue.Profiler=i,Ue.PureComponent=j,Ue.StrictMode=r,Ue.Suspense=d,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(D){return N.H.useMemoCache(D)}},Ue.cache=function(D){return function(){return D.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(D,H,T){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var F=w({},D.props),ue=D.key;if(H!=null)for(le in H.key!==void 0&&(ue=""+H.key),H)!Z.call(H,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&H.ref===void 0||(F[le]=H[le]);var le=arguments.length-2;if(le===1)F.children=T;else if(1<le){for(var Re=Array(le),Be=0;Be<le;Be++)Re[Be]=arguments[Be+2];F.children=Re}return Y(D.type,ue,F)},Ue.createContext=function(D){return D={$$typeof:l,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:s,_context:D},D},Ue.createElement=function(D,H,T){var F,ue={},le=null;if(H!=null)for(F in H.key!==void 0&&(le=""+H.key),H)Z.call(H,F)&&F!=="key"&&F!=="__self"&&F!=="__source"&&(ue[F]=H[F]);var Re=arguments.length-2;if(Re===1)ue.children=T;else if(1<Re){for(var Be=Array(Re),Ie=0;Ie<Re;Ie++)Be[Ie]=arguments[Ie+2];ue.children=Be}if(D&&D.defaultProps)for(F in Re=D.defaultProps,Re)ue[F]===void 0&&(ue[F]=Re[F]);return Y(D,le,ue)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(D){return{$$typeof:c,render:D}},Ue.isValidElement=ie,Ue.lazy=function(D){return{$$typeof:p,_payload:{_status:-1,_result:D},_init:me}},Ue.memo=function(D,H){return{$$typeof:f,type:D,compare:H===void 0?null:H}},Ue.startTransition=function(D){var H=N.T,T={};N.T=T;try{var F=D(),ue=N.S;ue!==null&&ue(T,F),typeof F=="object"&&F!==null&&typeof F.then=="function"&&F.then(_,Ae)}catch(le){Ae(le)}finally{H!==null&&T.types!==null&&(H.types=T.types),N.T=H}},Ue.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},Ue.use=function(D){return N.H.use(D)},Ue.useActionState=function(D,H,T){return N.H.useActionState(D,H,T)},Ue.useCallback=function(D,H){return N.H.useCallback(D,H)},Ue.useContext=function(D){return N.H.useContext(D)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(D,H){return N.H.useDeferredValue(D,H)},Ue.useEffect=function(D,H){return N.H.useEffect(D,H)},Ue.useEffectEvent=function(D){return N.H.useEffectEvent(D)},Ue.useId=function(){return N.H.useId()},Ue.useImperativeHandle=function(D,H,T){return N.H.useImperativeHandle(D,H,T)},Ue.useInsertionEffect=function(D,H){return N.H.useInsertionEffect(D,H)},Ue.useLayoutEffect=function(D,H){return N.H.useLayoutEffect(D,H)},Ue.useMemo=function(D,H){return N.H.useMemo(D,H)},Ue.useOptimistic=function(D,H){return N.H.useOptimistic(D,H)},Ue.useReducer=function(D,H,T){return N.H.useReducer(D,H,T)},Ue.useRef=function(D){return N.H.useRef(D)},Ue.useState=function(D){return N.H.useState(D)},Ue.useSyncExternalStore=function(D,H,T){return N.H.useSyncExternalStore(D,H,T)},Ue.useTransition=function(){return N.H.useTransition()},Ue.version="19.2.4",Ue}var lC;function Tx(){return lC||(lC=1,$y.exports=Sz()),$y.exports}var O=Tx();const hn=Zp(O);var Fy={exports:{}},Xc={},qy={exports:{}},Yy={};/**
|
|
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 aC;function wz(){return aC||(aC=1,(function(t){function e(L,G){var me=L.length;L.push(G);e:for(;0<me;){var Ae=me-1>>>1,M=L[Ae];if(0<i(M,G))L[Ae]=G,L[me]=M,me=Ae;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var G=L[0],me=L.pop();if(me!==G){L[0]=me;e:for(var Ae=0,M=L.length,D=M>>>1;Ae<D;){var H=2*(Ae+1)-1,T=L[H],F=H+1,ue=L[F];if(0>i(T,me))F<M&&0>i(ue,T)?(L[Ae]=ue,L[F]=me,Ae=F):(L[Ae]=T,L[H]=me,Ae=H);else if(F<M&&0>i(ue,me))L[Ae]=ue,L[F]=me,Ae=F;else break e}}return G}function i(L,G){var me=L.sortIndex-G.sortIndex;return me!==0?me:L.id-G.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var d=[],f=[],p=1,m=null,g=3,b=!1,v=!1,w=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function Q(L){for(var G=n(f);G!==null;){if(G.callback===null)r(f);else if(G.startTime<=L)r(f),G.sortIndex=G.expirationTime,e(d,G);else break;G=n(f)}}function V(L){if(w=!1,Q(L),!v)if(n(d)!==null)v=!0,_||(_=!0,se());else{var G=n(f);G!==null&&U(V,G.startTime-L)}}var _=!1,N=-1,Z=5,Y=-1;function ce(){return C?!0:!(t.unstable_now()-Y<Z)}function ie(){if(C=!1,_){var L=t.unstable_now();Y=L;var G=!0;try{e:{v=!1,w&&(w=!1,I(N),N=-1),b=!0;var me=g;try{t:{for(Q(L),m=n(d);m!==null&&!(m.expirationTime>L&&ce());){var Ae=m.callback;if(typeof Ae=="function"){m.callback=null,g=m.priorityLevel;var M=Ae(m.expirationTime<=L);if(L=t.unstable_now(),typeof M=="function"){m.callback=M,Q(L),G=!0;break t}m===n(d)&&r(d),Q(L)}else r(d);m=n(d)}if(m!==null)G=!0;else{var D=n(f);D!==null&&U(V,D.startTime-L),G=!1}}break e}finally{m=null,g=me,b=!1}G=void 0}}finally{G?se():_=!1}}}var se;if(typeof j=="function")se=function(){j(ie)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,pe=xe.port2;xe.port1.onmessage=ie,se=function(){pe.postMessage(null)}}else se=function(){E(ie,0)};function U(L,G){N=E(function(){L(t.unstable_now())},G)}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(L){L.callback=null},t.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<L?Math.floor(1e3/L):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(L){switch(g){case 1:case 2:case 3:var G=3;break;default:G=g}var me=g;g=G;try{return L()}finally{g=me}},t.unstable_requestPaint=function(){C=!0},t.unstable_runWithPriority=function(L,G){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var me=g;g=L;try{return G()}finally{g=me}},t.unstable_scheduleCallback=function(L,G,me){var Ae=t.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?Ae+me:Ae):me=Ae,L){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,L={id:p++,callback:G,priorityLevel:L,startTime:me,expirationTime:M,sortIndex:-1},me>Ae?(L.sortIndex=me,e(f,L),n(d)===null&&L===n(f)&&(w?(I(N),N=-1):w=!0,U(V,me-Ae))):(L.sortIndex=M,e(d,L),v||b||(v=!0,_||(_=!0,se()))),L},t.unstable_shouldYield=ce,t.unstable_wrapCallback=function(L){var G=g;return function(){var me=g;g=G;try{return L.apply(this,arguments)}finally{g=me}}}})(Yy)),Yy}var cC;function kz(){return cC||(cC=1,qy.exports=wz()),qy.exports}var Ky={exports:{}},Rn={};/**
|
|
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 uC;function Cz(){if(uC)return Rn;uC=1;var t=Tx();function e(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)f+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(d,f,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:d,containerInfo:f,implementation:p}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Rn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Rn.createPortal=function(d,f){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return s(d,f,null,p)},Rn.flushSync=function(d){var f=l.T,p=r.p;try{if(l.T=null,r.p=2,d)return d()}finally{l.T=f,r.p=p,r.d.f()}},Rn.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(d,f))},Rn.prefetchDNS=function(d){typeof d=="string"&&r.d.D(d)},Rn.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var p=f.as,m=c(p,f.crossOrigin),g=typeof f.integrity=="string"?f.integrity:void 0,b=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;p==="style"?r.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:g,fetchPriority:b}):p==="script"&&r.d.X(d,{crossOrigin:m,integrity:g,fetchPriority:b,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Rn.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var p=c(f.as,f.crossOrigin);r.d.M(d,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(d)},Rn.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var p=f.as,m=c(p,f.crossOrigin);r.d.L(d,p,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Rn.preloadModule=function(d,f){if(typeof d=="string")if(f){var p=c(f.as,f.crossOrigin);r.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(d)},Rn.requestFormReset=function(d){r.d.r(d)},Rn.unstable_batchedUpdates=function(d,f){return d(f)},Rn.useFormState=function(d,f,p){return l.H.useFormState(d,f,p)},Rn.useFormStatus=function(){return l.H.useHostTransitionStatus()},Rn.version="19.2.4",Rn}var dC;function sM(){if(dC)return Ky.exports;dC=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(),Ky.exports=Cz(),Ky.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 fC;function Ez(){if(fC)return Xc;fC=1;var t=kz(),e=Tx(),n=sM();function r(o){var a="https://react.dev/errors/"+o;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var a=o,u=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(u=a.return),o=a.return;while(o)}return a.tag===3?u:null}function l(o){if(o.tag===13){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function c(o){if(o.tag===31){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function d(o){if(s(o)!==o)throw Error(r(188))}function f(o){var a=o.alternate;if(!a){if(a=s(o),a===null)throw Error(r(188));return a!==o?null:o}for(var u=o,h=a;;){var y=u.return;if(y===null)break;var x=y.alternate;if(x===null){if(h=y.return,h!==null){u=h;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===u)return d(y),o;if(x===h)return d(y),a;x=x.sibling}throw Error(r(188))}if(u.return!==h.return)u=y,h=x;else{for(var S=!1,A=y.child;A;){if(A===u){S=!0,u=y,h=x;break}if(A===h){S=!0,h=y,u=x;break}A=A.sibling}if(!S){for(A=x.child;A;){if(A===u){S=!0,u=x,h=y;break}if(A===h){S=!0,h=x,u=y;break}A=A.sibling}if(!S)throw Error(r(189))}}if(u.alternate!==h)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?o:a}function p(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o;for(o=o.child;o!==null;){if(a=p(o),a!==null)return a;o=o.sibling}return null}var m=Object.assign,g=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),j=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),ce=Symbol.for("react.memo_cache_sentinel"),ie=Symbol.iterator;function se(o){return o===null||typeof o!="object"?null:(o=ie&&o[ie]||o["@@iterator"],typeof o=="function"?o:null)}var xe=Symbol.for("react.client.reference");function pe(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===xe?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case w:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case V:return"Suspense";case _:return"SuspenseList";case Y:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case v:return"Portal";case j:return o.displayName||"Context";case I:return(o._context.displayName||"Context")+".Consumer";case Q:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case N:return a=o.displayName||null,a!==null?a:pe(o.type)||"Memo";case Z:a=o._payload,o=o._init;try{return pe(o(a))}catch{}}return null}var U=Array.isArray,L=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},Ae=[],M=-1;function D(o){return{current:o}}function H(o){0>M||(o.current=Ae[M],Ae[M]=null,M--)}function T(o,a){M++,Ae[M]=o.current,o.current=a}var F=D(null),ue=D(null),le=D(null),Re=D(null);function Be(o,a){switch(T(le,a),T(ue,o),T(F,null),a.nodeType){case 9:case 11:o=(o=a.documentElement)&&(o=o.namespaceURI)?Ak(o):0;break;default:if(o=a.tagName,a=a.namespaceURI)a=Ak(a),o=Mk(a,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}H(F),T(F,o)}function Ie(){H(F),H(ue),H(le)}function Xe(o){o.memoizedState!==null&&T(Re,o);var a=F.current,u=Mk(a,o.type);a!==u&&(T(ue,o),T(F,u))}function Me(o){ue.current===o&&(H(F),H(ue)),Re.current===o&&(H(Re),Kc._currentValue=me)}var Ye,At;function Mt(o){if(Ye===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);Ye=a&&a[1]||"",At=-1<u.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Ye+o+At}var Jt=!1;function Vn(o,a){if(!o||Jt)return"";Jt=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(W){var q=W}Reflect.construct(o,[],te)}else{try{te.call()}catch(W){q=W}o.call(te.prototype)}}else{try{throw Error()}catch(W){q=W}(te=o())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(W){if(W&&q&&typeof W.stack=="string")return[W.stack,q.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=h.DetermineComponentFrameRoot(),S=x[0],A=x[1];if(S&&A){var R=S.split(`
|
|
44
|
+
`),$=A.split(`
|
|
45
|
+
`);for(y=h=0;h<R.length&&!R[h].includes("DetermineComponentFrameRoot");)h++;for(;y<$.length&&!$[y].includes("DetermineComponentFrameRoot");)y++;if(h===R.length||y===$.length)for(h=R.length-1,y=$.length-1;1<=h&&0<=y&&R[h]!==$[y];)y--;for(;1<=h&&0<=y;h--,y--)if(R[h]!==$[y]){if(h!==1||y!==1)do if(h--,y--,0>y||R[h]!==$[y]){var X=`
|
|
46
|
+
`+R[h].replace(" at new "," at ");return o.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",o.displayName)),X}while(1<=h&&0<=y);break}}}finally{Jt=!1,Error.prepareStackTrace=u}return(u=o?o.displayName||o.name:"")?Mt(u):""}function dr(o,a){switch(o.tag){case 26:case 27:case 5:return Mt(o.type);case 16:return Mt("Lazy");case 13:return o.child!==a&&a!==null?Mt("Suspense Fallback"):Mt("Suspense");case 19:return Mt("SuspenseList");case 0:case 15:return Vn(o.type,!1);case 11:return Vn(o.type.render,!1);case 1:return Vn(o.type,!0);case 31:return Mt("Activity");default:return""}}function Pn(o){try{var a="",u=null;do a+=dr(o,u),u=o,o=o.return;while(o);return a}catch(h){return`
|
|
47
|
+
Error generating stack: `+h.message+`
|
|
48
|
+
`+h.stack}}var Ft=Object.prototype.hasOwnProperty,fr=t.unstable_scheduleCallback,Qr=t.unstable_cancelCallback,ji=t.unstable_shouldYield,Ar=t.unstable_requestPaint,qt=t.unstable_now,Ii=t.unstable_getCurrentPriorityLevel,J=t.unstable_ImmediatePriority,de=t.unstable_UserBlockingPriority,Ee=t.unstable_NormalPriority,K=t.unstable_LowPriority,ge=t.unstable_IdlePriority,De=t.log,tt=t.unstable_setDisableYieldValue,re=null,Le=null;function nt(o){if(typeof De=="function"&&tt(o),Le&&typeof Le.setStrictMode=="function")try{Le.setStrictMode(re,o)}catch{}}var Ge=Math.clz32?Math.clz32:Nt,jt=Math.log,he=Math.LN2;function Nt(o){return o>>>=0,o===0?32:31-(jt(o)/he|0)|0}var Yt=256,Zn=262144,Mr=4194304;function fi(o){var a=o&42;if(a!==0)return a;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function hi(o,a,u){var h=o.pendingLanes;if(h===0)return 0;var y=0,x=o.suspendedLanes,S=o.pingedLanes;o=o.warmLanes;var A=h&134217727;return A!==0?(h=A&~x,h!==0?y=fi(h):(S&=A,S!==0?y=fi(S):u||(u=A&~o,u!==0&&(y=fi(u))))):(A=h&~x,A!==0?y=fi(A):S!==0?y=fi(S):u||(u=h&~o,u!==0&&(y=fi(u)))),y===0?0:a!==0&&a!==y&&(a&x)===0&&(x=y&-y,u=a&-a,x>=u||x===32&&(u&4194048)!==0)?a:y}function Bi(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function lc(o,a){switch(o){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function vl(){var o=Mr;return Mr<<=1,(Mr&62914560)===0&&(Mr=4194304),o}function Sl(o){for(var a=[],u=0;31>u;u++)a.push(o);return a}function So(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function wo(o,a,u,h,y,x){var S=o.pendingLanes;o.pendingLanes=u,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=u,o.entangledLanes&=u,o.errorRecoveryDisabledLanes&=u,o.shellSuspendCounter=0;var A=o.entanglements,R=o.expirationTimes,$=o.hiddenUpdates;for(u=S&~u;0<u;){var X=31-Ge(u),te=1<<X;A[X]=0,R[X]=-1;var q=$[X];if(q!==null)for($[X]=null,X=0;X<q.length;X++){var W=q[X];W!==null&&(W.lane&=-536870913)}u&=~te}h!==0&&cv(o,h,0),x!==0&&y===0&&o.tag!==0&&(o.suspendedLanes|=x&~(S&~a))}function cv(o,a,u){o.pendingLanes|=a,o.suspendedLanes&=~a;var h=31-Ge(a);o.entangledLanes|=a,o.entanglements[h]=o.entanglements[h]|1073741824|u&261930}function uv(o,a){var u=o.entangledLanes|=a;for(o=o.entanglements;u;){var h=31-Ge(u),y=1<<h;y&a|o[h]&a&&(o[h]|=a),u&=~y}}function dv(o,a){var u=a&-a;return u=(u&42)!==0?1:Dm(u),(u&(o.suspendedLanes|a))!==0?0:u}function Dm(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Rm(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function fv(){var o=G.p;return o!==0?o:(o=window.event,o===void 0?32:Jk(o.type))}function hv(o,a){var u=G.p;try{return G.p=o,a()}finally{G.p=u}}var xs=Math.random().toString(36).slice(2),Sn="__reactFiber$"+xs,Jn="__reactProps$"+xs,wl="__reactContainer$"+xs,Nm="__reactEvents$"+xs,oR="__reactListeners$"+xs,lR="__reactHandles$"+xs,pv="__reactResources$"+xs,ac="__reactMarker$"+xs;function zm(o){delete o[Sn],delete o[Jn],delete o[Nm],delete o[oR],delete o[lR]}function kl(o){var a=o[Sn];if(a)return a;for(var u=o.parentNode;u;){if(a=u[wl]||u[Sn]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(o=Lk(o);o!==null;){if(u=o[Sn])return u;o=Lk(o)}return a}o=u,u=o.parentNode}return null}function Cl(o){if(o=o[Sn]||o[wl]){var a=o.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return o}return null}function cc(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o.stateNode;throw Error(r(33))}function El(o){var a=o[pv];return a||(a=o[pv]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function cn(o){o[ac]=!0}var mv=new Set,gv={};function ko(o,a){Tl(o,a),Tl(o+"Capture",a)}function Tl(o,a){for(gv[o]=a,o=0;o<a.length;o++)mv.add(a[o])}var aR=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]*$"),yv={},bv={};function cR(o){return Ft.call(bv,o)?!0:Ft.call(yv,o)?!1:aR.test(o)?bv[o]=!0:(yv[o]=!0,!1)}function Ad(o,a,u){if(cR(a))if(u===null)o.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":o.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){o.removeAttribute(a);return}}o.setAttribute(a,""+u)}}function Md(o,a,u){if(u===null)o.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(a);return}o.setAttribute(a,""+u)}}function Ui(o,a,u,h){if(h===null)o.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(u);return}o.setAttributeNS(a,u,""+h)}}function Or(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function xv(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function uR(o,a,u){var h=Object.getOwnPropertyDescriptor(o.constructor.prototype,a);if(!o.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var y=h.get,x=h.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return y.call(this)},set:function(S){u=""+S,x.call(this,S)}}),Object.defineProperty(o,a,{enumerable:h.enumerable}),{getValue:function(){return u},setValue:function(S){u=""+S},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function Lm(o){if(!o._valueTracker){var a=xv(o)?"checked":"value";o._valueTracker=uR(o,a,""+o[a])}}function vv(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var u=a.getValue(),h="";return o&&(h=xv(o)?o.checked?"true":"false":o.value),o=h,o!==u?(a.setValue(o),!0):!1}function Od(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var dR=/[\n"\\]/g;function _r(o){return o.replace(dR,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function jm(o,a,u,h,y,x,S,A){o.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?o.type=S:o.removeAttribute("type"),a!=null?S==="number"?(a===0&&o.value===""||o.value!=a)&&(o.value=""+Or(a)):o.value!==""+Or(a)&&(o.value=""+Or(a)):S!=="submit"&&S!=="reset"||o.removeAttribute("value"),a!=null?Im(o,S,Or(a)):u!=null?Im(o,S,Or(u)):h!=null&&o.removeAttribute("value"),y==null&&x!=null&&(o.defaultChecked=!!x),y!=null&&(o.checked=y&&typeof y!="function"&&typeof y!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?o.name=""+Or(A):o.removeAttribute("name")}function Sv(o,a,u,h,y,x,S,A){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(o.type=x),a!=null||u!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){Lm(o);return}u=u!=null?""+Or(u):"",a=a!=null?""+Or(a):u,A||a===o.value||(o.value=a),o.defaultValue=a}h=h??y,h=typeof h!="function"&&typeof h!="symbol"&&!!h,o.checked=A?o.checked:!!h,o.defaultChecked=!!h,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(o.name=S),Lm(o)}function Im(o,a,u){a==="number"&&Od(o.ownerDocument)===o||o.defaultValue===""+u||(o.defaultValue=""+u)}function Al(o,a,u,h){if(o=o.options,a){a={};for(var y=0;y<u.length;y++)a["$"+u[y]]=!0;for(u=0;u<o.length;u++)y=a.hasOwnProperty("$"+o[u].value),o[u].selected!==y&&(o[u].selected=y),y&&h&&(o[u].defaultSelected=!0)}else{for(u=""+Or(u),a=null,y=0;y<o.length;y++){if(o[y].value===u){o[y].selected=!0,h&&(o[y].defaultSelected=!0);return}a!==null||o[y].disabled||(a=o[y])}a!==null&&(a.selected=!0)}}function wv(o,a,u){if(a!=null&&(a=""+Or(a),a!==o.value&&(o.value=a),u==null)){o.defaultValue!==a&&(o.defaultValue=a);return}o.defaultValue=u!=null?""+Or(u):""}function kv(o,a,u,h){if(a==null){if(h!=null){if(u!=null)throw Error(r(92));if(U(h)){if(1<h.length)throw Error(r(93));h=h[0]}u=h}u==null&&(u=""),a=u}u=Or(a),o.defaultValue=u,h=o.textContent,h===u&&h!==""&&h!==null&&(o.value=h),Lm(o)}function Ml(o,a){if(a){var u=o.firstChild;if(u&&u===o.lastChild&&u.nodeType===3){u.nodeValue=a;return}}o.textContent=a}var fR=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 Cv(o,a,u){var h=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?h?o.setProperty(a,""):a==="float"?o.cssFloat="":o[a]="":h?o.setProperty(a,u):typeof u!="number"||u===0||fR.has(a)?a==="float"?o.cssFloat=u:o[a]=(""+u).trim():o[a]=u+"px"}function Ev(o,a,u){if(a!=null&&typeof a!="object")throw Error(r(62));if(o=o.style,u!=null){for(var h in u)!u.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?o.setProperty(h,""):h==="float"?o.cssFloat="":o[h]="");for(var y in a)h=a[y],a.hasOwnProperty(y)&&u[y]!==h&&Cv(o,y,h)}else for(var x in a)a.hasOwnProperty(x)&&Cv(o,x,a[x])}function Bm(o){if(o.indexOf("-")===-1)return!1;switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hR=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"]]),pR=/^[\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 _d(o){return pR.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Hi(){}var Um=null;function Hm(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Ol=null,_l=null;function Tv(o){var a=Cl(o);if(a&&(o=a.stateNode)){var u=o[Jn]||null;e:switch(o=a.stateNode,a.type){case"input":if(jm(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=o;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+_r(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var h=u[a];if(h!==o&&h.form===o.form){var y=h[Jn]||null;if(!y)throw Error(r(90));jm(h,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(a=0;a<u.length;a++)h=u[a],h.form===o.form&&vv(h)}break e;case"textarea":wv(o,u.value,u.defaultValue);break e;case"select":a=u.value,a!=null&&Al(o,!!u.multiple,a,!1)}}}var Vm=!1;function Av(o,a,u){if(Vm)return o(a,u);Vm=!0;try{var h=o(a);return h}finally{if(Vm=!1,(Ol!==null||_l!==null)&&(bf(),Ol&&(a=Ol,o=_l,_l=Ol=null,Tv(a),o)))for(a=0;a<o.length;a++)Tv(o[a])}}function uc(o,a){var u=o.stateNode;if(u===null)return null;var h=u[Jn]||null;if(h===null)return null;u=h[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(o=o.type,h=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!h;break e;default:o=!1}if(o)return null;if(u&&typeof u!="function")throw Error(r(231,a,typeof u));return u}var Vi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pm=!1;if(Vi)try{var dc={};Object.defineProperty(dc,"passive",{get:function(){Pm=!0}}),window.addEventListener("test",dc,dc),window.removeEventListener("test",dc,dc)}catch{Pm=!1}var vs=null,$m=null,Dd=null;function Mv(){if(Dd)return Dd;var o,a=$m,u=a.length,h,y="value"in vs?vs.value:vs.textContent,x=y.length;for(o=0;o<u&&a[o]===y[o];o++);var S=u-o;for(h=1;h<=S&&a[u-h]===y[x-h];h++);return Dd=y.slice(o,1<h?1-h:void 0)}function Rd(o){var a=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&a===13&&(o=13)):o=a,o===10&&(o=13),32<=o||o===13?o:0}function Nd(){return!0}function Ov(){return!1}function Xn(o){function a(u,h,y,x,S){this._reactName=u,this._targetInst=y,this.type=h,this.nativeEvent=x,this.target=S,this.currentTarget=null;for(var A in o)o.hasOwnProperty(A)&&(u=o[A],this[A]=u?u(x):x[A]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Nd:Ov,this.isPropagationStopped=Ov,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=Nd)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Nd)},persist:function(){},isPersistent:Nd}),a}var Co={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zd=Xn(Co),fc=m({},Co,{view:0,detail:0}),mR=Xn(fc),Fm,qm,hc,Ld=m({},fc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Km,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==hc&&(hc&&o.type==="mousemove"?(Fm=o.screenX-hc.screenX,qm=o.screenY-hc.screenY):qm=Fm=0,hc=o),Fm)},movementY:function(o){return"movementY"in o?o.movementY:qm}}),_v=Xn(Ld),gR=m({},Ld,{dataTransfer:0}),yR=Xn(gR),bR=m({},fc,{relatedTarget:0}),Ym=Xn(bR),xR=m({},Co,{animationName:0,elapsedTime:0,pseudoElement:0}),vR=Xn(xR),SR=m({},Co,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),wR=Xn(SR),kR=m({},Co,{data:0}),Dv=Xn(kR),CR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ER={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"},TR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function AR(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=TR[o])?!!a[o]:!1}function Km(){return AR}var MR=m({},fc,{key:function(o){if(o.key){var a=CR[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=Rd(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?ER[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Km,charCode:function(o){return o.type==="keypress"?Rd(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Rd(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),OR=Xn(MR),_R=m({},Ld,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rv=Xn(_R),DR=m({},fc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Km}),RR=Xn(DR),NR=m({},Co,{propertyName:0,elapsedTime:0,pseudoElement:0}),zR=Xn(NR),LR=m({},Ld,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),jR=Xn(LR),IR=m({},Co,{newState:0,oldState:0}),BR=Xn(IR),UR=[9,13,27,32],Wm=Vi&&"CompositionEvent"in window,pc=null;Vi&&"documentMode"in document&&(pc=document.documentMode);var HR=Vi&&"TextEvent"in window&&!pc,Nv=Vi&&(!Wm||pc&&8<pc&&11>=pc),zv=" ",Lv=!1;function jv(o,a){switch(o){case"keyup":return UR.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Iv(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Dl=!1;function VR(o,a){switch(o){case"compositionend":return Iv(a);case"keypress":return a.which!==32?null:(Lv=!0,zv);case"textInput":return o=a.data,o===zv&&Lv?null:o;default:return null}}function PR(o,a){if(Dl)return o==="compositionend"||!Wm&&jv(o,a)?(o=Mv(),Dd=$m=vs=null,Dl=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Nv&&a.locale!=="ko"?null:a.data;default:return null}}var $R={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 Bv(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!$R[o.type]:a==="textarea"}function Uv(o,a,u,h){Ol?_l?_l.push(h):_l=[h]:Ol=h,a=Ef(a,"onChange"),0<a.length&&(u=new zd("onChange","change",null,u,h),o.push({event:u,listeners:a}))}var mc=null,gc=null;function FR(o){Sk(o,0)}function jd(o){var a=cc(o);if(vv(a))return o}function Hv(o,a){if(o==="change")return a}var Vv=!1;if(Vi){var Gm;if(Vi){var Zm="oninput"in document;if(!Zm){var Pv=document.createElement("div");Pv.setAttribute("oninput","return;"),Zm=typeof Pv.oninput=="function"}Gm=Zm}else Gm=!1;Vv=Gm&&(!document.documentMode||9<document.documentMode)}function $v(){mc&&(mc.detachEvent("onpropertychange",Fv),gc=mc=null)}function Fv(o){if(o.propertyName==="value"&&jd(gc)){var a=[];Uv(a,gc,o,Hm(o)),Av(FR,a)}}function qR(o,a,u){o==="focusin"?($v(),mc=a,gc=u,mc.attachEvent("onpropertychange",Fv)):o==="focusout"&&$v()}function YR(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return jd(gc)}function KR(o,a){if(o==="click")return jd(a)}function WR(o,a){if(o==="input"||o==="change")return jd(a)}function GR(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var hr=typeof Object.is=="function"?Object.is:GR;function yc(o,a){if(hr(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var u=Object.keys(o),h=Object.keys(a);if(u.length!==h.length)return!1;for(h=0;h<u.length;h++){var y=u[h];if(!Ft.call(a,y)||!hr(o[y],a[y]))return!1}return!0}function qv(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Yv(o,a){var u=qv(o);o=0;for(var h;u;){if(u.nodeType===3){if(h=o+u.textContent.length,o<=a&&h>=a)return{node:u,offset:a-o};o=h}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=qv(u)}}function Kv(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?Kv(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function Wv(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var a=Od(o.document);a instanceof o.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)o=a.contentWindow;else break;a=Od(o.document)}return a}function Jm(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a&&(a==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||a==="textarea"||o.contentEditable==="true")}var ZR=Vi&&"documentMode"in document&&11>=document.documentMode,Rl=null,Xm=null,bc=null,Qm=!1;function Gv(o,a,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Qm||Rl==null||Rl!==Od(h)||(h=Rl,"selectionStart"in h&&Jm(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}),bc&&yc(bc,h)||(bc=h,h=Ef(Xm,"onSelect"),0<h.length&&(a=new zd("onSelect","select",null,a,u),o.push({event:a,listeners:h}),a.target=Rl)))}function Eo(o,a){var u={};return u[o.toLowerCase()]=a.toLowerCase(),u["Webkit"+o]="webkit"+a,u["Moz"+o]="moz"+a,u}var Nl={animationend:Eo("Animation","AnimationEnd"),animationiteration:Eo("Animation","AnimationIteration"),animationstart:Eo("Animation","AnimationStart"),transitionrun:Eo("Transition","TransitionRun"),transitionstart:Eo("Transition","TransitionStart"),transitioncancel:Eo("Transition","TransitionCancel"),transitionend:Eo("Transition","TransitionEnd")},eg={},Zv={};Vi&&(Zv=document.createElement("div").style,"AnimationEvent"in window||(delete Nl.animationend.animation,delete Nl.animationiteration.animation,delete Nl.animationstart.animation),"TransitionEvent"in window||delete Nl.transitionend.transition);function To(o){if(eg[o])return eg[o];if(!Nl[o])return o;var a=Nl[o],u;for(u in a)if(a.hasOwnProperty(u)&&u in Zv)return eg[o]=a[u];return o}var Jv=To("animationend"),Xv=To("animationiteration"),Qv=To("animationstart"),JR=To("transitionrun"),XR=To("transitionstart"),QR=To("transitioncancel"),eS=To("transitionend"),tS=new Map,tg="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(" ");tg.push("scrollEnd");function ei(o,a){tS.set(o,a),ko(a,[o])}var Id=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Dr=[],zl=0,ng=0;function Bd(){for(var o=zl,a=ng=zl=0;a<o;){var u=Dr[a];Dr[a++]=null;var h=Dr[a];Dr[a++]=null;var y=Dr[a];Dr[a++]=null;var x=Dr[a];if(Dr[a++]=null,h!==null&&y!==null){var S=h.pending;S===null?y.next=y:(y.next=S.next,S.next=y),h.pending=y}x!==0&&nS(u,y,x)}}function Ud(o,a,u,h){Dr[zl++]=o,Dr[zl++]=a,Dr[zl++]=u,Dr[zl++]=h,ng|=h,o.lanes|=h,o=o.alternate,o!==null&&(o.lanes|=h)}function rg(o,a,u,h){return Ud(o,a,u,h),Hd(o)}function Ao(o,a){return Ud(o,null,null,a),Hd(o)}function nS(o,a,u){o.lanes|=u;var h=o.alternate;h!==null&&(h.lanes|=u);for(var y=!1,x=o.return;x!==null;)x.childLanes|=u,h=x.alternate,h!==null&&(h.childLanes|=u),x.tag===22&&(o=x.stateNode,o===null||o._visibility&1||(y=!0)),o=x,x=x.return;return o.tag===3?(x=o.stateNode,y&&a!==null&&(y=31-Ge(u),o=x.hiddenUpdates,h=o[y],h===null?o[y]=[a]:h.push(a),a.lane=u|536870912),x):null}function Hd(o){if(50<Hc)throw Hc=0,fy=null,Error(r(185));for(var a=o.return;a!==null;)o=a,a=o.return;return o.tag===3?o.stateNode:null}var Ll={};function eN(o,a,u,h){this.tag=o,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function pr(o,a,u,h){return new eN(o,a,u,h)}function ig(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Pi(o,a){var u=o.alternate;return u===null?(u=pr(o.tag,a,o.key,o.mode),u.elementType=o.elementType,u.type=o.type,u.stateNode=o.stateNode,u.alternate=o,o.alternate=u):(u.pendingProps=a,u.type=o.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=o.flags&65011712,u.childLanes=o.childLanes,u.lanes=o.lanes,u.child=o.child,u.memoizedProps=o.memoizedProps,u.memoizedState=o.memoizedState,u.updateQueue=o.updateQueue,a=o.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=o.sibling,u.index=o.index,u.ref=o.ref,u.refCleanup=o.refCleanup,u}function rS(o,a){o.flags&=65011714;var u=o.alternate;return u===null?(o.childLanes=0,o.lanes=a,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=u.childLanes,o.lanes=u.lanes,o.child=u.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=u.memoizedProps,o.memoizedState=u.memoizedState,o.updateQueue=u.updateQueue,o.type=u.type,a=u.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),o}function Vd(o,a,u,h,y,x){var S=0;if(h=o,typeof o=="function")ig(o)&&(S=1);else if(typeof o=="string")S=sz(o,u,F.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case Y:return o=pr(31,u,a,y),o.elementType=Y,o.lanes=x,o;case w:return Mo(u.children,y,x,a);case C:S=8,y|=24;break;case E:return o=pr(12,u,a,y|2),o.elementType=E,o.lanes=x,o;case V:return o=pr(13,u,a,y),o.elementType=V,o.lanes=x,o;case _:return o=pr(19,u,a,y),o.elementType=_,o.lanes=x,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case j:S=10;break e;case I:S=9;break e;case Q:S=11;break e;case N:S=14;break e;case Z:S=16,h=null;break e}S=29,u=Error(r(130,o===null?"null":typeof o,"")),h=null}return a=pr(S,u,a,y),a.elementType=o,a.type=h,a.lanes=x,a}function Mo(o,a,u,h){return o=pr(7,o,h,a),o.lanes=u,o}function sg(o,a,u){return o=pr(6,o,null,a),o.lanes=u,o}function iS(o){var a=pr(18,null,null,0);return a.stateNode=o,a}function og(o,a,u){return a=pr(4,o.children!==null?o.children:[],o.key,a),a.lanes=u,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}var sS=new WeakMap;function Rr(o,a){if(typeof o=="object"&&o!==null){var u=sS.get(o);return u!==void 0?u:(a={value:o,source:a,stack:Pn(a)},sS.set(o,a),a)}return{value:o,source:a,stack:Pn(a)}}var jl=[],Il=0,Pd=null,xc=0,Nr=[],zr=0,Ss=null,pi=1,mi="";function $i(o,a){jl[Il++]=xc,jl[Il++]=Pd,Pd=o,xc=a}function oS(o,a,u){Nr[zr++]=pi,Nr[zr++]=mi,Nr[zr++]=Ss,Ss=o;var h=pi;o=mi;var y=32-Ge(h)-1;h&=~(1<<y),u+=1;var x=32-Ge(a)+y;if(30<x){var S=y-y%5;x=(h&(1<<S)-1).toString(32),h>>=S,y-=S,pi=1<<32-Ge(a)+y|u<<y|h,mi=x+o}else pi=1<<x|u<<y|h,mi=o}function lg(o){o.return!==null&&($i(o,1),oS(o,1,0))}function ag(o){for(;o===Pd;)Pd=jl[--Il],jl[Il]=null,xc=jl[--Il],jl[Il]=null;for(;o===Ss;)Ss=Nr[--zr],Nr[zr]=null,mi=Nr[--zr],Nr[zr]=null,pi=Nr[--zr],Nr[zr]=null}function lS(o,a){Nr[zr++]=pi,Nr[zr++]=mi,Nr[zr++]=Ss,pi=a.id,mi=a.overflow,Ss=o}var wn=null,Ot=null,ot=!1,ws=null,Lr=!1,cg=Error(r(519));function ks(o){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw vc(Rr(a,o)),cg}function aS(o){var a=o.stateNode,u=o.type,h=o.memoizedProps;switch(a[Sn]=o,a[Jn]=h,u){case"dialog":et("cancel",a),et("close",a);break;case"iframe":case"object":case"embed":et("load",a);break;case"video":case"audio":for(u=0;u<Pc.length;u++)et(Pc[u],a);break;case"source":et("error",a);break;case"img":case"image":case"link":et("error",a),et("load",a);break;case"details":et("toggle",a);break;case"input":et("invalid",a),Sv(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":et("invalid",a);break;case"textarea":et("invalid",a),kv(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||Ek(a.textContent,u)?(h.popover!=null&&(et("beforetoggle",a),et("toggle",a)),h.onScroll!=null&&et("scroll",a),h.onScrollEnd!=null&&et("scrollend",a),h.onClick!=null&&(a.onclick=Hi),a=!0):a=!1,a||ks(o,!0)}function cS(o){for(wn=o.return;wn;)switch(wn.tag){case 5:case 31:case 13:Lr=!1;return;case 27:case 3:Lr=!0;return;default:wn=wn.return}}function Bl(o){if(o!==wn)return!1;if(!ot)return cS(o),ot=!0,!1;var a=o.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=o.type,u=!(u!=="form"&&u!=="button")||Ay(o.type,o.memoizedProps)),u=!u),u&&Ot&&ks(o),cS(o),a===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Ot=zk(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));Ot=zk(o)}else a===27?(a=Ot,Is(o.type)?(o=Ry,Ry=null,Ot=o):Ot=a):Ot=wn?Ir(o.stateNode.nextSibling):null;return!0}function Oo(){Ot=wn=null,ot=!1}function ug(){var o=ws;return o!==null&&(nr===null?nr=o:nr.push.apply(nr,o),ws=null),o}function vc(o){ws===null?ws=[o]:ws.push(o)}var dg=D(null),_o=null,Fi=null;function Cs(o,a,u){T(dg,a._currentValue),a._currentValue=u}function qi(o){o._currentValue=dg.current,H(dg)}function fg(o,a,u){for(;o!==null;){var h=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),o===u)break;o=o.return}}function hg(o,a,u,h){var y=o.child;for(y!==null&&(y.return=o);y!==null;){var x=y.dependencies;if(x!==null){var S=y.child;x=x.firstContext;e:for(;x!==null;){var A=x;x=y;for(var R=0;R<a.length;R++)if(A.context===a[R]){x.lanes|=u,A=x.alternate,A!==null&&(A.lanes|=u),fg(x.return,u,o),h||(S=null);break e}x=A.next}}else if(y.tag===18){if(S=y.return,S===null)throw Error(r(341));S.lanes|=u,x=S.alternate,x!==null&&(x.lanes|=u),fg(S,u,o),S=null}else S=y.child;if(S!==null)S.return=y;else for(S=y;S!==null;){if(S===o){S=null;break}if(y=S.sibling,y!==null){y.return=S.return,S=y;break}S=S.return}y=S}}function Ul(o,a,u,h){o=null;for(var y=a,x=!1;y!==null;){if(!x){if((y.flags&524288)!==0)x=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var S=y.alternate;if(S===null)throw Error(r(387));if(S=S.memoizedProps,S!==null){var A=y.type;hr(y.pendingProps.value,S.value)||(o!==null?o.push(A):o=[A])}}else if(y===Re.current){if(S=y.alternate,S===null)throw Error(r(387));S.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(o!==null?o.push(Kc):o=[Kc])}y=y.return}o!==null&&hg(a,o,u,h),a.flags|=262144}function $d(o){for(o=o.firstContext;o!==null;){if(!hr(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Do(o){_o=o,Fi=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function kn(o){return uS(_o,o)}function Fd(o,a){return _o===null&&Do(o),uS(o,a)}function uS(o,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},Fi===null){if(o===null)throw Error(r(308));Fi=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else Fi=Fi.next=a;return u}var tN=typeof AbortController<"u"?AbortController:function(){var o=[],a=this.signal={aborted:!1,addEventListener:function(u,h){o.push(h)}};this.abort=function(){a.aborted=!0,o.forEach(function(u){return u()})}},nN=t.unstable_scheduleCallback,rN=t.unstable_NormalPriority,Xt={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pg(){return{controller:new tN,data:new Map,refCount:0}}function Sc(o){o.refCount--,o.refCount===0&&nN(rN,function(){o.controller.abort()})}var wc=null,mg=0,Hl=0,Vl=null;function iN(o,a){if(wc===null){var u=wc=[];mg=0,Hl=by(),Vl={status:"pending",value:void 0,then:function(h){u.push(h)}}}return mg++,a.then(dS,dS),a}function dS(){if(--mg===0&&wc!==null){Vl!==null&&(Vl.status="fulfilled");var o=wc;wc=null,Hl=0,Vl=null;for(var a=0;a<o.length;a++)(0,o[a])()}}function sN(o,a){var u=[],h={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return o.then(function(){h.status="fulfilled",h.value=a;for(var y=0;y<u.length;y++)(0,u[y])(a)},function(y){for(h.status="rejected",h.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),h}var fS=L.S;L.S=function(o,a){Gw=qt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&iN(o,a),fS!==null&&fS(o,a)};var Ro=D(null);function gg(){var o=Ro.current;return o!==null?o:vt.pooledCache}function qd(o,a){a===null?T(Ro,Ro.current):T(Ro,a.pool)}function hS(){var o=gg();return o===null?null:{parent:Xt._currentValue,pool:o}}var Pl=Error(r(460)),yg=Error(r(474)),Yd=Error(r(542)),Kd={then:function(){}};function pS(o){return o=o.status,o==="fulfilled"||o==="rejected"}function mS(o,a,u){switch(u=o[u],u===void 0?o.push(a):u!==a&&(a.then(Hi,Hi),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,yS(o),o;default:if(typeof a.status=="string")a.then(Hi,Hi);else{if(o=vt,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=a,o.status="pending",o.then(function(h){if(a.status==="pending"){var y=a;y.status="fulfilled",y.value=h}},function(h){if(a.status==="pending"){var y=a;y.status="rejected",y.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,yS(o),o}throw zo=a,Pl}}function No(o){try{var a=o._init;return a(o._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(zo=u,Pl):u}}var zo=null;function gS(){if(zo===null)throw Error(r(459));var o=zo;return zo=null,o}function yS(o){if(o===Pl||o===Yd)throw Error(r(483))}var $l=null,kc=0;function Wd(o){var a=kc;return kc+=1,$l===null&&($l=[]),mS($l,o,a)}function Cc(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function Gd(o,a){throw a.$$typeof===g?Error(r(525)):(o=Object.prototype.toString.call(a),Error(r(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o)))}function bS(o){function a(B,z){if(o){var P=B.deletions;P===null?(B.deletions=[z],B.flags|=16):P.push(z)}}function u(B,z){if(!o)return null;for(;z!==null;)a(B,z),z=z.sibling;return null}function h(B){for(var z=new Map;B!==null;)B.key!==null?z.set(B.key,B):z.set(B.index,B),B=B.sibling;return z}function y(B,z){return B=Pi(B,z),B.index=0,B.sibling=null,B}function x(B,z,P){return B.index=P,o?(P=B.alternate,P!==null?(P=P.index,P<z?(B.flags|=67108866,z):P):(B.flags|=67108866,z)):(B.flags|=1048576,z)}function S(B){return o&&B.alternate===null&&(B.flags|=67108866),B}function A(B,z,P,ee){return z===null||z.tag!==6?(z=sg(P,B.mode,ee),z.return=B,z):(z=y(z,P),z.return=B,z)}function R(B,z,P,ee){var Oe=P.type;return Oe===w?X(B,z,P.props.children,ee,P.key):z!==null&&(z.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===Z&&No(Oe)===z.type)?(z=y(z,P.props),Cc(z,P),z.return=B,z):(z=Vd(P.type,P.key,P.props,null,B.mode,ee),Cc(z,P),z.return=B,z)}function $(B,z,P,ee){return z===null||z.tag!==4||z.stateNode.containerInfo!==P.containerInfo||z.stateNode.implementation!==P.implementation?(z=og(P,B.mode,ee),z.return=B,z):(z=y(z,P.children||[]),z.return=B,z)}function X(B,z,P,ee,Oe){return z===null||z.tag!==7?(z=Mo(P,B.mode,ee,Oe),z.return=B,z):(z=y(z,P),z.return=B,z)}function te(B,z,P){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=sg(""+z,B.mode,P),z.return=B,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case b:return P=Vd(z.type,z.key,z.props,null,B.mode,P),Cc(P,z),P.return=B,P;case v:return z=og(z,B.mode,P),z.return=B,z;case Z:return z=No(z),te(B,z,P)}if(U(z)||se(z))return z=Mo(z,B.mode,P,null),z.return=B,z;if(typeof z.then=="function")return te(B,Wd(z),P);if(z.$$typeof===j)return te(B,Fd(B,z),P);Gd(B,z)}return null}function q(B,z,P,ee){var Oe=z!==null?z.key:null;if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return Oe!==null?null:A(B,z,""+P,ee);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case b:return P.key===Oe?R(B,z,P,ee):null;case v:return P.key===Oe?$(B,z,P,ee):null;case Z:return P=No(P),q(B,z,P,ee)}if(U(P)||se(P))return Oe!==null?null:X(B,z,P,ee,null);if(typeof P.then=="function")return q(B,z,Wd(P),ee);if(P.$$typeof===j)return q(B,z,Fd(B,P),ee);Gd(B,P)}return null}function W(B,z,P,ee,Oe){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return B=B.get(P)||null,A(z,B,""+ee,Oe);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case b:return B=B.get(ee.key===null?P:ee.key)||null,R(z,B,ee,Oe);case v:return B=B.get(ee.key===null?P:ee.key)||null,$(z,B,ee,Oe);case Z:return ee=No(ee),W(B,z,P,ee,Oe)}if(U(ee)||se(ee))return B=B.get(P)||null,X(z,B,ee,Oe,null);if(typeof ee.then=="function")return W(B,z,P,Wd(ee),Oe);if(ee.$$typeof===j)return W(B,z,P,Fd(z,ee),Oe);Gd(z,ee)}return null}function ve(B,z,P,ee){for(var Oe=null,at=null,ke=z,Fe=z=0,it=null;ke!==null&&Fe<P.length;Fe++){ke.index>Fe?(it=ke,ke=null):it=ke.sibling;var ct=q(B,ke,P[Fe],ee);if(ct===null){ke===null&&(ke=it);break}o&&ke&&ct.alternate===null&&a(B,ke),z=x(ct,z,Fe),at===null?Oe=ct:at.sibling=ct,at=ct,ke=it}if(Fe===P.length)return u(B,ke),ot&&$i(B,Fe),Oe;if(ke===null){for(;Fe<P.length;Fe++)ke=te(B,P[Fe],ee),ke!==null&&(z=x(ke,z,Fe),at===null?Oe=ke:at.sibling=ke,at=ke);return ot&&$i(B,Fe),Oe}for(ke=h(ke);Fe<P.length;Fe++)it=W(ke,B,Fe,P[Fe],ee),it!==null&&(o&&it.alternate!==null&&ke.delete(it.key===null?Fe:it.key),z=x(it,z,Fe),at===null?Oe=it:at.sibling=it,at=it);return o&&ke.forEach(function(Ps){return a(B,Ps)}),ot&&$i(B,Fe),Oe}function Ne(B,z,P,ee){if(P==null)throw Error(r(151));for(var Oe=null,at=null,ke=z,Fe=z=0,it=null,ct=P.next();ke!==null&&!ct.done;Fe++,ct=P.next()){ke.index>Fe?(it=ke,ke=null):it=ke.sibling;var Ps=q(B,ke,ct.value,ee);if(Ps===null){ke===null&&(ke=it);break}o&&ke&&Ps.alternate===null&&a(B,ke),z=x(Ps,z,Fe),at===null?Oe=Ps:at.sibling=Ps,at=Ps,ke=it}if(ct.done)return u(B,ke),ot&&$i(B,Fe),Oe;if(ke===null){for(;!ct.done;Fe++,ct=P.next())ct=te(B,ct.value,ee),ct!==null&&(z=x(ct,z,Fe),at===null?Oe=ct:at.sibling=ct,at=ct);return ot&&$i(B,Fe),Oe}for(ke=h(ke);!ct.done;Fe++,ct=P.next())ct=W(ke,B,Fe,ct.value,ee),ct!==null&&(o&&ct.alternate!==null&&ke.delete(ct.key===null?Fe:ct.key),z=x(ct,z,Fe),at===null?Oe=ct:at.sibling=ct,at=ct);return o&&ke.forEach(function(gz){return a(B,gz)}),ot&&$i(B,Fe),Oe}function bt(B,z,P,ee){if(typeof P=="object"&&P!==null&&P.type===w&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case b:e:{for(var Oe=P.key;z!==null;){if(z.key===Oe){if(Oe=P.type,Oe===w){if(z.tag===7){u(B,z.sibling),ee=y(z,P.props.children),ee.return=B,B=ee;break e}}else if(z.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===Z&&No(Oe)===z.type){u(B,z.sibling),ee=y(z,P.props),Cc(ee,P),ee.return=B,B=ee;break e}u(B,z);break}else a(B,z);z=z.sibling}P.type===w?(ee=Mo(P.props.children,B.mode,ee,P.key),ee.return=B,B=ee):(ee=Vd(P.type,P.key,P.props,null,B.mode,ee),Cc(ee,P),ee.return=B,B=ee)}return S(B);case v:e:{for(Oe=P.key;z!==null;){if(z.key===Oe)if(z.tag===4&&z.stateNode.containerInfo===P.containerInfo&&z.stateNode.implementation===P.implementation){u(B,z.sibling),ee=y(z,P.children||[]),ee.return=B,B=ee;break e}else{u(B,z);break}else a(B,z);z=z.sibling}ee=og(P,B.mode,ee),ee.return=B,B=ee}return S(B);case Z:return P=No(P),bt(B,z,P,ee)}if(U(P))return ve(B,z,P,ee);if(se(P)){if(Oe=se(P),typeof Oe!="function")throw Error(r(150));return P=Oe.call(P),Ne(B,z,P,ee)}if(typeof P.then=="function")return bt(B,z,Wd(P),ee);if(P.$$typeof===j)return bt(B,z,Fd(B,P),ee);Gd(B,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,z!==null&&z.tag===6?(u(B,z.sibling),ee=y(z,P),ee.return=B,B=ee):(u(B,z),ee=sg(P,B.mode,ee),ee.return=B,B=ee),S(B)):u(B,z)}return function(B,z,P,ee){try{kc=0;var Oe=bt(B,z,P,ee);return $l=null,Oe}catch(ke){if(ke===Pl||ke===Yd)throw ke;var at=pr(29,ke,null,B.mode);return at.lanes=ee,at.return=B,at}finally{}}}var Lo=bS(!0),xS=bS(!1),Es=!1;function bg(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xg(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Ts(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function As(o,a,u){var h=o.updateQueue;if(h===null)return null;if(h=h.shared,(ft&2)!==0){var y=h.pending;return y===null?a.next=a:(a.next=y.next,y.next=a),h.pending=a,a=Hd(o),nS(o,null,u),a}return Ud(o,h,a,u),Hd(o)}function Ec(o,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,uv(o,u)}}function vg(o,a){var u=o.updateQueue,h=o.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var y=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var S={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};x===null?y=x=S:x=x.next=S,u=u.next}while(u!==null);x===null?y=x=a:x=x.next=a}else y=x=a;u={baseState:h.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:h.shared,callbacks:h.callbacks},o.updateQueue=u;return}o=u.lastBaseUpdate,o===null?u.firstBaseUpdate=a:o.next=a,u.lastBaseUpdate=a}var Sg=!1;function Tc(){if(Sg){var o=Vl;if(o!==null)throw o}}function Ac(o,a,u,h){Sg=!1;var y=o.updateQueue;Es=!1;var x=y.firstBaseUpdate,S=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var R=A,$=R.next;R.next=null,S===null?x=$:S.next=$,S=R;var X=o.alternate;X!==null&&(X=X.updateQueue,A=X.lastBaseUpdate,A!==S&&(A===null?X.firstBaseUpdate=$:A.next=$,X.lastBaseUpdate=R))}if(x!==null){var te=y.baseState;S=0,X=$=R=null,A=x;do{var q=A.lane&-536870913,W=q!==A.lane;if(W?(rt&q)===q:(h&q)===q){q!==0&&q===Hl&&(Sg=!0),X!==null&&(X=X.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var ve=o,Ne=A;q=a;var bt=u;switch(Ne.tag){case 1:if(ve=Ne.payload,typeof ve=="function"){te=ve.call(bt,te,q);break e}te=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=Ne.payload,q=typeof ve=="function"?ve.call(bt,te,q):ve,q==null)break e;te=m({},te,q);break e;case 2:Es=!0}}q=A.callback,q!==null&&(o.flags|=64,W&&(o.flags|=8192),W=y.callbacks,W===null?y.callbacks=[q]:W.push(q))}else W={lane:q,tag:A.tag,payload:A.payload,callback:A.callback,next:null},X===null?($=X=W,R=te):X=X.next=W,S|=q;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;W=A,A=W.next,W.next=null,y.lastBaseUpdate=W,y.shared.pending=null}}while(!0);X===null&&(R=te),y.baseState=R,y.firstBaseUpdate=$,y.lastBaseUpdate=X,x===null&&(y.shared.lanes=0),Rs|=S,o.lanes=S,o.memoizedState=te}}function vS(o,a){if(typeof o!="function")throw Error(r(191,o));o.call(a)}function SS(o,a){var u=o.callbacks;if(u!==null)for(o.callbacks=null,o=0;o<u.length;o++)vS(u[o],a)}var Fl=D(null),Zd=D(0);function wS(o,a){o=es,T(Zd,o),T(Fl,a),es=o|a.baseLanes}function wg(){T(Zd,es),T(Fl,Fl.current)}function kg(){es=Zd.current,H(Fl),H(Zd)}var mr=D(null),jr=null;function Ms(o){var a=o.alternate;T(Kt,Kt.current&1),T(mr,o),jr===null&&(a===null||Fl.current!==null||a.memoizedState!==null)&&(jr=o)}function Cg(o){T(Kt,Kt.current),T(mr,o),jr===null&&(jr=o)}function kS(o){o.tag===22?(T(Kt,Kt.current),T(mr,o),jr===null&&(jr=o)):Os()}function Os(){T(Kt,Kt.current),T(mr,mr.current)}function gr(o){H(mr),jr===o&&(jr=null),H(Kt)}var Kt=D(0);function Jd(o){for(var a=o;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||_y(u)||Dy(u)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Yi=0,$e=null,gt=null,Qt=null,Xd=!1,ql=!1,jo=!1,Qd=0,Mc=0,Yl=null,oN=0;function It(){throw Error(r(321))}function Eg(o,a){if(a===null)return!1;for(var u=0;u<a.length&&u<o.length;u++)if(!hr(o[u],a[u]))return!1;return!0}function Tg(o,a,u,h,y,x){return Yi=x,$e=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,L.H=o===null||o.memoizedState===null?ow:Vg,jo=!1,x=u(h,y),jo=!1,ql&&(x=ES(a,u,h,y)),CS(o),x}function CS(o){L.H=Dc;var a=gt!==null&>.next!==null;if(Yi=0,Qt=gt=$e=null,Xd=!1,Mc=0,Yl=null,a)throw Error(r(300));o===null||en||(o=o.dependencies,o!==null&&$d(o)&&(en=!0))}function ES(o,a,u,h){$e=o;var y=0;do{if(ql&&(Yl=null),Mc=0,ql=!1,25<=y)throw Error(r(301));if(y+=1,Qt=gt=null,o.updateQueue!=null){var x=o.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}L.H=lw,x=a(u,h)}while(ql);return x}function lN(){var o=L.H,a=o.useState()[0];return a=typeof a.then=="function"?Oc(a):a,o=o.useState()[0],(gt!==null?gt.memoizedState:null)!==o&&($e.flags|=1024),a}function Ag(){var o=Qd!==0;return Qd=0,o}function Mg(o,a,u){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~u}function Og(o){if(Xd){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}Xd=!1}Yi=0,Qt=gt=$e=null,ql=!1,Mc=Qd=0,Yl=null}function $n(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qt===null?$e.memoizedState=Qt=o:Qt=Qt.next=o,Qt}function Wt(){if(gt===null){var o=$e.alternate;o=o!==null?o.memoizedState:null}else o=gt.next;var a=Qt===null?$e.memoizedState:Qt.next;if(a!==null)Qt=a,gt=o;else{if(o===null)throw $e.alternate===null?Error(r(467)):Error(r(310));gt=o,o={memoizedState:gt.memoizedState,baseState:gt.baseState,baseQueue:gt.baseQueue,queue:gt.queue,next:null},Qt===null?$e.memoizedState=Qt=o:Qt=Qt.next=o}return Qt}function ef(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Oc(o){var a=Mc;return Mc+=1,Yl===null&&(Yl=[]),o=mS(Yl,o,a),a=$e,(Qt===null?a.memoizedState:Qt.next)===null&&(a=a.alternate,L.H=a===null||a.memoizedState===null?ow:Vg),o}function tf(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Oc(o);if(o.$$typeof===j)return kn(o)}throw Error(r(438,String(o)))}function _g(o){var a=null,u=$e.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var h=$e.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(y){return y.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=ef(),$e.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(o),h=0;h<o;h++)u[h]=ce;return a.index++,u}function Ki(o,a){return typeof a=="function"?a(o):a}function nf(o){var a=Wt();return Dg(a,gt,o)}function Dg(o,a,u){var h=o.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=u;var y=o.baseQueue,x=h.pending;if(x!==null){if(y!==null){var S=y.next;y.next=x.next,x.next=S}a.baseQueue=y=x,h.pending=null}if(x=o.baseState,y===null)o.memoizedState=x;else{a=y.next;var A=S=null,R=null,$=a,X=!1;do{var te=$.lane&-536870913;if(te!==$.lane?(rt&te)===te:(Yi&te)===te){var q=$.revertLane;if(q===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null}),te===Hl&&(X=!0);else if((Yi&q)===q){$=$.next,q===Hl&&(X=!0);continue}else te={lane:0,revertLane:$.revertLane,gesture:null,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},R===null?(A=R=te,S=x):R=R.next=te,$e.lanes|=q,Rs|=q;te=$.action,jo&&u(x,te),x=$.hasEagerState?$.eagerState:u(x,te)}else q={lane:te,revertLane:$.revertLane,gesture:$.gesture,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},R===null?(A=R=q,S=x):R=R.next=q,$e.lanes|=te,Rs|=te;$=$.next}while($!==null&&$!==a);if(R===null?S=x:R.next=A,!hr(x,o.memoizedState)&&(en=!0,X&&(u=Vl,u!==null)))throw u;o.memoizedState=x,o.baseState=S,o.baseQueue=R,h.lastRenderedState=x}return y===null&&(h.lanes=0),[o.memoizedState,h.dispatch]}function Rg(o){var a=Wt(),u=a.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=o;var h=u.dispatch,y=u.pending,x=a.memoizedState;if(y!==null){u.pending=null;var S=y=y.next;do x=o(x,S.action),S=S.next;while(S!==y);hr(x,a.memoizedState)||(en=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),u.lastRenderedState=x}return[x,h]}function TS(o,a,u){var h=$e,y=Wt(),x=ot;if(x){if(u===void 0)throw Error(r(407));u=u()}else u=a();var S=!hr((gt||y).memoizedState,u);if(S&&(y.memoizedState=u,en=!0),y=y.queue,Lg(OS.bind(null,h,y,o),[o]),y.getSnapshot!==a||S||Qt!==null&&Qt.memoizedState.tag&1){if(h.flags|=2048,Kl(9,{destroy:void 0},MS.bind(null,h,y,u,a),null),vt===null)throw Error(r(349));x||(Yi&127)!==0||AS(h,a,u)}return u}function AS(o,a,u){o.flags|=16384,o={getSnapshot:a,value:u},a=$e.updateQueue,a===null?(a=ef(),$e.updateQueue=a,a.stores=[o]):(u=a.stores,u===null?a.stores=[o]:u.push(o))}function MS(o,a,u,h){a.value=u,a.getSnapshot=h,_S(a)&&DS(o)}function OS(o,a,u){return u(function(){_S(a)&&DS(o)})}function _S(o){var a=o.getSnapshot;o=o.value;try{var u=a();return!hr(o,u)}catch{return!0}}function DS(o){var a=Ao(o,2);a!==null&&rr(a,o,2)}function Ng(o){var a=$n();if(typeof o=="function"){var u=o;if(o=u(),jo){nt(!0);try{u()}finally{nt(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:o},a}function RS(o,a,u,h){return o.baseState=u,Dg(o,gt,typeof h=="function"?h:Ki)}function aN(o,a,u,h,y){if(of(o))throw Error(r(485));if(o=a.action,o!==null){var x={payload:y,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){x.listeners.push(S)}};L.T!==null?u(!0):x.isTransition=!1,h(x),u=a.pending,u===null?(x.next=a.pending=x,NS(a,x)):(x.next=u.next,a.pending=u.next=x)}}function NS(o,a){var u=a.action,h=a.payload,y=o.state;if(a.isTransition){var x=L.T,S={};L.T=S;try{var A=u(y,h),R=L.S;R!==null&&R(S,A),zS(o,a,A)}catch($){zg(o,a,$)}finally{x!==null&&S.types!==null&&(x.types=S.types),L.T=x}}else try{x=u(y,h),zS(o,a,x)}catch($){zg(o,a,$)}}function zS(o,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(h){LS(o,a,h)},function(h){return zg(o,a,h)}):LS(o,a,u)}function LS(o,a,u){a.status="fulfilled",a.value=u,jS(a),o.state=u,a=o.pending,a!==null&&(u=a.next,u===a?o.pending=null:(u=u.next,a.next=u,NS(o,u)))}function zg(o,a,u){var h=o.pending;if(o.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=u,jS(a),a=a.next;while(a!==h)}o.action=null}function jS(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function IS(o,a){return a}function BS(o,a){if(ot){var u=vt.formState;if(u!==null){e:{var h=$e;if(ot){if(Ot){t:{for(var y=Ot,x=Lr;y.nodeType!==8;){if(!x){y=null;break t}if(y=Ir(y.nextSibling),y===null){y=null;break t}}x=y.data,y=x==="F!"||x==="F"?y:null}if(y){Ot=Ir(y.nextSibling),h=y.data==="F!";break e}}ks(h)}h=!1}h&&(a=u[0])}}return u=$n(),u.memoizedState=u.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:IS,lastRenderedState:a},u.queue=h,u=rw.bind(null,$e,h),h.dispatch=u,h=Ng(!1),x=Hg.bind(null,$e,!1,h.queue),h=$n(),y={state:a,dispatch:null,action:o,pending:null},h.queue=y,u=aN.bind(null,$e,y,x,u),y.dispatch=u,h.memoizedState=o,[a,u,!1]}function US(o){var a=Wt();return HS(a,gt,o)}function HS(o,a,u){if(a=Dg(o,a,IS)[0],o=nf(Ki)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=Oc(a)}catch(S){throw S===Pl?Yd:S}else h=a;a=Wt();var y=a.queue,x=y.dispatch;return u!==a.memoizedState&&($e.flags|=2048,Kl(9,{destroy:void 0},cN.bind(null,y,u),null)),[h,x,o]}function cN(o,a){o.action=a}function VS(o){var a=Wt(),u=gt;if(u!==null)return HS(a,u,o);Wt(),a=a.memoizedState,u=Wt();var h=u.queue.dispatch;return u.memoizedState=o,[a,h,!1]}function Kl(o,a,u,h){return o={tag:o,create:u,deps:h,inst:a,next:null},a=$e.updateQueue,a===null&&(a=ef(),$e.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=o.next=o:(h=u.next,u.next=o,o.next=h,a.lastEffect=o),o}function PS(){return Wt().memoizedState}function rf(o,a,u,h){var y=$n();$e.flags|=o,y.memoizedState=Kl(1|a,{destroy:void 0},u,h===void 0?null:h)}function sf(o,a,u,h){var y=Wt();h=h===void 0?null:h;var x=y.memoizedState.inst;gt!==null&&h!==null&&Eg(h,gt.memoizedState.deps)?y.memoizedState=Kl(a,x,u,h):($e.flags|=o,y.memoizedState=Kl(1|a,x,u,h))}function $S(o,a){rf(8390656,8,o,a)}function Lg(o,a){sf(2048,8,o,a)}function uN(o){$e.flags|=4;var a=$e.updateQueue;if(a===null)a=ef(),$e.updateQueue=a,a.events=[o];else{var u=a.events;u===null?a.events=[o]:u.push(o)}}function FS(o){var a=Wt().memoizedState;return uN({ref:a,nextImpl:o}),function(){if((ft&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function qS(o,a){return sf(4,2,o,a)}function YS(o,a){return sf(4,4,o,a)}function KS(o,a){if(typeof a=="function"){o=o();var u=a(o);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function WS(o,a,u){u=u!=null?u.concat([o]):null,sf(4,4,KS.bind(null,a,o),u)}function jg(){}function GS(o,a){var u=Wt();a=a===void 0?null:a;var h=u.memoizedState;return a!==null&&Eg(a,h[1])?h[0]:(u.memoizedState=[o,a],o)}function ZS(o,a){var u=Wt();a=a===void 0?null:a;var h=u.memoizedState;if(a!==null&&Eg(a,h[1]))return h[0];if(h=o(),jo){nt(!0);try{o()}finally{nt(!1)}}return u.memoizedState=[h,a],h}function Ig(o,a,u){return u===void 0||(Yi&1073741824)!==0&&(rt&261930)===0?o.memoizedState=a:(o.memoizedState=u,o=Jw(),$e.lanes|=o,Rs|=o,u)}function JS(o,a,u,h){return hr(u,a)?u:Fl.current!==null?(o=Ig(o,u,h),hr(o,a)||(en=!0),o):(Yi&42)===0||(Yi&1073741824)!==0&&(rt&261930)===0?(en=!0,o.memoizedState=u):(o=Jw(),$e.lanes|=o,Rs|=o,a)}function XS(o,a,u,h,y){var x=G.p;G.p=x!==0&&8>x?x:8;var S=L.T,A={};L.T=A,Hg(o,!1,a,u);try{var R=y(),$=L.S;if($!==null&&$(A,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var X=sN(R,h);_c(o,a,X,xr(o))}else _c(o,a,h,xr(o))}catch(te){_c(o,a,{then:function(){},status:"rejected",reason:te},xr())}finally{G.p=x,S!==null&&A.types!==null&&(S.types=A.types),L.T=S}}function dN(){}function Bg(o,a,u,h){if(o.tag!==5)throw Error(r(476));var y=QS(o).queue;XS(o,y,a,me,u===null?dN:function(){return ew(o),u(h)})}function QS(o){var a=o.memoizedState;if(a!==null)return a;a={memoizedState:me,baseState:me,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:me},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:u},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function ew(o){var a=QS(o);a.next===null&&(a=o.alternate.memoizedState),_c(o,a.next.queue,{},xr())}function Ug(){return kn(Kc)}function tw(){return Wt().memoizedState}function nw(){return Wt().memoizedState}function fN(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var u=xr();o=Ts(u);var h=As(a,o,u);h!==null&&(rr(h,a,u),Ec(h,a,u)),a={cache:pg()},o.payload=a;return}a=a.return}}function hN(o,a,u){var h=xr();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},of(o)?iw(a,u):(u=rg(o,a,u,h),u!==null&&(rr(u,o,h),sw(u,a,h)))}function rw(o,a,u){var h=xr();_c(o,a,u,h)}function _c(o,a,u,h){var y={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(of(o))iw(a,y);else{var x=o.alternate;if(o.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var S=a.lastRenderedState,A=x(S,u);if(y.hasEagerState=!0,y.eagerState=A,hr(A,S))return Ud(o,a,y,0),vt===null&&Bd(),!1}catch{}finally{}if(u=rg(o,a,y,h),u!==null)return rr(u,o,h),sw(u,a,h),!0}return!1}function Hg(o,a,u,h){if(h={lane:2,revertLane:by(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},of(o)){if(a)throw Error(r(479))}else a=rg(o,u,h,2),a!==null&&rr(a,o,2)}function of(o){var a=o.alternate;return o===$e||a!==null&&a===$e}function iw(o,a){ql=Xd=!0;var u=o.pending;u===null?a.next=a:(a.next=u.next,u.next=a),o.pending=a}function sw(o,a,u){if((u&4194048)!==0){var h=a.lanes;h&=o.pendingLanes,u|=h,a.lanes=u,uv(o,u)}}var Dc={readContext:kn,use:tf,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useLayoutEffect:It,useInsertionEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useSyncExternalStore:It,useId:It,useHostTransitionStatus:It,useFormState:It,useActionState:It,useOptimistic:It,useMemoCache:It,useCacheRefresh:It};Dc.useEffectEvent=It;var ow={readContext:kn,use:tf,useCallback:function(o,a){return $n().memoizedState=[o,a===void 0?null:a],o},useContext:kn,useEffect:$S,useImperativeHandle:function(o,a,u){u=u!=null?u.concat([o]):null,rf(4194308,4,KS.bind(null,a,o),u)},useLayoutEffect:function(o,a){return rf(4194308,4,o,a)},useInsertionEffect:function(o,a){rf(4,2,o,a)},useMemo:function(o,a){var u=$n();a=a===void 0?null:a;var h=o();if(jo){nt(!0);try{o()}finally{nt(!1)}}return u.memoizedState=[h,a],h},useReducer:function(o,a,u){var h=$n();if(u!==void 0){var y=u(a);if(jo){nt(!0);try{u(a)}finally{nt(!1)}}}else y=a;return h.memoizedState=h.baseState=y,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:y},h.queue=o,o=o.dispatch=hN.bind(null,$e,o),[h.memoizedState,o]},useRef:function(o){var a=$n();return o={current:o},a.memoizedState=o},useState:function(o){o=Ng(o);var a=o.queue,u=rw.bind(null,$e,a);return a.dispatch=u,[o.memoizedState,u]},useDebugValue:jg,useDeferredValue:function(o,a){var u=$n();return Ig(u,o,a)},useTransition:function(){var o=Ng(!1);return o=XS.bind(null,$e,o.queue,!0,!1),$n().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,u){var h=$e,y=$n();if(ot){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),vt===null)throw Error(r(349));(rt&127)!==0||AS(h,a,u)}y.memoizedState=u;var x={value:u,getSnapshot:a};return y.queue=x,$S(OS.bind(null,h,x,o),[o]),h.flags|=2048,Kl(9,{destroy:void 0},MS.bind(null,h,x,u,a),null),u},useId:function(){var o=$n(),a=vt.identifierPrefix;if(ot){var u=mi,h=pi;u=(h&~(1<<32-Ge(h)-1)).toString(32)+u,a="_"+a+"R_"+u,u=Qd++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=oN++,a="_"+a+"r_"+u.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:Ug,useFormState:BS,useActionState:BS,useOptimistic:function(o){var a=$n();a.memoizedState=a.baseState=o;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=Hg.bind(null,$e,!0,u),u.dispatch=a,[o,a]},useMemoCache:_g,useCacheRefresh:function(){return $n().memoizedState=fN.bind(null,$e)},useEffectEvent:function(o){var a=$n(),u={impl:o};return a.memoizedState=u,function(){if((ft&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},Vg={readContext:kn,use:tf,useCallback:GS,useContext:kn,useEffect:Lg,useImperativeHandle:WS,useInsertionEffect:qS,useLayoutEffect:YS,useMemo:ZS,useReducer:nf,useRef:PS,useState:function(){return nf(Ki)},useDebugValue:jg,useDeferredValue:function(o,a){var u=Wt();return JS(u,gt.memoizedState,o,a)},useTransition:function(){var o=nf(Ki)[0],a=Wt().memoizedState;return[typeof o=="boolean"?o:Oc(o),a]},useSyncExternalStore:TS,useId:tw,useHostTransitionStatus:Ug,useFormState:US,useActionState:US,useOptimistic:function(o,a){var u=Wt();return RS(u,gt,o,a)},useMemoCache:_g,useCacheRefresh:nw};Vg.useEffectEvent=FS;var lw={readContext:kn,use:tf,useCallback:GS,useContext:kn,useEffect:Lg,useImperativeHandle:WS,useInsertionEffect:qS,useLayoutEffect:YS,useMemo:ZS,useReducer:Rg,useRef:PS,useState:function(){return Rg(Ki)},useDebugValue:jg,useDeferredValue:function(o,a){var u=Wt();return gt===null?Ig(u,o,a):JS(u,gt.memoizedState,o,a)},useTransition:function(){var o=Rg(Ki)[0],a=Wt().memoizedState;return[typeof o=="boolean"?o:Oc(o),a]},useSyncExternalStore:TS,useId:tw,useHostTransitionStatus:Ug,useFormState:VS,useActionState:VS,useOptimistic:function(o,a){var u=Wt();return gt!==null?RS(u,gt,o,a):(u.baseState=o,[o,u.queue.dispatch])},useMemoCache:_g,useCacheRefresh:nw};lw.useEffectEvent=FS;function Pg(o,a,u,h){a=o.memoizedState,u=u(h,a),u=u==null?a:m({},a,u),o.memoizedState=u,o.lanes===0&&(o.updateQueue.baseState=u)}var $g={enqueueSetState:function(o,a,u){o=o._reactInternals;var h=xr(),y=Ts(h);y.payload=a,u!=null&&(y.callback=u),a=As(o,y,h),a!==null&&(rr(a,o,h),Ec(a,o,h))},enqueueReplaceState:function(o,a,u){o=o._reactInternals;var h=xr(),y=Ts(h);y.tag=1,y.payload=a,u!=null&&(y.callback=u),a=As(o,y,h),a!==null&&(rr(a,o,h),Ec(a,o,h))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var u=xr(),h=Ts(u);h.tag=2,a!=null&&(h.callback=a),a=As(o,h,u),a!==null&&(rr(a,o,u),Ec(a,o,u))}};function aw(o,a,u,h,y,x,S){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(h,x,S):a.prototype&&a.prototype.isPureReactComponent?!yc(u,h)||!yc(y,x):!0}function cw(o,a,u,h){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,h),a.state!==o&&$g.enqueueReplaceState(a,a.state,null)}function Io(o,a){var u=a;if("ref"in a){u={};for(var h in a)h!=="ref"&&(u[h]=a[h])}if(o=o.defaultProps){u===a&&(u=m({},u));for(var y in o)u[y]===void 0&&(u[y]=o[y])}return u}function uw(o){Id(o)}function dw(o){console.error(o)}function fw(o){Id(o)}function lf(o,a){try{var u=o.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function hw(o,a,u){try{var h=o.onCaughtError;h(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Fg(o,a,u){return u=Ts(u),u.tag=3,u.payload={element:null},u.callback=function(){lf(o,a)},u}function pw(o){return o=Ts(o),o.tag=3,o}function mw(o,a,u,h){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var x=h.value;o.payload=function(){return y(x)},o.callback=function(){hw(a,u,h)}}var S=u.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(o.callback=function(){hw(a,u,h),typeof y!="function"&&(Ns===null?Ns=new Set([this]):Ns.add(this));var A=h.stack;this.componentDidCatch(h.value,{componentStack:A!==null?A:""})})}function pN(o,a,u,h,y){if(u.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=u.alternate,a!==null&&Ul(a,u,y,!0),u=mr.current,u!==null){switch(u.tag){case 31:case 13:return jr===null?xf():u.alternate===null&&Bt===0&&(Bt=3),u.flags&=-257,u.flags|=65536,u.lanes=y,h===Kd?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([h]):a.add(h),my(o,h,y)),!1;case 22:return u.flags|=65536,h===Kd?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)),my(o,h,y)),!1}throw Error(r(435,u.tag))}return my(o,h,y),xf(),!1}if(ot)return a=mr.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=y,h!==cg&&(o=Error(r(422),{cause:h}),vc(Rr(o,u)))):(h!==cg&&(a=Error(r(423),{cause:h}),vc(Rr(a,u))),o=o.current.alternate,o.flags|=65536,y&=-y,o.lanes|=y,h=Rr(h,u),y=Fg(o.stateNode,h,y),vg(o,y),Bt!==4&&(Bt=2)),!1;var x=Error(r(520),{cause:h});if(x=Rr(x,u),Uc===null?Uc=[x]:Uc.push(x),Bt!==4&&(Bt=2),a===null)return!0;h=Rr(h,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,o=y&-y,u.lanes|=o,o=Fg(u.stateNode,h,o),vg(u,o),!1;case 1:if(a=u.type,x=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Ns===null||!Ns.has(x))))return u.flags|=65536,y&=-y,u.lanes|=y,y=pw(y),mw(y,o,u,h),vg(u,y),!1}u=u.return}while(u!==null);return!1}var qg=Error(r(461)),en=!1;function Cn(o,a,u,h){a.child=o===null?xS(a,null,u,h):Lo(a,o.child,u,h)}function gw(o,a,u,h,y){u=u.render;var x=a.ref;if("ref"in h){var S={};for(var A in h)A!=="ref"&&(S[A]=h[A])}else S=h;return Do(a),h=Tg(o,a,u,S,x,y),A=Ag(),o!==null&&!en?(Mg(o,a,y),Wi(o,a,y)):(ot&&A&&lg(a),a.flags|=1,Cn(o,a,h,y),a.child)}function yw(o,a,u,h,y){if(o===null){var x=u.type;return typeof x=="function"&&!ig(x)&&x.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=x,bw(o,a,x,h,y)):(o=Vd(u.type,null,h,a,a.mode,y),o.ref=a.ref,o.return=a,a.child=o)}if(x=o.child,!Qg(o,y)){var S=x.memoizedProps;if(u=u.compare,u=u!==null?u:yc,u(S,h)&&o.ref===a.ref)return Wi(o,a,y)}return a.flags|=1,o=Pi(x,h),o.ref=a.ref,o.return=a,a.child=o}function bw(o,a,u,h,y){if(o!==null){var x=o.memoizedProps;if(yc(x,h)&&o.ref===a.ref)if(en=!1,a.pendingProps=h=x,Qg(o,y))(o.flags&131072)!==0&&(en=!0);else return a.lanes=o.lanes,Wi(o,a,y)}return Yg(o,a,u,h,y)}function xw(o,a,u,h){var y=h.children,x=o!==null?o.memoizedState:null;if(o===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|u:u,o!==null){for(h=a.child=o.child,y=0;h!==null;)y=y|h.lanes|h.childLanes,h=h.sibling;h=y&~x}else h=0,a.child=null;return vw(o,a,x,u,h)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},o!==null&&qd(a,x!==null?x.cachePool:null),x!==null?wS(a,x):wg(),kS(a);else return h=a.lanes=536870912,vw(o,a,x!==null?x.baseLanes|u:u,u,h)}else x!==null?(qd(a,x.cachePool),wS(a,x),Os(),a.memoizedState=null):(o!==null&&qd(a,null),wg(),Os());return Cn(o,a,y,u),a.child}function Rc(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function vw(o,a,u,h,y){var x=gg();return x=x===null?null:{parent:Xt._currentValue,pool:x},a.memoizedState={baseLanes:u,cachePool:x},o!==null&&qd(a,null),wg(),kS(a),o!==null&&Ul(o,a,h,!0),a.childLanes=y,null}function af(o,a){return a=uf({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function Sw(o,a,u){return Lo(a,o.child,null,u),o=af(a,a.pendingProps),o.flags|=2,gr(a),a.memoizedState=null,o}function mN(o,a,u){var h=a.pendingProps,y=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(ot){if(h.mode==="hidden")return o=af(a,h),a.lanes=536870912,Rc(null,o);if(Cg(a),(o=Ot)?(o=Nk(o,Lr),o=o!==null&&o.data==="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:Ss!==null?{id:pi,overflow:mi}:null,retryLane:536870912,hydrationErrors:null},u=iS(o),u.return=a,a.child=u,wn=a,Ot=null)):o=null,o===null)throw ks(a);return a.lanes=536870912,null}return af(a,h)}var x=o.memoizedState;if(x!==null){var S=x.dehydrated;if(Cg(a),y)if(a.flags&256)a.flags&=-257,a=Sw(o,a,u);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(r(558));else if(en||Ul(o,a,u,!1),y=(u&o.childLanes)!==0,en||y){if(h=vt,h!==null&&(S=dv(h,u),S!==0&&S!==x.retryLane))throw x.retryLane=S,Ao(o,S),rr(h,o,S),qg;xf(),a=Sw(o,a,u)}else o=x.treeContext,Ot=Ir(S.nextSibling),wn=a,ot=!0,ws=null,Lr=!1,o!==null&&lS(a,o),a=af(a,h),a.flags|=4096;return a}return o=Pi(o.child,{mode:h.mode,children:h.children}),o.ref=a.ref,a.child=o,o.return=a,o}function cf(o,a){var u=a.ref;if(u===null)o!==null&&o.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(o===null||o.ref!==u)&&(a.flags|=4194816)}}function Yg(o,a,u,h,y){return Do(a),u=Tg(o,a,u,h,void 0,y),h=Ag(),o!==null&&!en?(Mg(o,a,y),Wi(o,a,y)):(ot&&h&&lg(a),a.flags|=1,Cn(o,a,u,y),a.child)}function ww(o,a,u,h,y,x){return Do(a),a.updateQueue=null,u=ES(a,h,u,y),CS(o),h=Ag(),o!==null&&!en?(Mg(o,a,x),Wi(o,a,x)):(ot&&h&&lg(a),a.flags|=1,Cn(o,a,u,x),a.child)}function kw(o,a,u,h,y){if(Do(a),a.stateNode===null){var x=Ll,S=u.contextType;typeof S=="object"&&S!==null&&(x=kn(S)),x=new u(h,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=$g,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=h,x.state=a.memoizedState,x.refs={},bg(a),S=u.contextType,x.context=typeof S=="object"&&S!==null?kn(S):Ll,x.state=a.memoizedState,S=u.getDerivedStateFromProps,typeof S=="function"&&(Pg(a,u,S,h),x.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(S=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),S!==x.state&&$g.enqueueReplaceState(x,x.state,null),Ac(a,h,x,y),Tc(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(o===null){x=a.stateNode;var A=a.memoizedProps,R=Io(u,A);x.props=R;var $=x.context,X=u.contextType;S=Ll,typeof X=="object"&&X!==null&&(S=kn(X));var te=u.getDerivedStateFromProps;X=typeof te=="function"||typeof x.getSnapshotBeforeUpdate=="function",A=a.pendingProps!==A,X||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(A||$!==S)&&cw(a,x,h,S),Es=!1;var q=a.memoizedState;x.state=q,Ac(a,h,x,y),Tc(),$=a.memoizedState,A||q!==$||Es?(typeof te=="function"&&(Pg(a,u,te,h),$=a.memoizedState),(R=Es||aw(a,u,R,h,q,$,S))?(X||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=$),x.props=h,x.state=$,x.context=S,h=R):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{x=a.stateNode,xg(o,a),S=a.memoizedProps,X=Io(u,S),x.props=X,te=a.pendingProps,q=x.context,$=u.contextType,R=Ll,typeof $=="object"&&$!==null&&(R=kn($)),A=u.getDerivedStateFromProps,($=typeof A=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(S!==te||q!==R)&&cw(a,x,h,R),Es=!1,q=a.memoizedState,x.state=q,Ac(a,h,x,y),Tc();var W=a.memoizedState;S!==te||q!==W||Es||o!==null&&o.dependencies!==null&&$d(o.dependencies)?(typeof A=="function"&&(Pg(a,u,A,h),W=a.memoizedState),(X=Es||aw(a,u,X,h,q,W,R)||o!==null&&o.dependencies!==null&&$d(o.dependencies))?($||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(h,W,R),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(h,W,R)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||S===o.memoizedProps&&q===o.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||S===o.memoizedProps&&q===o.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=W),x.props=h,x.state=W,x.context=R,h=X):(typeof x.componentDidUpdate!="function"||S===o.memoizedProps&&q===o.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||S===o.memoizedProps&&q===o.memoizedState||(a.flags|=1024),h=!1)}return x=h,cf(o,a),h=(a.flags&128)!==0,x||h?(x=a.stateNode,u=h&&typeof u.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,o!==null&&h?(a.child=Lo(a,o.child,null,y),a.child=Lo(a,null,u,y)):Cn(o,a,u,y),a.memoizedState=x.state,o=a.child):o=Wi(o,a,y),o}function Cw(o,a,u,h){return Oo(),a.flags|=256,Cn(o,a,u,h),a.child}var Kg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wg(o){return{baseLanes:o,cachePool:hS()}}function Gg(o,a,u){return o=o!==null?o.childLanes&~u:0,a&&(o|=br),o}function Ew(o,a,u){var h=a.pendingProps,y=!1,x=(a.flags&128)!==0,S;if((S=x)||(S=o!==null&&o.memoizedState===null?!1:(Kt.current&2)!==0),S&&(y=!0,a.flags&=-129),S=(a.flags&32)!==0,a.flags&=-33,o===null){if(ot){if(y?Ms(a):Os(),(o=Ot)?(o=Nk(o,Lr),o=o!==null&&o.data!=="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:Ss!==null?{id:pi,overflow:mi}:null,retryLane:536870912,hydrationErrors:null},u=iS(o),u.return=a,a.child=u,wn=a,Ot=null)):o=null,o===null)throw ks(a);return Dy(o)?a.lanes=32:a.lanes=536870912,null}var A=h.children;return h=h.fallback,y?(Os(),y=a.mode,A=uf({mode:"hidden",children:A},y),h=Mo(h,y,u,null),A.return=a,h.return=a,A.sibling=h,a.child=A,h=a.child,h.memoizedState=Wg(u),h.childLanes=Gg(o,S,u),a.memoizedState=Kg,Rc(null,h)):(Ms(a),Zg(a,A))}var R=o.memoizedState;if(R!==null&&(A=R.dehydrated,A!==null)){if(x)a.flags&256?(Ms(a),a.flags&=-257,a=Jg(o,a,u)):a.memoizedState!==null?(Os(),a.child=o.child,a.flags|=128,a=null):(Os(),A=h.fallback,y=a.mode,h=uf({mode:"visible",children:h.children},y),A=Mo(A,y,u,null),A.flags|=2,h.return=a,A.return=a,h.sibling=A,a.child=h,Lo(a,o.child,null,u),h=a.child,h.memoizedState=Wg(u),h.childLanes=Gg(o,S,u),a.memoizedState=Kg,a=Rc(null,h));else if(Ms(a),Dy(A)){if(S=A.nextSibling&&A.nextSibling.dataset,S)var $=S.dgst;S=$,h=Error(r(419)),h.stack="",h.digest=S,vc({value:h,source:null,stack:null}),a=Jg(o,a,u)}else if(en||Ul(o,a,u,!1),S=(u&o.childLanes)!==0,en||S){if(S=vt,S!==null&&(h=dv(S,u),h!==0&&h!==R.retryLane))throw R.retryLane=h,Ao(o,h),rr(S,o,h),qg;_y(A)||xf(),a=Jg(o,a,u)}else _y(A)?(a.flags|=192,a.child=o.child,a=null):(o=R.treeContext,Ot=Ir(A.nextSibling),wn=a,ot=!0,ws=null,Lr=!1,o!==null&&lS(a,o),a=Zg(a,h.children),a.flags|=4096);return a}return y?(Os(),A=h.fallback,y=a.mode,R=o.child,$=R.sibling,h=Pi(R,{mode:"hidden",children:h.children}),h.subtreeFlags=R.subtreeFlags&65011712,$!==null?A=Pi($,A):(A=Mo(A,y,u,null),A.flags|=2),A.return=a,h.return=a,h.sibling=A,a.child=h,Rc(null,h),h=a.child,A=o.child.memoizedState,A===null?A=Wg(u):(y=A.cachePool,y!==null?(R=Xt._currentValue,y=y.parent!==R?{parent:R,pool:R}:y):y=hS(),A={baseLanes:A.baseLanes|u,cachePool:y}),h.memoizedState=A,h.childLanes=Gg(o,S,u),a.memoizedState=Kg,Rc(o.child,h)):(Ms(a),u=o.child,o=u.sibling,u=Pi(u,{mode:"visible",children:h.children}),u.return=a,u.sibling=null,o!==null&&(S=a.deletions,S===null?(a.deletions=[o],a.flags|=16):S.push(o)),a.child=u,a.memoizedState=null,u)}function Zg(o,a){return a=uf({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function uf(o,a){return o=pr(22,o,null,a),o.lanes=0,o}function Jg(o,a,u){return Lo(a,o.child,null,u),o=Zg(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function Tw(o,a,u){o.lanes|=a;var h=o.alternate;h!==null&&(h.lanes|=a),fg(o.return,a,u)}function Xg(o,a,u,h,y,x){var S=o.memoizedState;S===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:u,tailMode:y,treeForkCount:x}:(S.isBackwards=a,S.rendering=null,S.renderingStartTime=0,S.last=h,S.tail=u,S.tailMode=y,S.treeForkCount=x)}function Aw(o,a,u){var h=a.pendingProps,y=h.revealOrder,x=h.tail;h=h.children;var S=Kt.current,A=(S&2)!==0;if(A?(S=S&1|2,a.flags|=128):S&=1,T(Kt,S),Cn(o,a,h,u),h=ot?xc:0,!A&&o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Tw(o,u,a);else if(o.tag===19)Tw(o,u,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break e;for(;o.sibling===null;){if(o.return===null||o.return===a)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(y){case"forwards":for(u=a.child,y=null;u!==null;)o=u.alternate,o!==null&&Jd(o)===null&&(y=u),u=u.sibling;u=y,u===null?(y=a.child,a.child=null):(y=u.sibling,u.sibling=null),Xg(a,!1,y,u,x,h);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=a.child,a.child=null;y!==null;){if(o=y.alternate,o!==null&&Jd(o)===null){a.child=y;break}o=y.sibling,y.sibling=u,u=y,y=o}Xg(a,!0,u,null,x,h);break;case"together":Xg(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function Wi(o,a,u){if(o!==null&&(a.dependencies=o.dependencies),Rs|=a.lanes,(u&a.childLanes)===0)if(o!==null){if(Ul(o,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(o!==null&&a.child!==o.child)throw Error(r(153));if(a.child!==null){for(o=a.child,u=Pi(o,o.pendingProps),a.child=u,u.return=a;o.sibling!==null;)o=o.sibling,u=u.sibling=Pi(o,o.pendingProps),u.return=a;u.sibling=null}return a.child}function Qg(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&$d(o)))}function gN(o,a,u){switch(a.tag){case 3:Be(a,a.stateNode.containerInfo),Cs(a,Xt,o.memoizedState.cache),Oo();break;case 27:case 5:Xe(a);break;case 4:Be(a,a.stateNode.containerInfo);break;case 10:Cs(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Cg(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(Ms(a),a.flags|=128,null):(u&a.child.childLanes)!==0?Ew(o,a,u):(Ms(a),o=Wi(o,a,u),o!==null?o.sibling:null);Ms(a);break;case 19:var y=(o.flags&128)!==0;if(h=(u&a.childLanes)!==0,h||(Ul(o,a,u,!1),h=(u&a.childLanes)!==0),y){if(h)return Aw(o,a,u);a.flags|=128}if(y=a.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),T(Kt,Kt.current),h)break;return null;case 22:return a.lanes=0,xw(o,a,u,a.pendingProps);case 24:Cs(a,Xt,o.memoizedState.cache)}return Wi(o,a,u)}function Mw(o,a,u){if(o!==null)if(o.memoizedProps!==a.pendingProps)en=!0;else{if(!Qg(o,u)&&(a.flags&128)===0)return en=!1,gN(o,a,u);en=(o.flags&131072)!==0}else en=!1,ot&&(a.flags&1048576)!==0&&oS(a,xc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(o=No(a.elementType),a.type=o,typeof o=="function")ig(o)?(h=Io(o,h),a.tag=1,a=kw(null,a,o,h,u)):(a.tag=0,a=Yg(null,a,o,h,u));else{if(o!=null){var y=o.$$typeof;if(y===Q){a.tag=11,a=gw(null,a,o,h,u);break e}else if(y===N){a.tag=14,a=yw(null,a,o,h,u);break e}}throw a=pe(o)||o,Error(r(306,a,""))}}return a;case 0:return Yg(o,a,a.type,a.pendingProps,u);case 1:return h=a.type,y=Io(h,a.pendingProps),kw(o,a,h,y,u);case 3:e:{if(Be(a,a.stateNode.containerInfo),o===null)throw Error(r(387));h=a.pendingProps;var x=a.memoizedState;y=x.element,xg(o,a),Ac(a,h,null,u);var S=a.memoizedState;if(h=S.cache,Cs(a,Xt,h),h!==x.cache&&hg(a,[Xt],u,!0),Tc(),h=S.element,x.isDehydrated)if(x={element:h,isDehydrated:!1,cache:S.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=Cw(o,a,h,u);break e}else if(h!==y){y=Rr(Error(r(424)),a),vc(y),a=Cw(o,a,h,u);break e}else{switch(o=a.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for(Ot=Ir(o.firstChild),wn=a,ot=!0,ws=null,Lr=!0,u=xS(a,null,h,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(Oo(),h===y){a=Wi(o,a,u);break e}Cn(o,a,h,u)}a=a.child}return a;case 26:return cf(o,a),o===null?(u=Uk(a.type,null,a.pendingProps,null))?a.memoizedState=u:ot||(u=a.type,o=a.pendingProps,h=Tf(le.current).createElement(u),h[Sn]=a,h[Jn]=o,En(h,u,o),cn(h),a.stateNode=h):a.memoizedState=Uk(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:return Xe(a),o===null&&ot&&(h=a.stateNode=jk(a.type,a.pendingProps,le.current),wn=a,Lr=!0,y=Ot,Is(a.type)?(Ry=y,Ot=Ir(h.firstChild)):Ot=y),Cn(o,a,a.pendingProps.children,u),cf(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&ot&&((y=h=Ot)&&(h=YN(h,a.type,a.pendingProps,Lr),h!==null?(a.stateNode=h,wn=a,Ot=Ir(h.firstChild),Lr=!1,y=!0):y=!1),y||ks(a)),Xe(a),y=a.type,x=a.pendingProps,S=o!==null?o.memoizedProps:null,h=x.children,Ay(y,x)?h=null:S!==null&&Ay(y,S)&&(a.flags|=32),a.memoizedState!==null&&(y=Tg(o,a,lN,null,null,u),Kc._currentValue=y),cf(o,a),Cn(o,a,h,u),a.child;case 6:return o===null&&ot&&((o=u=Ot)&&(u=KN(u,a.pendingProps,Lr),u!==null?(a.stateNode=u,wn=a,Ot=null,o=!0):o=!1),o||ks(a)),null;case 13:return Ew(o,a,u);case 4:return Be(a,a.stateNode.containerInfo),h=a.pendingProps,o===null?a.child=Lo(a,null,h,u):Cn(o,a,h,u),a.child;case 11:return gw(o,a,a.type,a.pendingProps,u);case 7:return Cn(o,a,a.pendingProps,u),a.child;case 8:return Cn(o,a,a.pendingProps.children,u),a.child;case 12:return Cn(o,a,a.pendingProps.children,u),a.child;case 10:return h=a.pendingProps,Cs(a,a.type,h.value),Cn(o,a,h.children,u),a.child;case 9:return y=a.type._context,h=a.pendingProps.children,Do(a),y=kn(y),h=h(y),a.flags|=1,Cn(o,a,h,u),a.child;case 14:return yw(o,a,a.type,a.pendingProps,u);case 15:return bw(o,a,a.type,a.pendingProps,u);case 19:return Aw(o,a,u);case 31:return mN(o,a,u);case 22:return xw(o,a,u,a.pendingProps);case 24:return Do(a),h=kn(Xt),o===null?(y=gg(),y===null&&(y=vt,x=pg(),y.pooledCache=x,x.refCount++,x!==null&&(y.pooledCacheLanes|=u),y=x),a.memoizedState={parent:h,cache:y},bg(a),Cs(a,Xt,y)):((o.lanes&u)!==0&&(xg(o,a),Ac(a,null,null,u),Tc()),y=o.memoizedState,x=a.memoizedState,y.parent!==h?(y={parent:h,cache:h},a.memoizedState=y,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=y),Cs(a,Xt,h)):(h=x.cache,Cs(a,Xt,h),h!==y.cache&&hg(a,[Xt],u,!0))),Cn(o,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Gi(o){o.flags|=4}function ey(o,a,u,h,y){if((a=(o.mode&32)!==0)&&(a=!1),a){if(o.flags|=16777216,(y&335544128)===y)if(o.stateNode.complete)o.flags|=8192;else if(tk())o.flags|=8192;else throw zo=Kd,yg}else o.flags&=-16777217}function Ow(o,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!Fk(a))if(tk())o.flags|=8192;else throw zo=Kd,yg}function df(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?vl():536870912,o.lanes|=a,Jl|=a)}function Nc(o,a){if(!ot)switch(o.tailMode){case"hidden":a=o.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?o.tail=null:u.sibling=null;break;case"collapsed":u=o.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:h.sibling=null}}function _t(o){var a=o.alternate!==null&&o.alternate.child===o.child,u=0,h=0;if(a)for(var y=o.child;y!==null;)u|=y.lanes|y.childLanes,h|=y.subtreeFlags&65011712,h|=y.flags&65011712,y.return=o,y=y.sibling;else for(y=o.child;y!==null;)u|=y.lanes|y.childLanes,h|=y.subtreeFlags,h|=y.flags,y.return=o,y=y.sibling;return o.subtreeFlags|=h,o.childLanes=u,a}function yN(o,a,u){var h=a.pendingProps;switch(ag(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(a),null;case 1:return _t(a),null;case 3:return u=a.stateNode,h=null,o!==null&&(h=o.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),qi(Xt),Ie(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(o===null||o.child===null)&&(Bl(a)?Gi(a):o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,ug())),_t(a),null;case 26:var y=a.type,x=a.memoizedState;return o===null?(Gi(a),x!==null?(_t(a),Ow(a,x)):(_t(a),ey(a,y,null,h,u))):x?x!==o.memoizedState?(Gi(a),_t(a),Ow(a,x)):(_t(a),a.flags&=-16777217):(o=o.memoizedProps,o!==h&&Gi(a),_t(a),ey(a,y,o,h,u)),null;case 27:if(Me(a),u=le.current,y=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&Gi(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return _t(a),null}o=F.current,Bl(a)?aS(a):(o=jk(y,h,u),a.stateNode=o,Gi(a))}return _t(a),null;case 5:if(Me(a),y=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==h&&Gi(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return _t(a),null}if(x=F.current,Bl(a))aS(a);else{var S=Tf(le.current);switch(x){case 1:x=S.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:x=S.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":x=S.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":x=S.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":x=S.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof h.is=="string"?S.createElement("select",{is:h.is}):S.createElement("select"),h.multiple?x.multiple=!0:h.size&&(x.size=h.size);break;default:x=typeof h.is=="string"?S.createElement(y,{is:h.is}):S.createElement(y)}}x[Sn]=a,x[Jn]=h;e:for(S=a.child;S!==null;){if(S.tag===5||S.tag===6)x.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===a)break e;for(;S.sibling===null;){if(S.return===null||S.return===a)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}a.stateNode=x;e:switch(En(x,y,h),y){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Gi(a)}}return _t(a),ey(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,u),null;case 6:if(o&&a.stateNode!=null)o.memoizedProps!==h&&Gi(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(r(166));if(o=le.current,Bl(a)){if(o=a.stateNode,u=a.memoizedProps,h=null,y=wn,y!==null)switch(y.tag){case 27:case 5:h=y.memoizedProps}o[Sn]=a,o=!!(o.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||Ek(o.nodeValue,u)),o||ks(a,!0)}else o=Tf(o).createTextNode(h),o[Sn]=a,a.stateNode=o}return _t(a),null;case 31:if(u=a.memoizedState,o===null||o.memoizedState!==null){if(h=Bl(a),u!==null){if(o===null){if(!h)throw Error(r(318));if(o=a.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[Sn]=a}else Oo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),o=!1}else u=ug(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=u),o=!0;if(!o)return a.flags&256?(gr(a),a):(gr(a),null);if((a.flags&128)!==0)throw Error(r(558))}return _t(a),null;case 13:if(h=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(y=Bl(a),h!==null&&h.dehydrated!==null){if(o===null){if(!y)throw Error(r(318));if(y=a.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Sn]=a}else Oo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),y=!1}else y=ug(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=y),y=!0;if(!y)return a.flags&256?(gr(a),a):(gr(a),null)}return gr(a),(a.flags&128)!==0?(a.lanes=u,a):(u=h!==null,o=o!==null&&o.memoizedState!==null,u&&(h=a.child,y=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(y=h.alternate.memoizedState.cachePool.pool),x=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(x=h.memoizedState.cachePool.pool),x!==y&&(h.flags|=2048)),u!==o&&u&&(a.child.flags|=8192),df(a,a.updateQueue),_t(a),null);case 4:return Ie(),o===null&&wy(a.stateNode.containerInfo),_t(a),null;case 10:return qi(a.type),_t(a),null;case 19:if(H(Kt),h=a.memoizedState,h===null)return _t(a),null;if(y=(a.flags&128)!==0,x=h.rendering,x===null)if(y)Nc(h,!1);else{if(Bt!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(x=Jd(o),x!==null){for(a.flags|=128,Nc(h,!1),o=x.updateQueue,a.updateQueue=o,df(a,o),a.subtreeFlags=0,o=u,u=a.child;u!==null;)rS(u,o),u=u.sibling;return T(Kt,Kt.current&1|2),ot&&$i(a,h.treeForkCount),a.child}o=o.sibling}h.tail!==null&&qt()>gf&&(a.flags|=128,y=!0,Nc(h,!1),a.lanes=4194304)}else{if(!y)if(o=Jd(x),o!==null){if(a.flags|=128,y=!0,o=o.updateQueue,a.updateQueue=o,df(a,o),Nc(h,!0),h.tail===null&&h.tailMode==="hidden"&&!x.alternate&&!ot)return _t(a),null}else 2*qt()-h.renderingStartTime>gf&&u!==536870912&&(a.flags|=128,y=!0,Nc(h,!1),a.lanes=4194304);h.isBackwards?(x.sibling=a.child,a.child=x):(o=h.last,o!==null?o.sibling=x:a.child=x,h.last=x)}return h.tail!==null?(o=h.tail,h.rendering=o,h.tail=o.sibling,h.renderingStartTime=qt(),o.sibling=null,u=Kt.current,T(Kt,y?u&1|2:u&1),ot&&$i(a,h.treeForkCount),o):(_t(a),null);case 22:case 23:return gr(a),kg(),h=a.memoizedState!==null,o!==null?o.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(u&536870912)!==0&&(a.flags&128)===0&&(_t(a),a.subtreeFlags&6&&(a.flags|=8192)):_t(a),u=a.updateQueue,u!==null&&df(a,u.retryQueue),u=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==u&&(a.flags|=2048),o!==null&&H(Ro),null;case 24:return u=null,o!==null&&(u=o.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),qi(Xt),_t(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function bN(o,a){switch(ag(a),a.tag){case 1:return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return qi(Xt),Ie(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 26:case 27:case 5:return Me(a),null;case 31:if(a.memoizedState!==null){if(gr(a),a.alternate===null)throw Error(r(340));Oo()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 13:if(gr(a),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(r(340));Oo()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return H(Kt),null;case 4:return Ie(),null;case 10:return qi(a.type),null;case 22:case 23:return gr(a),kg(),o!==null&&H(Ro),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 24:return qi(Xt),null;case 25:return null;default:return null}}function _w(o,a){switch(ag(a),a.tag){case 3:qi(Xt),Ie();break;case 26:case 27:case 5:Me(a);break;case 4:Ie();break;case 31:a.memoizedState!==null&&gr(a);break;case 13:gr(a);break;case 19:H(Kt);break;case 10:qi(a.type);break;case 22:case 23:gr(a),kg(),o!==null&&H(Ro);break;case 24:qi(Xt)}}function zc(o,a){try{var u=a.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var y=h.next;u=y;do{if((u.tag&o)===o){h=void 0;var x=u.create,S=u.inst;h=x(),S.destroy=h}u=u.next}while(u!==y)}}catch(A){mt(a,a.return,A)}}function _s(o,a,u){try{var h=a.updateQueue,y=h!==null?h.lastEffect:null;if(y!==null){var x=y.next;h=x;do{if((h.tag&o)===o){var S=h.inst,A=S.destroy;if(A!==void 0){S.destroy=void 0,y=a;var R=u,$=A;try{$()}catch(X){mt(y,R,X)}}}h=h.next}while(h!==x)}}catch(X){mt(a,a.return,X)}}function Dw(o){var a=o.updateQueue;if(a!==null){var u=o.stateNode;try{SS(a,u)}catch(h){mt(o,o.return,h)}}}function Rw(o,a,u){u.props=Io(o.type,o.memoizedProps),u.state=o.memoizedState;try{u.componentWillUnmount()}catch(h){mt(o,a,h)}}function Lc(o,a){try{var u=o.ref;if(u!==null){switch(o.tag){case 26:case 27:case 5:var h=o.stateNode;break;case 30:h=o.stateNode;break;default:h=o.stateNode}typeof u=="function"?o.refCleanup=u(h):u.current=h}}catch(y){mt(o,a,y)}}function gi(o,a){var u=o.ref,h=o.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(y){mt(o,a,y)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){mt(o,a,y)}else u.current=null}function Nw(o){var a=o.type,u=o.memoizedProps,h=o.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&h.focus();break e;case"img":u.src?h.src=u.src:u.srcSet&&(h.srcset=u.srcSet)}}catch(y){mt(o,o.return,y)}}function ty(o,a,u){try{var h=o.stateNode;HN(h,o.type,u,a),h[Jn]=a}catch(y){mt(o,o.return,y)}}function zw(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Is(o.type)||o.tag===4}function ny(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||zw(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&Is(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function ry(o,a,u){var h=o.tag;if(h===5||h===6)o=o.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(o,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(o),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=Hi));else if(h!==4&&(h===27&&Is(o.type)&&(u=o.stateNode,a=null),o=o.child,o!==null))for(ry(o,a,u),o=o.sibling;o!==null;)ry(o,a,u),o=o.sibling}function ff(o,a,u){var h=o.tag;if(h===5||h===6)o=o.stateNode,a?u.insertBefore(o,a):u.appendChild(o);else if(h!==4&&(h===27&&Is(o.type)&&(u=o.stateNode),o=o.child,o!==null))for(ff(o,a,u),o=o.sibling;o!==null;)ff(o,a,u),o=o.sibling}function Lw(o){var a=o.stateNode,u=o.memoizedProps;try{for(var h=o.type,y=a.attributes;y.length;)a.removeAttributeNode(y[0]);En(a,h,u),a[Sn]=o,a[Jn]=u}catch(x){mt(o,o.return,x)}}var Zi=!1,tn=!1,iy=!1,jw=typeof WeakSet=="function"?WeakSet:Set,un=null;function xN(o,a){if(o=o.containerInfo,Ey=Nf,o=Wv(o),Jm(o)){if("selectionStart"in o)var u={start:o.selectionStart,end:o.selectionEnd};else e:{u=(u=o.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var y=h.anchorOffset,x=h.focusNode;h=h.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var S=0,A=-1,R=-1,$=0,X=0,te=o,q=null;t:for(;;){for(var W;te!==u||y!==0&&te.nodeType!==3||(A=S+y),te!==x||h!==0&&te.nodeType!==3||(R=S+h),te.nodeType===3&&(S+=te.nodeValue.length),(W=te.firstChild)!==null;)q=te,te=W;for(;;){if(te===o)break t;if(q===u&&++$===y&&(A=S),q===x&&++X===h&&(R=S),(W=te.nextSibling)!==null)break;te=q,q=te.parentNode}te=W}u=A===-1||R===-1?null:{start:A,end:R}}else u=null}u=u||{start:0,end:0}}else u=null;for(Ty={focusedElem:o,selectionRange:u},Nf=!1,un=a;un!==null;)if(a=un,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,un=o;else for(;un!==null;){switch(a=un,x=a.alternate,o=a.flags,a.tag){case 0:if((o&4)!==0&&(o=a.updateQueue,o=o!==null?o.events:null,o!==null))for(u=0;u<o.length;u++)y=o[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&x!==null){o=void 0,u=a,y=x.memoizedProps,x=x.memoizedState,h=u.stateNode;try{var ve=Io(u.type,y);o=h.getSnapshotBeforeUpdate(ve,x),h.__reactInternalSnapshotBeforeUpdate=o}catch(Ne){mt(u,u.return,Ne)}}break;case 3:if((o&1024)!==0){if(o=a.stateNode.containerInfo,u=o.nodeType,u===9)Oy(o);else if(u===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":Oy(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(r(163))}if(o=a.sibling,o!==null){o.return=a.return,un=o;break}un=a.return}}function Iw(o,a,u){var h=u.flags;switch(u.tag){case 0:case 11:case 15:Xi(o,u),h&4&&zc(5,u);break;case 1:if(Xi(o,u),h&4)if(o=u.stateNode,a===null)try{o.componentDidMount()}catch(S){mt(u,u.return,S)}else{var y=Io(u.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(y,a,o.__reactInternalSnapshotBeforeUpdate)}catch(S){mt(u,u.return,S)}}h&64&&Dw(u),h&512&&Lc(u,u.return);break;case 3:if(Xi(o,u),h&64&&(o=u.updateQueue,o!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{SS(o,a)}catch(S){mt(u,u.return,S)}}break;case 27:a===null&&h&4&&Lw(u);case 26:case 5:Xi(o,u),a===null&&h&4&&Nw(u),h&512&&Lc(u,u.return);break;case 12:Xi(o,u);break;case 31:Xi(o,u),h&4&&Hw(o,u);break;case 13:Xi(o,u),h&4&&Vw(o,u),h&64&&(o=u.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(u=MN.bind(null,u),WN(o,u))));break;case 22:if(h=u.memoizedState!==null||Zi,!h){a=a!==null&&a.memoizedState!==null||tn,y=Zi;var x=tn;Zi=h,(tn=a)&&!x?Qi(o,u,(u.subtreeFlags&8772)!==0):Xi(o,u),Zi=y,tn=x}break;case 30:break;default:Xi(o,u)}}function Bw(o){var a=o.alternate;a!==null&&(o.alternate=null,Bw(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&zm(a)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var zt=null,Qn=!1;function Ji(o,a,u){for(u=u.child;u!==null;)Uw(o,a,u),u=u.sibling}function Uw(o,a,u){if(Le&&typeof Le.onCommitFiberUnmount=="function")try{Le.onCommitFiberUnmount(re,u)}catch{}switch(u.tag){case 26:tn||gi(u,a),Ji(o,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:tn||gi(u,a);var h=zt,y=Qn;Is(u.type)&&(zt=u.stateNode,Qn=!1),Ji(o,a,u),Fc(u.stateNode),zt=h,Qn=y;break;case 5:tn||gi(u,a);case 6:if(h=zt,y=Qn,zt=null,Ji(o,a,u),zt=h,Qn=y,zt!==null)if(Qn)try{(zt.nodeType===9?zt.body:zt.nodeName==="HTML"?zt.ownerDocument.body:zt).removeChild(u.stateNode)}catch(x){mt(u,a,x)}else try{zt.removeChild(u.stateNode)}catch(x){mt(u,a,x)}break;case 18:zt!==null&&(Qn?(o=zt,Dk(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,u.stateNode),sa(o)):Dk(zt,u.stateNode));break;case 4:h=zt,y=Qn,zt=u.stateNode.containerInfo,Qn=!0,Ji(o,a,u),zt=h,Qn=y;break;case 0:case 11:case 14:case 15:_s(2,u,a),tn||_s(4,u,a),Ji(o,a,u);break;case 1:tn||(gi(u,a),h=u.stateNode,typeof h.componentWillUnmount=="function"&&Rw(u,a,h)),Ji(o,a,u);break;case 21:Ji(o,a,u);break;case 22:tn=(h=tn)||u.memoizedState!==null,Ji(o,a,u),tn=h;break;default:Ji(o,a,u)}}function Hw(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{sa(o)}catch(u){mt(a,a.return,u)}}}function Vw(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{sa(o)}catch(u){mt(a,a.return,u)}}function vN(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new jw),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new jw),a;default:throw Error(r(435,o.tag))}}function hf(o,a){var u=vN(o);a.forEach(function(h){if(!u.has(h)){u.add(h);var y=ON.bind(null,o,h);h.then(y,y)}})}function er(o,a){var u=a.deletions;if(u!==null)for(var h=0;h<u.length;h++){var y=u[h],x=o,S=a,A=S;e:for(;A!==null;){switch(A.tag){case 27:if(Is(A.type)){zt=A.stateNode,Qn=!1;break e}break;case 5:zt=A.stateNode,Qn=!1;break e;case 3:case 4:zt=A.stateNode.containerInfo,Qn=!0;break e}A=A.return}if(zt===null)throw Error(r(160));Uw(x,S,y),zt=null,Qn=!1,x=y.alternate,x!==null&&(x.return=null),y.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Pw(a,o),a=a.sibling}var ti=null;function Pw(o,a){var u=o.alternate,h=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:er(a,o),tr(o),h&4&&(_s(3,o,o.return),zc(3,o),_s(5,o,o.return));break;case 1:er(a,o),tr(o),h&512&&(tn||u===null||gi(u,u.return)),h&64&&Zi&&(o=o.updateQueue,o!==null&&(h=o.callbacks,h!==null&&(u=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=u===null?h:u.concat(h))));break;case 26:var y=ti;if(er(a,o),tr(o),h&512&&(tn||u===null||gi(u,u.return)),h&4){var x=u!==null?u.memoizedState:null;if(h=o.memoizedState,u===null)if(h===null)if(o.stateNode===null){e:{h=o.type,u=o.memoizedProps,y=y.ownerDocument||y;t:switch(h){case"title":x=y.getElementsByTagName("title")[0],(!x||x[ac]||x[Sn]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=y.createElement(h),y.head.insertBefore(x,y.querySelector("head > title"))),En(x,h,u),x[Sn]=o,cn(x),h=x;break e;case"link":var S=Pk("link","href",y).get(h+(u.href||""));if(S){for(var A=0;A<S.length;A++)if(x=S[A],x.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&x.getAttribute("rel")===(u.rel==null?null:u.rel)&&x.getAttribute("title")===(u.title==null?null:u.title)&&x.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){S.splice(A,1);break t}}x=y.createElement(h),En(x,h,u),y.head.appendChild(x);break;case"meta":if(S=Pk("meta","content",y).get(h+(u.content||""))){for(A=0;A<S.length;A++)if(x=S[A],x.getAttribute("content")===(u.content==null?null:""+u.content)&&x.getAttribute("name")===(u.name==null?null:u.name)&&x.getAttribute("property")===(u.property==null?null:u.property)&&x.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&x.getAttribute("charset")===(u.charSet==null?null:u.charSet)){S.splice(A,1);break t}}x=y.createElement(h),En(x,h,u),y.head.appendChild(x);break;default:throw Error(r(468,h))}x[Sn]=o,cn(x),h=x}o.stateNode=h}else $k(y,o.type,o.stateNode);else o.stateNode=Vk(y,h,o.memoizedProps);else x!==h?(x===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):x.count--,h===null?$k(y,o.type,o.stateNode):Vk(y,h,o.memoizedProps)):h===null&&o.stateNode!==null&&ty(o,o.memoizedProps,u.memoizedProps)}break;case 27:er(a,o),tr(o),h&512&&(tn||u===null||gi(u,u.return)),u!==null&&h&4&&ty(o,o.memoizedProps,u.memoizedProps);break;case 5:if(er(a,o),tr(o),h&512&&(tn||u===null||gi(u,u.return)),o.flags&32){y=o.stateNode;try{Ml(y,"")}catch(ve){mt(o,o.return,ve)}}h&4&&o.stateNode!=null&&(y=o.memoizedProps,ty(o,y,u!==null?u.memoizedProps:y)),h&1024&&(iy=!0);break;case 6:if(er(a,o),tr(o),h&4){if(o.stateNode===null)throw Error(r(162));h=o.memoizedProps,u=o.stateNode;try{u.nodeValue=h}catch(ve){mt(o,o.return,ve)}}break;case 3:if(Of=null,y=ti,ti=Af(a.containerInfo),er(a,o),ti=y,tr(o),h&4&&u!==null&&u.memoizedState.isDehydrated)try{sa(a.containerInfo)}catch(ve){mt(o,o.return,ve)}iy&&(iy=!1,$w(o));break;case 4:h=ti,ti=Af(o.stateNode.containerInfo),er(a,o),tr(o),ti=h;break;case 12:er(a,o),tr(o);break;case 31:er(a,o),tr(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,hf(o,h)));break;case 13:er(a,o),tr(o),o.child.flags&8192&&o.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(mf=qt()),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,hf(o,h)));break;case 22:y=o.memoizedState!==null;var R=u!==null&&u.memoizedState!==null,$=Zi,X=tn;if(Zi=$||y,tn=X||R,er(a,o),tn=X,Zi=$,tr(o),h&8192)e:for(a=o.stateNode,a._visibility=y?a._visibility&-2:a._visibility|1,y&&(u===null||R||Zi||tn||Bo(o)),u=null,a=o;;){if(a.tag===5||a.tag===26){if(u===null){R=u=a;try{if(x=R.stateNode,y)S=x.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{A=R.stateNode;var te=R.memoizedProps.style,q=te!=null&&te.hasOwnProperty("display")?te.display:null;A.style.display=q==null||typeof q=="boolean"?"":(""+q).trim()}}catch(ve){mt(R,R.return,ve)}}}else if(a.tag===6){if(u===null){R=a;try{R.stateNode.nodeValue=y?"":R.memoizedProps}catch(ve){mt(R,R.return,ve)}}}else if(a.tag===18){if(u===null){R=a;try{var W=R.stateNode;y?Rk(W,!0):Rk(R.stateNode,!1)}catch(ve){mt(R,R.return,ve)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===o)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break e;for(;a.sibling===null;){if(a.return===null||a.return===o)break e;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=o.updateQueue,h!==null&&(u=h.retryQueue,u!==null&&(h.retryQueue=null,hf(o,u))));break;case 19:er(a,o),tr(o),h&4&&(h=o.updateQueue,h!==null&&(o.updateQueue=null,hf(o,h)));break;case 30:break;case 21:break;default:er(a,o),tr(o)}}function tr(o){var a=o.flags;if(a&2){try{for(var u,h=o.return;h!==null;){if(zw(h)){u=h;break}h=h.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var y=u.stateNode,x=ny(o);ff(o,x,y);break;case 5:var S=u.stateNode;u.flags&32&&(Ml(S,""),u.flags&=-33);var A=ny(o);ff(o,A,S);break;case 3:case 4:var R=u.stateNode.containerInfo,$=ny(o);ry(o,$,R);break;default:throw Error(r(161))}}catch(X){mt(o,o.return,X)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function $w(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;$w(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),o=o.sibling}}function Xi(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Iw(o,a.alternate,a),a=a.sibling}function Bo(o){for(o=o.child;o!==null;){var a=o;switch(a.tag){case 0:case 11:case 14:case 15:_s(4,a,a.return),Bo(a);break;case 1:gi(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&Rw(a,a.return,u),Bo(a);break;case 27:Fc(a.stateNode);case 26:case 5:gi(a,a.return),Bo(a);break;case 22:a.memoizedState===null&&Bo(a);break;case 30:Bo(a);break;default:Bo(a)}o=o.sibling}}function Qi(o,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,y=o,x=a,S=x.flags;switch(x.tag){case 0:case 11:case 15:Qi(y,x,u),zc(4,x);break;case 1:if(Qi(y,x,u),h=x,y=h.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch($){mt(h,h.return,$)}if(h=x,y=h.updateQueue,y!==null){var A=h.stateNode;try{var R=y.shared.hiddenCallbacks;if(R!==null)for(y.shared.hiddenCallbacks=null,y=0;y<R.length;y++)vS(R[y],A)}catch($){mt(h,h.return,$)}}u&&S&64&&Dw(x),Lc(x,x.return);break;case 27:Lw(x);case 26:case 5:Qi(y,x,u),u&&h===null&&S&4&&Nw(x),Lc(x,x.return);break;case 12:Qi(y,x,u);break;case 31:Qi(y,x,u),u&&S&4&&Hw(y,x);break;case 13:Qi(y,x,u),u&&S&4&&Vw(y,x);break;case 22:x.memoizedState===null&&Qi(y,x,u),Lc(x,x.return);break;case 30:break;default:Qi(y,x,u)}a=a.sibling}}function sy(o,a){var u=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(u=o.memoizedState.cachePool.pool),o=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),o!==u&&(o!=null&&o.refCount++,u!=null&&Sc(u))}function oy(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&Sc(o))}function ni(o,a,u,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Fw(o,a,u,h),a=a.sibling}function Fw(o,a,u,h){var y=a.flags;switch(a.tag){case 0:case 11:case 15:ni(o,a,u,h),y&2048&&zc(9,a);break;case 1:ni(o,a,u,h);break;case 3:ni(o,a,u,h),y&2048&&(o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&Sc(o)));break;case 12:if(y&2048){ni(o,a,u,h),o=a.stateNode;try{var x=a.memoizedProps,S=x.id,A=x.onPostCommit;typeof A=="function"&&A(S,a.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(R){mt(a,a.return,R)}}else ni(o,a,u,h);break;case 31:ni(o,a,u,h);break;case 13:ni(o,a,u,h);break;case 23:break;case 22:x=a.stateNode,S=a.alternate,a.memoizedState!==null?x._visibility&2?ni(o,a,u,h):jc(o,a):x._visibility&2?ni(o,a,u,h):(x._visibility|=2,Wl(o,a,u,h,(a.subtreeFlags&10256)!==0||!1)),y&2048&&sy(S,a);break;case 24:ni(o,a,u,h),y&2048&&oy(a.alternate,a);break;default:ni(o,a,u,h)}}function Wl(o,a,u,h,y){for(y=y&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=o,S=a,A=u,R=h,$=S.flags;switch(S.tag){case 0:case 11:case 15:Wl(x,S,A,R,y),zc(8,S);break;case 23:break;case 22:var X=S.stateNode;S.memoizedState!==null?X._visibility&2?Wl(x,S,A,R,y):jc(x,S):(X._visibility|=2,Wl(x,S,A,R,y)),y&&$&2048&&sy(S.alternate,S);break;case 24:Wl(x,S,A,R,y),y&&$&2048&&oy(S.alternate,S);break;default:Wl(x,S,A,R,y)}a=a.sibling}}function jc(o,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=o,h=a,y=h.flags;switch(h.tag){case 22:jc(u,h),y&2048&&sy(h.alternate,h);break;case 24:jc(u,h),y&2048&&oy(h.alternate,h);break;default:jc(u,h)}a=a.sibling}}var Ic=8192;function Gl(o,a,u){if(o.subtreeFlags&Ic)for(o=o.child;o!==null;)qw(o,a,u),o=o.sibling}function qw(o,a,u){switch(o.tag){case 26:Gl(o,a,u),o.flags&Ic&&o.memoizedState!==null&&oz(u,ti,o.memoizedState,o.memoizedProps);break;case 5:Gl(o,a,u);break;case 3:case 4:var h=ti;ti=Af(o.stateNode.containerInfo),Gl(o,a,u),ti=h;break;case 22:o.memoizedState===null&&(h=o.alternate,h!==null&&h.memoizedState!==null?(h=Ic,Ic=16777216,Gl(o,a,u),Ic=h):Gl(o,a,u));break;default:Gl(o,a,u)}}function Yw(o){var a=o.alternate;if(a!==null&&(o=a.child,o!==null)){a.child=null;do a=o.sibling,o.sibling=null,o=a;while(o!==null)}}function Bc(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];un=h,Ww(h,o)}Yw(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Kw(o),o=o.sibling}function Kw(o){switch(o.tag){case 0:case 11:case 15:Bc(o),o.flags&2048&&_s(9,o,o.return);break;case 3:Bc(o);break;case 12:Bc(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,pf(o)):Bc(o);break;default:Bc(o)}}function pf(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];un=h,Ww(h,o)}Yw(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:_s(8,a,a.return),pf(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,pf(a));break;default:pf(a)}o=o.sibling}}function Ww(o,a){for(;un!==null;){var u=un;switch(u.tag){case 0:case 11:case 15:_s(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var h=u.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Sc(u.memoizedState.cache)}if(h=u.child,h!==null)h.return=u,un=h;else e:for(u=o;un!==null;){h=un;var y=h.sibling,x=h.return;if(Bw(h),h===u){un=null;break e}if(y!==null){y.return=x,un=y;break e}un=x}}}var SN={getCacheForType:function(o){var a=kn(Xt),u=a.data.get(o);return u===void 0&&(u=o(),a.data.set(o,u)),u},cacheSignal:function(){return kn(Xt).controller.signal}},wN=typeof WeakMap=="function"?WeakMap:Map,ft=0,vt=null,Qe=null,rt=0,pt=0,yr=null,Ds=!1,Zl=!1,ly=!1,es=0,Bt=0,Rs=0,Uo=0,ay=0,br=0,Jl=0,Uc=null,nr=null,cy=!1,mf=0,Gw=0,gf=1/0,yf=null,Ns=null,ln=0,zs=null,Xl=null,ts=0,uy=0,dy=null,Zw=null,Hc=0,fy=null;function xr(){return(ft&2)!==0&&rt!==0?rt&-rt:L.T!==null?by():fv()}function Jw(){if(br===0)if((rt&536870912)===0||ot){var o=Zn;Zn<<=1,(Zn&3932160)===0&&(Zn=262144),br=o}else br=536870912;return o=mr.current,o!==null&&(o.flags|=32),br}function rr(o,a,u){(o===vt&&(pt===2||pt===9)||o.cancelPendingCommit!==null)&&(Ql(o,0),Ls(o,rt,br,!1)),So(o,u),((ft&2)===0||o!==vt)&&(o===vt&&((ft&2)===0&&(Uo|=u),Bt===4&&Ls(o,rt,br,!1)),yi(o))}function Xw(o,a,u){if((ft&6)!==0)throw Error(r(327));var h=!u&&(a&127)===0&&(a&o.expiredLanes)===0||Bi(o,a),y=h?EN(o,a):py(o,a,!0),x=h;do{if(y===0){Zl&&!h&&Ls(o,a,0,!1);break}else{if(u=o.current.alternate,x&&!kN(u)){y=py(o,a,!1),x=!1;continue}if(y===2){if(x=a,o.errorRecoveryDisabledLanes&x)var S=0;else S=o.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){a=S;e:{var A=o;y=Uc;var R=A.current.memoizedState.isDehydrated;if(R&&(Ql(A,S).flags|=256),S=py(A,S,!1),S!==2){if(ly&&!R){A.errorRecoveryDisabledLanes|=x,Uo|=x,y=4;break e}x=nr,nr=y,x!==null&&(nr===null?nr=x:nr.push.apply(nr,x))}y=S}if(x=!1,y!==2)continue}}if(y===1){Ql(o,0),Ls(o,a,0,!0);break}e:{switch(h=o,x=y,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Ls(h,a,br,!Ds);break e;case 2:nr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(y=mf+300-qt(),10<y)){if(Ls(h,a,br,!Ds),hi(h,0,!0)!==0)break e;ts=a,h.timeoutHandle=Ok(Qw.bind(null,h,u,nr,yf,cy,a,br,Uo,Jl,Ds,x,"Throttled",-0,0),y);break e}Qw(h,u,nr,yf,cy,a,br,Uo,Jl,Ds,x,null,-0,0)}}break}while(!0);yi(o)}function Qw(o,a,u,h,y,x,S,A,R,$,X,te,q,W){if(o.timeoutHandle=-1,te=a.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Hi},qw(a,x,te);var ve=(x&62914560)===x?mf-qt():(x&4194048)===x?Gw-qt():0;if(ve=lz(te,ve),ve!==null){ts=x,o.cancelPendingCommit=ve(lk.bind(null,o,a,x,u,h,y,S,A,R,X,te,null,q,W)),Ls(o,x,S,!$);return}}lk(o,a,x,u,h,y,S,A,R)}function kN(o){for(var a=o;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var h=0;h<u.length;h++){var y=u[h],x=y.getSnapshot;y=y.value;try{if(!hr(x(),y))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ls(o,a,u,h){a&=~ay,a&=~Uo,o.suspendedLanes|=a,o.pingedLanes&=~a,h&&(o.warmLanes|=a),h=o.expirationTimes;for(var y=a;0<y;){var x=31-Ge(y),S=1<<x;h[x]=-1,y&=~S}u!==0&&cv(o,u,a)}function bf(){return(ft&6)===0?(Vc(0),!1):!0}function hy(){if(Qe!==null){if(pt===0)var o=Qe.return;else o=Qe,Fi=_o=null,Og(o),$l=null,kc=0,o=Qe;for(;o!==null;)_w(o.alternate,o),o=o.return;Qe=null}}function Ql(o,a){var u=o.timeoutHandle;u!==-1&&(o.timeoutHandle=-1,$N(u)),u=o.cancelPendingCommit,u!==null&&(o.cancelPendingCommit=null,u()),ts=0,hy(),vt=o,Qe=u=Pi(o.current,null),rt=a,pt=0,yr=null,Ds=!1,Zl=Bi(o,a),ly=!1,Jl=br=ay=Uo=Rs=Bt=0,nr=Uc=null,cy=!1,(a&8)!==0&&(a|=a&32);var h=o.entangledLanes;if(h!==0)for(o=o.entanglements,h&=a;0<h;){var y=31-Ge(h),x=1<<y;a|=o[y],h&=~x}return es=a,Bd(),u}function ek(o,a){$e=null,L.H=Dc,a===Pl||a===Yd?(a=gS(),pt=3):a===yg?(a=gS(),pt=4):pt=a===qg?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,yr=a,Qe===null&&(Bt=1,lf(o,Rr(a,o.current)))}function tk(){var o=mr.current;return o===null?!0:(rt&4194048)===rt?jr===null:(rt&62914560)===rt||(rt&536870912)!==0?o===jr:!1}function nk(){var o=L.H;return L.H=Dc,o===null?Dc:o}function rk(){var o=L.A;return L.A=SN,o}function xf(){Bt=4,Ds||(rt&4194048)!==rt&&mr.current!==null||(Zl=!0),(Rs&134217727)===0&&(Uo&134217727)===0||vt===null||Ls(vt,rt,br,!1)}function py(o,a,u){var h=ft;ft|=2;var y=nk(),x=rk();(vt!==o||rt!==a)&&(yf=null,Ql(o,a)),a=!1;var S=Bt;e:do try{if(pt!==0&&Qe!==null){var A=Qe,R=yr;switch(pt){case 8:hy(),S=6;break e;case 3:case 2:case 9:case 6:mr.current===null&&(a=!0);var $=pt;if(pt=0,yr=null,ea(o,A,R,$),u&&Zl){S=0;break e}break;default:$=pt,pt=0,yr=null,ea(o,A,R,$)}}CN(),S=Bt;break}catch(X){ek(o,X)}while(!0);return a&&o.shellSuspendCounter++,Fi=_o=null,ft=h,L.H=y,L.A=x,Qe===null&&(vt=null,rt=0,Bd()),S}function CN(){for(;Qe!==null;)ik(Qe)}function EN(o,a){var u=ft;ft|=2;var h=nk(),y=rk();vt!==o||rt!==a?(yf=null,gf=qt()+500,Ql(o,a)):Zl=Bi(o,a);e:do try{if(pt!==0&&Qe!==null){a=Qe;var x=yr;t:switch(pt){case 1:pt=0,yr=null,ea(o,a,x,1);break;case 2:case 9:if(pS(x)){pt=0,yr=null,sk(a);break}a=function(){pt!==2&&pt!==9||vt!==o||(pt=7),yi(o)},x.then(a,a);break e;case 3:pt=7;break e;case 4:pt=5;break e;case 7:pS(x)?(pt=0,yr=null,sk(a)):(pt=0,yr=null,ea(o,a,x,7));break;case 5:var S=null;switch(Qe.tag){case 26:S=Qe.memoizedState;case 5:case 27:var A=Qe;if(S?Fk(S):A.stateNode.complete){pt=0,yr=null;var R=A.sibling;if(R!==null)Qe=R;else{var $=A.return;$!==null?(Qe=$,vf($)):Qe=null}break t}}pt=0,yr=null,ea(o,a,x,5);break;case 6:pt=0,yr=null,ea(o,a,x,6);break;case 8:hy(),Bt=6;break e;default:throw Error(r(462))}}TN();break}catch(X){ek(o,X)}while(!0);return Fi=_o=null,L.H=h,L.A=y,ft=u,Qe!==null?0:(vt=null,rt=0,Bd(),Bt)}function TN(){for(;Qe!==null&&!ji();)ik(Qe)}function ik(o){var a=Mw(o.alternate,o,es);o.memoizedProps=o.pendingProps,a===null?vf(o):Qe=a}function sk(o){var a=o,u=a.alternate;switch(a.tag){case 15:case 0:a=ww(u,a,a.pendingProps,a.type,void 0,rt);break;case 11:a=ww(u,a,a.pendingProps,a.type.render,a.ref,rt);break;case 5:Og(a);default:_w(u,a),a=Qe=rS(a,es),a=Mw(u,a,es)}o.memoizedProps=o.pendingProps,a===null?vf(o):Qe=a}function ea(o,a,u,h){Fi=_o=null,Og(a),$l=null,kc=0;var y=a.return;try{if(pN(o,y,a,u,rt)){Bt=1,lf(o,Rr(u,o.current)),Qe=null;return}}catch(x){if(y!==null)throw Qe=y,x;Bt=1,lf(o,Rr(u,o.current)),Qe=null;return}a.flags&32768?(ot||h===1?o=!0:Zl||(rt&536870912)!==0?o=!1:(Ds=o=!0,(h===2||h===9||h===3||h===6)&&(h=mr.current,h!==null&&h.tag===13&&(h.flags|=16384))),ok(a,o)):vf(a)}function vf(o){var a=o;do{if((a.flags&32768)!==0){ok(a,Ds);return}o=a.return;var u=yN(a.alternate,a,es);if(u!==null){Qe=u;return}if(a=a.sibling,a!==null){Qe=a;return}Qe=a=o}while(a!==null);Bt===0&&(Bt=5)}function ok(o,a){do{var u=bN(o.alternate,o);if(u!==null){u.flags&=32767,Qe=u;return}if(u=o.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(o=o.sibling,o!==null)){Qe=o;return}Qe=o=u}while(o!==null);Bt=6,Qe=null}function lk(o,a,u,h,y,x,S,A,R){o.cancelPendingCommit=null;do Sf();while(ln!==0);if((ft&6)!==0)throw Error(r(327));if(a!==null){if(a===o.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=ng,wo(o,u,x,S,A,R),o===vt&&(Qe=vt=null,rt=0),Xl=a,zs=o,ts=u,uy=x,dy=y,Zw=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,_N(Ee,function(){return fk(),null})):(o.callbackNode=null,o.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=L.T,L.T=null,y=G.p,G.p=2,S=ft,ft|=4;try{xN(o,a,u)}finally{ft=S,G.p=y,L.T=h}}ln=1,ak(),ck(),uk()}}function ak(){if(ln===1){ln=0;var o=zs,a=Xl,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=L.T,L.T=null;var h=G.p;G.p=2;var y=ft;ft|=4;try{Pw(a,o);var x=Ty,S=Wv(o.containerInfo),A=x.focusedElem,R=x.selectionRange;if(S!==A&&A&&A.ownerDocument&&Kv(A.ownerDocument.documentElement,A)){if(R!==null&&Jm(A)){var $=R.start,X=R.end;if(X===void 0&&(X=$),"selectionStart"in A)A.selectionStart=$,A.selectionEnd=Math.min(X,A.value.length);else{var te=A.ownerDocument||document,q=te&&te.defaultView||window;if(q.getSelection){var W=q.getSelection(),ve=A.textContent.length,Ne=Math.min(R.start,ve),bt=R.end===void 0?Ne:Math.min(R.end,ve);!W.extend&&Ne>bt&&(S=bt,bt=Ne,Ne=S);var B=Yv(A,Ne),z=Yv(A,bt);if(B&&z&&(W.rangeCount!==1||W.anchorNode!==B.node||W.anchorOffset!==B.offset||W.focusNode!==z.node||W.focusOffset!==z.offset)){var P=te.createRange();P.setStart(B.node,B.offset),W.removeAllRanges(),Ne>bt?(W.addRange(P),W.extend(z.node,z.offset)):(P.setEnd(z.node,z.offset),W.addRange(P))}}}}for(te=[],W=A;W=W.parentNode;)W.nodeType===1&&te.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<te.length;A++){var ee=te[A];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}Nf=!!Ey,Ty=Ey=null}finally{ft=y,G.p=h,L.T=u}}o.current=a,ln=2}}function ck(){if(ln===2){ln=0;var o=zs,a=Xl,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=L.T,L.T=null;var h=G.p;G.p=2;var y=ft;ft|=4;try{Iw(o,a.alternate,a)}finally{ft=y,G.p=h,L.T=u}}ln=3}}function uk(){if(ln===4||ln===3){ln=0,Ar();var o=zs,a=Xl,u=ts,h=Zw;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?ln=5:(ln=0,Xl=zs=null,dk(o,o.pendingLanes));var y=o.pendingLanes;if(y===0&&(Ns=null),Rm(u),a=a.stateNode,Le&&typeof Le.onCommitFiberRoot=="function")try{Le.onCommitFiberRoot(re,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=L.T,y=G.p,G.p=2,L.T=null;try{for(var x=o.onRecoverableError,S=0;S<h.length;S++){var A=h[S];x(A.value,{componentStack:A.stack})}}finally{L.T=a,G.p=y}}(ts&3)!==0&&Sf(),yi(o),y=o.pendingLanes,(u&261930)!==0&&(y&42)!==0?o===fy?Hc++:(Hc=0,fy=o):Hc=0,Vc(0)}}function dk(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,Sc(a)))}function Sf(){return ak(),ck(),uk(),fk()}function fk(){if(ln!==5)return!1;var o=zs,a=uy;uy=0;var u=Rm(ts),h=L.T,y=G.p;try{G.p=32>u?32:u,L.T=null,u=dy,dy=null;var x=zs,S=ts;if(ln=0,Xl=zs=null,ts=0,(ft&6)!==0)throw Error(r(331));var A=ft;if(ft|=4,Kw(x.current),Fw(x,x.current,S,u),ft=A,Vc(0,!1),Le&&typeof Le.onPostCommitFiberRoot=="function")try{Le.onPostCommitFiberRoot(re,x)}catch{}return!0}finally{G.p=y,L.T=h,dk(o,a)}}function hk(o,a,u){a=Rr(u,a),a=Fg(o.stateNode,a,2),o=As(o,a,2),o!==null&&(So(o,2),yi(o))}function mt(o,a,u){if(o.tag===3)hk(o,o,u);else for(;a!==null;){if(a.tag===3){hk(a,o,u);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Ns===null||!Ns.has(h))){o=Rr(u,o),u=pw(2),h=As(a,u,2),h!==null&&(mw(u,h,a,o),So(h,2),yi(h));break}}a=a.return}}function my(o,a,u){var h=o.pingCache;if(h===null){h=o.pingCache=new wN;var y=new Set;h.set(a,y)}else y=h.get(a),y===void 0&&(y=new Set,h.set(a,y));y.has(u)||(ly=!0,y.add(u),o=AN.bind(null,o,a,u),a.then(o,o))}function AN(o,a,u){var h=o.pingCache;h!==null&&h.delete(a),o.pingedLanes|=o.suspendedLanes&u,o.warmLanes&=~u,vt===o&&(rt&u)===u&&(Bt===4||Bt===3&&(rt&62914560)===rt&&300>qt()-mf?(ft&2)===0&&Ql(o,0):ay|=u,Jl===rt&&(Jl=0)),yi(o)}function pk(o,a){a===0&&(a=vl()),o=Ao(o,a),o!==null&&(So(o,a),yi(o))}function MN(o){var a=o.memoizedState,u=0;a!==null&&(u=a.retryLane),pk(o,u)}function ON(o,a){var u=0;switch(o.tag){case 31:case 13:var h=o.stateNode,y=o.memoizedState;y!==null&&(u=y.retryLane);break;case 19:h=o.stateNode;break;case 22:h=o.stateNode._retryCache;break;default:throw Error(r(314))}h!==null&&h.delete(a),pk(o,u)}function _N(o,a){return fr(o,a)}var wf=null,ta=null,gy=!1,kf=!1,yy=!1,js=0;function yi(o){o!==ta&&o.next===null&&(ta===null?wf=ta=o:ta=ta.next=o),kf=!0,gy||(gy=!0,RN())}function Vc(o,a){if(!yy&&kf){yy=!0;do for(var u=!1,h=wf;h!==null;){if(o!==0){var y=h.pendingLanes;if(y===0)var x=0;else{var S=h.suspendedLanes,A=h.pingedLanes;x=(1<<31-Ge(42|o)+1)-1,x&=y&~(S&~A),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(u=!0,bk(h,x))}else x=rt,x=hi(h,h===vt?x:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(x&3)===0||Bi(h,x)||(u=!0,bk(h,x));h=h.next}while(u);yy=!1}}function DN(){mk()}function mk(){kf=gy=!1;var o=0;js!==0&&PN()&&(o=js);for(var a=qt(),u=null,h=wf;h!==null;){var y=h.next,x=gk(h,a);x===0?(h.next=null,u===null?wf=y:u.next=y,y===null&&(ta=u)):(u=h,(o!==0||(x&3)!==0)&&(kf=!0)),h=y}ln!==0&&ln!==5||Vc(o),js!==0&&(js=0)}function gk(o,a){for(var u=o.suspendedLanes,h=o.pingedLanes,y=o.expirationTimes,x=o.pendingLanes&-62914561;0<x;){var S=31-Ge(x),A=1<<S,R=y[S];R===-1?((A&u)===0||(A&h)!==0)&&(y[S]=lc(A,a)):R<=a&&(o.expiredLanes|=A),x&=~A}if(a=vt,u=rt,u=hi(o,o===a?u:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h=o.callbackNode,u===0||o===a&&(pt===2||pt===9)||o.cancelPendingCommit!==null)return h!==null&&h!==null&&Qr(h),o.callbackNode=null,o.callbackPriority=0;if((u&3)===0||Bi(o,u)){if(a=u&-u,a===o.callbackPriority)return a;switch(h!==null&&Qr(h),Rm(u)){case 2:case 8:u=de;break;case 32:u=Ee;break;case 268435456:u=ge;break;default:u=Ee}return h=yk.bind(null,o),u=fr(u,h),o.callbackPriority=a,o.callbackNode=u,a}return h!==null&&h!==null&&Qr(h),o.callbackPriority=2,o.callbackNode=null,2}function yk(o,a){if(ln!==0&&ln!==5)return o.callbackNode=null,o.callbackPriority=0,null;var u=o.callbackNode;if(Sf()&&o.callbackNode!==u)return null;var h=rt;return h=hi(o,o===vt?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),h===0?null:(Xw(o,h,a),gk(o,qt()),o.callbackNode!=null&&o.callbackNode===u?yk.bind(null,o):null)}function bk(o,a){if(Sf())return null;Xw(o,a,!0)}function RN(){FN(function(){(ft&6)!==0?fr(J,DN):mk()})}function by(){if(js===0){var o=Hl;o===0&&(o=Yt,Yt<<=1,(Yt&261888)===0&&(Yt=256)),js=o}return js}function xk(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:_d(""+o)}function vk(o,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,o.id&&u.setAttribute("form",o.id),a.parentNode.insertBefore(u,a),o=new FormData(o),u.parentNode.removeChild(u),o}function NN(o,a,u,h,y){if(a==="submit"&&u&&u.stateNode===y){var x=xk((y[Jn]||null).action),S=h.submitter;S&&(a=(a=S[Jn]||null)?xk(a.formAction):S.getAttribute("formAction"),a!==null&&(x=a,S=null));var A=new zd("action","action",null,h,y);o.push({event:A,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(js!==0){var R=S?vk(y,S):new FormData(y);Bg(u,{pending:!0,data:R,method:y.method,action:x},null,R)}}else typeof x=="function"&&(A.preventDefault(),R=S?vk(y,S):new FormData(y),Bg(u,{pending:!0,data:R,method:y.method,action:x},x,R))},currentTarget:y}]})}}for(var xy=0;xy<tg.length;xy++){var vy=tg[xy],zN=vy.toLowerCase(),LN=vy[0].toUpperCase()+vy.slice(1);ei(zN,"on"+LN)}ei(Jv,"onAnimationEnd"),ei(Xv,"onAnimationIteration"),ei(Qv,"onAnimationStart"),ei("dblclick","onDoubleClick"),ei("focusin","onFocus"),ei("focusout","onBlur"),ei(JR,"onTransitionRun"),ei(XR,"onTransitionStart"),ei(QR,"onTransitionCancel"),ei(eS,"onTransitionEnd"),Tl("onMouseEnter",["mouseout","mouseover"]),Tl("onMouseLeave",["mouseout","mouseover"]),Tl("onPointerEnter",["pointerout","pointerover"]),Tl("onPointerLeave",["pointerout","pointerover"]),ko("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ko("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ko("onBeforeInput",["compositionend","keypress","textInput","paste"]),ko("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ko("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ko("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Pc="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(" "),jN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Pc));function Sk(o,a){a=(a&4)!==0;for(var u=0;u<o.length;u++){var h=o[u],y=h.event;h=h.listeners;e:{var x=void 0;if(a)for(var S=h.length-1;0<=S;S--){var A=h[S],R=A.instance,$=A.currentTarget;if(A=A.listener,R!==x&&y.isPropagationStopped())break e;x=A,y.currentTarget=$;try{x(y)}catch(X){Id(X)}y.currentTarget=null,x=R}else for(S=0;S<h.length;S++){if(A=h[S],R=A.instance,$=A.currentTarget,A=A.listener,R!==x&&y.isPropagationStopped())break e;x=A,y.currentTarget=$;try{x(y)}catch(X){Id(X)}y.currentTarget=null,x=R}}}}function et(o,a){var u=a[Nm];u===void 0&&(u=a[Nm]=new Set);var h=o+"__bubble";u.has(h)||(wk(a,o,2,!1),u.add(h))}function Sy(o,a,u){var h=0;a&&(h|=4),wk(u,o,h,a)}var Cf="_reactListening"+Math.random().toString(36).slice(2);function wy(o){if(!o[Cf]){o[Cf]=!0,mv.forEach(function(u){u!=="selectionchange"&&(jN.has(u)||Sy(u,!1,o),Sy(u,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[Cf]||(a[Cf]=!0,Sy("selectionchange",!1,a))}}function wk(o,a,u,h){switch(Jk(a)){case 2:var y=uz;break;case 8:y=dz;break;default:y=Iy}u=y.bind(null,a,u,o),y=void 0,!Pm||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(y=!0),h?y!==void 0?o.addEventListener(a,u,{capture:!0,passive:y}):o.addEventListener(a,u,!0):y!==void 0?o.addEventListener(a,u,{passive:y}):o.addEventListener(a,u,!1)}function ky(o,a,u,h,y){var x=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var S=h.tag;if(S===3||S===4){var A=h.stateNode.containerInfo;if(A===y)break;if(S===4)for(S=h.return;S!==null;){var R=S.tag;if((R===3||R===4)&&S.stateNode.containerInfo===y)return;S=S.return}for(;A!==null;){if(S=kl(A),S===null)return;if(R=S.tag,R===5||R===6||R===26||R===27){h=x=S;continue e}A=A.parentNode}}h=h.return}Av(function(){var $=x,X=Hm(u),te=[];e:{var q=tS.get(o);if(q!==void 0){var W=zd,ve=o;switch(o){case"keypress":if(Rd(u)===0)break e;case"keydown":case"keyup":W=OR;break;case"focusin":ve="focus",W=Ym;break;case"focusout":ve="blur",W=Ym;break;case"beforeblur":case"afterblur":W=Ym;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":W=_v;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=yR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=RR;break;case Jv:case Xv:case Qv:W=vR;break;case eS:W=zR;break;case"scroll":case"scrollend":W=mR;break;case"wheel":W=jR;break;case"copy":case"cut":case"paste":W=wR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=Rv;break;case"toggle":case"beforetoggle":W=BR}var Ne=(a&4)!==0,bt=!Ne&&(o==="scroll"||o==="scrollend"),B=Ne?q!==null?q+"Capture":null:q;Ne=[];for(var z=$,P;z!==null;){var ee=z;if(P=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||P===null||B===null||(ee=uc(z,B),ee!=null&&Ne.push($c(z,ee,P))),bt)break;z=z.return}0<Ne.length&&(q=new W(q,ve,null,u,X),te.push({event:q,listeners:Ne}))}}if((a&7)===0){e:{if(q=o==="mouseover"||o==="pointerover",W=o==="mouseout"||o==="pointerout",q&&u!==Um&&(ve=u.relatedTarget||u.fromElement)&&(kl(ve)||ve[wl]))break e;if((W||q)&&(q=X.window===X?X:(q=X.ownerDocument)?q.defaultView||q.parentWindow:window,W?(ve=u.relatedTarget||u.toElement,W=$,ve=ve?kl(ve):null,ve!==null&&(bt=s(ve),Ne=ve.tag,ve!==bt||Ne!==5&&Ne!==27&&Ne!==6)&&(ve=null)):(W=null,ve=$),W!==ve)){if(Ne=_v,ee="onMouseLeave",B="onMouseEnter",z="mouse",(o==="pointerout"||o==="pointerover")&&(Ne=Rv,ee="onPointerLeave",B="onPointerEnter",z="pointer"),bt=W==null?q:cc(W),P=ve==null?q:cc(ve),q=new Ne(ee,z+"leave",W,u,X),q.target=bt,q.relatedTarget=P,ee=null,kl(X)===$&&(Ne=new Ne(B,z+"enter",ve,u,X),Ne.target=P,Ne.relatedTarget=bt,ee=Ne),bt=ee,W&&ve)t:{for(Ne=IN,B=W,z=ve,P=0,ee=B;ee;ee=Ne(ee))P++;ee=0;for(var Oe=z;Oe;Oe=Ne(Oe))ee++;for(;0<P-ee;)B=Ne(B),P--;for(;0<ee-P;)z=Ne(z),ee--;for(;P--;){if(B===z||z!==null&&B===z.alternate){Ne=B;break t}B=Ne(B),z=Ne(z)}Ne=null}else Ne=null;W!==null&&kk(te,q,W,Ne,!1),ve!==null&&bt!==null&&kk(te,bt,ve,Ne,!0)}}e:{if(q=$?cc($):window,W=q.nodeName&&q.nodeName.toLowerCase(),W==="select"||W==="input"&&q.type==="file")var at=Hv;else if(Bv(q))if(Vv)at=WR;else{at=YR;var ke=qR}else W=q.nodeName,!W||W.toLowerCase()!=="input"||q.type!=="checkbox"&&q.type!=="radio"?$&&Bm($.elementType)&&(at=Hv):at=KR;if(at&&(at=at(o,$))){Uv(te,at,u,X);break e}ke&&ke(o,q,$),o==="focusout"&&$&&q.type==="number"&&$.memoizedProps.value!=null&&Im(q,"number",q.value)}switch(ke=$?cc($):window,o){case"focusin":(Bv(ke)||ke.contentEditable==="true")&&(Rl=ke,Xm=$,bc=null);break;case"focusout":bc=Xm=Rl=null;break;case"mousedown":Qm=!0;break;case"contextmenu":case"mouseup":case"dragend":Qm=!1,Gv(te,u,X);break;case"selectionchange":if(ZR)break;case"keydown":case"keyup":Gv(te,u,X)}var Fe;if(Wm)e:{switch(o){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else Dl?jv(o,u)&&(it="onCompositionEnd"):o==="keydown"&&u.keyCode===229&&(it="onCompositionStart");it&&(Nv&&u.locale!=="ko"&&(Dl||it!=="onCompositionStart"?it==="onCompositionEnd"&&Dl&&(Fe=Mv()):(vs=X,$m="value"in vs?vs.value:vs.textContent,Dl=!0)),ke=Ef($,it),0<ke.length&&(it=new Dv(it,o,null,u,X),te.push({event:it,listeners:ke}),Fe?it.data=Fe:(Fe=Iv(u),Fe!==null&&(it.data=Fe)))),(Fe=HR?VR(o,u):PR(o,u))&&(it=Ef($,"onBeforeInput"),0<it.length&&(ke=new Dv("onBeforeInput","beforeinput",null,u,X),te.push({event:ke,listeners:it}),ke.data=Fe)),NN(te,o,$,u,X)}Sk(te,a)})}function $c(o,a,u){return{instance:o,listener:a,currentTarget:u}}function Ef(o,a){for(var u=a+"Capture",h=[];o!==null;){var y=o,x=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||x===null||(y=uc(o,u),y!=null&&h.unshift($c(o,y,x)),y=uc(o,a),y!=null&&h.push($c(o,y,x))),o.tag===3)return h;o=o.return}return[]}function IN(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function kk(o,a,u,h,y){for(var x=a._reactName,S=[];u!==null&&u!==h;){var A=u,R=A.alternate,$=A.stateNode;if(A=A.tag,R!==null&&R===h)break;A!==5&&A!==26&&A!==27||$===null||(R=$,y?($=uc(u,x),$!=null&&S.unshift($c(u,$,R))):y||($=uc(u,x),$!=null&&S.push($c(u,$,R)))),u=u.return}S.length!==0&&o.push({event:a,listeners:S})}var BN=/\r\n?/g,UN=/\u0000|\uFFFD/g;function Ck(o){return(typeof o=="string"?o:""+o).replace(BN,`
|
|
49
|
+
`).replace(UN,"")}function Ek(o,a){return a=Ck(a),Ck(o)===a}function yt(o,a,u,h,y,x){switch(u){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||Ml(o,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&Ml(o,""+h);break;case"className":Md(o,"class",h);break;case"tabIndex":Md(o,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Md(o,u,h);break;case"style":Ev(o,h,x);break;case"data":if(a!=="object"){Md(o,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||u!=="href")){o.removeAttribute(u);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(u);break}h=_d(""+h),o.setAttribute(u,h);break;case"action":case"formAction":if(typeof h=="function"){o.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(u==="formAction"?(a!=="input"&&yt(o,a,"name",y.name,y,null),yt(o,a,"formEncType",y.formEncType,y,null),yt(o,a,"formMethod",y.formMethod,y,null),yt(o,a,"formTarget",y.formTarget,y,null)):(yt(o,a,"encType",y.encType,y,null),yt(o,a,"method",y.method,y,null),yt(o,a,"target",y.target,y,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){o.removeAttribute(u);break}h=_d(""+h),o.setAttribute(u,h);break;case"onClick":h!=null&&(o.onclick=Hi);break;case"onScroll":h!=null&&et("scroll",o);break;case"onScrollEnd":h!=null&&et("scrollend",o);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(y.children!=null)throw Error(r(60));o.innerHTML=u}}break;case"multiple":o.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":o.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){o.removeAttribute("xlink:href");break}u=_d(""+h),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,""+h):o.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,""):o.removeAttribute(u);break;case"capture":case"download":h===!0?o.setAttribute(u,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?o.setAttribute(u,h):o.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?o.setAttribute(u,h):o.removeAttribute(u);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?o.removeAttribute(u):o.setAttribute(u,h);break;case"popover":et("beforetoggle",o),et("toggle",o),Ad(o,"popover",h);break;case"xlinkActuate":Ui(o,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Ui(o,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Ui(o,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Ui(o,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Ui(o,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Ui(o,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Ui(o,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Ui(o,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Ui(o,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Ad(o,"is",h);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=hR.get(u)||u,Ad(o,u,h))}}function Cy(o,a,u,h,y,x){switch(u){case"style":Ev(o,h,x);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(y.children!=null)throw Error(r(60));o.innerHTML=u}}break;case"children":typeof h=="string"?Ml(o,h):(typeof h=="number"||typeof h=="bigint")&&Ml(o,""+h);break;case"onScroll":h!=null&&et("scroll",o);break;case"onScrollEnd":h!=null&&et("scrollend",o);break;case"onClick":h!=null&&(o.onclick=Hi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!gv.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),a=u.slice(2,y?u.length-7:void 0),x=o[Jn]||null,x=x!=null?x[u]:null,typeof x=="function"&&o.removeEventListener(a,x,y),typeof h=="function")){typeof x!="function"&&x!==null&&(u in o?o[u]=null:o.hasAttribute(u)&&o.removeAttribute(u)),o.addEventListener(a,h,y);break e}u in o?o[u]=h:h===!0?o.setAttribute(u,""):Ad(o,u,h)}}}function En(o,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",o),et("load",o);var h=!1,y=!1,x;for(x in u)if(u.hasOwnProperty(x)){var S=u[x];if(S!=null)switch(x){case"src":h=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:yt(o,a,x,S,u,null)}}y&&yt(o,a,"srcSet",u.srcSet,u,null),h&&yt(o,a,"src",u.src,u,null);return;case"input":et("invalid",o);var A=x=S=y=null,R=null,$=null;for(h in u)if(u.hasOwnProperty(h)){var X=u[h];if(X!=null)switch(h){case"name":y=X;break;case"type":S=X;break;case"checked":R=X;break;case"defaultChecked":$=X;break;case"value":x=X;break;case"defaultValue":A=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,a));break;default:yt(o,a,h,X,u,null)}}Sv(o,x,A,R,$,S,y,!1);return;case"select":et("invalid",o),h=S=x=null;for(y in u)if(u.hasOwnProperty(y)&&(A=u[y],A!=null))switch(y){case"value":x=A;break;case"defaultValue":S=A;break;case"multiple":h=A;default:yt(o,a,y,A,u,null)}a=x,u=S,o.multiple=!!h,a!=null?Al(o,!!h,a,!1):u!=null&&Al(o,!!h,u,!0);return;case"textarea":et("invalid",o),x=y=h=null;for(S in u)if(u.hasOwnProperty(S)&&(A=u[S],A!=null))switch(S){case"value":h=A;break;case"defaultValue":y=A;break;case"children":x=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(r(91));break;default:yt(o,a,S,A,u,null)}kv(o,h,y,x);return;case"option":for(R in u)if(u.hasOwnProperty(R)&&(h=u[R],h!=null))switch(R){case"selected":o.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:yt(o,a,R,h,u,null)}return;case"dialog":et("beforetoggle",o),et("toggle",o),et("cancel",o),et("close",o);break;case"iframe":case"object":et("load",o);break;case"video":case"audio":for(h=0;h<Pc.length;h++)et(Pc[h],o);break;case"image":et("error",o),et("load",o);break;case"details":et("toggle",o);break;case"embed":case"source":case"link":et("error",o),et("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for($ in u)if(u.hasOwnProperty($)&&(h=u[$],h!=null))switch($){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:yt(o,a,$,h,u,null)}return;default:if(Bm(a)){for(X in u)u.hasOwnProperty(X)&&(h=u[X],h!==void 0&&Cy(o,a,X,h,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(h=u[A],h!=null&&yt(o,a,A,h,u,null))}function HN(o,a,u,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,x=null,S=null,A=null,R=null,$=null,X=null;for(W in u){var te=u[W];if(u.hasOwnProperty(W)&&te!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":R=te;default:h.hasOwnProperty(W)||yt(o,a,W,null,h,te)}}for(var q in h){var W=h[q];if(te=u[q],h.hasOwnProperty(q)&&(W!=null||te!=null))switch(q){case"type":x=W;break;case"name":y=W;break;case"checked":$=W;break;case"defaultChecked":X=W;break;case"value":S=W;break;case"defaultValue":A=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,a));break;default:W!==te&&yt(o,a,q,W,h,te)}}jm(o,S,A,R,$,X,x,y);return;case"select":W=S=A=q=null;for(x in u)if(R=u[x],u.hasOwnProperty(x)&&R!=null)switch(x){case"value":break;case"multiple":W=R;default:h.hasOwnProperty(x)||yt(o,a,x,null,h,R)}for(y in h)if(x=h[y],R=u[y],h.hasOwnProperty(y)&&(x!=null||R!=null))switch(y){case"value":q=x;break;case"defaultValue":A=x;break;case"multiple":S=x;default:x!==R&&yt(o,a,y,x,h,R)}a=A,u=S,h=W,q!=null?Al(o,!!u,q,!1):!!h!=!!u&&(a!=null?Al(o,!!u,a,!0):Al(o,!!u,u?[]:"",!1));return;case"textarea":W=q=null;for(A in u)if(y=u[A],u.hasOwnProperty(A)&&y!=null&&!h.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:yt(o,a,A,null,h,y)}for(S in h)if(y=h[S],x=u[S],h.hasOwnProperty(S)&&(y!=null||x!=null))switch(S){case"value":q=y;break;case"defaultValue":W=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(r(91));break;default:y!==x&&yt(o,a,S,y,h,x)}wv(o,q,W);return;case"option":for(var ve in u)if(q=u[ve],u.hasOwnProperty(ve)&&q!=null&&!h.hasOwnProperty(ve))switch(ve){case"selected":o.selected=!1;break;default:yt(o,a,ve,null,h,q)}for(R in h)if(q=h[R],W=u[R],h.hasOwnProperty(R)&&q!==W&&(q!=null||W!=null))switch(R){case"selected":o.selected=q&&typeof q!="function"&&typeof q!="symbol";break;default:yt(o,a,R,q,h,W)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ne in u)q=u[Ne],u.hasOwnProperty(Ne)&&q!=null&&!h.hasOwnProperty(Ne)&&yt(o,a,Ne,null,h,q);for($ in h)if(q=h[$],W=u[$],h.hasOwnProperty($)&&q!==W&&(q!=null||W!=null))switch($){case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(r(137,a));break;default:yt(o,a,$,q,h,W)}return;default:if(Bm(a)){for(var bt in u)q=u[bt],u.hasOwnProperty(bt)&&q!==void 0&&!h.hasOwnProperty(bt)&&Cy(o,a,bt,void 0,h,q);for(X in h)q=h[X],W=u[X],!h.hasOwnProperty(X)||q===W||q===void 0&&W===void 0||Cy(o,a,X,q,h,W);return}}for(var B in u)q=u[B],u.hasOwnProperty(B)&&q!=null&&!h.hasOwnProperty(B)&&yt(o,a,B,null,h,q);for(te in h)q=h[te],W=u[te],!h.hasOwnProperty(te)||q===W||q==null&&W==null||yt(o,a,te,q,h,W)}function Tk(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function VN(){if(typeof performance.getEntriesByType=="function"){for(var o=0,a=0,u=performance.getEntriesByType("resource"),h=0;h<u.length;h++){var y=u[h],x=y.transferSize,S=y.initiatorType,A=y.duration;if(x&&A&&Tk(S)){for(S=0,A=y.responseEnd,h+=1;h<u.length;h++){var R=u[h],$=R.startTime;if($>A)break;var X=R.transferSize,te=R.initiatorType;X&&Tk(te)&&(R=R.responseEnd,S+=X*(R<A?1:(A-$)/(R-$)))}if(--h,a+=8*(x+S)/(y.duration/1e3),o++,10<o)break}}if(0<o)return a/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var Ey=null,Ty=null;function Tf(o){return o.nodeType===9?o:o.ownerDocument}function Ak(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Mk(o,a){if(o===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&a==="foreignObject"?0:o}function Ay(o,a){return o==="textarea"||o==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var My=null;function PN(){var o=window.event;return o&&o.type==="popstate"?o===My?!1:(My=o,!0):(My=null,!1)}var Ok=typeof setTimeout=="function"?setTimeout:void 0,$N=typeof clearTimeout=="function"?clearTimeout:void 0,_k=typeof Promise=="function"?Promise:void 0,FN=typeof queueMicrotask=="function"?queueMicrotask:typeof _k<"u"?function(o){return _k.resolve(null).then(o).catch(qN)}:Ok;function qN(o){setTimeout(function(){throw o})}function Is(o){return o==="head"}function Dk(o,a){var u=a,h=0;do{var y=u.nextSibling;if(o.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(h===0){o.removeChild(y),sa(a);return}h--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")h++;else if(u==="html")Fc(o.ownerDocument.documentElement);else if(u==="head"){u=o.ownerDocument.head,Fc(u);for(var x=u.firstChild;x;){var S=x.nextSibling,A=x.nodeName;x[ac]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&x.rel.toLowerCase()==="stylesheet"||u.removeChild(x),x=S}}else u==="body"&&Fc(o.ownerDocument.body);u=y}while(u);sa(a)}function Rk(o,a){var u=o;o=0;do{var h=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),h&&h.nodeType===8)if(u=h.data,u==="/$"){if(o===0)break;o--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||o++;u=h}while(u)}function Oy(o){var a=o.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Oy(u),zm(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}o.removeChild(u)}}function YN(o,a,u,h){for(;o.nodeType===1;){var y=u;if(o.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(h){if(!o[ac])switch(a){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(x=o.getAttribute("rel"),x==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(x!==y.rel||o.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||o.getAttribute("title")!==(y.title==null?null:y.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(x=o.getAttribute("src"),(x!==(y.src==null?null:y.src)||o.getAttribute("type")!==(y.type==null?null:y.type)||o.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&x&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(a==="input"&&o.type==="hidden"){var x=y.name==null?null:""+y.name;if(y.type==="hidden"&&o.getAttribute("name")===x)return o}else return o;if(o=Ir(o.nextSibling),o===null)break}return null}function KN(o,a,u){if(a==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!u||(o=Ir(o.nextSibling),o===null))return null;return o}function Nk(o,a){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=Ir(o.nextSibling),o===null))return null;return o}function _y(o){return o.data==="$?"||o.data==="$~"}function Dy(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function WN(o,a){var u=o.ownerDocument;if(o.data==="$~")o._reactRetry=a;else if(o.data!=="$?"||u.readyState!=="loading")a();else{var h=function(){a(),u.removeEventListener("DOMContentLoaded",h)};u.addEventListener("DOMContentLoaded",h),o._reactRetry=h}}function Ir(o){for(;o!=null;o=o.nextSibling){var a=o.nodeType;if(a===1||a===3)break;if(a===8){if(a=o.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return o}var Ry=null;function zk(o){o=o.nextSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="/$"||u==="/&"){if(a===0)return Ir(o.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}o=o.nextSibling}return null}function Lk(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return o;a--}else u!=="/$"&&u!=="/&"||a++}o=o.previousSibling}return null}function jk(o,a,u){switch(a=Tf(u),o){case"html":if(o=a.documentElement,!o)throw Error(r(452));return o;case"head":if(o=a.head,!o)throw Error(r(453));return o;case"body":if(o=a.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function Fc(o){for(var a=o.attributes;a.length;)o.removeAttributeNode(a[0]);zm(o)}var Br=new Map,Ik=new Set;function Af(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var ns=G.d;G.d={f:GN,r:ZN,D:JN,C:XN,L:QN,m:ez,X:nz,S:tz,M:rz};function GN(){var o=ns.f(),a=bf();return o||a}function ZN(o){var a=Cl(o);a!==null&&a.tag===5&&a.type==="form"?ew(a):ns.r(o)}var na=typeof document>"u"?null:document;function Bk(o,a,u){var h=na;if(h&&typeof a=="string"&&a){var y=_r(a);y='link[rel="'+o+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),Ik.has(y)||(Ik.add(y),o={rel:o,crossOrigin:u,href:a},h.querySelector(y)===null&&(a=h.createElement("link"),En(a,"link",o),cn(a),h.head.appendChild(a)))}}function JN(o){ns.D(o),Bk("dns-prefetch",o,null)}function XN(o,a){ns.C(o,a),Bk("preconnect",o,a)}function QN(o,a,u){ns.L(o,a,u);var h=na;if(h&&o&&a){var y='link[rel="preload"][as="'+_r(a)+'"]';a==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+_r(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+_r(u.imageSizes)+'"]')):y+='[href="'+_r(o)+'"]';var x=y;switch(a){case"style":x=ra(o);break;case"script":x=ia(o)}Br.has(x)||(o=m({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:o,as:a},u),Br.set(x,o),h.querySelector(y)!==null||a==="style"&&h.querySelector(qc(x))||a==="script"&&h.querySelector(Yc(x))||(a=h.createElement("link"),En(a,"link",o),cn(a),h.head.appendChild(a)))}}function ez(o,a){ns.m(o,a);var u=na;if(u&&o){var h=a&&typeof a.as=="string"?a.as:"script",y='link[rel="modulepreload"][as="'+_r(h)+'"][href="'+_r(o)+'"]',x=y;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=ia(o)}if(!Br.has(x)&&(o=m({rel:"modulepreload",href:o},a),Br.set(x,o),u.querySelector(y)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Yc(x)))return}h=u.createElement("link"),En(h,"link",o),cn(h),u.head.appendChild(h)}}}function tz(o,a,u){ns.S(o,a,u);var h=na;if(h&&o){var y=El(h).hoistableStyles,x=ra(o);a=a||"default";var S=y.get(x);if(!S){var A={loading:0,preload:null};if(S=h.querySelector(qc(x)))A.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":a},u),(u=Br.get(x))&&Ny(o,u);var R=S=h.createElement("link");cn(R),En(R,"link",o),R._p=new Promise(function($,X){R.onload=$,R.onerror=X}),R.addEventListener("load",function(){A.loading|=1}),R.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Mf(S,a,h)}S={type:"stylesheet",instance:S,count:1,state:A},y.set(x,S)}}}function nz(o,a){ns.X(o,a);var u=na;if(u&&o){var h=El(u).hoistableScripts,y=ia(o),x=h.get(y);x||(x=u.querySelector(Yc(y)),x||(o=m({src:o,async:!0},a),(a=Br.get(y))&&zy(o,a),x=u.createElement("script"),cn(x),En(x,"link",o),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(y,x))}}function rz(o,a){ns.M(o,a);var u=na;if(u&&o){var h=El(u).hoistableScripts,y=ia(o),x=h.get(y);x||(x=u.querySelector(Yc(y)),x||(o=m({src:o,async:!0,type:"module"},a),(a=Br.get(y))&&zy(o,a),x=u.createElement("script"),cn(x),En(x,"link",o),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(y,x))}}function Uk(o,a,u,h){var y=(y=le.current)?Af(y):null;if(!y)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=ra(u.href),u=El(y).hoistableStyles,h=u.get(a),h||(h={type:"style",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){o=ra(u.href);var x=El(y).hoistableStyles,S=x.get(o);if(S||(y=y.ownerDocument||y,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(o,S),(x=y.querySelector(qc(o)))&&!x._p&&(S.instance=x,S.state.loading=5),Br.has(o)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Br.set(o,u),x||iz(y,o,u,S.state))),a&&h===null)throw Error(r(528,""));return S}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=ia(u),u=El(y).hoistableScripts,h=u.get(a),h||(h={type:"script",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function ra(o){return'href="'+_r(o)+'"'}function qc(o){return'link[rel="stylesheet"]['+o+"]"}function Hk(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function iz(o,a,u,h){o.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=o.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),En(a,"link",u),cn(a),o.head.appendChild(a))}function ia(o){return'[src="'+_r(o)+'"]'}function Yc(o){return"script[async]"+o}function Vk(o,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var h=o.querySelector('style[data-href~="'+_r(u.href)+'"]');if(h)return a.instance=h,cn(h),h;var y=m({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(o.ownerDocument||o).createElement("style"),cn(h),En(h,"style",y),Mf(h,u.precedence,o),a.instance=h;case"stylesheet":y=ra(u.href);var x=o.querySelector(qc(y));if(x)return a.state.loading|=4,a.instance=x,cn(x),x;h=Hk(u),(y=Br.get(y))&&Ny(h,y),x=(o.ownerDocument||o).createElement("link"),cn(x);var S=x;return S._p=new Promise(function(A,R){S.onload=A,S.onerror=R}),En(x,"link",h),a.state.loading|=4,Mf(x,u.precedence,o),a.instance=x;case"script":return x=ia(u.src),(y=o.querySelector(Yc(x)))?(a.instance=y,cn(y),y):(h=u,(y=Br.get(x))&&(h=m({},u),zy(h,y)),o=o.ownerDocument||o,y=o.createElement("script"),cn(y),En(y,"link",h),o.head.appendChild(y),a.instance=y);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,Mf(h,u.precedence,o));return a.instance}function Mf(o,a,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=h.length?h[h.length-1]:null,x=y,S=0;S<h.length;S++){var A=h[S];if(A.dataset.precedence===a)x=A;else if(x!==y)break}x?x.parentNode.insertBefore(o,x.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(o,a.firstChild))}function Ny(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.title==null&&(o.title=a.title)}function zy(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.integrity==null&&(o.integrity=a.integrity)}var Of=null;function Pk(o,a,u){if(Of===null){var h=new Map,y=Of=new Map;y.set(u,h)}else y=Of,h=y.get(u),h||(h=new Map,y.set(u,h));if(h.has(o))return h;for(h.set(o,null),u=u.getElementsByTagName(o),y=0;y<u.length;y++){var x=u[y];if(!(x[ac]||x[Sn]||o==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var S=x.getAttribute(a)||"";S=o+S;var A=h.get(S);A?A.push(x):h.set(S,[x])}}return h}function $k(o,a,u){o=o.ownerDocument||o,o.head.insertBefore(u,a==="title"?o.querySelector("head > title"):null)}function sz(o,a,u){if(u===1||a.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return o=a.disabled,typeof a.precedence=="string"&&o==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Fk(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function oz(o,a,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=ra(h.href),x=a.querySelector(qc(y));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(o.count++,o=_f.bind(o),a.then(o,o)),u.state.loading|=4,u.instance=x,cn(x);return}x=a.ownerDocument||a,h=Hk(h),(y=Br.get(y))&&Ny(h,y),x=x.createElement("link"),cn(x);var S=x;S._p=new Promise(function(A,R){S.onload=A,S.onerror=R}),En(x,"link",h),u.instance=x}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(o.count++,u=_f.bind(o),a.addEventListener("load",u),a.addEventListener("error",u))}}var Ly=0;function lz(o,a){return o.stylesheets&&o.count===0&&Rf(o,o.stylesheets),0<o.count||0<o.imgCount?function(u){var h=setTimeout(function(){if(o.stylesheets&&Rf(o,o.stylesheets),o.unsuspend){var x=o.unsuspend;o.unsuspend=null,x()}},6e4+a);0<o.imgBytes&&Ly===0&&(Ly=62500*VN());var y=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Rf(o,o.stylesheets),o.unsuspend)){var x=o.unsuspend;o.unsuspend=null,x()}},(o.imgBytes>Ly?50:800)+a);return o.unsuspend=u,function(){o.unsuspend=null,clearTimeout(h),clearTimeout(y)}}:null}function _f(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Rf(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Df=null;function Rf(o,a){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Df=new Map,a.forEach(az,o),Df=null,_f.call(o))}function az(o,a){if(!(a.state.loading&4)){var u=Df.get(o);if(u)var h=u.get(null);else{u=new Map,Df.set(o,u);for(var y=o.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<y.length;x++){var S=y[x];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(u.set(S.dataset.precedence,S),h=S)}h&&u.set(null,h)}y=a.instance,S=y.getAttribute("data-precedence"),x=u.get(S)||h,x===h&&u.set(null,y),u.set(S,y),this.count++,h=_f.bind(this),y.addEventListener("load",h),y.addEventListener("error",h),x?x.parentNode.insertBefore(y,x.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(y,o.firstChild)),a.state.loading|=4}}var Kc={$$typeof:j,Provider:null,Consumer:null,_currentValue:me,_currentValue2:me,_threadCount:0};function cz(o,a,u,h,y,x,S,A,R){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Sl(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Sl(0),this.hiddenUpdates=Sl(null),this.identifierPrefix=h,this.onUncaughtError=y,this.onCaughtError=x,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function qk(o,a,u,h,y,x,S,A,R,$,X,te){return o=new cz(o,a,u,S,R,$,X,te,A),a=1,x===!0&&(a|=24),x=pr(3,null,null,a),o.current=x,x.stateNode=o,a=pg(),a.refCount++,o.pooledCache=a,a.refCount++,x.memoizedState={element:h,isDehydrated:u,cache:a},bg(x),o}function Yk(o){return o?(o=Ll,o):Ll}function Kk(o,a,u,h,y,x){y=Yk(y),h.context===null?h.context=y:h.pendingContext=y,h=Ts(a),h.payload={element:u},x=x===void 0?null:x,x!==null&&(h.callback=x),u=As(o,h,a),u!==null&&(rr(u,o,a),Ec(u,o,a))}function Wk(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var u=o.retryLane;o.retryLane=u!==0&&u<a?u:a}}function jy(o,a){Wk(o,a),(o=o.alternate)&&Wk(o,a)}function Gk(o){if(o.tag===13||o.tag===31){var a=Ao(o,67108864);a!==null&&rr(a,o,67108864),jy(o,67108864)}}function Zk(o){if(o.tag===13||o.tag===31){var a=xr();a=Dm(a);var u=Ao(o,a);u!==null&&rr(u,o,a),jy(o,a)}}var Nf=!0;function uz(o,a,u,h){var y=L.T;L.T=null;var x=G.p;try{G.p=2,Iy(o,a,u,h)}finally{G.p=x,L.T=y}}function dz(o,a,u,h){var y=L.T;L.T=null;var x=G.p;try{G.p=8,Iy(o,a,u,h)}finally{G.p=x,L.T=y}}function Iy(o,a,u,h){if(Nf){var y=By(h);if(y===null)ky(o,a,h,zf,u),Xk(o,h);else if(hz(y,o,a,u,h))h.stopPropagation();else if(Xk(o,h),a&4&&-1<fz.indexOf(o)){for(;y!==null;){var x=Cl(y);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var S=fi(x.pendingLanes);if(S!==0){var A=x;for(A.pendingLanes|=2,A.entangledLanes|=2;S;){var R=1<<31-Ge(S);A.entanglements[1]|=R,S&=~R}yi(x),(ft&6)===0&&(gf=qt()+500,Vc(0))}}break;case 31:case 13:A=Ao(x,2),A!==null&&rr(A,x,2),bf(),jy(x,2)}if(x=By(h),x===null&&ky(o,a,h,zf,u),x===y)break;y=x}y!==null&&h.stopPropagation()}else ky(o,a,h,null,u)}}function By(o){return o=Hm(o),Uy(o)}var zf=null;function Uy(o){if(zf=null,o=kl(o),o!==null){var a=s(o);if(a===null)o=null;else{var u=a.tag;if(u===13){if(o=l(a),o!==null)return o;o=null}else if(u===31){if(o=c(a),o!==null)return o;o=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null)}}return zf=o,null}function Jk(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ii()){case J:return 2;case de:return 8;case Ee:case K:return 32;case ge:return 268435456;default:return 32}default:return 32}}var Hy=!1,Bs=null,Us=null,Hs=null,Wc=new Map,Gc=new Map,Vs=[],fz="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 Xk(o,a){switch(o){case"focusin":case"focusout":Bs=null;break;case"dragenter":case"dragleave":Us=null;break;case"mouseover":case"mouseout":Hs=null;break;case"pointerover":case"pointerout":Wc.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gc.delete(a.pointerId)}}function Zc(o,a,u,h,y,x){return o===null||o.nativeEvent!==x?(o={blockedOn:a,domEventName:u,eventSystemFlags:h,nativeEvent:x,targetContainers:[y]},a!==null&&(a=Cl(a),a!==null&&Gk(a)),o):(o.eventSystemFlags|=h,a=o.targetContainers,y!==null&&a.indexOf(y)===-1&&a.push(y),o)}function hz(o,a,u,h,y){switch(a){case"focusin":return Bs=Zc(Bs,o,a,u,h,y),!0;case"dragenter":return Us=Zc(Us,o,a,u,h,y),!0;case"mouseover":return Hs=Zc(Hs,o,a,u,h,y),!0;case"pointerover":var x=y.pointerId;return Wc.set(x,Zc(Wc.get(x)||null,o,a,u,h,y)),!0;case"gotpointercapture":return x=y.pointerId,Gc.set(x,Zc(Gc.get(x)||null,o,a,u,h,y)),!0}return!1}function Qk(o){var a=kl(o.target);if(a!==null){var u=s(a);if(u!==null){if(a=u.tag,a===13){if(a=l(u),a!==null){o.blockedOn=a,hv(o.priority,function(){Zk(u)});return}}else if(a===31){if(a=c(u),a!==null){o.blockedOn=a,hv(o.priority,function(){Zk(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){o.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Lf(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var u=By(o.nativeEvent);if(u===null){u=o.nativeEvent;var h=new u.constructor(u.type,u);Um=h,u.target.dispatchEvent(h),Um=null}else return a=Cl(u),a!==null&&Gk(a),o.blockedOn=u,!1;a.shift()}return!0}function eC(o,a,u){Lf(o)&&u.delete(a)}function pz(){Hy=!1,Bs!==null&&Lf(Bs)&&(Bs=null),Us!==null&&Lf(Us)&&(Us=null),Hs!==null&&Lf(Hs)&&(Hs=null),Wc.forEach(eC),Gc.forEach(eC)}function jf(o,a){o.blockedOn===a&&(o.blockedOn=null,Hy||(Hy=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,pz)))}var If=null;function tC(o){If!==o&&(If=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){If===o&&(If=null);for(var a=0;a<o.length;a+=3){var u=o[a],h=o[a+1],y=o[a+2];if(typeof h!="function"){if(Uy(h||u)===null)continue;break}var x=Cl(u);x!==null&&(o.splice(a,3),a-=3,Bg(x,{pending:!0,data:y,method:u.method,action:h},h,y))}}))}function sa(o){function a(R){return jf(R,o)}Bs!==null&&jf(Bs,o),Us!==null&&jf(Us,o),Hs!==null&&jf(Hs,o),Wc.forEach(a),Gc.forEach(a);for(var u=0;u<Vs.length;u++){var h=Vs[u];h.blockedOn===o&&(h.blockedOn=null)}for(;0<Vs.length&&(u=Vs[0],u.blockedOn===null);)Qk(u),u.blockedOn===null&&Vs.shift();if(u=(o.ownerDocument||o).$$reactFormReplay,u!=null)for(h=0;h<u.length;h+=3){var y=u[h],x=u[h+1],S=y[Jn]||null;if(typeof x=="function")S||tC(u);else if(S){var A=null;if(x&&x.hasAttribute("formAction")){if(y=x,S=x[Jn]||null)A=S.formAction;else if(Uy(y)!==null)continue}else A=S.action;typeof A=="function"?u[h+1]=A:(u.splice(h,3),h-=3),tC(u)}}}function nC(){function o(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(S){return y=S})},focusReset:"manual",scroll:"manual"})}function a(){y!==null&&(y(),y=null),h||setTimeout(u,20)}function u(){if(!h&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,y=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){h=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),y!==null&&(y(),y=null)}}}function Vy(o){this._internalRoot=o}Bf.prototype.render=Vy.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,h=xr();Kk(u,h,o,a,null,null)},Bf.prototype.unmount=Vy.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;Kk(o.current,2,null,o,null,null),bf(),a[wl]=null}};function Bf(o){this._internalRoot=o}Bf.prototype.unstable_scheduleHydration=function(o){if(o){var a=fv();o={blockedOn:null,target:o,priority:a};for(var u=0;u<Vs.length&&a!==0&&a<Vs[u].priority;u++);Vs.splice(u,0,o),u===0&&Qk(o)}};var rC=e.version;if(rC!=="19.2.4")throw Error(r(527,rC,"19.2.4"));G.findDOMNode=function(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=f(a),o=o!==null?p(o):null,o=o===null?null:o.stateNode,o};var mz={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Uf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Uf.isDisabled&&Uf.supportsFiber)try{re=Uf.inject(mz),Le=Uf}catch{}}return Xc.createRoot=function(o,a){if(!i(o))throw Error(r(299));var u=!1,h="",y=uw,x=dw,S=fw;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(y=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError)),a=qk(o,1,!1,null,null,u,h,null,y,x,S,nC),o[wl]=a.current,wy(o),new Vy(a)},Xc.hydrateRoot=function(o,a,u){if(!i(o))throw Error(r(299));var h=!1,y="",x=uw,S=dw,A=fw,R=null;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(x=u.onUncaughtError),u.onCaughtError!==void 0&&(S=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(R=u.formState)),a=qk(o,1,!0,a,u??null,h,y,R,x,S,A,nC),a.context=Yk(null),u=a.current,h=xr(),h=Dm(h),y=Ts(h),y.callback=null,As(u,y,h),u=h,a.current.lanes=u,So(a,u),yi(a),o[wl]=a.current,wy(o),new Bf(a)},Xc.version="19.2.4",Xc}var hC;function Tz(){if(hC)return Fy.exports;hC=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(),Fy.exports=Ez(),Fy.exports}var Az=Tz();const pC=3478,Ga=3479,Mz=3e3,Oz=3e3,_z=3e4,zu={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)"},mC="tandem",Vf="tandem:mode",oM="tandem:settings",Dz="tandem-panel-width",Rz="tandem-left-panel-width",lM={left:Rz,right:Dz},aM=1e3,Nh=500,zh=3e3,Nz="__tandem_ctrl__",xa="annotations",cM="awareness",ib="userAwareness",zz="mode",Lz="selectionDwellMs",gC="chat",mh="documentMeta",jz="annotationReplies",yC="savedAtVersion",bC="authorship",uM="tandem:showAuthorship",Ax="tandem:recentFiles",Iz=20,Mx="tandem:userName",dM="You",sb="tandem:user-name-changed",fM=40,xC={error:8e3,warning:6e3,info:4e3},Bz=5,hM="tandem:tutorialCompleted",Uz="tutorial-",vC="tandem:zoomLevel",SC=.5,wC=2,Qc=1,Hz="upload://";function Vz(t){return t.startsWith(Hz)}const gh=t=>t,Kr=t=>t;var dt;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const s={};for(const l of i)s[l]=l;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),l={};for(const c of s)l[c]=i[c];return t.objectValues(l)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const l in i)Object.prototype.hasOwnProperty.call(i,l)&&s.push(l);return s},t.find=(i,s)=>{for(const l of i)if(s(l))return l},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(dt||(dt={}));var kC;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(kC||(kC={}));const we=dt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ys=t=>{switch(typeof t){case"undefined":return we.undefined;case"string":return we.string;case"number":return Number.isNaN(t)?we.nan:we.number;case"boolean":return we.boolean;case"function":return we.function;case"bigint":return we.bigint;case"symbol":return we.symbol;case"object":return Array.isArray(t)?we.array:t===null?we.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?we.promise:typeof Map<"u"&&t instanceof Map?we.map:typeof Set<"u"&&t instanceof Set?we.set:typeof Date<"u"&&t instanceof Date?we.date:we.object;default:return we.unknown}},fe=dt.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 gs extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const l of s.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let c=r,d=0;for(;d<l.path.length;){const f=l.path[d];d===l.path.length-1?(c[f]=c[f]||{_errors:[]},c[f]._errors.push(n(l))):c[f]=c[f]||{_errors:[]},c=c[f],d++}}};return i(this),r}static assert(e){if(!(e instanceof gs))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,dt.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()}}gs.create=t=>new gs(t);const ob=(t,e)=>{let n;switch(t.code){case fe.invalid_type:t.received===we.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case fe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,dt.jsonStringifyReplacer)}`;break;case fe.unrecognized_keys:n=`Unrecognized key(s) in object: ${dt.joinValues(t.keys,", ")}`;break;case fe.invalid_union:n="Invalid input";break;case fe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${dt.joinValues(t.options)}`;break;case fe.invalid_enum_value:n=`Invalid enum value. Expected ${dt.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}"`:dt.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,dt.assertNever(t)}return{message:n}};let Pz=ob;function $z(){return Pz}const Fz=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],l={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="";const d=r.filter(f=>!!f).slice().reverse();for(const f of d)c=f(l,{data:e,defaultError:c}).message;return{...i,path:s,message:c}};function be(t,e){const n=$z(),r=Fz({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ob?void 0:ob].filter(i=>!!i)});t.common.issues.push(r)}class Tr{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 He;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const s=await i.key,l=await i.value;r.push({key:s,value:l})}return Tr.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:l}=i;if(s.status==="aborted"||l.status==="aborted")return He;s.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(r[s.value]=l.value)}return{status:e.value,value:r}}}const He=Object.freeze({status:"aborted"}),au=t=>({status:"dirty",value:t}),Xr=t=>({status:"valid",value:t}),CC=t=>t.status==="aborted",EC=t=>t.status==="dirty",Ra=t=>t.status==="valid",Lh=t=>typeof Promise<"u"&&t instanceof Promise;var Ce;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ce||(Ce={}));class co{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const TC=(t,e)=>{if(Ra(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 gs(t.common.issues);return this._error=n,this._error}}};function Je(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(l,c)=>{const{message:d}=t;return l.code==="invalid_enum_value"?{message:d??c.defaultError}:typeof c.data>"u"?{message:d??r??c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:d??n??c.defaultError}},description:i}}class lt{get description(){return this._def.description}_getType(e){return Ys(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Ys(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Tr,ctx:{common:e.parent.common,data:e.data,parsedType:Ys(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Lh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ys(e)},i=this._parseSync({data:e,path:r.path,parent:r});return TC(r,i)}"~validate"(e){var r,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ys(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:n});return Ra(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=>Ra(s)?{value:s.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ys(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Lh(i)?i:Promise.resolve(i));return TC(r,s)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const l=e(i),c=()=>s.addIssue({code:fe.custom,...r(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(c(),!1)):l?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new za({schema:this,typeName:Ve.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return io.create(this,this._def)}nullable(){return La.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ei.create(this)}promise(){return Uh.create(this,this._def)}or(e){return Ih.create([this,e],this._def)}and(e){return Bh.create(this,e,this._def)}transform(e){return new za({...Je(this._def),schema:this,typeName:Ve.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new ab({...Je(this._def),innerType:this,defaultValue:n,typeName:Ve.ZodDefault})}brand(){return new hL({typeName:Ve.ZodBranded,type:this,...Je(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new cb({...Je(this._def),innerType:this,catchValue:n,typeName:Ve.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Ox.create(this,e)}readonly(){return ub.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const qz=/^c[^\s-]{8,}$/i,Yz=/^[0-9a-z]+$/,Kz=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Wz=/^[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,Gz=/^[a-z0-9_-]{21}$/i,Zz=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Jz=/^[-+]?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)?)??$/,Xz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Wy;const eL=/^(?:(?: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])$/,tL=/^(?:(?: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])$/,nL=/^(([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]))$/,rL=/^(([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])$/,iL=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sL=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pM="((\\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])))",oL=new RegExp(`^${pM}$`);function mM(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 lL(t){return new RegExp(`^${mM(t)}$`)}function aL(t){let e=`${pM}T${mM(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 cL(t,e){return!!((e==="v4"||!e)&&eL.test(t)||(e==="v6"||!e)&&nL.test(t))}function uL(t,e){if(!Zz.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 dL(t,e){return!!((e==="v4"||!e)&&tL.test(t)||(e==="v6"||!e)&&rL.test(t))}class Fo extends lt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==we.string){const s=this._getOrReturnCtx(e);return be(s,{code:fe.invalid_type,expected:we.string,received:s.parsedType}),He}const r=new Tr;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),be(i,{code: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),be(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 l=e.data.length>s.value,c=e.data.length<s.value;(l||c)&&(i=this._getOrReturnCtx(e,i),l?be(i,{code:fe.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&be(i,{code:fe.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Xz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"email",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Wy||(Wy=new RegExp(Qz,"u")),Wy.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"emoji",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Wz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"uuid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")Gz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"nanoid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")qz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"cuid",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Yz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"cuid2",code:fe.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Kz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(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),be(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),be(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),be(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),be(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),be(i,{code:fe.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?aL(s).test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{code:fe.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?oL.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{code:fe.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?lL(s).test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{code:fe.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Jz.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"duration",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?cL(e.data,s.version)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"ip",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?uL(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"jwt",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?dL(e.data,s.version)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"cidr",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?iL.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"base64",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?sL.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"base64url",code:fe.invalid_string,message:s.message}),r.dirty()):dt.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,...Ce.errToObj(r)})}_addCheck(e){return new Fo({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ce.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ce.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ce.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ce.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ce.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ce.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ce.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ce.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ce.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ce.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ce.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ce.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ce.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Ce.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Ce.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ce.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ce.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Ce.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ce.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ce.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ce.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ce.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ce.errToObj(n)})}nonempty(e){return this.min(1,Ce.errToObj(e))}trim(){return new Fo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Fo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Fo({...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}}Fo.create=t=>new Fo({checks:[],typeName:Ve.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Je(t)});function fL(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,s=Number.parseInt(t.toFixed(i).replace(".","")),l=Number.parseInt(e.toFixed(i).replace(".",""));return s%l/10**i}class Lu extends lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==we.number){const s=this._getOrReturnCtx(e);return be(s,{code:fe.invalid_type,expected:we.number,received:s.parsedType}),He}let r;const i=new Tr;for(const s of this._def.checks)s.kind==="int"?dt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),be(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),be(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),be(r,{code:fe.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?fL(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),be(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),be(r,{code:fe.not_finite,message:s.message}),i.dirty()):dt.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ce.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ce.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ce.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ce.toString(n))}setLimit(e,n,r,i){return new Lu({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ce.toString(i)}]})}_addCheck(e){return new Lu({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ce.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ce.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ce.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ce.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ce.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ce.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ce.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ce.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ce.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&dt.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)}}Lu.create=t=>new Lu({checks:[],typeName:Ve.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Je(t)});class ju extends lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==we.bigint)return this._getInvalidInput(e);let r;const i=new Tr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),be(r,{code: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),be(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),be(r,{code:fe.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):dt.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return be(n,{code:fe.invalid_type,expected:we.bigint,received:n.parsedType}),He}gte(e,n){return this.setLimit("min",e,!0,Ce.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ce.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ce.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ce.toString(n))}setLimit(e,n,r,i){return new ju({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ce.toString(i)}]})}_addCheck(e){return new ju({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ce.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ce.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ce.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ce.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ce.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}ju.create=t=>new ju({checks:[],typeName:Ve.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Je(t)});class AC extends lt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==we.boolean){const r=this._getOrReturnCtx(e);return be(r,{code:fe.invalid_type,expected:we.boolean,received:r.parsedType}),He}return Xr(e.data)}}AC.create=t=>new AC({typeName:Ve.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Je(t)});class jh extends lt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==we.date){const s=this._getOrReturnCtx(e);return be(s,{code:fe.invalid_type,expected:we.date,received:s.parsedType}),He}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return be(s,{code:fe.invalid_date}),He}const r=new Tr;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),be(i,{code: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),be(i,{code:fe.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):dt.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new jh({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ce.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ce.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}jh.create=t=>new jh({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Ve.ZodDate,...Je(t)});class MC extends lt{_parse(e){if(this._getType(e)!==we.symbol){const r=this._getOrReturnCtx(e);return be(r,{code:fe.invalid_type,expected:we.symbol,received:r.parsedType}),He}return Xr(e.data)}}MC.create=t=>new MC({typeName:Ve.ZodSymbol,...Je(t)});class OC extends lt{_parse(e){if(this._getType(e)!==we.undefined){const r=this._getOrReturnCtx(e);return be(r,{code:fe.invalid_type,expected:we.undefined,received:r.parsedType}),He}return Xr(e.data)}}OC.create=t=>new OC({typeName:Ve.ZodUndefined,...Je(t)});class _C extends lt{_parse(e){if(this._getType(e)!==we.null){const r=this._getOrReturnCtx(e);return be(r,{code:fe.invalid_type,expected:we.null,received:r.parsedType}),He}return Xr(e.data)}}_C.create=t=>new _C({typeName:Ve.ZodNull,...Je(t)});class DC extends lt{constructor(){super(...arguments),this._any=!0}_parse(e){return Xr(e.data)}}DC.create=t=>new DC({typeName:Ve.ZodAny,...Je(t)});class RC extends lt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Xr(e.data)}}RC.create=t=>new RC({typeName:Ve.ZodUnknown,...Je(t)});class uo extends lt{_parse(e){const n=this._getOrReturnCtx(e);return be(n,{code:fe.invalid_type,expected:we.never,received:n.parsedType}),He}}uo.create=t=>new uo({typeName:Ve.ZodNever,...Je(t)});class NC extends lt{_parse(e){if(this._getType(e)!==we.undefined){const r=this._getOrReturnCtx(e);return be(r,{code:fe.invalid_type,expected:we.void,received:r.parsedType}),He}return Xr(e.data)}}NC.create=t=>new NC({typeName:Ve.ZodVoid,...Je(t)});class Ei extends lt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==we.array)return be(n,{code:fe.invalid_type,expected:we.array,received:n.parsedType}),He;if(i.exactLength!==null){const l=n.data.length>i.exactLength.value,c=n.data.length<i.exactLength.value;(l||c)&&(be(n,{code:l?fe.too_big:fe.too_small,minimum:c?i.exactLength.value:void 0,maximum:l?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(be(n,{code: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&&(be(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((l,c)=>i.type._parseAsync(new co(n,l,n.path,c)))).then(l=>Tr.mergeArray(r,l));const s=[...n.data].map((l,c)=>i.type._parseSync(new co(n,l,n.path,c)));return Tr.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new Ei({...this._def,minLength:{value:e,message:Ce.toString(n)}})}max(e,n){return new Ei({...this._def,maxLength:{value:e,message:Ce.toString(n)}})}length(e,n){return new Ei({...this._def,exactLength:{value:e,message:Ce.toString(n)}})}nonempty(e){return this.min(1,e)}}Ei.create=(t,e)=>new Ei({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ve.ZodArray,...Je(e)});function da(t){if(t instanceof an){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=io.create(da(r))}return new an({...t._def,shape:()=>e})}else return t instanceof Ei?new Ei({...t._def,type:da(t.element)}):t instanceof io?io.create(da(t.unwrap())):t instanceof La?La.create(da(t.unwrap())):t instanceof rl?rl.create(t.items.map(e=>da(e))):t}class an extends lt{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=dt.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==we.object){const f=this._getOrReturnCtx(e);return be(f,{code:fe.invalid_type,expected:we.object,received:f.parsedType}),He}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof uo&&this._def.unknownKeys==="strip"))for(const f in i.data)l.includes(f)||c.push(f);const d=[];for(const f of l){const p=s[f],m=i.data[f];d.push({key:{status:"valid",value:f},value:p._parse(new co(i,m,i.path,f)),alwaysSet:f in i.data})}if(this._def.catchall instanceof uo){const f=this._def.unknownKeys;if(f==="passthrough")for(const p of c)d.push({key:{status:"valid",value:p},value:{status:"valid",value:i.data[p]}});else if(f==="strict")c.length>0&&(be(i,{code:fe.unrecognized_keys,keys:c}),r.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const p of c){const m=i.data[p];d.push({key:{status:"valid",value:p},value:f._parse(new co(i,m,i.path,p)),alwaysSet:p in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const f=[];for(const p of d){const m=await p.key,g=await p.value;f.push({key:m,value:g,alwaysSet:p.alwaysSet})}return f}).then(f=>Tr.mergeObjectSync(r,f)):Tr.mergeObjectSync(r,d)}get shape(){return this._def.shape()}strict(e){return Ce.errToObj,new an({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var s,l;const i=((l=(s=this._def).errorMap)==null?void 0:l.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Ce.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new an({...this._def,unknownKeys:"strip"})}passthrough(){return new an({...this._def,unknownKeys:"passthrough"})}extend(e){return new an({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new an({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ve.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new an({...this._def,catchall:e})}pick(e){const n={};for(const r of dt.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new an({...this._def,shape:()=>n})}omit(e){const n={};for(const r of dt.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new an({...this._def,shape:()=>n})}deepPartial(){return da(this)}partial(e){const n={};for(const r of dt.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new an({...this._def,shape:()=>n})}required(e){const n={};for(const r of dt.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof io;)s=s._def.innerType;n[r]=s}return new an({...this._def,shape:()=>n})}keyof(){return gM(dt.objectKeys(this.shape))}}an.create=(t,e)=>new an({shape:()=>t,unknownKeys:"strip",catchall:uo.create(),typeName:Ve.ZodObject,...Je(e)});an.strictCreate=(t,e)=>new an({shape:()=>t,unknownKeys:"strict",catchall:uo.create(),typeName:Ve.ZodObject,...Je(e)});an.lazycreate=(t,e)=>new an({shape:t,unknownKeys:"strip",catchall:uo.create(),typeName:Ve.ZodObject,...Je(e)});class Ih extends lt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const c of s)if(c.result.status==="valid")return c.result;for(const c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const l=s.map(c=>new gs(c.ctx.common.issues));return be(n,{code:fe.invalid_union,unionErrors:l}),He}if(n.common.async)return Promise.all(r.map(async s=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(i);{let s;const l=[];for(const d of r){const f={...n,common:{...n.common,issues:[]},parent:null},p=d._parseSync({data:n.data,path:n.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:f}),f.common.issues.length&&l.push(f.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=l.map(d=>new gs(d));return be(n,{code:fe.invalid_union,unionErrors:c}),He}}get options(){return this._def.options}}Ih.create=(t,e)=>new Ih({options:t,typeName:Ve.ZodUnion,...Je(e)});function lb(t,e){const n=Ys(t),r=Ys(e);if(t===e)return{valid:!0,data:t};if(n===we.object&&r===we.object){const i=dt.objectKeys(e),s=dt.objectKeys(t).filter(c=>i.indexOf(c)!==-1),l={...t,...e};for(const c of s){const d=lb(t[c],e[c]);if(!d.valid)return{valid:!1};l[c]=d.data}return{valid:!0,data:l}}else if(n===we.array&&r===we.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const l=t[s],c=e[s],d=lb(l,c);if(!d.valid)return{valid:!1};i.push(d.data)}return{valid:!0,data:i}}else return n===we.date&&r===we.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Bh extends lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,l)=>{if(CC(s)||CC(l))return He;const c=lb(s.value,l.value);return c.valid?((EC(s)||EC(l))&&n.dirty(),{status:n.value,value:c.data}):(be(r,{code:fe.invalid_intersection_types}),He)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,l])=>i(s,l)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Bh.create=(t,e,n)=>new Bh({left:t,right:e,typeName:Ve.ZodIntersection,...Je(n)});class rl extends lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==we.array)return be(r,{code:fe.invalid_type,expected:we.array,received:r.parsedType}),He;if(r.data.length<this._def.items.length)return be(r,{code:fe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),He;!this._def.rest&&r.data.length>this._def.items.length&&(be(r,{code:fe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((l,c)=>{const d=this._def.items[c]||this._def.rest;return d?d._parse(new co(r,l,r.path,c)):null}).filter(l=>!!l);return r.common.async?Promise.all(s).then(l=>Tr.mergeArray(n,l)):Tr.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new rl({...this._def,rest:e})}}rl.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new rl({items:t,typeName:Ve.ZodTuple,rest:null,...Je(e)})};class zC extends lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==we.map)return be(r,{code:fe.invalid_type,expected:we.map,received:r.parsedType}),He;const i=this._def.keyType,s=this._def.valueType,l=[...r.data.entries()].map(([c,d],f)=>({key:i._parse(new co(r,c,r.path,[f,"key"])),value:s._parse(new co(r,d,r.path,[f,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const d of l){const f=await d.key,p=await d.value;if(f.status==="aborted"||p.status==="aborted")return He;(f.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(f.value,p.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const d of l){const f=d.key,p=d.value;if(f.status==="aborted"||p.status==="aborted")return He;(f.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(f.value,p.value)}return{status:n.value,value:c}}}}zC.create=(t,e,n)=>new zC({valueType:e,keyType:t,typeName:Ve.ZodMap,...Je(n)});class Iu extends lt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==we.set)return be(r,{code:fe.invalid_type,expected:we.set,received:r.parsedType}),He;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(be(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&&(be(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 l(d){const f=new Set;for(const p of d){if(p.status==="aborted")return He;p.status==="dirty"&&n.dirty(),f.add(p.value)}return{status:n.value,value:f}}const c=[...r.data.values()].map((d,f)=>s._parse(new co(r,d,r.path,f)));return r.common.async?Promise.all(c).then(d=>l(d)):l(c)}min(e,n){return new Iu({...this._def,minSize:{value:e,message:Ce.toString(n)}})}max(e,n){return new Iu({...this._def,maxSize:{value:e,message:Ce.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Iu.create=(t,e)=>new Iu({valueType:t,minSize:null,maxSize:null,typeName:Ve.ZodSet,...Je(e)});class LC extends lt{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})}}LC.create=(t,e)=>new LC({getter:t,typeName:Ve.ZodLazy,...Je(e)});class jC extends lt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return be(n,{received:n.data,code:fe.invalid_literal,expected:this._def.value}),He}return{status:"valid",value:e.data}}get value(){return this._def.value}}jC.create=(t,e)=>new jC({value:t,typeName:Ve.ZodLiteral,...Je(e)});function gM(t,e){return new Na({values:t,typeName:Ve.ZodEnum,...Je(e)})}class Na extends lt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return be(n,{expected:dt.joinValues(r),received:n.parsedType,code:fe.invalid_type}),He}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return be(n,{received:n.data,code:fe.invalid_enum_value,options:r}),He}return Xr(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 Na.create(e,{...this._def,...n})}exclude(e,n=this._def){return Na.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Na.create=gM;class IC extends lt{_parse(e){const n=dt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==we.string&&r.parsedType!==we.number){const i=dt.objectValues(n);return be(r,{expected:dt.joinValues(i),received:r.parsedType,code:fe.invalid_type}),He}if(this._cache||(this._cache=new Set(dt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=dt.objectValues(n);return be(r,{received:r.data,code:fe.invalid_enum_value,options:i}),He}return Xr(e.data)}get enum(){return this._def.values}}IC.create=(t,e)=>new IC({values:t,typeName:Ve.ZodNativeEnum,...Je(e)});class Uh extends lt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==we.promise&&n.common.async===!1)return be(n,{code:fe.invalid_type,expected:we.promise,received:n.parsedType}),He;const r=n.parsedType===we.promise?n.data:Promise.resolve(n.data);return Xr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Uh.create=(t,e)=>new Uh({type:t,typeName:Ve.ZodPromise,...Je(e)});class za extends lt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ve.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:l=>{be(r,l),l.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const l=i.transform(r.data,s);if(r.common.async)return Promise.resolve(l).then(async c=>{if(n.value==="aborted")return He;const d=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return d.status==="aborted"?He:d.status==="dirty"||n.value==="dirty"?au(d.value):d});{if(n.value==="aborted")return He;const c=this._def.schema._parseSync({data:l,path:r.path,parent:r});return c.status==="aborted"?He:c.status==="dirty"||n.value==="dirty"?au(c.value):c}}if(i.type==="refinement"){const l=c=>{const d=i.refinement(c,s);if(r.common.async)return Promise.resolve(d);if(d 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"?He:(c.status==="dirty"&&n.dirty(),l(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?He:(c.status==="dirty"&&n.dirty(),l(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ra(l))return He;const c=i.transform(l.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>Ra(l)?Promise.resolve(i.transform(l.value,s)).then(c=>({status:n.value,value:c})):He);dt.assertNever(i)}}za.create=(t,e,n)=>new za({schema:t,typeName:Ve.ZodEffects,effect:e,...Je(n)});za.createWithPreprocess=(t,e,n)=>new za({schema:e,effect:{type:"preprocess",transform:t},typeName:Ve.ZodEffects,...Je(n)});class io extends lt{_parse(e){return this._getType(e)===we.undefined?Xr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}io.create=(t,e)=>new io({innerType:t,typeName:Ve.ZodOptional,...Je(e)});class La extends lt{_parse(e){return this._getType(e)===we.null?Xr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}La.create=(t,e)=>new La({innerType:t,typeName:Ve.ZodNullable,...Je(e)});class ab extends lt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===we.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ab.create=(t,e)=>new ab({innerType:t,typeName:Ve.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Je(e)});class cb extends lt{_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 Lh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new gs(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new gs(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}cb.create=(t,e)=>new cb({innerType:t,typeName:Ve.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Je(e)});class BC extends lt{_parse(e){if(this._getType(e)!==we.nan){const r=this._getOrReturnCtx(e);return be(r,{code:fe.invalid_type,expected:we.nan,received:r.parsedType}),He}return{status:"valid",value:e.data}}}BC.create=t=>new BC({typeName:Ve.ZodNaN,...Je(t)});class hL extends lt{_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 Ox extends lt{_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"?He:s.status==="dirty"?(n.dirty(),au(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"?He: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 Ox({in:e,out:n,typeName:Ve.ZodPipeline})}}class ub extends lt{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Ra(i)&&(i.value=Object.freeze(i.value)),i);return Lh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}ub.create=(t,e)=>new ub({innerType:t,typeName:Ve.ZodReadonly,...Je(e)});var Ve;(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"})(Ve||(Ve={}));uo.create;Ei.create;Ih.create;Bh.create;rl.create;const ci=Na.create;Uh.create;io.create;La.create;ci(["highlight","comment","flag"]);ci(["pending","accepted","dismissed"]);ci(["yellow","red","green","blue","purple"]);ci(["info","warning","error","success"]);const pL=ci(["solo","tandem"]);ci(["user","claude","import"]);ci(["user","claude"]);ci(["accept","dismiss"]);ci(["markdown","json"]);ci(["md","txt","html","docx"]);ci(["RANGE_GONE","RANGE_MOVED","FILE_LOCKED","FILE_NOT_FOUND","NO_DOCUMENT","INVALID_RANGE","FORMAT_ERROR","PERMISSION_DENIED"]);const mL=[{title:"Editor",rows:[{keys:["Ctrl","B"],description:"Bold"},{keys:["Ctrl","I"],description:"Italic"},{keys:["Ctrl","Z"],description:"Undo"},{keys:["Ctrl","Y"],description:"Redo"},{keys:["Ctrl","S"],description:"Save document"}]},{title:"Review Mode",rows:[{keys:["Tab"],description:"Next annotation"},{keys:["Shift","Tab"],description:"Previous annotation"},{keys:["Y"],description:"Accept annotation"},{keys:["N"],description:"Reject annotation"},{keys:["Z"],description:"Undo last accept/reject"},{keys:["E"],description:"Examine (scroll & exit)"},{keys:["Escape"],description:"Exit review mode"}]},{title:"Chat",rows:[{keys:["Enter"],description:"Send message"}]},{title:"Tabs",rows:[{keys:["Ctrl","Tab"],description:"Next tab"},{keys:["Ctrl","Shift","Tab"],description:"Previous tab"},{keys:["Alt","←"],description:"Move tab left"},{keys:["Alt","→"],description:"Move tab right"}]},{title:"General",rows:[{keys:["?"],description:"Show / hide this help"}]}];function gL({open:t,onClose:e}){return O.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e]),t?k.jsx("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.45)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:e,"data-testid":"help-modal",children:k.jsxs("div",{style:{backgroundColor:"var(--tandem-surface)",border:"1px solid var(--tandem-border)",borderRadius:"8px",boxShadow:"0 8px 32px rgba(0,0,0,0.18)",padding:"24px 28px 20px",width:"480px",maxWidth:"90vw",maxHeight:"80vh",overflowY:"auto",position:"relative"},onClick:n=>n.stopPropagation(),children:[k.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px"},children:[k.jsx("h2",{style:{margin:0,fontSize:"16px",fontWeight:600,color:"var(--tandem-fg)"},children:"Keyboard Shortcuts"}),k.jsx("button",{type:"button",onClick:e,"aria-label":"Close help","data-testid":"help-modal-close",style:{background:"none",border:"none",cursor:"pointer",fontSize:"18px",color:"var(--tandem-fg-muted)",lineHeight:1,padding:"2px 6px",borderRadius:"4px"},children:"✕"})]}),mL.map(n=>k.jsxs("div",{style:{marginBottom:"18px"},children:[k.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:n.title}),k.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:k.jsx("tbody",{children:n.rows.map(r=>k.jsxs("tr",{children:[k.jsx("td",{style:{paddingBottom:"5px",paddingRight:"16px",whiteSpace:"nowrap",verticalAlign:"middle",width:"1%"},children:k.jsx("span",{style:{display:"flex",gap:"4px",alignItems:"center"},children:r.keys.map((i,s)=>k.jsxs("span",{children:[k.jsx("kbd",{style:{display:"inline-block",padding:"1px 6px",fontSize:"12px",fontFamily:"ui-monospace, SFMono-Regular, monospace",background:"var(--tandem-surface-muted)",border:"1px solid var(--tandem-border-strong)",borderBottom:"2px solid var(--tandem-border-strong)",borderRadius:"4px",color:"var(--tandem-fg)",lineHeight:"1.5"},children:i}),s<r.keys.length-1&&k.jsx("span",{style:{color:"var(--tandem-fg-subtle)",fontSize:"11px",margin:"0 2px"},children:"+"})]},i))})}),k.jsx("td",{style:{paddingBottom:"5px",fontSize:"13px",color:"var(--tandem-fg-muted)",verticalAlign:"middle"},children:r.description})]},r.description))})})]},n.title)),k.jsxs("div",{style:{marginTop:"12px",paddingTop:"10px",borderTop:"1px solid var(--tandem-border)",fontSize:"11px",color:"var(--tandem-fg-subtle)",textAlign:"center"},children:["Press"," ",k.jsx("kbd",{style:{fontSize:"11px",padding:"1px 4px",background:"var(--tandem-surface-muted)",border:"1px solid var(--tandem-border)",borderRadius:"3px",color:"var(--tandem-fg-subtle)"},children:"?"})," ","or"," ",k.jsx("kbd",{style:{fontSize:"11px",padding:"1px 4px",background:"var(--tandem-surface-muted)",border:"1px solid var(--tandem-border)",borderRadius:"3px",color:"var(--tandem-fg-subtle)"},children:"Esc"})," ","to close"]})]})}):null}const yL=[{title:"Review an annotation",text:"Open the side panel and accept or dismiss one of the highlighted annotations. Try Review Mode (Ctrl+Shift+R) for keyboard shortcuts."},{title:"Ask a question",text:"Select text, click Comment, and check the @Claude toggle to direct it to Claude — or type in the Chat panel."},{title:"Make an edit",text:"Click in the document and type something. All changes sync in real-time."},{title:"You're ready!",text:"You've learned the basics. Press ? anytime to see keyboard shortcuts."}],Pf=3;function bL({currentStep:t,onNext:e,onDismiss:n}){const r=yL[t];if(!r)return null;const i=t>=Pf;return k.jsxs("div",{"data-testid":"onboarding-tutorial",style:{position:"fixed",bottom:48,left:24,zIndex:900,maxWidth:340,background:"var(--tandem-surface)",borderLeft:"4px solid var(--tandem-accent)",borderRadius:8,boxShadow:"0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08)",padding:"16px 20px",fontFamily:"inherit"},children:[!i&&k.jsx("div",{style:{display:"flex",gap:6,marginBottom:12},children:Array.from({length:Pf},(s,l)=>k.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:l<=t?"var(--tandem-accent)":"var(--tandem-border)",transition:"background 0.2s"}},l))}),k.jsx("div",{style:{fontSize:14,fontWeight:600,color:"var(--tandem-fg)",marginBottom:6},children:r.title}),k.jsx("div",{style:{fontSize:13,lineHeight:1.5,color:"var(--tandem-fg-muted)",marginBottom:i?0:14},children:r.text}),!i&&k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsxs("span",{style:{fontSize:11,color:"var(--tandem-fg-subtle)"},children:["Step ",t+1," of ",Pf]}),k.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[k.jsx("button",{"data-testid":"tutorial-dismiss-btn",onClick:n,style:{background:"none",border:"none",cursor:"pointer",fontSize:12,color:"var(--tandem-fg-subtle)",padding:0,textDecoration:"underline"},children:"Dismiss tutorial"}),k.jsx("button",{"data-testid":"tutorial-next-btn",onClick:e,style:{padding:"4px 12px",fontSize:12,border:"1px solid var(--tandem-border-strong)",borderRadius:4,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer",fontWeight:500},children:t===Pf-1?"Done":"Next"})]})]})]})}const Bu=`http://localhost:${Ga}/api`;function xL(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 vL(t){return t.toLowerCase().endsWith(".docx")}async function yM(t){if(vL(t.name)){const e=await t.arrayBuffer();return xL(e)}return t.text()}const UC="tandem:reviewOnlyBannerDismissed";function HC({visible:t,documentId:e}){const[n,r]=O.useState(()=>{try{return localStorage.getItem(UC)==="true"}catch{return!1}}),[i,s]=O.useState(!1),[l,c]=O.useState(null);if(!t||n)return null;async function d(){if(!(!e||i)){s(!0),c(null);try{const f=await fetch(`${Bu}/convert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:e})});if(!f.ok){const p=await f.json().catch(()=>null);c((p==null?void 0:p.message)??`Conversion failed (HTTP ${f.status}).`)}}catch{c("Could not reach the server.")}finally{s(!1)}}}return k.jsxs("div",{"data-testid":"review-only-banner",style:{padding:"8px 16px",backgroundColor:"var(--tandem-info-bg)",borderBottom:"1px solid var(--tandem-info-border)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:"13px",color:"var(--tandem-info-fg-strong)",gap:"12px"},children:[k.jsx("span",{children:"This document is open in review-only mode. You can add annotations and review, but cannot edit directly."}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[l&&k.jsx("span",{style:{color:"var(--tandem-error-fg-strong)",fontSize:"12px",maxWidth:"200px"},children:l}),e&&k.jsx("button",{type:"button","data-testid":"convert-to-markdown-btn",onClick:d,disabled:i,style:{background:"var(--tandem-info)",border:"none",color:"var(--tandem-info-fg)",cursor:i?"default":"pointer",fontWeight:500,fontSize:"12px",padding:"4px 10px",borderRadius:"4px",whiteSpace:"nowrap",opacity:i?.6:1},children:i?"Converting…":"Convert to Markdown"}),k.jsx("button",{type:"button","data-testid":"review-only-dismiss",onClick:()=>{try{localStorage.setItem(UC,"true")}catch{}r(!0)},style:{background:"none",border:"none",color:"var(--tandem-info-fg-strong)",cursor:"pointer",fontWeight:500,fontSize:"13px",padding:"2px 8px",whiteSpace:"nowrap"},children:"Dismiss"})]})]})}function eu(t,e,n,r){const i=r?e.filter(d=>!r(d)):e,s=d=>{var C;const{key:f}=d;if(f!=="ArrowLeft"&&f!=="ArrowRight"&&f!=="ArrowUp"&&f!=="ArrowDown"&&f!=="Home"&&f!=="End"||i.length===0)return;d.preventDefault();const p=i.indexOf(t),m=i.length-1;let g;f==="Home"?g=0:f==="End"?g=m:f==="ArrowLeft"||f==="ArrowUp"?g=p<=0?m:p-1:g=p>=m?0:p+1;const b=i[g];n(b);const v=d.currentTarget.querySelectorAll('[role="radio"]'),w=e.indexOf(b);(C=v[w])==null||C.focus()},l=r!=null&&r(t)?i[0]:t;return{handleKeyDown:s,tabIndexFor:d=>r!=null&&r(d)?-1:d===l?0:-1}}function _x(t){return(t==null?void 0:t.trim())||dM}function Dx(){try{return _x(localStorage.getItem(Mx))}catch{return dM}}function SL(t){const e=_x(t);try{localStorage.setItem(Mx,e)}catch{}return typeof window<"u"&&window.dispatchEvent(new Event(sb)),e}function bM(t){const e=()=>t(Dx()),n=r=>{r.key===Mx&&t(_x(r.newValue))};return window.addEventListener(sb,e),window.addEventListener("storage",n),()=>{window.removeEventListener(sb,e),window.removeEventListener("storage",n)}}function xM(){const[t,e]=O.useState(Dx);O.useEffect(()=>bM(e),[]);const n=O.useCallback(r=>{const i=SL(r);e(i)},[]);return{userName:t,setUserName:n}}const wL=320,VC="tandem-settings-heading",kL='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function CL({open:t,onClose:e,settings:n,onUpdate:r,returnFocusRef:i,anchorRef:s}){const l=O.useRef(null),c=O.useRef(null),[d,f]=O.useState(window.innerWidth),p=d<768,{userName:m,setUserName:g}=xM(),[b,v]=O.useState(m);O.useEffect(()=>{b!==m&&document.activeElement!==c.current&&v(m)},[m,b]);const w=eu(n.theme,["light","dark","system"],_=>r({theme:_})),C=eu(n.layout,["tabbed","three-panel"],_=>r({layout:_}),_=>_==="three-panel"&&p),E=eu(n.primaryTab,["chat","annotations"],_=>r({primaryTab:_})),I=eu(n.panelOrder,["chat-editor-annotations","annotations-editor-chat"],_=>r({panelOrder:_})),j=eu(n.textSize,["s","m","l"],_=>r({textSize:_}));if(O.useEffect(()=>{if(!t)return;f(window.innerWidth);const _=()=>f(window.innerWidth);return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[t]),O.useEffect(()=>{if(!t)return;const _=l.current;return _==null||_.focus(),()=>{var N;(N=i==null?void 0:i.current)==null||N.focus()}},[t,i]),O.useEffect(()=>{if(!t)return;const _=Z=>{var ce;const Y=Z.target;(ce=s==null?void 0:s.current)!=null&&ce.contains(Y)||l.current&&!l.current.contains(Y)&&e()},N=setTimeout(()=>document.addEventListener("pointerdown",_),0);return()=>{clearTimeout(N),document.removeEventListener("pointerdown",_)}},[t,e,s]),O.useEffect(()=>{if(!t)return;const _=N=>{if(N.key==="Escape"){e();return}if(N.key!=="Tab"||!l.current)return;const Z=l.current.querySelectorAll(kL);if(Z.length===0)return;const Y=Z[0],ce=Z[Z.length-1],ie=document.activeElement;if(!l.current.contains(ie)){N.preventDefault(),Y.focus();return}N.shiftKey&&ie===Y?(N.preventDefault(),ce.focus()):!N.shiftKey&&ie===ce&&(N.preventDefault(),Y.focus())};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[t,e]),!t)return null;const Q={fontSize:"11px",fontWeight:600,color:"var(--tandem-fg)",marginBottom:"6px",textTransform:"uppercase",letterSpacing:"0.5px"},V=(_,N)=>({flex:1,padding:"8px",minHeight:"24px",border:`2px solid ${_?"var(--tandem-accent)":"var(--tandem-border)"}`,borderRadius:"6px",background:N?"var(--tandem-surface-muted)":_?"var(--tandem-accent-bg)":"var(--tandem-surface)",cursor:N?"not-allowed":"pointer",textAlign:"center",fontSize:"11px",color:N?"var(--tandem-fg-subtle)":_?"var(--tandem-accent-fg-strong)":"var(--tandem-fg-muted)",fontWeight:_?600:400,opacity:N?.6:1,transition:"border-color 0.15s, background 0.15s"});return k.jsxs("div",{ref:l,"data-testid":"settings-popover",role:"dialog","aria-modal":"true","aria-labelledby":VC,tabIndex:-1,style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxHeight:"calc(100vh - 32px)",overflowY:"auto",width:`${wL}px`,background:"var(--tandem-surface)",color:"var(--tandem-fg)",border:"1px solid var(--tandem-border)",borderRadius:"8px",boxShadow:"0 4px 24px rgba(0,0,0,0.12)",padding:"16px",zIndex:9999,display:"flex",flexDirection:"column",gap:"14px",outline:"none"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsx("span",{id:VC,style:{fontSize:"13px",fontWeight:600,color:"var(--tandem-fg)"},children:"Settings"}),k.jsx("button",{onClick:e,style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-fg-subtle)",fontSize:"16px",lineHeight:1,padding:"4px 6px",minWidth:"24px",minHeight:"24px"},"aria-label":"Close settings",children:"×"})]}),k.jsxs("div",{children:[k.jsx("label",{htmlFor:"settings-display-name",style:Q,children:"Display Name"}),k.jsx("input",{ref:c,id:"settings-display-name","data-testid":"settings-display-name",type:"text",value:b,onChange:_=>v(_.target.value),onBlur:()=>g(b),onKeyDown:_=>{_.key==="Enter"&&_.currentTarget.blur(),_.key==="Escape"&&(v(m),_.currentTarget.blur())},maxLength:fM,style:{width:"100%",padding:"6px 8px",fontSize:"12px",color:"var(--tandem-fg)",background:"var(--tandem-surface)",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",outline:"none"}})]}),k.jsxs("div",{children:[k.jsx("div",{id:"settings-theme-label",style:Q,children:"Theme"}),k.jsx("div",{role:"radiogroup","aria-labelledby":"settings-theme-label",onKeyDown:w.handleKeyDown,style:{display:"flex",gap:"8px"},children:["light","dark","system"].map(_=>k.jsx("button",{"data-testid":`theme-${_}-btn`,role:"radio","aria-checked":n.theme===_,tabIndex:w.tabIndexFor(_),onClick:()=>r({theme:_}),style:V(n.theme===_),children:_==="light"?"Light":_==="dark"?"Dark":"System"},_))})]}),k.jsxs("div",{children:[k.jsx("div",{id:"settings-layout-label",style:Q,children:"Layout"}),k.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-layout-label",onKeyDown:C.handleKeyDown,style:{display:"flex",gap:"8px"},children:[k.jsxs("button",{"data-testid":"layout-tabbed-btn",role:"radio","aria-checked":n.layout==="tabbed",tabIndex:C.tabIndexFor("tabbed"),onClick:()=>r({layout:"tabbed"}),style:V(n.layout==="tabbed"),children:[k.jsx("div",{style:{fontSize:"18px",marginBottom:"2px"},children:"[=|]"}),"Tabbed"]}),k.jsxs("button",{"data-testid":"layout-three-panel-btn",role:"radio","aria-checked":n.layout==="three-panel","aria-disabled":p||void 0,tabIndex:C.tabIndexFor("three-panel"),onClick:()=>{p||r({layout:"three-panel"})},style:V(n.layout==="three-panel",p),title:p?"Requires viewport wider than 768px":void 0,children:[k.jsx("div",{style:{fontSize:"18px",marginBottom:"2px"},children:"[|||]"}),"Three-Panel"]})]}),p&&k.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Three-panel requires a wider viewport"})]}),n.layout==="tabbed"&&k.jsxs("div",{children:[k.jsx("div",{id:"settings-default-tab-label",style:Q,children:"Default Tab"}),k.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-default-tab-label",onKeyDown:E.handleKeyDown,style:{display:"flex",gap:"8px"},children:[k.jsx("button",{"data-testid":"default-tab-chat-btn",role:"radio","aria-checked":n.primaryTab==="chat",tabIndex:E.tabIndexFor("chat"),onClick:()=>r({primaryTab:"chat"}),style:V(n.primaryTab==="chat"),children:"Chat"}),k.jsx("button",{"data-testid":"default-tab-annotations-btn",role:"radio","aria-checked":n.primaryTab==="annotations",tabIndex:E.tabIndexFor("annotations"),onClick:()=>r({primaryTab:"annotations"}),style:V(n.primaryTab==="annotations"),children:"Annotations"})]})]}),n.layout==="three-panel"&&k.jsxs("div",{children:[k.jsx("div",{id:"settings-panel-order-label",style:Q,children:"Panel Order"}),k.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-panel-order-label",onKeyDown:I.handleKeyDown,style:{display:"flex",gap:"8px"},children:[k.jsx("button",{"data-testid":"panel-order-cea-btn",role:"radio","aria-checked":n.panelOrder==="chat-editor-annotations",tabIndex:I.tabIndexFor("chat-editor-annotations"),onClick:()=>r({panelOrder:"chat-editor-annotations"}),style:V(n.panelOrder==="chat-editor-annotations"),children:"Chat | Editor | Ann."}),k.jsx("button",{"data-testid":"panel-order-aec-btn",role:"radio","aria-checked":n.panelOrder==="annotations-editor-chat",tabIndex:I.tabIndexFor("annotations-editor-chat"),onClick:()=>r({panelOrder:"annotations-editor-chat"}),style:V(n.panelOrder==="annotations-editor-chat"),children:"Ann. | Editor | Chat"})]})]}),k.jsxs("div",{children:[k.jsxs("div",{style:Q,children:["Editor Width:"," ",k.jsxs("span",{style:{fontWeight:400,textTransform:"none"},children:[n.editorWidthPercent,"%"]})]}),k.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:"How much of the available space the editor text fills"}),k.jsx("input",{"data-testid":"editor-width-slider",type:"range",min:50,max:100,step:5,value:n.editorWidthPercent,onChange:_=>r({editorWidthPercent:Number(_.target.value)}),style:{width:"100%",accentColor:"var(--tandem-accent)"},"aria-label":"Editor width"}),k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[k.jsx("span",{children:"50%"}),k.jsx("span",{children:"100%"})]})]}),k.jsxs("div",{children:[k.jsx("div",{style:Q,children:"Authorship"}),k.jsxs("label",{"data-testid":"authorship-toggle",style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",fontSize:"12px",color:"var(--tandem-fg)",minHeight:"24px"},children:[k.jsx("input",{type:"checkbox",checked:n.showAuthorship,onChange:_=>r({showAuthorship:_.target.checked}),style:{accentColor:"var(--tandem-accent)"}}),k.jsx("span",{children:"Show who wrote what"})]}),k.jsxs("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:["Highlights text by author: ",k.jsx("span",{style:{color:"var(--tandem-author-user)"},children:"you"})," ","/ ",k.jsx("span",{style:{color:"var(--tandem-author-claude)"},children:"Claude"})]})]}),k.jsxs("div",{children:[k.jsx("div",{id:"settings-text-size-label",style:Q,children:"Text Size"}),k.jsx("div",{role:"radiogroup","aria-labelledby":"settings-text-size-label",onKeyDown:j.handleKeyDown,style:{display:"flex",gap:"8px"},children:["s","m","l"].map(_=>k.jsx("button",{"data-testid":`text-size-${_}-btn`,role:"radio","aria-checked":n.textSize===_,tabIndex:j.tabIndexFor(_),onClick:()=>r({textSize:_}),style:V(n.textSize===_),children:_==="s"?"Small":_==="m"?"Medium":"Large"},_))}),k.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Reading density only — use browser zoom (Ctrl + =/−) to scale the whole UI."})]}),k.jsxs("div",{children:[k.jsxs("label",{"data-testid":"reduce-motion-toggle",style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",fontSize:"12px",color:"var(--tandem-fg)",minHeight:"24px"},children:[k.jsx("input",{type:"checkbox",checked:n.reduceMotion,onChange:_=>r({reduceMotion:_.target.checked}),style:{accentColor:"var(--tandem-accent)"}}),k.jsx("span",{children:"Reduce motion"})]}),k.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Disables smooth autoscroll and the annotation flash animation."})]}),k.jsxs("div",{children:[k.jsxs("div",{style:Q,children:["Selection Sensitivity:"," ",k.jsxs("span",{style:{fontWeight:400,textTransform:"none"},children:[(n.selectionDwellMs/1e3).toFixed(1),"s"]})]}),k.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:"How long you must hold a selection before Claude notices it"}),k.jsx("input",{"data-testid":"dwell-time-slider",type:"range",min:Nh,max:zh,step:100,value:n.selectionDwellMs,onChange:_=>r({selectionDwellMs:Number(_.target.value)}),style:{width:"100%",accentColor:"var(--tandem-accent)"},"aria-label":"Selection dwell time"}),k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[k.jsxs("span",{children:[(Nh/1e3).toFixed(1),"s"]}),k.jsxs("span",{children:[(zh/1e3).toFixed(1),"s"]})]})]})]})}const EL={error:"var(--tandem-error)",warning:"var(--tandem-warning)",info:"var(--tandem-accent)"},TL={error:"var(--tandem-error-bg)",warning:"var(--tandem-warning-bg)",info:"var(--tandem-accent-bg)"},AL={error:"var(--tandem-error-fg-strong)",warning:"var(--tandem-warning-fg-strong)",info:"var(--tandem-accent-fg-strong)"};function ML({toasts:t,onDismiss:e}){return t.length===0?null:k.jsxs(k.Fragment,{children:[k.jsx("style",{children:`
|
|
50
|
+
@keyframes tandem-toast-slide-in {
|
|
51
|
+
from {
|
|
52
|
+
opacity: 0;
|
|
53
|
+
transform: translateX(40px);
|
|
54
|
+
}
|
|
55
|
+
to {
|
|
56
|
+
opacity: 1;
|
|
57
|
+
transform: translateX(0);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`}),k.jsx("div",{"data-testid":"toast-container",style:{position:"fixed",bottom:40,right:16,zIndex:1e3,display:"flex",flexDirection:"column",gap:8,maxWidth:360,pointerEvents:"none"},children:t.map(n=>k.jsx(OL,{toast:n,onDismiss:e},n.id))})]})}function OL({toast:t,onDismiss:e}){const n=EL[t.severity],r=TL[t.severity],i=AL[t.severity],s=t.severity==="info"?"status":"alert";return k.jsxs("div",{role:s,"data-testid":`toast-${t.id}`,style:{pointerEvents:"auto",background:"var(--tandem-surface)",borderRadius:6,borderLeft:`4px solid ${n}`,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08)",padding:"10px 32px 10px 12px",position:"relative",animation:"tandem-toast-slide-in 0.2s ease-out",fontSize:13,lineHeight:1.4,color:"var(--tandem-fg)"},children:[k.jsx("span",{children:t.message}),t.count>1&&k.jsxs("span",{"data-testid":`toast-count-${t.id}`,style:{marginLeft:6,fontSize:11,fontWeight:600,color:i,background:r,padding:"1px 5px",borderRadius:8},children:["×",t.count]}),k.jsx("button",{"data-testid":`toast-dismiss-${t.id}`,onClick:()=>e(t.id),style:{position:"absolute",top:6,right:6,border:"none",background:"transparent",cursor:"pointer",fontSize:14,color:"var(--tandem-fg-subtle)",lineHeight:1,padding:"2px 4px"},"aria-label":"Dismiss notification",children:"×"})]})}function Tn(t){this.content=t}Tn.prototype={constructor:Tn,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 Tn(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 Tn(n)},addToStart:function(t,e){return new Tn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Tn(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 Tn(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=Tn.from(t),t.size?new Tn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Tn.from(t),t.size?new Tn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Tn.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}};Tn.from=function(t){if(t instanceof Tn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Tn(e)};function vM(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let l=0;i.text[l]==s.text[l];l++)n++;return n}if(i.content.size||s.content.size){let l=vM(i.content,s.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function SM(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let l=t.child(--i),c=e.child(--s),d=l.nodeSize;if(l==c){n-=d,r-=d;continue}if(!l.sameMarkup(c))return{a:n,b:r};if(l.isText&&l.text!=c.text){let f=0,p=Math.min(l.text.length,c.text.length);for(;f<p&&l.text[l.text.length-f-1]==c.text[c.text.length-f-1];)f++,n--,r--;return{a:n,b:r}}if(l.content.size||c.content.size){let f=SM(l.content,c.content,n-1,r-1);if(f)return f}n-=d,r-=d}}class ne{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let l=0,c=0;c<n;l++){let d=this.content[l],f=c+d.nodeSize;if(f>e&&r(d,i+c,s||null,l)!==!1&&d.content.size){let p=c+1;d.nodesBetween(Math.max(0,e-p),Math.min(d.content.size,n-p),r,i+p)}c=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",l=!0;return this.nodesBetween(e,n,(c,d)=>{let f=c.isText?c.text.slice(Math.max(e,d)-d,n-d):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&f||c.isTextblock)&&r&&(l?l=!1:s+=r),s+=f},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new ne(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,l=0;l<n;s++){let c=this.content[s],d=l+c.nodeSize;d>e&&((l<e||d>n)&&(c.isText?c=c.cut(Math.max(0,e-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,e-l-1),Math.min(c.content.size,n-l-1))),r.push(c),i+=c.nodeSize),l=d}return new ne(r,i)}cutByIndex(e,n){return e==n?ne.empty:e==0&&n==this.content.length?this:new ne(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 ne(i,s)}addToStart(e){return new ne([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ne(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 vM(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return SM(this,e,n,r)}findIndex(e){if(e==0)return $f(0,e);if(e==this.size)return $f(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?$f(n+1,s):$f(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 ne.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ne(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ne.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 ne(n||e,r)}static from(e){if(!e)return ne.empty;if(e instanceof ne)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ne([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ne.empty=new ne([],0);const Gy={index:0,offset:0};function $f(t,e){return Gy.index=t,Gy.offset=e,Gy}function Hh(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(!Hh(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Hh(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let wt=class db{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&&Hh(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 db.none;if(e instanceof db)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};wt.none=[];class Vh extends Error{}class ye{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=kM(this.content,e+this.openStart,n);return r&&new ye(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ye(wM(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 ye.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 ye(ne.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 ye(e,r,i)}}ye.empty=new ye(ne.empty,0,0);function wM(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:l,offset:c}=t.findIndex(n);if(i==e||s.isText){if(c!=n&&!t.child(l).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=l)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(wM(s.content,e-i-1,n-i-1)))}function kM(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),l=t.maybeChild(i);if(s==e||l.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=kM(l.content,e-s-1,n,l);return c&&t.replaceChild(i,l.copy(c))}function _L(t,e,n){if(n.openStart>t.depth)throw new Vh("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Vh("Inconsistent open depths");return CM(t,e,n,0)}function CM(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let l=CM(t,e,n,r+1);return s.copy(s.content.replaceChild(i,l))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let l=t.parent,c=l.content;return Zo(l,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}else{let{start:l,end:c}=DL(n,t);return Zo(s,TM(t,l,c,e,r))}else return Zo(s,Ph(t,e,r))}function EM(t,e){if(!e.type.compatibleContent(t.type))throw new Vh("Cannot join "+e.type.name+" onto "+t.type.name)}function fb(t,e,n){let r=t.node(n);return EM(r,e.node(n)),r}function Go(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 hu(t,e,n,r){let i=(e||t).node(n),s=0,l=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Go(t.nodeAfter,r),s++));for(let c=s;c<l;c++)Go(i.child(c),r);e&&e.depth==n&&e.textOffset&&Go(e.nodeBefore,r)}function Zo(t,e){return t.type.checkContent(e),t.copy(e)}function TM(t,e,n,r,i){let s=t.depth>i&&fb(t,e,i+1),l=r.depth>i&&fb(n,r,i+1),c=[];return hu(null,t,i,c),s&&l&&e.index(i)==n.index(i)?(EM(s,l),Go(Zo(s,TM(t,e,n,r,i+1)),c)):(s&&Go(Zo(s,Ph(t,e,i+1)),c),hu(e,n,i,c),l&&Go(Zo(l,Ph(n,r,i+1)),c)),hu(r,null,i,c),new ne(c)}function Ph(t,e,n){let r=[];if(hu(null,t,n,r),t.depth>n){let i=fb(t,e,n+1);Go(Zo(i,Ph(t,e,n+1)),r)}return hu(e,null,n,r),new ne(r)}function DL(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(ne.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Uu{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 wt.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let c=r;r=i,i=c}let s=r.marks;for(var l=0;l<s.length;l++)s[l].type.spec.inclusive===!1&&(!i||!s[l].isInSet(i.marks))&&(s=s[l--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new $h(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let l=e;;){let{index:c,offset:d}=l.content.findIndex(s),f=s-d;if(r.push(l,c,i+d),!f||(l=l.child(c),l.isText))break;s=f-1,i+=d+1}return new Uu(n,r,s)}static resolveCached(e,n){let r=PC.get(e);if(r)for(let s=0;s<r.elts.length;s++){let l=r.elts[s];if(l.pos==n)return l}else PC.set(e,r=new RL);let i=r.elts[r.i]=Uu.resolve(e,n);return r.i=(r.i+1)%NL,i}}class RL{constructor(){this.elts=[],this.i=0}}const NL=12,PC=new WeakMap;class $h{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 zL=Object.create(null);let so=class hb{constructor(e,n,r,i=wt.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||ne.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&&Hh(this.attrs,n||e.defaultAttrs||zL)&&wt.sameSet(this.marks,r||wt.none)}copy(e=null){return e==this.content?this:new hb(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new hb(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ye.empty;let i=this.resolve(e),s=this.resolve(n),l=r?0:i.sharedDepth(n),c=i.start(l),f=i.node(l).content.cut(i.pos-c,s.pos-c);return new ye(f,i.depth-l,s.depth-l)}replace(e,n,r){return _L(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 Uu.resolveCached(this,e)}resolveNoCache(e){return Uu.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()+")"),AM(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=ne.empty,i=0,s=r.childCount){let l=this.contentMatchAt(e).matchFragment(r,i,s),c=l&&l.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let d=i;d<s;d++)if(!this.type.allowsMarks(r.child(d).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),l=s&&s.matchFragment(this.content,n);return l?l.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=wt.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(!wt.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=ne.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};so.prototype.text=void 0;class Fh extends so{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):AM(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 Fh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Fh(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 AM(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class il{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new LL(e,n);if(r.next==null)return il.empty;let i=MM(r);r.next&&r.err("Unexpected trailing text");let s=PL(VL(i));return $L(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(l,c){let d=l.matchFragment(e,r);if(d&&(!n||d.validEnd))return ne.from(c.map(f=>f.createAndFill()));for(let f=0;f<l.next.length;f++){let{type:p,next:m}=l.next[f];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let g=s(m,c.concat(p));if(g)return g}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let l=[];for(let c=i;c.type;c=c.via)l.push(c.type);return l.reverse()}for(let l=0;l<s.next.length;l++){let{type:c,next:d}=s.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!i.type||d.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),n[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)s+=(l?", ":"")+r.next[l].type.name+"->"+e.indexOf(r.next[l].next);return s}).join(`
|
|
61
|
+
`)}}il.empty=new il(!0);class LL{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 MM(t){let e=[];do e.push(jL(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function jL(t){let e=[];do e.push(IL(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function IL(t){let e=HL(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=BL(t,e);else break;return e}function $C(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function BL(t,e){let n=$C(t),r=n;return t.eat(",")&&(t.next!="}"?r=$C(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function UL(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let l=n[s];l.isInGroup(e)&&i.push(l)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function HL(t){if(t.eat("(")){let e=MM(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=UL(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 VL(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(l,c,d){let f={term:d,to:c};return e[l].push(f),f}function i(l,c){l.forEach(d=>d.to=c)}function s(l,c){if(l.type=="choice")return l.exprs.reduce((d,f)=>d.concat(s(f,c)),[]);if(l.type=="seq")for(let d=0;;d++){let f=s(l.exprs[d],c);if(d==l.exprs.length-1)return f;i(f,c=n())}else if(l.type=="star"){let d=n();return r(c,d),i(s(l.expr,d),d),[r(d)]}else if(l.type=="plus"){let d=n();return i(s(l.expr,c),d),i(s(l.expr,d),d),[r(d)]}else{if(l.type=="opt")return[r(c)].concat(s(l.expr,c));if(l.type=="range"){let d=c;for(let f=0;f<l.min;f++){let p=n();i(s(l.expr,d),p),d=p}if(l.max==-1)i(s(l.expr,d),d);else for(let f=l.min;f<l.max;f++){let p=n();r(d,p),i(s(l.expr,d),p),d=p}return[r(d)]}else{if(l.type=="name")return[r(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function OM(t,e){return e-t}function FC(t,e){let n=[];return r(e),n.sort(OM);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let l=0;l<s.length;l++){let{term:c,to:d}=s[l];!c&&n.indexOf(d)==-1&&r(d)}}}function PL(t){let e=Object.create(null);return n(FC(t,0));function n(r){let i=[];r.forEach(l=>{t[l].forEach(({term:c,to:d})=>{if(!c)return;let f;for(let p=0;p<i.length;p++)i[p][0]==c&&(f=i[p][1]);FC(t,d).forEach(p=>{f||i.push([c,f=[]]),f.indexOf(p)==-1&&f.push(p)})})});let s=e[r.join(",")]=new il(r.indexOf(t.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(OM);s.next.push({type:i[l][0],next:e[c.join(",")]||n(c)})}return s}}function $L(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,l=[];for(let c=0;c<i.next.length;c++){let{type:d,next:f}=i.next[c];l.push(d.name),s&&!(d.isText||d.hasRequiredAttrs())&&(s=!1),r.indexOf(f)==-1&&r.push(f)}s&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function _M(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 DM(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 RM(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 NM(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new qL(t,r,e[r]);return n}let qC=class zM{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=NM(e,r.attrs),this.defaultAttrs=_M(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==il.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:DM(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new so(this,this.computeAttrs(e),ne.from(n),wt.setFrom(r))}createChecked(e=null,n,r){return n=ne.from(n),this.checkContent(n),new so(this,this.computeAttrs(e),n,wt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ne.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(ne.empty,!0);return s?new so(this,e,n.append(s),wt.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){RM(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:wt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,l)=>r[s]=new zM(s,n,l));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function FL(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 qL{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?FL(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Jp{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=NM(e,i.attrs),this.excluded=null;let s=_M(this.attrs);this.instance=s?new wt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new wt(this,DM(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,l)=>r[s]=new Jp(s,i++,n,l)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){RM(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let LM=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=Tn.from(e.nodes),n.marks=Tn.from(e.marks||{}),this.nodes=qC.compile(this.spec.nodes,this),this.marks=Jp.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],l=s.spec.content||"",c=s.spec.marks;if(s.contentMatch=r[l]||(r[l]=il.parse(l,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=c=="_"?null:c?YC(this,c.split(" ")):c==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],l=s.spec.excludes;s.excluded=l==null?[s]:l==""?[]:YC(this,l.split(" "))}this.nodeFromJSON=i=>so.fromJSON(this,i),this.markFromJSON=i=>wt.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 qC){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 Fh(r,r.defaultAttrs,e,wt.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 YC(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],l=s;if(s)n.push(s);else for(let c in t.marks){let d=t.marks[c];(i=="_"||d.spec.group&&d.spec.group.split(" ").indexOf(i)>-1)&&n.push(l=d)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function YL(t){return t.tag!=null}function KL(t){return t.style!=null}let pu=class pb{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(YL(i))this.tags.push(i);else if(KL(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 WC(this,n,!1);return r.addAll(e,wt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new WC(this,n,!0);return r.addAll(e,wt.none,n.from,n.to),ye.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(ZL(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let l=this.styles[s],c=l.style;if(!(c.indexOf(e)!=0||l.context&&!r.matchesContext(l.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(l.getAttrs){let d=l.getAttrs(n);if(d===!1)continue;l.attrs=d||void 0}return l}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,l=0;for(;l<n.length;l++){let c=n[l];if((c.priority==null?50:c.priority)<s)break}n.splice(l,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(l=>{r(l=GC(l)),l.mark||l.ignore||l.clearMark||(l.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(l=>{r(l=GC(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new pb(e,pb.schemaRules(e)))}};const jM={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},WL={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},IM={ol:!0,ul:!0},Hu=1,mb=2,mu=4;function KC(t,e,n){return e!=null?(e?Hu:0)|(e==="full"?mb:0):t&&t.whitespace=="pre"?Hu|mb:n&~mu}class Ff{constructor(e,n,r,i,s,l){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=l,this.content=[],this.activeMarks=wt.none,this.match=s||(l&mu?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ne.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&Hu)){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=ne.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ne.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&&!jM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class WC{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,l=KC(null,n.preserveWhitespace,0)|(r?mu:0);i?s=new Ff(i.type,i.attrs,wt.none,!0,n.topMatch||i.type.contentMatch,l):r?s=new Ff(null,null,wt.none,!0,null,l):s=new Ff(e.schema.topNodeType,null,wt.none,!0,null,l),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&mb?"full":this.localPreserveWS||(i.options&Hu)>0,{schema:l}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
62
|
+
`);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let d=0;d<c.length;d++)d&&this.insertNode(l.linebreakReplacement.create(),n,!0),c[d]&&this.insertNode(l.text(c[d]),n,!/\S/.test(c[d]));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],d=e.previousSibling;(!c||d&&d.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(r=r.slice(1))}r&&this.insertNode(l.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),c;IM.hasOwnProperty(l)&&this.parser.normalizeLists&&GL(e);let d=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(d?d.ignore:WL.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,n);else if(!d||d.skip||d.closeParent){d&&d.closeParent?this.open=Math.max(0,this.open-1):d&&d.skip.nodeType&&(e=d.skip);let f,p=this.needsBlock;if(jM.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),f=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=d&&d.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),f&&this.sync(s),this.needsBlock=p}else{let f=this.readStyles(e,n);f&&this.addElementByRule(e,d,f,d.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
63
|
+
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],l=r.getPropertyValue(s);if(l)for(let c=void 0;;){let d=this.parser.matchStyle(s,l,this,c);if(!d)break;if(d.ignore)return null;if(d.clearMark?n=n.filter(f=>!d.clearMark(f)):n=n.concat(this.parser.schema.marks[d.mark].create(d.attrs)),d.consuming===!1)c=d;else break}}return n}addElementByRule(e,n,r,i){let s,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let d=this.enter(l,n.attrs||null,r,n.preserveWhitespace);d&&(s=!0,r=d)}else{let d=this.parser.schema.marks[n.mark];r=r.concat(d.create(n.attrs))}let c=this.top;if(l&&l.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(d=>this.insertNode(d,r,!1));else{let d=e;typeof n.contentElement=="string"?d=e.querySelector(n.contentElement):typeof n.contentElement=="function"?d=n.contentElement(e):n.contentElement&&(d=n.contentElement),this.findAround(e,d,!0),this.addAll(d,r),this.findAround(e,d,!1)}s&&this.sync(c)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let l=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];l!=c;l=l.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(l,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let l=this.open,c=0;l>=0;l--){let d=this.nodes[l],f=d.findWrapping(e);if(f&&(!i||i.length>f.length+c)&&(i=f,s=d,!f.length))break;if(d.solid){if(r)break;c+=2}}if(!i)return null;this.sync(s);for(let l=0;l<i.length;l++)n=this.enterInner(i[l],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let l=wt.none;for(let c of i.concat(e.marks))(s.type?s.type.allowsMarkType(c.type):ZC(c.type,e.type))&&(l=c.addToSet(l));return s.content.push(e.mark(l)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let c=KC(e,s,l.options);l.options&mu&&l.content.length==0&&(c|=mu);let d=wt.none;return r=r.filter(f=>(l.type?l.type.allowsMarkType(f.type):ZC(f.type,e))?(d=f.addToSet(d),!1):!0),this.nodes.push(new Ff(e,n,d,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|=Hu)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),l=(c,d)=>{for(;c>=0;c--){let f=n[c];if(f==""){if(c==n.length-1||c==0)continue;for(;d>=s;d--)if(l(c-1,d))return!0;return!1}else{let p=d>0||d==0&&i?this.nodes[d].type:r&&d>=s?r.node(d-s).type:null;if(!p||p.name!=f&&!p.isInGroup(f))return!1;d--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function GL(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&IM.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function ZL(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function GC(t){let e={};for(let n in t)e[n]=t[n];return e}function ZC(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],l=c=>{s.push(c);for(let d=0;d<c.edgeCount;d++){let{type:f,next:p}=c.edge(d);if(f==e||s.indexOf(p)<0&&l(p))return!0}};if(l(i.contentMatch))return!0}}class gl{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Zy(n).createDocumentFragment());let i=r,s=[];return e.forEach(l=>{if(s.length||l.marks.length){let c=0,d=0;for(;c<s.length&&d<l.marks.length;){let f=l.marks[d];if(!this.marks[f.type.name]){d++;continue}if(!f.eq(s[c][0])||f.type.spec.spanning===!1)break;c++,d++}for(;c<s.length;)i=s.pop()[1];for(;d<l.marks.length;){let f=l.marks[d++],p=this.serializeMark(f,l.isInline,n);p&&(s.push([f,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(l,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=yh(Zy(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&&yh(Zy(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return yh(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new gl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=JC(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return JC(e.marks)}}function JC(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Zy(t){return t.document||window.document}const XC=new WeakMap;function JL(t){let e=XC.get(t);return e===void 0&&XC.set(t,e=XL(t)),e}function XL(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 yh(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=JL(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=i.indexOf(" ");l>0&&(n=i.slice(0,l),i=i.slice(l+1));let c,d=n?t.createElementNS(n,i):t.createElement(i),f=e[1],p=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){p=2;for(let m in f)if(f[m]!=null){let g=m.indexOf(" ");g>0?d.setAttributeNS(m.slice(0,g),m.slice(g+1),f[m]):m=="style"&&d.style?d.style.cssText=f[m]:d.setAttribute(m,f[m])}}for(let m=p;m<e.length;m++){let g=e[m];if(g===0){if(m<e.length-1||m>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}else{let{dom:b,contentDOM:v}=yh(t,g,n,r);if(d.appendChild(b),v){if(c)throw new RangeError("Multiple content holes");c=v}}}return{dom:d,contentDOM:c}}const BM=65535,UM=Math.pow(2,16);function QL(t,e){return t+e*UM}function QC(t){return t&BM}function e3(t){return(t-(t&BM))/UM}const HM=1,VM=2,bh=4,PM=8;class gb{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&PM)>0}get deletedBefore(){return(this.delInfo&(HM|bh))>0}get deletedAfter(){return(this.delInfo&(VM|bh))>0}get deletedAcross(){return(this.delInfo&bh)>0}}class kr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&kr.empty)return kr.empty}recover(e){let n=0,r=QC(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+e3(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let d=this.ranges[c]-(this.inverted?i:0);if(d>e)break;let f=this.ranges[c+s],p=this.ranges[c+l],m=d+f;if(e<=m){let g=f?e==d?-1:e==m?1:n:n,b=d+i+(g<0?0:p);if(r)return b;let v=e==(n<0?d:m)?null:QL(c/3,e-d),w=e==d?VM:e==m?HM:bh;return(n<0?e!=d:e!=m)&&(w|=PM),new gb(b,w,v)}i+=p-f}return r?e+i:new gb(e+i,0,null)}touches(e,n){let r=0,i=QC(n),s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let d=this.ranges[c]-(this.inverted?r:0);if(d>e)break;let f=this.ranges[c+s],p=d+f;if(e<=p&&c==i*3)return!0;r+=this.ranges[c+l]-f}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let l=this.ranges[i],c=l-(this.inverted?s:0),d=l+(this.inverted?0:s),f=this.ranges[i+n],p=this.ranges[i+r];e(c,c+f,d,d+p),s+=p-f}}invert(){return new kr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?kr.empty:new kr(e<0?[0,-e,0]:[0,0,e])}}kr.empty=new kr([]);class Vu{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 Vu(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 Vu;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let l=this._maps[s],c=l.mapResult(e,n);if(c.recover!=null){let d=this.getMirror(s);if(d!=null&&d>s&&d<this.to){s=d,e=this._maps[d].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new gb(e,i,null)}}const Jy=Object.create(null);class Un{getMap(){return kr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Jy[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 Jy)throw new RangeError("Duplicate use of step JSON ID "+e);return Jy[e]=n,n.prototype.jsonID=e,n}}class rn{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new rn(e,null)}static fail(e){return new rn(null,e)}static fromReplace(e,n,r,i){try{return rn.ok(e.replace(n,r,i))}catch(s){if(s instanceof Vh)return rn.fail(s.message);throw s}}}function Rx(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Rx(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return ne.fromArray(r)}class eo extends Un{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 ye(Rx(n.content,(l,c)=>!l.isAtom||!c.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),n.openStart,n.openEnd);return rn.fromReplace(e,this.from,this.to,s)}invert(){return new Ci(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new eo(n.pos,r.pos,this.mark)}merge(e){return e instanceof eo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new eo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new eo(n.from,n.to,e.markFromJSON(n.mark))}}Un.jsonID("addMark",eo);class Ci extends Un{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 ye(Rx(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return rn.fromReplace(e,this.from,this.to,r)}invert(){return new eo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Ci(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ci&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ci(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"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 Ci(n.from,n.to,e.markFromJSON(n.mark))}}Un.jsonID("removeMark",Ci);class to extends Un{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return rn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return rn.fromReplace(e,this.pos,this.pos+1,new ye(ne.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new to(this.pos,n.marks[i]);return new to(this.pos,this.mark)}}return new sl(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new to(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new to(n.pos,e.markFromJSON(n.mark))}}Un.jsonID("addNodeMark",to);class sl extends Un{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return rn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return rn.fromReplace(e,this.pos,this.pos+1,new ye(ne.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new to(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new sl(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 sl(n.pos,e.markFromJSON(n.mark))}}Un.jsonID("removeNodeMark",sl);class pn extends Un{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&yb(e,this.from,this.to)?rn.fail("Structure replace would overwrite content"):rn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new kr([this.from,this.to-this.from,this.slice.size])}invert(e){return new pn(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 pn(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pn)||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?ye.empty:new ye(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pn(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?ye.empty:new ye(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pn(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 pn(n.from,n.to,ye.fromJSON(e,n.slice),!!n.structure)}}Un.jsonID("replace",pn);class mn extends Un{constructor(e,n,r,i,s,l,c=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=l,this.structure=c}apply(e){if(this.structure&&(yb(e,this.from,this.gapFrom)||yb(e,this.gapTo,this.to)))return rn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return rn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?rn.fromReplace(e,this.from,this.to,r):rn.fail("Content does not fit in gap")}getMap(){return new kr([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 mn(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 mn(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 mn(n.from,n.to,n.gapFrom,n.gapTo,ye.fromJSON(e,n.slice),n.insert,!!n.structure)}}Un.jsonID("replaceAround",mn);function yb(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let l=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function t3(t,e,n,r){let i=[],s=[],l,c;t.doc.nodesBetween(e,n,(d,f,p)=>{if(!d.isInline)return;let m=d.marks;if(!r.isInSet(m)&&p.type.allowsMarkType(r.type)){let g=Math.max(f,e),b=Math.min(f+d.nodeSize,n),v=r.addToSet(m);for(let w=0;w<m.length;w++)m[w].isInSet(v)||(l&&l.to==g&&l.mark.eq(m[w])?l.to=b:i.push(l=new Ci(g,b,m[w])));c&&c.to==g?c.to=b:s.push(c=new eo(g,b,r))}}),i.forEach(d=>t.step(d)),s.forEach(d=>t.step(d))}function n3(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(l,c)=>{if(!l.isInline)return;s++;let d=null;if(r instanceof Jp){let f=l.marks,p;for(;p=r.isInSet(f);)(d||(d=[])).push(p),f=p.removeFromSet(f)}else r?r.isInSet(l.marks)&&(d=[r]):d=l.marks;if(d&&d.length){let f=Math.min(c+l.nodeSize,n);for(let p=0;p<d.length;p++){let m=d[p],g;for(let b=0;b<i.length;b++){let v=i[b];v.step==s-1&&m.eq(i[b].style)&&(g=v)}g?(g.to=f,g.step=s):i.push({style:m,from:Math.max(c,e),to:f,step:s})}}}),i.forEach(l=>t.step(new Ci(l.from,l.to,l.style)))}function Nx(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),l=[],c=e+1;for(let d=0;d<s.childCount;d++){let f=s.child(d),p=c+f.nodeSize,m=r.matchType(f.type);if(!m)l.push(new pn(c,p,ye.empty));else{r=m;for(let g=0;g<f.marks.length;g++)n.allowsMarkType(f.marks[g].type)||t.step(new Ci(c,p,f.marks[g]));if(i&&f.isText&&n.whitespace!="pre"){let g,b=/\r?\n|\r/g,v;for(;g=b.exec(f.text);)v||(v=new ye(ne.from(n.schema.text(" ",n.allowedMarks(f.marks))),0,0)),l.push(new pn(c+g.index,c+g.index+g[0].length,v))}}c=p}if(!r.validEnd){let d=r.fillBefore(ne.empty,!0);t.replace(c,c,new ye(d,0,0))}for(let d=l.length-1;d>=0;d--)t.step(l[d])}function r3(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Za(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let l=t.$from.node(r),c=t.$from.index(r)+i,d=t.$to.indexAfter(r)-s;if(r<t.depth&&l.canReplace(c,d,n))return r;if(r==0||l.type.spec.isolating||!r3(l,c,d))break;c&&(i=1),d<l.childCount&&(s=1)}return null}function i3(t,e,n){let{$from:r,$to:i,depth:s}=e,l=r.before(s+1),c=i.after(s+1),d=l,f=c,p=ne.empty,m=0;for(let v=s,w=!1;v>n;v--)w||r.index(v)>0?(w=!0,p=ne.from(r.node(v).copy(p)),m++):d--;let g=ne.empty,b=0;for(let v=s,w=!1;v>n;v--)w||i.after(v+1)<i.end(v)?(w=!0,g=ne.from(i.node(v).copy(g)),b++):f++;t.step(new mn(d,f,l,c,new ye(p.append(g),m,b),p.size-m,!0))}function zx(t,e,n=null,r=t){let i=s3(t,e),s=i&&o3(r,e);return s?i.map(eE).concat({type:e,attrs:n}).concat(s.map(eE)):null}function eE(t){return{type:t,attrs:null}}function s3(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let l=s.length?s[0]:e;return n.canReplaceWith(r,i,l)?s:null}function o3(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),l=e.contentMatch.findWrapping(s.type);if(!l)return null;let d=(l.length?l[l.length-1]:e).contentMatch;for(let f=r;d&&f<i;f++)d=d.matchType(n.child(f).type);return!d||!d.validEnd?null:l}function l3(t,e,n){let r=ne.empty;for(let l=n.length-1;l>=0;l--){if(r.size){let c=n[l].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=ne.from(n[l].type.create(n[l].attrs,r))}let i=e.start,s=e.end;t.step(new mn(i,s,i,s,new ye(r,0,0),n.length,!0))}function a3(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(l,c)=>{let d=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,d)&&c3(t.doc,t.mapping.slice(s).map(c),r)){let f=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!v?f=!1:!b&&v&&(f=!0)}f===!1&&FM(t,l,c,s),Nx(t,t.mapping.slice(s).map(c,1),r,void 0,f===null);let p=t.mapping.slice(s),m=p.map(c,1),g=p.map(c+l.nodeSize,1);return t.step(new mn(m,g,m+1,g-1,new ye(ne.from(r.create(d,null,l.marks)),0,0),1,!0)),f===!0&&$M(t,l,c,s),!1}})}function $M(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(i.text);){let d=t.mapping.slice(r).map(n+1+s+l.index);t.replaceWith(d,d+1,e.type.schema.linebreakReplacement.create())}}})}function FM(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let l=t.mapping.slice(r).map(n+1+s);t.replaceWith(l,l+1,e.type.schema.text(`
|
|
64
|
+
`))}})}function c3(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function u3(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let l=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,l);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new mn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new ye(ne.from(l),0,0),1,!0))}function fs(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,l=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let f=i.depth-1,p=n-2;f>s;f--,p--){let m=i.node(f),g=i.index(f);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(g,m.childCount),v=r&&r[p+1];v&&(b=b.replaceChild(0,v.type.create(v.attrs)));let w=r&&r[p]||m;if(!m.canReplace(g+1,m.childCount)||!w.type.validContent(b))return!1}let c=i.indexAfter(s),d=r&&r[0];return i.node(s).canReplaceWith(c,c,d?d.type:i.node(s+1).type)}function d3(t,e,n=1,r){let i=t.doc.resolve(e),s=ne.empty,l=ne.empty;for(let c=i.depth,d=i.depth-n,f=n-1;c>d;c--,f--){s=ne.from(i.node(c).copy(s));let p=r&&r[f];l=ne.from(p?p.type.create(p.attrs,l):i.node(c).copy(l))}t.step(new pn(e,e,new ye(s.append(l),n,n),!0))}function yo(t,e){let n=t.resolve(e),r=n.index();return qM(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function f3(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),l=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(l),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function qM(t,e){return!!(t&&e&&!t.isLeaf&&f3(t,e))}function Xp(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,l,c=r.index(i);if(i==r.depth?(s=r.nodeBefore,l=r.nodeAfter):n>0?(s=r.node(i+1),c++,l=r.node(i).maybeChild(c)):(s=r.node(i).maybeChild(c-1),l=r.node(i+1)),s&&!s.isTextblock&&qM(s,l)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function h3(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),l=s.node().type;if(i&&l.inlineContent){let p=l.whitespace=="pre",m=!!l.contentMatch.matchType(i);p&&!m?r=!1:!p&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let p=t.doc.resolve(e+n);FM(t,p.node(),p.before(),c)}l.inlineContent&&Nx(t,e+n-1,l,s.node().contentMatchAt(s.index()),r==null);let d=t.mapping.slice(c),f=d.map(e-n);if(t.step(new pn(f,d.map(e+n,-1),ye.empty,!0)),r===!0){let p=t.doc.resolve(f);$M(t,p.node(),p.before(),t.steps.length)}return t}function p3(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 YM(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let l=r.depth;l>=0;l--){let c=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,d=r.index(l)+(c>0?1:0),f=r.node(l),p=!1;if(s==1)p=f.canReplace(d,d,i);else{let m=f.contentMatchAt(d).findWrapping(i.firstChild.type);p=m&&f.canReplaceWith(d,d,m[0])}if(p)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function Qp(t,e,n=e,r=ye.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return KM(i,s,r)?new pn(e,n,r):new m3(i,s,r).fit()}function KM(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class m3{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ne.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=ne.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let f=this.findFittable();f?this.placeNodes(f):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,l=r.depth,c=i.depth;for(;l&&c&&s.childCount==1;)s=s.firstChild.content,l--,c--;let d=new ye(s,l,c);return e>-1?new mn(r.pos,e,this.$to.pos,this.$to.end(),d,n):d.size||r.pos!=this.$to.pos?new pn(r.pos,i.pos,d):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=Xy(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let l=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:d,match:f}=this.frontier[c],p,m=null;if(n==1&&(l?f.matchType(l.type)||(m=f.fillBefore(ne.from(l),!1)):s&&d.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:m};if(n==2&&l&&(p=f.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:p};if(s&&f.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Xy(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new ye(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=Xy(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new ye(cu(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new ye(cu(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let w=0;w<s.length;w++)this.openFrontierNode(s[w]);let l=this.unplaced,c=r?r.content:l.content,d=l.openStart-e,f=0,p=[],{match:m,type:g}=this.frontier[n];if(i){for(let w=0;w<i.childCount;w++)p.push(i.child(w));m=m.matchFragment(i)}let b=c.size+e-(l.content.size-l.openEnd);for(;f<c.childCount;){let w=c.child(f),C=m.matchType(w.type);if(!C)break;f++,(f>1||d==0||w.content.size)&&(m=C,p.push(WM(w.mark(g.allowedMarks(w.marks)),f==1?d:0,f==c.childCount?b:-1)))}let v=f==c.childCount;v||(b=-1),this.placed=uu(this.placed,n,ne.from(p)),this.frontier[n].match=m,v&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,C=c;w<b;w++){let E=C.lastChild;this.frontier.push({type:E.type,match:E.contentMatchAt(E.childCount)}),C=E.content}this.unplaced=v?e==0?ye.empty:new ye(cu(l.content,e-1,1),e-1,b<0?l.openEnd:e-1):new ye(cu(l.content,e,f),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Qy(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),l=Qy(e,n,i,r,s);if(l){for(let c=n-1;c>=0;c--){let{match:d,type:f}=this.frontier[c],p=Qy(e,c,f,d,!0);if(!p||p.childCount)continue e}return{depth:n,fit:l,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=uu(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=uu(this.placed,this.depth,ne.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ne.empty,!0);n.childCount&&(this.placed=uu(this.placed,this.frontier.length,n))}}function cu(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(cu(t.firstChild.content,e-1,n)))}function uu(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(uu(t.lastChild.content,e-1,n)))}function Xy(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function WM(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,WM(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(ne.empty,!0)))),t.copy(r)}function Qy(t,e,n,r,i){let s=t.node(e),l=i?t.indexAfter(e):t.index(e);if(l==s.childCount&&!n.compatibleContent(s.type))return null;let c=r.fillBefore(s.content,!0,l);return c&&!g3(n,s.content,l)?c:null}function g3(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function y3(t){return t.spec.defining||t.spec.definingForContent}function b3(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(KM(i,s,r))return t.step(new pn(e,n,r));let l=ZM(i,s);l[l.length-1]==0&&l.pop();let c=-(i.depth+1);l.unshift(c);for(let g=i.depth,b=i.pos-1;g>0;g--,b--){let v=i.node(g).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;l.indexOf(g)>-1?c=g:i.before(g)==b&&l.splice(1,0,-g)}let d=l.indexOf(c),f=[],p=r.openStart;for(let g=r.content,b=0;;b++){let v=g.firstChild;if(f.push(v),b==r.openStart)break;g=v.content}for(let g=p-1;g>=0;g--){let b=f[g],v=y3(b.type);if(v&&!b.sameMarkup(i.node(Math.abs(c)-1)))p=g;else if(v||!b.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let b=(g+p+1)%(r.openStart+1),v=f[b];if(v)for(let w=0;w<l.length;w++){let C=l[(w+d)%l.length],E=!0;C<0&&(E=!1,C=-C);let I=i.node(C-1),j=i.index(C-1);if(I.canReplaceWith(j,j,v.type,v.marks))return t.replace(i.before(C),E?s.after(C):n,new ye(GM(r.content,0,r.openStart,b),b,r.openEnd))}}let m=t.steps.length;for(let g=l.length-1;g>=0&&(t.replace(e,n,r),!(t.steps.length>m));g--){let b=l[g];b<0||(e=i.before(b),n=s.after(b))}}function GM(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(GM(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),l=s.fillBefore(t).append(t);t=l.append(s.matchFragment(l).fillBefore(ne.empty,!0))}return t}function x3(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=p3(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new ye(ne.from(r),0,0))}function v3(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=ZM(r,i);for(let l=0;l<s.length;l++){let c=s[l],d=l==s.length-1;if(d&&c==0||r.node(c).type.contentMatch.validEnd)return t.delete(r.start(c),i.end(c));if(c>0&&(d||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return t.delete(r.before(c),i.after(c))}for(let l=1;l<=r.depth&&l<=i.depth;l++)if(e-r.start(l)==r.depth-l&&n>r.end(l)&&i.end(l)-n!=i.depth-l&&r.start(l-1)==i.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),i.index(l-1)))return t.delete(r.before(l),n);t.delete(e,n)}function ZM(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 va extends Un{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 rn.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 rn.fromReplace(e,this.pos,this.pos+1,new ye(ne.from(i),0,n.isLeaf?0:1))}getMap(){return kr.empty}invert(e){return new va(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 va(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 va(n.pos,n.attr,n.value)}}Un.jsonID("attr",va);class Pu extends Un{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 rn.ok(r)}getMap(){return kr.empty}invert(e){return new Pu(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 Pu(n.attr,n.value)}}Un.jsonID("docAttr",Pu);let ja=class extends Error{};ja=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ja.prototype=Object.create(Error.prototype);ja.prototype.constructor=ja;ja.prototype.name="TransformError";class Lx{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Vu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ja(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,l,c,d)=>{e=Math.min(e,c),n=Math.max(n,d)})}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=ye.empty){let i=Qp(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new ye(ne.from(r),0,0))}delete(e,n){return this.replace(e,n,ye.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return b3(this,e,n,r),this}replaceRangeWith(e,n,r){return x3(this,e,n,r),this}deleteRange(e,n){return v3(this,e,n),this}lift(e,n){return i3(this,e,n),this}join(e,n=1){return h3(this,e,n),this}wrap(e,n){return l3(this,e,n),this}setBlockType(e,n=e,r,i=null){return a3(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return u3(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new va(e,n,r)),this}setDocAttribute(e,n){return this.step(new Pu(e,n)),this}addNodeMark(e,n){return this.step(new to(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof wt)n.isInSet(r.marks)&&this.step(new sl(e,n));else{let i=r.marks,s,l=[];for(;s=n.isInSet(i);)l.push(new sl(e,s)),i=s.removeFromSet(i);for(let c=l.length-1;c>=0;c--)this.step(l[c])}return this}split(e,n=1,r){return d3(this,e,n,r),this}addMark(e,n,r){return t3(this,e,n,r),this}removeMark(e,n,r){return n3(this,e,n,r),this}clearIncompatible(e,n,r){return Nx(this,e,n,r),this}}const e0=Object.create(null);class ze{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new JM(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=ye.empty){let r=n.content.lastChild,i=null;for(let c=0;c<n.openEnd;c++)i=r,r=r.lastChild;let s=e.steps.length,l=this.ranges;for(let c=0;c<l.length;c++){let{$from:d,$to:f}=l[c],p=e.mapping.slice(s);e.replaceRange(p.map(d.pos),p.map(f.pos),c?ye.empty:n),c==0&&rE(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:c}=i[s],d=e.mapping.slice(r),f=d.map(l.pos),p=d.map(c.pos);s?e.deleteRange(f,p):(e.replaceRangeWith(f,p,n),rE(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new _e(e):fa(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let l=n<0?fa(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):fa(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(l)return l}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new lr(e.node(0))}static atStart(e){return fa(e,e,0,0,1)||new lr(e)}static atEnd(e){return fa(e,e,e.content.size,e.childCount,-1)||new lr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=e0[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 e0)throw new RangeError("Duplicate use of selection JSON ID "+e);return e0[e]=n,n.prototype.jsonID=e,n}getBookmark(){return _e.between(this.$anchor,this.$head).getBookmark()}}ze.prototype.visible=!0;class JM{constructor(e,n){this.$from=e,this.$to=n}}let tE=!1;function nE(t){!tE&&!t.parent.inlineContent&&(tE=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class _e extends ze{constructor(e,n=e){nE(e),nE(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return ze.near(r);let i=e.resolve(n.map(this.anchor));return new _e(i.parent.inlineContent?i:r,r)}replace(e,n=ye.empty){if(super.replace(e,n),n==ye.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof _e&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new em(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new _e(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=ze.findFrom(n,r,!0)||ze.findFrom(n,-r,!0);if(s)n=s.$head;else return ze.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(ze.findFrom(e,-r,!0)||ze.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new _e(e,n)}}ze.jsonID("text",_e);class em{constructor(e,n){this.anchor=e,this.head=n}map(e){return new em(e.map(this.anchor),e.map(this.head))}resolve(e){return _e.between(e.resolve(this.anchor),e.resolve(this.head))}}class Te extends ze{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?ze.near(s):new Te(s)}content(){return new ye(ne.from(this.node),0,0)}eq(e){return e instanceof Te&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new jx(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Te(e.resolve(n.anchor))}static create(e,n){return new Te(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Te.prototype.visible=!1;ze.jsonID("node",Te);class jx{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new em(r,r):new jx(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Te.isSelectable(r)?new Te(n):ze.near(n)}}class lr extends ze{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ye.empty){if(n==ye.empty){e.delete(0,e.doc.content.size);let r=ze.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new lr(e)}map(e){return new lr(e)}eq(e){return e instanceof lr}getBookmark(){return S3}}ze.jsonID("all",lr);const S3={map(){return this},resolve(t){return new lr(t)}};function fa(t,e,n,r,i,s=!1){if(e.inlineContent)return _e.create(t,n);for(let l=r-(i>0?0:1);i>0?l<e.childCount:l>=0;l+=i){let c=e.child(l);if(c.isAtom){if(!s&&Te.isSelectable(c))return Te.create(t,n-(i<0?c.nodeSize:0))}else{let d=fa(t,c,n+i,i<0?c.childCount:0,i,s);if(d)return d}n+=c.nodeSize*i}return null}function rE(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof pn||i instanceof mn))return;let s=t.mapping.maps[r],l;s.forEach((c,d,f,p)=>{l==null&&(l=p)}),t.setSelection(ze.near(t.doc.resolve(l),n))}const iE=1,qf=2,sE=4;let w3=class extends Lx{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|iE)&~qf,this.storedMarks=null,this}get selectionSet(){return(this.updated&iE)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=qf,this}ensureMarks(e){return wt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&qf)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~qf,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||wt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let l=this.doc.resolve(n);s=r==n?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ze.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=sE,this}get scrolledIntoView(){return(this.updated&sE)>0}};function oE(t,e){return!e||!t?t:t.bind(e)}class du{constructor(e,n,r){this.name=e,this.init=oE(n.init,r),this.apply=oE(n.apply,r)}}const k3=[new du("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new du("selection",{init(t,e){return t.selection||ze.atStart(e.doc)},apply(t){return t.selection}}),new du("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new du("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class t0{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=k3.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 du(r.key,r.spec.state,r))})}}class ga{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let l=0;l<this.config.plugins.length;l++){let c=this.config.plugins[l];if(c.spec.appendTransaction){let d=i?i[l].n:0,f=i?i[l].state:this,p=d<n.length&&c.spec.appendTransaction.call(c,d?n.slice(d):n,f,r);if(p&&r.filterTransaction(p,l)){if(p.setMeta("appendedTransaction",e),!i){i=[];for(let m=0;m<this.config.plugins.length;m++)i.push(m<l?{state:r,n:n.length}:{state:this,n:0})}n.push(p),r=r.applyInner(p),s=!0}i&&(i[l]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ga(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 w3(this)}static create(e){let n=new t0(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ga(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 t0(this.schema,e.plugins),r=n.fields,i=new ga(n);for(let s=0;s<r.length;s++){let l=r[s].name;i[l]=this.hasOwnProperty(l)?this[l]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new t0(e.schema,e.plugins),s=new ga(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=so.fromJSON(e.schema,n.doc);else if(l.name=="selection")s.selection=ze.fromJSON(s.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let d=r[c],f=d.spec.state;if(d.key==l.name&&f&&f.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){s[l.name]=f.fromJSON.call(d,e,n[c],s);return}}s[l.name]=l.init(e,s)}}),s}}function XM(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=XM(i,e,{})),n[r]=i}return n}class xt{constructor(e){this.spec=e,this.props={},e.props&&XM(e.props,this,this.props),this.key=e.key?e.key.key:QM("plugin")}getState(e){return e[this.key]}}const n0=Object.create(null);function QM(t){return t in n0?t+"$"+ ++n0[t]:(n0[t]=0,t+"$")}class Rt{constructor(e="key"){this.key=QM(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Mn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ia=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let bb=null;const us=function(t,e,n){let r=bb||(bb=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},C3=function(){bb=null},ol=function(t,e,n,r){return n&&(lE(t,e,n,r,-1)||lE(t,e,n,r,1))},E3=/^(img|br|input|textarea|hr)$/i;function lE(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Fr(t))){let l=t.parentNode;if(!l||l.nodeType!=1||md(t)||E3.test(t.nodeName)||t.contentEditable=="false")return!1;e=Mn(t)+(i<0?0:1),t=l}else if(t.nodeType==1){let l=t.childNodes[e+(i<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((s=l.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=l,e=i<0?Fr(t):0}else return!1}}function Fr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function T3(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=Fr(t)}else if(t.parentNode&&!md(t))e=Mn(t),t=t.parentNode;else return null}}function A3(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&&!md(t))e=Mn(t)+1,t=t.parentNode;else return null}}function M3(t,e,n){for(let r=e==0,i=e==Fr(t);r||i;){if(t==n)return!0;let s=Mn(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Fr(t)}}function md(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 tm=function(t){return t.focusNode&&ol(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Vo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function O3(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function _3(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Fr(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Fr(r.startContainer),r.startOffset)}}}const Mi=typeof navigator<"u"?navigator:null,aE=typeof document<"u"?document:null,bo=Mi&&Mi.userAgent||"",xb=/Edge\/(\d+)/.exec(bo),eO=/MSIE \d/.exec(bo),vb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(bo),ar=!!(eO||vb||xb),oo=eO?document.documentMode:vb?+vb[1]:xb?+xb[1]:0,Wr=!ar&&/gecko\/(\d+)/i.test(bo);Wr&&+(/Firefox\/(\d+)/.exec(bo)||[0,0])[1];const Sb=!ar&&/Chrome\/(\d+)/.exec(bo),_n=!!Sb,tO=Sb?+Sb[1]:0,jn=!ar&&!!Mi&&/Apple Computer/.test(Mi.vendor),Ba=jn&&(/Mobile\/\w+/.test(bo)||!!Mi&&Mi.maxTouchPoints>2),Pr=Ba||(Mi?/Mac/.test(Mi.platform):!1),nO=Mi?/Win/.test(Mi.platform):!1,ds=/Android \d/.test(bo),gd=!!aE&&"webkitFontSmoothing"in aE.documentElement.style,D3=gd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function R3(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 rs(t,e){return typeof t=="number"?t:t[e]}function N3(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 cE(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let l=n||t.dom;l;){if(l.nodeType!=1){l=Ia(l);continue}let c=l,d=c==s.body,f=d?R3(s):N3(c),p=0,m=0;if(e.top<f.top+rs(r,"top")?m=-(f.top-e.top+rs(i,"top")):e.bottom>f.bottom-rs(r,"bottom")&&(m=e.bottom-e.top>f.bottom-f.top?e.top+rs(i,"top")-f.top:e.bottom-f.bottom+rs(i,"bottom")),e.left<f.left+rs(r,"left")?p=-(f.left-e.left+rs(i,"left")):e.right>f.right-rs(r,"right")&&(p=e.right-f.right+rs(i,"right")),p||m)if(d)s.defaultView.scrollBy(p,m);else{let b=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),p&&(c.scrollLeft+=p);let w=c.scrollLeft-b,C=c.scrollTop-v;e={left:e.left-w,top:e.top-C,right:e.right-w,bottom:e.bottom-C}}let g=d?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(g))break;l=g=="absolute"?l.offsetParent:Ia(l)}}function z3(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,l=n+1;l<Math.min(innerHeight,e.bottom);l+=5){let c=t.root.elementFromPoint(s,l);if(!c||c==t.dom||!t.dom.contains(c))continue;let d=c.getBoundingClientRect();if(d.top>=n-20){r=c,i=d.top;break}}return{refDOM:r,refTop:i,stack:rO(t.dom)}}function rO(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Ia(r));return e}function L3({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;iO(n,r==0?0:r-e)}function iO(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 oa=null;function j3(t){if(t.setActive)return t.setActive();if(oa)return t.focus(oa);let e=rO(t);t.focus(oa==null?{get preventScroll(){return oa={preventScroll:!0},!0}}:void 0),oa||(oa=!1,iO(e,0))}function sO(t,e){let n,r=2e8,i,s=0,l=e.top,c=e.top,d,f;for(let p=t.firstChild,m=0;p;p=p.nextSibling,m++){let g;if(p.nodeType==1)g=p.getClientRects();else if(p.nodeType==3)g=us(p).getClientRects();else continue;for(let b=0;b<g.length;b++){let v=g[b];if(v.top<=l&&v.bottom>=c){l=Math.max(v.bottom,l),c=Math.min(v.top,c);let w=v.left>e.left?v.left-e.left:v.right<e.left?e.left-v.right:0;if(w<r){n=p,r=w,i=w&&n.nodeType==3?{left:v.right<e.left?v.right:v.left,top:e.top}:e,p.nodeType==1&&w&&(s=m+(e.left>=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!d&&v.left<=e.left&&v.right>=e.left&&(d=p,f={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(s=m+1)}}return!n&&d&&(n=d,i=f,r=0),n&&n.nodeType==3?I3(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:sO(n,i)}function I3(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let l=qs(r,1);if(l.top!=l.bottom&&Ix(e,l)){i={node:t,offset:s+(e.left>=(l.left+l.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function Ix(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function B3(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function U3(t,e,n){let{node:r,offset:i}=sO(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();s=l.left!=l.right&&n.left>(l.left+l.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function H3(t,e,n,r){let i=-1;for(let s=e,l=!1;s!=t.dom;){let c=t.docView.nearestDesc(s,!0),d;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((d=c.dom.getBoundingClientRect()).width||d.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!l&&d.left>r.left||d.top>r.top?i=c.posBefore:(!l&&d.right<r.left||d.bottom<r.top)&&(i=c.posAfter),l=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(d.top+d.bottom)/2:r.left<(d.left+d.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function oO(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let l=t.childNodes[s];if(l.nodeType==1){let c=l.getClientRects();for(let d=0;d<c.length;d++){let f=c[d];if(Ix(e,f))return oO(l,e,f)}}if((s=(s+1)%r)==i)break}return t}function V3(t,e){let n=t.dom.ownerDocument,r,i=0,s=_3(n,e.left,e.top);s&&({node:r,offset:i}=s);let l=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),c;if(!l||!t.dom.contains(l.nodeType!=1?l.parentNode:l)){let f=t.dom.getBoundingClientRect();if(!Ix(e,f)||(l=oO(t.dom,e,f),!l))return null}if(jn)for(let f=l;r&&f;f=Ia(f))f.draggable&&(r=void 0);if(l=B3(l,e),r){if(Wr&&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 f;gd&&i&&r.nodeType==1&&(f=r.childNodes[i-1]).nodeType==1&&f.contentEditable=="false"&&f.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=H3(t,r,i,e))}c==null&&(c=U3(t,l,e));let d=t.docView.nearestDesc(l,!0);return{pos:c,inside:d?d.posAtStart-d.border:-1}}function uE(t){return t.top<t.bottom||t.left<t.right}function qs(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(uE(r))return r}return Array.prototype.find.call(n,uE)||t.getBoundingClientRect()}const P3=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function lO(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),l=gd||Wr;if(r.nodeType==3)if(l&&(P3.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let d=qs(us(r,i,i),n);if(Wr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let f=qs(us(r,i-1,i-1),-1);if(f.top==d.top){let p=qs(us(r,i,i+1),-1);if(p.top!=d.top)return tu(p,p.left<f.left)}}return d}else{let d=i,f=i,p=n<0?1:-1;return n<0&&!i?(f++,p=-1):n>=0&&i==r.nodeValue.length?(d--,p=1):n<0?d--:f++,tu(qs(us(r,d,f),p),p<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Fr(r))){let d=r.childNodes[i-1];if(d.nodeType==1)return r0(d.getBoundingClientRect(),!1)}if(s==null&&i<Fr(r)){let d=r.childNodes[i];if(d.nodeType==1)return r0(d.getBoundingClientRect(),!0)}return r0(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Fr(r))){let d=r.childNodes[i-1],f=d.nodeType==3?us(d,Fr(d)-(l?0:1)):d.nodeType==1&&(d.nodeName!="BR"||!d.nextSibling)?d:null;if(f)return tu(qs(f,1),!1)}if(s==null&&i<Fr(r)){let d=r.childNodes[i];for(;d.pmViewDesc&&d.pmViewDesc.ignoreForCoords;)d=d.nextSibling;let f=d?d.nodeType==3?us(d,0,l?0:1):d.nodeType==1?d:null:null;if(f)return tu(qs(f,-1),!0)}return tu(qs(r.nodeType==3?us(r):r,-n),n>=0)}function tu(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 r0(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 aO(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 $3(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return aO(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(s,!0);if(!c)break;if(c.node.isBlock){s=c.contentDOM||c.dom;break}s=c.dom.parentNode}let l=lO(t,i.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let d;if(c.nodeType==1)d=c.getClientRects();else if(c.nodeType==3)d=us(c,0,c.nodeValue.length).getClientRects();else continue;for(let f=0;f<d.length;f++){let p=d[f];if(p.bottom>p.top+1&&(n=="up"?l.top-p.top>(p.bottom-l.top)*2:p.bottom-l.bottom>(l.bottom-p.top)*2))return!1}}return!0})}const F3=/[\u0590-\u08ac]/;function q3(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,l=i==r.parent.content.size,c=t.domSelection();return c?!F3.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:l:aO(t,e,()=>{let{focusNode:d,focusOffset:f,anchorNode:p,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:w}=t.domSelectionRange(),C=v&&!b.contains(v.nodeType==1?v:v.parentNode)||d==v&&f==w;try{c.collapse(p,m),d&&(d!=p||f!=m)&&c.extend&&c.extend(d,f)}catch{}return g!=null&&(c.caretBidiLevel=g),C}):r.pos==r.start()||r.pos==r.end()}let dE=null,fE=null,hE=!1;function Y3(t,e,n){return dE==e&&fE==n?hE:(dE=e,fE=n,hE=n=="up"||n=="down"?$3(t,e,n):q3(t,e,n))}const Gr=0,pE=1,qo=2,Oi=3;class yd{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Gr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,l;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(l)+l.size:this.posAtStart}else{let s,l;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(l):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Mn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),l;if(s&&(!n||s.node))if(r&&(l=s.nodeDOM)&&!(l.nodeType==1?l.contains(e.nodeType==1?e:e.parentNode):l==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let l=0;l<i.children.length;l++){let c=i.children[l];if(c.size){i=c;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let l=this.children[r],c=s+l.size;if(c>e||l instanceof uO){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 cO&&s.side>=0;r--);if(n<=0){let s,l=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,l=!1);return s&&n&&l&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Mn(s.dom)+1:0}}else{let s,l=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,l=!1);return s&&l&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Mn(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let l=r,c=0;;c++){let d=this.children[c],f=l+d.size;if(i==-1&&e<=f){let p=l+d.border;if(e>=p&&n<=f-d.border&&d.node&&d.contentDOM&&this.contentDOM.contains(d.contentDOM))return d.parseRange(e,n,p);e=l;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){i=Mn(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(f>n||c==this.children.length-1)){n=f;for(let p=c+1;p<this.children.length;p++){let m=this.children[p];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=Mn(m.dom);break}n+=m.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=f}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),l=Math.max(e,n);for(let b=0,v=0;b<this.children.length;b++){let w=this.children[b],C=v+w.size;if(s>v&&l<C)return w.setSelection(e-v-w.border,n-v-w.border,r,i);v=C}let c=this.domFromPos(e,e?-1:1),d=n==e?c:this.domFromPos(n,n?-1:1),f=r.root.getSelection(),p=r.domSelectionRange(),m=!1;if((Wr||jn)&&e==n){let{node:b,offset:v}=c;if(b.nodeType==3){if(m=!!(v&&b.nodeValue[v-1]==`
|
|
65
|
+
`),m&&v==b.nodeValue.length)for(let w=b,C;w;w=w.parentNode){if(C=w.nextSibling){C.nodeName=="BR"&&(c=d={node:C.parentNode,offset:Mn(C)+1});break}let E=w.pmViewDesc;if(E&&E.node&&E.node.isBlock)break}}else{let w=b.childNodes[v-1];m=w&&(w.nodeName=="BR"||w.contentEditable=="false")}}if(Wr&&p.focusNode&&p.focusNode!=d.node&&p.focusNode.nodeType==1){let b=p.focusNode.childNodes[p.focusOffset];b&&b.contentEditable=="false"&&(i=!0)}if(!(i||m&&jn)&&ol(c.node,c.offset,p.anchorNode,p.anchorOffset)&&ol(d.node,d.offset,p.focusNode,p.focusOffset))return;let g=!1;if((f.extend||e==n)&&!(m&&Wr)){f.collapse(c.node,c.offset);try{e!=n&&f.extend(d.node,d.offset),g=!0}catch{}}if(!g){if(e>n){let v=c;c=d,d=v}let b=document.createRange();b.setEnd(d.node,d.offset),b.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(b)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],l=r+s.size;if(r==l?e<=l&&n>=r:e<l&&n>r){let c=r+s.border,d=l-s.border;if(e>=c&&n<=d){this.dirty=e==r||n==l?qo:pE,e==c&&n==d&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Oi:s.markDirty(e-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?qo:Oi}r=l}this.dirty=qo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?qo:pE;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class cO extends yd{constructor(e,n,r,i){let s,l=n.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(l.nodeType!=1){let c=document.createElement("span");c.appendChild(l),l=c}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Gr&&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 K3 extends yd{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 ll extends yd{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],l=s&&s(n,i,r);return(!l||!l.dom)&&(l=gl.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ll(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Oi||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Oi&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Gr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Gr}}slice(e,n,r){let i=ll.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;n<l&&(s=kb(s,n,l,r)),e>0&&(s=kb(s,0,e,r));for(let c=0;c<s.length;c++)s[c].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class lo extends yd{constructor(e,n,r,i,s,l,c,d,f){super(e,[],s,l),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(e,n,r,i,s,l){let c=s.nodeViews[n.type.name],d,f=c&&c(n,s,()=>{if(!d)return l;if(d.parent)return d.parent.posBeforeChild(d)},r,i),p=f&&f.dom,m=f&&f.contentDOM;if(n.isText){if(!p)p=document.createTextNode(n.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:m}=gl.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),n.type.spec.draggable&&(p.draggable=!0));let g=p;return p=hO(p,r,n),f?d=new W3(e,n,r,i,p,m||null,g,f,s,l+1):n.isText?new nm(e,n,r,i,p,g,s):new lo(e,n,r,i,p,m||null,g,s,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ne.empty)}return e}matchesNode(e,n,r){return this.dirty==Gr&&e.eq(this.node)&&qh(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,l=s&&s.pos>-1?s:null,c=s&&s.pos<0,d=new Z3(this,l&&l.node,e);Q3(this.node,this.innerDeco,(f,p,m)=>{f.spec.marks?d.syncToMarks(f.spec.marks,r,e,p):f.type.side>=0&&!m&&d.syncToMarks(p==this.node.childCount?wt.none:this.node.child(p).marks,r,e,p),d.placeWidget(f,e,i)},(f,p,m,g)=>{d.syncToMarks(f.marks,r,e,g);let b;d.findNodeMatch(f,p,m,g)||c&&e.state.selection.from>i&&e.state.selection.to<i+f.nodeSize&&(b=d.findIndexWithChild(s.node))>-1&&d.updateNodeAt(f,p,m,b,e)||d.updateNextNode(f,p,m,e,g,i)||d.addNode(f,p,m,e,i),i+=f.nodeSize}),d.syncToMarks([],r,e,0),this.node.isTextblock&&d.addTextblockHacks(),d.destroyRest(),(d.changed||this.dirty==qo)&&(l&&this.protectLocalComposition(e,l),dO(this.contentDOM,this.children,e),Ba&&e4(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof _e)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let l=s.nodeValue,c=t4(this.node.content,l,r-n,i-n);return c<0?null:{node:s,pos:c,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let l=new K3(this,s,n,i);e.input.compositionNodes.push(l),this.children=kb(this.children,r,r+i.length,e,l)}update(e,n,r,i){return this.dirty==Oi||!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=Gr}updateOuterDeco(e){if(qh(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=fO(this.dom,this.nodeDOM,wb(this.outerDeco,this.node,n),wb(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function mE(t,e,n,r,i){hO(r,e,t);let s=new lo(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class nm extends lo{constructor(e,n,r,i,s,l,c){super(e,n,r,i,s,null,l,c,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Oi||this.dirty!=Gr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Gr||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=Gr,!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 nm(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=Oi)}get domAtom(){return!1}isText(e){return this.node.text==e}}class uO extends yd{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Gr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class W3 extends lo{constructor(e,n,r,i,s,l,c,d,f,p){super(e,n,r,i,s,l,c,f,p),this.spec=d}update(e,n,r,i){if(this.dirty==Oi)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 dO(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let l=e[s],c=l.dom;if(c.parentNode==t){for(;c!=r;)r=gE(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(c,r);if(l instanceof ll){let d=r?r.previousSibling:t.lastChild;dO(l.contentDOM,l.children,n),r=d?d.nextSibling:t.firstChild}}for(;r;)r=gE(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const gu=function(t){t&&(this.nodeName=t)};gu.prototype=Object.create(null);const Yo=[new gu];function wb(t,e,n){if(t.length==0)return Yo;let r=n?Yo[0]:new gu,i=[r];for(let s=0;s<t.length;s++){let l=t[s].type.attrs;if(l){l.nodeName&&i.push(r=new gu(l.nodeName));for(let c in l){let d=l[c];d!=null&&(n&&i.length==1&&i.push(r=new gu(e.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+d:c=="style"?r.style=(r.style?r.style+";":"")+d:c!="nodeName"&&(r[c]=d))}}}return i}function fO(t,e,n,r){if(n==Yo&&r==Yo)return e;let i=e;for(let s=0;s<r.length;s++){let l=r[s],c=n[s];if(s){let d;c&&c.nodeName==l.nodeName&&i!=t&&(d=i.parentNode)&&d.nodeName.toLowerCase()==l.nodeName||(d=document.createElement(l.nodeName),d.pmIsDeco=!0,d.appendChild(i),c=Yo[0]),i=d}G3(i,c||Yo[0],l)}return i}function G3(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 hO(t,e,n){return fO(t,t,Yo,wb(e,n,t.nodeType!=1))}function qh(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 gE(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Z3{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=J3(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,l=this.stack.length>>1,c=Math.min(l,e.length);for(;s<c&&(s==l-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<l;)this.destroyRest(),this.top.dirty=Gr,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let d=-1,f=this.top.children.length;i<this.preMatch.index&&(f=Math.min(this.index+3,f));for(let p=this.index;p<f;p++){let m=this.top.children[p];if(m.matchesMark(e[l])&&!this.isLocked(m.dom)){d=p;break}}if(d>-1)d>this.index&&(this.changed=!0,this.destroyBetween(this.index,d)),this.top=this.top.children[this.index];else{let p=ll.create(this.top,e[l],n,r);this.top.children.splice(this.index,0,p),this.top=p,this.changed=!0}this.index=0,l++}}findNodeMatch(e,n,r,i){let s=-1,l;if(i>=this.preMatch.index&&(l=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&l.matchesNode(e,n,r))s=this.top.children.indexOf(l,this.index);else for(let c=this.index,d=Math.min(this.top.children.length,c+5);c<d;c++){let f=this.top.children[c];if(f.matchesNode(e,n,r)&&!this.preMatch.matched.has(f)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let l=this.top.children[i];return l.dirty==Oi&&l.dom==l.contentDOM&&(l.dirty=qo),l.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,l){for(let c=this.index;c<this.top.children.length;c++){let d=this.top.children[c];if(d instanceof lo){let f=this.preMatch.matched.get(d);if(f!=null&&f!=s)return!1;let p=d.dom,m,g=this.isLocked(p)&&!(e.isText&&d.node&&d.node.isText&&d.nodeDOM.nodeValue==e.text&&d.dirty!=Oi&&qh(n,d.outerDeco));if(!g&&d.update(e,n,r,i))return this.destroyBetween(this.index,c),d.dom!=p&&(this.changed=!0),this.index++,!0;if(!g&&(m=this.recreateWrapper(d,e,n,r,i,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=qo,m.updateChildren(i,l+1),m.dirty=Gr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,l){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!qh(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let c=lo.create(this.top,n,r,i,s,l);if(c.contentDOM){c.children=e.children,e.children=[];for(let d of c.children)d.parent=c}return e.destroy(),c}addNode(e,n,r,i,s){let l=lo.create(this.top,e,n,r,i,s);l.contentDOM&&l.updateChildren(i,s+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new cO(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 ll;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof nm)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((jn||_n)&&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 uO(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 J3(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,l=[];e:for(;i>0;){let c;for(;;)if(r){let f=n.children[r-1];if(f instanceof ll)n=f,r=f.children.length;else{c=f,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let d=c.node;if(d){if(d!=t.child(i-1))break;--i,s.set(c,i),l.push(c)}}return{index:i,matched:s,matches:l.reverse()}}function X3(t,e){return t.type.side-e.type.side}function Q3(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let f=0;f<t.childCount;f++){let p=t.child(f);r(p,i,e.forChild(s,p),f),s+=p.nodeSize}return}let l=0,c=[],d=null;for(let f=0;;){let p,m;for(;l<i.length&&i[l].to==s;){let C=i[l++];C.widget&&(p?(m||(m=[p])).push(C):p=C)}if(p)if(m){m.sort(X3);for(let C=0;C<m.length;C++)n(m[C],f,!!d)}else n(p,f,!!d);let g,b;if(d)b=-1,g=d,d=null;else if(f<t.childCount)b=f,g=t.child(f++);else break;for(let C=0;C<c.length;C++)c[C].to<=s&&c.splice(C--,1);for(;l<i.length&&i[l].from<=s&&i[l].to>s;)c.push(i[l++]);let v=s+g.nodeSize;if(g.isText){let C=v;l<i.length&&i[l].from<C&&(C=i[l].from);for(let E=0;E<c.length;E++)c[E].to<C&&(C=c[E].to);C<v&&(d=g.cut(C-s),g=g.cut(0,C-s),v=C,b=-1)}else for(;l<i.length&&i[l].to<v;)l++;let w=g.isInline&&!g.isLeaf?c.filter(C=>!C.inline):c.slice();r(g,w,e.forChild(s,g),b),s=v}}function e4(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 t4(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let l=t.child(i++),c=s;if(s+=l.nodeSize,!l.isText)continue;let d=l.text;for(;i<t.childCount;){let f=t.child(i++);if(s+=f.nodeSize,!f.isText)break;d+=f.text}if(s>=n){if(s>=r&&d.slice(r-e.length-c,r-c)==e)return r-e.length;let f=c<r?d.lastIndexOf(e,r-c-1):-1;if(f>=0&&f+e.length+c>=n)return c+f;if(n==r&&d.length>=r+e.length-c&&d.slice(r-c,r-c+e.length)==e)return r}}return-1}function kb(t,e,n,r,i){let s=[];for(let l=0,c=0;l<t.length;l++){let d=t[l],f=c,p=c+=d.size;f>=n||p<=e?s.push(d):(f<e&&s.push(d.slice(0,e-f,r)),i&&(s.push(i),i=void 0),p>n&&s.push(d.slice(n-f,d.size,r)))}return s}function Bx(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c=r.resolve(l),d,f;if(tm(n)){for(d=l;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Te.isSelectable(m)&&i.parent&&!(m.isInline&&M3(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;f=new Te(l==g?c:r.resolve(g))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=l,g=l;for(let b=0;b<n.rangeCount;b++){let v=n.getRangeAt(b);m=Math.min(m,t.docView.posFromDOM(v.startContainer,v.startOffset,1)),g=Math.max(g,t.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(m<0)return null;[d,l]=g==t.state.selection.anchor?[g,m]:[m,g],c=r.resolve(l)}else d=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(d<0)return null}let p=r.resolve(d);if(!f){let m=e=="pointer"||t.state.selection.head<c.pos&&!s?1:-1;f=Ux(t,p,c,m)}return f}function pO(t){return t.editable?t.hasFocus():gO(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function hs(t,e=!1){let n=t.state.selection;if(mO(t,n),!!pO(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&_n){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ol(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)r4(t);else{let{anchor:r,head:i}=n,s,l;yE&&!(n instanceof _e)&&(n.$from.parent.inlineContent||(s=bE(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=bE(t,n.to))),t.docView.setSelection(r,i,t,e),yE&&(s&&xE(s),l&&xE(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&n4(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const yE=jn||_n&&tO<63;function bE(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(jn&&i&&i.contentEditable=="false")return i0(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return i0(i);if(s)return i0(s)}}function i0(t){return t.contentEditable="true",jn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function xE(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function n4(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(()=>{(!pO(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function r4(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Mn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ar&&oo<=11&&(n.disabled=!0,n.disabled=!1)}function mO(t,e){if(e instanceof Te){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(vE(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else vE(t)}function vE(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Ux(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||_e.between(e,n,r)}function SE(t){return t.editable&&!t.hasFocus()?!1:gO(t)}function gO(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 i4(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ol(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Cb(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&ze.findFrom(s,e)}function Ks(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function wE(t,e,n){let r=t.state.selection;if(r instanceof _e)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let l=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Ks(t,new _e(r.$anchor,l))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Cb(t.state,e);return i&&i instanceof Te?Ks(t,i):!1}else if(!(Pr&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,l;if(!s||s.isText)return!1;let c=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(l=t.docView.descAt(c))&&!l.contentDOM?Te.isSelectable(s)?Ks(t,new Te(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):gd?Ks(t,new _e(t.state.doc.resolve(e<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Te&&r.node.isInline)return Ks(t,new _e(e>0?r.$to:r.$from));{let i=Cb(t.state,e);return i?Ks(t,i):!1}}}function Yh(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function yu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function la(t,e){return e<0?s4(t):o4(t)}function s4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,l=!1;for(Wr&&n.nodeType==1&&r<Yh(n)&&yu(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(yu(c,-1))i=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(yO(n))break;{let c=n.previousSibling;for(;c&&yu(c,-1);)i=n.parentNode,s=Mn(c),c=c.previousSibling;if(c)n=c,r=Yh(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}l?Eb(t,n,r):i&&Eb(t,i,s)}function o4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Yh(n),s,l;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(yu(c,1))s=n,l=++r;else break}else{if(yO(n))break;{let c=n.nextSibling;for(;c&&yu(c,1);)s=c.parentNode,l=Mn(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=Yh(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&Eb(t,s,l)}function yO(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function l4(t,e){for(;t&&e==t.childNodes.length&&!md(t);)e=Mn(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 a4(t,e){for(;t&&!e&&!md(t);)e=Mn(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 Eb(t,e,n){if(e.nodeType!=3){let s,l;(l=l4(e,n))?(e=l,n=0):(s=a4(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(tm(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&&hs(t)},50)}function kE(t,e){let n=t.state.doc.resolve(e);if(!(_n||nO)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function CE(t,e,n){let r=t.state.selection;if(r instanceof _e&&!r.empty||n.indexOf("s")>-1||Pr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=Cb(t.state,e);if(l&&l instanceof Te)return Ks(t,l)}if(!i.parent.inlineContent){let l=e<0?i:s,c=r instanceof lr?ze.near(l,e):ze.findFrom(l,e);return c?Ks(t,c):!1}return!1}function EE(t,e){if(!(t.state.selection instanceof _e))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let l=t.state.tr;return e<0?l.delete(n.pos-s.nodeSize,n.pos):l.delete(n.pos,n.pos+s.nodeSize),t.dispatch(l),!0}return!1}function TE(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function c4(t){if(!jn||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;TE(t,r,"true"),setTimeout(()=>TE(t,r,"false"),20)}return!1}function u4(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function d4(t,e){let n=e.keyCode,r=u4(e);if(n==8||Pr&&n==72&&r=="c")return EE(t,-1)||la(t,-1);if(n==46&&!e.shiftKey||Pr&&n==68&&r=="c")return EE(t,1)||la(t,1);if(n==13||n==27)return!0;if(n==37||Pr&&n==66&&r=="c"){let i=n==37?kE(t,t.state.selection.from)=="ltr"?-1:1:-1;return wE(t,i,r)||la(t,i)}else if(n==39||Pr&&n==70&&r=="c"){let i=n==39?kE(t,t.state.selection.from)=="ltr"?1:-1:1;return wE(t,i,r)||la(t,i)}else{if(n==38||Pr&&n==80&&r=="c")return CE(t,-1,r)||la(t,-1);if(n==40||Pr&&n==78&&r=="c")return c4(t)||CE(t,1,r)||la(t,1);if(r==(Pr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Hx(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let l=t.someProp("clipboardSerializer")||gl.fromSchema(t.state.schema),c=kO(),d=c.createElement("div");d.appendChild(l.serializeFragment(r,{document:c}));let f=d.firstChild,p,m=0;for(;f&&f.nodeType==1&&(p=wO[f.nodeName.toLowerCase()]);){for(let b=p.length-1;b>=0;b--){let v=c.createElement(p[b]);for(;d.firstChild;)v.appendChild(d.firstChild);d.appendChild(v),m++}f=d.firstChild}f&&f.nodeType==1&&f.setAttribute("data-pm-slice",`${i} ${s}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
|
|
66
|
+
|
|
67
|
+
`);return{dom:d,text:g,slice:e}}function bO(t,e,n,r,i){let s=i.parent.type.spec.code,l,c;if(!n&&!e)return null;let d=!!e&&(r||s||!n);if(d){if(t.someProp("transformPastedText",g=>{e=g(e,s||r,t)}),s)return c=new ye(ne.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
68
|
+
`))),0,0),t.someProp("transformPasted",g=>{c=g(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",g=>g(e,i,r,t));if(m)c=m;else{let g=i.marks(),{schema:b}=t.state,v=gl.fromSchema(b);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let C=l.appendChild(document.createElement("p"));w&&C.appendChild(v.serializeNode(b.text(w,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),l=m4(n),gd&&g4(l);let f=l&&l.querySelector("[data-pm-slice]"),p=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let m=+p[3];m>0;m--){let g=l.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;l=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||pu.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(d||p),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!f4.test(g.parentNode.nodeName)?{ignore:!0}:null}})),p)c=y4(AE(c,+p[1],+p[2]),p[4]);else if(c=ye.maxOpen(h4(c.content,i),!0),c.openStart||c.openEnd){let m=0,g=0;for(let b=c.content.firstChild;m<c.openStart&&!b.type.spec.isolating;m++,b=b.firstChild);for(let b=c.content.lastChild;g<c.openEnd&&!b.type.spec.isolating;g++,b=b.lastChild);c=AE(c,m,g)}return t.someProp("transformPasted",m=>{c=m(c,t,d)}),c}const f4=/^(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 h4(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,l=[];if(t.forEach(c=>{if(!l)return;let d=i.findWrapping(c.type),f;if(!d)return l=null;if(f=l.length&&s.length&&vO(d,s,c,l[l.length-1],0))l[l.length-1]=f;else{l.length&&(l[l.length-1]=SO(l[l.length-1],s.length));let p=xO(c,d);l.push(p),i=i.matchType(p.type),s=d}}),l)return ne.from(l)}return t}function xO(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ne.from(t));return t}function vO(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=vO(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(ne.from(xO(n,t,i+1))))}}function SO(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,SO(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(ne.empty,!0);return t.copy(n.append(r))}function Tb(t,e,n,r,i,s){let l=e<0?t.firstChild:t.lastChild,c=l.content;return t.childCount>1&&(s=0),i<r-1&&(c=Tb(c,e,n,r,i+1,s)),i>=n&&(c=e<0?l.contentMatchAt(0).fillBefore(c,s<=i).append(c):c.append(l.contentMatchAt(l.childCount).fillBefore(ne.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(c))}function AE(t,e,n){return e<t.openStart&&(t=new ye(Tb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ye(Tb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const wO={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 ME=null;function kO(){return ME||(ME=document.implementation.createHTMLDocument("title"))}let s0=null;function p4(t){let e=window.trustedTypes;return e?(s0||(s0=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),s0.createHTML(t)):t}function m4(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=kO().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&wO[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=p4(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function g4(t){let e=t.querySelectorAll(_n?"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 y4(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:l}=t;for(let c=r.length-2;c>=0;c-=2){let d=n.nodes[r[c]];if(!d||d.hasRequiredAttrs())break;i=ne.from(d.create(r[c+1],i)),s++,l++}return new ye(i,s,l)}const Kn={},Wn={},b4={touchstart:!0,touchmove:!0};class x4{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 v4(t){for(let e in Kn){let n=Kn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{w4(t,r)&&!Vx(t,r)&&(t.editable||!(r.type in Wn))&&n(t,r)},b4[e]?{passive:!0}:void 0)}jn&&t.dom.addEventListener("input",()=>null),Ab(t)}function no(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function S4(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 Ab(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Vx(t,r))})}function Vx(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function w4(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 k4(t,e){!Vx(t,e)&&Kn[e.type]&&(t.editable||!(e.type in Wn))&&Kn[e.type](t,e)}Wn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!EO(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ds&&_n&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Ba&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Vo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||d4(t,n)?n.preventDefault():no(t,"key")};Wn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Wn.keypress=(t,e)=>{let n=e;if(EO(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Pr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof _e)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",l=>l(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function rm(t){return{left:t.clientX,top:t.clientY}}function C4(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Px(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let l=s.depth+1;l>0;l--)if(t.someProp(e,c=>l>s.depth?c(t,n,s.nodeAfter,s.before(l),i,!0):c(t,n,s.node(l),s.before(l),i,!1)))return!0;return!1}function Sa(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 E4(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Te.isSelectable(r)?(Sa(t,new Te(n)),!0):!1}function T4(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Te&&(r=n.node);let s=t.state.doc.resolve(e);for(let l=s.depth+1;l>0;l--){let c=l>s.depth?s.nodeAfter:s.node(l);if(Te.isSelectable(c)){r&&n.$from.depth>0&&l>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(l);break}}return i!=null?(Sa(t,Te.create(t.state.doc,i)),!0):!1}function A4(t,e,n,r,i){return Px(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?T4(t,n):E4(t,n))}function M4(t,e,n,r){return Px(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function O4(t,e,n,r){return Px(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||_4(t,n,r)}function _4(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Sa(t,_e.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s),c=i.before(s);if(l.inlineContent)Sa(t,_e.create(r,c+1,c+1+l.content.size));else if(Te.isSelectable(l))Sa(t,Te.create(r,c));else continue;return!0}}function $x(t){return Kh(t)}const CO=Pr?"metaKey":"ctrlKey";Kn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=$x(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&C4(n,t.input.lastClick)&&!n[CO]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let l=t.posAtCoords(rm(n));l&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new D4(t,l,n,!!r)):(s=="doubleClick"?M4:O4)(t,l.pos,l.inside,n)?n.preventDefault():no(t,"pointer"))};class D4{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[CO],this.allowDefault=r.shiftKey;let s,l;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),l=n.inside;else{let p=e.state.doc.resolve(n.pos);s=p.parent,l=p.depth?p.before():0}const c=i?null:r.target,d=c?e.docView.nearestDesc(c,!0):null;this.target=d&&d.nodeDOM.nodeType==1?d.nodeDOM:null;let{selection:f}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||f instanceof Te&&f.from<=l&&f.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Wr&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),no(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>hs(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(rm(e))),this.updateAllowDefault(e),this.allowDefault||!n?no(this.view,"pointer"):A4(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||jn&&this.mightDrag&&!this.mightDrag.node.isAtom||_n&&!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)?(Sa(this.view,ze.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):no(this.view,"pointer")}move(e){this.updateAllowDefault(e),no(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Kn.touchstart=t=>{t.input.lastTouch=Date.now(),$x(t),no(t,"pointer")};Kn.touchmove=t=>{t.input.lastTouch=Date.now(),no(t,"pointer")};Kn.contextmenu=t=>$x(t);function EO(t,e){return t.composing?!0:jn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const R4=ds?5e3:-1;Wn.compositionstart=Wn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof _e&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||_n&&nO&&N4(t)))t.markCursor=t.state.storedMarks||n.marks(),Kh(t,!0),t.markCursor=null;else if(Kh(t,!e.selection.empty),Wr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let l=s<0?i.lastChild:i.childNodes[s-1];if(!l)break;if(l.nodeType==3){let c=t.domSelection();c&&c.collapse(l,l.nodeValue.length);break}else i=l,s=-1}}t.input.composing=!0}TO(t,R4)};function N4(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"}Wn.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++,TO(t,20))};function TO(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Kh(t),e))}function AO(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=L4());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function z4(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=T3(e.focusNode,e.focusOffset),r=A3(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return r}}return n||r}function L4(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Kh(t,e=!1){if(!(ds&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),AO(t),e||t.docView&&t.docView.dirty){let n=Bx(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 j4(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 $u=ar&&oo<15||Ba&&D3<604;Kn.copy=Wn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=$u?null:n.clipboardData,l=r.content(),{dom:c,text:d}=Hx(t,l);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",d)):j4(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function I4(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function B4(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?Fu(t,r.value,null,i,e):Fu(t,r.textContent,r.innerHTML,i,e)},50)}function Fu(t,e,n,r,i){let s=bO(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",d=>d(t,i,s||ye.empty)))return!0;if(!s)return!1;let l=I4(s),c=l?t.state.tr.replaceSelectionWith(l,r):t.state.tr.replaceSelection(s);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function MO(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," "):""}Wn.paste=(t,e)=>{let n=e;if(t.composing&&!ds)return;let r=$u?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Fu(t,MO(r),r.getData("text/html"),i,n)?n.preventDefault():B4(t,n)};class OO{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const U4=Pr?"altKey":"ctrlKey";function _O(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[U4]}Kn.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(rm(n)),l;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Te?i.to-1:i.to))){if(r&&r.mightDrag)l=Te.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(l=Te.create(t.state.doc,m.posBefore))}}let c=(l||t.state.selection).content(),{dom:d,text:f,slice:p}=Hx(t,c);(!n.dataTransfer.files.length||!_n||tO>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData($u?"Text":"text/html",d.innerHTML),n.dataTransfer.effectAllowed="copyMove",$u||n.dataTransfer.setData("text/plain",f),t.dragging=new OO(p,_O(t,n),l)};Kn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Wn.dragover=Wn.dragenter=(t,e)=>e.preventDefault();Wn.drop=(t,e)=>{try{H4(t,e,t.dragging)}finally{t.dragging=null}};function H4(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(rm(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=bO(t,MO(e.dataTransfer),$u?null:e.dataTransfer.getData("text/html"),!1,i);let l=!!(n&&_O(t,e));if(t.someProp("handleDrop",b=>b(t,e,s||ye.empty,l))){e.preventDefault();return}if(!s)return;e.preventDefault();let c=s?YM(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let d=t.state.tr;if(l){let{node:b}=n;b?b.replace(d):d.deleteSelection()}let f=d.mapping.map(c),p=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=d.doc;if(p?d.replaceRangeWith(f,f,s.content.firstChild):d.replaceRange(f,f,s),d.doc.eq(m))return;let g=d.doc.resolve(f);if(p&&Te.isSelectable(s.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(s.content.firstChild))d.setSelection(new Te(g));else{let b=d.mapping.map(c);d.mapping.maps[d.mapping.maps.length-1].forEach((v,w,C,E)=>b=E),d.setSelection(Ux(t,g,d.doc.resolve(b)))}t.focus(),t.dispatch(d.setMeta("uiEvent","drop"))}Kn.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())&&hs(t)},20))};Kn.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)};Kn.beforeinput=(t,e)=>{if(_n&&ds&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Vo(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Wn)Kn[t]=Wn[t];function qu(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 Wh{constructor(e,n){this.toDOM=e,this.spec=n||Jo,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:l}=e.mapResult(n.from+i,this.side<0?-1:1);return l?null:new Pt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Wh&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&qu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ao{constructor(e,n){this.attrs=e,this.spec=n||Jo}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,l=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=l?null:new Pt(s,l,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof ao&&qu(this.attrs,e.attrs)&&qu(this.spec,e.spec)}static is(e){return e.type instanceof ao}destroy(){}}class Fx{constructor(e,n){this.attrs=e,this.spec=n||Jo}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let l=e.mapResult(n.to+i,-1);return l.deleted||l.pos<=s.pos?null:new Pt(s.pos-r,l.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Fx&&qu(this.attrs,e.attrs)&&qu(this.spec,e.spec)}destroy(){}}class Pt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Pt(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 Pt(e,e,new Wh(n,r))}static inline(e,n,r,i){return new Pt(e,n,new ao(r,i))}static node(e,n,r,i){return new Pt(e,n,new Fx(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ao}get widget(){return this.type instanceof Wh}}const ha=[],Jo={};class ut{constructor(e,n){this.local=e.length?e:ha,this.children=n.length?n:ha}static create(e,n){return n.length?Gh(n,e,0,Jo):Nn}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let l=0;l<this.local.length;l++){let c=this.local[l];c.from<=n&&c.to>=e&&(!s||s(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<n&&this.children[l+1]>e){let c=this.children[l]+1;this.children[l+2].findInner(e-c,n-c,r,i+c,s)}}map(e,n,r){return this==Nn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Jo)}mapInner(e,n,r,i,s){let l;for(let c=0;c<this.local.length;c++){let d=this.local[c].map(e,r,i);d&&d.type.valid(n,d)?(l||(l=[])).push(d):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?V4(this.children,l||[],e,n,r,i,s):l?new ut(l.sort(Xo),ha):Nn}add(e,n){return n.length?this==Nn?ut.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((c,d)=>{let f=d+r,p;if(p=RO(n,c,f)){for(i||(i=this.children.slice());s<i.length&&i[s]<d;)s+=3;i[s]==d?i[s+2]=i[s+2].addInner(c,p,f+1):i.splice(s,0,d,d+c.nodeSize,Gh(p,c,f+1,Jo)),s+=3}});let l=DO(s?NO(n):n,-r);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||l.splice(c--,1);return new ut(l.length?this.local.concat(l).sort(Xo):this.local,i||this.children)}remove(e){return e.length==0||this==Nn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let l,c=r[s]+n,d=r[s+1]+n;for(let p=0,m;p<e.length;p++)(m=e[p])&&m.from>c&&m.to<d&&(e[p]=null,(l||(l=[])).push(m));if(!l)continue;r==this.children&&(r=this.children.slice());let f=r[s+2].removeInner(l,c+1);f!=Nn?r[s+2]=f:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,l;s<e.length;s++)if(l=e[s])for(let c=0;c<i.length;c++)i[c].eq(l,n)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ut(i,r):Nn}forChild(e,n){if(this==Nn)return this;if(n.isLeaf)return ut.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=e){this.children[c]==e&&(r=this.children[c+2]);break}let s=e+1,l=s+n.content.size;for(let c=0;c<this.local.length;c++){let d=this.local[c];if(d.from<l&&d.to>s&&d.type instanceof ao){let f=Math.max(s,d.from)-s,p=Math.min(l,d.to)-s;f<p&&(i||(i=[])).push(d.copy(f,p))}}if(i){let c=new ut(i.sort(Xo),ha);return r?new Zs([c,r]):c}return r||Nn}eq(e){if(this==e)return!0;if(!(e instanceof ut)||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 qx(this.localsInner(e))}localsInner(e){if(this==Nn)return ha;if(e.inlineContent||!this.local.some(ao.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ao||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ut.empty=new ut([],[]);ut.removeOverlap=qx;const Nn=ut.empty;class Zs{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Jo));return Zs.from(r)}forChild(e,n){if(n.isLeaf)return ut.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Nn&&(s instanceof Zs?r=r.concat(s.members):r.push(s))}return Zs.from(r)}eq(e){if(!(e instanceof Zs)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let l=0;l<s.length;l++)n.push(s[l])}}return n?qx(r?n:n.sort(Xo)):ha}static from(e){switch(e.length){case 0:return Nn;case 1:return e[0];default:return new Zs(e.every(n=>n instanceof ut)?e:e.reduce((n,r)=>n.concat(r instanceof ut?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function V4(t,e,n,r,i,s,l){let c=t.slice();for(let f=0,p=s;f<n.maps.length;f++){let m=0;n.maps[f].forEach((g,b,v,w)=>{let C=w-v-(b-g);for(let E=0;E<c.length;E+=3){let I=c[E+1];if(I<0||g>I+p-m)continue;let j=c[E]+p-m;b>=j?c[E+1]=g<=j?-2:-1:g>=p&&C&&(c[E]+=C,c[E+1]+=C)}m+=C}),p=n.maps[f].map(p,-1)}let d=!1;for(let f=0;f<c.length;f+=3)if(c[f+1]<0){if(c[f+1]==-2){d=!0,c[f+1]=-1;continue}let p=n.map(t[f]+s),m=p-i;if(m<0||m>=r.content.size){d=!0;continue}let g=n.map(t[f+1]+s,-1),b=g-i,{index:v,offset:w}=r.content.findIndex(m),C=r.maybeChild(v);if(C&&w==m&&w+C.nodeSize==b){let E=c[f+2].mapInner(n,C,p+1,t[f]+s+1,l);E!=Nn?(c[f]=m,c[f+1]=b,c[f+2]=E):(c[f+1]=-2,d=!0)}else d=!0}if(d){let f=P4(c,t,e,n,i,s,l),p=Gh(f,r,0,l);e=p.local;for(let m=0;m<c.length;m+=3)c[m+1]<0&&(c.splice(m,3),m-=3);for(let m=0,g=0;m<p.children.length;m+=3){let b=p.children[m];for(;g<c.length&&c[g]<b;)g+=3;c.splice(g,0,p.children[m],p.children[m+1],p.children[m+2])}}return new ut(e.sort(Xo),c)}function DO(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 Pt(i.from+e,i.to+e,i.type))}return n}function P4(t,e,n,r,i,s,l){function c(d,f){for(let p=0;p<d.local.length;p++){let m=d.local[p].map(r,i,f);m?n.push(m):l.onRemove&&l.onRemove(d.local[p].spec)}for(let p=0;p<d.children.length;p+=3)c(d.children[p+2],d.children[p]+f+1)}for(let d=0;d<t.length;d+=3)t[d+1]==-1&&c(t[d+2],e[d]+s+1);return n}function RO(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,l;s<t.length;s++)(l=t[s])&&l.from>n&&l.to<r&&((i||(i=[])).push(l),t[s]=null);return i}function NO(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Gh(t,e,n,r){let i=[],s=!1;e.forEach((c,d)=>{let f=RO(t,c,d+n);if(f){s=!0;let p=Gh(f,c,n+d+1,r);p!=Nn&&i.push(d,d+c.nodeSize,p)}});let l=DO(s?NO(t):t,-n).sort(Xo);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||(r.onRemove&&r.onRemove(l[c].spec),l.splice(c--,1));return l.length||i.length?new ut(l,i):Nn}function Xo(t,e){return t.from-e.from||t.to-e.to}function qx(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),OE(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),OE(e,i,r.copy(s.from,r.to)));break}}}return e}function OE(t,e,n){for(;e<t.length&&Xo(n,t[e])>0;)e++;t.splice(e,0,n)}function o0(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Nn&&e.push(r)}),t.cursorWrapper&&e.push(ut.create(t.state.doc,[t.cursorWrapper.deco])),Zs.from(e)}const $4={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},F4=ar&&oo<=11;class q4{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 Y4{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new q4,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]);ar&&oo<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():jn&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),F4&&(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,$4)),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(SE(this.view)){if(this.suppressingSelectionUpdates)return hs(this.view);if(ar&&oo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ol(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=Ia(s))n.add(s);for(let s=e.anchorNode;s;s=Ia(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)&&SE(e)&&!this.ignoreSelectionChange(r),s=-1,l=-1,c=!1,d=[];if(e.editable)for(let p=0;p<n.length;p++){let m=this.registerMutation(n[p],d);m&&(s=s<0?m.from:Math.min(m.from,s),l=l<0?m.to:Math.max(m.to,l),m.typeOver&&(c=!0))}if(d.some(p=>p.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let p of d)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(Wr&&d.length){let p=d.filter(m=>m.nodeName=="BR");if(p.length==2){let[m,g]=p;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of p){let b=g.parentNode;b&&b.nodeName=="LI"&&(!m||G4(e,m)!=b)&&g.remove()}}}let f=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&tm(r)&&(f=Bx(e))&&f.eq(ze.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,hs(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,l),K4(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Z4(e,d)),this.handleDOMChange(s,l,c,d),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||hs(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(ar&&oo<=11&&e.addedNodes.length)for(let p=0;p<e.addedNodes.length;p++){let{previousSibling:m,nextSibling:g}=e.addedNodes[p];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(i=m),(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(s=g)}let l=i&&i.parentNode==e.target?Mn(i)+1:0,c=r.localPosFromDOM(e.target,l,-1),d=s&&s.parentNode==e.target?Mn(s):e.target.childNodes.length,f=r.localPosFromDOM(e.target,d,1);return{from:c,to:f}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let _E=new WeakMap,DE=!1;function K4(t){if(!_E.has(t)&&(_E.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Wr,DE)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."),DE=!0}}function RE(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return ol(l.node,l.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function W4(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return RE(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?RE(t,n):null}function G4(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 Z4(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let l=s.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let c=l;for(;;){let d=c.firstChild;if(!d||d.nodeType!=1||d.contentEditable=="false"||/^(BR|IMG)$/.test(d.nodeName))break;c=d}c.insertBefore(s,c.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function J4(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:l,to:c}=t.docView.parseRange(e,n),d=t.domSelectionRange(),f,p=d.anchorNode;if(p&&t.dom.contains(p.nodeType==1?p:p.parentNode)&&(f=[{node:p,offset:d.anchorOffset}],tm(d)||f.push({node:d.focusNode,offset:d.focusOffset})),_n&&t.input.lastKeyCode===8)for(let C=s;C>i;C--){let E=r.childNodes[C-1],I=E.pmViewDesc;if(E.nodeName=="BR"&&!I){s=C;break}if(!I||I.size)break}let m=t.state.doc,g=t.someProp("domParser")||pu.fromSchema(t.state.schema),b=m.resolve(l),v=null,w=g.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:i,to:s,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:f,ruleFromNode:X4,context:b});if(f&&f[0].pos!=null){let C=f[0].pos,E=f[1]&&f[1].pos;E==null&&(E=C),v={anchor:C+l,head:E+l}}return{doc:w,sel:v,from:l,to:c}}function X4(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(jn&&/^(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||jn&&/^(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 Q4=/^(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 ej(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let N=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,Z=Bx(t,N);if(Z&&!t.state.selection.eq(Z)){if(_n&&ds&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",ce=>ce(t,Vo(13,"Enter"))))return;let Y=t.state.tr.setSelection(Z);N=="pointer"?Y.setMeta("pointer",!0):N=="key"&&Y.scrollIntoView(),s&&Y.setMeta("composition",s),t.dispatch(Y)}return}let l=t.state.doc.resolve(e),c=l.sharedDepth(n);e=l.before(c+1),n=t.state.doc.resolve(n).after(c+1);let d=t.state.selection,f=J4(t,e,n),p=t.state.doc,m=p.slice(f.from,f.to),g,b;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(g=t.state.selection.to,b="end"):(g=t.state.selection.from,b="start"),t.input.lastKeyCode=null;let v=rj(m.content,f.doc.content,f.from,g,b);if(v&&t.input.domChangeCount++,(Ba&&t.input.lastIOSEnter>Date.now()-225||ds)&&i.some(N=>N.nodeType==1&&!Q4.test(N.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",N=>N(t,Vo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&d instanceof _e&&!d.empty&&d.$head.sameParent(d.$anchor)&&!t.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))v={start:d.from,endA:d.to,endB:d.to};else{if(f.sel){let N=NE(t,t.state.doc,f.sel);if(N&&!N.eq(t.state.selection)){let Z=t.state.tr.setSelection(N);s&&Z.setMeta("composition",s),t.dispatch(Z)}}return}t.state.selection.from<t.state.selection.to&&v.start==v.endB&&t.state.selection instanceof _e&&(v.start>t.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=f.from?v.start=t.state.selection.from:v.endA<t.state.selection.to&&v.endA>=t.state.selection.to-2&&t.state.selection.to<=f.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),ar&&oo<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>f.from&&f.doc.textBetween(v.start-f.from-1,v.start-f.from+1)==" "&&(v.start--,v.endA--,v.endB--);let w=f.doc.resolveNoCache(v.start-f.from),C=f.doc.resolveNoCache(v.endB-f.from),E=p.resolve(v.start),I=w.sameParent(C)&&w.parent.inlineContent&&E.end()>=v.endA;if((Ba&&t.input.lastIOSEnter>Date.now()-225&&(!I||i.some(N=>N.nodeName=="DIV"||N.nodeName=="P"))||!I&&w.pos<f.doc.content.size&&(!w.sameParent(C)||!w.parent.inlineContent)&&w.pos<C.pos&&!/\S/.test(f.doc.textBetween(w.pos,C.pos,"","")))&&t.someProp("handleKeyDown",N=>N(t,Vo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&nj(p,v.start,v.endA,w,C)&&t.someProp("handleKeyDown",N=>N(t,Vo(8,"Backspace")))){ds&&_n&&t.domObserver.suppressSelectionUpdates();return}_n&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),ds&&!I&&w.start()!=C.start()&&C.parentOffset==0&&w.depth==C.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==v.endA&&(v.endB-=2,C=f.doc.resolveNoCache(v.endB-f.from),setTimeout(()=>{t.someProp("handleKeyDown",function(N){return N(t,Vo(13,"Enter"))})},20));let j=v.start,Q=v.endA,V=N=>{let Z=N||t.state.tr.replace(j,Q,f.doc.slice(v.start-f.from,v.endB-f.from));if(f.sel){let Y=NE(t,Z.doc,f.sel);Y&&!(_n&&t.composing&&Y.empty&&(v.start!=v.endB||t.input.lastChromeDelete<Date.now()-100)&&(Y.head==j||Y.head==Z.mapping.map(Q)-1)||ar&&Y.empty&&Y.head==j)&&Z.setSelection(Y)}return s&&Z.setMeta("composition",s),Z.scrollIntoView()},_;if(I)if(w.pos==C.pos){ar&&oo<=11&&w.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>hs(t),20));let N=V(t.state.tr.delete(j,Q)),Z=p.resolve(v.start).marksAcross(p.resolve(v.endA));Z&&N.ensureMarks(Z),t.dispatch(N)}else if(v.endA==v.endB&&(_=tj(w.parent.content.cut(w.parentOffset,C.parentOffset),E.parent.content.cut(E.parentOffset,v.endA-E.start())))){let N=V(t.state.tr);_.type=="add"?N.addMark(j,Q,_.mark):N.removeMark(j,Q,_.mark),t.dispatch(N)}else if(w.parent.child(w.index()).isText&&w.index()==C.index()-(C.textOffset?0:1)){let N=w.parent.textBetween(w.parentOffset,C.parentOffset),Z=()=>V(t.state.tr.insertText(N,j,Q));t.someProp("handleTextInput",Y=>Y(t,j,Q,N,Z))||t.dispatch(Z())}else t.dispatch(V());else t.dispatch(V())}function NE(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Ux(t,e.resolve(n.anchor),e.resolve(n.head))}function tj(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,l,c,d;for(let p=0;p<r.length;p++)i=r[p].removeFromSet(i);for(let p=0;p<n.length;p++)s=n[p].removeFromSet(s);if(i.length==1&&s.length==0)c=i[0],l="add",d=p=>p.mark(c.addToSet(p.marks));else if(i.length==0&&s.length==1)c=s[0],l="remove",d=p=>p.mark(c.removeFromSet(p.marks));else return null;let f=[];for(let p=0;p<e.childCount;p++)f.push(d(e.child(p)));if(ne.from(f).eq(t))return{mark:c,type:l}}function nj(t,e,n,r,i){if(n-e<=i.pos-r.pos||l0(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let c=s.nodeAfter;return c!=null&&n==e+c.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=t.resolve(l0(s,!0,!0));return!l.parent.isTextblock||l.pos>n||l0(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function l0(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 rj(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:l,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let d=Math.max(0,s-Math.min(l,c));r-=l+d-s}if(l<s&&t.size<e.size){let d=r<=s&&r>=l?s-r:0;s-=d,s&&s<e.size&&zE(e.textBetween(s-1,s+1))&&(s+=d?1:-1),c=s+(c-l),l=s}else if(c<s){let d=r<=s&&r>=c?s-r:0;s-=d,s&&s<t.size&&zE(t.textBetween(s-1,s+1))&&(s+=d?1:-1),l=s+(l-c),c=s}return{start:s,endA:l,endB:c}}function zE(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 zO{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 x4,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(UE),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=IE(this),jE(this),this.nodeViews=BE(this),this.docView=mE(this.state.doc,LE(this),o0(this),this.dom,this),this.domObserver=new Y4(this,(r,i,s,l)=>ej(this,r,i,s,l)),this.domObserver.start(),v4(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&&Ab(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(UE),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,l=!1;e.storedMarks&&this.composing&&(AO(this),l=!0),this.state=e;let c=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let b=BE(this);sj(b,this.nodeViews)&&(this.nodeViews=b,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Ab(this),this.editable=IE(this),jE(this);let d=o0(this),f=LE(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,f,d);(m||!e.selection.eq(i.selection))&&(l=!0);let g=p=="preserve"&&l&&this.dom.style.overflowAnchor==null&&z3(this);if(l){this.domObserver.stop();let b=m&&(ar||_n)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&ij(i.selection,e.selection);if(m){let v=_n?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=z4(this)),(s||!this.docView.update(e.doc,f,d,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=mE(e.doc,f,d,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&i4(this))?hs(this,b):(mO(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():g&&L3(g)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Te){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&cE(this,n.getBoundingClientRect(),e)}else cE(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 OO(e.slice,e.move,i<0?void 0:Te.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let l=0;l<this.directPlugins.length;l++){let c=this.directPlugins[l].props[e];if(c!=null&&(i=n?n(c):c))return i}let s=this.state.plugins;if(s)for(let l=0;l<s.length;l++){let c=s[l].props[e];if(c!=null&&(i=n?n(c):c))return i}}hasFocus(){if(ar){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&&j3(this.dom),hs(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 V3(this,e)}coordsAtPos(e,n=1){return lO(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 Y3(this,n||this.state,e)}pasteHTML(e,n){return Fu(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Fu(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Hx(this,e)}destroy(){this.docView&&(S4(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],o0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,C3())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return k4(this,e)}domSelectionRange(){let e=this.domSelection();return e?jn&&this.root.nodeType===11&&O3(this.dom.ownerDocument)==this.dom&&W4(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}zO.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function LE(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"),[Pt.node(0,t.state.doc.content.size,e)]}function jE(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:Pt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function IE(t){return!t.someProp("editable",e=>e(t.state)===!1)}function ij(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 BE(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 sj(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 UE(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var fo={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Zh={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},oj=typeof navigator<"u"&&/Mac/.test(navigator.platform),lj=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var On=0;On<10;On++)fo[48+On]=fo[96+On]=String(On);for(var On=1;On<=24;On++)fo[On+111]="F"+On;for(var On=65;On<=90;On++)fo[On]=String.fromCharCode(On+32),Zh[On]=String.fromCharCode(On);for(var a0 in fo)Zh.hasOwnProperty(a0)||(Zh[a0]=fo[a0]);function aj(t){var e=oj&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||lj&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Zh:fo)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const cj=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),uj=typeof navigator<"u"&&/Win/.test(navigator.platform);function dj(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<e.length-1;c++){let d=e[c];if(/^(cmd|meta|m)$/i.test(d))l=!0;else if(/^a(lt)?$/i.test(d))r=!0;else if(/^(c|ctrl|control)$/i.test(d))i=!0;else if(/^s(hift)?$/i.test(d))s=!0;else if(/^mod$/i.test(d))cj?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+d)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),l&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function fj(t){let e=Object.create(null);for(let n in t)e[dj(n)]=t[n];return e}function c0(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 hj(t){return new xt({props:{handleKeyDown:Yx(t)}})}function Yx(t){let e=fj(t);return function(n,r){let i=aj(r),s,l=e[c0(i,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[c0(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(uj&&r.ctrlKey&&r.altKey)&&(s=fo[r.keyCode])&&s!=i){let c=e[c0(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}const Kx=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function LO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const jO=(t,e,n)=>{let r=LO(t,n);if(!r)return!1;let i=Wx(r);if(!i){let l=r.blockRange(),c=l&&Za(l);return c==null?!1:(e&&e(t.tr.lift(l,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(qO(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Ua(s,"end")||Te.isSelectable(s)))for(let l=r.depth;;l--){let c=Qp(t.doc,r.before(l),r.after(l),ye.empty);if(c&&c.slice.size<c.to-c.from){if(e){let d=t.tr.step(c);d.setSelection(Ua(s,"end")?ze.findFrom(d.doc.resolve(d.mapping.map(i.pos,-1)),-1):Te.create(d.doc,i.pos-s.nodeSize)),e(d.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},pj=(t,e,n)=>{let r=LO(t,n);if(!r)return!1;let i=Wx(r);return i?IO(t,i,e):!1},mj=(t,e,n)=>{let r=UO(t,n);if(!r)return!1;let i=Gx(r);return i?IO(t,i,e):!1};function IO(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let p=i.lastChild;if(!p)return!1;i=p}let l=e.nodeAfter,c=l,d=e.pos+1;for(;!c.isTextblock;d++){if(c.type.spec.isolating)return!1;let p=c.firstChild;if(!p)return!1;c=p}let f=Qp(t.doc,s,d,ye.empty);if(!f||f.from!=s||f instanceof pn&&f.slice.size>=d-s)return!1;if(n){let p=t.tr.step(f);p.setSelection(_e.create(p.doc,s)),n(p.scrollIntoView())}return!0}function Ua(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 BO=(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=Wx(r)}let l=s&&s.nodeBefore;return!l||!Te.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Te.create(t.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function Wx(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 UO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const HO=(t,e,n)=>{let r=UO(t,n);if(!r)return!1;let i=Gx(r);if(!i)return!1;let s=i.nodeAfter;if(qO(t,i,e,1))return!0;if(r.parent.content.size==0&&(Ua(s,"start")||Te.isSelectable(s))){let l=Qp(t.doc,r.before(),r.after(),ye.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(Ua(s,"start")?ze.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Te.create(c.doc,c.mapping.map(i.pos))),e(c.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},VO=(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=Gx(r)}let l=s&&s.nodeAfter;return!l||!Te.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Te.create(t.doc,s.pos)).scrollIntoView()),!0)};function Gx(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 gj=(t,e)=>{let n=t.selection,r=n instanceof Te,i;if(r){if(n.node.isTextblock||!yo(t.doc,n.from))return!1;i=n.from}else if(i=Xp(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(Te.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},yj=(t,e)=>{let n=t.selection,r;if(n instanceof Te){if(n.node.isTextblock||!yo(t.doc,n.to))return!1;r=n.to}else if(r=Xp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},bj=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&Za(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},PO=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
69
|
+
`).scrollIntoView()),!0)};function Zx(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 xj=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),l=Zx(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(e){let c=n.after(),d=t.tr.replaceWith(c,c,l.createAndFill());d.setSelection(ze.near(d.doc.resolve(c),1)),e(d.scrollIntoView())}return!0},$O=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof lr||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Zx(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let l=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,c=t.tr.insert(l,s.createAndFill());c.setSelection(_e.create(c.doc,l+1)),e(c.scrollIntoView())}return!0},FO=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(fs(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Za(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function vj(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Te&&e.selection.node.isBlock)return!r.parentOffset||!fs(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,c,d=!1,f=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){d=r.end(b)==r.pos+(r.depth-b),f=r.start(b)==r.pos-(r.depth-b),c=Zx(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),s.unshift(d&&c?{type:c}:null),l=b;break}else{if(b==1)return!1;s.unshift(null)}let p=e.tr;(e.selection instanceof _e||e.selection instanceof lr)&&p.deleteSelection();let m=p.mapping.map(r.pos),g=fs(p.doc,m,s.length,s);if(g||(s[0]=c?{type:c}:null,g=fs(p.doc,m,s.length,s)),!g)return!1;if(p.split(m,s.length,s),!d&&f&&r.node(l).type!=c){let b=p.mapping.map(r.before(l)),v=p.doc.resolve(b);c&&r.node(l-1).canReplaceWith(v.index(),v.index()+1,c)&&p.setNodeMarkup(p.mapping.map(r.before(l)),c)}return n&&n(p.scrollIntoView()),!0}}const Sj=vj(),wj=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(Te.create(t.doc,i))),!0)};function kj(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||yo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function qO(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,l,c,d=i.type.spec.isolating||s.type.spec.isolating;if(!d&&kj(t,e,n))return!0;let f=!d&&e.parent.canReplace(e.index(),e.index()+1);if(f&&(l=(c=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&c.matchType(l[0]||s.type).validEnd){if(n){let b=e.pos+s.nodeSize,v=ne.empty;for(let E=l.length-1;E>=0;E--)v=ne.from(l[E].create(null,v));v=ne.from(i.copy(v));let w=t.tr.step(new mn(e.pos-1,b,e.pos,b,new ye(v,1,0),l.length,!0)),C=w.doc.resolve(b+2*l.length);C.nodeAfter&&C.nodeAfter.type==i.type&&yo(w.doc,C.pos)&&w.join(C.pos),n(w.scrollIntoView())}return!0}let p=s.type.spec.isolating||r>0&&d?null:ze.findFrom(e,1),m=p&&p.$from.blockRange(p.$to),g=m&&Za(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(f&&Ua(s,"start",!0)&&Ua(i,"end")){let b=i,v=[];for(;v.push(b),!b.isTextblock;)b=b.lastChild;let w=s,C=1;for(;!w.isTextblock;w=w.firstChild)C++;if(b.canReplace(b.childCount,b.childCount,w.content)){if(n){let E=ne.empty;for(let j=v.length-1;j>=0;j--)E=ne.from(v[j].copy(E));let I=t.tr.step(new mn(e.pos-v.length,e.pos+s.nodeSize,e.pos+C,e.pos+s.nodeSize-C,new ye(E,v.length,0),0,!0));n(I.scrollIntoView())}return!0}}return!1}function YO(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(_e.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const Cj=YO(-1),Ej=YO(1);function Tj(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s),c=l&&zx(l,t,e);return c?(r&&r(n.tr.wrap(l,c).scrollIntoView()),!0):!1}}function HE(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];n.doc.nodesBetween(l,c,(d,f)=>{if(i)return!1;if(!(!d.isTextblock||d.hasMarkup(t,e)))if(d.type==t)i=!0;else{let p=n.doc.resolve(f),m=p.index();i=p.parent.canReplaceWith(m,m+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let l=0;l<n.selection.ranges.length;l++){let{$from:{pos:c},$to:{pos:d}}=n.selection.ranges[l];s.setBlockType(c,d,t,e)}r(s.scrollIntoView())}return!0}}function Jx(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Jx(Kx,jO,BO);Jx(Kx,HO,VO);Jx(PO,$O,FO,Sj);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Aj(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s);if(!l)return!1;let c=r?n.tr:null;return Mj(c,l,t,e)?(r&&r(c.scrollIntoView()),!0):!1}}function Mj(t,e,n,r=null){let i=!1,s=e,l=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let d=l.resolve(e.start-2);s=new $h(d,d,e.depth),e.endIndex<e.parent.childCount&&(e=new $h(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=zx(s,n,r,e);return c?(t&&Oj(t,e,c,i,n),!0):!1}function Oj(t,e,n,r,i){let s=ne.empty;for(let p=n.length-1;p>=0;p--)s=ne.from(n[p].type.create(n[p].attrs,s));t.step(new mn(e.start-(r?2:0),e.end,e.start,e.end,new ye(s,0,0),n.length,!0));let l=0;for(let p=0;p<n.length;p++)n[p].type==i&&(l=p+1);let c=n.length-l,d=e.start+n.length-(r?2:0),f=e.parent;for(let p=e.startIndex,m=e.endIndex,g=!0;p<m;p++,g=!1)!g&&fs(t.doc,d,c)&&(t.split(d,c),d+=2*c),d+=f.child(p).nodeSize;return t}function _j(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?Dj(e,n,t,s):Rj(e,n,s):!0:!1}}function Dj(t,e,n,r){let i=t.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(i.step(new mn(s-1,l,s,l,new ye(ne.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new $h(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=Za(r);if(c==null)return!1;i.lift(r,c);let d=i.doc.resolve(i.mapping.map(s,-1)-1);return yo(i.doc,d.pos)&&d.nodeBefore.type==d.nodeAfter.type&&i.join(d.pos),e(i.scrollIntoView()),!0}function Rj(t,e,n){let r=t.tr,i=n.parent;for(let b=n.end,v=n.endIndex-1,w=n.startIndex;v>w;v--)b-=i.child(v).nodeSize,r.delete(b-1,b+1);let s=r.doc.resolve(n.start),l=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,d=n.endIndex==i.childCount,f=s.node(-1),p=s.index(-1);if(!f.canReplace(p+(c?0:1),p+1,l.content.append(d?ne.empty:ne.from(i))))return!1;let m=s.pos,g=m+l.nodeSize;return r.step(new mn(m-(c?1:0),g+(d?1:0),m+1,g-1,new ye((c?ne.empty:ne.from(i.copy(ne.empty))).append(d?ne.empty:ne.from(i.copy(ne.empty))),c?0:1,d?0:1),c?0:1)),e(r.scrollIntoView()),!0}function Nj(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,f=>f.childCount>0&&f.firstChild.type==t);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let c=s.parent,d=c.child(l-1);if(d.type!=t)return!1;if(n){let f=d.lastChild&&d.lastChild.type==c.type,p=ne.from(f?t.create():null),m=new ye(ne.from(t.create(null,ne.from(c.type.create(null,p)))),f?3:1,0),g=s.start,b=s.end;n(e.tr.step(new mn(g-(f?3:1),b,g,b,m,1,!0)).scrollIntoView())}return!0}}function im(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 sm{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,l=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([c,d])=>[c,(...p)=>{const m=d(...p)(l);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),m}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c=[],d=!!e,f=e||s.tr,p=()=>(!d&&n&&!f.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(f),c.every(g=>g===!0)),m={...Object.fromEntries(Object.entries(r).map(([g,b])=>[g,(...w)=>{const C=this.buildProps(f,n),E=b(...w)(C);return c.push(E),m}])),run:p};return m}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,l=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>f(...p)({...l,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c={tr:e,editor:i,view:l,state:im({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(([d,f])=>[d,(...p)=>f(...p)(c)]))}};return c}}let zj=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}};function Se(t,e,n){return t.config[e]===void 0&&t.parent?Se(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Se(t.parent,e,n):null}):t.config[e]}function om(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 KO(t){const e=[],{nodeExtensions:n,markExtensions:r}=om(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(l=>{const c={name:l.name,options:l.options,storage:l.storage,extensions:i},d=Se(l,"addGlobalAttributes",c);if(!d)return;d().forEach(p=>{p.types.forEach(m=>{Object.entries(p.attributes).forEach(([g,b])=>{e.push({type:m,name:g,attribute:{...s,...b}})})})})}),i.forEach(l=>{const c={name:l.name,options:l.options,storage:l.storage},d=Se(l,"addAttributes",c);if(!d)return;const f=d();Object.entries(f).forEach(([p,m])=>{const g={...s,...m};typeof(g==null?void 0:g.default)=="function"&&(g.default=g.default()),g!=null&&g.isRequired&&(g==null?void 0:g.default)===void 0&&delete g.default,e.push({type:l.name,name:p,attribute:g})})}),e}function bn(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 $t(...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(" "):[],d=r[i]?r[i].split(" "):[],f=c.filter(p=>!d.includes(p));r[i]=[...d,...f].join(" ")}else if(i==="style"){const c=s?s.split(";").map(p=>p.trim()).filter(Boolean):[],d=r[i]?r[i].split(";").map(p=>p.trim()).filter(Boolean):[],f=new Map;d.forEach(p=>{const[m,g]=p.split(":").map(b=>b.trim());f.set(m,g)}),c.forEach(p=>{const[m,g]=p.split(":").map(b=>b.trim());f.set(m,g)}),r[i]=Array.from(f.entries()).map(([p,m])=>`${p}: ${m}`).join("; ")}else r[i]=s}),r},{})}function Mb(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)=>$t(n,r),{})}function WO(t){return typeof t=="function"}function We(t,e=void 0,...n){return WO(t)?e?t.bind(e)(...n):t(...n):t}function Lj(t={}){return Object.keys(t).length===0&&t.constructor===Object}function jj(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function VE(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,l)=>{const c=l.attribute.parseHTML?l.attribute.parseHTML(n):jj(n.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...i}}}}function PE(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Lj(n)?!1:n!=null))}function Ij(t,e){var n;const r=KO(t),{nodeExtensions:i,markExtensions:s}=om(t),l=(n=i.find(f=>Se(f,"topNode")))===null||n===void 0?void 0:n.name,c=Object.fromEntries(i.map(f=>{const p=r.filter(E=>E.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((E,I)=>{const j=Se(I,"extendNodeSchema",m);return{...E,...j?j(f):{}}},{}),b=PE({...g,content:We(Se(f,"content",m)),marks:We(Se(f,"marks",m)),group:We(Se(f,"group",m)),inline:We(Se(f,"inline",m)),atom:We(Se(f,"atom",m)),selectable:We(Se(f,"selectable",m)),draggable:We(Se(f,"draggable",m)),code:We(Se(f,"code",m)),whitespace:We(Se(f,"whitespace",m)),linebreakReplacement:We(Se(f,"linebreakReplacement",m)),defining:We(Se(f,"defining",m)),isolating:We(Se(f,"isolating",m)),attrs:Object.fromEntries(p.map(E=>{var I;return[E.name,{default:(I=E==null?void 0:E.attribute)===null||I===void 0?void 0:I.default}]}))}),v=We(Se(f,"parseHTML",m));v&&(b.parseDOM=v.map(E=>VE(E,p)));const w=Se(f,"renderHTML",m);w&&(b.toDOM=E=>w({node:E,HTMLAttributes:Mb(E,p)}));const C=Se(f,"renderText",m);return C&&(b.toText=C),[f.name,b]})),d=Object.fromEntries(s.map(f=>{const p=r.filter(C=>C.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((C,E)=>{const I=Se(E,"extendMarkSchema",m);return{...C,...I?I(f):{}}},{}),b=PE({...g,inclusive:We(Se(f,"inclusive",m)),excludes:We(Se(f,"excludes",m)),group:We(Se(f,"group",m)),spanning:We(Se(f,"spanning",m)),code:We(Se(f,"code",m)),attrs:Object.fromEntries(p.map(C=>{var E;return[C.name,{default:(E=C==null?void 0:C.attribute)===null||E===void 0?void 0:E.default}]}))}),v=We(Se(f,"parseHTML",m));v&&(b.parseDOM=v.map(C=>VE(C,p)));const w=Se(f,"renderHTML",m);return w&&(b.toDOM=C=>w({mark:C,HTMLAttributes:Mb(C,p)})),[f.name,b]}));return new LM({topNode:l,nodes:c,marks:d})}function u0(t,e){return e.nodes[t]||e.marks[t]||null}function $E(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Xx(t,e){const n=gl.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const Bj=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,l,c)=>{var d,f;const p=((f=(d=i.type.spec).toText)===null||f===void 0?void 0:f.call(d,{node:i,pos:s,parent:l,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-s))}),n};function Qx(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class lm{constructor(e){this.find=e.find,this.handler=e.handler}}const Uj=(t,e)=>{if(Qx(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 Yf(t){var e;const{editor:n,from:r,to:i,text:s,rules:l,plugin:c}=t,{view:d}=n;if(d.composing)return!1;const f=d.state.doc.resolve(r);if(f.parent.type.spec.code||!((e=f.nodeBefore||f.nodeAfter)===null||e===void 0)&&e.marks.find(g=>g.type.spec.code))return!1;let p=!1;const m=Bj(f)+s;return l.forEach(g=>{if(p)return;const b=Uj(m,g.find);if(!b)return;const v=d.state.tr,w=im({state:d.state,transaction:v}),C={from:r-(b[0].length-s.length),to:i},{commands:E,chain:I,can:j}=new sm({editor:n,state:w});g.handler({state:w,range:C,match:b,commands:E,chain:I,can:j})===null||!v.steps.length||(v.setMeta(c,{transform:v,from:r,to:i,text:s}),d.dispatch(v),p=!0)}),p}function Hj(t){const{editor:e,rules:n}=t,r=new xt({state:{init(){return null},apply(i,s,l){const c=i.getMeta(r);if(c)return c;const d=i.getMeta("applyInputRules");return!!d&&setTimeout(()=>{let{text:p}=d;typeof p=="string"?p=p:p=Xx(ne.from(p),l.schema);const{from:m}=d,g=m+p.length;Yf({editor:e,from:m,to:g,text:p,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,l,c){return Yf({editor:e,from:s,to:l,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Yf({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:l}=i.state.selection;return l?Yf({editor:e,from:l.pos,to:l.pos,text:`
|
|
70
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Vj(t){return Object.prototype.toString.call(t).slice(8,-1)}function Kf(t){return Vj(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function am(t,e){const n={...t};return Kf(t)&&Kf(e)&&Object.keys(e).forEach(r=>{Kf(e[r])&&Kf(t[r])?n[r]=am(t[r],e[r]):n[r]=e[r]}),n}class _i{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=We(Se(this,"addOptions",{name:this.name}))),this.storage=We(Se(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new _i(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>am(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new _i(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=We(Se(n,"addOptions",{name:n.name})),n.storage=We(Se(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const l=i.marks();if(!!!l.find(f=>(f==null?void 0:f.type.name)===n.name))return!1;const d=l.find(f=>(f==null?void 0:f.type.name)===n.name);return d&&r.removeStoredMark(d),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function Pj(t){return typeof t=="number"}class $j{constructor(e){this.find=e.find,this.handler=e.handler}}const Fj=(t,e,n)=>{if(Qx(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 qj(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:l,dropEvent:c}=t,{commands:d,chain:f,can:p}=new sm({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(b,v)=>{if(!b.isTextblock||b.type.spec.code)return;const w=Math.max(r,v),C=Math.min(i,v+b.content.size),E=b.textBetween(w-v,C-v,void 0,"");Fj(E,s.find,l).forEach(j=>{if(j.index===void 0)return;const Q=w+j.index+1,V=Q+j[0].length,_={from:n.tr.mapping.map(Q),to:n.tr.mapping.map(V)},N=s.handler({state:n,range:_,match:j,commands:d,chain:f,can:p,pasteEvent:l,dropEvent:c});m.push(N)})}),m.every(b=>b!==null)}let Wf=null;const Yj=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 Kj(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const d=({state:p,from:m,to:g,rule:b,pasteEvt:v})=>{const w=p.tr,C=im({state:p,transaction:w});if(!(!qj({editor:e,state:C,from:Math.max(m-1,0),to:g.b-1,rule:b,pasteEvent:v,dropEvent:c})||!w.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,w}};return n.map(p=>new xt({view(m){const g=v=>{var w;r=!((w=m.dom.parentElement)===null||w===void 0)&&w.contains(v.target)?m.dom.parentElement:null,r&&(Wf=e)},b=()=>{Wf&&(Wf=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(s=r===m.dom.parentElement,c=g,!s){const b=Wf;b!=null&&b.isEditable&&setTimeout(()=>{const v=b.state.selection;v&&b.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,g)=>{var b;const v=(b=g.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return l=g,i=!!(v!=null&&v.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,b)=>{const v=m[0],w=v.getMeta("uiEvent")==="paste"&&!i,C=v.getMeta("uiEvent")==="drop"&&!s,E=v.getMeta("applyPasteRules"),I=!!E;if(!w&&!C&&!I)return;if(I){let{text:V}=E;typeof V=="string"?V=V:V=Xx(ne.from(V),b.schema);const{from:_}=E,N=_+V.length,Z=Yj(V);return d({rule:p,state:b,from:_,to:{b:N},pasteEvt:Z})}const j=g.doc.content.findDiffStart(b.doc.content),Q=g.doc.content.findDiffEnd(b.doc.content);if(!(!Pj(j)||!Q||j===Q.b))return d({rule:p,state:b,from:j,to:Q,pasteEvt:l})}}))}function Wj(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class ya{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=ya.resolve(e),this.schema=Ij(this.extensions,n),this.setupExtensions()}static resolve(e){const n=ya.sort(ya.flatten(e)),r=Wj(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=Se(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=Se(r,"priority")||100,l=Se(i,"priority")||100;return s>l?-1:s<l?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:u0(n.name,this.schema)},i=Se(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=ya.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(l=>{const c={name:l.name,options:l.options,storage:l.storage,editor:e,type:u0(l.name,this.schema)},d=[],f=Se(l,"addKeyboardShortcuts",c);let p={};if(l.type==="mark"&&Se(l,"exitable",c)&&(p.ArrowRight=()=>_i.handleExit({editor:e,mark:l})),f){const w=Object.fromEntries(Object.entries(f()).map(([C,E])=>[C,()=>E({editor:e})]));p={...p,...w}}const m=hj(p);d.push(m);const g=Se(l,"addInputRules",c);$E(l,e.options.enableInputRules)&&g&&r.push(...g());const b=Se(l,"addPasteRules",c);$E(l,e.options.enablePasteRules)&&b&&i.push(...b());const v=Se(l,"addProseMirrorPlugins",c);if(v){const w=v();d.push(...w)}return d}).flat();return[Hj({editor:e,rules:r}),...Kj({editor:e,rules:i}),...s]}get attributes(){return KO(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=om(this.extensions);return Object.fromEntries(n.filter(r=>!!Se(r,"addNodeView")).map(r=>{const i=this.attributes.filter(d=>d.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:bn(r.name,this.schema)},l=Se(r,"addNodeView",s);if(!l)return[];const c=(d,f,p,m,g)=>{const b=Mb(d,i);return l()({node:d,view:f,getPos:p,decorations:m,innerDecorations:g,editor:e,extension:r,HTMLAttributes:b})};return[r.name,c]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:u0(e.name,this.schema)};e.type==="mark"&&(!((n=We(Se(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=Se(e,"onBeforeCreate",r),s=Se(e,"onCreate",r),l=Se(e,"onUpdate",r),c=Se(e,"onSelectionUpdate",r),d=Se(e,"onTransaction",r),f=Se(e,"onFocus",r),p=Se(e,"onBlur",r),m=Se(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),l&&this.editor.on("update",l),c&&this.editor.on("selectionUpdate",c),d&&this.editor.on("transaction",d),f&&this.editor.on("focus",f),p&&this.editor.on("blur",p),m&&this.editor.on("destroy",m)})}}class Zt{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=We(Se(this,"addOptions",{name:this.name}))),this.storage=We(Se(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Zt(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>am(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Zt({...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=We(Se(n,"addOptions",{name:n.name})),n.storage=We(Se(n,"addStorage",{name:n.name,options:n.options})),n}}function GO(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
71
|
+
|
|
72
|
+
`,textSerializers:l={}}=n||{};let c="";return t.nodesBetween(r,i,(d,f,p,m)=>{var g;d.isBlock&&f>r&&(c+=s);const b=l==null?void 0:l[d.type.name];if(b)return p&&(c+=b({node:d,pos:f,parent:p,index:m,range:e})),!1;d.isText&&(c+=(g=d==null?void 0:d.text)===null||g===void 0?void 0:g.slice(Math.max(r,f)-f,i-f))}),c}function ZO(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const Gj=Zt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new xt({key:new Rt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,l=Math.min(...s.map(p=>p.$from.pos)),c=Math.max(...s.map(p=>p.$to.pos)),d=ZO(n);return GO(r,{from:l,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:d})}}})]}}),Zj=()=>({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),Jj=(t=!1)=>({commands:e})=>e.setContent("",t),Xj=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:l})=>{t.doc.nodesBetween(s.pos,l.pos,(c,d)=>{if(c.type.isText)return;const{doc:f,mapping:p}=e,m=f.resolve(p.map(d)),g=f.resolve(p.map(d+c.nodeSize)),b=m.blockRange(g);if(!b)return;const v=Za(b);if(c.type.isTextblock){const{defaultType:w}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,w)}(v||v===0)&&e.lift(b,v)})}),!0},Qj=t=>e=>t(e),eI=()=>({state:t,dispatch:e})=>$O(t,e),tI=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const l=r.mapping.map(e);return r.insert(l,s.content),r.setSelection(new _e(r.doc.resolve(Math.max(l-1,0)))),!0},nI=()=>({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),d=i.after(s);t.delete(c,d).scrollIntoView()}return!0}return!1},rI=t=>({tr:e,state:n,dispatch:r})=>{const i=bn(t,n.schema),s=e.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===i){if(r){const d=s.before(l),f=s.after(l);e.delete(d,f).scrollIntoView()}return!0}return!1},iI=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},sI=()=>({state:t,dispatch:e})=>Kx(t,e),oI=()=>({commands:t})=>t.keyboardShortcut("Enter"),lI=()=>({state:t,dispatch:e})=>xj(t,e);function Jh(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Qx(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function JO(t,e,n={}){return t.find(r=>r.type===e&&Jh(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function FE(t,e,n={}){return!!JO(t,e,n)}function e1(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),!JO([...i.node.marks],e,n)))return;let l=i.index,c=t.start()+i.offset,d=l+1,f=c+i.node.nodeSize;for(;l>0&&FE([...t.parent.child(l-1).marks],e,n);)l-=1,c-=t.parent.child(l).nodeSize;for(;d<t.parent.childCount&&FE([...t.parent.child(d).marks],e,n);)f+=t.parent.child(d).nodeSize,d+=1;return{from:c,to:f}}function xo(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const aI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=xo(t,r.schema),{doc:l,selection:c}=n,{$from:d,from:f,to:p}=c;if(i){const m=e1(d,s,e);if(m&&m.from<=f&&m.to>=p){const g=_e.create(l,m.from,m.to);n.setSelection(g)}}return!0},cI=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 XO(t){return t instanceof _e}function Ko(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function QO(t,e=null){if(!e)return null;const n=ze.atStart(t),r=ze.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?_e.create(t,Ko(0,i,s),Ko(t.content.size,i,s)):_e.create(t,Ko(e,i,s),Ko(e,i,s))}function qE(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Xh(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function uI(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const dI=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(Xh()||qE())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),uI()&&!Xh()&&!qE()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!XO(n.state.selection))return l(),!0;const c=QO(i.doc,t)||n.state.selection,d=n.state.selection.eq(c);return s&&(d||i.setSelection(c),d&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},fI=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),hI=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),e_=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&&e_(r)}return t};function Gf(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return e_(n)}function Yu(t,e,n){if(t instanceof so||t instanceof ne)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 ne.fromArray(t.map(c=>e.nodeFromJSON(c)));const l=e.nodeFromJSON(t);return n.errorOnInvalidContent&&l.check(),l}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Yu("",e,n)}if(i){if(n.errorOnInvalidContent){let l=!1,c="";const d=new LM({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:f=>(l=!0,c=typeof f=="string"?f:f.outerHTML,null)}]}})});if(n.slice?pu.fromSchema(d).parseSlice(Gf(t),n.parseOptions):pu.fromSchema(d).parse(Gf(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=pu.fromSchema(e);return n.slice?s.parseSlice(Gf(t),n.parseOptions).content:s.parse(Gf(t),n.parseOptions)}return Yu("",e,n)}function pI(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof pn||i instanceof mn))return;const s=t.mapping.maps[r];let l=0;s.forEach((c,d,f,p)=>{l===0&&(l=p)}),t.setSelection(ze.near(t.doc.resolve(l),n))}const mI=t=>!("type"in t),gI=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var l;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const d=C=>{s.emit("contentError",{editor:s,error:C,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},f={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Yu(e,s.schema,{parseOptions:f,errorOnInvalidContent:!0})}catch(C){d(C)}try{c=Yu(e,s.schema,{parseOptions:f,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:s.options.enableContentCheck})}catch(C){return d(C),!1}let{from:p,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,b=!0;if((mI(c)?c:[c]).forEach(C=>{C.check(),g=g?C.isText&&C.marks.length===0:!1,b=b?C.isBlock:!1}),p===m&&b){const{parent:C}=r.doc.resolve(p);C.isTextblock&&!C.type.spec.code&&!C.childCount&&(p-=1,m+=1)}let w;if(g){if(Array.isArray(e))w=e.map(C=>C.text||"").join("");else if(e instanceof ne){let C="";e.forEach(E=>{E.text&&(C+=E.text)}),w=C}else typeof e=="object"&&e&&e.text?w=e.text:w=e;r.insertText(w,p,m)}else w=c,r.replaceWith(p,m,w);n.updateSelection&&pI(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:w}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:w})}return!0},yI=()=>({state:t,dispatch:e})=>gj(t,e),bI=()=>({state:t,dispatch:e})=>yj(t,e),xI=()=>({state:t,dispatch:e})=>jO(t,e),vI=()=>({state:t,dispatch:e})=>HO(t,e),SI=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Xp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},wI=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Xp(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},kI=()=>({state:t,dispatch:e})=>pj(t,e),CI=()=>({state:t,dispatch:e})=>mj(t,e);function t_(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function EI(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<e.length-1;c+=1){const d=e[c];if(/^(cmd|meta|m)$/i.test(d))l=!0;else if(/^a(lt)?$/i.test(d))r=!0;else if(/^(c|ctrl|control)$/i.test(d))i=!0;else if(/^s(hift)?$/i.test(d))s=!0;else if(/^mod$/i.test(d))Xh()||t_()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${d}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const TI=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=EI(t).split(/-(?!$)/),l=s.find(f=>!["Alt","Ctrl","Meta","Shift"].includes(f)),c=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),d=e.captureTransaction(()=>{n.someProp("handleKeyDown",f=>f(n,c))});return d==null||d.steps.forEach(f=>{const p=f.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function Ku(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,l=e?bn(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(m,g)=>{if(m.isText)return;const b=Math.max(r,g),v=Math.min(i,g+m.nodeSize);c.push({node:m,from:b,to:v})});const d=i-r,f=c.filter(m=>l?l.name===m.node.type.name:!0).filter(m=>Jh(m.node.attrs,n,{strict:!1}));return s?!!f.length:f.reduce((m,g)=>m+g.to-g.from,0)>=d}const AI=(t,e={})=>({state:n,dispatch:r})=>{const i=bn(t,n.schema);return Ku(n,i,e)?bj(n,r):!1},MI=()=>({state:t,dispatch:e})=>FO(t,e),OI=t=>({state:e,dispatch:n})=>{const r=bn(t,e.schema);return _j(r)(e,n)},_I=()=>({state:t,dispatch:e})=>PO(t,e);function cm(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function YE(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 DI=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=cm(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=bn(t,r.schema)),c==="mark"&&(l=xo(t,r.schema)),i&&n.selection.ranges.forEach(d=>{r.doc.nodesBetween(d.$from.pos,d.$to.pos,(f,p)=>{s&&s===f.type&&n.setNodeMarkup(p,void 0,YE(f.attrs,e)),l&&f.marks.length&&f.marks.forEach(m=>{l===m.type&&n.addMark(p,p+f.nodeSize,l.create(YE(m.attrs,e)))})})}),!0):!1},RI=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),NI=()=>({tr:t,dispatch:e})=>{if(e){const n=new lr(t.doc);t.setSelection(n)}return!0},zI=()=>({state:t,dispatch:e})=>BO(t,e),LI=()=>({state:t,dispatch:e})=>VO(t,e),jI=()=>({state:t,dispatch:e})=>wj(t,e),II=()=>({state:t,dispatch:e})=>Ej(t,e),BI=()=>({state:t,dispatch:e})=>Cj(t,e);function Ob(t,e,n={},r={}){return Yu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const UI=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:l,commands:c})=>{var d,f;const{doc:p}=s;if(n.preserveWhitespace!=="full"){const m=Ob(t,i.schema,n,{errorOnInvalidContent:(d=r.errorOnInvalidContent)!==null&&d!==void 0?d:i.options.enableContentCheck});return l&&s.replaceWith(0,p.content.size,m).setMeta("preventUpdate",!e),!0}return l&&s.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:p.content.size},t,{parseOptions:n,errorOnInvalidContent:(f=r.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck})};function n_(t,e){const n=xo(e,t.schema),{from:r,to:i,empty:s}=t.selection,l=[];s?(t.storedMarks&&l.push(...t.storedMarks),l.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,d=>{l.push(...d.marks)});const c=l.find(d=>d.type.name===n.name);return c?{...c.attrs}:{}}function HI(t,e){const n=new Lx(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function VI(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 PI(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function r_(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 t1(t){return e=>r_(e.$from,t)}function $I(t,e){const n={from:0,to:t.content.size};return GO(t,n,e)}function FI(t,e){const n=bn(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,c=>{s.push(c)});const l=s.reverse().find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function i_(t,e){const n=cm(typeof e=="string"?e:e.name,t.schema);return n==="node"?FI(t,e):n==="mark"?n_(t,e):{}}function qI(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 YI(t){const e=qI(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,l)=>l!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function KI(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const l=[];if(i.ranges.length)i.forEach((c,d)=>{l.push({from:c,to:d})});else{const{from:c,to:d}=n[s];if(c===void 0||d===void 0)return;l.push({from:c,to:d})}l.forEach(({from:c,to:d})=>{const f=e.slice(s).map(c,-1),p=e.slice(s).map(d),m=e.invert().map(f,-1),g=e.invert().map(p);r.push({oldRange:{from:m,to:g},newRange:{from:f,to:p}})})}),YI(r)}function n1(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),l=e1(s,i.type);l&&r.push({mark:i,...l})}):n.nodesBetween(t,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(l=>({from:s,to:s+i.nodeSize,mark:l})))}),r}function xh(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 _b(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?xo(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>Jh(m.attrs,n,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:m,$to:g})=>{const b=m.pos,v=g.pos;t.doc.nodesBetween(b,v,(w,C)=>{if(!w.isText&&!w.marks.length)return;const E=Math.max(b,C),I=Math.min(v,C+w.nodeSize),j=I-E;l+=j,c.push(...w.marks.map(Q=>({mark:Q,from:E,to:I})))})}),l===0)return!1;const d=c.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>Jh(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),f=c.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,g)=>m+g.to-g.from,0);return(d>0?d+f:d)>=l}function WI(t,e,n={}){if(!e)return Ku(t,null,n)||_b(t,null,n);const r=cm(e,t.schema);return r==="node"?Ku(t,e,n):r==="mark"?_b(t,e,n):!1}function KE(t,e){const{nodeExtensions:n}=om(e),r=n.find(l=>l.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=We(Se(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function um(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&&(um(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function GI(t){return t instanceof Te}function ZI(t,e,n){var r;const{selection:i}=e;let s=null;if(XO(i)&&(s=i.$cursor),s){const c=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(c)||!c.some(d=>d.type.excludes(n))}const{ranges:l}=i;return l.some(({$from:c,$to:d})=>{let f=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,d.pos,(p,m,g)=>{if(f)return!1;if(p.isInline){const b=!g||g.type.allowsMarkType(n),v=!!n.isInSet(p.marks)||!p.marks.some(w=>w.type.excludes(n));f=b&&v}return!f}),f})}const JI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:l,ranges:c}=s,d=xo(t,r.schema);if(i)if(l){const f=n_(r,d);n.addStoredMark(d.create({...f,...e}))}else c.forEach(f=>{const p=f.$from.pos,m=f.$to.pos;r.doc.nodesBetween(p,m,(g,b)=>{const v=Math.max(b,p),w=Math.min(b+g.nodeSize,m);g.marks.find(E=>E.type===d)?g.marks.forEach(E=>{d===E.type&&n.addMark(v,w,d.create({...E.attrs,...e}))}):n.addMark(v,w,d.create(e))})});return ZI(r,n,d)},XI=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),QI=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=bn(t,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:c})=>HE(s,{...l,...e})(n)?!0:c.clearNodes()).command(({state:c})=>HE(s,{...l,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},eB=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Ko(t,0,r.content.size),s=Te.create(r,i);e.setSelection(s)}return!0},tB=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,l=_e.atStart(r).from,c=_e.atEnd(r).to,d=Ko(i,l,c),f=Ko(s,l,c),p=_e.create(r,d,f);e.setSelection(p)}return!0},nB=t=>({state:e,dispatch:n})=>{const r=bn(t,e.schema);return Nj(r)(e,n)};function WE(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 rB=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:l}=e,{$from:c,$to:d}=s,f=i.extensionManager.attributes,p=xh(f,c.node().type.name,c.node().attrs);if(s instanceof Te&&s.node.isBlock)return!c.parentOffset||!fs(l,c.pos)?!1:(r&&(t&&WE(n,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=d.parentOffset===d.parent.content.size,g=c.depth===0?void 0:VI(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&g?[{type:g,attrs:p}]:void 0,v=fs(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!v&&fs(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(v=!0,b=g?[{type:g,attrs:p}]:void 0),r){if(v&&(s instanceof _e&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const w=e.mapping.map(c.before()),C=e.doc.resolve(w);c.node(-1).canReplaceWith(C.index(),C.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&WE(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return v},iB=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var l;const c=bn(t,r.schema),{$from:d,$to:f}=r.selection,p=r.selection.node;if(p&&p.isBlock||d.depth<2||!d.sameParent(f))return!1;const m=d.node(-1);if(m.type!==c)return!1;const g=s.extensionManager.attributes;if(d.parent.content.size===0&&d.node(-1).childCount===d.indexAfter(-1)){if(d.depth===2||d.node(-3).type!==c||d.index(-2)!==d.node(-2).childCount-1)return!1;if(i){let E=ne.empty;const I=d.index(-1)?1:d.index(-2)?2:3;for(let Z=d.depth-I;Z>=d.depth-3;Z-=1)E=ne.from(d.node(Z).copy(E));const j=d.indexAfter(-1)<d.node(-2).childCount?1:d.indexAfter(-2)<d.node(-3).childCount?2:3,Q={...xh(g,d.node().type.name,d.node().attrs),...e},V=((l=c.contentMatch.defaultType)===null||l===void 0?void 0:l.createAndFill(Q))||void 0;E=E.append(ne.from(c.createAndFill(null,V)||void 0));const _=d.before(d.depth-(I-1));n.replace(_,d.after(-j),new ye(E,4-I,0));let N=-1;n.doc.nodesBetween(_,n.doc.content.size,(Z,Y)=>{if(N>-1)return!1;Z.isTextblock&&Z.content.size===0&&(N=Y+1)}),N>-1&&n.setSelection(_e.near(n.doc.resolve(N))),n.scrollIntoView()}return!0}const b=f.pos===d.end()?m.contentMatchAt(0).defaultType:null,v={...xh(g,m.type.name,m.attrs),...e},w={...xh(g,d.node().type.name,d.node().attrs),...e};n.delete(d.pos,f.pos);const C=b?[{type:c,attrs:v},{type:b,attrs:w}]:[{type:c,attrs:v}];if(!fs(n.doc,d.pos,2))return!1;if(i){const{selection:E,storedMarks:I}=r,{splittableMarks:j}=s.extensionManager,Q=I||E.$to.parentOffset&&E.$from.marks();if(n.split(d.pos,2,C).scrollIntoView(),!Q||!i)return!0;const V=Q.filter(_=>j.includes(_.type.name));n.ensureMarks(V)}return!0},d0=(t,e)=>{const n=t1(l=>l.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&yo(t.doc,n.pos)&&t.join(n.pos),!0},f0=(t,e)=>{const n=t1(l=>l.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===(i==null?void 0:i.type)&&yo(t.doc,r)&&t.join(r),!0},sB=(t,e,n,r={})=>({editor:i,tr:s,state:l,dispatch:c,chain:d,commands:f,can:p})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,b=bn(t,l.schema),v=bn(e,l.schema),{selection:w,storedMarks:C}=l,{$from:E,$to:I}=w,j=E.blockRange(I),Q=C||w.$to.parentOffset&&w.$from.marks();if(!j)return!1;const V=t1(_=>KE(_.type.name,m))(w);if(j.depth>=1&&V&&j.depth-V.depth<=1){if(V.node.type===b)return f.liftListItem(v);if(KE(V.node.type.name,m)&&b.validContent(V.node.content)&&c)return d().command(()=>(s.setNodeMarkup(V.pos,b),!0)).command(()=>d0(s,b)).command(()=>f0(s,b)).run()}return!n||!Q||!c?d().command(()=>p().wrapInList(b,r)?!0:f.clearNodes()).wrapInList(b,r).command(()=>d0(s,b)).command(()=>f0(s,b)).run():d().command(()=>{const _=p().wrapInList(b,r),N=Q.filter(Z=>g.includes(Z.type.name));return s.ensureMarks(N),_?!0:f.clearNodes()}).wrapInList(b,r).command(()=>d0(s,b)).command(()=>f0(s,b)).run()},oB=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,l=xo(t,r.schema);return _b(r,l,e)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,e)},lB=(t,e,n={})=>({state:r,commands:i})=>{const s=bn(t,r.schema),l=bn(e,r.schema),c=Ku(r,s,n);let d;return r.selection.$anchor.sameParent(r.selection.$head)&&(d=r.selection.$anchor.parent.attrs),c?i.setNode(l,d):i.setNode(s,{...d,...n})},aB=(t,e={})=>({state:n,commands:r})=>{const i=bn(t,n.schema);return Ku(n,i,e)?r.lift(i):r.wrapIn(i,e)},cB=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const l=t.tr,c=s.transform;for(let d=c.steps.length-1;d>=0;d-=1)l.step(c.steps[d].invert(c.docs[d]));if(s.text){const d=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,t.schema.text(s.text,d))}else l.delete(s.from,s.to)}return!0}}return!1},uB=()=>({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},dB=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:c}=n,d=xo(t,r.schema),{$from:f,empty:p,ranges:m}=c;if(!i)return!0;if(p&&l){let{from:g,to:b}=c;const v=(s=f.marks().find(C=>C.type===d))===null||s===void 0?void 0:s.attrs,w=e1(f,d,v);w&&(g=w.from,b=w.to),n.removeMark(g,b,d)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,d)});return n.removeStoredMark(d),!0},fB=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=cm(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=bn(t,r.schema)),c==="mark"&&(l=xo(t,r.schema)),i&&n.selection.ranges.forEach(d=>{const f=d.$from.pos,p=d.$to.pos;let m,g,b,v;n.selection.empty?r.doc.nodesBetween(f,p,(w,C)=>{s&&s===w.type&&(b=Math.max(C,f),v=Math.min(C+w.nodeSize,p),m=C,g=w)}):r.doc.nodesBetween(f,p,(w,C)=>{C<f&&s&&s===w.type&&(b=Math.max(C,f),v=Math.min(C+w.nodeSize,p),m=C,g=w),C>=f&&C<=p&&(s&&s===w.type&&n.setNodeMarkup(C,void 0,{...w.attrs,...e}),l&&w.marks.length&&w.marks.forEach(E=>{if(l===E.type){const I=Math.max(C,f),j=Math.min(C+w.nodeSize,p);n.addMark(I,j,l.create({...E.attrs,...e}))}}))}),g&&(m!==void 0&&n.setNodeMarkup(m,void 0,{...g.attrs,...e}),l&&g.marks.length&&g.marks.forEach(w=>{l===w.type&&n.addMark(b,v,l.create({...w.attrs,...e}))}))}),!0):!1},hB=(t,e={})=>({state:n,dispatch:r})=>{const i=bn(t,n.schema);return Tj(i,e)(n,r)},pB=(t,e={})=>({state:n,dispatch:r})=>{const i=bn(t,n.schema);return Aj(i,e)(n,r)};var mB=Object.freeze({__proto__:null,blur:Zj,clearContent:Jj,clearNodes:Xj,command:Qj,createParagraphNear:eI,cut:tI,deleteCurrentNode:nI,deleteNode:rI,deleteRange:iI,deleteSelection:sI,enter:oI,exitCode:lI,extendMarkRange:aI,first:cI,focus:dI,forEach:fI,insertContent:hI,insertContentAt:gI,joinBackward:xI,joinDown:bI,joinForward:vI,joinItemBackward:SI,joinItemForward:wI,joinTextblockBackward:kI,joinTextblockForward:CI,joinUp:yI,keyboardShortcut:TI,lift:AI,liftEmptyBlock:MI,liftListItem:OI,newlineInCode:_I,resetAttributes:DI,scrollIntoView:RI,selectAll:NI,selectNodeBackward:zI,selectNodeForward:LI,selectParentNode:jI,selectTextblockEnd:II,selectTextblockStart:BI,setContent:UI,setMark:JI,setMeta:XI,setNode:QI,setNodeSelection:eB,setTextSelection:tB,sinkListItem:nB,splitBlock:rB,splitListItem:iB,toggleList:sB,toggleMark:oB,toggleNode:lB,toggleWrap:aB,undoInputRule:cB,unsetAllMarks:uB,unsetMark:dB,updateAttributes:fB,wrapIn:hB,wrapInList:pB});const gB=Zt.create({name:"commands",addCommands(){return{...mB}}}),yB=Zt.create({name:"drop",addProseMirrorPlugins(){return[new xt({key:new Rt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),bB=Zt.create({name:"editable",addProseMirrorPlugins(){return[new xt({key:new Rt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),xB=new Rt("focusEvents"),vB=Zt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new xt({key:xB,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}}}})]}}),SB=Zt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:d,doc:f}=c,{empty:p,$anchor:m}=d,{pos:g,parent:b}=m,v=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,w=v.parent.type.spec.isolating,C=m.pos-m.parentOffset,E=w&&v.parent.childCount===1?C===m.pos:ze.atStart(f).from===g;return!p||!b.type.isTextblock||b.textContent.length||!E||E&&m.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Xh()||t_()?s:i},addProseMirrorPlugins(){return[new xt({key:new Rt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(w=>w.getMeta("composition")))return;const r=t.some(w=>w.docChanged)&&!e.doc.eq(n.doc),i=t.some(w=>w.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:l,to:c}=e.selection,d=ze.atStart(e.doc).from,f=ze.atEnd(e.doc).to;if(s||!(l===d&&c===f)||!um(n.doc))return;const g=n.tr,b=im({state:n,transaction:g}),{commands:v}=new sm({editor:this.editor,state:b});if(v.clearNodes(),!!g.steps.length)return g}})]}}),wB=Zt.create({name:"paste",addProseMirrorPlugins(){return[new xt({key:new Rt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),kB=Zt.create({name:"tabindex",addProseMirrorPlugins(){return[new xt({key:new Rt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Po{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Po(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Po(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Po(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const c=this.resolvedPos.doc.resolve(l);if(!i&&c.depth<=this.depth)return;const d=new Po(c,this.editor,i,i?n:null);i&&(d.actualDepth=this.depth+1),e.push(new Po(c,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,l=Object.keys(n);for(let c=0;c<l.length;c+=1){const d=l[c];if(s[d]!==n[d])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(l=>{r&&i.length>0||(l.node.type.name===e&&s.every(d=>n[d]===l.node.attrs[d])&&i.push(l),!(r&&i.length>0)&&(i=i.concat(l.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const CB=`.ProseMirror {
|
|
73
|
+
position: relative;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ProseMirror {
|
|
77
|
+
word-wrap: break-word;
|
|
78
|
+
white-space: pre-wrap;
|
|
79
|
+
white-space: break-spaces;
|
|
80
|
+
-webkit-font-variant-ligatures: none;
|
|
81
|
+
font-variant-ligatures: none;
|
|
82
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.ProseMirror [contenteditable="false"] {
|
|
86
|
+
white-space: normal;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
90
|
+
white-space: pre-wrap;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ProseMirror pre {
|
|
94
|
+
white-space: pre-wrap;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
img.ProseMirror-separator {
|
|
98
|
+
display: inline !important;
|
|
99
|
+
border: none !important;
|
|
100
|
+
margin: 0 !important;
|
|
101
|
+
width: 0 !important;
|
|
102
|
+
height: 0 !important;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.ProseMirror-gapcursor {
|
|
106
|
+
display: none;
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
position: absolute;
|
|
109
|
+
margin: 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.ProseMirror-gapcursor:after {
|
|
113
|
+
content: "";
|
|
114
|
+
display: block;
|
|
115
|
+
position: absolute;
|
|
116
|
+
top: -2px;
|
|
117
|
+
width: 20px;
|
|
118
|
+
border-top: 1px solid black;
|
|
119
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@keyframes ProseMirror-cursor-blink {
|
|
123
|
+
to {
|
|
124
|
+
visibility: hidden;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.ProseMirror-hideselection *::selection {
|
|
129
|
+
background: transparent;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
133
|
+
background: transparent;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.ProseMirror-hideselection * {
|
|
137
|
+
caret-color: transparent;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
141
|
+
display: block;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
145
|
+
opacity: 0
|
|
146
|
+
}`;function EB(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 TB=class extends zj{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=EB(CB,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=WO(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let r=n;if([].concat(e).forEach(s=>{const l=typeof s=="string"?`${s}$`:s.key;r=r.filter(c=>!c.key.startsWith(l))}),n.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[bB,Gj.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),gB,vB,SB,kB,yB,wB].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 ya(i,this)}createCommandManager(){this.commandManager=new sm({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(l){if(!(l instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(l.message))throw l;this.emit("contentError",{editor:this,error:l,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(c=>c.name!=="collaboration"),this.createExtensionManager()}}),n=Ob(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=QO(n,this.options.autofocus);this.view=new zO(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:ga.create({doc:n,selection:r||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const s=this.view.dom;s.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(l=>{var c;return(c=this.capturedTransaction)===null||c===void 0?void 0:c.step(l)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return i_(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return WI(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Xx(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
|
|
147
|
+
|
|
148
|
+
`,textSerializers:r={}}=e||{};return $I(this.state.doc,{blockSeparator:n,textSerializers:{...ZO(this.schema),...r}})}get isEmpty(){return um(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new Po(n,this)}get $doc(){return this.$pos(0)}};function al(t){return new lm({find:t.find,handler:({state:e,range:n,match:r})=>{const i=We(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,l=r[r.length-1],c=r[0];if(l){const d=c.search(/\S/),f=n.from+c.indexOf(l),p=f+l.length;if(n1(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(w=>w===t.type&&w!==b.mark.type)).filter(b=>b.to>f).length)return null;p<n.to&&s.delete(p,n.to),f>n.from&&s.delete(n.from+d,f);const g=n.from+d+l.length;s.addMark(n.from+d,g,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function AB(t){return new lm({find:t.find,handler:({state:e,range:n,match:r})=>{const i=We(t.getAttributes,void 0,r)||{},{tr:s}=e,l=n.from;let c=n.to;const d=t.type.create(i);if(r[1]){const f=r[0].lastIndexOf(r[1]);let p=l+f;p>c?p=c:c=p+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,l+r[0].length-1),s.replaceWith(p,c,d)}else if(r[0]){const f=t.type.isInline?l:l-1;s.insert(f,t.type.create(i)).delete(s.mapping.map(l),s.mapping.map(c))}s.scrollIntoView()}})}function Db(t){return new lm({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=We(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 Wu(t){return new lm({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=We(t.getAttributes,void 0,r)||{},l=e.tr.delete(n.from,n.to),d=l.doc.resolve(n.from).blockRange(),f=d&&zx(d,t.type,s);if(!f)return null;if(l.wrap(d,f),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:b}=t.editor.extensionManager,v=g||m.$to.parentOffset&&m.$from.marks();if(v){const w=v.filter(C=>b.includes(C.type.name));l.ensureMarks(w)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,s).run()}const p=l.doc.resolve(n.from-1).nodeBefore;p&&p.type===t.type&&yo(l.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,p))&&l.join(n.from-1)}})}class xn{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=We(Se(this,"addOptions",{name:this.name}))),this.storage=We(Se(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new xn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>am(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new xn(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=We(Se(n,"addOptions",{name:n.name})),n.storage=We(Se(n,"addStorage",{name:n.name,options:n.options})),n}}function ho(t){return new $j({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=We(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:l}=e,c=r[r.length-1],d=r[0];let f=n.to;if(c){const p=d.search(/\S/),m=n.from+d.indexOf(c),g=m+c.length;if(n1(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(C=>C===t.type&&C!==v.mark.type)).filter(v=>v.to>m).length)return null;g<n.to&&l.delete(g,n.to),m>n.from&&l.delete(n.from+p,m),f=n.from+p+c.length,l.addMark(n.from+p,f,t.type.create(s||{})),l.removeStoredMark(t.type)}}})}function MB(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Te){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}const Zr=()=>new Map,Rb=t=>{const e=Zr();return t.forEach((n,r)=>{e.set(r,n)}),e},zi=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},OB=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},_B=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},cl=()=>new Set,h0=t=>t[t.length-1],DB=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},po=Array.from,r1=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},i1=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},RB=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},Ha=Array.isArray;class s_{constructor(){this._observers=Zr()}on(e,n){return zi(this._observers,e,cl).add(n),n}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return po((this._observers.get(e)||Zr()).values()).forEach(r=>r(...n))}destroy(){this._observers=Zr()}}const si=Math.floor,vh=Math.abs,ps=(t,e)=>t<e?t:e,oi=(t,e)=>t>e?t:e,o_=t=>t!==0?t<0:1/t<0,GE=1,ZE=2,p0=4,m0=8,Gu=32,ms=64,qn=128,NB=1<<29,dm=31,Nb=63,Qo=127,zB=2147483647,Qh=Number.MAX_SAFE_INTEGER,JE=Number.MIN_SAFE_INTEGER,LB=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&si(t)===t),l_=String.fromCharCode,jB=t=>t.toLowerCase(),IB=/^\s*/g,BB=t=>t.replace(IB,""),UB=/([A-Z])/g,XE=(t,e)=>BB(t.replace(UB,n=>`${e}${jB(n)}`)),HB=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},Zu=typeof TextEncoder<"u"?new TextEncoder:null,VB=t=>Zu.encode(t),PB=Zu?VB:HB;let bu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});bu&&bu.decode(new Uint8Array).length===1&&(bu=null);const $B=(t,e)=>RB(e,()=>t).join("");let bd=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const xd=()=>new bd,FB=t=>{const e=xd();return t(e),ii(e)},qB=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},ii=t=>{const e=new Uint8Array(qB(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},YB=(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(oi(n,e)*2),t.cpos=0)},fn=(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},zb=fn,st=(t,e)=>{for(;e>Qo;)fn(t,qn|Qo&e),e=si(e/128);fn(t,Qo&e)},s1=(t,e)=>{const n=o_(e);for(n&&(e=-e),fn(t,(e>Nb?qn:0)|(n?ms:0)|Nb&e),e=si(e/64);e>0;)fn(t,(e>Qo?qn:0)|Qo&e),e=si(e/128)},Lb=new Uint8Array(3e4),KB=Lb.length/3,WB=(t,e)=>{if(e.length<KB){const n=Zu.encodeInto(e,Lb).written||0;st(t,n);for(let r=0;r<n;r++)fn(t,Lb[r])}else Sr(t,PB(e))},GB=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;st(t,r);for(let i=0;i<r;i++)fn(t,n.codePointAt(i))},wa=Zu&&Zu.encodeInto?WB:GB,fm=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=ps(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(oi(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},Sr=(t,e)=>{st(t,e.byteLength),fm(t,e)},o1=(t,e)=>{YB(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},ZB=(t,e)=>o1(t,4).setFloat32(0,e,!1),JB=(t,e)=>o1(t,8).setFloat64(0,e,!1),XB=(t,e)=>o1(t,8).setBigInt64(0,e,!1),QE=new DataView(new ArrayBuffer(4)),QB=t=>(QE.setFloat32(0,t),QE.getFloat32(0)===t),Va=(t,e)=>{switch(typeof e){case"string":fn(t,119),wa(t,e);break;case"number":LB(e)&&vh(e)<=zB?(fn(t,125),s1(t,e)):QB(e)?(fn(t,124),ZB(t,e)):(fn(t,123),JB(t,e));break;case"bigint":fn(t,122),XB(t,e);break;case"object":if(e===null)fn(t,126);else if(Ha(e)){fn(t,117),st(t,e.length);for(let n=0;n<e.length;n++)Va(t,e[n])}else if(e instanceof Uint8Array)fn(t,116),Sr(t,e);else{fn(t,118);const n=Object.keys(e);st(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];wa(t,i),Va(t,e[i])}}break;case"boolean":fn(t,e?120:121);break;default:fn(t,127)}};class eT extends bd{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&st(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const tT=t=>{t.count>0&&(s1(t.encoder,t.count===1?t.s:-t.s),t.count>1&&st(t.encoder,t.count-2))};class Sh{constructor(){this.encoder=new bd,this.s=0,this.count=0}write(e){this.s===e?this.count++:(tT(this),this.count=1,this.s=e)}toUint8Array(){return tT(this),ii(this.encoder)}}const nT=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);s1(t.encoder,e),t.count>1&&st(t.encoder,t.count-2)}};class g0{constructor(){this.encoder=new bd,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(nT(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return nT(this),ii(this.encoder)}}class e6{constructor(){this.sarr=[],this.s="",this.lensE=new Sh}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 bd;return this.sarr.push(this.s),this.s="",wa(e,this.sarr.join("")),fm(e,this.lensE.toUint8Array()),ii(e)}}const Di=t=>new Error(t),Jr=()=>{throw Di("Method unimplemented")},In=()=>{throw Di("Unexpected case")},a_=Di("Unexpected end of array"),c_=Di("Integer out of Range");let hm=class{constructor(e){this.arr=e,this.pos=0}};const Ja=t=>new hm(t),t6=t=>t.pos!==t.arr.length,n6=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},wr=t=>n6(t,Ze(t)),Pa=t=>t.arr[t.pos++],Ze=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&Qo)*n,n*=128,i<qn)return e;if(e>Qh)throw c_}throw a_},l1=t=>{let e=t.arr[t.pos++],n=e&Nb,r=64;const i=(e&ms)>0?-1:1;if((e&qn)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&Qo)*r,r*=128,e<qn)return i*n;if(n>Qh)throw c_}throw a_},r6=t=>{let e=Ze(t);if(e===0)return"";{let n=String.fromCodePoint(Pa(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Pa(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))}},i6=t=>bu.decode(wr(t)),ka=bu?i6:r6,a1=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},s6=t=>a1(t,4).getFloat32(0,!1),o6=t=>a1(t,8).getFloat64(0,!1),l6=t=>a1(t,8).getBigInt64(0,!1),a6=[t=>{},t=>null,l1,s6,o6,l6,t=>!1,t=>!0,ka,t=>{const e=Ze(t),n={};for(let r=0;r<e;r++){const i=ka(t);n[i]=Ju(t)}return n},t=>{const e=Ze(t),n=[];for(let r=0;r<e;r++)n.push(Ju(t));return n},wr],Ju=t=>a6[127-Pa(t)](t);class rT extends hm{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),t6(this)?this.count=Ze(this)+1:this.count=-1),this.count--,this.s}}class wh extends hm{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=l1(this);const e=o_(this.s);this.count=1,e&&(this.s=-this.s,this.count=Ze(this)+2)}return this.count--,this.s}}class y0 extends hm{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=l1(this),n=e&1;this.diff=si(e/2),this.count=1,n&&(this.count=Ze(this)+2)}return this.s+=this.diff,this.count--,this.s}}class c6{constructor(e){this.decoder=new wh(e),this.str=ka(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 u6=crypto.getRandomValues.bind(crypto),d6=Math.random,u_=()=>u6(new Uint32Array(1))[0],f6=t=>t[si(d6()*t.length)],h6="10000000-1000-4000-8000"+-1e11,p6=()=>h6.replace(/[018]/g,t=>(t^u_()&15>>t/4).toString(16)),m6=Date.now,iT=t=>new Promise(t);Promise.all.bind(Promise);const sT=t=>t===void 0?null:t;class g6{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let d_=new g6,y6=!0;try{typeof localStorage<"u"&&localStorage&&(d_=localStorage,y6=!1)}catch{}const b6=d_,Xu=Symbol("Equality"),f_=(t,e)=>{var n;return t===e||!!((n=t==null?void 0:t[Xu])!=null&&n.call(t,e))||!1},x6=t=>typeof t=="object",v6=Object.assign,h_=Object.keys,S6=(t,e)=>{for(const n in t)e(t[n],n)},ep=t=>h_(t).length,w6=t=>{for(const e in t)return!1;return!0},Xa=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},c1=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),k6=(t,e)=>t===e||ep(t)===ep(e)&&Xa(t,(n,r)=>(n!==void 0||c1(e,r))&&f_(e[r],n)),C6=Object.freeze,p_=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&p_(t[e])}return C6(t)},u1=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&u1(t,e,n+1)}},E6=t=>t,kh=(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[Xu]!=null)return t[Xu](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)||!kh(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(ep(t)!==ep(e))return!1;for(const n in t)if(!c1(t,n)||!kh(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(!kh(t[n],e[n]))return!1;break;default:return!1}return!0},T6=(t,e)=>e.includes(t);var m_={};const $a=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",g_=typeof window<"u"&&typeof document<"u"&&!$a;let bi;const A6=()=>{if(bi===void 0)if($a){bi=Zr();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&bi.set(e,""),e=r):e!==null&&(bi.set(e,r),e=null)}e!==null&&bi.set(e,"")}else typeof location=="object"?(bi=Zr(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");bi.set(`--${XE(e,"-")}`,n),bi.set(`-${XE(e,"-")}`,n)}})):bi=Zr();return bi},jb=t=>A6().has(t),tp=t=>sT($a?m_[t.toUpperCase().replaceAll("-","_")]:b6.getItem(t)),y_=t=>jb("--"+t)||tp(t)!==null,M6=y_("production"),O6=$a&&T6(m_.FORCE_COLOR,["true","1","2"]),_6=O6||!jb("--no-colors")&&!y_("no-color")&&(!$a||process.stdout.isTTY)&&(!$a||jb("--color")||tp("COLORTERM")!==null||(tp("TERM")||"").includes("color")),D6=t=>new Uint8Array(t),R6=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=l_(t[n]);return btoa(e)},N6=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),z6=g_?R6:N6,L6=t=>{const e=D6(t.byteLength);return e.set(t),e},j6=t=>FB(e=>Va(e,t));class I6{constructor(e,n){this.left=e,this.right=n}}const is=(t,e)=>new I6(t,e),oT=t=>t.next()>=.5,b0=(t,e,n)=>si(t.next()*(n+1-e)+e),b_=(t,e,n)=>si(t.next()*(n+1-e)+e),d1=(t,e,n)=>b_(t,e,n),B6=t=>l_(d1(t,97,122)),U6=(t,e=0,n=20)=>{const r=d1(t,e,n);let i="";for(let s=0;s<r;s++)i+=B6(t);return i},x0=(t,e)=>e[d1(t,0,e.length-1)],H6=Symbol("0schema");class V6{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($B(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
|
|
149
|
+
`)}}const Ib=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[Xu]?f_(t,e):Ha(t)?r1(t,n=>i1(e,r=>Ib(n,r))):x6(t)?Xa(t,(n,r)=>Ib(n,e[r])):!1;var rb;let Gn=(rb=class{extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),Ib(n,r)}equals(e){return this.constructor===e.constructor&&kh(this.shape,e.shape)}[H6](){return!0}[Xu](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){Jr()}get nullable(){return Qa(this,bm)}get optional(){return new S_(this)}cast(e){return lT(e,this),e}expect(e){return lT(e,this),e}},Hf(rb,"_dilutes",!1),rb);class f1 extends Gn{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 on=(t,e=null)=>new f1(t,e);on(f1);class h1 extends Gn{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 vn=t=>new h1(t);on(h1);class pm extends Gn{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 mm=(...t)=>new pm(t),x_=on(pm),P6=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),v_=t=>{if(Fa.check(t))return[P6(t)];if(x_.check(t))return t.shape.map(e=>e+"");if(__.check(t))return["[+-]?\\d+.?\\d*"];if(D_.check(t))return[".*"];if(rp.check(t))return t.shape.map(v_).flat(1);In()};class $6 extends Gn{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(v_).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}}on($6);const F6=Symbol("optional");class S_ extends Gn{constructor(e){super(),this.shape=e}check(e,n){const r=e===void 0||this.shape.check(e);return!r&&(n==null||n.extend(null,"undefined (optional)","()")),r}get[F6](){return!0}}const q6=on(S_);class Y6 extends Gn{check(e,n){return n==null||n.extend(null,"never",typeof e),!1}}on(Y6);const Gp=class Gp extends Gn{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}get partial(){return new Gp(this.shape,!0)}check(e,n){return e==null?(n==null||n.extend(null,"object","null"),!1):Xa(this.shape,(r,i)=>{const s=this._isPartial&&!c1(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})}};Hf(Gp,"_dilutes",!0);let np=Gp;const K6=t=>new np(t),W6=on(np),G6=vn(t=>t!=null&&(t.constructor===Object||t.constructor==null));class w_ extends Gn{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&Xa(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 k_=(t,e)=>new w_(t,e),Z6=on(w_);class C_ extends Gn{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&Xa(this.shape,(r,i)=>{const s=r.check(e[i],n);return!s&&(n==null||n.extend(i.toString(),"Tuple",typeof r)),s})}}const J6=(...t)=>new C_(t);on(C_);class E_ extends Gn{constructor(e){super(),this.shape=e.length===1?e[0]:new gm(e)}check(e,n){const r=Ha(e)&&r1(e,i=>this.shape.check(i));return!r&&(n==null||n.extend(null,"Array","")),r}}const T_=(...t)=>new E_(t),X6=on(E_),Q6=vn(t=>Ha(t));class A_ extends Gn{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 e5=(t,e=null)=>new A_(t,e);on(A_);const t5=e5(Gn);class n5 extends Gn{constructor(e){super(),this.len=e.length-1,this.args=J6(...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 r5=on(n5),i5=vn(t=>typeof t=="function");class s5 extends Gn{constructor(e){super(),this.shape=e}check(e,n){const r=r1(this.shape,i=>i.check(e,n));return!r&&(n==null||n.extend(null,"Intersectinon",typeof e)),r}}on(s5,t=>t.shape.length>0);class gm extends Gn{constructor(e){super(),this.shape=e}check(e,n){const r=i1(this.shape,i=>i.check(e,n));return n==null||n.extend(null,"Union",typeof e),r}}Hf(gm,"_dilutes",!0);const Qa=(...t)=>t.findIndex(e=>rp.check(e))>=0?Qa(...t.map(e=>Qu(e)).map(e=>rp.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new gm(t),rp=on(gm),M_=()=>!0,ip=vn(M_),o5=on(h1,t=>t.shape===M_),p1=vn(t=>typeof t=="bigint"),l5=vn(t=>t===p1),O_=vn(t=>typeof t=="symbol");vn(t=>t===O_);const Ca=vn(t=>typeof t=="number"),__=vn(t=>t===Ca),Fa=vn(t=>typeof t=="string"),D_=vn(t=>t===Fa),ym=vn(t=>typeof t=="boolean"),a5=vn(t=>t===ym),R_=mm(void 0);on(pm,t=>t.shape.length===1&&t.shape[0]===void 0);mm(void 0);const bm=mm(null),c5=on(pm,t=>t.shape.length===1&&t.shape[0]===null);on(Uint8Array);on(f1,t=>t.shape===Uint8Array);const u5=Qa(Ca,Fa,bm,R_,p1,ym,O_);(()=>{const t=T_(ip),e=k_(Fa,ip),n=Qa(Ca,Fa,bm,ym,t,e);return t.shape=n,e.shape.values=n,n})();const Qu=t=>{if(t5.check(t))return t;if(G6.check(t)){const e={};for(const n in t)e[n]=Qu(t[n]);return K6(e)}else{if(Q6.check(t))return Qa(...t.map(Qu));if(u5.check(t))return mm(t);if(i5.check(t))return on(t)}In()},lT=M6?()=>{}:(t,e)=>{const n=new V6;if(!e.check(t,n))throw Di(`Expected value to be of type ${e.constructor.name}.
|
|
150
|
+
${n.toString()}`)};class d5{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:Qu(e),h:n}),this}else(e){return this.if(ip,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 Di("Unhandled pattern")}}}const f5=t=>new d5(t),N_=f5(ip).if(__,(t,e)=>b0(e,JE,Qh)).if(D_,(t,e)=>U6(e)).if(a5,(t,e)=>oT(e)).if(l5,(t,e)=>BigInt(b0(e,JE,Qh))).if(rp,(t,e)=>aa(e,x0(e,t.shape))).if(W6,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(q6.check(i)){if(oT(e))continue;i=i.shape}n[r]=N_(i,e)}return n}).if(X6,(t,e)=>{const n=[],r=b_(e,0,42);for(let i=0;i<r;i++)n.push(aa(e,t.shape));return n}).if(x_,(t,e)=>x0(e,t.shape)).if(c5,(t,e)=>null).if(r5,(t,e)=>{const n=aa(e,t.res);return()=>n}).if(o5,(t,e)=>aa(e,x0(e,[Ca,Fa,bm,R_,p1,ym,T_(Ca),k_(Qa("a","b","c"),Ca)]))).if(Z6,(t,e)=>{const n={},r=b0(e,0,3);for(let i=0;i<r;i++){const s=aa(e,t.shape.keys),l=aa(e,t.shape.values);n[s]=l}return n}).done(),aa=(t,e)=>N_(Qu(e),t),vd=typeof document<"u"?document:{};vn(t=>t.nodeType===y5);typeof DOMParser<"u"&&new DOMParser;vn(t=>t.nodeType===p5);vn(t=>t.nodeType===m5);const h5=t=>OB(t,(e,n)=>`${n}:${e};`).join(""),p5=vd.ELEMENT_NODE,m5=vd.TEXT_NODE,g5=vd.DOCUMENT_NODE,y5=vd.DOCUMENT_FRAGMENT_NODE;vn(t=>t.nodeType===g5);const b5=t=>class{constructor(n){this._=n}destroy(){t(this._)}},x5=b5(clearTimeout),m1=(t,e)=>new x5(setTimeout(e,t)),bs=Symbol,z_=bs(),L_=bs(),v5=bs(),S5=bs(),w5=bs(),j_=bs(),k5=bs(),g1=bs(),C5=bs(),E5=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},T5={[z_]:is("font-weight","bold"),[L_]:is("font-weight","normal"),[v5]:is("color","blue"),[w5]:is("color","green"),[S5]:is("color","grey"),[j_]:is("color","red"),[k5]:is("color","purple"),[g1]:is("color","orange"),[C5]:is("color","black")},A5=t=>{var l;t.length===1&&((l=t[0])==null?void 0:l.constructor)===Function&&(t=t[0]());const e=[],n=[],r=Zr();let i=[],s=0;for(;s<t.length;s++){const c=t[s],d=T5[c];if(d!==void 0)r.set(d.left,d.right);else{if(c===void 0)break;if(c.constructor===String||c.constructor===Number){const f=h5(r);s>0||f.length>0?(e.push("%c"+c),n.push(f)):e.push(c)}else break}}for(s>0&&(i=n,i.unshift(e.join("")));s<t.length;s++){const c=t[s];c instanceof Symbol||i.push(c)}return i},I_=_6?A5:E5,M5=(...t)=>{console.log(...I_(t)),U_.forEach(e=>e.print(t))},B_=(...t)=>{console.warn(...I_(t)),t.unshift(g1),U_.forEach(e=>e.print(t))},U_=cl(),H_=t=>({[Symbol.iterator](){return this},next:t}),O5=(t,e)=>H_(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),v0=(t,e)=>H_(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class xm{constructor(e,n){this.clock=e,this.len=n}}class ec{constructor(){this.clients=new Map}}const mo=(t,e,n)=>e.clients.forEach((r,i)=>{const s=t.doc.store.clients.get(i);if(s!=null){const l=s[s.length-1],c=l.id.clock+l.length;for(let d=0,f=r[d];d<r.length&&f.clock<c;f=r[++d])eD(t,s,f.clock,f.len,n)}}),_5=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=si((n+r)/2),s=t[i],l=s.clock;if(l<=e){if(e<l+s.len)return i;n=i+1}else r=i-1}return null},tc=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&_5(n,e.clock)!==null},y1=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 xm(i.clock,oi(i.len,s.clock+s.len-i.clock)):(r<n&&(e[r]=s),r++)}e.length=r})},Bb=t=>{const e=new ec;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,i)=>{if(!e.clients.has(i)){const s=r.slice();for(let l=n+1;l<t.length;l++)DB(s,t[l].clients.get(i)||[]);e.clients.set(i,s)}});return y1(e),e},ed=(t,e,n,r)=>{zi(t.clients,e,()=>[]).push(new xm(n,r))},V_=()=>new ec,P_=t=>{const e=V_();return t.clients.forEach((n,r)=>{const i=[];for(let s=0;s<n.length;s++){const l=n[s];if(l.deleted){const c=l.id.clock;let d=l.length;if(s+1<n.length)for(let f=n[s+1];s+1<n.length&&f.deleted;f=n[++s+1])d+=f.length;i.push(new xm(c,d))}}i.length>0&&e.clients.set(r,i)}),e},nc=(t,e)=>{st(t.restEncoder,e.clients.size),po(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),st(t.restEncoder,n);const i=r.length;st(t.restEncoder,i);for(let s=0;s<i;s++){const l=r[s];t.writeDsClock(l.clock),t.writeDsLen(l.len)}})},b1=t=>{const e=new ec,n=Ze(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const i=Ze(t.restDecoder),s=Ze(t.restDecoder);if(s>0){const l=zi(e.clients,i,()=>[]);for(let c=0;c<s;c++)l.push(new xm(t.readDsClock(),t.readDsLen()))}}return e},aT=(t,e,n)=>{const r=new ec,i=Ze(t.restDecoder);for(let s=0;s<i;s++){t.resetDsCurVal();const l=Ze(t.restDecoder),c=Ze(t.restDecoder),d=n.clients.get(l)||[],f=Gt(n,l);for(let p=0;p<c;p++){const m=t.readDsClock(),g=m+t.readDsLen();if(m<f){f<g&&ed(r,l,f,g-f);let b=li(d,m),v=d[b];for(!v.deleted&&v.id.clock<m&&(d.splice(b+1,0,dp(e,v,m-v.id.clock)),b++);b<d.length&&(v=d[b++],v.id.clock<g);)v.deleted||(g<v.id.clock+v.length&&d.splice(b,0,dp(e,v,g-v.id.clock)),v.delete(e))}else ed(r,l,m,g-m)}}if(r.clients.size>0){const s=new ul;return st(s.restEncoder,0),nc(s,r),s.toUint8Array()}return null},$_=u_;class Ri extends s_{constructor({guid:e=p6(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:l=!1,shouldLoad:c=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=$_(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new X_,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=c,this.autoLoad=l,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=iT(f=>{this.on("load",()=>{this.isLoaded=!0,f(this)})});const d=()=>iT(f=>{const p=m=>{(m===void 0||m===!0)&&(this.off("sync",p),f())};this.on("sync",p)});this.on("sync",f=>{f===!1&&this.isSynced&&(this.whenSynced=d()),this.isSynced=f===void 0||f===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=d()}load(){const e=this._item;e!==null&&!this.shouldLoad&&St(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(po(this.subdocs).map(e=>e.guid))}transact(e,n=null){return St(this,e,n)}get(e,n=gn){const r=zi(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==gn&&i!==n)if(i===gn){const s=new n;s._map=r._map,r._map.forEach(l=>{for(;l!==null;l=l.left)l.parent=s}),s._start=r._start;for(let l=s._start;l!==null;l=l.right)l.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Aa)}getText(e=""){return this.get(e,go)}getMap(e=""){return this.get(e,Ya)}getXmlElement(e=""){return this.get(e,Dn)}getXmlFragment(e=""){return this.get(e,dl)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,po(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new Ri({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,St(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 F_{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Ze(this.restDecoder)}readDsLen(){return Ze(this.restDecoder)}}class q_ extends F_{readLeftID(){return Pe(Ze(this.restDecoder),Ze(this.restDecoder))}readRightID(){return Pe(Ze(this.restDecoder),Ze(this.restDecoder))}readClient(){return Ze(this.restDecoder)}readInfo(){return Pa(this.restDecoder)}readString(){return ka(this.restDecoder)}readParentInfo(){return Ze(this.restDecoder)===1}readTypeRef(){return Ze(this.restDecoder)}readLen(){return Ze(this.restDecoder)}readAny(){return Ju(this.restDecoder)}readBuf(){return L6(wr(this.restDecoder))}readJSON(){return JSON.parse(ka(this.restDecoder))}readKey(){return ka(this.restDecoder)}}class D5{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Ze(this.restDecoder),this.dsCurrVal}readDsLen(){const e=Ze(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class qa extends D5{constructor(e){super(e),this.keys=[],Ze(e),this.keyClockDecoder=new y0(wr(e)),this.clientDecoder=new wh(wr(e)),this.leftClockDecoder=new y0(wr(e)),this.rightClockDecoder=new y0(wr(e)),this.infoDecoder=new rT(wr(e),Pa),this.stringDecoder=new c6(wr(e)),this.parentInfoDecoder=new rT(wr(e),Pa),this.typeRefDecoder=new wh(wr(e)),this.lenDecoder=new wh(wr(e))}readLeftID(){return new Ea(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Ea(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 Ju(this.restDecoder)}readBuf(){return wr(this.restDecoder)}readJSON(){return Ju(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 Y_{constructor(){this.restEncoder=xd()}toUint8Array(){return ii(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){st(this.restEncoder,e)}writeDsLen(e){st(this.restEncoder,e)}}class Sd extends Y_{writeLeftID(e){st(this.restEncoder,e.client),st(this.restEncoder,e.clock)}writeRightID(e){st(this.restEncoder,e.client),st(this.restEncoder,e.clock)}writeClient(e){st(this.restEncoder,e)}writeInfo(e){zb(this.restEncoder,e)}writeString(e){wa(this.restEncoder,e)}writeParentInfo(e){st(this.restEncoder,e?1:0)}writeTypeRef(e){st(this.restEncoder,e)}writeLen(e){st(this.restEncoder,e)}writeAny(e){Va(this.restEncoder,e)}writeBuf(e){Sr(this.restEncoder,e)}writeJSON(e){wa(this.restEncoder,JSON.stringify(e))}writeKey(e){wa(this.restEncoder,e)}}class K_{constructor(){this.restEncoder=xd(),this.dsCurrVal=0}toUint8Array(){return ii(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,st(this.restEncoder,n)}writeDsLen(e){e===0&&In(),st(this.restEncoder,e-1),this.dsCurrVal+=e}}class ul extends K_{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new g0,this.clientEncoder=new Sh,this.leftClockEncoder=new g0,this.rightClockEncoder=new g0,this.infoEncoder=new eT(zb),this.stringEncoder=new e6,this.parentInfoEncoder=new eT(zb),this.typeRefEncoder=new Sh,this.lenEncoder=new Sh}toUint8Array(){const e=xd();return st(e,0),Sr(e,this.keyClockEncoder.toUint8Array()),Sr(e,this.clientEncoder.toUint8Array()),Sr(e,this.leftClockEncoder.toUint8Array()),Sr(e,this.rightClockEncoder.toUint8Array()),Sr(e,ii(this.infoEncoder)),Sr(e,this.stringEncoder.toUint8Array()),Sr(e,ii(this.parentInfoEncoder)),Sr(e,this.typeRefEncoder.toUint8Array()),Sr(e,this.lenEncoder.toUint8Array()),fm(e,ii(this.restEncoder)),ii(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){Va(this.restEncoder,e)}writeBuf(e){Sr(this.restEncoder,e)}writeJSON(e){Va(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 R5=(t,e,n,r)=>{r=oi(r,e[0].id.clock);const i=li(e,r);st(t.restEncoder,e.length-i),t.writeClient(n),st(t.restEncoder,r);const s=e[i];s.write(t,r-s.id.clock);for(let l=i+1;l<e.length;l++)e[l].write(t,0)},x1=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{Gt(e,s)>i&&r.set(s,i)}),wd(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),st(t.restEncoder,r.size),po(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{R5(t,e.clients.get(i),i,s)})},N5=(t,e)=>{const n=Zr(),r=Ze(t.restDecoder);for(let i=0;i<r;i++){const s=Ze(t.restDecoder),l=new Array(s),c=t.readClient();let d=Ze(t.restDecoder);n.set(c,{i:0,refs:l});for(let f=0;f<s;f++){const p=t.readInfo();switch(dm&p){case 0:{const m=t.readLen();l[f]=new qr(Pe(c,d),m),d+=m;break}case 10:{const m=Ze(t.restDecoder);l[f]=new Yr(Pe(c,d),m),d+=m;break}default:{const m=(p&(ms|qn))===0,g=new Et(Pe(c,d),null,(p&qn)===qn?t.readLeftID():null,null,(p&ms)===ms?t.readRightID():null,m?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,m&&(p&Gu)===Gu?t.readString():null,wD(t,p));l[f]=g,d+=g.length}}}}return n},z5=(t,e,n)=>{const r=[];let i=po(n.keys()).sort((b,v)=>b-v);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let b=n.get(i[i.length-1]);for(;b.refs.length===b.i;)if(i.pop(),i.length>0)b=n.get(i[i.length-1]);else return null;return b};let l=s();if(l===null)return null;const c=new X_,d=new Map,f=(b,v)=>{const w=d.get(b);(w==null||w>v)&&d.set(b,v)};let p=l.refs[l.i++];const m=new Map,g=()=>{for(const b of r){const v=b.id.client,w=n.get(v);w?(w.i--,c.clients.set(v,w.refs.slice(w.i)),n.delete(v),w.i=0,w.refs=[]):c.clients.set(v,[b]),i=i.filter(C=>C!==v)}r.length=0};for(;;){if(p.constructor!==Yr){const v=zi(m,p.id.client,()=>Gt(e,p.id.client))-p.id.clock;if(v<0)r.push(p),f(p.id.client,p.id.clock-1),g();else{const w=p.getMissing(t,e);if(w!==null){r.push(p);const C=n.get(w)||{refs:[],i:0};if(C.refs.length===C.i)f(w,Gt(e,w)),g();else{p=C.refs[C.i++];continue}}else(v===0||v<p.length)&&(p.integrate(t,v),m.set(p.id.client,p.id.clock+p.length))}}if(r.length>0)p=r.pop();else if(l!==null&&l.i<l.refs.length)p=l.refs[l.i++];else{if(l=s(),l===null)break;p=l.refs[l.i++]}}if(c.clients.size>0){const b=new ul;return x1(b,c,new Map),st(b.restEncoder,0),{missing:d,update:b.toUint8Array()}}return null},L5=(t,e)=>x1(t,e.doc.store,e.beforeState),j5=(t,e,n,r=new qa(t))=>St(e,i=>{i.local=!1;let s=!1;const l=i.doc,c=l.store,d=N5(r,l),f=z5(i,c,d),p=c.pendingStructs;if(p){for(const[g,b]of p.missing)if(b<Gt(c,g)){s=!0;break}if(f){for(const[g,b]of f.missing){const v=p.missing.get(g);(v==null||v>b)&&p.missing.set(g,b)}p.update=op([p.update,f.update])}}else c.pendingStructs=f;const m=aT(r,i,c);if(c.pendingDs){const g=new qa(Ja(c.pendingDs));Ze(g.restDecoder);const b=aT(g,i,c);m&&b?c.pendingDs=op([m,b]):c.pendingDs=m||b}else c.pendingDs=m;if(s){const g=c.pendingStructs.update;c.pendingStructs=null,sp(i.doc,g)}},n,!1),sp=(t,e,n,r=qa)=>{const i=Ja(e);j5(i,t,n,new r(i))},I5=(t,e,n)=>sp(t,e,n,q_),B5=(t,e,n=new Map)=>{x1(t,e.store,n),nc(t,P_(e.store))},U5=(t,e=new Uint8Array([0]),n=new ul)=>{const r=W_(e);B5(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(iU(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===Sd)return nU(i.map((s,l)=>l===0?s:oU(s)));if(n.constructor===ul)return op(i)}return i[0]},H5=(t,e)=>U5(t,e,new Sd),V5=t=>{const e=new Map,n=Ze(t.restDecoder);for(let r=0;r<n;r++){const i=Ze(t.restDecoder),s=Ze(t.restDecoder);e.set(i,s)}return e},W_=t=>V5(new F_(Ja(t))),G_=(t,e)=>(st(t.restEncoder,e.size),po(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{st(t.restEncoder,n),st(t.restEncoder,r)}),t),P5=(t,e)=>G_(t,wd(e.store)),$5=(t,e=new K_)=>(t instanceof Map?G_(e,t):P5(e,t),e.toUint8Array()),F5=t=>$5(t,new Y_);class q5{constructor(){this.l=[]}}const cT=()=>new q5,uT=(t,e)=>t.l.push(e),dT=(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.")},Z_=(t,e,n)=>u1(t.l,[e,n]);class Ea{constructor(e,n){this.client=e,this.clock=n}}const ba=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Pe=(t,e)=>new Ea(t,e),td=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw In()},nd=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class rd{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const el=t=>new rd(t.type==null?null:Pe(t.type.client,t.type.clock),t.tname??null,t.item==null?null:Pe(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class Y5{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const K5=(t,e,n=0)=>new Y5(t,e,n),Zf=(t,e,n)=>{let r=null,i=null;return t._item===null?i=td(t):r=Pe(t._item.id.client,t._item.id.clock),new rd(r,i,e,n)},S0=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Zf(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Zf(t,Pe(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Zf(t,r.lastId,n);r=r.right}return Zf(t,null,n)},W5=(t,e)=>{const n=Ta(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},Ub=(t,e,n=!0)=>{const r=e.store,i=t.item,s=t.type,l=t.tname,c=t.assoc;let d=null,f=0;if(i!==null){if(Gt(r,i.client)<=i.clock)return null;const p=n?$b(r,i):W5(r,i),m=p.item;if(!(m instanceof Et))return null;if(d=m.parent,d._item===null||!d._item.deleted){f=m.deleted||!m.countable?0:p.diff+(c>=0?0:1);let g=m.left;for(;g!==null;)!g.deleted&&g.countable&&(f+=g.length),g=g.left}}else{if(l!==null)d=e.get(l);else if(s!==null){if(Gt(r,s.client)<=s.clock)return null;const{item:p}=n?$b(r,s):{item:Ta(r,s)};if(p instanceof Et&&p.content instanceof ui)d=p.content.type;else return null}else throw In();c>=0?f=d._length:f=0}return K5(d,f,t.assoc)},fT=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&ba(t.item,e.item)&&ba(t.type,e.type)&&t.assoc===e.assoc;class v1{constructor(e,n){this.ds=e,this.sv=n}}const J_=(t,e)=>new v1(t,e),w0=t=>J_(P_(t.store),wd(t.store)),$o=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!tc(e.ds,t.id),Hb=(t,e)=>{const n=zi(t.meta,Hb,cl),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<Gt(r,s)&&or(t,Pe(s,i))}),mo(t,e.ds,i=>{}),n.add(e))};class X_{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const wd=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},Gt=(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},Q_=(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 In()}n.push(e)},li=(t,e)=>{let n=0,r=t.length-1,i=t[r],s=i.id.clock;if(s===e)return r;let l=si(e/(s+i.length-1)*r);for(;n<=r;){if(i=t[l],s=i.id.clock,s<=e){if(e<s+i.length)return l;n=l+1}else r=l-1;l=si((n+r)/2)}throw In()},G5=(t,e)=>{const n=t.clients.get(e.client);return n[li(n,e.clock)]},Ta=G5,Vb=(t,e,n)=>{const r=li(e,n),i=e[r];return i.id.clock<n&&i instanceof Et?(e.splice(r+1,0,dp(t,i,n-i.id.clock)),r+1):r},or=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Vb(t,n,e.clock)]},hT=(t,e,n)=>{const r=e.clients.get(n.client),i=li(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==qr&&r.splice(i+1,0,dp(t,s,n.clock-s.id.clock+1)),s},Z5=(t,e,n)=>{const r=t.clients.get(e.id.client);r[li(r,e.id.clock)]=n},eD=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let l=Vb(t,e,n),c;do c=e[l++],s<c.id.clock+c.length&&Vb(t,e,s),i(c);while(l<e.length&&e[l].id.clock<s)};class J5{constructor(e,n,r){this.doc=e,this.deleteSet=new ec,this.beforeState=wd(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 pT=(t,e)=>e.deleteSet.clients.size===0&&!_B(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(y1(e.deleteSet),L5(t,e),nc(t,e.deleteSet),!0),mT=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&zi(t.changed,e,cl).add(n)},Ch=(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 Et&&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},X5=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const s=e.clients.get(r);for(let l=i.length-1;l>=0;l--){const c=i[l],d=c.clock+c.len;for(let f=li(s,c.clock),p=s[f];f<s.length&&p.id.clock<d;p=s[++f]){const m=s[f];if(c.clock+c.len<=m.id.clock)break;m instanceof Et&&m.deleted&&!m.keep&&n(m)&&m.gc(e,!1)}}}},Q5=(t,e)=>{t.clients.forEach((n,r)=>{const i=e.clients.get(r);for(let s=n.length-1;s>=0;s--){const l=n[s],c=ps(i.length-1,1+li(i,l.clock+l.len-1));for(let d=c,f=i[d];d>0&&f.id.clock>=l.clock;f=i[d])d-=1+Ch(i,d)}})},tD=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,l=n._mergeStructs;try{y1(s),n.afterState=wd(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const c=[];n.changed.forEach((d,f)=>c.push(()=>{(f._item===null||!f._item.deleted)&&f._callObserver(n,d)})),c.push(()=>{n.changedParentTypes.forEach((d,f)=>{f._dEH.l.length>0&&(f._item===null||!f._item.deleted)&&(d=d.filter(p=>p.target._item===null||!p.target._item.deleted),d.forEach(p=>{p.currentTarget=f,p._path=null}),d.sort((p,m)=>p.path.length-m.path.length),c.push(()=>{Z_(f._dEH,d,n)}))}),c.push(()=>r.emit("afterTransaction",[n,r])),c.push(()=>{n._needFormattingCleanup&&vU(n)})}),u1(c,[])}finally{r.gc&&X5(s,i,r.gcFilter),Q5(s,i),n.afterState.forEach((p,m)=>{const g=n.beforeState.get(m)||0;if(g!==p){const b=i.clients.get(m),v=oi(li(b,g),1);for(let w=b.length-1;w>=v;)w-=1+Ch(b,w)}});for(let p=l.length-1;p>=0;p--){const{client:m,clock:g}=l[p].id,b=i.clients.get(m),v=li(b,g);v+1<b.length&&Ch(b,v+1)>1||v>0&&Ch(b,v)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(M5(g1,z_,"[yjs] ",L_,j_,"Changed the client-id because another client seems to be using it."),r.clientID=$_()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const p=new Sd;pT(p,n)&&r.emit("update",[p.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const p=new ul;pT(p,n)&&r.emit("updateV2",[p.toUint8Array(),n.origin,r,n])}const{subdocsAdded:c,subdocsLoaded:d,subdocsRemoved:f}=n;(c.size>0||f.size>0||d.size>0)&&(c.forEach(p=>{p.clientID=r.clientID,p.collectionid==null&&(p.collectionid=r.collectionid),r.subdocs.add(p)}),f.forEach(p=>r.subdocs.delete(p)),r.emit("subdocs",[{loaded:d,added:c,removed:f},r,n]),f.forEach(p=>p.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):tD(t,e+1)}}},St=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,l=null;t._transaction===null&&(s=!0,t._transaction=new J5(t,n,r),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{l=e(t._transaction)}finally{if(s){const c=t._transaction===i[0];t._transaction=null,c&&tD(i,0)}}return l};class eU{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const gT=(t,e,n)=>{mo(t,n.deletions,r=>{r instanceof Et&&e.scope.some(i=>i===t.doc||nd(i,r))&&M1(r,!1)})},yT=(t,e,n)=>{let r=null;const i=t.doc,s=t.scope;St(i,c=>{for(;e.length>0&&t.currStackItem===null;){const d=i.store,f=e.pop(),p=new Set,m=[];let g=!1;mo(c,f.insertions,b=>{if(b instanceof Et){if(b.redone!==null){let{item:v,diff:w}=$b(d,b.id);w>0&&(v=or(c,Pe(v.id.client,v.id.clock+w))),b=v}!b.deleted&&s.some(v=>v===c.doc||nd(v,b))&&m.push(b)}}),mo(c,f.deletions,b=>{b instanceof Et&&s.some(v=>v===c.doc||nd(v,b))&&!tc(f.insertions,b.id)&&p.add(b)}),p.forEach(b=>{g=SD(c,b,p,f.insertions,t.ignoreRemoteMapChanges,t)!==null||g});for(let b=m.length-1;b>=0;b--){const v=m[b];t.deleteFilter(v)&&(v.delete(c),g=!0)}t.currStackItem=g?f:null}c.changed.forEach((d,f)=>{d.has(null)&&f._searchMarker&&(f._searchMarker.length=0)}),r=c},t);const l=t.currStackItem;if(l!=null){const c=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:l,type:n,changedParentTypes:c,origin:t},t]),t.currStackItem=null}return l};class nD extends s_{constructor(e,{captureTimeout:n=500,captureTransaction:r=d=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:l=!1,doc:c=Ha(e)?e[0].doc:e instanceof Ri?e:e.doc}={}){super(),this.scope=[],this.doc=c,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=l,this.captureTimeout=n,this.afterTransactionHandler=d=>{if(!this.captureTransaction(d)||!this.scope.some(C=>d.changedParentTypes.has(C)||C===this.doc)||!this.trackedOrigins.has(d.origin)&&(!d.origin||!this.trackedOrigins.has(d.origin.constructor)))return;const f=this.undoing,p=this.redoing,m=f?this.redoStack:this.undoStack;f?this.stopCapturing():p||this.clear(!1,!0);const g=new ec;d.afterState.forEach((C,E)=>{const I=d.beforeState.get(E)||0,j=C-I;j>0&&ed(g,E,I,j)});const b=m6();let v=!1;if(this.lastChange>0&&b-this.lastChange<this.captureTimeout&&m.length>0&&!f&&!p){const C=m[m.length-1];C.deletions=Bb([C.deletions,d.deleteSet]),C.insertions=Bb([C.insertions,g])}else m.push(new eU(d.deleteSet,g)),v=!0;!f&&!p&&(this.lastChange=b),mo(d,d.deleteSet,C=>{C instanceof Et&&this.scope.some(E=>E===d.doc||nd(E,C))&&M1(C,!0)});const w=[{stackItem:m[m.length-1],origin:d.origin,type:f?"redo":"undo",changedParentTypes:d.changedParentTypes},this];v?this.emit("stack-item-added",w):this.emit("stack-item-updated",w)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=Ha(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof gn?r.doc!==this.doc:r!==this.doc)&&B_("[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=>gT(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>gT(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=yT(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=yT(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*tU(t){const e=Ze(t.restDecoder);for(let n=0;n<e;n++){const r=Ze(t.restDecoder),i=t.readClient();let s=Ze(t.restDecoder);for(let l=0;l<r;l++){const c=t.readInfo();if(c===10){const d=Ze(t.restDecoder);yield new Yr(Pe(i,s),d),s+=d}else if((dm&c)!==0){const d=(c&(ms|qn))===0,f=new Et(Pe(i,s),null,(c&qn)===qn?t.readLeftID():null,null,(c&ms)===ms?t.readRightID():null,d?t.readParentInfo()?t.readString():t.readLeftID():null,d&&(c&Gu)===Gu?t.readString():null,wD(t,c));yield f,s+=f.length}else{const d=t.readLen();yield new qr(Pe(i,s),d),s+=d}}}}class S1{constructor(e,n){this.gen=tU(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===Yr);return this.curr}}class w1{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const nU=t=>op(t,q_,Sd),rU=(t,e)=>{if(t.constructor===qr){const{client:n,clock:r}=t.id;return new qr(Pe(n,r+e),t.length-e)}else if(t.constructor===Yr){const{client:n,clock:r}=t.id;return new Yr(Pe(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new Et(Pe(r,i+e),null,Pe(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},op=(t,e=qa,n=ul)=>{if(t.length===1)return t[0];const r=t.map(p=>new e(Ja(p)));let i=r.map(p=>new S1(p,!0)),s=null;const l=new n,c=new w1(l);for(;i=i.filter(g=>g.curr!==null),i.sort((g,b)=>{if(g.curr.id.client===b.curr.id.client){const v=g.curr.id.clock-b.curr.id.clock;return v===0?g.curr.constructor===b.curr.constructor?0:g.curr.constructor===Yr?1:-1:v}else return b.curr.id.client-g.curr.id.client}),i.length!==0;){const p=i[0],m=p.curr.id.client;if(s!==null){let g=p.curr,b=!1;for(;g!==null&&g.id.clock+g.length<=s.struct.id.clock+s.struct.length&&g.id.client>=s.struct.id.client;)g=p.next(),b=!0;if(g===null||g.id.client!==m||b&&g.id.clock>s.struct.id.clock+s.struct.length)continue;if(m!==s.struct.id.client)Js(c,s.struct,s.offset),s={struct:g,offset:0},p.next();else if(s.struct.id.clock+s.struct.length<g.id.clock)if(s.struct.constructor===Yr)s.struct.length=g.id.clock+g.length-s.struct.id.clock;else{Js(c,s.struct,s.offset);const v=g.id.clock-s.struct.id.clock-s.struct.length;s={struct:new Yr(Pe(m,s.struct.id.clock+s.struct.length),v),offset:0}}else{const v=s.struct.id.clock+s.struct.length-g.id.clock;v>0&&(s.struct.constructor===Yr?s.struct.length-=v:g=rU(g,v)),s.struct.mergeWith(g)||(Js(c,s.struct,s.offset),s={struct:g,offset:0},p.next())}}else s={struct:p.curr,offset:0},p.next();for(let g=p.curr;g!==null&&g.id.client===m&&g.id.clock===s.struct.id.clock+s.struct.length&&g.constructor!==Yr;g=p.next())Js(c,s.struct,s.offset),s={struct:g,offset:0}}s!==null&&(Js(c,s.struct,s.offset),s=null),k1(c);const d=r.map(p=>b1(p)),f=Bb(d);return nc(l,f),l.toUint8Array()},iU=(t,e,n=qa,r=ul)=>{const i=W_(e),s=new r,l=new w1(s),c=new n(Ja(t)),d=new S1(c,!1);for(;d.curr;){const p=d.curr,m=p.id.client,g=i.get(m)||0;if(d.curr.constructor===Yr){d.next();continue}if(p.id.clock+p.length>g)for(Js(l,p,oi(g-p.id.clock,0)),d.next();d.curr&&d.curr.id.client===m;)Js(l,d.curr,0),d.next();else for(;d.curr&&d.curr.id.client===m&&d.curr.id.clock+d.curr.length<=g;)d.next()}k1(l);const f=b1(c);return nc(s,f),s.toUint8Array()},rD=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:ii(t.encoder.restEncoder)}),t.encoder.restEncoder=xd(),t.written=0)},Js=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&rD(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),st(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},k1=t=>{rD(t);const e=t.encoder.restEncoder;st(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];st(e,r.written),fm(e,r.restEncoder)}},sU=(t,e,n,r)=>{const i=new n(Ja(t)),s=new S1(i,!1),l=new r,c=new w1(l);for(let f=s.curr;f!==null;f=s.next())Js(c,e(f),0);k1(c);const d=b1(i);return nc(l,d),l.toUint8Array()},oU=t=>sU(t,E6,qa,Sd),bT="You must not compute changes after the event-handler fired.";class vm{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=lU(this.currentTarget,this.target))}deletes(e){return tc(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Di(bT);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const s=n._map.get(i);let l,c;if(this.adds(s)){let d=s.left;for(;d!==null&&this.adds(d);)d=d.left;if(this.deletes(s))if(d!==null&&this.deletes(d))l="delete",c=h0(d.content.getContent());else return;else d!==null&&this.deletes(d)?(l="update",c=h0(d.content.getContent())):(l="add",c=void 0)}else if(this.deletes(s))l="delete",c=h0(s.content.getContent());else return;e.set(i,{action:l,oldValue:c})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Di(bT);const n=this.target,r=cl(),i=cl(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let c=null;const d=()=>{c&&s.push(c)};for(let f=n._start;f!==null;f=f.right)f.deleted?this.deletes(f)&&!this.adds(f)&&((c===null||c.delete===void 0)&&(d(),c={delete:0}),c.delete+=f.length,i.add(f)):this.adds(f)?((c===null||c.insert===void 0)&&(d(),c={insert:[]}),c.insert=c.insert.concat(f.content.getContent()),r.add(f)):((c===null||c.retain===void 0)&&(d(),c={retain:0}),c.retain+=f.length);c!==null&&c.retain===void 0&&d()}this._changes=e}return e}}const lU=(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},zn=()=>{B_("Invalid access: Add Yjs type to a document before reading data.")},iD=80;let C1=0;class aU{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=C1++}}const cU=t=>{t.timestamp=C1++},sD=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=C1++},uU=(t,e,n)=>{if(t.length>=iD){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return sD(r,e,n),r}else{const r=new aU(e,n);return t.push(r),r}},Sm=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((s,l)=>vh(e-s.index)<vh(e-l.index)?s:l);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,cU(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&&vh(n.index-i)<r.parent.length/iD?(sD(n,r,i),n):uU(t._searchMarker,r,i)},id=(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=oi(e,i.index+n))}},wm=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;zi(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;Z_(r._eH,n,e)};class gn{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=cT(),this._dEH=cT(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw Jr()}clone(){throw Jr()}_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){uT(this._eH,e)}observeDeep(e){uT(this._dEH,e)}unobserve(e){dT(this._eH,e)}unobserveDeep(e){dT(this._dEH,e)}toJSON(){}}const oD=(t,e,n)=>{t.doc??zn(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let s=t._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const l=s.content.getContent();if(l.length<=e)e-=l.length;else{for(let c=e;c<l.length&&r>0;c++)i.push(l[c]),r--;e=0}}s=s.right}return i},lD=t=>{t.doc??zn();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},aD=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&$o(r,e)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},sd=(t,e)=>{let n=0,r=t._start;for(t.doc??zn();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}},cD=(t,e)=>{const n=[];return sd(t,(r,i)=>{n.push(e(r,i,t))}),n},dU=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}}}},uD=(t,e)=>{t.doc??zn();const n=Sm(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}},lp=(t,e,n,r)=>{let i=n;const s=t.doc,l=s.clientID,c=s.store,d=n===null?e._start:n.right;let f=[];const p=()=>{f.length>0&&(i=new Et(Pe(l,Gt(c,l)),i,i&&i.lastId,d,d&&d.id,e,null,new fl(f)),i.integrate(t,0),f=[])};r.forEach(m=>{if(m===null)f.push(m);else switch(m.constructor){case Number:case Object:case Boolean:case Array:case String:f.push(m);break;default:switch(p(),m.constructor){case Uint8Array:case ArrayBuffer:i=new Et(Pe(l,Gt(c,l)),i,i&&i.lastId,d,d&&d.id,e,null,new kd(new Uint8Array(m))),i.integrate(t,0);break;case Ri:i=new Et(Pe(l,Gt(c,l)),i,i&&i.lastId,d,d&&d.id,e,null,new Cd(m)),i.integrate(t,0);break;default:if(m instanceof gn)i=new Et(Pe(l,Gt(c,l)),i,i&&i.lastId,d,d&&d.id,e,null,new ui(m)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),p()},dD=()=>Di("Length exceeded!"),fD=(t,e,n,r)=>{if(n>e._length)throw dD();if(n===0)return e._searchMarker&&id(e._searchMarker,n,r.length),lp(t,e,null,r);const i=n,s=Sm(e,n);let l=e._start;for(s!==null&&(l=s.p,n-=s.index,n===0&&(l=l.prev,n+=l&&l.countable&&!l.deleted?l.length:0));l!==null;l=l.right)if(!l.deleted&&l.countable){if(n<=l.length){n<l.length&&or(t,Pe(l.id.client,l.id.clock+n));break}n-=l.length}return e._searchMarker&&id(e._searchMarker,i,r.length),lp(t,e,l,r)},fU=(t,e,n)=>{let i=(e._searchMarker||[]).reduce((s,l)=>l.index>s.index?l:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return lp(t,e,i,n)},hD=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,l=Sm(e,n);let c=e._start;for(l!==null&&(c=l.p,n-=l.index);c!==null&&n>0;c=c.right)!c.deleted&&c.countable&&(n<c.length&&or(t,Pe(c.id.client,c.id.clock+n)),n-=c.length);for(;r>0&&c!==null;)c.deleted||(r<c.length&&or(t,Pe(c.id.client,c.id.clock+r)),c.delete(t),r-=c.length),c=c.right;if(r>0)throw dD();e._searchMarker&&id(e._searchMarker,i,-s+r)},ap=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},E1=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,l=s.clientID;let c;if(r==null)c=new fl([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new fl([r]);break;case Uint8Array:c=new kd(r);break;case Ri:c=new Cd(r);break;default:if(r instanceof gn)c=new ui(r);else throw new Error("Unexpected content type")}new Et(Pe(l,Gt(s.store,l)),i,i&&i.lastId,null,null,e,n,c).integrate(t,0)},T1=(t,e)=>{t.doc??zn();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},pD=t=>{const e={};return t.doc??zn(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},mD=(t,e)=>{t.doc??zn();const n=t._map.get(e);return n!==void 0&&!n.deleted},hU=(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&&$o(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},Jf=t=>(t.doc??zn(),O5(t._map.entries(),e=>!e[1].deleted));class pU extends vm{}class Aa extends gn{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new Aa;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Aa}clone(){const e=new Aa;return e.insert(0,this.toArray().map(n=>n instanceof gn?n.clone():n)),e}get length(){return this.doc??zn(),this._length}_callObserver(e,n){super._callObserver(e,n),wm(this,e,new pU(this,e))}insert(e,n){this.doc!==null?St(this.doc,r=>{fD(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?St(this.doc,n=>{fU(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?St(this.doc,r=>{hD(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return uD(this,e)}toArray(){return lD(this)}slice(e=0,n=this.length){return oD(this,e,n)}toJSON(){return this.map(e=>e instanceof gn?e.toJSON():e)}map(e){return cD(this,e)}forEach(e){sd(this,e)}[Symbol.iterator](){return dU(this)}_write(e){e.writeTypeRef(UU)}}const mU=t=>new Aa;class gU extends vm{constructor(e,n,r){super(e,n),this.keysChanged=r}}class Ya extends gn{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 Ya}clone(){const e=new Ya;return this.forEach((n,r)=>{e.set(r,n instanceof gn?n.clone():n)}),e}_callObserver(e,n){wm(this,e,new gU(this,e,n))}toJSON(){this.doc??zn();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof gn?i.toJSON():i}}),e}get size(){return[...Jf(this)].length}keys(){return v0(Jf(this),e=>e[0])}values(){return v0(Jf(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return v0(Jf(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??zn(),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?St(this.doc,n=>{ap(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?St(this.doc,r=>{E1(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return T1(this,e)}has(e){return mD(this,e)}clear(){this.doc!==null?St(this.doc,e=>{this.forEach(function(n,r,i){ap(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(HU)}}const yU=t=>new Ya,ro=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&k6(t,e);class Pb{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){switch(this.right===null&&In(),this.right.content.constructor){case sn:this.right.deleted||rc(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 xT=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case sn:e.right.deleted||rc(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&or(t,Pe(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},Xf=(t,e,n,r)=>{const i=new Map,s=r?Sm(e,n):null;if(s){const l=new Pb(s.p.left,s.p,s.index,i);return xT(t,l,n-s.index)}else{const l=new Pb(null,e._start,0,i);return xT(t,l,n)}},gD=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===sn&&ro(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=t.doc,s=i.clientID;r.forEach((l,c)=>{const d=n.left,f=n.right,p=new Et(Pe(s,Gt(i.store,s)),d,d&&d.lastId,f,f&&f.id,e,null,new sn(c,l));p.integrate(t,0),n.right=p,n.forward()})},rc=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},yD=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===sn&&ro(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},bD=(t,e,n,r)=>{const i=t.doc,s=i.clientID,l=new Map;for(const c in r){const d=r[c],f=n.currentAttributes.get(c)??null;if(!ro(f,d)){l.set(c,f);const{left:p,right:m}=n;n.right=new Et(Pe(s,Gt(i.store,s)),p,p&&p.lastId,m,m&&m.id,e,null,new sn(c,d)),n.right.integrate(t,0),n.forward()}}return l},k0=(t,e,n,r,i)=>{n.currentAttributes.forEach((g,b)=>{i[b]===void 0&&(i[b]=null)});const s=t.doc,l=s.clientID;yD(n,i);const c=bD(t,e,n,i),d=r.constructor===String?new ai(r):r instanceof gn?new ui(r):new yl(r);let{left:f,right:p,index:m}=n;e._searchMarker&&id(e._searchMarker,n.index,d.getLength()),p=new Et(Pe(l,Gt(s.store,l)),f,f&&f.lastId,p,p&&p.id,e,null,d),p.integrate(t,0),n.right=p,n.index=m,n.forward(),gD(t,e,n,c)},vT=(t,e,n,r,i)=>{const s=t.doc,l=s.clientID;yD(n,i);const c=bD(t,e,n,i);e:for(;n.right!==null&&(r>0||c.size>0&&(n.right.deleted||n.right.content.constructor===sn));){if(!n.right.deleted)switch(n.right.content.constructor){case sn:{const{key:d,value:f}=n.right.content,p=i[d];if(p!==void 0){if(ro(p,f))c.delete(d);else{if(r===0)break e;c.set(d,f)}n.right.delete(t)}else n.currentAttributes.set(d,f);break}default:r<n.right.length&&or(t,Pe(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let d="";for(;r>0;r--)d+=`
|
|
151
|
+
`;n.right=new Et(Pe(l,Gt(s.store,l)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new ai(d)),n.right.integrate(t,0),n.forward()}gD(t,e,n,c)},xD=(t,e,n,r,i)=>{let s=e;const l=Zr();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===sn){const f=s.content;l.set(f.key,f)}s=s.right}let c=0,d=!1;for(;e!==s;){if(n===e&&(d=!0),!e.deleted){const f=e.content;switch(f.constructor){case sn:{const{key:p,value:m}=f,g=r.get(p)??null;(l.get(p)!==f||g===m)&&(e.delete(t),c++,!d&&(i.get(p)??null)===m&&g!==m&&(g===null?i.delete(p):i.set(p,g))),!d&&!e.deleted&&rc(i,f);break}}}e=e.right}return c},bU=(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===sn){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},xU=t=>{let e=0;return St(t.doc,n=>{let r=t._start,i=t._start,s=Zr();const l=Rb(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case sn:rc(l,i.content);break;default:e+=xD(n,r,i,s,l),s=Rb(l),r=i;break}i=i.right}}),e},vU=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&&eD(t,n.store.clients.get(r),s,i,l=>{!l.deleted&&l.content.constructor===sn&&l.constructor!==qr&&e.add(l.parent)})}St(n,r=>{mo(t,t.deleteSet,i=>{if(i instanceof qr||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===sn?e.add(s):bU(r,i)});for(const i of e)xU(i)})},ST=(t,e,n)=>{const r=n,i=Rb(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case ui:case yl:case ai:n<e.right.length&&or(t,Pe(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&xD(t,s,e.right,i,e.currentAttributes);const l=(e.left||e.right).parent;return l._searchMarker&&id(l._searchMarker,e.index,-r+n),e};class SU extends vm{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=[];St(e,r=>{const i=new Map,s=new Map;let l=this.target._start,c=null;const d={};let f="",p=0,m=0;const g=()=>{if(c!==null){let b=null;switch(c){case"delete":m>0&&(b={delete:m}),m=0;break;case"insert":(typeof f=="object"||f.length>0)&&(b={insert:f},i.size>0&&(b.attributes={},i.forEach((v,w)=>{v!==null&&(b.attributes[w]=v)}))),f="";break;case"retain":p>0&&(b={retain:p},w6(d)||(b.attributes=v6({},d))),p=0;break}b&&n.push(b),c=null}};for(;l!==null;){switch(l.content.constructor){case ui:case yl:this.adds(l)?this.deletes(l)||(g(),c="insert",f=l.content.getContent()[0],g()):this.deletes(l)?(c!=="delete"&&(g(),c="delete"),m+=1):l.deleted||(c!=="retain"&&(g(),c="retain"),p+=1);break;case ai:this.adds(l)?this.deletes(l)||(c!=="insert"&&(g(),c="insert"),f+=l.content.str):this.deletes(l)?(c!=="delete"&&(g(),c="delete"),m+=l.length):l.deleted||(c!=="retain"&&(g(),c="retain"),p+=l.length);break;case sn:{const{key:b,value:v}=l.content;if(this.adds(l)){if(!this.deletes(l)){const w=i.get(b)??null;ro(w,v)?v!==null&&l.delete(r):(c==="retain"&&g(),ro(v,s.get(b)??null)?delete d[b]:d[b]=v)}}else if(this.deletes(l)){s.set(b,v);const w=i.get(b)??null;ro(w,v)||(c==="retain"&&g(),d[b]=w)}else if(!l.deleted){s.set(b,v);const w=d[b];w!==void 0&&(ro(w,v)?w!==null&&l.delete(r):(c==="retain"&&g(),v===null?delete d[b]:d[b]=v))}l.deleted||(c==="insert"&&g(),rc(i,l.content));break}}l=l.right}for(g();n.length>0;){const b=n[n.length-1];if(b.retain!==void 0&&b.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class go extends gn{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??zn(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new go}clone(){const e=new go;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new SU(this,e,n);wm(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??zn();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===ai&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?St(this.doc,r=>{const i=new Pb(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const l=e[s];if(l.insert!==void 0){const c=!n&&typeof l.insert=="string"&&s===e.length-1&&i.right===null&&l.insert.slice(-1)===`
|
|
152
|
+
`?l.insert.slice(0,-1):l.insert;(typeof c!="string"||c.length>0)&&k0(r,this,i,c,l.attributes||{})}else l.retain!==void 0?vT(r,this,i,l.retain,l.attributes||{}):l.delete!==void 0&&ST(r,i,l.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??zn();const i=[],s=new Map,l=this.doc;let c="",d=this._start;function f(){if(c.length>0){const m={};let g=!1;s.forEach((v,w)=>{g=!0,m[w]=v});const b={insert:c};g&&(b.attributes=m),i.push(b),c=""}}const p=()=>{for(;d!==null;){if($o(d,e)||n!==void 0&&$o(d,n))switch(d.content.constructor){case ai:{const m=s.get("ychange");e!==void 0&&!$o(d,e)?(m===void 0||m.user!==d.id.client||m.type!=="removed")&&(f(),s.set("ychange",r?r("removed",d.id):{type:"removed"})):n!==void 0&&!$o(d,n)?(m===void 0||m.user!==d.id.client||m.type!=="added")&&(f(),s.set("ychange",r?r("added",d.id):{type:"added"})):m!==void 0&&(f(),s.delete("ychange")),c+=d.content.str;break}case ui:case yl:{f();const m={insert:d.content.getContent()[0]};if(s.size>0){const g={};m.attributes=g,s.forEach((b,v)=>{g[v]=b})}i.push(m);break}case sn:$o(d,e)&&(f(),rc(s,d.content));break}d=d.right}f()};return e||n?St(l,m=>{e&&Hb(m,e),n&&Hb(m,n),p()},"cleanup"):p(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?St(i,s=>{const l=Xf(s,this,e,!r);r||(r={},l.currentAttributes.forEach((c,d)=>{r[d]=c})),k0(s,this,l,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?St(i,s=>{const l=Xf(s,this,e,!r);k0(s,this,l,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?St(r,i=>{ST(i,Xf(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?St(i,s=>{const l=Xf(s,this,e,!1);l.right!==null&&vT(s,this,l,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?St(this.doc,n=>{ap(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?St(this.doc,r=>{E1(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return T1(this,e)}getAttributes(){return pD(this)}_write(e){e.writeTypeRef(VU)}}const wU=t=>new go;class C0{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??zn()}[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===Dn||n.constructor===dl)&&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 dl extends gn{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 dl}clone(){const e=new dl;return e.insert(0,this.toArray().map(n=>n instanceof gn?n.clone():n)),e}get length(){return this.doc??zn(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new C0(this,e)}querySelector(e){e=e.toUpperCase();const r=new C0(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),po(new C0(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){wm(this,e,new EU(this,n,e))}toString(){return cD(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),sd(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?St(this.doc,r=>{fD(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)St(this.doc,r=>{const i=e&&e instanceof gn?e._item:e;lp(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 Di("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?St(this.doc,r=>{hD(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return lD(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return uD(this,e)}slice(e=0,n=this.length){return oD(this,e,n)}forEach(e){sd(this,e)}_write(e){e.writeTypeRef($U)}}const kU=t=>new dl;class Dn extends dl{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 Dn(this.nodeName)}clone(){const e=new Dn(this.nodeName),n=this.getAttributes();return S6(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof gn?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 d=r[c];n.push(d+'="'+e[d]+'"')}const s=this.nodeName.toLocaleLowerCase(),l=n.length>0?" "+n.join(" "):"";return`<${s}${l}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?St(this.doc,n=>{ap(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?St(this.doc,r=>{E1(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return T1(this,e)}hasAttribute(e){return mD(this,e)}getAttributes(e){return e?hU(this,e):pD(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const l in s){const c=s[l];typeof c=="string"&&i.setAttribute(l,c)}return sd(this,l=>{i.appendChild(l.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(PU),e.writeKey(this.nodeName)}}const CU=t=>new Dn(t.readKey());class EU extends vm{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 cp extends Ya{constructor(e){super(),this.hookName=e}_copy(){return new cp(this.hookName)}clone(){const e=new cp(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const i=n[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(FU),e.writeKey(this.hookName)}}const TU=t=>new cp(t.readKey());class Yn extends go{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new Yn}clone(){const e=new Yn;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const n=[];for(const i in e.attributes){const s=[];for(const l in e.attributes[i])s.push({key:l,value:e.attributes[i][l]});s.sort((l,c)=>l.key<c.key?-1:1),n.push({nodeName:i,attrs:s})}n.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const s=n[i];r+=`<${s.nodeName}`;for(let l=0;l<s.attrs.length;l++){const c=s.attrs[l];r+=` ${c.key}="${c.value}"`}r+=">"}r+=e.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(qU)}}const AU=t=>new Yn;class A1{constructor(e,n){this.id=e,this.length=n}get deleted(){throw Jr()}mergeWith(e){return!1}write(e,n,r){throw Jr()}integrate(e,n){throw Jr()}}const MU=0;class qr extends A1{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),Q_(e.doc.store,this)}write(e,n){e.writeInfo(MU),e.writeLen(this.length-n)}getMissing(e,n){return null}}class kd{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new kd(this.content)}splice(e){throw Jr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const OU=t=>new kd(t.readBuf());class od{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new od(this.len)}splice(e){const n=new od(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){ed(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 _U=t=>new od(t.readLen()),vD=(t,e)=>new Ri({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Cd{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 Cd(vD(this.doc.guid,this.opts))}splice(e){throw Jr()}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 DU=t=>new Cd(vD(t.readString(),t.readAny()));class yl{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new yl(this.embed)}splice(e){throw Jr()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const RU=t=>new yl(t.readJSON());class sn{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new sn(this.key,this.value)}splice(e){throw Jr()}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 NU=t=>new sn(t.readKey(),t.readJSON());class up{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new up(this.arr)}splice(e){const n=new up(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 zU=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 up(n)},LU=tp("node_env")==="development";class fl{constructor(e){this.arr=e,LU&&p_(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new fl(this.arr)}splice(e){const n=new fl(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}const jU=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new fl(n)};class ai{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new ai(this.str)}splice(e){const n=new ai(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 IU=t=>new ai(t.readString()),BU=[mU,yU,wU,CU,kU,TU,AU],UU=0,HU=1,VU=2,PU=3,$U=4,FU=5,qU=6;class ui{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new ui(this.type._copy())}splice(e){throw Jr()}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 YU=t=>new ui(BU[t.readTypeRef()](t)),$b=(t,e)=>{let n=e,r=0,i;do r>0&&(n=Pe(n.client,n.clock+r)),i=Ta(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof Et);return{item:i,diff:r}},M1=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},dp=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new Et(Pe(r,i+n),e,Pe(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=Pe(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},wT=(t,e)=>i1(t,n=>tc(n.deletions,e)),SD=(t,e,n,r,i,s)=>{const l=t.doc,c=l.store,d=l.clientID,f=e.redone;if(f!==null)return or(t,f);let p=e.parent._item,m=null,g;if(p!==null&&p.deleted===!0){if(p.redone===null&&(!n.has(p)||SD(t,p,n,r,i,s)===null))return null;for(;p.redone!==null;)p=or(t,p.redone)}const b=p===null?e.parent:p.content.type;if(e.parentSub===null){for(m=e.left,g=e;m!==null;){let E=m;for(;E!==null&&E.parent._item!==p;)E=E.redone===null?null:or(t,E.redone);if(E!==null&&E.parent._item===p){m=E;break}m=m.left}for(;g!==null;){let E=g;for(;E!==null&&E.parent._item!==p;)E=E.redone===null?null:or(t,E.redone);if(E!==null&&E.parent._item===p){g=E;break}g=g.right}}else if(g=null,e.right&&!i){for(m=e;m!==null&&m.right!==null&&(m.right.redone||tc(r,m.right.id)||wT(s.undoStack,m.right.id)||wT(s.redoStack,m.right.id));)for(m=m.right;m.redone;)m=or(t,m.redone);if(m&&m.right!==null)return null}else m=b._map.get(e.parentSub)||null;const v=Gt(c,d),w=Pe(d,v),C=new Et(w,m,m&&m.lastId,g,g&&g.id,b,e.parentSub,e.content.copy());return e.redone=w,M1(C,!0),C.integrate(t,0),C};let Et=class Fb extends A1{constructor(e,n,r,i,s,l,c,d){super(e,d.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=l,this.parentSub=c,this.redone=null,this.content=d,this.info=this.content.isCountable()?ZE:0}set marker(e){(this.info&m0)>0!==e&&(this.info^=m0)}get marker(){return(this.info&m0)>0}get keep(){return(this.info&GE)>0}set keep(e){this.keep!==e&&(this.info^=GE)}get countable(){return(this.info&ZE)>0}get deleted(){return(this.info&p0)>0}set deleted(e){this.deleted!==e&&(this.info^=p0)}markDeleted(){this.info|=p0}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Gt(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Gt(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Ea&&this.id.client!==this.parent.client&&this.parent.clock>=Gt(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=hT(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=or(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===qr||this.right&&this.right.constructor===qr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===Fb?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===Fb&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Ea){const r=Ta(n,this.parent);r.constructor===qr?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=hT(e,e.doc.store,Pe(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,l=new Set;for(;i!==null&&i!==this.right;){if(l.add(i),s.add(i),ba(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(ba(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&l.has(Ta(e.doc.store,i.origin)))s.has(Ta(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),Q_(e.doc.store,this),this.content.integrate(e,this),mT(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new qr(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:Pe(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&ba(e.origin,this.lastId)&&this.right===e&&ba(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(),ed(e.deleteSet,this.id.client,this.id.clock,this.length),mT(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw In();this.content.gc(e),n?Z5(e,this,new qr(this.id,this.length)):this.content=new od(this.length)}write(e,n){const r=n>0?Pe(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,l=this.content.getRef()&dm|(r===null?0:qn)|(i===null?0:ms)|(s===null?0:Gu);if(e.writeInfo(l),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const c=this.parent;if(c._item!==void 0){const d=c._item;if(d===null){const f=td(c);e.writeParentInfo(!0),e.writeString(f)}else e.writeParentInfo(!1),e.writeLeftID(d.id)}else c.constructor===String?(e.writeParentInfo(!0),e.writeString(c)):c.constructor===Ea?(e.writeParentInfo(!1),e.writeLeftID(c)):In();s!==null&&e.writeString(s)}this.content.write(e,n)}};const wD=(t,e)=>KU[e&dm](t),KU=[()=>{In()},_U,zU,OU,IU,RU,NU,YU,jU,DU,()=>{In()}],WU=10;class Yr extends A1{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){In()}write(e,n){e.writeInfo(WU),st(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const kD=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},CD="__ $YJS$ __";kD[CD]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");kD[CD]=!0;const GU=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},ZU=/[\uD800-\uDBFF]/,JU=/[\uDC00-\uDFFF]/,XU=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&ZU.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&&JU.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},QU=XU,Lt=new Rt("y-sync"),Ti=new Rt("y-undo"),Qf=new Rt("yjs-cursor"),Ai=(t,e)=>t>>>e|t<<32-e,eH=t=>Ai(t,2)^Ai(t,13)^Ai(t,22),tH=t=>Ai(t,6)^Ai(t,11)^Ai(t,25),nH=t=>Ai(t,7)^Ai(t,18)^t>>>3,rH=t=>Ai(t,17)^Ai(t,19)^t>>>10,iH=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]),sH=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class oH{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(sH),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let m=16;m<64;m++)n[m]=rH(n[m-2])+n[m-7]+nH(n[m-15])+n[m-16];let r=e[0],i=e[1],s=e[2],l=e[3],c=e[4],d=e[5],f=e[6],p=e[7];for(let m=0,g,b;m<64;m++)g=p+tH(c)+(c&d^~c&f)+iH[m]+n[m]>>>0,b=eH(r)+(r&i^r&s^i&s)>>>0,p=f,f=d,d=c,c=l+g>>>0,l=s,s=i,i=r,r=g+b>>>0;e[0]+=r,e[1]+=i,e[2]+=s,e[3]+=l,e[4]+=c,e[5]+=d,e[6]+=f,e[7]+=p}digest(e){let n=0;for(;n+56<=e.length;){let l=0;for(;l<16&&n+3<e.length;l++)this._W[l]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,l,16);n<e.length;)this._W[l]|=e[n]<<(3-n%4)*8,n++;this._W[l]|=qn<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<e.length;i++)for(let l=3;l>=0&&n<e.length;l--)this._W[i]|=e[n++]<<l*8;r||(this._W[i-(n%4===0?0:1)]|=qn<<(3-n%4)*8),this._W[14]=e.byteLength/NB,this._W[15]=e.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let l=0;l<this._H.length;l++)for(let c=0;c<4;c++)s[l*4+c]=this._H[l]>>>(3-c)*8;return s}}const lH=t=>new oH().digest(t),aH=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},cH=t=>z6(aH(lH(j6(t)))),fp=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!tc(e.ds,t.id),uH=[{light:"#ecd44433",dark:"#ecd444"}],dH=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=cl();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,f6(e))}return t.get(n)},fH=(t,{colors:e=uH,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let l=!1;const c=new pH(t,s),d=new xt({props:{editable:f=>{const p=Lt.getState(f);return p.snapshot==null&&p.prevSnapshot==null}},key:Lt,state:{init:(f,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:(f,p)=>{const m=f.getMeta(Lt);if(m!==void 0){p=Object.assign({},p);for(const g in m)p[g]=m[g]}return p.addToHistory=f.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)&&m1(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:f=>(c.initView(f),s==null&&c._forceRerender(),i(),{update:()=>{const p=d.getState(f.state);if(p.snapshot==null&&p.prevSnapshot==null&&(l||f.state.doc.content.findDiffStart(f.state.doc.type.createAndFill().content)!==null)){if(l=!0,p.addToHistory===!1&&!p.isChangeOrigin){const m=Ti.getState(f.state),g=m&&m.undoManager;g&&g.stopCapturing()}c.mux(()=>{p.doc.transact(m=>{m.meta.set("addToHistory",p.addToHistory),c._prosemirrorChanged(f.state.doc)},Lt)})}},destroy:()=>{c.destroy()}})});return d},hH=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new lr(t.doc));else if(e.type==="node"){const r=Ma(n.doc,n.type,e.anchor,n.mapping);t.setSelection(Te.create(t.doc,r))}else{const r=Ma(n.doc,n.type,e.anchor,n.mapping),i=Ma(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const s=_e.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(s)}}},qb=(t,e)=>({type:e.selection.jsonID,anchor:pp(e.selection.anchor,t.type,t.mapping),head:pp(e.selection.head,t.type,t.mapping)});class pH{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=GU(),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=qb(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()?(g_&&this._domSelectionInView===null&&(m1(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=vd.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=J_(V_(),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=>Eh(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ye(ne.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=>Eh(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ye(ne.from(n),0,0));if(e){const i=ps(oi(e.anchor,0),r.doc.content.size),s=ps(oi(e.head,0),r.doc.content.size);r.setSelection(_e.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(Lt,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc,s=this.type;if(e||(e=w0(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&In(),i=new Ri({gc:!1}),sp(i,n),n=w0(i),sp(i,e),e=w0(i),s._item===null){const l=Array.from(this.doc.share.keys()).find(c=>this.doc.share.get(c)===this.type);s=i.getXmlFragment(l)}else{const l=i.store.clients.get(s._item.id.client)??[],c=li(l,s._item.id.clock);s=l[c].content.type}this.mapping.clear(),this.mux(()=>{i.transact(l=>{const c=r.permanentUserData;c&&c.dss.forEach(m=>{mo(l,m,g=>{})});const d=(m,g)=>{const b=m==="added"?c.getUserByClientId(g.client):c.getUserByDeletedId(g);return{user:b,type:m,color:dH(r.colorMapping,r.colors,b)}},f=aD(s,new v1(n.ds,e.sv)).map(m=>!m._item.deleted||fp(m._item,e)||fp(m._item,n)?Eh(m,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,d):null).filter(m=>m!==null),p=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ye(ne.from(f),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,d)=>this.mapping.delete(d);mo(n,n.deleteSet,c=>{if(c.constructor===Et){const d=c.content.type;d&&this.mapping.delete(d)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(c=>ED(c,this.prosemirrorView.state.schema,this)).filter(c=>c!==null);let l=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ye(ne.from(s),0,0));hH(l,this.beforeTransactionSelection,this),l=l.setMeta(Lt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof nD}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&l.scrollIntoView(),this.prosemirrorView.dispatch(l)})}_prosemirrorChanged(e){this.doc.transact(()=>{Kb(this.doc,this.type,e,this),this.beforeTransactionSelection=qb(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 ED=(t,e,n,r,i,s)=>{const l=n.mapping.get(t);if(l===void 0){if(t instanceof Dn)return Eh(t,e,n,r,i,s);throw Jr()}return l},Eh=(t,e,n,r,i,s)=>{const l=[],c=d=>{var f,p;if(d instanceof Dn){const m=ED(d,e,n,r,i,s);m!==null&&l.push(m)}else{const m=(p=(f=d._item.right)==null?void 0:f.content)==null?void 0:p.type;m instanceof go&&!m._item.deleted&&m._item.id.client===m.doc.clientID&&(d.applyDelta([{retain:d.length},...m.toDelta()]),m.doc.transact(b=>{m._item.delete(b)}));const g=mH(d,e,n,r,i,s);g!==null&&g.forEach(b=>{b!==null&&l.push(b)})}};r===void 0||i===void 0?t.toArray().forEach(c):aD(t,new v1(i.ds,r.sv)).forEach(c);try{const d=t.getAttributes(r);r!==void 0&&(fp(t._item,r)?fp(t._item,i)||(d.ychange=s?s("added",t._item.id):{type:"added"}):d.ychange=s?s("removed",t._item.id):{type:"removed"});const f=e.node(t.nodeName,d,l);return n.mapping.set(t,f),f}catch{return t.doc.transact(f=>{t._item.delete(f)},Lt),n.mapping.delete(t),null}},mH=(t,e,n,r,i,s)=>{const l=[],c=t.toDelta(r,i,s);try{for(let d=0;d<c.length;d++){const f=c[d];l.push(e.text(f.insert,SH(f.attributes,e)))}}catch{return t.doc.transact(f=>{t._item.delete(f)},Lt),null}return l},gH=(t,e)=>{const n=new Yn,r=t.map(i=>({insert:i.text,attributes:AD(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},yH=(t,e)=>{const n=new Dn(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,km(t).map(r=>Yb(r,e))),e.mapping.set(n,t),n},Yb=(t,e)=>t instanceof Array?gH(t,e):yH(t,e),kT=t=>typeof t=="object"&&t!==null,O1=(t,e)=>{const n=Object.keys(t).filter(i=>t[i]!==null);let r=n.length===(e==null?0:Object.keys(e).filter(i=>e[i]!==null).length);for(let i=0;i<n.length&&r;i++){const s=n[i],l=t[s],c=e[s];r=s==="ychange"||l===c||kT(l)&&kT(c)&&O1(l,c)}return r},km=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.isText){const s=[];for(let l=e[r];r<e.length&&l.isText;l=e[++r])s.push(l);r--,n.push(s)}else n.push(i)}return n},TD=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&h_(r.attributes||{}).length===e[i].marks.length&&Xa(r.attributes,(s,l)=>{var f;const c=_1(l),d=e[i].marks;return O1(s,(f=d.find(p=>p.type.name===c))==null?void 0:f.attrs)}))},ld=(t,e)=>{if(t instanceof Dn&&!(e instanceof Array)&&Wb(t,e)){const n=km(e);return t._length===n.length&&O1(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>ld(r,n[i]))}return t instanceof Yn&&e instanceof Array&&TD(t,e)},hp=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),CT=(t,e,n)=>{const r=t.toArray(),i=km(e),s=i.length,l=r.length,c=ps(l,s);let d=0,f=0,p=!1;for(;d<c;d++){const m=r[d],g=i[d];if(hp(n.mapping.get(m),g))p=!0;else if(!ld(m,g))break}for(;d+f<c;f++){const m=r[l-f-1],g=i[s-f-1];if(hp(n.mapping.get(m),g))p=!0;else if(!ld(m,g))break}return{equalityFactor:d+f,foundMappedChild:p}},bH=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof ai?e+=n.content.str:n.content instanceof sn&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},xH=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=bH(t),s=e.map(f=>({insert:f.text,attributes:Object.assign({},r,AD(f.marks,n))})),{insert:l,remove:c,index:d}=QU(i,s.map(f=>f.insert).join(""));t.delete(d,c),t.insert(d,l),t.applyDelta(s.map(f=>({retain:f.insert.length,attributes:f.attributes})))},vH=/(.*)(--[a-zA-Z0-9+/=]{8})$/,_1=t=>{var e;return((e=vH.exec(t))==null?void 0:e[1])??t},SH=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(_1(r),t[r]));return n},AD=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=zi(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${cH(r.toJSON())}`:r.type.name]=r.attrs}}),n},Kb=(t,e,n,r)=>{if(e instanceof Dn&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof Dn){const m=e.getAttributes(),g=n.attrs;for(const b in g)g[b]!==null?m[b]!==g[b]&&b!=="ychange"&&e.setAttribute(b,g[b]):e.removeAttribute(b);for(const b in m)g[b]===void 0&&e.removeAttribute(b)}const i=km(n),s=i.length,l=e.toArray(),c=l.length,d=ps(s,c);let f=0,p=0;for(;f<d;f++){const m=l[f],g=i[f];if(!hp(r.mapping.get(m),g))if(ld(m,g))r.mapping.set(m,g);else break}for(;p+f<d;p++){const m=l[c-p-1],g=i[s-p-1];if(!hp(r.mapping.get(m),g))if(ld(m,g))r.mapping.set(m,g);else break}t.transact(()=>{for(;c-f-p>0&&s-f-p>0;){const g=l[f],b=i[f],v=l[c-p-1],w=i[s-p-1];if(g instanceof Yn&&b instanceof Array)TD(g,b)||xH(g,b,r),f+=1;else{let C=g instanceof Dn&&Wb(g,b),E=v instanceof Dn&&Wb(v,w);if(C&&E){const I=CT(g,b,r),j=CT(v,w,r);I.foundMappedChild&&!j.foundMappedChild?E=!1:!I.foundMappedChild&&j.foundMappedChild||I.equalityFactor<j.equalityFactor?C=!1:E=!1}C?(Kb(t,g,b,r),f+=1):E?(Kb(t,v,w,r),p+=1):(r.mapping.delete(e.get(f)),e.delete(f,1),e.insert(f,[Yb(b,r)]),f+=1)}}const m=c-f-p;if(c===1&&s===0&&l[0]instanceof Yn?(r.mapping.delete(l[0]),l[0].delete(0,l[0].length)):m>0&&(e.slice(f,f+m).forEach(g=>r.mapping.delete(g)),e.delete(f,m)),f+p<s){const g=[];for(let b=f;b<s-p;b++)g.push(Yb(i[b],r));e.insert(f,g)}},Lt)},Wb=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let xu=null;const wH=()=>{const t=xu;xu=null,t.forEach((e,n)=>{const r=n.state.tr,i=Lt.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(e.forEach((s,l)=>{r.setMeta(l,s)}),n.dispatch(r))})},kH=(t,e,n)=>{xu||(xu=new Map,m1(0,wH)),zi(xu,t,Zr).set(e,n)},pp=(t,e,n)=>{if(t===0)return S0(e,0,e.length===0?-1:0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Yn){if(r._length>=t)return S0(r,t,e.length===0?-1:0);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<i)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&i>1)return new rd(r._item===null?null:r._item.id,r._item===null?td(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 rd(r._item===null?null:r._item.id,r._item===null?td(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 In();if(t===0&&r.constructor!==Yn&&r!==e)return CH(r._item.parent,r._item)}return S0(e,e._length,e.length===0?-1:0)},CH=(t,e)=>{let n=null,r=null;return t._item===null?r=td(t):n=Pe(t._item.id.client,t._item.id.clock),new rd(n,r,e.id)},Ma=(t,e,n,r)=>{const i=Ub(n,t);if(i===null||i.type!==e&&!nd(e,i.type._item))return null;let s=i.type,l=0;if(s.constructor===Yn)l=i.index;else if(s._item===null||!s._item.deleted){let c=s._first,d=0;for(;d<s._length&&d<i.index&&c!==null;){if(!c.deleted){const f=c.content.type;d++,f instanceof Yn?l+=f._length:l+=r.get(f).nodeSize}c=c.right}l+=1}for(;s!==e&&s._item!==null;){const c=s._item.parent;if(c._item===null||!c._item.deleted){l+=1;let d=c._first;for(;d!==null;){const f=d.content.type;if(f===s)break;d.deleted||(f instanceof Yn?l+=f._length:l+=r.get(f).nodeSize),d=d.right}}s=c}return l-1};function EH(t){const e=t.toArray(),n=r=>{let i;if(r instanceof Yn)i=r.toDelta().map(l=>{const c={type:"text",text:l.insert};return l.attributes&&(c.marks=Object.keys(l.attributes).map(d=>{const f=l.attributes[d],m={type:_1(d)};return Object.keys(f)&&(m.attrs=f),m})),c});else if(r instanceof Dn){i={type:r.nodeName};const s=r.getAttributes();Object.keys(s).length&&(i.attrs=s);const l=r.toArray();l.length&&(i.content=l.map(n).flat())}else In();return i};return{type:"doc",content:e.map(n)}}const TH=(t,e,n)=>t!==e,AH=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},MD=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),MH=/^#[0-9a-fA-F]{6}$/,ET=(t,e,n,r,i)=>{const s=Lt.getState(t),l=s.doc,c=[];return s.snapshot!=null||s.prevSnapshot!=null||s.binding.mapping.size===0?ut.create(t.doc,[]):(e.getStates().forEach((d,f)=>{if(n(l.clientID,f,d)&&d.cursor!=null){const p=d.user||{};p.color==null?p.color="#ffa500":MH.test(p.color)||console.warn("A user uses an unsupported color format",p),p.name==null&&(p.name=`User: ${f}`);let m=Ma(l,s.type,el(d.cursor.anchor),s.binding.mapping),g=Ma(l,s.type,el(d.cursor.head),s.binding.mapping);if(m!==null&&g!==null){const b=oi(t.doc.content.size-1,0);m=ps(m,b),g=ps(g,b),c.push(Pt.widget(g,()=>r(p,f),{key:f+"",side:10}));const v=ps(m,g),w=oi(m,g);c.push(Pt.inline(v,w,i(p,f),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),ut.create(t.doc,c))},OH=(t,{awarenessStateFilter:e=TH,cursorBuilder:n=AH,selectionBuilder:r=MD,getSelection:i=l=>l.selection}={},s="cursor")=>new xt({key:Qf,state:{init(l,c){return ET(c,t,e,n,r)},apply(l,c,d,f){const p=Lt.getState(f),m=l.getMeta(Qf);return p&&p.isChangeOrigin||m&&m.awarenessUpdated?ET(f,t,e,n,r):c.map(l.mapping,l.doc)}},props:{decorations:l=>Qf.getState(l)},view:l=>{const c=()=>{l.docView&&kH(l,Qf,{awarenessUpdated:!0})},d=()=>{const f=Lt.getState(l.state),p=t.getLocalState()||{};if(l.hasFocus()){const m=i(l.state),g=pp(m.anchor,f.type,f.binding.mapping),b=pp(m.head,f.type,f.binding.mapping);(p.cursor==null||!fT(el(p.cursor.anchor),g)||!fT(el(p.cursor.head),b))&&t.setLocalStateField(s,{anchor:g,head:b})}else p.cursor!=null&&Ma(f.doc,f.type,el(p.cursor.anchor),f.binding.mapping)!==null&&t.setLocalStateField(s,null)};return t.on("change",c),l.dom.addEventListener("focusin",d),l.dom.addEventListener("focusout",d),{update:d,destroy:()=>{l.dom.removeEventListener("focusin",d),l.dom.removeEventListener("focusout",d),t.off("change",c),t.setLocalStateField(s,null)}}}}),_H=t=>{var e,n;return((n=(e=Ti.getState(t))==null?void 0:e.undoManager)==null?void 0:n.undo())!=null},DH=t=>{var e,n;return((n=(e=Ti.getState(t))==null?void 0:e.undoManager)==null?void 0:n.redo())!=null},RH=new Set(["paragraph"]),NH=(t,e)=>!(t instanceof Et)||!(t.content instanceof ui)||!(t.content.type instanceof go||t.content.type instanceof Dn&&e.has(t.content.type.nodeName))||t.content.type._length===0,zH=({protectedNodes:t=RH,trackedOrigins:e=[],undoManager:n=null}={})=>new xt({key:Ti,state:{init:(r,i)=>{const s=Lt.getState(i),l=n||new nD(s.type,{trackedOrigins:new Set([Lt].concat(e)),deleteFilter:c=>NH(c,t),captureTransaction:c=>c.meta.get("addToHistory")!==!1});return{undoManager:l,prevSel:null,hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}},apply:(r,i,s,l)=>{const c=Lt.getState(l).binding,d=i.undoManager,f=d.undoStack.length>0,p=d.redoStack.length>0;return c?{undoManager:d,prevSel:qb(c,s),hasUndoOps:f,hasRedoOps:p}:f!==i.hasUndoOps||p!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:d.undoStack.length>0,hasRedoOps:d.redoStack.length>0}):i}},view:r=>{const i=Lt.getState(r.state),s=Ti.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:l})=>{const c=i.binding;c&&l.meta.set(c,Ti.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:l})=>{const c=i.binding;c&&(c.beforeTransactionSelection=l.meta.get(c)||c.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),LH=Zt.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),Ti.getState(e).undoManager.undoStack.length===0?!1:n?_H(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Ti.getState(e).undoManager.redoStack.length===0?!1:n?DH(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=zH(this.options.yUndoOptions),r=n.spec.view;n.spec.view=l=>{const{undoManager:c}=Ti.getState(l.state);c.restore&&(c.restore(),c.restore=()=>{});const d=r?r(l):void 0;return{destroy:()=>{const f=c.trackedOrigins.has(c),p=c._observers;c.restore=()=>{f&&c.trackedOrigins.add(c),c.doc.on("afterTransaction",c.afterTransactionHandler),c._observers=p},d!=null&&d.destroy&&d.destroy()}}};const i={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},s=fH(e,i);return this.editor.options.enableContentCheck&&((t=e.doc)===null||t===void 0||t.on("beforeTransaction",()=>{try{const l=EH(e);if(l.content.length===0)return;this.editor.schema.nodeFromJSON(l).check()}catch(l){return this.editor.emit("contentError",{error:l,editor:this.editor,disableCollaboration:()=>{var c;(c=e.doc)===null||c===void 0||c.destroy(),this.storage.isDisabled=!0}}),!1}})),[s,n,this.editor.options.enableContentCheck&&new xt({key:new Rt("filterInvalidContent"),filterTransaction:()=>{var l;return this.storage.isDisabled&&((l=e.doc)===null||l===void 0||l.destroy()),!0}})].filter(Boolean)}}),TT=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n.user})),AT=()=>null,jH=Zt.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:MD,onUpdate:AT}},onCreate(){if(this.options.onUpdate!==AT&&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[OH((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=TT(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=TT(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),IH=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,BH=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,UH=_i.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",$t(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[al({find:IH,type:this.type})]},addPasteRules(){return[ho({find:BH,type:this.type})]}}),HH="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",VH="ελ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",Gb="numeric",Zb="ascii",Jb="alpha",vu="asciinumeric",fu="alphanumeric",Xb="domain",OD="emoji",PH="scheme",$H="slashscheme",E0="whitespace";function FH(t,e){return t in e||(e[t]=[]),e[t]}function Wo(t,e,n){e[Gb]&&(e[vu]=!0,e[fu]=!0),e[Zb]&&(e[vu]=!0,e[Jb]=!0),e[vu]&&(e[fu]=!0),e[Jb]&&(e[fu]=!0),e[fu]&&(e[Xb]=!0),e[OD]&&(e[Xb]=!0);for(const r in e){const i=FH(r,n);i.indexOf(t)<0&&i.push(t)}}function qH(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function sr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}sr.groups={};sr.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||sr.groups;let i;return e&&e.j?i=e:(i=new sr(e),n&&r&&Wo(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let l=0;l<s-1;l++)i=i.tt(t[l]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||sr.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let l,c=i.go(t);if(c?(l=new sr,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new sr,s){if(r)if(l.t&&typeof l.t=="string"){const d=Object.assign(qH(l.t,r),n);Wo(s,d,r)}else n&&Wo(s,n,r);l.t=s}return i.j[t]=l,l}};const Ke=(t,e,n,r,i)=>t.ta(e,n,r,i),Ut=(t,e,n,r,i)=>t.tr(e,n,r,i),MT=(t,e,n,r,i)=>t.ts(e,n,r,i),oe=(t,e,n,r,i)=>t.tt(e,n,r,i),as="WORD",Qb="UWORD",_D="ASCIINUMERICAL",DD="ALPHANUMERICAL",ad="LOCALHOST",ex="TLD",tx="UTLD",Th="SCHEME",pa="SLASH_SCHEME",D1="NUM",nx="WS",R1="NL",Su="OPENBRACE",wu="CLOSEBRACE",mp="OPENBRACKET",gp="CLOSEBRACKET",yp="OPENPAREN",bp="CLOSEPAREN",xp="OPENANGLEBRACKET",vp="CLOSEANGLEBRACKET",Sp="FULLWIDTHLEFTPAREN",wp="FULLWIDTHRIGHTPAREN",kp="LEFTCORNERBRACKET",Cp="RIGHTCORNERBRACKET",Ep="LEFTWHITECORNERBRACKET",Tp="RIGHTWHITECORNERBRACKET",Ap="FULLWIDTHLESSTHAN",Mp="FULLWIDTHGREATERTHAN",Op="AMPERSAND",_p="APOSTROPHE",Dp="ASTERISK",Ws="AT",Rp="BACKSLASH",Np="BACKTICK",zp="CARET",Xs="COLON",N1="COMMA",Lp="DOLLAR",xi="DOT",jp="EQUALS",z1="EXCLAMATION",Vr="HYPHEN",ku="PERCENT",Ip="PIPE",Bp="PLUS",Up="POUND",Cu="QUERY",L1="QUOTE",RD="FULLWIDTHMIDDLEDOT",j1="SEMI",vi="SLASH",Eu="TILDE",Hp="UNDERSCORE",ND="EMOJI",Vp="SYM";var zD=Object.freeze({__proto__:null,ALPHANUMERICAL:DD,AMPERSAND:Op,APOSTROPHE:_p,ASCIINUMERICAL:_D,ASTERISK:Dp,AT:Ws,BACKSLASH:Rp,BACKTICK:Np,CARET:zp,CLOSEANGLEBRACKET:vp,CLOSEBRACE:wu,CLOSEBRACKET:gp,CLOSEPAREN:bp,COLON:Xs,COMMA:N1,DOLLAR:Lp,DOT:xi,EMOJI:ND,EQUALS:jp,EXCLAMATION:z1,FULLWIDTHGREATERTHAN:Mp,FULLWIDTHLEFTPAREN:Sp,FULLWIDTHLESSTHAN:Ap,FULLWIDTHMIDDLEDOT:RD,FULLWIDTHRIGHTPAREN:wp,HYPHEN:Vr,LEFTCORNERBRACKET:kp,LEFTWHITECORNERBRACKET:Ep,LOCALHOST:ad,NL:R1,NUM:D1,OPENANGLEBRACKET:xp,OPENBRACE:Su,OPENBRACKET:mp,OPENPAREN:yp,PERCENT:ku,PIPE:Ip,PLUS:Bp,POUND:Up,QUERY:Cu,QUOTE:L1,RIGHTCORNERBRACKET:Cp,RIGHTWHITECORNERBRACKET:Tp,SCHEME:Th,SEMI:j1,SLASH:vi,SLASH_SCHEME:pa,SYM:Vp,TILDE:Eu,TLD:ex,UNDERSCORE:Hp,UTLD:tx,UWORD:Qb,WORD:as,WS:nx});const ss=/[a-z]/,nu=new RegExp("\\p{L}","u"),T0=new RegExp("\\p{Emoji}","u"),ls=/\d/,A0=/\s/,OT="\r",M0=`
|
|
153
|
+
`,YH="️",KH="",O0="";let eh=null,th=null;function WH(t=[]){const e={};sr.groups=e;const n=new sr;eh==null&&(eh=_T(HH)),th==null&&(th=_T(VH)),oe(n,"'",_p),oe(n,"{",Su),oe(n,"}",wu),oe(n,"[",mp),oe(n,"]",gp),oe(n,"(",yp),oe(n,")",bp),oe(n,"<",xp),oe(n,">",vp),oe(n,"(",Sp),oe(n,")",wp),oe(n,"「",kp),oe(n,"」",Cp),oe(n,"『",Ep),oe(n,"』",Tp),oe(n,"<",Ap),oe(n,">",Mp),oe(n,"&",Op),oe(n,"*",Dp),oe(n,"@",Ws),oe(n,"`",Np),oe(n,"^",zp),oe(n,":",Xs),oe(n,",",N1),oe(n,"$",Lp),oe(n,".",xi),oe(n,"=",jp),oe(n,"!",z1),oe(n,"-",Vr),oe(n,"%",ku),oe(n,"|",Ip),oe(n,"+",Bp),oe(n,"#",Up),oe(n,"?",Cu),oe(n,'"',L1),oe(n,"/",vi),oe(n,";",j1),oe(n,"~",Eu),oe(n,"_",Hp),oe(n,"\\",Rp),oe(n,"・",RD);const r=Ut(n,ls,D1,{[Gb]:!0});Ut(r,ls,r);const i=Ut(r,ss,_D,{[vu]:!0}),s=Ut(r,nu,DD,{[fu]:!0}),l=Ut(n,ss,as,{[Zb]:!0});Ut(l,ls,i),Ut(l,ss,l),Ut(i,ls,i),Ut(i,ss,i);const c=Ut(n,nu,Qb,{[Jb]:!0});Ut(c,ss),Ut(c,ls,s),Ut(c,nu,c),Ut(s,ls,s),Ut(s,ss),Ut(s,nu,s);const d=oe(n,M0,R1,{[E0]:!0}),f=oe(n,OT,nx,{[E0]:!0}),p=Ut(n,A0,nx,{[E0]:!0});oe(n,O0,p),oe(f,M0,d),oe(f,O0,p),Ut(f,A0,p),oe(p,OT),oe(p,M0),Ut(p,A0,p),oe(p,O0,p);const m=Ut(n,T0,ND,{[OD]:!0});oe(m,"#"),Ut(m,T0,m),oe(m,YH,m);const g=oe(m,KH);oe(g,"#"),Ut(g,T0,m);const b=[[ss,l],[ls,i]],v=[[ss,null],[nu,c],[ls,s]];for(let w=0;w<eh.length;w++)$s(n,eh[w],ex,as,b);for(let w=0;w<th.length;w++)$s(n,th[w],tx,Qb,v);Wo(ex,{tld:!0,ascii:!0},e),Wo(tx,{utld:!0,alpha:!0},e),$s(n,"file",Th,as,b),$s(n,"mailto",Th,as,b),$s(n,"http",pa,as,b),$s(n,"https",pa,as,b),$s(n,"ftp",pa,as,b),$s(n,"ftps",pa,as,b),Wo(Th,{scheme:!0,ascii:!0},e),Wo(pa,{slashscheme:!0,ascii:!0},e),t=t.sort((w,C)=>w[0]>C[0]?1:-1);for(let w=0;w<t.length;w++){const C=t[w][0],I=t[w][1]?{[PH]:!0}:{[$H]:!0};C.indexOf("-")>=0?I[Xb]=!0:ss.test(C)?ls.test(C)?I[vu]=!0:I[Zb]=!0:I[Gb]=!0,MT(n,C,C,I)}return MT(n,"localhost",ad,{ascii:!0}),n.jd=new sr(Vp),{start:n,tokens:Object.assign({groups:e},zD)}}function LD(t,e){const n=GH(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let s=0,l=0;for(;l<r;){let c=t,d=null,f=0,p=null,m=-1,g=-1;for(;l<r&&(d=c.go(n[l]));)c=d,c.accepts()?(m=0,g=0,p=c):m>=0&&(m+=n[l].length,g++),f+=n[l].length,s+=n[l].length,l++;s-=m,l-=g,f-=m,i.push({t:p.t,v:e.slice(s-f,s),s:s-f,e:s})}return i}function GH(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,l=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(l),r+=l.length}return e}function $s(t,e,n,r,i){let s;const l=e.length;for(let c=0;c<l-1;c++){const d=e[c];t.j[d]?s=t.j[d]:(s=new sr(r),s.jr=i.slice(),t.j[d]=s),t=s}return s=new sr(n),s.jr=i.slice(),t.j[e[l-1]]=s,s}function _T(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let l=parseInt(t.substring(r,r+s),10);l>0;l--)n.pop();r+=s}else n.push(t[r]),r++}return e}const cd={defaultProtocol:"http",events:null,format:DT,formatHref:DT,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function I1(t,e=null){let n=Object.assign({},cd);t&&(n=Object.assign(n,t instanceof I1?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}I1.prototype={o:cd,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]:cd[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 DT(t){return t}function jD(t,e){this.t="token",this.v=t,this.tk=e}jD.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=cd.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),l={},c=t.get("className",n,e),d=t.get("target",n,e),f=t.get("rel",n,e),p=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return l.href=r,c&&(l.class=c),d&&(l.target=d),f&&(l.rel=f),p&&Object.assign(l,p),{tagName:i,attributes:l,content:s,eventListeners:m}}};function Cm(t,e){class n extends jD{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 RT=Cm("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),NT=Cm("text"),ZH=Cm("nl"),nh=Cm("url",{isLink:!0,toHref(t=cd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==ad&&t[1].t===Xs}}),Ur=t=>new sr(t);function JH({groups:t}){const e=t.domain.concat([Op,Dp,Ws,Rp,Np,zp,Lp,jp,Vr,D1,ku,Ip,Bp,Up,vi,Vp,Eu,Hp]),n=[_p,Xs,N1,xi,z1,ku,Cu,L1,j1,xp,vp,Su,wu,gp,mp,yp,bp,Sp,wp,kp,Cp,Ep,Tp,Ap,Mp],r=[Op,_p,Dp,Rp,Np,zp,Lp,jp,Vr,Su,wu,ku,Ip,Bp,Up,Cu,vi,Vp,Eu,Hp],i=Ur(),s=oe(i,Eu);Ke(s,r,s),Ke(s,t.domain,s);const l=Ur(),c=Ur(),d=Ur();Ke(i,t.domain,l),Ke(i,t.scheme,c),Ke(i,t.slashscheme,d),Ke(l,r,s),Ke(l,t.domain,l);const f=oe(l,Ws);oe(s,Ws,f),oe(c,Ws,f),oe(d,Ws,f);const p=oe(s,xi);Ke(p,r,s),Ke(p,t.domain,s);const m=Ur();Ke(f,t.domain,m),Ke(m,t.domain,m);const g=oe(m,xi);Ke(g,t.domain,m);const b=Ur(RT);Ke(g,t.tld,b),Ke(g,t.utld,b),oe(f,ad,b);const v=oe(m,Vr);oe(v,Vr,v),Ke(v,t.domain,m),Ke(b,t.domain,m),oe(b,xi,g),oe(b,Vr,v);const w=oe(b,Xs);Ke(w,t.numeric,RT);const C=oe(l,Vr),E=oe(l,xi);oe(C,Vr,C),Ke(C,t.domain,l),Ke(E,r,s),Ke(E,t.domain,l);const I=Ur(nh);Ke(E,t.tld,I),Ke(E,t.utld,I),Ke(I,t.domain,l),Ke(I,r,s),oe(I,xi,E),oe(I,Vr,C),oe(I,Ws,f);const j=oe(I,Xs),Q=Ur(nh);Ke(j,t.numeric,Q);const V=Ur(nh),_=Ur();Ke(V,e,V),Ke(V,n,_),Ke(_,e,V),Ke(_,n,_),oe(I,vi,V),oe(Q,vi,V);const N=oe(c,Xs),Z=oe(d,Xs),Y=oe(Z,vi),ce=oe(Y,vi);Ke(c,t.domain,l),oe(c,xi,E),oe(c,Vr,C),Ke(d,t.domain,l),oe(d,xi,E),oe(d,Vr,C),Ke(N,t.domain,V),oe(N,vi,V),oe(N,Cu,V),Ke(ce,t.domain,V),Ke(ce,e,V),oe(ce,vi,V);const ie=[[Su,wu],[mp,gp],[yp,bp],[xp,vp],[Sp,wp],[kp,Cp],[Ep,Tp],[Ap,Mp]];for(let se=0;se<ie.length;se++){const[xe,pe]=ie[se],U=oe(V,xe);oe(_,xe,U),oe(U,pe,V);const L=Ur(nh);Ke(U,e,L);const G=Ur();Ke(U,n),Ke(L,e,L),Ke(L,n,G),Ke(G,e,L),Ke(G,n,G),oe(L,pe,V),oe(G,pe,V)}return oe(i,ad,I),oe(i,R1,ZH),{start:i,tokens:zD}}function XH(t,e,n){let r=n.length,i=0,s=[],l=[];for(;i<r;){let c=t,d=null,f=null,p=0,m=null,g=-1;for(;i<r&&!(d=c.go(n[i].t));)l.push(n[i++]);for(;i<r&&(f=d||c.go(n[i].t));)d=null,c=f,c.accepts()?(g=0,m=c):g>=0&&g++,i++,p++;if(g<0)i-=p,i<r&&(l.push(n[i]),i++);else{l.length>0&&(s.push(_0(NT,e,l)),l=[]),i-=g,p-=g;const b=m.t,v=n.slice(i-p,i);s.push(_0(b,e,v))}}return l.length>0&&s.push(_0(NT,e,l)),s}function _0(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 QH=typeof console<"u"&&console&&console.warn||(()=>{}),e8="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 t8(){return sr.groups={},Dt.scanner=null,Dt.parser=null,Dt.tokenQueue=[],Dt.pluginQueue=[],Dt.customSchemes=[],Dt.initialized=!1,Dt}function zT(t,e=!1){if(Dt.initialized&&QH(`linkifyjs: already initialized - will not register custom scheme "${t}" ${e8}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
154
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
155
|
+
2. Cannot start or end with "-"
|
|
156
|
+
3. "-" cannot repeat`);Dt.customSchemes.push([t,e])}function n8(){Dt.scanner=WH(Dt.customSchemes);for(let t=0;t<Dt.tokenQueue.length;t++)Dt.tokenQueue[t][1]({scanner:Dt.scanner});Dt.parser=JH(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 B1(t){return Dt.initialized||n8(),XH(Dt.parser.start,t,LD(Dt.scanner.start,t))}B1.scan=LD;function ID(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 I1(n),i=B1(t),s=[];for(let l=0;l<i.length;l++){const c=i[l];c.isLink&&(!e||c.t===e)&&r.check(c)&&s.push(c.toFormattedObject(r))}return s}const U1="[\0- -\u2029 ]",r8=new RegExp(U1),i8=new RegExp(`${U1}$`),s8=new RegExp(U1,"g");function o8(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function l8(t){return new xt({key:new Rt("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(f=>f.docChanged)&&!n.doc.eq(r.doc),s=e.some(f=>f.getMeta("preventAutolink"));if(!i||s)return;const{tr:l}=r,c=HI(n.doc,[...e]);if(KI(c).forEach(({newRange:f})=>{const p=PI(r.doc,f,b=>b.isTextblock);let m,g;if(p.length>1)m=p[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(p.length){const b=r.doc.textBetween(f.from,f.to," "," ");if(!i8.test(b))return;m=p[0],g=r.doc.textBetween(m.pos,f.to,void 0," ")}if(m&&g){const b=g.split(r8).filter(Boolean);if(b.length<=0)return!1;const v=b[b.length-1],w=m.pos+g.lastIndexOf(v);if(!v)return!1;const C=B1(v).map(E=>E.toObject(t.defaultProtocol));if(!o8(C))return!1;C.filter(E=>E.isLink).map(E=>({...E,from:w+E.start+1,to:w+E.end+1})).filter(E=>r.schema.marks.code?!r.doc.rangeHasMark(E.from,E.to,r.schema.marks.code):!0).filter(E=>t.validate(E.value)).filter(E=>t.shouldAutoLink(E.value)).forEach(E=>{n1(E.from,E.to,r.doc).some(I=>I.mark.type===t.type)||l.addMark(E.from,E.to,t.type.create({href:E.href}))})}}),!!l.steps.length)return l}})}function a8(t){return new xt({key:new Rt("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let l=r.target;const c=[];for(;l.nodeName!=="DIV";)c.push(l),l=l.parentNode;if(!c.find(g=>g.nodeName==="A"))return!1;const d=i_(e.state,t.type.name),f=r.target,p=(i=f==null?void 0:f.href)!==null&&i!==void 0?i:d.href,m=(s=f==null?void 0:f.target)!==null&&s!==void 0?s:d.target;return f&&p?(window.open(p,m),!0):!1}}})}function c8(t){return new xt({key:new Rt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let c="";r.content.forEach(f=>{c+=f.textContent});const d=ID(c,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===c);return!c||!d?!1:t.editor.commands.setMark(t.type,{href:d.href})}}})}function Ho(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(s8,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const u8=_i.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"){zT(t);return}zT(t.scheme,t.optionalSlashes)})},onDestroy(){t8()},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)=>!!Ho(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=>!!Ho(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=>!!Ho(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",$t(this.options.HTMLAttributes,t),0]:["a",$t(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ho(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=>!!Ho(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ho({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=ID(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!Ho(l,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(l8({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Ho(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(a8({type:this.type})),this.options.linkOnPaste&&t.push(c8({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),d8=Zt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new xt({key:new Rt("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;const s=this.editor.isEmpty;return t.descendants((l,c)=>{const d=r>=c&&r<=c+l.nodeSize,f=!l.isLeaf&&um(l);if((d||!this.options.showOnlyCurrent)&&f){const p=[this.options.emptyNodeClass];s&&p.push(this.options.emptyEditorClass);const m=Pt.node(c,c+l.nodeSize,{class:p.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:c,hasAnchor:d}):this.options.placeholder});i.push(m)}return this.options.includeChildren}),ut.create(t,i)}}})]}});let rx,ix;if(typeof WeakMap<"u"){let t=new WeakMap;rx=e=>t.get(e),ix=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;rx=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},ix=(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,l=i+1;for(let c=1;s<this.width&&this.map[e+c]==n;c++)s++;for(let c=1;l<this.height&&this.map[e+this.width*c]==n;c++)l++;return{left:r,top:i,right:s,bottom:l}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:l}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:l==this.height)?null:this.map[r+this.width*(n<0?s-1:l)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:l,right:c,top:d,bottom:f}=this.findCell(e);return{left:Math.min(n,l),top:Math.min(i,d),right:Math.max(r,c),bottom:Math.max(s,f)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,l=this.map[s];n[l]||(n[l]=!0,!(i==t.left&&i&&this.map[s-1]==l||r==t.top&&r&&this.map[s-this.width]==l)&&e.push(l))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let l=e+t*this.width;const c=(t+1)*this.width;for(;l<c&&this.map[l]<i;)l++;return l==c?s-1:this.map[l]}i=s}}static get(t){return rx(t)||ix(t,f8(t))}};function f8(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=h8(t),n=t.childCount,r=[];let i=0,s=null;const l=[];for(let f=0,p=e*n;f<p;f++)r[f]=0;for(let f=0,p=0;f<n;f++){const m=t.child(f);p++;for(let v=0;;v++){for(;i<r.length&&r[i]!=0;)i++;if(v==m.childCount)break;const w=m.child(v),{colspan:C,rowspan:E,colwidth:I}=w.attrs;for(let j=0;j<E;j++){if(j+f>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:p,n:E-j});break}const Q=i+j*e;for(let V=0;V<C;V++){r[Q+V]==0?r[Q+V]=p:(s||(s=[])).push({type:"collision",row:f,pos:p,n:C-V});const _=I&&I[V];if(_){const N=(Q+V)%e*2,Z=l[N];Z==null||Z!=_&&l[N+1]==1?(l[N]=_,l[N+1]=1):Z==_&&l[N+1]++}}}i+=C,p+=w.nodeSize}const g=(f+1)*e;let b=0;for(;i<g;)r[i++]==0&&b++;b&&(s||(s=[])).push({type:"missing",row:f,n:b}),p++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const c=new Vt(e,n,r,s);let d=!1;for(let f=0;!d&&f<l.length;f+=2)l[f]!=null&&l[f+1]<n&&(d=!0);return d&&p8(c,l,t),c}function h8(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let l=0;l<r;l++){const c=t.child(l);for(let d=0;d<c.childCount;d++){const f=c.child(d);l+f.attrs.rowspan>r&&(s+=f.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const c=i.child(l);s+=c.attrs.colspan,c.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function p8(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const l=n.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let c=null;const d=l.attrs;for(let f=0;f<d.colspan;f++){const p=e[(i+f)%t.width*2];p!=null&&(!d.colwidth||d.colwidth[f]!=p)&&((c||(c=m8(d)))[f]=p)}c&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:c})}}function m8(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Bn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Qs=new Rt("selectingCells");function hl(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 g8(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 di(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 Em(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=hl(e.$head)||y8(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function y8(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 sx(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function b8(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function H1(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function BD(t,e,n){const r=t.node(-1),i=Vt.get(r),s=t.start(-1),l=i.nextCell(t.pos-s,e,n);return l==null?null:t.node(0).resolve(s+l)}function pl(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 UD(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 x8(t,e,n){const r=Bn(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 Tt=class cs extends ze{constructor(e,n=e){const r=e.node(-1),i=Vt.get(r),s=e.start(-1),l=i.rectBetween(e.pos-s,n.pos-s),c=e.node(0),d=i.cellsInRect(l).filter(p=>p!=n.pos-s);d.unshift(n.pos-s);const f=d.map(p=>{const m=r.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const g=s+p+1;return new JM(c.resolve(g),c.resolve(g+m.content.size))});super(f[0].$from,f[0].$to,f),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(sx(r)&&sx(i)&&H1(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?cs.rowSelection(r,i):s&&this.isColSelection()?cs.colSelection(r,i):new cs(r,i)}return _e.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={},l=[];for(let d=i.top;d<i.bottom;d++){const f=[];for(let p=d*n.width+i.left,m=i.left;m<i.right;m++,p++){const g=n.map[p];if(s[g])continue;s[g]=!0;const b=n.findCell(g);let v=e.nodeAt(g);if(!v)throw new RangeError(`No cell with offset ${g} found`);const w=i.left-b.left,C=b.right-i.right;if(w>0||C>0){let E=v.attrs;if(w>0&&(E=pl(E,0,w)),C>0&&(E=pl(E,E.colspan-C,C)),b.left<i.left){if(v=v.type.createAndFill(E),!v)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(E)}`)}else v=v.type.create(E,v.content)}if(b.top<i.top||b.bottom>i.bottom){const E={...v.attrs,rowspan:Math.min(b.bottom,i.bottom)-Math.max(b.top,i.top)};b.top<i.top?v=v.type.createAndFill(E):v=v.type.create(E,v.content)}f.push(v)}l.push(e.child(d).copy(ne.from(f)))}const c=this.isColSelection()&&this.isRowSelection()?e:l;return new ye(ne.from(c),1,1)}replace(e,n=ye.empty){const r=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:c,$to:d}=i[l],f=e.mapping.slice(r);e.replace(f.map(c.pos),f.map(d.pos),l?ye.empty:n)}const s=ze.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new ye(ne.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 l=0;l<s.length;l++)e(n.nodeAt(s[l]),i+s[l])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Vt.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),d=e.node(0);return l.top<=c.top?(l.top>0&&(e=d.resolve(s+i.map[l.left])),c.bottom<i.height&&(n=d.resolve(s+i.map[i.width*(i.height-1)+c.right-1]))):(c.top>0&&(n=d.resolve(s+i.map[c.left])),l.bottom<i.height&&(e=d.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new cs(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 l=i+this.$anchorCell.nodeAfter.attrs.colspan,c=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,c)==n.width}eq(e){return e instanceof cs&&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),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),d=e.node(0);return l.left<=c.left?(l.left>0&&(e=d.resolve(s+i.map[l.top*i.width])),c.right<i.width&&(n=d.resolve(s+i.map[i.width*(c.top+1)-1]))):(c.left>0&&(n=d.resolve(s+i.map[c.top*i.width])),l.right<i.width&&(e=d.resolve(s+i.map[i.width*(l.top+1)-1]))),new cs(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new cs(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new cs(e.resolve(n),e.resolve(r))}getBookmark(){return new v8(this.$anchorCell.pos,this.$headCell.pos)}};Tt.prototype.visible=!1;ze.jsonID("cell",Tt);var v8=class HD{constructor(e,n){this.anchor=e,this.head=n}map(e){return new HD(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&&H1(n,r)?new Tt(n,r):ze.near(r,1)}};function S8(t){if(!(t.selection instanceof Tt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Pt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ut.create(t.doc,e)}function w8({$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 k8({$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 C8(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,l;if(r instanceof Te&&(l=r.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=Tt.create(i,r.from);else if(l=="row"){const c=i.resolve(r.from+1);s=Tt.rowSelection(c,c)}else if(!n){const c=Vt.get(r.node),d=r.from+1,f=d+c.map[c.width*c.height-1];s=Tt.create(i,d+1,f)}}else r instanceof _e&&w8(r)?s=_e.create(i,r.from):r instanceof _e&&k8(r)&&(s=_e.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const E8=new Rt("fix-tables");function VD(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let l=0,c=0;l<s;l++){const d=e.child(l);for(let f=c,p=Math.min(i,l+3);f<p;f++)if(t.child(f)==d){c=f+1,n+=d.nodeSize;continue e}r(d,n),c<i&&t.child(c).sameMarkup(d)?VD(t.child(c),d,n+1,r):d.nodesBetween(0,d.content.size,r,n+1),n+=d.nodeSize}}function PD(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=T8(t,i,s,n))};return e?e.doc!=t.doc&&VD(e.doc,t.doc,0,r):t.doc.descendants(r),n}function T8(t,e,n,r){const i=Vt.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let d=0;d<i.height;d++)s.push(0);for(let d=0;d<i.problems.length;d++){const f=i.problems[d];if(f.type=="collision"){const p=e.nodeAt(f.pos);if(!p)continue;const m=p.attrs;for(let g=0;g<m.rowspan;g++)s[f.row+g]+=f.n;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,pl(m,m.colspan-f.n,f.n))}else if(f.type=="missing")s[f.row]+=f.n;else if(f.type=="overlong_rowspan"){const p=e.nodeAt(f.pos);if(!p)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...p.attrs,rowspan:p.attrs.rowspan-f.n})}else if(f.type=="colwidth mismatch"){const p=e.nodeAt(f.pos);if(!p)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...p.attrs,colwidth:f.colwidth})}else if(f.type=="zero_sized"){const p=r.mapping.map(n);r.delete(p,p+e.nodeSize)}}let l,c;for(let d=0;d<s.length;d++)s[d]&&(l==null&&(l=d),c=d);for(let d=0,f=n+1;d<i.height;d++){const p=e.child(d),m=f+p.nodeSize,g=s[d];if(g>0){let b="cell";p.firstChild&&(b=p.firstChild.type.spec.tableRole);const v=[];for(let C=0;C<g;C++){const E=Bn(t.schema)[b].createAndFill();E&&v.push(E)}const w=(d==0||l==d-1)&&c==d?f+1:m-1;r.insert(r.mapping.map(w),v)}f=m}return r.setMeta(E8,{fixTables:!0})}function Li(t){const e=t.selection,n=Em(t),r=n.node(-1),i=n.start(-1),s=Vt.get(r);return{...e instanceof Tt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function $D(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;x8(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let l=0;l<e.height;l++){const c=l*e.width+i;if(i>0&&i<e.width&&e.map[c-1]==e.map[c]){const d=e.map[c],f=r.nodeAt(d);t.setNodeMarkup(t.mapping.map(n+d),null,UD(f.attrs,i-e.colCount(d))),l+=f.attrs.rowspan-1}else{const d=s==null?Bn(r.type.schema).cell:r.nodeAt(e.map[c+s]).type,f=e.positionAt(l,i,r);t.insert(t.mapping.map(n+f),d.createAndFill())}}return t}function A8(t,e){if(!di(t))return!1;if(e){const n=Li(t);e($D(t.tr,n,n.left))}return!0}function M8(t,e){if(!di(t))return!1;if(e){const n=Li(t);e($D(t.tr,n,n.right))}return!0}function O8(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let l=0;l<e.height;){const c=l*e.width+i,d=e.map[c],f=n.nodeAt(d),p=f.attrs;if(i>0&&e.map[c-1]==d||i<e.width-1&&e.map[c+1]==d)t.setNodeMarkup(t.mapping.slice(s).map(r+d),null,pl(p,i-e.colCount(d)));else{const m=t.mapping.slice(s).map(r+d);t.delete(m,m+f.nodeSize)}l+=p.rowspan}}function _8(t,e){if(!di(t))return!1;if(e){const n=Li(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;O8(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 D8(t,e,n){var r;const i=Bn(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 FD(t,{map:e,tableStart:n,table:r},i){let s=n;for(let f=0;f<i;f++)s+=r.child(f).nodeSize;const l=[];let c=i>0?-1:0;D8(e,r,i+c)&&(c=i==0||i==e.height?null:0);for(let f=0,p=e.width*i;f<e.width;f++,p++)if(i>0&&i<e.height&&e.map[p]==e.map[p-e.width]){const m=e.map[p],g=r.nodeAt(m).attrs;t.setNodeMarkup(n+m,null,{...g,rowspan:g.rowspan+1}),f+=g.colspan-1}else{var d;const m=c==null?Bn(r.type.schema).cell:(d=r.nodeAt(e.map[p+c*e.width]))===null||d===void 0?void 0:d.type,g=m==null?void 0:m.createAndFill();g&&l.push(g)}return t.insert(s,Bn(r.type.schema).row.create(null,l)),t}function R8(t,e){if(!di(t))return!1;if(e){const n=Li(t);e(FD(t.tr,n,n.top))}return!0}function N8(t,e){if(!di(t))return!1;if(e){const n=Li(t);e(FD(t.tr,n,n.bottom))}return!0}function z8(t,{map:e,table:n,tableStart:r},i){let s=0;for(let f=0;f<i;f++)s+=n.child(f).nodeSize;const l=s+n.child(i).nodeSize,c=t.mapping.maps.length;t.delete(s+r,l+r);const d=new Set;for(let f=0,p=i*e.width;f<e.width;f++,p++){const m=e.map[p];if(!d.has(m)){if(d.add(m),i>0&&m==e.map[p-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),f+=g.colspan-1}else if(i<e.height&&m==e.map[p+e.width]){const g=n.nodeAt(m),b=g.attrs,v=g.type.create({...b,rowspan:g.attrs.rowspan-1},g.content),w=e.positionAt(i+1,f,n);t.insert(t.mapping.slice(c).map(r+w),v),f+=b.colspan-1}}}}function L8(t,e){if(!di(t))return!1;if(e){const n=Li(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;z8(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 LT(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function j8({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,l=(r.bottom-1)*t+r.left,c=i+(r.right-r.left-1);for(let d=r.top;d<r.bottom;d++){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 d=r.left;d<r.right;d++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[l]==n[l+t])return!0;i++,l++}return!1}function jT(t,e){const n=t.selection;if(!(n instanceof Tt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Li(t),{map:i}=r;if(j8(i,r))return!1;if(e){const s=t.tr,l={};let c=ne.empty,d,f;for(let p=r.top;p<r.bottom;p++)for(let m=r.left;m<r.right;m++){const g=i.map[p*i.width+m],b=r.table.nodeAt(g);if(!(l[g]||!b))if(l[g]=!0,d==null)d=g,f=b;else{LT(b)||(c=c.append(b.content));const v=s.mapping.map(g+r.tableStart);s.delete(v,v+b.nodeSize)}}if(d==null||f==null)return!0;if(s.setNodeMarkup(d+r.tableStart,null,{...UD(f.attrs,f.attrs.colspan,r.right-r.left-f.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){const p=d+1+f.content.size,m=LT(f)?d+1:p;s.replaceWith(m+r.tableStart,p+r.tableStart,c)}s.setSelection(new Tt(s.doc.resolve(d+r.tableStart))),e(s)}return!0}function IT(t,e){const n=Bn(t.schema);return I8(({node:r})=>n[r.type.spec.tableRole])(t,e)}function I8(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof Tt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var l;if(i=g8(r.$from),!i)return!1;s=(l=hl(r.$from))===null||l===void 0?void 0:l.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let c=i.attrs;const d=[],f=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const p=Li(e),m=e.tr;for(let b=0;b<p.right-p.left;b++)d.push(f?{...c,colwidth:f&&f[b]?[f[b]]:null}:c);let g;for(let b=p.top;b<p.bottom;b++){let v=p.map.positionAt(b,p.left,p.table);b==p.top&&(v+=i.nodeSize);for(let w=p.left,C=0;w<p.right;w++,C++)w==p.left&&b==p.top||m.insert(g=m.mapping.map(v+p.tableStart,1),t({node:i,row:b,col:w}).createAndFill(d[C]))}m.setNodeMarkup(s,t({node:i,row:p.top,col:p.left}),d[0]),r instanceof Tt&&m.setSelection(new Tt(m.doc.resolve(r.$anchorCell.pos),g?m.doc.resolve(g):void 0)),n(m)}return!0}}function B8(t,e){return function(n,r){if(!di(n))return!1;const i=Em(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Tt?n.selection.forEachCell((l,c)=>{l.attrs[t]!==e&&s.setNodeMarkup(c,null,{...l.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function U8(t){return function(e,n){if(!di(e))return!1;if(n){const r=Bn(e.schema),i=Li(e),s=e.tr,l=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),c=l.map(d=>i.table.nodeAt(d));for(let d=0;d<l.length;d++)c[d].type==r.header_cell&&s.setNodeMarkup(i.tableStart+l[d],r.cell,c[d].attrs);if(s.steps.length===0)for(let d=0;d<l.length;d++)s.setNodeMarkup(i.tableStart+l[d],r.header_cell,c[d].attrs);n(s)}return!0}}function BT(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 ud(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?U8(t):function(n,r){if(!di(n))return!1;if(r){const i=Bn(n.schema),s=Li(n),l=n.tr,c=BT("row",s,i),d=BT("column",s,i),f=(t==="column"?c:t==="row"&&d)?1:0,p=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?d?i.cell:i.header_cell:t=="row"?c?i.cell:i.header_cell:i.cell;s.map.cellsInRect(p).forEach(g=>{const b=g+s.tableStart,v=l.doc.nodeAt(b);v&&l.setNodeMarkup(b,m,v.attrs)}),r(l)}return!0}}ud("row",{useDeprecatedLogic:!0});ud("column",{useDeprecatedLogic:!0});const H8=ud("cell",{useDeprecatedLogic:!0});function V8(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),l=s.lastChild;if(l)return i-1-l.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function UT(t){return function(e,n){if(!di(e))return!1;const r=V8(Em(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(_e.between(i,b8(i))).scrollIntoView())}return!0}}function P8(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 rh(t,e){const n=t.selection;if(!(n instanceof Tt))return!1;if(e){const r=t.tr,i=Bn(t.schema).cell.createAndFill().content;n.forEachCell((s,l)=>{s.content.eq(i)||r.replace(r.mapping.map(l+1),r.mapping.map(l+s.nodeSize-1),new ye(i,0,0))}),r.docChanged&&e(r)}return!0}function $8(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,l=i.type.schema,c=[];if(s=="row")for(let d=0;d<e.childCount;d++){let f=e.child(d).content;const p=d?0:Math.max(0,n-1),m=d<e.childCount-1?0:Math.max(0,r-1);(p||m)&&(f=ox(Bn(l).row,new ye(f,p,m)).content),c.push(f)}else if(s=="cell"||s=="header_cell")c.push(n||r?ox(Bn(l).row,new ye(e,n,r)).content:e);else return null;return F8(l,c)}function F8(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let l=s.childCount-1;l>=0;l--){const{rowspan:c,colspan:d}=s.child(l).attrs;for(let f=i;f<i+c;f++)n[f]=(n[f]||0)+d}}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(ne.empty),n[i]<r){const s=Bn(t).cell.createAndFill(),l=[];for(let c=n[i];c<r;c++)l.push(s);e[i]=e[i].append(ne.from(l))}return{height:e.length,width:r,rows:e}}function ox(t,e){const n=t.createAndFill();return new Lx(n).replace(0,n.content.size,e).doc}function q8({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],l=[];for(let c=0;c<n.length;c++){const d=n[c],f=[];for(let p=s[c]||0,m=0;p<r;m++){let g=d.child(m%d.childCount);p+g.attrs.colspan>r&&(g=g.type.createChecked(pl(g.attrs,g.attrs.colspan,p+g.attrs.colspan-r),g.content)),f.push(g),p+=g.attrs.colspan;for(let b=1;b<g.attrs.rowspan;b++)s[c+b]=(s[c+b]||0)+g.attrs.colspan}l.push(ne.from(f))}n=l,t=r}if(e!=i){const s=[];for(let l=0,c=0;l<i;l++,c++){const d=[],f=n[c%e];for(let p=0;p<f.childCount;p++){let m=f.child(p);l+m.attrs.rowspan>i&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,i-m.attrs.rowspan)},m.content)),d.push(m)}s.push(ne.from(d))}n=s,e=i}return{width:t,height:e,rows:n}}function Y8(t,e,n,r,i,s,l){const c=t.doc.type.schema,d=Bn(c);let f,p;if(i>e.width)for(let m=0,g=0;m<e.height;m++){const b=n.child(m);g+=b.nodeSize;const v=[];let w;b.lastChild==null||b.lastChild.type==d.cell?w=f||(f=d.cell.createAndFill()):w=p||(p=d.header_cell.createAndFill());for(let C=e.width;C<i;C++)v.push(w);t.insert(t.mapping.slice(l).map(g-1+r),v)}if(s>e.height){const m=[];for(let v=0,w=(e.height-1)*e.width;v<Math.max(e.width,i);v++){const C=v>=e.width?!1:n.nodeAt(e.map[w+v]).type==d.header_cell;m.push(C?p||(p=d.header_cell.createAndFill()):f||(f=d.cell.createAndFill()))}const g=d.row.create(null,ne.from(m)),b=[];for(let v=e.height;v<s;v++)b.push(g);t.insert(t.mapping.slice(l).map(r+n.nodeSize-2),b)}return!!(f||p)}function HT(t,e,n,r,i,s,l,c){if(l==0||l==e.height)return!1;let d=!1;for(let f=i;f<s;f++){const p=l*e.width+f,m=e.map[p];if(e.map[p-e.width]==m){d=!0;const g=n.nodeAt(m),{top:b,left:v}=e.findCell(m);t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g.attrs,rowspan:l-b}),t.insert(t.mapping.slice(c).map(e.positionAt(l,v,n)),g.type.createAndFill({...g.attrs,rowspan:b+g.attrs.rowspan-l})),f+=g.attrs.colspan-1}}return d}function VT(t,e,n,r,i,s,l,c){if(l==0||l==e.width)return!1;let d=!1;for(let f=i;f<s;f++){const p=f*e.width+l,m=e.map[p];if(e.map[p-1]==m){d=!0;const g=n.nodeAt(m),b=e.colCount(m),v=t.mapping.slice(c).map(m+r);t.setNodeMarkup(v,null,pl(g.attrs,l-b,g.attrs.colspan-(l-b))),t.insert(v+g.nodeSize,g.type.createAndFill(pl(g.attrs,0,l-b))),f+=g.attrs.rowspan-1}}return d}function PT(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let l=Vt.get(s);const{top:c,left:d}=r,f=d+i.width,p=c+i.height,m=t.tr;let g=0;function b(){if(s=n?m.doc.nodeAt(n-1):m.doc,!s)throw new Error("No table found");l=Vt.get(s),g=m.mapping.maps.length}Y8(m,l,s,n,f,p,g)&&b(),HT(m,l,s,n,d,f,c,g)&&b(),HT(m,l,s,n,d,f,p,g)&&b(),VT(m,l,s,n,c,p,d,g)&&b(),VT(m,l,s,n,c,p,f,g)&&b();for(let v=c;v<p;v++){const w=l.positionAt(v,d,s),C=l.positionAt(v,f,s);m.replace(m.mapping.slice(g).map(w+n),m.mapping.slice(g).map(C+n),new ye(i.rows[v-c],0,0))}b(),m.setSelection(new Tt(m.doc.resolve(n+l.positionAt(c,d,s)),m.doc.resolve(n+l.positionAt(p-1,f-1,s)))),e(m)}const K8=Yx({ArrowLeft:ih("horiz",-1),ArrowRight:ih("horiz",1),ArrowUp:ih("vert",-1),ArrowDown:ih("vert",1),"Shift-ArrowLeft":sh("horiz",-1),"Shift-ArrowRight":sh("horiz",1),"Shift-ArrowUp":sh("vert",-1),"Shift-ArrowDown":sh("vert",1),Backspace:rh,"Mod-Backspace":rh,Delete:rh,"Mod-Delete":rh});function Ah(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function ih(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Tt)return Ah(n,r,ze.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const l=qD(i,t,e);if(l==null)return!1;if(t=="horiz")return Ah(n,r,ze.near(n.doc.resolve(s.head+e),e));{const c=n.doc.resolve(l),d=BD(c,t,e);let f;return d?f=ze.near(d,1):e<0?f=ze.near(n.doc.resolve(c.before(-1)),-1):f=ze.near(n.doc.resolve(c.after(-1)),1),Ah(n,r,f)}}}function sh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let l;if(s instanceof Tt)l=s;else{const d=qD(i,t,e);if(d==null)return!1;l=new Tt(n.doc.resolve(d))}const c=BD(l.$headCell,t,e);return c?Ah(n,r,new Tt(l.$anchorCell,c)):!1}}function W8(t,e){const n=t.state.doc,r=hl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Tt(r))),!0):!1}function G8(t,e,n){if(!di(t.state))return!1;let r=$8(n);const i=t.state.selection;if(i instanceof Tt){r||(r={width:1,height:1,rows:[ne.from(ox(Bn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),c=Vt.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return r=q8(r,c.right-c.left,c.bottom-c.top),PT(t.state,t.dispatch,l,c,r),!0}else if(r){const s=Em(t.state),l=s.start(-1);return PT(t.state,t.dispatch,l,Vt.get(s.node(-1)).findCell(s.pos-l),r),!0}else return!1}function Z8(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=$T(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Tt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=hl(t.state.selection.$anchor))!=null&&((n=D0(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(d,f){let p=D0(t,f);const m=Qs.getState(t.state)==null;if(!p||!H1(d,p))if(m)p=d;else return;const g=new Tt(d,p);if(m||!t.state.selection.eq(g)){const b=t.state.tr.setSelection(g);m&&b.setMeta(Qs,d.pos),t.dispatch(b)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",c),Qs.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Qs,-1))}function c(d){const f=d,p=Qs.getState(t.state);let m;if(p!=null)m=t.state.doc.resolve(p);else if($T(t,f.target)!=r&&(m=D0(t,e),!m))return l();m&&s(m,f)}t.root.addEventListener("mouseup",l),t.root.addEventListener("dragstart",l),t.root.addEventListener("mousemove",c)}function qD(t,e,n){if(!(t.state.selection instanceof _e))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?l:null}}return null}function $T(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function D0(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&&hl(t.state.doc.resolve(r))||hl(t.state.doc.resolve(i))}var J8=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")),lx(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,lx(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function lx(t,e,n,r,i,s){let l=0,c=!0,d=e.firstChild;const f=t.firstChild;if(f){for(let m=0,g=0;m<f.childCount;m++){const{colspan:b,colwidth:v}=f.child(m).attrs;for(let w=0;w<b;w++,g++){const C=i==g?s:v&&v[w],E=C?C+"px":"";if(l+=C||r,C||(c=!1),d)d.style.width!=E&&(d.style.width=E),d=d.nextSibling;else{const I=document.createElement("col");I.style.width=E,e.appendChild(I)}}}for(;d;){var p;const m=d.nextSibling;(p=d.parentNode)===null||p===void 0||p.removeChild(d),d=m}c?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const Cr=new Rt("tableColumnResizing");function X8({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=J8,lastColumnResizable:i=!0}={}){const s=new xt({key:Cr,state:{init(l,c){var d;const f=(d=s.spec)===null||d===void 0||(d=d.props)===null||d===void 0?void 0:d.nodeViews,p=Bn(c.schema).table.name;return r&&f&&(f[p]=(m,g)=>new r(m,n,g)),new Q8(-1,!1)},apply(l,c){return c.apply(l)}},props:{attributes:l=>{const c=Cr.getState(l);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,c)=>{eV(l,c,t,i)},mouseleave:l=>{tV(l)},mousedown:(l,c)=>{nV(l,c,e,n)}},decorations:l=>{const c=Cr.getState(l);if(c&&c.activeHandle>-1)return lV(l,c.activeHandle)},nodeViews:{}}});return s}var Q8=class Mh{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Cr);if(r&&r.setHandle!=null)return new Mh(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Mh(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return sx(e.doc.resolve(i))||(i=-1),new Mh(i,n.dragging)}return n}};function eV(t,e,n,r){if(!t.editable)return;const i=Cr.getState(t.state);if(i&&!i.dragging){const s=iV(e.target);let l=-1;if(s){const{left:c,right:d}=s.getBoundingClientRect();e.clientX-c<=n?l=FT(t,e,"left",n):d-e.clientX<=n&&(l=FT(t,e,"right",n))}if(l!=i.activeHandle){if(!r&&l!==-1){const c=t.state.doc.resolve(l),d=c.node(-1),f=Vt.get(d),p=c.start(-1);if(f.colCount(c.pos-p)+c.nodeAfter.attrs.colspan-1==f.width-1)return}YD(t,l)}}}function tV(t){if(!t.editable)return;const e=Cr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&YD(t,-1)}function nV(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,l=Cr.getState(t.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const c=t.state.doc.nodeAt(l.activeHandle),d=rV(t,l.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(Cr,{setDragging:{startX:e.clientX,startWidth:d}}));function f(m){s.removeEventListener("mouseup",f),s.removeEventListener("mousemove",p);const g=Cr.getState(t.state);g!=null&&g.dragging&&(sV(t,g.activeHandle,qT(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Cr,{setDragging:null})))}function p(m){if(!m.which)return f(m);const g=Cr.getState(t.state);if(g&&g.dragging){const b=qT(g.dragging,m,n);YT(t,g.activeHandle,b,r)}}return YT(t,l.activeHandle,d,r),s.addEventListener("mouseup",f),s.addEventListener("mousemove",p),e.preventDefault(),!0}function rV(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,c=n;if(r)for(let d=0;d<n;d++)r[d]&&(l-=r[d],c--);return l/c}function iV(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function FT(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:l}=s,c=hl(t.state.doc.resolve(l));if(!c)return-1;if(n=="right")return c.pos;const d=Vt.get(c.node(-1)),f=c.start(-1),p=d.map.indexOf(c.pos-f);return p%d.width==0?-1:f+d.map[p-1]}function qT(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function YD(t,e){t.dispatch(t.state.tr.setMeta(Cr,{setHandle:e}))}function sV(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Vt.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,d=t.state.tr;for(let f=0;f<s.height;f++){const p=f*s.width+c;if(f&&s.map[p]==s.map[p-s.width])continue;const m=s.map[p],g=i.nodeAt(m).attrs,b=g.colspan==1?0:c-s.colCount(m);if(g.colwidth&&g.colwidth[b]==n)continue;const v=g.colwidth?g.colwidth.slice():oV(g.colspan);v[b]=n,d.setNodeMarkup(l+m,null,{...g,colwidth:v})}d.docChanged&&t.dispatch(d)}function YT(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),l=i.start(-1),c=Vt.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let d=t.domAtPos(i.start(-1)).node;for(;d&&d.nodeName!="TABLE";)d=d.parentNode;d&&lx(s,d.firstChild,d,r,c,n)}function oV(t){return Array(t).fill(0)}function lV(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return ut.empty;const s=Vt.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let f=0;f<s.height;f++){const p=c+f*s.width;if((c==s.width-1||s.map[p]!=s.map[p+1])&&(f==0||s.map[p]!=s.map[p-s.width])){var d;const m=s.map[p],g=l+m+i.nodeAt(m).nodeSize-1,b=document.createElement("div");b.className="column-resize-handle",!((d=Cr.getState(t))===null||d===void 0)&&d.dragging&&n.push(Pt.node(l+m,l+m+i.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),n.push(Pt.widget(g,b))}}return ut.create(t.doc,n)}function aV({allowTableNodeSelection:t=!1}={}){return new xt({key:Qs,state:{init(){return null},apply(e,n){const r=e.getMeta(Qs);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:S8,handleDOMEvents:{mousedown:Z8},createSelectionBetween(e){return Qs.getState(e.state)!=null?e.state.selection:null},handleTripleClick:W8,handleKeyDown:K8,handlePaste:G8},appendTransaction(e,n,r){return C8(r,PD(r,n),t)}})}function ax(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function KT(t,e,n,r,i,s){var l;let c=0,d=!0,f=e.firstChild;const p=t.firstChild;if(p!==null)for(let m=0,g=0;m<p.childCount;m+=1){const{colspan:b,colwidth:v}=p.child(m).attrs;for(let w=0;w<b;w+=1,g+=1){const C=i===g?s:v&&v[w],E=C?`${C}px`:"";if(c+=C||r,C||(d=!1),f){if(f.style.width!==E){const[I,j]=ax(r,C);f.style.setProperty(I,j)}f=f.nextSibling}else{const I=document.createElement("col"),[j,Q]=ax(r,C);I.style.setProperty(j,Q),e.appendChild(I)}}}for(;f;){const m=f.nextSibling;(l=f.parentNode)===null||l===void 0||l.removeChild(f),f=m}d?(n.style.width=`${c}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${c}px`)}class cV{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")),KT(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,KT(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function uV(t,e,n,r){let i=0,s=!0;const l=[],c=t.firstChild;if(!c)return{};for(let m=0,g=0;m<c.childCount;m+=1){const{colspan:b,colwidth:v}=c.child(m).attrs;for(let w=0;w<b;w+=1,g+=1){const C=n===g?r:v&&v[w];i+=C||e,C||(s=!1);const[E,I]=ax(e,C);l.push(["col",{style:`${E}: ${I}`}])}}const d=s?`${i}px`:"",f=s?"":`${i}px`;return{colgroup:["colgroup",{},...l],tableWidth:d,tableMinWidth:f}}function WT(t,e){return t.createAndFill()}function dV(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 fV(t,e,n,r,i){const s=dV(t),l=[],c=[];for(let f=0;f<n;f+=1){const p=WT(s.cell);if(p&&c.push(p),r){const m=WT(s.header_cell);m&&l.push(m)}}const d=[];for(let f=0;f<e;f+=1)d.push(s.row.createChecked(null,r&&f===0?l:c));return s.table.createChecked(null,d)}function hV(t){return t instanceof Tt}const oh=({editor:t})=>{const{selection:e}=t.state;if(!hV(e))return!1;let n=0;const r=r_(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},pV=xn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:cV,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}=uV(t,this.options.cellMinWidth),s=["table",$t(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const l=fV(s.schema,t,e,n);if(i){const c=r.selection.from+1;r.replaceSelectionWith(l).scrollIntoView().setSelection(_e.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>A8(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>M8(t,e),deleteColumn:()=>({state:t,dispatch:e})=>_8(t,e),addRowBefore:()=>({state:t,dispatch:e})=>R8(t,e),addRowAfter:()=>({state:t,dispatch:e})=>N8(t,e),deleteRow:()=>({state:t,dispatch:e})=>L8(t,e),deleteTable:()=>({state:t,dispatch:e})=>P8(t,e),mergeCells:()=>({state:t,dispatch:e})=>jT(t,e),splitCell:()=>({state:t,dispatch:e})=>IT(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>ud("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>ud("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>H8(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>jT(t,e)?!0:IT(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>B8(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>UT(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>UT(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&PD(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Tt.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:oh,"Mod-Backspace":oh,Delete:oh,"Mod-Delete":oh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[X8({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],aV({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:We(Se(t,"tableRole",e))}}}),mV=xn.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",$t(this.options.HTMLAttributes,t),0]}}),gV=xn.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",$t(this.options.HTMLAttributes,t),0]}}),yV=xn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",$t(this.options.HTMLAttributes,t),0]}});var bV=sM();const xV=Zp(bV);function vV(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var KD={exports:{}},R0={};/**
|
|
157
|
+
* @license React
|
|
158
|
+
* use-sync-external-store-shim.production.min.js
|
|
159
|
+
*
|
|
160
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
161
|
+
*
|
|
162
|
+
* This source code is licensed under the MIT license found in the
|
|
163
|
+
* LICENSE file in the root directory of this source tree.
|
|
164
|
+
*/var GT;function SV(){if(GT)return R0;GT=1;var t=hn;function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,l=t.useDebugValue;function c(m,g){var b=g(),v=r({inst:{value:b,getSnapshot:g}}),w=v[0].inst,C=v[1];return s(function(){w.value=b,w.getSnapshot=g,d(w)&&C({inst:w})},[m,b,g]),i(function(){return d(w)&&C({inst:w}),m(function(){d(w)&&C({inst:w})})},[m]),l(b),b}function d(m){var g=m.getSnapshot;m=m.value;try{var b=g();return!n(m,b)}catch{return!0}}function f(m,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return R0.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,R0}KD.exports=SV();var V1=KD.exports;const wV=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},kV=({contentComponent:t})=>{const e=V1.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return hn.createElement(hn.Fragment,null,Object.values(e))};function CV(){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]:xV.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 EV extends hn.Component{constructor(e){var n;super(e),this.editorContentRef=hn.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=CV(),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 hn.createElement(hn.Fragment,null,hn.createElement("div",{ref:wV(n,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&hn.createElement(kV,{contentComponent:e.contentComponent}))}}const TV=O.forwardRef((t,e)=>{const n=hn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return hn.createElement(EV,{key:n,innerRef:e,...t})}),AV=hn.memo(TV);var MV=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;for(i of e.entries())if(!t(i[1],n.get(i[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(e[i]!==n[i])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var l=s[i];if(!(l==="_owner"&&e.$$typeof)&&!t(e[l],n[l]))return!1}return!0}return e!==e&&n!==n},OV=vV(MV),WD={exports:{}},N0={};/**
|
|
165
|
+
* @license React
|
|
166
|
+
* use-sync-external-store-shim/with-selector.production.min.js
|
|
167
|
+
*
|
|
168
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
169
|
+
*
|
|
170
|
+
* This source code is licensed under the MIT license found in the
|
|
171
|
+
* LICENSE file in the root directory of this source tree.
|
|
172
|
+
*/var ZT;function _V(){if(ZT)return N0;ZT=1;var t=hn,e=V1;function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,l=t.useEffect,c=t.useMemo,d=t.useDebugValue;return N0.useSyncExternalStoreWithSelector=function(f,p,m,g,b){var v=s(null);if(v.current===null){var w={hasValue:!1,value:null};v.current=w}else w=v.current;v=c(function(){function E(_){if(!I){if(I=!0,j=_,_=g(_),b!==void 0&&w.hasValue){var N=w.value;if(b(N,_))return Q=N}return Q=_}if(N=Q,r(j,_))return N;var Z=g(_);return b!==void 0&&b(N,Z)?N:(j=_,Q=Z)}var I=!1,j,Q,V=m===void 0?null:m;return[function(){return E(p())},V===null?void 0:function(){return E(V())}]},[p,m,g,b]);var C=i(f,v[0],v[1]);return l(function(){w.hasValue=!0,w.value=C},[C]),d(C),C},N0}WD.exports=_V();var DV=WD.exports;const RV=typeof window<"u"?O.useLayoutEffect:O.useEffect;class NV{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 zV(t){var e;const[n]=O.useState(()=>new NV(t.editor)),r=DV.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:OV);return RV(()=>n.watch(t.editor),[t.editor,n]),O.useDebugValue(r),r}const LV=!1,cx=typeof window>"u",jV=cx||!!(typeof window<"u"&&window.next);class P1{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?cx||jV?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 TB(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var l;return i===((l=n.extensions)===null||l===void 0?void 0:l[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?P1.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 IV(t={},e=[]){const n=O.useRef(t);n.current=t;const[r]=O.useState(()=>new P1(n)),i=V1.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return O.useDebugValue(i),O.useEffect(r.onRender(e)),zV({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&s===0?0:s+1}),i}const BV=O.createContext({editor:null});BV.Consumer;const UV=O.createContext({onDragStart:void 0}),HV=()=>O.useContext(UV);hn.forwardRef((t,e)=>{const{onDragStart:n}=HV(),r=t.as||"div";return hn.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});const VV=/^\s*>\s$/,PV=xn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",$t(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[Wu({find:VV,type:this.type})]}}),$V=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,FV=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,qV=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,YV=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,KV=_i.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",$t(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[al({find:$V,type:this.type}),al({find:qV,type:this.type})]},addPasteRules(){return[ho({find:FV,type:this.type}),ho({find:YV,type:this.type})]}}),WV="listItem",JT="textStyle",XT=/^\s*([-+*])\s$/,GV=xn.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",$t(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(WV,this.editor.getAttributes(JT)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Wu({find:XT,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Wu({find:XT,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(JT),editor:this.editor})),[t]}}),ZV=/(^|[^`])`([^`]+)`(?!`)/,JV=/(^|[^`])`([^`]+)`(?!`)/g,XV=_i.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",$t(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[al({find:ZV,type:this.type})]},addPasteRules(){return[ho({find:JV,type:this.type})]}}),QV=/^```([a-z]+)?[\s\n]$/,e9=/^~~~([a-z]+)?[\s\n]$/,t9=xn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,s=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(l=>l.startsWith(n)).map(l=>l.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",$t(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,l=r.parent.textContent.endsWith(`
|
|
173
|
+
|
|
174
|
+
`);return!s||!l?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const c=i.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:f})=>(f.setSelection(ze.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Db({find:QV,type:this.type,getAttributes:t=>({language:t[1]})}),Db({find:e9,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new xt({key:new Rt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!n||!s)return!1;const{tr:l,schema:c}=t.state,d=c.text(n.replace(/\r\n?/g,`
|
|
175
|
+
`));return l.replaceSelectionWith(this.type.create({language:s},d)),l.selection.$from.parent.type!==this.type&&l.setSelection(_e.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),n9=xn.create({name:"doc",topNode:!0,content:"block+"});function r9(t={}){return new xt({view(e){return new i9(e,t)}})}class i9{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=l=>{this[i](l)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),l=s.width/i.offsetWidth,c=s.height/i.offsetHeight;if(n){let m=e.nodeBefore,g=e.nodeAfter;if(m||g){let b=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(b){let v=b.getBoundingClientRect(),w=m?v.bottom:v.top;m&&g&&(w=(w+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let C=this.width/2*c;r={left:v.left,right:v.right,top:w-C,bottom:w+C}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*l;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let d=this.editorView.dom.offsetParent;this.element||(this.element=d.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let f,p;if(!d||d==document.body&&getComputedStyle(d).position=="static")f=-pageXOffset,p=-pageYOffset;else{let m=d.getBoundingClientRect(),g=m.width/d.offsetWidth,b=m.height/d.offsetHeight;f=m.left-d.scrollLeft*g,p=m.top-d.scrollTop*b}this.element.style.left=(r.left-f)/l+"px",this.element.style.top=(r.top-p)/c+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=YM(this.editorView.state.doc,l,this.editorView.dragging.slice);c!=null&&(l=c)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const s9=Zt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[r9(this.options)]}});class Ht extends ze{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Ht.valid(r)?new Ht(r):ze.near(r)}content(){return ye.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 $1(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!o9(e)||!l9(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 l=e.depth;;l--){let c=e.node(l);if(n>0?e.indexAfter(l)<c.childCount:e.index(l)>0){s=c.child(n>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;i+=n;let d=e.doc.resolve(i);if(Ht.valid(d))return d}for(;;){let l=n>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!Te.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=l,i+=n;let c=e.doc.resolve(i);if(Ht.valid(c))return c}return null}}}Ht.prototype.visible=!1;Ht.findFrom=Ht.findGapCursorFrom;ze.jsonID("gapcursor",Ht);class $1{constructor(e){this.pos=e}map(e){return new $1(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ht.valid(n)?new Ht(n):ze.near(n)}}function GD(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function o9(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||GD(i.type))return!0;if(i.inlineContent)return!1}}return!0}function l9(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||GD(i.type))return!0;if(i.inlineContent)return!1}}return!0}function a9(){return new xt({props:{decorations:f9,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ht.valid(n)?new Ht(n):null},handleClick:u9,handleKeyDown:c9,handleDOMEvents:{beforeinput:d9}}})}const c9=Yx({ArrowLeft:lh("horiz",-1),ArrowRight:lh("horiz",1),ArrowUp:lh("vert",-1),ArrowDown:lh("vert",1)});function lh(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let l=r.selection,c=e>0?l.$to:l.$from,d=l.empty;if(l instanceof _e){if(!s.endOfTextblock(n)||c.depth==0)return!1;d=!1,c=r.doc.resolve(e>0?c.after():c.before())}let f=Ht.findGapCursorFrom(c,e,d);return f?(i&&i(r.tr.setSelection(new Ht(f))),!0):!1}}function u9(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&&Te.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ht(r))),!0)}function d9(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=ne.empty;for(let l=r.length-1;l>=0;l--)i=ne.from(r[l].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new ye(i,0,0));return s.setSelection(_e.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function f9(t){if(!(t.selection instanceof Ht))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ut.create(t.doc,[Pt.widget(t.selection.head,e,{key:"gapcursor"})])}const h9=Zt.create({name:"gapCursor",addProseMirrorPlugins(){return[a9()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=We(Se(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),p9=xn.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",$t(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
176
|
+
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:c}=r.extensionManager,d=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:f,dispatch:p})=>{if(p&&d&&l){const m=d.filter(g=>c.includes(g.type.name));f.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),m9=xn.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]}`,$t(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=>Db({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Pp=200,yn=function(){};yn.prototype.append=function(e){return e.length?(e=yn.from(e),!this.length&&e||e.length<Pp&&this.leafAppend(e)||this.length<Pp&&e.leafPrepend(this)||this.appendInner(e)):this};yn.prototype.prepend=function(e){return e.length?yn.from(e).append(this):this};yn.prototype.appendInner=function(e){return new g9(this,e)};yn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?yn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};yn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};yn.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)};yn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,l){return i.push(e(s,l))},n,r),i};yn.from=function(e){return e instanceof yn?e:e&&e.length?new ZD(e):yn.empty};var ZD=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,l,c){for(var d=s;d<l;d++)if(i(this.values[d],c+d)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,l,c){for(var d=s-1;d>=l;d--)if(i(this.values[d],c+d)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Pp)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Pp)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(yn);yn.empty=new ZD([]);var g9=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,l){var c=this.left.length;if(i<c&&this.left.forEachInner(r,i,Math.min(s,c),l)===!1||s>c&&this.right.forEachInner(r,Math.max(i-c,0),Math.min(this.length,s)-c,l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,l){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(s,c)-c,l+c)===!1||s<c&&this.left.forEachInvertedInner(r,Math.min(i,c),s,l)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(yn);const y9=500;class ri{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let l=e.tr,c,d,f=[],p=[];return this.items.forEach((m,g)=>{if(!m.step){i||(i=this.remapping(r,g+1),s=i.maps.length),s--,p.push(m);return}if(i){p.push(new Si(m.map));let b=m.step.map(i.slice(s)),v;b&&l.maybeStep(b).doc&&(v=l.mapping.maps[l.mapping.maps.length-1],f.push(new Si(v,void 0,void 0,f.length+p.length))),s--,v&&i.appendMap(v,s)}else l.maybeStep(m.step);if(m.selection)return c=i?m.selection.map(i.slice(s)):m.selection,d=new ri(this.items.slice(0,r).append(p.reverse().concat(f)),this.eventCount-1),!1},this.items.length,0),{remaining:d,transform:l,selection:c}}addTransform(e,n,r,i){let s=[],l=this.eventCount,c=this.items,d=!i&&c.length?c.get(c.length-1):null;for(let p=0;p<e.steps.length;p++){let m=e.steps[p].invert(e.docs[p]),g=new Si(e.mapping.maps[p],m,n),b;(b=d&&d.merge(g))&&(g=b,p?s.pop():c=c.slice(0,c.length-1)),s.push(g),n&&(l++,n=void 0),i||(d=g)}let f=l-r.depth;return f>x9&&(c=b9(c,f),l-=f),new ri(c.append(s),l)}remapping(e,n){let r=new Vu;return this.items.forEach((i,s)=>{let l=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,l)},e,n),r}addMaps(e){return this.eventCount==0?this:new ri(this.items.append(e.map(n=>new Si(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,l=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},i);let d=n;this.items.forEach(g=>{let b=s.getMirror(--d);if(b==null)return;l=Math.min(l,b);let v=s.maps[b];if(g.step){let w=e.steps[b].invert(e.docs[b]),C=g.selection&&g.selection.map(s.slice(d+1,b));C&&c++,r.push(new Si(v,w,C))}else r.push(new Si(v))},i);let f=[];for(let g=n;g<l;g++)f.push(new Si(s.maps[g]));let p=this.items.slice(0,i).append(f).append(r),m=new ri(p,c);return m.emptyItemCount()>y9&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((l,c)=>{if(c>=e)i.push(l),l.selection&&s++;else if(l.step){let d=l.step.map(n.slice(r)),f=d&&d.getMap();if(r--,f&&n.appendMap(f,r),d){let p=l.selection&&l.selection.map(n.slice(r));p&&s++;let m=new Si(f.invert(),d,p),g,b=i.length-1;(g=i.length&&i[b].merge(m))?i[b]=g:i.push(m)}}else l.map&&r--},this.items.length,0),new ri(yn.from(i.reverse()),s)}}ri.empty=new ri(yn.empty,0);function b9(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Si{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 Si(n.getMap().invert(),n,this.selection)}}}class Gs{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const x9=20;function v9(t,e,n,r){let i=n.getMeta(tl),s;if(i)return i.historyState;n.getMeta(k9)&&(t=new Gs(t.done,t.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(l&&l.getMeta(tl))return l.getMeta(tl).redo?new Gs(t.done.addTransform(n,void 0,r,Oh(e)),t.undone,QT(n.mapping.maps),t.prevTime,t.prevComposition):new Gs(t.done,t.undone.addTransform(n,void 0,r,Oh(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),d=t.prevTime==0||!l&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!S9(n,t.prevRanges)),f=l?z0(t.prevRanges,n.mapping):QT(n.mapping.maps);return new Gs(t.done.addTransform(n,d?e.selection.getBookmark():void 0,r,Oh(e)),ri.empty,f,n.time,c??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Gs(t.done.rebased(n,s),t.undone.rebased(n,s),z0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Gs(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),z0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function S9(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 QT(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,l)=>e.push(s,l));return e}function z0(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 w9(t,e,n){let r=Oh(e),i=tl.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),c=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),d=new Gs(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(tl,{redo:n,historyState:d})}let L0=!1,eA=null;function Oh(t){let e=t.plugins;if(eA!=e){L0=!1,eA=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){L0=!0;break}}return L0}const tl=new Rt("history"),k9=new Rt("closeHistory");function C9(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new xt({key:tl,state:{init(){return new Gs(ri.empty,ri.empty,null,0,-1)},apply(e,n,r){return v9(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?XD:r=="historyRedo"?QD:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function JD(t,e){return(n,r)=>{let i=tl.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=w9(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const XD=JD(!1,!0),QD=JD(!0,!0),E9=Zt.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>XD(t,e),redo:()=>({state:t,dispatch:e})=>QD(t,e)}},addProseMirrorPlugins(){return[C9(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()}}}),T9=xn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",$t(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!MB(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}):GI(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:l,dispatch:c})=>{var d;if(c){const{$to:f}=l.selection,p=f.end();if(f.nodeAfter)f.nodeAfter.isTextblock?l.setSelection(_e.create(l.doc,f.pos+1)):f.nodeAfter.isBlock?l.setSelection(Te.create(l.doc,f.pos)):l.setSelection(_e.create(l.doc,f.pos));else{const m=(d=f.parent.type.contentMatch.defaultType)===null||d===void 0?void 0:d.create();m&&(l.insert(p,m),l.setSelection(_e.create(l.doc,p+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[AB({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),A9=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,M9=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,O9=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,_9=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,D9=_i.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",$t(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[al({find:A9,type:this.type}),al({find:O9,type:this.type})]},addPasteRules(){return[ho({find:M9,type:this.type}),ho({find:_9,type:this.type})]}}),R9=xn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",$t(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)}}}),N9="listItem",tA="textStyle",nA=/^(\d+)\.\s$/,z9=xn.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",$t(this.options.HTMLAttributes,n),0]:["ol",$t(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(N9,this.editor.getAttributes(tA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Wu({find:nA,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=Wu({find:nA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(tA)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),L9=xn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",$t(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),j9=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,I9=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,B9=_i.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",$t(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[al({find:j9,type:this.type})]},addPasteRules(){return[ho({find:I9,type:this.type})]}}),U9=xn.create({name:"text",group:"inline"}),H9=Zt.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(KV.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(PV.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(GV.configure(this.options.bulletList)),this.options.code!==!1&&t.push(XV.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(t9.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(n9.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(s9.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(h9.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(p9.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(m9.configure(this.options.heading)),this.options.history!==!1&&t.push(E9.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(T9.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(D9.configure(this.options.italic)),this.options.listItem!==!1&&t.push(R9.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(z9.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(L9.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(B9.configure(this.options.strike)),this.options.text!==!1&&t.push(U9.configure(this.options.text)),t}});function Tu(t){const e=t,n={id:e.id,author:e.author,range:e.range,content:e.content,status:e.status,timestamp:e.timestamp,...e.relRange!==void 0?{relRange:e.relRange}:{},...e.textSnapshot!==void 0?{textSnapshot:e.textSnapshot}:{},...e.editedAt!==void 0?{editedAt:e.editedAt}:{},...typeof e.rev=="number"?{rev:e.rev}:{}};if(e.type==="suggestion"){let r,i;try{const s=JSON.parse(e.content);r=s.newText,i=s.reason??""}catch{console.warn(`[sanitizeAnnotation] Malformed JSON in legacy suggestion ${e.id}, treating as plain comment`),i=e.content}return{...n,type:"comment",content:i,suggestedText:r}}return e.type==="question"?{...n,type:"comment",directedAt:"claude"}:e.type==="highlight"?{...n,type:"highlight",color:e.color}:e.type==="flag"?{...n,type:"flag"}:e.type==="comment"?{...n,type:"comment",...e.suggestedText!==void 0?{suggestedText:e.suggestedText}:{},...e.directedAt!==void 0?{directedAt:e.directedAt}:{}}:(console.warn(`[sanitizeAnnotation] Unknown type "${e.type}" for ${e.id}, coercing to "comment"`),{...n,type:"comment"})}function e2(t){return t?t+1:0}function ml(t,e){let n=0,r=0;const i=t.childCount;for(let s=0;s<i;s++){const l=t.child(s),c=r+1,d=l.type.name==="heading"?e2(l.attrs.level||1):0,f=l.textContent.length,p=d+f;if(n+p>e){const m=e-n,g=Math.max(0,m-d);return Kr(c+Math.min(g,f))}if(n+=p,r+=l.nodeSize,s<i-1&&(n+=1,n>e))return Kr(c+f)}return Kr(t.content.size)}function Ka(t,e){let n=0,r=0;const i=t.childCount;for(let s=0;s<i;s++){const l=t.child(s),c=r+1,d=l.type.name==="heading"?e2(l.attrs.level||1):0,f=l.textContent.length,p=c+f;if(e<=p){if(e<=c)return gh(n+d);const m=e-c;return gh(n+d+Math.min(m,f))}n+=d+f,r+=l.nodeSize,s<i-1&&(n+=1)}return gh(n)}function rA(t,e,n){let r=0;const i=Math.min(t.childCount,e.length);for(let s=0;s<i;s++){const l=e.get(s),c=t.child(s),d=r+1;if(l instanceof Dn){let f=0;for(let p=0;p<l.length;p++){const m=l.get(p);if(m instanceof Yn){if(m===n.type)return Kr(d+Math.min(f+n.index,c.textContent.length));f+=m.length}}}r+=c.nodeSize}return null}function t2(t,e,n){let r,i;try{const d=el(n.fromRel),f=el(n.toRel);r=Ub(d,t),i=Ub(f,t)}catch(d){return console.warn("[positions] relRangeToPmPositions: failed to resolve relRange:",d),null}if(!r||!i)return null;const s=t.getXmlFragment("default"),l=rA(e,s,r),c=rA(e,s,i);return l===null||c===null?null:{from:l,to:c}}function $p(t,e,n){if(t.relRange&&n){const r=t2(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:ml(e,t.range.from),to:ml(e,t.range.to),method:"flat"}:null}function n2(t,e){return{from:Ka(t,e.from),to:Ka(t,e.to)}}const ah=new Rt("tandemAnnotations");function iA(t,e,n){const r=[],i=t.content.size;return e.forEach(s=>{const l=Tu(s);if(l.status!=="pending"||!l.range&&!l.relRange)return;const c=$p(l,t,n);if(!c)return;l.relRange&&c.method==="flat"&&console.warn("[annotation] relRange-equipped annotation %s fell back to flat offsets",l.id);const{from:d,to:f}=c;if(d>=f||d<0||f>i)return;let p={};switch(l.type){case"highlight":{const m=l.color||"yellow",g=zu[m]||zu.yellow;p={class:`tandem-highlight tandem-highlight--${m}`,style:`background: ${g}; border-radius: 2px; padding: 1px 0;`,"data-annotation-id":l.id,"aria-label":`Highlight annotation (${m})`};break}case"comment":l.suggestedText!==void 0?p={class:"tandem-suggestion",style:"background: var(--tandem-accent-bg); text-decoration: underline wavy var(--tandem-accent); text-underline-offset: 3px;","data-annotation-id":l.id,"aria-label":"Replacement annotation"}:l.directedAt==="claude"?p={class:"tandem-question",style:"background: var(--tandem-accent-bg); border-bottom: 2px solid var(--tandem-accent); padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Question annotation"}:p={class:"tandem-comment",style:"border-bottom: 2px dashed var(--tandem-author-user); padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Comment annotation"};break;case"flag":p={class:"tandem-flag",style:"background: var(--tandem-error-bg); border-bottom: 2px solid var(--tandem-error); padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Flag annotation"};break;default:{console.warn("[annotation] Unhandled annotation type in buildDecorations, skipping");return}}try{r.push(Pt.inline(d,f,p))}catch(m){if(!(m instanceof RangeError))throw m;console.debug("[annotation] RangeError for %s (from=%d, to=%d), skipping",l.id,d,f)}}),ut.create(t,r)}const V9=Zt.create({name:"tandemAnnotations",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(xa);return[new xt({key:ah,state:{init(n,r){return iA(r.doc,e,t)},apply(n,r,i,s){return n.getMeta(ah)?iA(s.doc,e,t):n.docChanged?r.map(n.mapping,n.doc):r}},props:{decorations(n){return ah.getState(n)}},view(n){const r=()=>{const i=n.state.tr.setMeta(ah,!0);n.dispatch(i)};return e.observe(r),{destroy(){e.unobserve(r)}}}})]}});function F1(t){return`${t}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function P9(){return F1("ann")}function $9(){return F1("msg")}function F9(t){return F1(t)}const ma=new Rt("tandemAuthorship");function q9(t,e,n){if(t.relRange){const r=t2(n,e,t.relRange);if(r&&r.from<r.to)return r}if(t.range){console.warn("[authorship] Falling back to flat offsets for range",t.id);const r=ml(e,t.range.from),i=ml(e,t.range.to);if(r<i)return{from:r,to:i}}return null}function j0(t,e,n,r){if(!r)return ut.empty;const i=[],s=t.content.size;return e.forEach(l=>{const c=l;if(!c.author||!c.range)return;const d=q9(c,t,n);if(!d)return;const{from:f,to:p}=d;if(f>=p||f<0||p>s)return;const m={class:`tandem-authorship tandem-authorship--${c.author}`};try{i.push(Pt.inline(f,p,m))}catch(g){if(!(g instanceof RangeError))throw g;console.warn("[authorship] Decoration RangeError for entry",c.id,g)}}),ut.create(t,i)}const Y9=Zt.create({name:"tandemAuthorship",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(bC);let n=!1;try{n=localStorage.getItem(uM)==="true"}catch(r){console.warn("[authorship] localStorage unavailable",r)}return[new xt({key:ma,state:{init(r,i){return{visible:n,decorations:j0(i.doc,e,t,n)}},apply(r,i,s,l){const c=r.getMeta(ma);if((c==null?void 0:c.type)==="toggle"){const d=c.visible;return{visible:d,decorations:j0(l.doc,e,t,d)}}return(c==null?void 0:c.type)==="rebuild"?{visible:i.visible,decorations:j0(l.doc,e,t,i.visible)}:r.docChanged&&i.visible?{visible:i.visible,decorations:i.decorations.map(r.mapping,r.doc)}:i}},props:{decorations(r){var i;return((i=ma.getState(r))==null?void 0:i.decorations)??ut.empty}},view(r){const i=()=>{const l=r.state.tr.setMeta(ma,{type:"rebuild"});r.dispatch(l)};e.observe(i);const s=setTimeout(()=>{e.size>0&&i()},500);return{destroy(){clearTimeout(s),e.unobserve(i)}}}})]},onTransaction({transaction:t}){const e=this.options.ydoc;if(!e||t.getMeta("y-sync$")||t.getMeta(ma)||!t.docChanged)return;const n=e.getMap(bC),r=t.doc;t.steps.forEach(i=>{i.getMap().forEach((l,c,d,f)=>{if(f-d-(c-l)>0)try{const m=Ka(r,Kr(d)),g=Ka(r,Kr(f));if(g<=m)return;const b=F9("user"),v={id:b,author:"user",range:{from:m,to:g},timestamp:Date.now()};n.set(b,v)}catch(m){console.warn("[authorship] Position conversion failed during user attribution",m)}})})}}),ch=new Rt("tandemAwareness");function sA(t,e){if(!e)return ut.empty;const n=[],{focusParagraph:r,focusOffset:i,active:s}=e;if(r!==null&&r>=0){let l=0;t.forEach((c,d)=>{l===r&&n.push(Pt.node(d,d+c.nodeSize,{class:"tandem-claude-focus",style:"background: rgba(99, 102, 241, 0.1); border-left: 3px solid rgba(99, 102, 241, 0.4); padding-left: 8px; transition: background 0.3s ease, border-color 0.3s ease;"})),l++})}if(i!==null&&i>=0)try{const l=ml(t,gh(i)),c=s===!1?" tandem-claude-cursor-idle":"";n.push(Pt.widget(l,()=>{const d=document.createElement("span");d.className=`tandem-claude-cursor${c}`,d.setAttribute("aria-hidden","true");const f=document.createElement("span");return f.className="tandem-claude-cursor-label",f.textContent="Claude",d.appendChild(f),d}))}catch(l){console.warn("[awareness] cursor decoration failed, falling back to gutter-only:",l)}return n.length===0?ut.empty:ut.create(t,n)}const K9=Zt.create({name:"tandemAwareness",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(cM),n=t.getMap(ib);return[new xt({key:ch,state:{init(r,i){const s=e.get("claude");return sA(i.doc,s??null)},apply(r,i,s,l){if(r.getMeta(ch)){const c=e.get("claude");return sA(l.doc,c??null)}return r.docChanged?i.map(r.mapping,r.doc):i}},props:{decorations(r){return ch.getState(r)}},view(r){const i=()=>{const s=r.state.tr.setMeta(ch,!0);r.dispatch(s)};return e.observe(i),{destroy(){e.unobserve(i)}}}}),new xt({key:new Rt("tandemUserAwareness"),view(){let r=null,i=null,s=null,l=!1,c=-1;return{update(d,f){const{state:p}=d;if(!p.selection.eq(f.selection)){const m=n2(p.doc,{from:Kr(p.selection.from),to:Kr(p.selection.to)});if(p.selection.from===p.selection.to)s&&(clearTimeout(s),s=null),n.set("selection",{...m,timestamp:Date.now()});else{const g=p.doc.textBetween(p.selection.from,p.selection.to,`
|
|
177
|
+
`),b=g.length>200?g.slice(0,197)+"...":g;s&&clearTimeout(s),s=setTimeout(()=>{s=null,n.set("selection",{...m,selectedText:b,timestamp:Date.now()})},150)}}p.doc!==f.doc&&(c=p.selection.from,l=!0,i||(i=setTimeout(()=>{i=null,l&&n.set("activity",{isTyping:!0,cursor:c,lastEdit:Date.now()})},200)),r&&clearTimeout(r),r=setTimeout(()=>{l=!1,n.set("activity",{isTyping:!1,cursor:d.state.selection.from,lastEdit:Date.now()})},Mz))},destroy(){r&&clearTimeout(r),i&&clearTimeout(i),s&&clearTimeout(s)}}}})]}});function oA({ydoc:t,provider:e,readOnly:n,reviewMode:r,activeAnnotationId:i,onEditorReady:s,onAnnotationClick:l}){const c=IV({extensions:[H9.configure({history:!1}),UH.configure({multicolor:!0}),u8.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),d8.configure({placeholder:"Open a document with Claude to get started..."}),pV.configure({resizable:!0}),yV,mV,gV,LH.configure({document:t}),jH.configure({provider:e,user:{name:Dx(),color:"var(--tandem-warning)"}}),V9.configure({ydoc:t}),Y9.configure({ydoc:t}),K9.configure({ydoc:t})],editorProps:{attributes:{class:"tandem-editor",style:"outline: none; min-height: 500px; font-size: var(--tandem-editor-font-size, 16px); line-height: 1.6;"}}},[t,e]);O.useEffect(()=>{c&&c.setEditable(!n)},[c,n]),O.useEffect(()=>{if(c)return bM(p=>c.commands.updateUser({name:p}))},[c]),O.useEffect(()=>(s==null||s(c),()=>s==null?void 0:s(null)),[c,s]),O.useEffect(()=>{if(!c)return;const p=c.view.dom;p.querySelectorAll(".tandem-annotation-active").forEach(m=>{m.classList.remove("tandem-annotation-active")}),i&&r&&p.querySelectorAll(`[data-annotation-id="${CSS.escape(i)}"]`).forEach(m=>{m.classList.add("tandem-annotation-active")})},[c,i,r]);const d=O.useCallback(p=>{const m=p.target.closest("[data-annotation-id]");if(!m)return;const g=m.getAttribute("data-annotation-id");g&&l&&l(g)},[l]),f=r?"tandem-review-dimmed":"";return k.jsxs("div",{className:f,onClick:d,children:[k.jsx(AV,{editor:c}),k.jsx("style",{children:`
|
|
178
|
+
.tandem-editor h1 { font-size: 2em; font-weight: 700; margin: 0.67em 0; }
|
|
179
|
+
.tandem-editor h2 { font-size: 1.5em; font-weight: 600; margin: 0.75em 0; }
|
|
180
|
+
.tandem-editor h3 { font-size: 1.17em; font-weight: 600; margin: 0.83em 0; }
|
|
181
|
+
.tandem-editor p { margin: 0.5em 0; }
|
|
182
|
+
.tandem-editor ul, .tandem-editor ol { padding-left: 1.5em; }
|
|
183
|
+
.tandem-editor table { border-collapse: collapse; width: 100%; margin: 1em 0; }
|
|
184
|
+
.tandem-editor td, .tandem-editor th { border: 1px solid var(--tandem-border); padding: 8px; }
|
|
185
|
+
.tandem-editor th { background: var(--tandem-surface-muted); font-weight: 600; }
|
|
186
|
+
.tandem-editor blockquote {
|
|
187
|
+
border-left: 3px solid var(--tandem-border-strong);
|
|
188
|
+
margin: 0.5em 0;
|
|
189
|
+
padding-left: 1em;
|
|
190
|
+
color: var(--tandem-fg-muted);
|
|
191
|
+
}
|
|
192
|
+
.collaboration-cursor__caret {
|
|
193
|
+
position: relative;
|
|
194
|
+
border-left: 2px solid;
|
|
195
|
+
border-right: none;
|
|
196
|
+
margin-left: -1px;
|
|
197
|
+
}
|
|
198
|
+
.collaboration-cursor__label {
|
|
199
|
+
position: absolute;
|
|
200
|
+
top: -1.4em;
|
|
201
|
+
left: -1px;
|
|
202
|
+
font-size: 12px;
|
|
203
|
+
white-space: nowrap;
|
|
204
|
+
padding: 0 4px;
|
|
205
|
+
border-radius: 3px 3px 3px 0;
|
|
206
|
+
color: var(--tandem-accent-fg);
|
|
207
|
+
}
|
|
208
|
+
.ProseMirror-focused { outline: none; }
|
|
209
|
+
.ProseMirror p.is-empty::before {
|
|
210
|
+
content: attr(data-placeholder);
|
|
211
|
+
color: var(--tandem-fg-subtle);
|
|
212
|
+
pointer-events: none;
|
|
213
|
+
float: left;
|
|
214
|
+
height: 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* Annotation decorations */
|
|
218
|
+
.tandem-highlight { cursor: pointer; }
|
|
219
|
+
.tandem-highlight:hover { filter: brightness(0.95); }
|
|
220
|
+
.tandem-comment { cursor: pointer; }
|
|
221
|
+
.tandem-comment:hover { border-bottom-style: solid; }
|
|
222
|
+
.tandem-suggestion { cursor: pointer; }
|
|
223
|
+
|
|
224
|
+
/* Review mode dimming — grays out text, keeps annotated spans readable */
|
|
225
|
+
.tandem-review-dimmed .ProseMirror {
|
|
226
|
+
color: var(--tandem-fg-subtle);
|
|
227
|
+
transition: color 0.2s;
|
|
228
|
+
}
|
|
229
|
+
.tandem-review-dimmed .tandem-highlight,
|
|
230
|
+
.tandem-review-dimmed .tandem-comment,
|
|
231
|
+
.tandem-review-dimmed .tandem-suggestion {
|
|
232
|
+
color: var(--tandem-fg);
|
|
233
|
+
}
|
|
234
|
+
.tandem-review-dimmed .tandem-annotation-active {
|
|
235
|
+
outline: 2px solid var(--tandem-accent);
|
|
236
|
+
outline-offset: 1px;
|
|
237
|
+
border-radius: 2px;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* Authorship decorations — user=blue, claude=orange */
|
|
241
|
+
.tandem-authorship { transition: color 0.2s; }
|
|
242
|
+
.tandem-authorship--user { color: var(--tandem-author-user); }
|
|
243
|
+
.tandem-authorship--claude { color: var(--tandem-author-claude); }
|
|
244
|
+
|
|
245
|
+
/* Claude focus paragraph */
|
|
246
|
+
.tandem-claude-focus {
|
|
247
|
+
position: relative;
|
|
248
|
+
}
|
|
249
|
+
.tandem-claude-focus::before {
|
|
250
|
+
content: '';
|
|
251
|
+
position: absolute;
|
|
252
|
+
left: -24px;
|
|
253
|
+
top: 0;
|
|
254
|
+
bottom: 0;
|
|
255
|
+
width: 3px;
|
|
256
|
+
background: var(--tandem-accent);
|
|
257
|
+
border-radius: 2px;
|
|
258
|
+
animation: tandem-gutter-pulse 2s ease-in-out infinite;
|
|
259
|
+
}
|
|
260
|
+
@keyframes tandem-gutter-pulse {
|
|
261
|
+
0%, 100% { opacity: 0.4; }
|
|
262
|
+
50% { opacity: 1; }
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/* Claude character-level cursor */
|
|
266
|
+
.tandem-claude-cursor {
|
|
267
|
+
position: relative;
|
|
268
|
+
display: inline;
|
|
269
|
+
border-left: 2px solid var(--tandem-author-claude);
|
|
270
|
+
margin-left: -1px;
|
|
271
|
+
z-index: 10;
|
|
272
|
+
animation: tandem-claude-blink 1.2s step-end infinite;
|
|
273
|
+
}
|
|
274
|
+
.tandem-claude-cursor-idle {
|
|
275
|
+
opacity: 0.3;
|
|
276
|
+
animation: none;
|
|
277
|
+
}
|
|
278
|
+
.tandem-claude-cursor-label {
|
|
279
|
+
position: absolute;
|
|
280
|
+
top: -1.4em;
|
|
281
|
+
left: -1px;
|
|
282
|
+
font-size: 11px;
|
|
283
|
+
font-weight: 500;
|
|
284
|
+
white-space: nowrap;
|
|
285
|
+
padding: 0 4px;
|
|
286
|
+
border-radius: 3px 3px 3px 0;
|
|
287
|
+
background: var(--tandem-author-claude);
|
|
288
|
+
color: var(--tandem-accent-fg);
|
|
289
|
+
pointer-events: none;
|
|
290
|
+
z-index: 11;
|
|
291
|
+
}
|
|
292
|
+
@keyframes tandem-claude-blink {
|
|
293
|
+
0%, 100% { opacity: 1; }
|
|
294
|
+
50% { opacity: 0; }
|
|
295
|
+
}
|
|
296
|
+
`})]})}function dn({label:t,ariaLabel:e,shortcut:n,disabled:r,disabledTitle:i,active:s,onMouseDown:l,onClick:c,style:d}){let f="1px solid var(--tandem-border)",p="var(--tandem-surface)",m="var(--tandem-fg)";r?(p="var(--tandem-surface-muted)",m="var(--tandem-fg-subtle)"):s&&(f="1px solid var(--tandem-accent)",p="var(--tandem-accent-bg)",m="var(--tandem-accent)");const g=e??(typeof t=="string"?t:void 0),b=g??"";return k.jsx("button",{type:"button",disabled:r,title:r&&i?i:n?`${b} (${n})`:b,"aria-label":g,onMouseDown:l,onClick:c,style:{padding:"4px 10px",fontSize:"13px",borderRadius:"4px",cursor:r?"not-allowed":"pointer",...d,border:f,background:p,color:m},children:t})}const W9=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("circle",{cx:"2",cy:"4",r:"1.5",fill:"currentColor"}),k.jsx("circle",{cx:"2",cy:"8",r:"1.5",fill:"currentColor"}),k.jsx("circle",{cx:"2",cy:"12",r:"1.5",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"})]}),G9=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"}),k.jsx("text",{x:"0",y:"5.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"1."}),k.jsx("text",{x:"0",y:"9.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"2."}),k.jsx("text",{x:"0",y:"13.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"3."})]}),Z9=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M6.5 8.5a3.5 3.5 0 0 0 5 0l2-2a3.5 3.5 0 0 0-5-5l-1 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M9.5 7.5a3.5 3.5 0 0 0-5 0l-2 2a3.5 3.5 0 0 0 5 5l1-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),J9=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M5 4L1 8l4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M11 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M9 2l-2 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),X9=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("rect",{x:"0",y:"2",width:"3",height:"12",rx:"1.5",fill:"currentColor"}),k.jsx("rect",{x:"5",y:"4",width:"9",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),k.jsx("rect",{x:"5",y:"8",width:"7",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),k.jsx("rect",{x:"5",y:"12",width:"8",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"})]}),Q9=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M4 7L1 4l3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M1 4h9a5 5 0 0 1 0 10H7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),eP=k.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M12 7l3-3-3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),k.jsx("path",{d:"M15 4H6a5 5 0 0 0 0 10h3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),r2=[1,2,3],tP={1:700,2:600,3:500};function nP(t){for(const e of r2)if(t.isActive("heading",{level:e}))return e;return null}function Hr(t){return e=>{e.preventDefault(),t()}}function rP({editor:t,disabled:e}){var v,w;const[,n]=O.useState(0),[r,i]=O.useState(!1),s=O.useRef(null);if(O.useEffect(()=>{if(!t)return;const C=()=>{t.isDestroyed||n(E=>E+1)};return t.on("transaction",C),()=>{t.off("transaction",C)}},[t]),O.useEffect(()=>{if(!r)return;function C(E){s.current&&!s.current.contains(E.target)&&i(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[r]),!t)return null;const c=!t.isEditable||!!e,d=Ti.getState(t.state),f=!c&&(((v=d==null?void 0:d.undoManager)==null?void 0:v.undoStack.length)??0)>0,p=!c&&(((w=d==null?void 0:d.undoManager)==null?void 0:w.redoStack.length)??0)>0,m=nP(t);function g(C){return E=>{E.preventDefault(),!(!t||t.isDestroyed)&&(t.chain().focus().toggleHeading({level:C}).run(),i(!1))}}const b=m?`H${m}`:"H";return k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[k.jsx(dn,{label:Q9,ariaLabel:"Undo",shortcut:"Ctrl+Z",disabled:!f,onMouseDown:Hr(()=>t.commands.undo()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx(dn,{label:eP,ariaLabel:"Redo",shortcut:"Ctrl+Shift+Z",disabled:!p,onMouseDown:Hr(()=>t.commands.redo()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx("div",{style:{width:"1px",height:"16px",background:"var(--tandem-border)",margin:"0 2px"}}),k.jsx(dn,{label:"B",shortcut:"Ctrl+B",disabled:c,active:t.isActive("bold"),onMouseDown:Hr(()=>t.chain().focus().toggleBold().run()),style:{fontWeight:700,minWidth:"30px"}}),k.jsx(dn,{label:"I",shortcut:"Ctrl+I",disabled:c,active:t.isActive("italic"),onMouseDown:Hr(()=>t.chain().focus().toggleItalic().run()),style:{fontStyle:"italic",minWidth:"30px"}}),k.jsx(dn,{label:"S",shortcut:"Ctrl+Shift+X",disabled:c,active:t.isActive("strike"),onMouseDown:Hr(()=>t.chain().focus().toggleStrike().run()),style:{textDecoration:"line-through",minWidth:"30px"}}),k.jsx(dn,{label:"<>",shortcut:"Ctrl+E",disabled:c,active:t.isActive("code"),onMouseDown:Hr(()=>t.chain().focus().toggleCode().run()),style:{fontFamily:"monospace",minWidth:"30px"}}),k.jsxs("div",{style:{position:"relative"},ref:s,onKeyDown:C=>{C.key==="Escape"&&i(!1)},children:[k.jsx(dn,{label:b,disabled:c,active:m!==null,onMouseDown:C=>{C.preventDefault(),i(E=>!E)},style:{minWidth:"30px"}}),r&&k.jsx("div",{role:"menu","aria-label":"Heading level",style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"var(--tandem-surface)",border:"1px solid var(--tandem-border)",borderRadius:"6px",padding:"4px",display:"flex",flexDirection:"column",gap:"2px",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:r2.map(C=>k.jsxs("button",{type:"button",role:"menuitem",onMouseDown:g(C),style:{padding:"4px 12px",fontSize:"13px",border:"none",borderRadius:"4px",background:m===C?"var(--tandem-accent-bg)":"transparent",color:m===C?"var(--tandem-accent)":"var(--tandem-fg)",cursor:"pointer",textAlign:"left",fontWeight:tP[C],whiteSpace:"nowrap"},children:["Heading ",C]},C))})]}),k.jsx("div",{style:{width:"1px",height:"16px",background:"var(--tandem-border)",margin:"0 2px"}}),k.jsx(dn,{label:W9,ariaLabel:"Bullet list",shortcut:"Ctrl+Shift+8",disabled:c,active:t.isActive("bulletList"),onMouseDown:Hr(()=>t.chain().focus().toggleBulletList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx(dn,{label:G9,ariaLabel:"Ordered list",shortcut:"Ctrl+Shift+7",disabled:c,active:t.isActive("orderedList"),onMouseDown:Hr(()=>t.chain().focus().toggleOrderedList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx(dn,{label:X9,ariaLabel:"Blockquote",shortcut:"Ctrl+Shift+B",disabled:c,active:t.isActive("blockquote"),onMouseDown:Hr(()=>t.chain().focus().toggleBlockquote().run()),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx("div",{style:{width:"1px",height:"16px",background:"var(--tandem-border)",margin:"0 2px"}}),k.jsx(dn,{label:Z9,ariaLabel:"Link",shortcut:"Ctrl+K",disabled:c||!t.isActive("link")&&t.state.selection.from===t.state.selection.to,active:t.isActive("link"),onMouseDown:Hr(()=>{if(t.isActive("link"))t.chain().focus().unsetLink().run();else{const C=window.prompt("Enter URL:");C&&t.chain().focus().setLink({href:C}).run()}}),style:{minWidth:"30px",padding:"4px 6px"}}),k.jsx(dn,{label:"—",ariaLabel:"Horizontal rule",disabled:c,onMouseDown:Hr(()=>t.chain().focus().setHorizontalRule().run()),style:{minWidth:"30px"}}),k.jsx(dn,{label:J9,ariaLabel:"Code block",disabled:c,active:t.isActive("codeBlock"),onMouseDown:Hr(()=>t.chain().focus().toggleCodeBlock().run()),style:{minWidth:"30px",padding:"4px 6px"}})]})}function iP({inputRef:t,value:e,onChange:n,onKeyDown:r,onSubmit:i,onCancel:s,placeholder:l,submitLabel:c,borderColor:d,canSubmit:f,secondaryInput:p}){return k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[k.jsx("input",{ref:t,type:"text",value:e,onChange:m=>n(m.target.value),onKeyDown:r,placeholder:l,style:{padding:"3px 8px",fontSize:"13px",border:`1px solid ${d}`,borderRadius:"4px",outline:"none",minWidth:"120px",flex:"1 1 200px",background:"var(--tandem-surface)",color:"var(--tandem-fg)"}}),p,k.jsx(dn,{label:c,disabled:!f,onClick:i}),k.jsx(dn,{label:"Cancel",disabled:!1,onClick:s})]})}const sP=[{value:"yellow",label:"Yellow"},{value:"red",label:"Red"},{value:"green",label:"Green"},{value:"blue",label:"Blue"},{value:"purple",label:"Purple"}];function oP({editor:t,ydoc:e,onSettingsOpen:n,settingsBtnRef:r,tandemMode:i,onModeChange:s,heldCount:l}){const[c,d]=O.useState(!1),[f,p]=O.useState("yellow"),[m,g]=O.useState(!1),[b,v]=O.useState("idle"),[w,C]=O.useState(""),[E,I]=O.useState(!1),[j,Q]=O.useState(""),[V,_]=O.useState(!1),N=O.useRef(null),Z=O.useRef(null),Y=O.useRef(null);O.useEffect(()=>{if(!t)return;const F=t;function ue(){const{from:le,to:Re}=F.state.selection,Be=le!==Re;d(Ie=>Ie===Be?Ie:Be)}return t.on("selectionUpdate",ue),()=>{t.off("selectionUpdate",ue)}},[t]),O.useEffect(()=>{b==="comment"&&Z.current&&Z.current.focus()},[b]),O.useEffect(()=>{if(!m)return;function F(ue){Y.current&&!Y.current.contains(ue.target)&&g(!1)}return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[m]);function ce(F,ue,le){if(!t||!e)return;const Re=N.current??t.state.selection,{from:Be,to:Ie}=Re;if(Be===Ie)return;const Xe=Ka(t.state.doc,Kr(Be)),Me=Ka(t.state.doc,Kr(Ie)),Ye=P9(),At={id:Ye,author:"user",type:F,range:{from:Xe,to:Me},content:ue,status:"pending",timestamp:Date.now(),...le!=null&&le.color?{color:le.color}:{},...(le==null?void 0:le.suggestedText)!==void 0?{suggestedText:le.suggestedText}:{},...(le==null?void 0:le.directedAt)!==void 0?{directedAt:le.directedAt}:{}};e.getMap(xa).set(Ye,At),N.current=null}function ie(){if(!t)return;const{from:F,to:ue}=t.state.selection;N.current={from:F,to:ue}}function se(){N.current=null,t==null||t.chain().focus().run()}const xe=b!=="idle";function pe(F){F.preventDefault(),ce("highlight","",{color:f})}function U(F){F.preventDefault(),g(ue=>!ue)}function L(F){p(F),g(!1)}const G=O.useCallback(F=>ue=>{ue.preventDefault(),ie(),v(F),C(""),Q(""),I(!1),_(!1)},[t]),me=O.useMemo(()=>G("comment"),[G]);function Ae(){v("idle"),C(""),Q(""),I(!1),_(!1),se()}function M(){if(!w.trim()&&!j.trim()){Ae();return}const F={};E&&j.trim()&&(F.suggestedText=j.trim()),V&&(F.directedAt="claude"),ce("comment",w.trim(),F),v("idle"),C(""),Q(""),I(!1),_(!1),t==null||t.chain().focus().run()}function D(F){F.key==="Enter"?(F.preventDefault(),M()):F.key==="Escape"&&Ae()}function H(F){F.preventDefault(),ce("flag","")}const T=t&&e&&c;return k.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px",minHeight:"42px",padding:"8px 16px",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",userSelect:"none"},children:[k.jsx("span",{style:{fontWeight:700,fontSize:"15px",color:"var(--tandem-accent)",letterSpacing:"-0.02em"},children:"Tandem"}),k.jsx("div",{style:{width:"1px",height:"20px",background:"var(--tandem-border)",margin:"0 8px"}}),k.jsx(rP,{editor:t,disabled:xe}),k.jsx("div",{style:{width:"1px",height:"20px",background:"var(--tandem-border)",margin:"0 8px"}}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",position:"relative"},children:[k.jsx(dn,{label:"Highlight",disabled:!T||xe,disabledTitle:"Select text first",onMouseDown:pe,style:{borderRadius:"4px 0 0 4px",borderRight:"none"}}),k.jsx("button",{disabled:!T||xe,onMouseDown:U,title:"Choose highlight color",style:{padding:"4px 6px",fontSize:"13px",border:"1px solid var(--tandem-border)",borderRadius:"0 4px 4px 0",background:!T||xe?"var(--tandem-surface-muted)":"var(--tandem-surface)",cursor:!T||xe?"not-allowed":"pointer",display:"flex",alignItems:"center"},children:k.jsx("span",{style:{display:"inline-block",width:"12px",height:"12px",borderRadius:"2px",background:zu[f],border:"1px solid rgba(0,0,0,0.15)"}})}),m&&k.jsxs("div",{ref:Y,style:{position:"absolute",top:"100%",left:0,marginTop:"4px",background:"var(--tandem-surface)",border:"1px solid var(--tandem-border)",borderRadius:"6px",padding:"6px",display:"flex",gap:"4px",zIndex:10,boxShadow:"0 2px 8px rgba(0,0,0,0.1)"},children:[sP.map(({value:F,label:ue})=>k.jsx("button",{title:ue,onClick:()=>L(F),style:{width:"24px",height:"24px",borderRadius:"4px",border:F===f?"2px solid var(--tandem-fg)":"1px solid rgba(0,0,0,0.15)",background:zu[F],cursor:"pointer",padding:0}},F)),k.jsx("button",{"data-testid":"color-picker-close",title:"Close",onClick:()=>g(!1),style:{width:"24px",height:"24px",borderRadius:"4px",border:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",cursor:"pointer",padding:0,fontSize:"13px",color:"var(--tandem-fg-muted)",display:"flex",alignItems:"center",justifyContent:"center"},children:"✕"})]})]}),k.jsx(dn,{label:"Comment",disabled:!T||xe,disabledTitle:"Select text first",onMouseDown:me}),b==="comment"&&k.jsx(iP,{inputRef:Z,value:w,onChange:C,onKeyDown:D,onSubmit:M,onCancel:Ae,placeholder:V?"Ask about this text...":"Add a comment...",submitLabel:E?"Suggest":V?"Ask":"Add",borderColor:E?"var(--tandem-author-user)":V?"var(--tandem-accent)":"var(--tandem-author-user)",canSubmit:!!w.trim()||E&&!!j.trim(),secondaryInput:k.jsxs(k.Fragment,{children:[E&&k.jsx("input",{type:"text",value:j,onChange:F=>Q(F.target.value),onKeyDown:D,placeholder:"Replacement text...",style:{padding:"3px 8px",fontSize:"13px",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",outline:"none",minWidth:"100px",flex:"1 1 140px",background:"var(--tandem-surface)",color:"var(--tandem-fg)"}}),k.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[k.jsxs("label",{style:{fontSize:"11px",color:E?"var(--tandem-accent)":"var(--tandem-fg-subtle)",cursor:"pointer",display:"flex",alignItems:"center",gap:"3px",userSelect:"none"},children:[k.jsx("input",{type:"checkbox",checked:E,onChange:F=>{I(F.target.checked),F.target.checked||Q("")},style:{margin:0}}),"Replace"]}),k.jsxs("label",{style:{fontSize:"11px",color:V?"var(--tandem-accent)":"var(--tandem-fg-subtle)",cursor:"pointer",display:"flex",alignItems:"center",gap:"3px",userSelect:"none"},children:[k.jsx("input",{type:"checkbox",checked:V,onChange:F=>_(F.target.checked),style:{margin:0}}),"@Claude"]})]})]})}),k.jsx(dn,{label:"Flag",disabled:!T||xe,onMouseDown:H}),k.jsx("div",{style:{flex:1}}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[(l??0)>0&&k.jsxs("span",{"data-testid":"held-badge",style:{padding:"1px 6px",fontSize:"10px",fontWeight:600,color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",borderRadius:"9999px"},children:[l," held"]}),i&&s&&k.jsxs("div",{"data-testid":"mode-toggle",role:"group","aria-label":"Claude collaboration mode",style:{display:"flex",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",overflow:"hidden"},children:[k.jsxs("button",{"data-testid":"mode-solo-btn",title:"Write undisturbed — Claude only responds when you message","aria-pressed":i==="solo",onClick:()=>s("solo"),style:{padding:"3px 10px",fontSize:"12px",border:"none",cursor:"pointer",background:i==="solo"?"var(--tandem-accent)":"transparent",color:i==="solo"?"var(--tandem-accent-fg)":"var(--tandem-fg-muted)",fontWeight:i==="solo"?600:400,borderRight:"1px solid var(--tandem-border-strong)",display:"flex",alignItems:"center",gap:"5px"},children:[i==="solo"&&k.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--tandem-fg-subtle)",display:"inline-block"}}),"Solo"]}),k.jsxs("button",{"data-testid":"mode-tandem-btn",title:"Full collaboration — Claude reacts to selections and document changes","aria-pressed":i==="tandem",onClick:()=>s("tandem"),style:{padding:"3px 10px",fontSize:"12px",border:"none",cursor:"pointer",background:i==="tandem"?"var(--tandem-accent)":"transparent",color:i==="tandem"?"var(--tandem-accent-fg)":"var(--tandem-fg-muted)",fontWeight:i==="tandem"?600:400,display:"flex",alignItems:"center",gap:"5px"},children:[i==="tandem"&&k.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--tandem-success)",display:"inline-block"}}),"Tandem"]})]}),n&&k.jsx("button",{ref:r,"data-testid":"settings-btn",onClick:n,title:"Settings (Ctrl+,)","aria-label":"Settings","aria-keyshortcuts":"Control+Comma",style:{background:"none",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",cursor:"pointer",color:"var(--tandem-fg-muted)",fontSize:"13px",padding:"4px 12px",minHeight:"24px"},children:"Settings"})]})]})}function lP(){const[t,e]=O.useState(!1),n=O.useCallback(s=>{s.dataTransfer.types.includes("Files")&&(s.preventDefault(),e(!0))},[]),r=O.useCallback(s=>{(s.currentTarget===s.target||!s.currentTarget.contains(s.relatedTarget))&&e(!1)},[]),i=O.useCallback(async s=>{if(e(!1),!s.dataTransfer.files.length)return;s.preventDefault();const l=s.dataTransfer.files[0],c=await yM(l);try{const d=await fetch(`${Bu}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:l.name,content:c})});if(!d.ok){const f=await d.json().catch(()=>({message:"Upload failed"}));console.error("[useFileDrop] Upload failed:",d.status,f.message??f.error)}}catch{console.error("[useFileDrop] Server unreachable — file drop ignored")}},[]);return{fileDragOver:t,handleEditorDragOver:n,handleEditorDragLeave:r,handleEditorDrop:i}}function aP(t,e){return t.status!=="pending"||e==="tandem"?!0:t.author!=="claude"}function cP(t,e){return O.useMemo(()=>{const n=[];let r=0;for(const i of t)aP(i,e)?n.push(i):i.status==="pending"&&r++;return{visibleAnnotations:n,heldCount:r}},[t,e])}function uP(){const[t,e]=O.useState([]),n=O.useRef(new Map),r=O.useCallback((l,c)=>{const d=n.current.get(l);d&&clearTimeout(d);const f=xC[c]??xC.info,p=setTimeout(()=>{e(m=>m.filter(g=>g.id!==l)),n.current.delete(l)},f);n.current.set(l,p)},[]),i=O.useCallback(l=>{const c=n.current.get(l);c&&(clearTimeout(c),n.current.delete(l))},[]),s=O.useCallback(l=>{e(c=>c.filter(d=>d.id!==l)),i(l)},[i]);return O.useEffect(()=>{const l=`http://localhost:${Ga}/api/notify-stream`,c=new EventSource(l);return c.onmessage=d=>{let f;try{f=JSON.parse(d.data)}catch{console.warn("[useNotifications] Malformed SSE data:",d.data);return}e(p=>{if(f.dedupKey){const b=p.findIndex(v=>v.dedupKey===f.dedupKey);if(b!==-1){const v=p[b];i(v.id);const w={...f,count:v.count+1},C=[...p];return C[b]=w,r(w.id,w.severity),C}}const m={...f,count:1},g=[...p,m];for(;g.length>Bz;){const b=g.shift();i(b.id)}return r(m.id,m.severity),g})},c.onerror=()=>{c.readyState===EventSource.CLOSED&&console.warn("[useNotifications] EventSource permanently closed. Notifications will not be delivered. Is the server running?")},()=>{c.close();for(const d of n.current.values())clearTimeout(d);n.current.clear()}},[r,i]),{toasts:t,dismiss:s}}function dP(t){const[e,n]=O.useState(!1),[r,i]=O.useState(null),s=O.useRef(0),{pendingCount:l,acceptedCount:c,dismissedCount:d}=O.useMemo(()=>{let p=0,m=0,g=0;for(const b of t)b.status==="pending"?p++:b.status==="accepted"?m++:b.status==="dismissed"&&g++;return{pendingCount:p,acceptedCount:m,dismissedCount:g}},[t]);O.useEffect(()=>{const p=c+d;s.current>0&&l===0&&p>0&&(i({accepted:c,dismissed:d,total:p}),n(!0)),s.current=l},[l,c,d]);const f=O.useCallback(()=>{n(!1)},[]);return{pendingCount:l,showReviewSummary:e,reviewSummaryData:r,dismissReviewSummary:f}}function fP(t){const[e,n]=O.useState(!1),r=O.useRef(!1),i=O.useCallback(async()=>{if(!(!t||r.current)){r.current=!0,n(!0);try{const s=await fetch(`http://localhost:${Ga}/api/save`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:t})});if(!s.ok){const l=await s.json().catch(()=>({}));console.warn("[Tandem] Save failed:",l.message??s.statusText)}}catch(s){console.warn("[Tandem] Save request failed:",s)}finally{r.current=!1,n(!1)}}},[t]);return O.useEffect(()=>{const s=l=>{l.key==="s"&&(l.ctrlKey||l.metaKey)&&(l.preventDefault(),i())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[i]),{saving:e,triggerSave:i}}function hP(t){return t.isComposing||t.code!=="Comma"?!1:t.ctrlKey||t.metaKey}function pP(t){O.useEffect(()=>{const e=n=>{hP(n)&&(n.preventDefault(),t())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t])}function mP(t,e,n){if(t.length<2)return null;const s=(t.findIndex(l=>l.id===e)+(n?-1:1)+t.length)%t.length;return t[s].id}function gP(t,e,n){const r=O.useRef(t);r.current=t;const i=O.useRef(e);i.current=e,O.useEffect(()=>{const s=l=>{if(!l.ctrlKey&&!l.metaKey||l.key!=="Tab")return;const c=mP(r.current,i.current,l.shiftKey);c&&(l.preventDefault(),n(c))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n])}function lA(t,e){const n=new Set(e),r=t.filter(l=>n.has(l)),i=new Set(r),s=e.filter(l=>!i.has(l));return[...r,...s]}function yP(t,e,n,r,i="left"){const s=t.filter(m=>r.has(m)),l=s.indexOf(e),c=s.indexOf(n);if(l===-1||c===-1)return s;const d=[...s];d.splice(l,1);const f=d.indexOf(n),p=i==="right"?f+1:f;return d.splice(p,0,e),d}function bP(t){const[e,n]=O.useState([]),r=O.useMemo(()=>{const l=new Map(t.map(f=>[f.id,f])),c=t.map(f=>f.id);return lA(e,c).map(f=>l.get(f)).filter(Boolean)},[t,e]),i=O.useMemo(()=>t.map(l=>l.id),[t]);O.useEffect(()=>{n(l=>{const c=lA(l,i);return l.length===c.length&&l.every((d,f)=>d===c[f])?l:c})},[i]);const s=O.useCallback(function(c,d,f="left"){if(c===d)return;const p=new Set(i);n(m=>yP(m,c,d,p,f))},[i]);return{orderedTabs:r,reorder:s}}const xP={s:14,m:16,l:18};function aA(){try{return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}const ru={layout:"three-panel",primaryTab:"chat",panelOrder:"chat-editor-annotations",editorWidthPercent:50,selectionDwellMs:aM,showAuthorship:!1,reduceMotion:!1,textSize:"m",theme:"system"};function vP(){let t;try{t=localStorage.getItem(oM)}catch{t=null}if(t)try{const e=JSON.parse(t);return{layout:e.layout==="three-panel"||e.layout==="tabbed"?e.layout:ru.layout,primaryTab:e.primaryTab==="annotations"?"annotations":"chat",panelOrder:e.panelOrder==="annotations-editor-chat"?"annotations-editor-chat":"chat-editor-annotations",editorWidthPercent:Math.max(50,Math.min(100,Number(e.editorWidthPercent)||ru.editorWidthPercent)),selectionDwellMs:Math.max(Nh,Math.min(zh,Number(e.selectionDwellMs)||aM)),showAuthorship:e.showAuthorship===!0,reduceMotion:typeof e.reduceMotion=="boolean"?e.reduceMotion:aA(),textSize:e.textSize==="s"||e.textSize==="m"||e.textSize==="l"?e.textSize:ru.textSize,theme:e.theme==="light"||e.theme==="dark"||e.theme==="system"?e.theme:ru.theme}}catch(e){console.warn("[tandem] settings JSON is corrupt, resetting to defaults:",e)}return{...ru,reduceMotion:aA()}}function SP(t,e){const n={...t,...e};return{...n,editorWidthPercent:Math.max(50,Math.min(100,n.editorWidthPercent)),selectionDwellMs:Math.max(Nh,Math.min(zh,n.selectionDwellMs))}}function wP(){const[t,e]=O.useState(vP),n=O.useCallback(r=>{e(i=>{const s=SP(i,r);try{localStorage.setItem(oM,JSON.stringify(s)),localStorage.setItem(uM,String(s.showAuthorship))}catch{}return s})},[]);return{settings:t,updateSettings:n}}function i2(){try{return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function kP(t){return t==="system"?i2():t}function CP(t){const e=document.documentElement;if(e.setAttribute("data-theme",kP(t)),t!=="system")return()=>e.removeAttribute("data-theme");const n=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>e.setAttribute("data-theme",i2());return n.addEventListener("change",r),()=>{n.removeEventListener("change",r),e.removeAttribute("data-theme")}}function EP(t){O.useEffect(()=>CP(t),[t])}function TP(){try{return localStorage.getItem(hM)==="true"}catch{return!1}}function cA(){try{localStorage.setItem(hM,"true")}catch{}}function AP(t,e,n){const[r,i]=O.useState(TP),[s,l]=O.useState(0),c=O.useRef(0),f=!r&&n==="welcome.md";O.useEffect(()=>{if(!f||s!==0)return;const b=t.filter(w=>w.id.startsWith(Uz));if(b.length===0)return;b.some(w=>w.status!=="pending")&&(c.current=Date.now(),l(1))},[f,s,t]),O.useEffect(()=>{if(!f||s!==1)return;t.some(v=>v.author==="user")&&(c.current=Date.now(),l(2))},[f,s,t]);const p=e.current;O.useEffect(()=>{if(!f||s!==2||!p)return;const b=()=>{Date.now()-c.current<2e3||p.isFocused&&(c.current=Date.now(),l(3))};return p.on("update",b),()=>{p.off("update",b)}},[f,s,p]),O.useEffect(()=>{if(!f||s!==3)return;const b=setTimeout(()=>{cA(),i(!0)},3e3);return()=>clearTimeout(b)},[f,s]);const m=O.useCallback(()=>{cA(),i(!0)},[]),g=O.useCallback(()=>{c.current=Date.now(),l(b=>Math.min(b+1,3))},[]);return{tutorialActive:f,currentStep:s,dismissTutorial:m,nextStep:g}}const MP="modulepreload",OP=function(t){return"/"+t},uA={},_P=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=l(n.map(f=>{if(f=OP(f),f in uA)return;uA[f]=!0;const p=f.endsWith(".css"),m=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const g=document.createElement("link");if(g.rel=p?"stylesheet":MP,p||(g.as="script"),g.crossOrigin="",g.href=f,d&&g.setAttribute("nonce",d),document.head.appendChild(g),p)return new Promise((b,v)=>{g.addEventListener("load",b),g.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${f}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return i.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})};function DP(){O.useEffect(()=>{let t=!1,e;return _P(async()=>{const{getCurrentWebview:n}=await import("./webview-0tvvWtyc.js");return{getCurrentWebview:n}},[]).then(({getCurrentWebview:n})=>{if(t)return;const r=n();let i=Qc;try{const f=localStorage.getItem(vC);if(f!==null){const p=Number(f);Number.isFinite(p)?i=Math.max(SC,Math.min(wC,p)):console.warn(`[tandem] ignoring invalid stored zoom: ${f}`)}}catch{}i!==Qc&&r.setZoom(i).catch(f=>{console.warn("[tandem] failed to restore zoom level:",f)});function s(f){try{localStorage.setItem(vC,String(f))}catch{}}const l=f=>{!(f.metaKey||f.ctrlKey)||f.key!=="0"||(f.preventDefault(),f.stopPropagation(),i=Qc,r.setZoom(Qc).catch(m=>{console.warn("[tandem] failed to reset zoom:",m)}),s(Qc))},c=.1,d=f=>{if(!(f.metaKey||f.ctrlKey))return;const m=f.key==="+"||f.key==="=",g=f.key==="-"||f.key==="_";if(!m&&!g)return;const b=m?i+c:i-c;i=Math.max(SC,Math.min(wC,Math.round(b*100)/100)),s(i)};window.addEventListener("keydown",l,{capture:!0}),window.addEventListener("keydown",d,{capture:!0}),e=()=>{window.removeEventListener("keydown",l,{capture:!0}),window.removeEventListener("keydown",d,{capture:!0})}}).catch(()=>{}),()=>{t=!0,e==null||e()}},[])}const RP=Math.floor,NP=(t,e)=>t<e?t:e,zP=(t,e)=>t>e?t:e,s2=128,_h=127,LP=Number.MAX_SAFE_INTEGER,jP=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},dd=typeof TextEncoder<"u"?new TextEncoder:null,IP=t=>dd.encode(t),BP=dd?IP:jP;let Au=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Au&&Au.decode(new Uint8Array).length===1&&(Au=null);const Fp=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Tm=(t,e)=>{for(;e>_h;)Fp(t,s2|_h&e),e=RP(e/128);Fp(t,_h&e)},ux=new Uint8Array(3e4),UP=ux.length/3,HP=(t,e)=>{if(e.length<UP){const n=dd.encodeInto(e,ux).written||0;Tm(t,n);for(let r=0;r<n;r++)Fp(t,ux[r])}else FP(t,BP(e))},VP=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Tm(t,r);for(let i=0;i<r;i++)Fp(t,n.codePointAt(i))},PP=dd&&dd.encodeInto?HP:VP,$P=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=NP(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(zP(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},FP=(t,e)=>{Tm(t,e.byteLength),$P(t,e)},o2=t=>new Error(t),qP=o2("Unexpected end of array"),YP=o2("Integer out of Range"),KP=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},WP=t=>KP(t,q1(t)),dA=t=>t.arr[t.pos++],q1=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&_h)*n,n*=128,i<s2)return e;if(e>LP)throw YP}throw qP},GP=t=>{let e=q1(t);if(e===0)return"";{let n=String.fromCodePoint(dA(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(dA(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))}},ZP=t=>Au.decode(WP(t)),fA=Au?ZP:GP;var Oa;(function(t){t[t.Token=0]="Token",t[t.PermissionDenied=1]="PermissionDenied",t[t.Authenticated=2]="Authenticated"})(Oa||(Oa={}));const JP=(t,e)=>{Tm(t,Oa.Token),PP(t,e)},XP=(t,e,n,r)=>{switch(q1(t)){case Oa.Token:{e();break}case Oa.PermissionDenied:{n(fA(t));break}case Oa.Authenticated:{r(fA(t));break}}},hA=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n}));var dx;(function(t){t[t.Connecting=0]="Connecting",t[t.Open=1]="Open",t[t.Closing=2]="Closing",t[t.Closed=3]="Closed"})(dx||(dx={}));function QP(t){return t||(t={}),{delay:t.delay===void 0?200:t.delay,initialDelay:t.initialDelay===void 0?0:t.initialDelay,minDelay:t.minDelay===void 0?0:t.minDelay,maxDelay:t.maxDelay===void 0?0:t.maxDelay,factor:t.factor===void 0?0:t.factor,maxAttempts:t.maxAttempts===void 0?3:t.maxAttempts,timeout:t.timeout===void 0?0:t.timeout,jitter:t.jitter===!0,initialJitter:t.initialJitter===!0,handleError:t.handleError===void 0?null:t.handleError,handleTimeout:t.handleTimeout===void 0?null:t.handleTimeout,beforeAttempt:t.beforeAttempt===void 0?null:t.beforeAttempt,calculateDelay:t.calculateDelay===void 0?null:t.calculateDelay}}async function I0(t){return new Promise(e=>setTimeout(e,t))}function e$(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 t$(t,e){const n=QP(e);for(const c of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const d=n[c];if(!Number.isInteger(d)||d<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||e$;async function s(){if(n.beforeAttempt&&n.beforeAttempt(r,n),r.aborted){const d=new Error("Attempt aborted");throw d.code="ATTEMPT_ABORTED",d}const c=async d=>{if(n.handleError&&await n.handleError(d,r,n),r.aborted||r.attemptsRemaining===0)throw d;r.attemptNum++;const f=i(r,n);return f&&await I0(f),s()};return r.attemptsRemaining>0&&r.attemptsRemaining--,n.timeout?new Promise((d,f)=>{const p=setTimeout(()=>{if(n.handleTimeout)try{d(n.handleTimeout(r,n))}catch(m){f(m)}else{const m=new Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);m.code="ATTEMPT_TIMEOUT",f(m)}},n.timeout);t(r,n).then(m=>{clearTimeout(p),d(m)}).catch(m=>{clearTimeout(p),c(m).then(d).catch(f)})}):t(r,n).catch(c)}const l=n.calculateDelay?n.calculateDelay(r,n):n.initialDelay;if(l&&await I0(l),r.attemptNum<1&&n.initialJitter){const c=i(r,n);c&&await I0(c)}return s()}const l2=Math.floor,n$=(t,e)=>t<e?t:e,r$=(t,e)=>t>e?t:e,i$=64,qp=128,s$=63,Mu=127,a2=Number.MAX_SAFE_INTEGER,o$=()=>new Set,l$=Array.from,a$=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},fd=typeof TextEncoder<"u"?new TextEncoder:null,c$=t=>fd.encode(t),u$=fd?c$:a$;let Ou=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Ou&&Ou.decode(new Uint8Array).length===1&&(Ou=null);class d${constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const Y1=()=>new d$,c2=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},K1=t=>{const e=new Uint8Array(c2(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},Yp=(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},Ln=(t,e)=>{for(;e>Mu;)Yp(t,qp|Mu&e),e=l2(e/128);Yp(t,Mu&e)},fx=new Uint8Array(3e4),f$=fx.length/3,h$=(t,e)=>{if(e.length<f$){const n=fd.encodeInto(e,fx).written||0;Ln(t,n);for(let r=0;r<n;r++)Yp(t,fx[r])}else ic(t,u$(e))},p$=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Ln(t,r);for(let i=0;i<r;i++)Yp(t,n.codePointAt(i))},ys=fd&&fd.encodeInto?h$:p$,m$=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=n$(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(r$(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},ic=(t,e)=>{Ln(t,e.byteLength),m$(t,e)},u2=t=>new Error(t),d2=u2("Unexpected end of array"),f2=u2("Integer out of Range");class g${constructor(e){this.arr=e,this.pos=0}}const h2=t=>new g$(t),y$=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},Am=t=>y$(t,nl(t)),pA=t=>t.arr[t.pos++],nl=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<qp)return e;if(e>a2)throw f2}throw d2},b$=t=>{let e=t.arr[t.pos++],n=e&s$,r=64;const i=(e&i$)>0?-1:1;if((e&qp)===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<qp)return i*n;if(n>a2)throw f2}throw d2},x$=t=>{let e=nl(t);if(e===0)return"";{let n=String.fromCodePoint(pA(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(pA(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))}},v$=t=>Ou.decode(Am(t)),hd=Ou?v$:x$,S$=t=>{const e=t.pos,n=hd(t);return t.pos=e,n},Wa=Date.now,B0=()=>new Map,w$=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r};class k${constructor(){this._observers=B0()}on(e,n){w$(this._observers,e,o$).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 l$((this._observers.get(e)||B0()).values()).forEach(r=>r(...n))}destroy(){this._observers=B0()}}const C$=Object.keys,mA=t=>C$(t).length,E$=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),T$=(t,e)=>t===e,_u=(t,e)=>{if(t==null||e==null)return T$(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!_u(t.get(n),e.get(n)))return!1;break}case Object:if(mA(t)!==mA(e))return!1;for(const n in t)if(!E$(t,n)||!_u(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!_u(t[n],e[n]))return!1;break;default:return!1}return!0},U0=3e4;class A$ extends k${constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=Wa();this.getLocalState()!==null&&U0/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&U0<=n-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&Dh(this,r,"timeout")},l2(U0/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const n=this.clientID,r=this.meta.get(n),i=r===void 0?0:r.clock+1,s=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:i,lastUpdated:Wa()});const l=[],c=[],d=[],f=[];e===null?f.push(n):s==null?e!=null&&l.push(n):(c.push(n),_u(s,e)||d.push(n)),(l.length>0||d.length>0||f.length>0)&&this.emit("change",[{added:l,updated:d,removed:f},"local"]),this.emit("update",[{added:l,updated:c,removed:f},"local"])}setLocalStateField(e,n){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}}const Dh=(t,e,n)=>{const r=[];for(let i=0;i<e.length;i++){const s=e[i];if(t.states.has(s)){if(t.states.delete(s),s===t.clientID){const l=t.meta.get(s);t.meta.set(s,{clock:l.clock+1,lastUpdated:Wa()})}r.push(s)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},hx=(t,e,n=t.states)=>{const r=e.length,i=Y1();Ln(i,r);for(let s=0;s<r;s++){const l=e[s],c=n.get(l)||null,d=t.meta.get(l).clock;Ln(i,l),Ln(i,d),ys(i,JSON.stringify(c))}return K1(i)},M$=(t,e,n)=>{const r=h2(e),i=Wa(),s=[],l=[],c=[],d=[],f=nl(r);for(let p=0;p<f;p++){const m=nl(r);let g=nl(r);const b=JSON.parse(hd(r)),v=t.meta.get(m),w=t.states.get(m),C=v===void 0?0:v.clock;(C<g||C===g&&b===null&&t.states.has(m))&&(b===null?m===t.clientID&&t.getLocalState()!=null?g++:t.states.delete(m):t.states.set(m,b),t.meta.set(m,{clock:g,lastUpdated:i}),v===void 0&&b!==null?s.push(m):v!==void 0&&b===null?d.push(m):b!==null&&(_u(b,w)||c.push(m),l.push(m)))}(s.length>0||c.length>0||d.length>0)&&t.emit("change",[{added:s,updated:c,removed:d},n]),(s.length>0||l.length>0||d.length>0)&&t.emit("update",[{added:s,updated:l,removed:d},n])};class p2{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 px{constructor(e){this.data=e,this.encoder=Y1(),this.decoder=h2(new Uint8Array(this.data))}peekVarString(){return S$(this.decoder)}readVarUint(){return nl(this.decoder)}readVarString(){return hd(this.decoder)}readVarUint8Array(){return Am(this.decoder)}writeVarUint(e){return Ln(this.encoder,e)}writeVarString(e){return ys(this.encoder,e)}writeVarUint8Array(e){return ic(this.encoder,e)}length(){return c2(this.encoder)}}var An;(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"})(An||(An={}));var Fn;(function(t){t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected"})(Fn||(Fn={}));class bl{constructor(){this.encoder=Y1()}get(e){return e.encoder}toUint8Array(){return K1(this.encoder)}}class O$ extends bl{constructor(){super(...arguments),this.type=An.CLOSE,this.description="Ask the server to close the connection"}get(e){return ys(this.encoder,e.documentName),Ln(this.encoder,this.type),this.encoder}}class _$ extends p2{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=Fn.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=Fn.Connected,this.emit("status",{status:Fn.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=e}attach(e){this.configuration.providerMap.set(e.configuration.name,e),this.status===Fn.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===Fn.Connected&&e.onOpen(this.receivedOnOpenPayload)}detach(e){this.configuration.providerMap.has(e.configuration.name)&&(e.send(O$,{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===Fn.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;const e=()=>{let i=!1;return{retryPromise:t$(this.createWebSocketConnection.bind(this),{delay:this.configuration.delay,initialDelay:this.configuration.initialDelay,factor:this.configuration.factor,maxAttempts:this.configuration.maxAttempts,minDelay:this.configuration.minDelay,maxDelay:this.configuration.maxDelay,jitter:this.configuration.jitter,timeout:this.configuration.timeout,handleTimeout:this.configuration.handleTimeout,beforeAttempt:l=>{(!this.shouldConnect||i)&&l.abort()}}).catch(l=>{if(l&&l.code!=="ATTEMPT_ABORTED")throw l}),cancelFunc:()=>{i=!0}}},{retryPromise:n,cancelFunc:r}=e();return this.cancelWebsocketRetry=r,n}attachWebSocketListeners(e,n){const{identifier:r}=e,i=f=>this.emit("message",f),s=f=>this.emit("close",{event:f}),l=f=>this.emit("open",f),c=f=>{n(f)};this.webSocketHandlers[r]={message:i,close:s,open:l,error:c};const d=this.webSocketHandlers[e.identifier];Object.keys(d).forEach(f=>{e.addEventListener(f,d[f])})}cleanupWebSocket(){if(!this.webSocket)return;const{identifier:e}=this.webSocket,n=this.webSocketHandlers[e];Object.keys(n).forEach(r=>{var i;(i=this.webSocket)===null||i===void 0||i.removeEventListener(r,n[r]),delete this.webSocketHandlers[e]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((e,n)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;const r=new this.configuration.WebSocketPolyfill(this.url);r.binaryType="arraybuffer",r.identifier=this.identifier,this.attachWebSocketListeners(r,n),this.webSocket=r,this.status=Fn.Connecting,this.emit("status",{status:Fn.Connecting}),this.connectionAttempt={resolve:e,reject:n}})}onMessage(e){var n;this.resolveConnectionAttempt(),this.lastMessageReceived=Wa();const i=new px(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=Fn.Connected,this.emit("status",{status:Fn.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===Fn.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=Wa()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:"forced"}}),this.closeTries=0):((e=this.webSocket)===null||e===void 0||e.close(),this.messageQueue=[])))}get serverUrl(){if(this.configuration.preserveTrailingSlash)return this.configuration.url;let e=this.configuration.url;for(;e[e.length-1]==="/";)e=e.slice(0,e.length-1);return e}get url(){return this.serverUrl}disconnect(){if(this.shouldConnect=!1,this.webSocket!==null)try{this.webSocket.close(),this.messageQueue=[]}catch(e){console.error(e)}}send(e){var n;((n=this.webSocket)===null||n===void 0?void 0:n.readyState)===dx.Open?this.webSocket.send(e):this.messageQueue.push(e)}onClose({event:e}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=Fn.Disconnected,this.emit("status",{status:Fn.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 m2=0,W1=1,g2=2,D$=(t,e)=>{Ln(t,m2);const n=F5(e);ic(t,n)},R$=(t,e,n)=>{Ln(t,W1),ic(t,H5(e,n))},N$=(t,e,n)=>R$(e,n,Am(t)),y2=(t,e,n)=>{try{I5(e,Am(t),n)}catch(r){console.error("Caught error while handling a Yjs update",r)}},z$=(t,e)=>{Ln(t,g2),ic(t,e)},L$=y2,j$=(t,e,n,r)=>{const i=nl(t);switch(i){case m2:N$(t,e,n);break;case W1:y2(t,n,r);break;case g2:L$(t,n,r);break;default:throw new Error("Unknown message type")}return i};class I${constructor(e){this.message=e}apply(e,n){const{message:r}=this,i=r.readVarUint(),s=r.length();switch(i){case An.Sync:this.applySyncMessage(e,n);break;case An.Awareness:this.applyAwarenessMessage(e);break;case An.Auth:this.applyAuthMessage(e);break;case An.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case An.Stateless:e.receiveStateless(hd(r.decoder));break;case An.SyncStatus:this.applySyncStatusMessage(e,b$(r.decoder)===1);break;case An.CLOSE:const l={code:1e3,reason:hd(r.decoder),target:e.configuration.websocketProvider.webSocket,type:"close"};e.onClose(),e.configuration.onClose({event:l}),e.forwardClose({event:l});break;default:throw new Error(`Can’t apply message of unknown type: ${i}`)}r.length()>s+1&&e.send(bl,{encoder:r.encoder})}applySyncMessage(e,n){const{message:r}=this;r.writeVarUint(An.Sync);const i=j$(r.decoder,r.encoder,e.document,e);n&&i===W1&&(e.synced=!0)}applySyncStatusMessage(e,n){n&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;M$(e.awareness,n.readVarUint8Array(),e)}applyAuthMessage(e){const{message:n}=this;XP(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(An.Awareness),n.writeVarUint8Array(hx(e.awareness,Array.from(e.awareness.getStates().keys())))}}class B${constructor(e,n={}){this.message=new e,this.encoder=this.message.get(n)}create(){return K1(this.encoder)}send(e){e==null||e.send(this.create())}}class U$ extends bl{constructor(){super(...arguments),this.type=An.Auth,this.description="Authentication"}get(e){if(typeof e.token>"u")throw new Error("The authentication message requires `token` as an argument.");return ys(this.encoder,e.documentName),Ln(this.encoder,this.type),JP(this.encoder,e.token),this.encoder}}class gA extends bl{constructor(){super(...arguments),this.type=An.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");ys(this.encoder,e.documentName),Ln(this.encoder,this.type);let n;return e.states===void 0?n=hx(e.awareness,e.clients):n=hx(e.awareness,e.clients,e.states),ic(this.encoder,n),this.encoder}}class H$ extends bl{constructor(){super(...arguments),this.type=An.Stateless,this.description="A stateless message"}get(e){var n;return ys(this.encoder,e.documentName),Ln(this.encoder,this.type),ys(this.encoder,(n=e.payload)!==null&&n!==void 0?n:""),this.encoder}}class yA extends bl{constructor(){super(...arguments),this.type=An.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 ys(this.encoder,e.documentName),Ln(this.encoder,this.type),D$(this.encoder,e.document),this.encoder}}class V$ extends bl{constructor(){super(...arguments),this.type=An.Sync,this.description="A document update"}get(e){return ys(this.encoder,e.documentName),Ln(this.encoder,this.type),z$(this.encoder,e.update),this.encoder}}class P$ extends Error{constructor(){super(...arguments),this.code=1001}}class bA extends p2{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 Ri,this.configuration.awareness=e.awareness!==void 0?e.awareness:new A$(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:hA(this.awareness.getStates())})}),(r=this.awareness)===null||r===void 0||r.on("change",()=>{this.emit("awarenessChange",{states:hA(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 _$(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(yA,{document:this.document,documentName:this.configuration.name})}pageHide(){this.awareness&&Dh(this.awareness,[this.document.clientID],"page hide")}registerEventListeners(){typeof window>"u"||!("addEventListener"in window)||window.addEventListener("pagehide",this.boundPageHide)}sendStateless(e){this.send(H$,{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(U$,{token:e??"",documentName:this.configuration.name})}documentUpdateHandler(e,n){n!==this&&(this.incrementUnsyncedChanges(),this.send(V$,{update:e,documentName:this.configuration.name}))}awarenessUpdateHandler({added:e,updated:n,removed:r},i){const s=e.concat(n).concat(r);this.send(gA,{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(yA,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(gA,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(e,n){if(!this._isAttached)return;const r=new B$(e,n);this.emit("outgoingMessage",{message:r.message}),r.send(this.configuration.websocketProvider)}onMessage(e){const n=new px(e.data),r=n.readVarString();n.writeVarString(r),this.emit("message",{event:e,message:new px(e.data)}),new I$(n).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&Dh(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&&(Dh(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 P$(`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 $$(t,e,n){return t.filter(r=>!e.has(r.id)&&!n.has(r.id))}function F$(){var M;const[t,e]=O.useState([]),[n,r]=O.useState(null),[i,s]=O.useState(!1),[l,c]=O.useState("connecting"),[d,f]=O.useState(0),[p,m]=O.useState(null),[g,b]=O.useState([]),[v,w]=O.useState(null),[C,E]=O.useState(!1),[I,j]=O.useState(!1),[Q,V]=O.useState(!1),[_,N]=O.useState(!1),Z=O.useRef(null),Y=O.useRef(!1),ce=O.useRef(null),ie=O.useRef(null),se=O.useRef([]);se.current=t;const xe=O.useRef(new Set),pe=O.useRef(new Map);for(const D of t)xe.current.delete(D.id),pe.current.delete(D.id);const U=O.useRef(new Map),L=O.useRef(new Map),G=O.useRef(void 0),me=O.useCallback(D=>{const{ydoc:H}=D,T=H.getMap(xa),F=()=>{const Ye=[];T.forEach(At=>{Ye.push(Tu(At))}),b(Ye)};T.observe(F),F();const ue=H.getMap(cM);let le=null,Re=!1;const Be=()=>{const Ye=ue.get("claude"),At=(Ye==null?void 0:Ye.status)??null,Mt=(Ye==null?void 0:Ye.active)??!1;At!==le&&(le=At,w(At)),Mt!==Re&&(Re=Mt,E(Mt))};ue.observe(Be),Be();const Ie=H.getMap(mh);let Xe=!1;const Me=()=>{const Ye=Ie.get("readOnly")===!0;Ye!==Xe&&(Xe=Ye,j(Ye))};return Ie.observe(Me),Me(),()=>{T.unobserve(F),ue.unobserve(Be),Ie.unobserve(Me)}},[]);G.current=(D,H)=>{var Ie,Xe;const T=se.current,F=new Set(T.map(Me=>Me.id)),ue=new Set(D.map(Me=>Me.id));for(const[Me,Ye]of pe.current)ue.has(Me)||((Ie=L.current.get(Me))==null||Ie(),L.current.delete(Me),Ye.provider.destroy(),Ye.ydoc.destroy(),pe.current.delete(Me),xe.current.delete(Me));const le=$$(D,F,xe.current),Re=[];for(const Me of le){xe.current.add(Me.id);const Ye=new Ri,At=new bA({url:`ws://localhost:${pC}`,name:Me.id,document:Ye});pe.current.set(Me.id,{ydoc:Ye,provider:At});const Mt=Ye.getMap(mh),Jt=()=>{var Pn;const Vn=Mt.get("openDocuments"),dr=Mt.get("activeDocumentId");Vn&&((Pn=G.current)==null||Pn.call(G,Vn,dr??null))};Mt.observe(Jt),L.current.set(Me.id,()=>Mt.unobserve(Jt)),Re.push({...Me,ydoc:Ye,provider:At})}const Be=T.filter(Me=>!ue.has(Me.id));for(const Me of Be){const Ye=U.current.get(Me.id);Ye&&(Ye.cleanup(),U.current.delete(Me.id)),(Xe=L.current.get(Me.id))==null||Xe(),L.current.delete(Me.id),xe.current.delete(Me.id),pe.current.delete(Me.id),Me.provider.destroy(),Me.ydoc.destroy()}e(Me=>[...Me.filter(At=>ue.has(At.id)),...Re]),H!==null&&r(Me=>Me===null||!ue.has(Me)?H:Be.length>0&&H===Me?Me:H)},O.useEffect(()=>{const D=new Ri,H=new bA({url:`ws://localhost:${pC}`,name:Nz,document:D});return ce.current={ydoc:D,provider:H},H.on("status",({status:T})=>{s(T==="connected"),c(T),T==="connected"?(Y.current=!0,f(0),m(null)):T==="disconnected"?m(F=>F??Date.now()):T==="connecting"&&(Y.current&&f(F=>F+1),m(F=>F??Date.now()))}),V(!0),()=>{H.destroy(),D.destroy(),ce.current=null}},[]),O.useEffect(()=>{if(!ce.current)return;const D=ce.current.ydoc.getMap(mh),H=()=>{var le;const T=D.get("generationId");T&&ie.current&&T!==ie.current&&(console.warn("[Tandem] Server restarted — refreshing documents"),N(!0),Z.current&&clearTimeout(Z.current),Z.current=setTimeout(()=>N(!1),5e3)),T&&(ie.current=T);const F=D.get("openDocuments"),ue=D.get("activeDocumentId");F&&((le=G.current)==null||le.call(G,F,ue??null))};return D.observe(H),H(),()=>{D.unobserve(H),Z.current&&clearTimeout(Z.current)}},[]),O.useEffect(()=>{for(const H of U.current.values())H.cleanup();U.current.clear();const D=se.current.find(H=>H.id===n);if(D){const H=me(D);U.current.set(D.id,{cleanup:H})}else b([]),w(null),E(!1),j(!1)},[n,me]);const Ae=O.useCallback(D=>{r(H=>{if(H!==D)return H;const T=se.current,F=T.findIndex(le=>le.id===D),ue=T.filter(le=>le.id!==D);return ue.length===0?null:ue[Math.min(F,ue.length-1)].id}),fetch(`http://localhost:${Ga}/api/close`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:D})}).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:Ae,connected:i,connectionStatus:l,reconnectAttempts:d,disconnectedSince:p,annotations:g,claudeStatus:v,claudeActive:C,readOnly:I,bootstrapYdoc:((M=ce.current)==null?void 0:M.ydoc)??null,ready:Q,serverRestarted:_}}function q$(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Y$=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,K$=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,W$={};function xA(t,e){return(W$.jsx?K$:Y$).test(t)}const G$=/[ \t\n\f\r]/g;function Z$(t){return typeof t=="object"?t.type==="text"?vA(t.value):!1:vA(t)}function vA(t){return t.replace(G$,"")===""}class Ed{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Ed.prototype.normal={};Ed.prototype.property={};Ed.prototype.space=void 0;function b2(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new Ed(n,r,e)}function mx(t){return t.toLowerCase()}class ur{constructor(e,n){this.attribute=n,this.property=e}}ur.prototype.attribute="";ur.prototype.booleanish=!1;ur.prototype.boolean=!1;ur.prototype.commaOrSpaceSeparated=!1;ur.prototype.commaSeparated=!1;ur.prototype.defined=!1;ur.prototype.mustUseProperty=!1;ur.prototype.number=!1;ur.prototype.overloadedBoolean=!1;ur.prototype.property="";ur.prototype.spaceSeparated=!1;ur.prototype.space=void 0;let J$=0;const qe=xl(),nn=xl(),gx=xl(),ae=xl(),kt=xl(),_a=xl(),vr=xl();function xl(){return 2**++J$}const yx=Object.freeze(Object.defineProperty({__proto__:null,boolean:qe,booleanish:nn,commaOrSpaceSeparated:vr,commaSeparated:_a,number:ae,overloadedBoolean:gx,spaceSeparated:kt},Symbol.toStringTag,{value:"Module"})),H0=Object.keys(yx);class G1 extends ur{constructor(e,n,r,i){let s=-1;if(super(e,n),SA(this,"space",i),typeof r=="number")for(;++s<H0.length;){const l=H0[s];SA(this,H0[s],(r&yx[l])===yx[l])}}}G1.prototype.defined=!0;function SA(t,e,n){n&&(t[e]=n)}function sc(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new G1(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[mx(r)]=r,n[mx(s.attribute)]=r}return new Ed(e,n,t.space)}const x2=sc({properties:{ariaActiveDescendant:null,ariaAtomic:nn,ariaAutoComplete:null,ariaBusy:nn,ariaChecked:nn,ariaColCount:ae,ariaColIndex:ae,ariaColSpan:ae,ariaControls:kt,ariaCurrent:null,ariaDescribedBy:kt,ariaDetails:null,ariaDisabled:nn,ariaDropEffect:kt,ariaErrorMessage:null,ariaExpanded:nn,ariaFlowTo:kt,ariaGrabbed:nn,ariaHasPopup:null,ariaHidden:nn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:kt,ariaLevel:ae,ariaLive:null,ariaModal:nn,ariaMultiLine:nn,ariaMultiSelectable:nn,ariaOrientation:null,ariaOwns:kt,ariaPlaceholder:null,ariaPosInSet:ae,ariaPressed:nn,ariaReadOnly:nn,ariaRelevant:null,ariaRequired:nn,ariaRoleDescription:kt,ariaRowCount:ae,ariaRowIndex:ae,ariaRowSpan:ae,ariaSelected:nn,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 v2(t,e){return e in t?t[e]:e}function S2(t,e){return v2(t,e.toLowerCase())}const X$=sc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_a,acceptCharset:kt,accessKey:kt,action:null,allow:null,allowFullScreen:qe,allowPaymentRequest:qe,allowUserMedia:qe,alt:null,as:null,async:qe,autoCapitalize:null,autoComplete:kt,autoFocus:qe,autoPlay:qe,blocking:kt,capture:null,charSet:null,checked:qe,cite:null,className:kt,cols:ae,colSpan:null,content:null,contentEditable:nn,controls:qe,controlsList:kt,coords:ae|_a,crossOrigin:null,data:null,dateTime:null,decoding:null,default:qe,defer:qe,dir:null,dirName:null,disabled:qe,download:gx,draggable:nn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:qe,formTarget:null,headers:kt,height:ae,hidden:gx,high:ae,href:null,hrefLang:null,htmlFor:kt,httpEquiv:kt,id:null,imageSizes:null,imageSrcSet:null,inert:qe,inputMode:null,integrity:null,is:null,isMap:qe,itemId:null,itemProp:kt,itemRef:kt,itemScope:qe,itemType:kt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:qe,low:ae,manifest:null,max:null,maxLength:ae,media:null,method:null,min:null,minLength:ae,multiple:qe,muted:qe,name:null,nonce:null,noModule:qe,noValidate:qe,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:qe,optimum:ae,pattern:null,ping:kt,placeholder:null,playsInline:qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:qe,referrerPolicy:null,rel:kt,required:qe,reversed:qe,rows:ae,rowSpan:ae,sandbox:kt,scope:null,scoped:qe,seamless:qe,selected:qe,shadowRootClonable:qe,shadowRootDelegatesFocus:qe,shadowRootMode:null,shape:null,size:ae,sizes:null,slot:null,span:ae,spellCheck:nn,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:qe,useMap:null,value:nn,width:ae,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:kt,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:qe,declare:qe,event:null,face:null,frame:null,frameBorder:null,hSpace:ae,leftMargin:ae,link:null,longDesc:null,lowSrc:null,marginHeight:ae,marginWidth:ae,noResize:qe,noHref:qe,noShade:qe,noWrap:qe,object:null,profile:null,prompt:null,rev:null,rightMargin:ae,rules:null,scheme:null,scrolling:nn,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:qe,disableRemotePlayback:qe,prefix:null,property:null,results:ae,security:null,unselectable:null},space:"html",transform:S2}),Q$=sc({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:vr,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:kt,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:qe,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:_a,g2:_a,glyphName:_a,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:vr,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:kt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ae,pointsAtY:ae,pointsAtZ:ae,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vr,rev:vr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vr,requiredFeatures:vr,requiredFonts:vr,requiredFormats:vr,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:vr,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:vr,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:vr,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:v2}),w2=sc({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()}}),k2=sc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:S2}),C2=sc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),eF={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"},tF=/[A-Z]/g,wA=/-[a-z]/g,nF=/^data[-\w.:]+$/i;function rF(t,e){const n=mx(e);let r=e,i=ur;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&nF.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(wA,sF);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!wA.test(s)){let l=s.replace(tF,iF);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}i=G1}return new i(r,e)}function iF(t){return"-"+t.toLowerCase()}function sF(t){return t.charAt(1).toUpperCase()}const oF=b2([x2,X$,w2,k2,C2],"html"),Z1=b2([x2,Q$,w2,k2,C2],"svg");function lF(t){return t.join(" ").trim()}var ca={},V0,kA;function aF(){if(kA)return V0;kA=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
297
|
+
`,f="/",p="*",m="",g="comment",b="declaration";function v(C,E){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];E=E||{};var I=1,j=1;function Q(pe){var U=pe.match(e);U&&(I+=U.length);var L=pe.lastIndexOf(d);j=~L?pe.length-L:j+pe.length}function V(){var pe={line:I,column:j};return function(U){return U.position=new _(pe),Y(),U}}function _(pe){this.start=pe,this.end={line:I,column:j},this.source=E.source}_.prototype.content=C;function N(pe){var U=new Error(E.source+":"+I+":"+j+": "+pe);if(U.reason=pe,U.filename=E.source,U.line=I,U.column=j,U.source=C,!E.silent)throw U}function Z(pe){var U=pe.exec(C);if(U){var L=U[0];return Q(L),C=C.slice(L.length),U}}function Y(){Z(n)}function ce(pe){var U;for(pe=pe||[];U=ie();)U!==!1&&pe.push(U);return pe}function ie(){var pe=V();if(!(f!=C.charAt(0)||p!=C.charAt(1))){for(var U=2;m!=C.charAt(U)&&(p!=C.charAt(U)||f!=C.charAt(U+1));)++U;if(U+=2,m===C.charAt(U-1))return N("End of comment missing");var L=C.slice(2,U-2);return j+=2,Q(L),C=C.slice(U),j+=2,pe({type:g,comment:L})}}function se(){var pe=V(),U=Z(r);if(U){if(ie(),!Z(i))return N("property missing ':'");var L=Z(s),G=pe({type:b,property:w(U[0].replace(t,m)),value:L?w(L[0].replace(t,m)):m});return Z(l),G}}function xe(){var pe=[];ce(pe);for(var U;U=se();)U!==!1&&(pe.push(U),ce(pe));return pe}return Y(),xe()}function w(C){return C?C.replace(c,m):m}return V0=v,V0}var CA;function cF(){if(CA)return ca;CA=1;var t=ca&&ca.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ca,"__esModule",{value:!0}),ca.default=n;const e=t(aF());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const l=(0,e.default)(r),c=typeof i=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:p}=d;c?i(f,p,d):p&&(s=s||{},s[f]=p)}),s}return ca}var iu={},EA;function uF(){if(EA)return iu;EA=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(f){return!f||n.test(f)||t.test(f)},l=function(f,p){return p.toUpperCase()},c=function(f,p){return"".concat(p,"-")},d=function(f,p){return p===void 0&&(p={}),s(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(i,c):f=f.replace(r,c),f.replace(e,l))};return iu.camelCase=d,iu}var su,TA;function dF(){if(TA)return su;TA=1;var t=su&&su.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(cF()),n=uF();function r(i,s){var l={};return!i||typeof i!="string"||(0,e.default)(i,function(c,d){c&&d&&(l[(0,n.camelCase)(c,s)]=d)}),l}return r.default=r,su=r,su}var fF=dF();const hF=Zp(fF),E2=T2("end"),J1=T2("start");function T2(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 pF(t){const e=J1(t),n=E2(t);if(e&&n)return{start:e,end:n}}function Du(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?AA(t.position):"start"in t||"end"in t?AA(t):"line"in t||"column"in t?bx(t):""}function bx(t){return MA(t&&t.line)+":"+MA(t&&t.column)}function AA(t){return bx(t&&t.start)+"-"+bx(t&&t.end)}function MA(t){return t&&typeof t=="number"?t:1}class Hn extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},l=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(l=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?s.ruleId=r:(s.source=r.slice(0,d),s.ruleId=r.slice(d+1))}if(!s.place&&s.ancestors&&s.ancestors){const d=s.ancestors[s.ancestors.length-1];d&&(s.place=d.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=Du(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=l&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Hn.prototype.file="";Hn.prototype.name="";Hn.prototype.reason="";Hn.prototype.message="";Hn.prototype.stack="";Hn.prototype.column=void 0;Hn.prototype.line=void 0;Hn.prototype.ancestors=void 0;Hn.prototype.cause=void 0;Hn.prototype.fatal=void 0;Hn.prototype.place=void 0;Hn.prototype.ruleId=void 0;Hn.prototype.source=void 0;const X1={}.hasOwnProperty,mF=new Map,gF=/[A-Z]/g,yF=new Set(["table","tbody","thead","tfoot","tr"]),bF=new Set(["td","th"]),A2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function xF(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=AF(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=TF(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"?Z1:oF,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=M2(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function M2(t,e,n){if(e.type==="element")return vF(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return SF(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return kF(t,e,n);if(e.type==="mdxjsEsm")return wF(t,e);if(e.type==="root")return CF(t,e,n);if(e.type==="text")return EF(t,e)}function vF(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Z1,t.schema=i),t.ancestors.push(e);const s=_2(t,e.tagName,!1),l=MF(t,e);let c=ev(t,e);return yF.has(e.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!Z$(d):!0})),O2(t,l,s,e),Q1(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function SF(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)}pd(t,e.position)}function wF(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);pd(t,e.position)}function kF(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=Z1,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:_2(t,e.name,!0),l=OF(t,e),c=ev(t,e);return O2(t,l,s,e),Q1(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function CF(t,e,n){const r={};return Q1(r,ev(t,e)),t.create(e,t.Fragment,r,n)}function EF(t,e){return e.value}function O2(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function Q1(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function TF(t,e,n){return r;function r(i,s,l,c){const f=Array.isArray(l.children)?n:e;return c?f(s,l,c):f(s,l)}}function AF(t,e){return n;function n(r,i,s,l){const c=Array.isArray(s.children),d=J1(r);return e(i,s,l,c,{columnNumber:d?d.column-1:void 0,fileName:t,lineNumber:d?d.line:void 0},void 0)}}function MF(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&X1.call(e.properties,i)){const s=_F(t,i,e.properties[i]);if(s){const[l,c]=s;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&bF.has(e.tagName)?r=c:n[l]=c}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function OF(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const l=s.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,t.evaluater.evaluateExpression(c.argument))}else pd(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 pd(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function ev(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:mF;for(;++r<e.children.length;){const s=e.children[r];let l;if(t.passKeys){const d=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(d){const f=i.get(d)||0;l=d+"-"+f,i.set(d,f+1)}}const c=M2(t,s,l);c!==void 0&&n.push(c)}return n}function _F(t,e,n){const r=rF(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?q$(n):lF(n)),r.property==="style"){let i=typeof n=="object"?n:DF(t,String(n));return t.stylePropertyNameCase==="css"&&(i=RF(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?eF[r.property]||r.property:r.attribute,n]}}function DF(t,e){try{return hF(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new Hn("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=A2+"#cannot-parse-style-attribute",i}}function _2(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,l;for(;++s<i.length;){const c=xA(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(s&&c.type==="Literal"),optional:!1}:c}r=l}else r=xA(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return X1.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);pd(t)}function pd(t,e){const n=new Hn("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=A2+"#cannot-handle-mdx-estrees-without-createevaluater",n}function RF(t){const e={};let n;for(n in t)X1.call(t,n)&&(e[NF(n)]=t[n]);return e}function NF(t){let e=t.replace(gF,zF);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function zF(t){return"-"+t.toLowerCase()}const P0={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},LF={};function jF(t,e){const n=LF,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return D2(t,r,i)}function D2(t,e,n){if(IF(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 OA(t.children,e,n)}return Array.isArray(t)?OA(t,e,n):""}function OA(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=D2(t[i],e,n);return r.join("")}function IF(t){return!!(t&&typeof t=="object")}const _A=document.createElement("i");function tv(t){const e="&"+t+";";_A.innerHTML=e;const n=_A.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Ni(t,e,n,r){const i=t.length;let s=0,l;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(e,n),t.splice(...l);else for(n&&t.splice(e,n);s<r.length;)l=r.slice(s,s+1e4),l.unshift(e,0),t.splice(...l),s+=1e4,e+=1e4}function $r(t,e){return t.length>0?(Ni(t,t.length,0,e),t):e}const DA={}.hasOwnProperty;function BF(t){const e={};let n=-1;for(;++n<t.length;)UF(e,t[n]);return e}function UF(t,e){let n;for(n in e){const i=(DA.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let l;if(s)for(l in s){DA.call(i,l)||(i[l]=[]);const c=s[l];HF(i[l],Array.isArray(c)?c:c?[c]:[])}}}function HF(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Ni(t,0,0,r)}function R2(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 Da(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ki=vo(/[A-Za-z]/),Er=vo(/[\dA-Za-z]/),VF=vo(/[#-'*+\--9=?A-Z^-~]/);function xx(t){return t!==null&&(t<32||t===127)}const vx=vo(/\d/),PF=vo(/[\dA-Fa-f]/),$F=vo(/[!-/:-@[-`{-~]/);function je(t){return t!==null&&t<-2}function cr(t){return t!==null&&(t<0||t===32)}function ht(t){return t===-2||t===-1||t===32}const FF=vo(new RegExp("\\p{P}|\\p{S}","u")),qF=vo(/\s/);function vo(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function oc(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let l="";if(s===37&&Er(t.charCodeAt(n+1))&&Er(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(l=String.fromCharCode(s));else if(s>55295&&s<57344){const c=t.charCodeAt(n+1);s<56320&&c>56319&&c<57344?(l=String.fromCharCode(s,c),i=1):l="�"}else l=String.fromCharCode(s);l&&(e.push(t.slice(r,n),encodeURIComponent(l)),r=n+i+1,l=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Ct(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return l;function l(d){return ht(d)?(t.enter(n),c(d)):e(d)}function c(d){return ht(d)&&s++<i?(t.consume(d),c):(t.exit(n),e(d))}}const YF={tokenize:KF};function KF(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"),Ct(t,e,"linePrefix")}function i(c){return t.enter("paragraph"),s(c)}function s(c){const d=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,l(c)}function l(c){if(c===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(c);return}return je(c)?(t.consume(c),t.exit("chunkText"),s):(t.consume(c),l)}}const WF={tokenize:GF},RA={tokenize:ZF};function GF(t){const e=this,n=[];let r=0,i,s,l;return c;function c(j){if(r<n.length){const Q=n[r];return e.containerState=Q[1],t.attempt(Q[0].continuation,d,f)(j)}return f(j)}function d(j){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&I();const Q=e.events.length;let V=Q,_;for(;V--;)if(e.events[V][0]==="exit"&&e.events[V][1].type==="chunkFlow"){_=e.events[V][1].end;break}E(r);let N=Q;for(;N<e.events.length;)e.events[N][1].end={..._},N++;return Ni(e.events,V+1,0,e.events.slice(Q)),e.events.length=N,f(j)}return c(j)}function f(j){if(r===n.length){if(!i)return g(j);if(i.currentConstruct&&i.currentConstruct.concrete)return v(j);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(RA,p,m)(j)}function p(j){return i&&I(),E(r),g(j)}function m(j){return e.parser.lazy[e.now().line]=r!==n.length,l=e.now().offset,v(j)}function g(j){return e.containerState={},t.attempt(RA,b,v)(j)}function b(j){return r++,n.push([e.currentConstruct,e.containerState]),g(j)}function v(j){if(j===null){i&&I(),E(0),t.consume(j);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),w(j)}function w(j){if(j===null){C(t.exit("chunkFlow"),!0),E(0),t.consume(j);return}return je(j)?(t.consume(j),C(t.exit("chunkFlow")),r=0,e.interrupt=void 0,c):(t.consume(j),w)}function C(j,Q){const V=e.sliceStream(j);if(Q&&V.push(null),j.previous=s,s&&(s.next=j),s=j,i.defineSkip(j.start),i.write(V),e.parser.lazy[j.start.line]){let _=i.events.length;for(;_--;)if(i.events[_][1].start.offset<l&&(!i.events[_][1].end||i.events[_][1].end.offset>l))return;const N=e.events.length;let Z=N,Y,ce;for(;Z--;)if(e.events[Z][0]==="exit"&&e.events[Z][1].type==="chunkFlow"){if(Y){ce=e.events[Z][1].end;break}Y=!0}for(E(r),_=N;_<e.events.length;)e.events[_][1].end={...ce},_++;Ni(e.events,Z+1,0,e.events.slice(N)),e.events.length=_}}function E(j){let Q=n.length;for(;Q-- >j;){const V=n[Q];e.containerState=V[1],V[0].exit.call(e,t)}n.length=j}function I(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function ZF(t,e,n){return Ct(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function NA(t){if(t===null||cr(t)||qF(t))return 1;if(FF(t))return 2}function nv(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const Sx={name:"attention",resolveAll:JF,tokenize:XF};function JF(t,e){let n=-1,r,i,s,l,c,d,f,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;d=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};zA(m,-d),zA(g,d),l={type:d>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},s={type:d>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},f=[],t[r][1].end.offset-t[r][1].start.offset&&(f=$r(f,[["enter",t[r][1],e],["exit",t[r][1],e]])),f=$r(f,[["enter",i,e],["enter",l,e],["exit",l,e],["enter",s,e]]),f=$r(f,nv(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),f=$r(f,[["exit",s,e],["enter",c,e],["exit",c,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(p=2,f=$r(f,[["enter",t[n][1],e],["exit",t[n][1],e]])):p=0,Ni(t,r-1,n-r+3,f),n=r+f.length-p-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function XF(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=NA(r);let s;return l;function l(d){return s=d,t.enter("attentionSequence"),c(d)}function c(d){if(d===s)return t.consume(d),c;const f=t.exit("attentionSequence"),p=NA(d),m=!p||p===2&&i||n.includes(d),g=!i||i===2&&p||n.includes(r);return f._open=!!(s===42?m:m&&(i||!g)),f._close=!!(s===42?g:g&&(p||!m)),e(d)}}function zA(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const QF={name:"autolink",tokenize:e7};function e7(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 ki(b)?(t.consume(b),l):b===64?n(b):f(b)}function l(b){return b===43||b===45||b===46||Er(b)?(r=1,c(b)):f(b)}function c(b){return b===58?(t.consume(b),r=0,d):(b===43||b===45||b===46||Er(b))&&r++<32?(t.consume(b),c):(r=0,f(b))}function d(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||xx(b)?n(b):(t.consume(b),d)}function f(b){return b===64?(t.consume(b),p):VF(b)?(t.consume(b),f):n(b)}function p(b){return Er(b)?m(b):n(b)}function m(b){return b===46?(t.consume(b),r=0,p):b===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(b),t.exit("autolinkMarker"),t.exit("autolink"),e):g(b)}function g(b){if((b===45||Er(b))&&r++<63){const v=b===45?g:m;return t.consume(b),v}return n(b)}}const Mm={partial:!0,tokenize:t7};function t7(t,e,n){return r;function r(s){return ht(s)?Ct(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||je(s)?e(s):n(s)}}const N2={continuation:{tokenize:r7},exit:i7,name:"blockQuote",tokenize:n7};function n7(t,e,n){const r=this;return i;function i(l){if(l===62){const c=r.containerState;return c.open||(t.enter("blockQuote",{_container:!0}),c.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(l),t.exit("blockQuoteMarker"),s}return n(l)}function s(l){return ht(l)?(t.enter("blockQuotePrefixWhitespace"),t.consume(l),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(l))}}function r7(t,e,n){const r=this;return i;function i(l){return ht(l)?Ct(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):s(l)}function s(l){return t.attempt(N2,e,n)(l)}}function i7(t){t.exit("blockQuote")}const z2={name:"characterEscape",tokenize:s7};function s7(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 $F(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const L2={name:"characterReference",tokenize:o7};function o7(t,e,n){const r=this;let i=0,s,l;return c;function c(m){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),d}function d(m){return m===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),f):(t.enter("characterReferenceValue"),s=31,l=Er,p(m))}function f(m){return m===88||m===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,l=PF,p):(t.enter("characterReferenceValue"),s=7,l=vx,p(m))}function p(m){if(m===59&&i){const g=t.exit("characterReferenceValue");return l===Er&&!tv(r.sliceSerialize(g))?n(m):(t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return l(m)&&i++<s?(t.consume(m),p):n(m)}}const LA={partial:!0,tokenize:a7},jA={concrete:!0,name:"codeFenced",tokenize:l7};function l7(t,e,n){const r=this,i={partial:!0,tokenize:V};let s=0,l=0,c;return d;function d(_){return f(_)}function f(_){const N=r.events[r.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,c=_,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),p(_)}function p(_){return _===c?(l++,t.consume(_),p):l<3?n(_):(t.exit("codeFencedFenceSequence"),ht(_)?Ct(t,m,"whitespace")(_):m(_))}function m(_){return _===null||je(_)?(t.exit("codeFencedFence"),r.interrupt?e(_):t.check(LA,w,Q)(_)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(_))}function g(_){return _===null||je(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(_)):ht(_)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ct(t,b,"whitespace")(_)):_===96&&_===c?n(_):(t.consume(_),g)}function b(_){return _===null||je(_)?m(_):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),v(_))}function v(_){return _===null||je(_)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(_)):_===96&&_===c?n(_):(t.consume(_),v)}function w(_){return t.attempt(i,Q,C)(_)}function C(_){return t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),E}function E(_){return s>0&&ht(_)?Ct(t,I,"linePrefix",s+1)(_):I(_)}function I(_){return _===null||je(_)?t.check(LA,w,Q)(_):(t.enter("codeFlowValue"),j(_))}function j(_){return _===null||je(_)?(t.exit("codeFlowValue"),I(_)):(t.consume(_),j)}function Q(_){return t.exit("codeFenced"),e(_)}function V(_,N,Z){let Y=0;return ce;function ce(U){return _.enter("lineEnding"),_.consume(U),_.exit("lineEnding"),ie}function ie(U){return _.enter("codeFencedFence"),ht(U)?Ct(_,se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):se(U)}function se(U){return U===c?(_.enter("codeFencedFenceSequence"),xe(U)):Z(U)}function xe(U){return U===c?(Y++,_.consume(U),xe):Y>=l?(_.exit("codeFencedFenceSequence"),ht(U)?Ct(_,pe,"whitespace")(U):pe(U)):Z(U)}function pe(U){return U===null||je(U)?(_.exit("codeFencedFence"),N(U)):Z(U)}}}function a7(t,e,n){const r=this;return i;function i(l){return l===null?n(l):(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s)}function s(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}const $0={name:"codeIndented",tokenize:u7},c7={partial:!0,tokenize:d7};function u7(t,e,n){const r=this;return i;function i(f){return t.enter("codeIndented"),Ct(t,s,"linePrefix",5)(f)}function s(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?l(f):n(f)}function l(f){return f===null?d(f):je(f)?t.attempt(c7,l,d)(f):(t.enter("codeFlowValue"),c(f))}function c(f){return f===null||je(f)?(t.exit("codeFlowValue"),l(f)):(t.consume(f),c)}function d(f){return t.exit("codeIndented"),e(f)}}function d7(t,e,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):je(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):Ct(t,s,"linePrefix",5)(l)}function s(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):je(l)?i(l):n(l)}}const f7={name:"codeText",previous:p7,resolve:h7,tokenize:m7};function h7(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 p7(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function m7(t,e,n){let r=0,i,s;return l;function l(m){return t.enter("codeText"),t.enter("codeTextSequence"),c(m)}function c(m){return m===96?(t.consume(m),r++,c):(t.exit("codeTextSequence"),d(m))}function d(m){return m===null?n(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),d):m===96?(s=t.enter("codeTextSequence"),i=0,p(m)):je(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),d):(t.enter("codeTextData"),f(m))}function f(m){return m===null||m===32||m===96||je(m)?(t.exit("codeTextData"),d(m)):(t.consume(m),f)}function p(m){return m===96?(t.consume(m),i++,p):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(s.type="codeTextData",f(m))}}class g7{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&&ou(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),ou(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ou(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);ou(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);ou(this.left,n.reverse())}}}function ou(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 j2(t){const e={};let n=-1,r,i,s,l,c,d,f;const p=new g7(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"&&(d=r[1]._tokenizer.events,s=0,s<d.length&&d[s][1].type==="lineEndingBlank"&&(s+=2),s<d.length&&d[s][1].type==="content"))for(;++s<d.length&&d[s][1].type!=="content";)d[s][1].type==="chunkText"&&(d[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,y7(p,n)),n=e[n],f=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(l=p.get(s),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(p.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=s);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...p.get(i)[1].start},c=p.slice(i,n),c.unshift(r),p.splice(i,n-i+1,c))}}return Ni(t,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function y7(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,d=[],f={};let p,m,g=-1,b=n,v=0,w=0;const C=[w];for(;b;){for(;t.get(++i)[1]!==b;);s.push(i),b._tokenizer||(p=r.sliceStream(b),b.next||p.push(null),m&&l.defineSkip(b.start),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(p),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),m=b,b=b.next}for(b=n;++g<c.length;)c[g][0]==="exit"&&c[g-1][0]==="enter"&&c[g][1].type===c[g-1][1].type&&c[g][1].start.line!==c[g][1].end.line&&(w=g+1,C.push(w),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(l.events=[],b?(b._tokenizer=void 0,b.previous=void 0):C.pop(),g=C.length;g--;){const E=c.slice(C[g],C[g+1]),I=s.pop();d.push([I,I+E.length-1]),t.splice(I,2,E)}for(d.reverse(),g=-1;++g<d.length;)f[v+d[g][0]]=v+d[g][1],v+=d[g][1]-d[g][0]-1;return f}const b7={resolve:v7,tokenize:S7},x7={partial:!0,tokenize:w7};function v7(t){return j2(t),t}function S7(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):je(c)?t.check(x7,l,s)(c):(t.consume(c),i)}function s(c){return t.exit("chunkContent"),t.exit("content"),e(c)}function l(c){return t.consume(c),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function w7(t,e,n){const r=this;return i;function i(l){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Ct(t,s,"linePrefix")}function s(l){if(l===null||je(l))return n(l);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?e(l):t.interrupt(r.parser.constructs.flow,n,e)(l)}}function I2(t,e,n,r,i,s,l,c,d){const f=d||Number.POSITIVE_INFINITY;let p=0;return m;function m(E){return E===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(E),t.exit(s),g):E===null||E===32||E===41||xx(E)?n(E):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),w(E))}function g(E){return E===62?(t.enter(s),t.consume(E),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(c),t.enter("chunkString",{contentType:"string"}),b(E))}function b(E){return E===62?(t.exit("chunkString"),t.exit(c),g(E)):E===null||E===60||je(E)?n(E):(t.consume(E),E===92?v:b)}function v(E){return E===60||E===62||E===92?(t.consume(E),b):b(E)}function w(E){return!p&&(E===null||E===41||cr(E))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(E)):p<f&&E===40?(t.consume(E),p++,w):E===41?(t.consume(E),p--,w):E===null||E===32||E===40||xx(E)?n(E):(t.consume(E),E===92?C:w)}function C(E){return E===40||E===41||E===92?(t.consume(E),w):w(E)}}function B2(t,e,n,r,i,s){const l=this;let c=0,d;return f;function f(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&&!d||b===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(b):b===93?(t.exit(s),t.enter(i),t.consume(b),t.exit(i),t.exit(r),e):je(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||je(b)||c++>999?(t.exit("chunkString"),p(b)):(t.consume(b),d||(d=!ht(b)),b===92?g:m)}function g(b){return b===91||b===92||b===93?(t.consume(b),c++,m):m(b)}}function U2(t,e,n,r,i,s){let l;return c;function c(g){return g===34||g===39||g===40?(t.enter(r),t.enter(i),t.consume(g),t.exit(i),l=g===40?41:g,d):n(g)}function d(g){return g===l?(t.enter(i),t.consume(g),t.exit(i),t.exit(r),e):(t.enter(s),f(g))}function f(g){return g===l?(t.exit(s),d(l)):g===null?n(g):je(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Ct(t,f,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===l||g===null||je(g)?(t.exit("chunkString"),f(g)):(t.consume(g),g===92?m:p)}function m(g){return g===l||g===92?(t.consume(g),p):p(g)}}function Ru(t,e){let n;return r;function r(i){return je(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):ht(i)?Ct(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const k7={name:"definition",tokenize:E7},C7={partial:!0,tokenize:T7};function E7(t,e,n){const r=this;let i;return s;function s(b){return t.enter("definition"),l(b)}function l(b){return B2.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function c(b){return i=Da(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(t.enter("definitionMarker"),t.consume(b),t.exit("definitionMarker"),d):n(b)}function d(b){return cr(b)?Ru(t,f)(b):f(b)}function f(b){return I2(t,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function p(b){return t.attempt(C7,m,m)(b)}function m(b){return ht(b)?Ct(t,g,"whitespace")(b):g(b)}function g(b){return b===null||je(b)?(t.exit("definition"),r.parser.defined.push(i),e(b)):n(b)}}function T7(t,e,n){return r;function r(c){return cr(c)?Ru(t,i)(c):n(c)}function i(c){return U2(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return ht(c)?Ct(t,l,"whitespace")(c):l(c)}function l(c){return c===null||je(c)?e(c):n(c)}}const A7={name:"hardBreakEscape",tokenize:M7};function M7(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return je(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const O7={name:"headingAtx",resolve:_7,tokenize:D7};function _7(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"},Ni(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function D7(t,e,n){let r=0;return i;function i(p){return t.enter("atxHeading"),s(p)}function s(p){return t.enter("atxHeadingSequence"),l(p)}function l(p){return p===35&&r++<6?(t.consume(p),l):p===null||cr(p)?(t.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(t.enter("atxHeadingSequence"),d(p)):p===null||je(p)?(t.exit("atxHeading"),e(p)):ht(p)?Ct(t,c,"whitespace")(p):(t.enter("atxHeadingText"),f(p))}function d(p){return p===35?(t.consume(p),d):(t.exit("atxHeadingSequence"),c(p))}function f(p){return p===null||p===35||cr(p)?(t.exit("atxHeadingText"),c(p)):(t.consume(p),f)}}const R7=["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"],IA=["pre","script","style","textarea"],N7={concrete:!0,name:"htmlFlow",resolveTo:j7,tokenize:I7},z7={partial:!0,tokenize:U7},L7={partial:!0,tokenize:B7};function j7(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 I7(t,e,n){const r=this;let i,s,l,c,d;return f;function f(T){return p(T)}function p(T){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(T),m}function m(T){return T===33?(t.consume(T),g):T===47?(t.consume(T),s=!0,w):T===63?(t.consume(T),i=3,r.interrupt?e:M):ki(T)?(t.consume(T),l=String.fromCharCode(T),C):n(T)}function g(T){return T===45?(t.consume(T),i=2,b):T===91?(t.consume(T),i=5,c=0,v):ki(T)?(t.consume(T),i=4,r.interrupt?e:M):n(T)}function b(T){return T===45?(t.consume(T),r.interrupt?e:M):n(T)}function v(T){const F="CDATA[";return T===F.charCodeAt(c++)?(t.consume(T),c===F.length?r.interrupt?e:se:v):n(T)}function w(T){return ki(T)?(t.consume(T),l=String.fromCharCode(T),C):n(T)}function C(T){if(T===null||T===47||T===62||cr(T)){const F=T===47,ue=l.toLowerCase();return!F&&!s&&IA.includes(ue)?(i=1,r.interrupt?e(T):se(T)):R7.includes(l.toLowerCase())?(i=6,F?(t.consume(T),E):r.interrupt?e(T):se(T)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(T):s?I(T):j(T))}return T===45||Er(T)?(t.consume(T),l+=String.fromCharCode(T),C):n(T)}function E(T){return T===62?(t.consume(T),r.interrupt?e:se):n(T)}function I(T){return ht(T)?(t.consume(T),I):ce(T)}function j(T){return T===47?(t.consume(T),ce):T===58||T===95||ki(T)?(t.consume(T),Q):ht(T)?(t.consume(T),j):ce(T)}function Q(T){return T===45||T===46||T===58||T===95||Er(T)?(t.consume(T),Q):V(T)}function V(T){return T===61?(t.consume(T),_):ht(T)?(t.consume(T),V):j(T)}function _(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(t.consume(T),d=T,N):ht(T)?(t.consume(T),_):Z(T)}function N(T){return T===d?(t.consume(T),d=null,Y):T===null||je(T)?n(T):(t.consume(T),N)}function Z(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||cr(T)?V(T):(t.consume(T),Z)}function Y(T){return T===47||T===62||ht(T)?j(T):n(T)}function ce(T){return T===62?(t.consume(T),ie):n(T)}function ie(T){return T===null||je(T)?se(T):ht(T)?(t.consume(T),ie):n(T)}function se(T){return T===45&&i===2?(t.consume(T),L):T===60&&i===1?(t.consume(T),G):T===62&&i===4?(t.consume(T),D):T===63&&i===3?(t.consume(T),M):T===93&&i===5?(t.consume(T),Ae):je(T)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(z7,H,xe)(T)):T===null||je(T)?(t.exit("htmlFlowData"),xe(T)):(t.consume(T),se)}function xe(T){return t.check(L7,pe,H)(T)}function pe(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),U}function U(T){return T===null||je(T)?xe(T):(t.enter("htmlFlowData"),se(T))}function L(T){return T===45?(t.consume(T),M):se(T)}function G(T){return T===47?(t.consume(T),l="",me):se(T)}function me(T){if(T===62){const F=l.toLowerCase();return IA.includes(F)?(t.consume(T),D):se(T)}return ki(T)&&l.length<8?(t.consume(T),l+=String.fromCharCode(T),me):se(T)}function Ae(T){return T===93?(t.consume(T),M):se(T)}function M(T){return T===62?(t.consume(T),D):T===45&&i===2?(t.consume(T),M):se(T)}function D(T){return T===null||je(T)?(t.exit("htmlFlowData"),H(T)):(t.consume(T),D)}function H(T){return t.exit("htmlFlow"),e(T)}}function B7(t,e,n){const r=this;return i;function i(l){return je(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),s):n(l)}function s(l){return r.parser.lazy[r.now().line]?n(l):e(l)}}function U7(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Mm,e,n)}}const H7={name:"htmlText",tokenize:V7};function V7(t,e,n){const r=this;let i,s,l;return c;function c(M){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(M),d}function d(M){return M===33?(t.consume(M),f):M===47?(t.consume(M),V):M===63?(t.consume(M),j):ki(M)?(t.consume(M),Z):n(M)}function f(M){return M===45?(t.consume(M),p):M===91?(t.consume(M),s=0,v):ki(M)?(t.consume(M),I):n(M)}function p(M){return M===45?(t.consume(M),b):n(M)}function m(M){return M===null?n(M):M===45?(t.consume(M),g):je(M)?(l=m,G(M)):(t.consume(M),m)}function g(M){return M===45?(t.consume(M),b):m(M)}function b(M){return M===62?L(M):M===45?g(M):m(M)}function v(M){const D="CDATA[";return M===D.charCodeAt(s++)?(t.consume(M),s===D.length?w:v):n(M)}function w(M){return M===null?n(M):M===93?(t.consume(M),C):je(M)?(l=w,G(M)):(t.consume(M),w)}function C(M){return M===93?(t.consume(M),E):w(M)}function E(M){return M===62?L(M):M===93?(t.consume(M),E):w(M)}function I(M){return M===null||M===62?L(M):je(M)?(l=I,G(M)):(t.consume(M),I)}function j(M){return M===null?n(M):M===63?(t.consume(M),Q):je(M)?(l=j,G(M)):(t.consume(M),j)}function Q(M){return M===62?L(M):j(M)}function V(M){return ki(M)?(t.consume(M),_):n(M)}function _(M){return M===45||Er(M)?(t.consume(M),_):N(M)}function N(M){return je(M)?(l=N,G(M)):ht(M)?(t.consume(M),N):L(M)}function Z(M){return M===45||Er(M)?(t.consume(M),Z):M===47||M===62||cr(M)?Y(M):n(M)}function Y(M){return M===47?(t.consume(M),L):M===58||M===95||ki(M)?(t.consume(M),ce):je(M)?(l=Y,G(M)):ht(M)?(t.consume(M),Y):L(M)}function ce(M){return M===45||M===46||M===58||M===95||Er(M)?(t.consume(M),ce):ie(M)}function ie(M){return M===61?(t.consume(M),se):je(M)?(l=ie,G(M)):ht(M)?(t.consume(M),ie):Y(M)}function se(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(t.consume(M),i=M,xe):je(M)?(l=se,G(M)):ht(M)?(t.consume(M),se):(t.consume(M),pe)}function xe(M){return M===i?(t.consume(M),i=void 0,U):M===null?n(M):je(M)?(l=xe,G(M)):(t.consume(M),xe)}function pe(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||cr(M)?Y(M):(t.consume(M),pe)}function U(M){return M===47||M===62||cr(M)?Y(M):n(M)}function L(M){return M===62?(t.consume(M),t.exit("htmlTextData"),t.exit("htmlText"),e):n(M)}function G(M){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),me}function me(M){return ht(M)?Ct(t,Ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):Ae(M)}function Ae(M){return t.enter("htmlTextData"),l(M)}}const rv={name:"labelEnd",resolveAll:q7,resolveTo:Y7,tokenize:K7},P7={tokenize:W7},$7={tokenize:G7},F7={tokenize:Z7};function q7(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&&Ni(t,0,t.length,n),t}function Y7(t,e){let n=t.length,r=0,i,s,l,c;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const d={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},f={type:"label",start:{...t[s][1].start},end:{...t[l][1].end}},p={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[l-2][1].start}};return c=[["enter",d,e],["enter",f,e]],c=$r(c,t.slice(s+1,s+r+3)),c=$r(c,[["enter",p,e]]),c=$r(c,nv(e.parser.constructs.insideSpan.null,t.slice(s+r+4,l-3),e)),c=$r(c,[["exit",p,e],t[l-2],t[l-1],["exit",f,e]]),c=$r(c,t.slice(l+1)),c=$r(c,[["exit",d,e]]),Ni(t,s,t.length,c),t}function K7(t,e,n){const r=this;let i=r.events.length,s,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return c;function c(g){return s?s._inactive?m(g):(l=r.parser.defined.includes(Da(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),d):n(g)}function d(g){return g===40?t.attempt(P7,p,l?p:m)(g):g===91?t.attempt($7,p,l?f:m)(g):l?p(g):m(g)}function f(g){return t.attempt(F7,p,m)(g)}function p(g){return e(g)}function m(g){return s._balanced=!0,n(g)}}function W7(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 cr(m)?Ru(t,s)(m):s(m)}function s(m){return m===41?p(m):I2(t,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function l(m){return cr(m)?Ru(t,d)(m):p(m)}function c(m){return n(m)}function d(m){return m===34||m===39||m===40?U2(t,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):p(m)}function f(m){return cr(m)?Ru(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 G7(t,e,n){const r=this;return i;function i(c){return B2.call(r,t,s,l,"reference","referenceMarker","referenceString")(c)}function s(c){return r.parser.defined.includes(Da(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(c):n(c)}function l(c){return n(c)}}function Z7(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 J7={name:"labelStartImage",resolveAll:rv.resolveAll,tokenize:X7};function X7(t,e,n){const r=this;return i;function i(c){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(c),t.exit("labelImageMarker"),s}function s(c){return c===91?(t.enter("labelMarker"),t.consume(c),t.exit("labelMarker"),t.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):e(c)}}const Q7={name:"labelStartLink",resolveAll:rv.resolveAll,tokenize:eq};function eq(t,e,n){const r=this;return i;function i(l){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(l),t.exit("labelMarker"),t.exit("labelLink"),s}function s(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):e(l)}}const F0={name:"lineEnding",tokenize:tq};function tq(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Ct(t,e,"linePrefix")}}const Rh={name:"thematicBreak",tokenize:nq};function nq(t,e,n){let r=0,i;return s;function s(f){return t.enter("thematicBreak"),l(f)}function l(f){return i=f,c(f)}function c(f){return f===i?(t.enter("thematicBreakSequence"),d(f)):r>=3&&(f===null||je(f))?(t.exit("thematicBreak"),e(f)):n(f)}function d(f){return f===i?(t.consume(f),r++,d):(t.exit("thematicBreakSequence"),ht(f)?Ct(t,c,"whitespace")(f):c(f))}}const ir={continuation:{tokenize:oq},exit:aq,name:"list",tokenize:sq},rq={partial:!0,tokenize:cq},iq={partial:!0,tokenize:lq};function sq(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return c;function c(b){const v=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:vx(b)){if(r.containerState.type||(r.containerState.type=v,t.enter(v,{_container:!0})),v==="listUnordered")return t.enter("listItemPrefix"),b===42||b===45?t.check(Rh,n,f)(b):f(b);if(!r.interrupt||b===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),d(b)}return n(b)}function d(b){return vx(b)&&++l<10?(t.consume(b),d):(!r.interrupt||l<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(t.exit("listItemValue"),f(b)):n(b)}function f(b){return t.enter("listItemMarker"),t.consume(b),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,t.check(Mm,r.interrupt?n:p,t.attempt(rq,g,m))}function p(b){return r.containerState.initialBlankLine=!0,s++,g(b)}function m(b){return ht(b)?(t.enter("listItemPrefixWhitespace"),t.consume(b),t.exit("listItemPrefixWhitespace"),g):n(b)}function g(b){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(b)}}function oq(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Mm,i,s);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ct(t,e,"listItemIndent",r.containerState.size+1)(c)}function s(c){return r.containerState.furtherBlankLines||!ht(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(iq,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ct(t,t.attempt(ir,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function lq(t,e,n){const r=this;return Ct(t,i,"listItemIndent",r.containerState.size+1);function i(s){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?e(s):n(s)}}function aq(t){t.exit(this.containerState.type)}function cq(t,e,n){const r=this;return Ct(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const l=r.events[r.events.length-1];return!ht(s)&&l&&l[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const BA={name:"setextUnderline",resolveTo:uq,tokenize:dq};function uq(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const l={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",l,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=l,t.push(["exit",l,e]),t}function dq(t,e,n){const r=this;let i;return s;function s(f){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=f,l(f)):n(f)}function l(f){return t.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===i?(t.consume(f),c):(t.exit("setextHeadingLineSequence"),ht(f)?Ct(t,d,"lineSuffix")(f):d(f))}function d(f){return f===null||je(f)?(t.exit("setextHeadingLine"),e(f)):n(f)}}const fq={tokenize:hq};function hq(t){const e=this,n=t.attempt(Mm,r,t.attempt(this.parser.constructs.flowInitial,i,Ct(t,t.attempt(this.parser.constructs.flow,i,t.attempt(b7,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 pq={resolveAll:V2()},mq=H2("string"),gq=H2("text");function H2(t){return{resolveAll:V2(t==="text"?yq:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,l,c);return l;function l(p){return f(p)?s(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),d}function d(p){return f(p)?(n.exit("data"),s(p)):(n.consume(p),d)}function f(p){if(p===null)return!0;const m=i[p];let g=-1;if(m)for(;++g<m.length;){const b=m[g];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function V2(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 yq(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,l=-1,c=0,d;for(;s--;){const f=i[s];if(typeof f=="string"){for(l=f.length;f.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(f===-2)d=!0,c++;else if(f!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(c=0),c){const f={type:n===t.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?l:r.start._bufferIndex+l,_index:r.start._index+s,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(t.splice(n,0,["enter",f,e],["exit",f,e]),n+=2)}n++}return t}const bq={42:ir,43:ir,45:ir,48:ir,49:ir,50:ir,51:ir,52:ir,53:ir,54:ir,55:ir,56:ir,57:ir,62:N2},xq={91:k7},vq={[-2]:$0,[-1]:$0,32:$0},Sq={35:O7,42:Rh,45:[BA,Rh],60:N7,61:BA,95:Rh,96:jA,126:jA},wq={38:L2,92:z2},kq={[-5]:F0,[-4]:F0,[-3]:F0,33:J7,38:L2,42:Sx,60:[QF,H7],91:Q7,92:[A7,z2],93:rv,95:Sx,96:f7},Cq={null:[Sx,pq]},Eq={null:[42,95]},Tq={null:[]},Aq=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Eq,contentInitial:xq,disable:Tq,document:bq,flow:Sq,flowInitial:vq,insideSpan:Cq,string:wq,text:kq},Symbol.toStringTag,{value:"Module"}));function Mq(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let l=[],c=[];const d={attempt:N(V),check:N(_),consume:I,enter:j,exit:Q,interrupt:N(_,{interrupt:!0})},f={code:null,containerState:{},defineSkip:w,events:[],now:v,parser:t,previous:null,sliceSerialize:g,sliceStream:b,write:m};let p=e.tokenize.call(f,d);return e.resolveAll&&s.push(e),f;function m(ie){return l=$r(l,ie),C(),l[l.length-1]!==null?[]:(Z(e,0),f.events=nv(s,f.events,f),f.events)}function g(ie,se){return _q(b(ie),se)}function b(ie){return Oq(l,ie)}function v(){const{_bufferIndex:ie,_index:se,line:xe,column:pe,offset:U}=r;return{_bufferIndex:ie,_index:se,line:xe,column:pe,offset:U}}function w(ie){i[ie.line]=ie.column,ce()}function C(){let ie;for(;r._index<l.length;){const se=l[r._index];if(typeof se=="string")for(ie=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===ie&&r._bufferIndex<se.length;)E(se.charCodeAt(r._bufferIndex));else E(se)}}function E(ie){p=p(ie)}function I(ie){je(ie)?(r.line++,r.column=1,r.offset+=ie===-3?2:1,ce()):ie!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=ie}function j(ie,se){const xe=se||{};return xe.type=ie,xe.start=v(),f.events.push(["enter",xe,f]),c.push(xe),xe}function Q(ie){const se=c.pop();return se.end=v(),f.events.push(["exit",se,f]),se}function V(ie,se){Z(ie,se.from)}function _(ie,se){se.restore()}function N(ie,se){return xe;function xe(pe,U,L){let G,me,Ae,M;return Array.isArray(pe)?H(pe):"tokenize"in pe?H([pe]):D(pe);function D(le){return Re;function Re(Be){const Ie=Be!==null&&le[Be],Xe=Be!==null&&le.null,Me=[...Array.isArray(Ie)?Ie:Ie?[Ie]:[],...Array.isArray(Xe)?Xe:Xe?[Xe]:[]];return H(Me)(Be)}}function H(le){return G=le,me=0,le.length===0?L:T(le[me])}function T(le){return Re;function Re(Be){return M=Y(),Ae=le,le.partial||(f.currentConstruct=le),le.name&&f.parser.constructs.disable.null.includes(le.name)?ue():le.tokenize.call(se?Object.assign(Object.create(f),se):f,d,F,ue)(Be)}}function F(le){return ie(Ae,M),U}function ue(le){return M.restore(),++me<G.length?T(G[me]):L}}}function Z(ie,se){ie.resolveAll&&!s.includes(ie)&&s.push(ie),ie.resolve&&Ni(f.events,se,f.events.length-se,ie.resolve(f.events.slice(se),f)),ie.resolveTo&&(f.events=ie.resolveTo(f.events,f))}function Y(){const ie=v(),se=f.previous,xe=f.currentConstruct,pe=f.events.length,U=Array.from(c);return{from:pe,restore:L};function L(){r=ie,f.previous=se,f.currentConstruct=xe,f.events.length=pe,c=U,ce()}}function ce(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Oq(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let l;if(n===i)l=[t[n].slice(r,s)];else{if(l=t.slice(n,i),r>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}s>0&&l.push(t[i].slice(0,s))}return l}function _q(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let l;if(typeof s=="string")l=s;else switch(s){case-5:{l="\r";break}case-4:{l=`
|
|
298
|
+
`;break}case-3:{l=`\r
|
|
299
|
+
`;break}case-2:{l=e?" ":" ";break}case-1:{if(!e&&i)continue;l=" ";break}default:l=String.fromCharCode(s)}i=s===-2,r.push(l)}return r.join("")}function Dq(t){const r={constructs:BF([Aq,...(t||{}).extensions||[]]),content:i(YF),defined:[],document:i(WF),flow:i(fq),lazy:{},string:i(mq),text:i(gq)};return r;function i(s){return l;function l(c){return Mq(r,s,c)}}}function Rq(t){for(;!j2(t););return t}const UA=/[\0\t\n\r]/g;function Nq(){let t=1,e="",n=!0,r;return i;function i(s,l,c){const d=[];let f,p,m,g,b;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(l||void 0).decode(s)),m=0,e="",n&&(s.charCodeAt(0)===65279&&m++,n=void 0);m<s.length;){if(UA.lastIndex=m,f=UA.exec(s),g=f&&f.index!==void 0?f.index:s.length,b=s.charCodeAt(g),!f){e=s.slice(m);break}if(b===10&&m===g&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),m<g&&(d.push(s.slice(m,g)),t+=g-m),b){case 0:{d.push(65533),t++;break}case 9:{for(p=Math.ceil(t/4)*4,d.push(-2);t++<p;)d.push(-1);break}case 10:{d.push(-4),t=1;break}default:r=!0,t=1}m=g+1}return c&&(r&&d.push(-5),e&&d.push(e),d.push(null)),d}}const zq=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Lq(t){return t.replace(zq,jq)}function jq(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return R2(n.slice(s?2:1),s?16:10)}return tv(n)||t}const P2={}.hasOwnProperty;function Iq(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),Bq(n)(Rq(Dq(n).document().write(Nq()(t,e,!0))))}function Bq(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ft),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:s(Jt),blockQuote:s(Xe),characterEscape:Y,characterReference:Y,codeFenced:s(Me),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(Me,l),codeText:s(Ye,l),codeTextData:Y,data:Y,codeFlowValue:Y,definition:s(At),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s(Mt),hardBreakEscape:s(Vn),hardBreakTrailing:s(Vn),htmlFlow:s(dr,l),htmlFlowData:Y,htmlText:s(dr,l),htmlTextData:Y,image:s(Pn),label:l,link:s(Ft),listItem:s(Qr),listItemValue:g,listOrdered:s(fr,m),listUnordered:s(fr),paragraph:s(ji),reference:T,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(Jt),strong:s(Ar),thematicBreak:s(Ii)},exit:{atxHeading:d(),atxHeadingSequence:V,autolink:d(),autolinkEmail:Ie,autolinkProtocol:Be,blockQuote:d(),characterEscapeValue:ce,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:le,characterReference:Re,codeFenced:d(C),codeFencedFence:w,codeFencedFenceInfo:b,codeFencedFenceMeta:v,codeFlowValue:ce,codeIndented:d(E),codeText:d(U),codeTextData:ce,data:ce,definition:d(),definitionDestinationString:Q,definitionLabelString:I,definitionTitleString:j,emphasis:d(),hardBreakEscape:d(se),hardBreakTrailing:d(se),htmlFlow:d(xe),htmlFlowData:ce,htmlText:d(pe),htmlTextData:ce,image:d(G),label:Ae,labelText:me,lineEnding:ie,link:d(L),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:F,resourceDestinationString:M,resourceTitleString:D,resource:H,setextHeading:d(Z),setextHeadingLineSequence:N,setextHeadingText:_,strong:d(),thematicBreak:d()}};$2(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(J){let de={type:"root",children:[]};const Ee={stack:[de],tokenStack:[],config:e,enter:c,exit:f,buffer:l,resume:p,data:n},K=[];let ge=-1;for(;++ge<J.length;)if(J[ge][1].type==="listOrdered"||J[ge][1].type==="listUnordered")if(J[ge][0]==="enter")K.push(ge);else{const De=K.pop();ge=i(J,De,ge)}for(ge=-1;++ge<J.length;){const De=e[J[ge][0]];P2.call(De,J[ge][1].type)&&De[J[ge][1].type].call(Object.assign({sliceSerialize:J[ge][2].sliceSerialize},Ee),J[ge][1])}if(Ee.tokenStack.length>0){const De=Ee.tokenStack[Ee.tokenStack.length-1];(De[1]||HA).call(Ee,void 0,De[0])}for(de.position={start:Fs(J.length>0?J[0][1].start:{line:1,column:1,offset:0}),end:Fs(J.length>0?J[J.length-2][1].end:{line:1,column:1,offset:0})},ge=-1;++ge<e.transforms.length;)de=e.transforms[ge](de)||de;return de}function i(J,de,Ee){let K=de-1,ge=-1,De=!1,tt,re,Le,nt;for(;++K<=Ee;){const Ge=J[K];switch(Ge[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ge[0]==="enter"?ge++:ge--,nt=void 0;break}case"lineEndingBlank":{Ge[0]==="enter"&&(tt&&!nt&&!ge&&!Le&&(Le=K),nt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:nt=void 0}if(!ge&&Ge[0]==="enter"&&Ge[1].type==="listItemPrefix"||ge===-1&&Ge[0]==="exit"&&(Ge[1].type==="listUnordered"||Ge[1].type==="listOrdered")){if(tt){let jt=K;for(re=void 0;jt--;){const he=J[jt];if(he[1].type==="lineEnding"||he[1].type==="lineEndingBlank"){if(he[0]==="exit")continue;re&&(J[re][1].type="lineEndingBlank",De=!0),he[1].type="lineEnding",re=jt}else if(!(he[1].type==="linePrefix"||he[1].type==="blockQuotePrefix"||he[1].type==="blockQuotePrefixWhitespace"||he[1].type==="blockQuoteMarker"||he[1].type==="listItemIndent"))break}Le&&(!re||Le<re)&&(tt._spread=!0),tt.end=Object.assign({},re?J[re][1].start:Ge[1].end),J.splice(re||K,0,["exit",tt,Ge[2]]),K++,Ee++}if(Ge[1].type==="listItemPrefix"){const jt={type:"listItem",_spread:!1,start:Object.assign({},Ge[1].start),end:void 0};tt=jt,J.splice(K,0,["enter",jt,Ge[2]]),K++,Ee++,Le=void 0,nt=!0}}}return J[de][1]._spread=De,Ee}function s(J,de){return Ee;function Ee(K){c.call(this,J(K),K),de&&de.call(this,K)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(J,de,Ee){this.stack[this.stack.length-1].children.push(J),this.stack.push(J),this.tokenStack.push([de,Ee||void 0]),J.position={start:Fs(de.start),end:void 0}}function d(J){return de;function de(Ee){J&&J.call(this,Ee),f.call(this,Ee)}}function f(J,de){const Ee=this.stack.pop(),K=this.tokenStack.pop();if(K)K[0].type!==J.type&&(de?de.call(this,J,K[0]):(K[1]||HA).call(this,J,K[0]));else throw new Error("Cannot close `"+J.type+"` ("+Du({start:J.start,end:J.end})+"): it’s not open");Ee.position.end=Fs(J.end)}function p(){return jF(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function g(J){if(this.data.expectingFirstListItemValue){const de=this.stack[this.stack.length-2];de.start=Number.parseInt(this.sliceSerialize(J),10),this.data.expectingFirstListItemValue=void 0}}function b(){const J=this.resume(),de=this.stack[this.stack.length-1];de.lang=J}function v(){const J=this.resume(),de=this.stack[this.stack.length-1];de.meta=J}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const J=this.resume(),de=this.stack[this.stack.length-1];de.value=J.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const J=this.resume(),de=this.stack[this.stack.length-1];de.value=J.replace(/(\r?\n|\r)$/g,"")}function I(J){const de=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=de,Ee.identifier=Da(this.sliceSerialize(J)).toLowerCase()}function j(){const J=this.resume(),de=this.stack[this.stack.length-1];de.title=J}function Q(){const J=this.resume(),de=this.stack[this.stack.length-1];de.url=J}function V(J){const de=this.stack[this.stack.length-1];if(!de.depth){const Ee=this.sliceSerialize(J).length;de.depth=Ee}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function N(J){const de=this.stack[this.stack.length-1];de.depth=this.sliceSerialize(J).codePointAt(0)===61?1:2}function Z(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(J){const Ee=this.stack[this.stack.length-1].children;let K=Ee[Ee.length-1];(!K||K.type!=="text")&&(K=qt(),K.position={start:Fs(J.start),end:void 0},Ee.push(K)),this.stack.push(K)}function ce(J){const de=this.stack.pop();de.value+=this.sliceSerialize(J),de.position.end=Fs(J.end)}function ie(J){const de=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ee=de.children[de.children.length-1];Ee.position.end=Fs(J.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(de.type)&&(Y.call(this,J),ce.call(this,J))}function se(){this.data.atHardBreak=!0}function xe(){const J=this.resume(),de=this.stack[this.stack.length-1];de.value=J}function pe(){const J=this.resume(),de=this.stack[this.stack.length-1];de.value=J}function U(){const J=this.resume(),de=this.stack[this.stack.length-1];de.value=J}function L(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=de,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function G(){const J=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";J.type+="Reference",J.referenceType=de,delete J.url,delete J.title}else delete J.identifier,delete J.label;this.data.referenceType=void 0}function me(J){const de=this.sliceSerialize(J),Ee=this.stack[this.stack.length-2];Ee.label=Lq(de),Ee.identifier=Da(de).toLowerCase()}function Ae(){const J=this.stack[this.stack.length-1],de=this.resume(),Ee=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ee.type==="link"){const K=J.children;Ee.children=K}else Ee.alt=de}function M(){const J=this.resume(),de=this.stack[this.stack.length-1];de.url=J}function D(){const J=this.resume(),de=this.stack[this.stack.length-1];de.title=J}function H(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function F(J){const de=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=de,Ee.identifier=Da(this.sliceSerialize(J)).toLowerCase(),this.data.referenceType="full"}function ue(J){this.data.characterReferenceType=J.type}function le(J){const de=this.sliceSerialize(J),Ee=this.data.characterReferenceType;let K;Ee?(K=R2(de,Ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):K=tv(de);const ge=this.stack[this.stack.length-1];ge.value+=K}function Re(J){const de=this.stack.pop();de.position.end=Fs(J.end)}function Be(J){ce.call(this,J);const de=this.stack[this.stack.length-1];de.url=this.sliceSerialize(J)}function Ie(J){ce.call(this,J);const de=this.stack[this.stack.length-1];de.url="mailto:"+this.sliceSerialize(J)}function Xe(){return{type:"blockquote",children:[]}}function Me(){return{type:"code",lang:null,meta:null,value:""}}function Ye(){return{type:"inlineCode",value:""}}function At(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Mt(){return{type:"emphasis",children:[]}}function Jt(){return{type:"heading",depth:0,children:[]}}function Vn(){return{type:"break"}}function dr(){return{type:"html",value:""}}function Pn(){return{type:"image",title:null,url:"",alt:null}}function Ft(){return{type:"link",title:null,url:"",children:[]}}function fr(J){return{type:"list",ordered:J.type==="listOrdered",start:null,spread:J._spread,children:[]}}function Qr(J){return{type:"listItem",spread:J._spread,checked:null,children:[]}}function ji(){return{type:"paragraph",children:[]}}function Ar(){return{type:"strong",children:[]}}function qt(){return{type:"text",value:""}}function Ii(){return{type:"thematicBreak"}}}function Fs(t){return{line:t.line,column:t.column,offset:t.offset}}function $2(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?$2(t,r):Uq(t,r)}}function Uq(t,e){let n;for(n in e)if(P2.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 HA(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Du({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Du({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Du({start:e.start,end:e.end})+") is still open")}function Hq(t){const e=this;e.parser=n;function n(r){return Iq(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Vq(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 Pq(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
300
|
+
`}]}function $q(t,e){const n=e.value?e.value+`
|
|
301
|
+
`:"",r={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function Fq(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function qq(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Yq(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=oc(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let l,c=t.footnoteCounts.get(r);c===void 0?(c=0,t.footnoteOrder.push(r),l=t.footnoteOrder.length):l=s+1,c+=1,t.footnoteCounts.set(r,c);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};t.patch(e,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return t.patch(e,f),t.applyData(e,f)}function Kq(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 Wq(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function F2(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const l=i[i.length-1];return l&&l.type==="text"?l.value+=r:i.push({type:"text",value:r}),i}function Gq(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return F2(t,e);const i={src:oc(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 Zq(t,e){const n={src:oc(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 Jq(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 Xq(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return F2(t,e);const i={href:oc(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 Qq(t,e){const n={href:oc(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 eY(t,e,n){const r=t.all(e),i=n?tY(n):q2(e),s={},l=[];if(typeof e.checked=="boolean"){const p=r[0];let m;p&&p.type==="element"&&p.tagName==="p"?m=p:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const p=r[c];(i||c!==0||p.type!=="element"||p.tagName!=="p")&&l.push({type:"text",value:`
|
|
302
|
+
`}),p.type==="element"&&p.tagName==="p"&&!i?l.push(...p.children):l.push(p)}const d=r[r.length-1];d&&(i||d.type!=="element"||d.tagName!=="p")&&l.push({type:"text",value:`
|
|
303
|
+
`});const f={type:"element",tagName:"li",properties:s,children:l};return t.patch(e,f),t.applyData(e,f)}function tY(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=q2(n[r])}return e}function q2(t){const e=t.spread;return e??t.children.length>1}function nY(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i<r.length;){const l=r[i];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)}function rY(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function iY(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function sY(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function oY(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],l),i.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},c=J1(e.children[1]),d=E2(e.children[e.children.length-1]);c&&d&&(l.position={start:c,end:d}),i.push(l)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function lY(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:e.children.length;let d=-1;const f=[];for(;++d<c;){const m=e.children[d],g={},b=l?l[d]:void 0;b&&(g.align=b);let v={type:"element",tagName:s,properties:g,children:[]};m&&(v.children=t.all(m),t.patch(m,v),v=t.applyData(m,v)),f.push(v)}const p={type:"element",tagName:"tr",properties:{},children:t.wrap(f,!0)};return t.patch(e,p),t.applyData(e,p)}function aY(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const VA=9,PA=32;function cY(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push($A(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push($A(e.slice(i),i>0,!1)),s.join("")}function $A(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===VA||s===PA;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===VA||s===PA;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function uY(t,e){const n={type:"text",value:cY(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function dY(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const fY={blockquote:Vq,break:Pq,code:$q,delete:Fq,emphasis:qq,footnoteReference:Yq,heading:Kq,html:Wq,imageReference:Gq,image:Zq,inlineCode:Jq,linkReference:Xq,link:Qq,listItem:eY,list:nY,paragraph:rY,root:iY,strong:sY,table:oY,tableCell:aY,tableRow:lY,text:uY,thematicBreak:dY,toml:uh,yaml:uh,definition:uh,footnoteDefinition:uh};function uh(){}const Y2=-1,Om=0,Nu=1,Kp=2,iv=3,sv=4,ov=5,lv=6,K2=7,W2=8,FA=typeof self=="object"?self:globalThis,hY=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,l]=e[i];switch(s){case Om:case Y2:return n(l,i);case Nu:{const c=n([],i);for(const d of l)c.push(r(d));return c}case Kp:{const c=n({},i);for(const[d,f]of l)c[r(d)]=r(f);return c}case iv:return n(new Date(l),i);case sv:{const{source:c,flags:d}=l;return n(new RegExp(c,d),i)}case ov:{const c=n(new Map,i);for(const[d,f]of l)c.set(r(d),r(f));return c}case lv:{const c=n(new Set,i);for(const d of l)c.add(r(d));return c}case K2:{const{name:c,message:d}=l;return n(new FA[c](d),i)}case W2:return n(BigInt(l),i);case"BigInt":return n(Object(BigInt(l)),i);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}}return n(new FA[s](l),i)};return r},qA=t=>hY(new Map,t)(0),ua="",{toString:pY}={},{keys:mY}=Object,lu=t=>{const e=typeof t;if(e!=="object"||!t)return[Om,e];const n=pY.call(t).slice(8,-1);switch(n){case"Array":return[Nu,ua];case"Object":return[Kp,ua];case"Date":return[iv,ua];case"RegExp":return[sv,ua];case"Map":return[ov,ua];case"Set":return[lv,ua];case"DataView":return[Nu,n]}return n.includes("Array")?[Nu,n]:n.includes("Error")?[K2,n]:[Kp,n]},dh=([t,e])=>t===Om&&(e==="function"||e==="symbol"),gY=(t,e,n,r)=>{const i=(l,c)=>{const d=r.push(l)-1;return n.set(c,d),d},s=l=>{if(n.has(l))return n.get(l);let[c,d]=lu(l);switch(c){case Om:{let p=l;switch(d){case"bigint":c=W2,p=l.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+d);p=null;break;case"undefined":return i([Y2],l)}return i([c,p],l)}case Nu:{if(d){let g=l;return d==="DataView"?g=new Uint8Array(l.buffer):d==="ArrayBuffer"&&(g=new Uint8Array(l)),i([d,[...g]],l)}const p=[],m=i([c,p],l);for(const g of l)p.push(s(g));return m}case Kp:{if(d)switch(d){case"BigInt":return i([d,l.toString()],l);case"Boolean":case"Number":case"String":return i([d,l.valueOf()],l)}if(e&&"toJSON"in l)return s(l.toJSON());const p=[],m=i([c,p],l);for(const g of mY(l))(t||!dh(lu(l[g])))&&p.push([s(g),s(l[g])]);return m}case iv:return i([c,l.toISOString()],l);case sv:{const{source:p,flags:m}=l;return i([c,{source:p,flags:m}],l)}case ov:{const p=[],m=i([c,p],l);for(const[g,b]of l)(t||!(dh(lu(g))||dh(lu(b))))&&p.push([s(g),s(b)]);return m}case lv:{const p=[],m=i([c,p],l);for(const g of l)(t||!dh(lu(g)))&&p.push(s(g));return m}}const{message:f}=l;return i([c,{name:d,message:f}],l)};return s},YA=(t,{json:e,lossy:n}={})=>{const r=[];return gY(!(e||n),!!e,new Map,r)(t),r},Wp=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?qA(YA(t,e)):structuredClone(t):(t,e)=>qA(YA(t,e));function yY(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 bY(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function xY(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||yY,r=t.options.footnoteBackLabel||bY,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let d=-1;for(;++d<t.footnoteOrder.length;){const f=t.footnoteById.get(t.footnoteOrder[d]);if(!f)continue;const p=t.all(f),m=String(f.identifier).toUpperCase(),g=oc(m.toLowerCase());let b=0;const v=[],w=t.footnoteCounts.get(m);for(;w!==void 0&&++b<=w;){v.length>0&&v.push({type:"text",value:" "});let I=typeof n=="string"?n:n(d,b);typeof I=="string"&&(I={type:"text",value:I}),v.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(d,b),className:["data-footnote-backref"]},children:Array.isArray(I)?I:[I]})}const C=p[p.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const I=C.children[C.children.length-1];I&&I.type==="text"?I.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...v)}else p.push(...v);const E={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(p,!0)};t.patch(f,E),c.push(E)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Wp(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
304
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:`
|
|
305
|
+
`}]}}const G2=(function(t){if(t==null)return kY;if(typeof t=="function")return _m(t);if(typeof t=="object")return Array.isArray(t)?vY(t):SY(t);if(typeof t=="string")return wY(t);throw new Error("Expected function, string, or object as test")});function vY(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=G2(t[n]);return _m(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function SY(t){const e=t;return _m(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function wY(t){return _m(e);function e(n){return n&&n.type===t}}function _m(t){return e;function e(n,r,i){return!!(CY(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function kY(){return!0}function CY(t){return t!==null&&typeof t=="object"&&"type"in t}const Z2=[],EY=!0,KA=!1,TY="skip";function AY(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=G2(i),l=r?-1:1;c(t,void 0,[])();function c(d,f,p){const m=d&&typeof d=="object"?d:{};if(typeof m.type=="string"){const b=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(d.type+(b?"<"+b+">":""))+")"})}return g;function g(){let b=Z2,v,w,C;if((!e||s(d,f,p[p.length-1]||void 0))&&(b=MY(n(d,p)),b[0]===KA))return b;if("children"in d&&d.children){const E=d;if(E.children&&b[0]!==TY)for(w=(r?E.children.length:-1)+l,C=p.concat(E);w>-1&&w<E.children.length;){const I=E.children[w];if(v=c(I,w,C)(),v[0]===KA)return v;w=typeof v[1]=="number"?v[1]:w+l}}return b}}}function MY(t){return Array.isArray(t)?t:typeof t=="number"?[EY,t]:t==null?Z2:[t]}function J2(t,e,n,r){let i,s,l;typeof e=="function"&&typeof n!="function"?(s=void 0,l=e,i=n):(s=e,l=n,i=r),AY(t,s,c,i);function c(d,f){const p=f[f.length-1],m=p?p.children.indexOf(d):void 0;return l(d,m,p)}}const wx={}.hasOwnProperty,OY={};function _Y(t,e){const n=e||OY,r=new Map,i=new Map,s=new Map,l={...fY,...n.handlers},c={all:f,applyData:RY,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:l,one:d,options:n,patch:DY,wrap:zY};return J2(t,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const m=p.type==="definition"?r:i,g=String(p.identifier).toUpperCase();m.has(g)||m.set(g,p)}}),c;function d(p,m){const g=p.type,b=c.handlers[g];if(wx.call(c.handlers,g)&&b)return b(c,p,m);if(c.options.passThrough&&c.options.passThrough.includes(g)){if("children"in p){const{children:w,...C}=p,E=Wp(C);return E.children=c.all(p),E}return Wp(p)}return(c.options.unknownHandler||NY)(c,p,m)}function f(p){const m=[];if("children"in p){const g=p.children;let b=-1;for(;++b<g.length;){const v=c.one(g[b],p);if(v){if(b&&g[b-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=WA(v.value)),!Array.isArray(v)&&v.type==="element")){const w=v.children[0];w&&w.type==="text"&&(w.value=WA(w.value))}Array.isArray(v)?m.push(...v):m.push(v)}}}return m}}function DY(t,e){t.position&&(e.position=pF(t))}function RY(t,e){let n=e;if(t&&t.data){const r=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&s&&Object.assign(n.properties,Wp(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function NY(t,e){const n=e.data||{},r="value"in e&&!(wx.call(n,"hProperties")||wx.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function zY(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
|
|
306
|
+
`});++r<t.length;)r&&n.push({type:"text",value:`
|
|
307
|
+
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
308
|
+
`}),n}function WA(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function GA(t,e){const n=_Y(t,e),r=n.one(t,void 0),i=xY(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
309
|
+
`},i),s}function LY(t,e){return t&&"run"in t?async function(n,r){const i=GA(n,{file:r,...e});await t.run(i,r)}:function(n,r){return GA(n,{file:r,...t||e})}}function ZA(t){if(t)throw t}var q0,JA;function jY(){if(JA)return q0;JA=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(f){return typeof Array.isArray=="function"?Array.isArray(f):e.call(f)==="[object Array]"},s=function(f){if(!f||e.call(f)!=="[object Object]")return!1;var p=t.call(f,"constructor"),m=f.constructor&&f.constructor.prototype&&t.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!m)return!1;var g;for(g in f);return typeof g>"u"||t.call(f,g)},l=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},c=function(f,p){if(p==="__proto__")if(t.call(f,p)){if(r)return r(f,p).value}else return;return f[p]};return q0=function d(){var f,p,m,g,b,v,w=arguments[0],C=1,E=arguments.length,I=!1;for(typeof w=="boolean"&&(I=w,w=arguments[1]||{},C=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});C<E;++C)if(f=arguments[C],f!=null)for(p in f)m=c(w,p),g=c(f,p),w!==g&&(I&&g&&(s(g)||(b=i(g)))?(b?(b=!1,v=m&&i(m)?m:[]):v=m&&s(m)?m:{},l(w,{name:p,newValue:d(I,v,g)})):typeof g<"u"&&l(w,{name:p,newValue:g}));return w},q0}var IY=jY();const Y0=Zp(IY);function kx(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 BY(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...i);function c(d,...f){const p=t[++s];let m=-1;if(d){l(d);return}for(;++m<i.length;)(f[m]===null||f[m]===void 0)&&(f[m]=i[m]);i=f,p?UY(p,c)(...f):l(null,...f)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function UY(t,e){let n;return r;function r(...l){const c=t.length>l.length;let d;c&&l.push(i);try{d=t.apply(this,l)}catch(f){const p=f;if(c&&n)throw p;return i(p)}c||(d&&d.then&&typeof d.then=="function"?d.then(s,i):d instanceof Error?i(d):s(d))}function i(l,...c){n||(n=!0,e(l,...c))}function s(l){i(null,l)}}const wi={basename:HY,dirname:VY,extname:PY,join:$Y,sep:"/"};function HY(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Td(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let l=-1,c=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else l<0&&(s=!0,l=i+1),c>-1&&(t.codePointAt(i)===e.codePointAt(c--)?c<0&&(r=i):(c=-1,r=l));return n===r?r=l:r<0&&(r=t.length),t.slice(n,r)}function VY(t){if(Td(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 PY(t){Td(t);let e=t.length,n=-1,r=0,i=-1,s=0,l;for(;e--;){const c=t.codePointAt(e);if(c===47){if(l){r=e+1;break}continue}n<0&&(l=!0,n=e+1),c===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function $Y(...t){let e=-1,n;for(;++e<t.length;)Td(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":FY(n)}function FY(t){Td(t);const e=t.codePointAt(0)===47;let n=qY(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function qY(t,e){let n="",r=0,i=-1,s=0,l=-1,c,d;for(;++l<=t.length;){if(l<t.length)c=t.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(i===l-1||s===1))if(i!==l-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),i=l,s=0;continue}}else if(n.length>0){n="",r=0,i=l,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,l):n=t.slice(i+1,l),r=l-i-1;i=l,s=0}else c===46&&s>-1?s++:s=-1}return n}function Td(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const YY={cwd:KY};function KY(){return"/"}function Cx(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function WY(t){if(typeof t=="string")t=new URL(t);else if(!Cx(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 GY(t)}function GY(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const K0=["history","path","basename","stem","extname","dirname"];class X2{constructor(e){let n;e?Cx(e)?n={path:e}:typeof e=="string"||ZY(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":YY.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<K0.length;){const s=K0[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)K0.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?wi.basename(this.path):void 0}set basename(e){G0(e,"basename"),W0(e,"basename"),this.path=wi.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?wi.dirname(this.path):void 0}set dirname(e){XA(this.basename,"dirname"),this.path=wi.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?wi.extname(this.path):void 0}set extname(e){if(W0(e,"extname"),XA(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=wi.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Cx(e)&&(e=WY(e)),G0(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?wi.basename(this.path,this.extname):void 0}set stem(e){G0(e,"stem"),W0(e,"stem"),this.path=wi.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 Hn(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function W0(t,e){if(t&&t.includes(wi.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+wi.sep+"`")}function G0(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function XA(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function ZY(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const JY=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),XY={}.hasOwnProperty;class av extends JY{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=BY()}copy(){const e=new av;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(Y0(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(X0("data",this.frozen),this.namespace[e]=n,this):XY.call(this.namespace,e)&&this.namespace[e]||void 0:e?(X0("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=fh(e),r=this.parser||this.Parser;return Z0("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),Z0("process",this.parser||this.Parser),J0("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,l){const c=fh(e),d=r.parse(c);r.run(d,c,function(p,m,g){if(p||!m||!g)return f(p);const b=m,v=r.stringify(b,g);tK(v)?g.value=v:g.result=v,f(p,g)});function f(p,m){p||!m?l(p):s?s(m):n(void 0,m)}}}processSync(e){let n=!1,r;return this.freeze(),Z0("processSync",this.parser||this.Parser),J0("processSync",this.compiler||this.Compiler),this.process(e,i),eM("processSync","process",n),r;function i(s,l){n=!0,ZA(s),r=l}}run(e,n,r){QA(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(l,c){const d=fh(n);i.run(e,d,f);function f(p,m,g){const b=m||e;p?c(p):l?l(b):r(void 0,b,g)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),eM("runSync","run",r),i;function s(l,c){ZA(l),i=c,r=!0}}stringify(e,n){this.freeze();const r=fh(n),i=this.compiler||this.Compiler;return J0("stringify",i),QA(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(X0("use",this.frozen),e!=null)if(typeof e=="function")d(e,n);else if(typeof e=="object")Array.isArray(e)?c(e):l(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...m]=f;d(p,m)}else l(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function l(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(f.plugins),f.settings&&(i.settings=Y0(!0,i.settings,f.settings))}function c(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const m=f[p];s(m)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,p){let m=-1,g=-1;for(;++m<r.length;)if(r[m][0]===f){g=m;break}if(g===-1)r.push([f,...p]);else if(p.length>0){let[b,...v]=p;const w=r[g][1];kx(w)&&kx(b)&&(b=Y0(!0,w,b)),r[g]=[f,b,...v]}}}}const QY=new av().freeze();function Z0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function J0(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function X0(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function QA(t){if(!kx(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function eM(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function fh(t){return eK(t)?t:new X2(t)}function eK(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function tK(t){return typeof t=="string"||nK(t)}function nK(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const rK="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",tM=[],nM={allowDangerousHtml:!0},iK=/^(https?|ircs?|mailto|xmpp)$/i,sK=[{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 oK(t){const e=lK(t),n=aK(t);return cK(e.runSync(e.parse(n),n),t)}function lK(t){const e=t.rehypePlugins||tM,n=t.remarkPlugins||tM,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...nM}:nM;return QY().use(Hq).use(n).use(LY,r).use(e)}function aK(t){const e=t.children||"",n=new X2;return typeof e=="string"&&(n.value=e),n}function cK(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,l=e.skipHtml,c=e.unwrapDisallowed,d=e.urlTransform||uK;for(const p of sK)Object.hasOwn(e,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+rK+p.id,void 0);return J2(t,f),xF(t,{Fragment:k.Fragment,components:i,ignoreInvalidStyle:!0,jsx:k.jsx,jsxs:k.jsxs,passKeys:!0,passNode:!0});function f(p,m,g){if(p.type==="raw"&&g&&typeof m=="number")return l?g.children.splice(m,1):g.children[m]={type:"text",value:p.value},m;if(p.type==="element"){let b;for(b in P0)if(Object.hasOwn(P0,b)&&Object.hasOwn(p.properties,b)){const v=p.properties[b],w=P0[b];(w===null||w.includes(p.tagName))&&(p.properties[b]=d(String(v||""),b,p))}}if(p.type==="element"){let b=n?!n.includes(p.tagName):s?s.includes(p.tagName):!1;if(!b&&r&&typeof m=="number"&&(b=!r(p,m,g)),b&&g&&typeof m=="number")return c&&p.children?g.children.splice(m,1,...p.children):g.children.splice(m,1),m}}}function uK(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||iK.test(t.slice(0,e))?t:""}const dK=[0,.2,.4];function Q0({ctrlYdoc:t,editor:e,activeDocId:n,openDocs:r,claudeActive:i,claudeStatus:s,visible:l,capturedAnchor:c,onCapturedAnchorChange:d,inputRef:f,reduceMotion:p}){const m=p?"auto":"smooth",[g,b]=O.useState([]),[v,w]=O.useState(""),C=O.useRef(null),E=O.useRef(null);O.useEffect(()=>{f&&(f.current=E.current)},[f]),O.useEffect(()=>{if(!t)return;const Y=t.getMap(gC),ce=()=>{const ie=[];Y.forEach(se=>{ie.push(se)}),ie.sort((se,xe)=>se.timestamp-xe.timestamp||se.id.localeCompare(xe.id)),b(ie)};return Y.observe(ce),ce(),()=>Y.unobserve(ce)},[t]);const I=O.useRef(!1);O.useEffect(()=>{var Y;if(!i&&I.current){I.current=!1;return}I.current=!!i,(Y=C.current)==null||Y.scrollIntoView({behavior:m})},[g,i,m]),O.useEffect(()=>{var Y;l&&((Y=C.current)==null||Y.scrollIntoView({behavior:m}))},[l,m]);const j=O.useCallback(()=>{if(!t||!v.trim())return;const Y=t.getMap(gC),ce={id:$9(),author:"user",text:v.trim(),timestamp:Date.now(),...n?{documentId:n}:{},...c?{anchor:c}:{},read:!1};Y.set(ce.id,ce),w(""),d(null)},[t,v,n,c,d]),Q=O.useCallback(Y=>{Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),j())},[j]),V=O.useCallback((Y,ce)=>{if(!(!e||ce&&ce!==n))try{const ie=ml(e.state.doc,Y.from),se=ml(e.state.doc,Y.to);e.chain().focus().setTextSelection({from:ie,to:se}).scrollIntoView().run()}catch(ie){console.warn("[ChatPanel] Could not scroll to anchor:",ie instanceof Error?ie.message:ie)}},[e,n]),_=Y=>{if(!Y)return null;const ce=r.find(ie=>ie.id===Y);return(ce==null?void 0:ce.fileName)??null},N=g.filter(Y=>Y.author==="claude"&&!Y.read).length,Z=O.useCallback(async()=>{try{await fetch(`http://localhost:${Ga}/api/chat`,{method:"DELETE"})}catch(Y){console.warn("[ChatPanel] Failed to clear chat:",Y)}},[]);return k.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",background:"var(--tandem-surface-muted)",flex:1,minHeight:0},children:[k.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--tandem-border)",fontWeight:600,fontSize:"14px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:["Chat",k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[N>0&&k.jsx("span",{style:{background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",borderRadius:"10px",padding:"2px 8px",fontSize:"11px"},children:N}),g.length>0&&k.jsx("button",{onClick:Z,title:"Clear chat history","data-testid":"clear-chat-btn",style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-fg-subtle)",fontSize:"13px",padding:"2px 4px",lineHeight:1},children:"Clear"})]})]}),k.jsxs("div",{style:{flex:1,overflow:"auto",padding:"12px",minHeight:0},children:[g.length===0&&k.jsx("div",{style:{color:"var(--tandem-fg-subtle)",fontSize:"13px",textAlign:"center",marginTop:"24px"},children:"No messages yet. Select text and send a message to Claude."}),g.map(Y=>k.jsxs("div",{style:{marginBottom:"12px",padding:"8px 12px",borderRadius:"8px",background:Y.author==="user"?"var(--tandem-accent-bg)":"var(--tandem-surface)",border:`1px solid ${Y.author==="user"?"var(--tandem-accent-border)":"var(--tandem-border)"}`,fontSize:"13px",color:"var(--tandem-fg)"},children:[k.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",marginBottom:"4px"},children:[k.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:Y.author==="claude"?"var(--tandem-accent)":"var(--tandem-fg-muted)",textTransform:"uppercase"},children:Y.author}),Y.documentId&&k.jsx("span",{style:{fontSize:"10px",color:"var(--tandem-fg-muted)",background:"var(--tandem-surface-muted)",padding:"1px 6px",borderRadius:"4px"},children:_(Y.documentId)??Y.documentId}),k.jsx("span",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginLeft:"auto"},children:new Date(Y.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),Y.anchor&&k.jsx("div",{onClick:()=>V(Y.anchor,Y.documentId),className:"chat-anchor-quote",style:{padding:"4px 8px",marginBottom:"6px",borderLeft:"3px solid var(--tandem-accent-border)",background:"var(--tandem-accent-bg)",fontSize:"12px",color:"var(--tandem-accent-fg-strong)",cursor:"pointer",borderRadius:"0 4px 4px 0",maxHeight:"60px",overflow:"hidden",transition:"max-height 0.3s ease"},title:"Click to scroll to this text",onMouseEnter:ce=>{ce.currentTarget.style.maxHeight="500px"},onMouseLeave:ce=>{ce.currentTarget.style.maxHeight="60px"},children:Y.anchor.textSnapshot}),Y.author==="claude"?k.jsx("div",{className:"chat-markdown",children:k.jsx(oK,{children:Y.text})}):k.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:Y.text})]},Y.id)),i&&k.jsxs("div",{style:{padding:"8px 12px",marginBottom:"8px",fontSize:"12px",color:"var(--tandem-author-claude)",display:"flex",alignItems:"center",gap:"8px"},children:[k.jsx("span",{style:{display:"inline-flex",gap:"3px"},children:dK.map(Y=>k.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"var(--tandem-author-claude)",animation:`tandem-typing-bounce 1.2s ease-in-out ${Y}s infinite`}},Y))}),k.jsx("span",{children:s??"Claude is thinking..."})]}),k.jsx("div",{ref:C})]}),c&&k.jsxs("div",{style:{padding:"4px 12px",background:"var(--tandem-accent-bg)",borderTop:"1px solid var(--tandem-accent-border)",fontSize:"11px",color:"var(--tandem-accent-fg-strong)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsxs("span",{children:["with selection: “",c.textSnapshot.slice(0,40),c.textSnapshot.length>40?"...":"","”"]}),k.jsx("button",{onClick:()=>d(null),style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-fg-muted)",fontSize:"14px"},children:"x"})]}),k.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid var(--tandem-border)",display:"flex",gap:"8px"},children:[k.jsx("textarea",{ref:E,value:v,onChange:Y=>w(Y.target.value),onKeyDown:Q,placeholder:"Message Claude...",rows:2,style:{flex:1,padding:"8px",border:"1px solid var(--tandem-border-strong)",borderRadius:"6px",fontSize:"13px",resize:"none",outline:"none",fontFamily:"inherit",background:"var(--tandem-surface)",color:"var(--tandem-fg)"}}),k.jsx("button",{onClick:j,disabled:!v.trim(),style:{padding:"8px 12px",background:v.trim()?"var(--tandem-accent)":"var(--tandem-border-strong)",color:v.trim()?"var(--tandem-accent-fg)":"var(--tandem-fg-subtle)",border:"none",borderRadius:"6px",cursor:v.trim()?"pointer":"default",fontSize:"13px",fontWeight:500,alignSelf:"flex-end"},children:"Send"})]}),k.jsx("style",{children:`
|
|
310
|
+
@keyframes tandem-typing-bounce {
|
|
311
|
+
0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
|
|
312
|
+
30% { transform: translateY(-4px); opacity: 1; }
|
|
313
|
+
}
|
|
314
|
+
`})]})}function fK({accepted:t,dismissed:e,total:n,onDismiss:r}){const i=n>0?Math.round(t/n*100):0;return k.jsx("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.4)",zIndex:1e3},onClick:r,children:k.jsxs("div",{style:{background:"var(--tandem-surface)",borderRadius:"12px",padding:"32px 40px",maxWidth:"400px",boxShadow:"0 20px 60px rgba(0,0,0,0.2)",textAlign:"center"},onClick:s=>s.stopPropagation(),children:[k.jsx("div",{style:{fontSize:"48px",marginBottom:"8px"},children:i>=80?"✅":i>=50?"📋":"🔍"}),k.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",fontWeight:600,color:"var(--tandem-fg)"},children:"Review Complete"}),k.jsx("p",{style:{margin:"0 0 20px",color:"var(--tandem-fg-muted)",fontSize:"14px"},children:"All annotations have been resolved."}),k.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:"24px",marginBottom:"20px"},children:[k.jsxs("div",{children:[k.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"var(--tandem-success)"},children:t}),k.jsx("div",{style:{fontSize:"12px",color:"var(--tandem-fg-muted)"},children:"Accepted"})]}),k.jsx("div",{style:{width:"1px",background:"var(--tandem-border)"}}),k.jsxs("div",{children:[k.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"var(--tandem-error)"},children:e}),k.jsx("div",{style:{fontSize:"12px",color:"var(--tandem-fg-muted)"},children:"Dismissed"})]}),k.jsx("div",{style:{width:"1px",background:"var(--tandem-border)"}}),k.jsxs("div",{children:[k.jsxs("div",{style:{fontSize:"28px",fontWeight:700,color:"var(--tandem-accent)"},children:[i,"%"]}),k.jsx("div",{style:{fontSize:"12px",color:"var(--tandem-fg-muted)"},children:"Accept rate"})]})]}),k.jsx("button",{onClick:r,style:{padding:"8px 24px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"6px",background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",cursor:"pointer"},children:"Done"})]})})}function hK({annotations:t,activeDocFormat:e,documentId:n}){const[r,i]=O.useState(!1);if(e!=="docx")return null;const s=t.filter(f=>f.status==="accepted"),l=t.filter(f=>f.status==="pending"),c=s.length===0||r;async function d(){if(c||!n)return;let f=`Apply ${s.length} change(s) as tracked revisions?
|
|
315
|
+
|
|
316
|
+
The changes will appear as tracked revisions in Word — you can Accept or Reject each one individually.
|
|
317
|
+
|
|
318
|
+
Your original file will be backed up.`;if(l.length>0&&(f+=`
|
|
319
|
+
|
|
320
|
+
⚠ ${l.length} annotation(s) are still pending review and will not be applied.`),!!confirm(f)){i(!0);try{const p=await fetch(`${Bu}/apply-changes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:n})}),m=await p.json().catch(b=>(console.error("[ApplyChanges] Failed to parse response JSON:",b),null));if(!p.ok){alert((m==null?void 0:m.message)??`Apply failed (HTTP ${p.status}).`);return}const g=m==null?void 0:m.data;if(g){const b=[`Applied ${g.applied??0} tracked change(s).`];g.rejected>0&&b.push(`${g.rejected} could not be applied.`),g.backupPath&&b.push(`
|
|
321
|
+
Backup saved to:
|
|
322
|
+
${g.backupPath}`),alert(b.join(" "))}else alert("Changes applied successfully.")}catch(p){console.error("[ApplyChanges] Request failed:",p),alert(p instanceof TypeError?"Could not reach the server.":`Apply failed: ${p instanceof Error?p.message:String(p)}`)}finally{i(!1)}}}return k.jsx("button",{type:"button","data-testid":"apply-changes-btn",onClick:d,disabled:c,title:s.length===0?"No accepted suggestions to apply":void 0,style:{width:"100%",padding:"6px 12px",fontSize:"12px",fontWeight:500,border:`1px solid ${c?"var(--tandem-border)":"var(--tandem-info-border)"}`,borderRadius:"4px",background:c?"var(--tandem-surface-muted)":"var(--tandem-info)",color:c?"var(--tandem-fg-subtle)":"var(--tandem-info-fg)",cursor:c?"default":"pointer",opacity:r?.6:1,whiteSpace:"nowrap"},children:r?"Applying…":`Apply as Tracked Changes (${s.length})`})}function pK(t,e){O.useEffect(()=>{function n(r){if(r.ctrlKey&&r.shiftKey&&r.key==="R"){r.preventDefault(),e.onToggleReviewMode();return}if(t)if(r.key==="Tab"&&!r.ctrlKey&&!r.altKey)r.preventDefault(),e.navigateReview(r.shiftKey?"prev":"next");else if(r.key==="y"||r.key==="Y"){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;r.preventDefault(),e.acceptCurrent()}else if(r.key==="n"||r.key==="N"){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;r.preventDefault(),e.dismissCurrent()}else if(r.key==="z"||r.key==="Z"){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;r.preventDefault(),e.undoLast()}else if(r.key==="e"||r.key==="E"){if(r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement)return;r.preventDefault(),e.scrollToCurrentAndExit()}else r.key==="Escape"&&e.cancelBulkOrExit()}return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e])}const eb={background:"var(--tandem-warning-bg)",border:"var(--tandem-warning-border)",color:"var(--tandem-warning-fg-strong)"};function mK(t){const e=new Date(t),r=new Date().getTime()-e.getTime(),i=Math.floor(r/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const s=Math.floor(i/60);return s<24?`${s}h ago`:e.toLocaleDateString()}function gK({replies:t}){return t.length===0?null:k.jsx("div",{"data-testid":"comment-thread",style:{marginTop:"6px",paddingLeft:"8px",borderLeft:"2px solid var(--tandem-border)"},children:t.map(e=>k.jsxs("div",{"data-testid":`reply-${e.id}`,style:{padding:"4px 0",fontSize:"12px",lineHeight:"1.4"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[k.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:e.author==="claude"?"var(--tandem-accent)":"var(--tandem-fg-muted)"},children:e.author==="claude"?"Claude":"You"}),k.jsxs("span",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[e.editedAt&&k.jsx("span",{style:{fontStyle:"italic",marginRight:"4px"},children:"(edited)"}),mK(e.timestamp)]})]}),k.jsx("p",{style:{margin:0,color:"var(--tandem-fg)"},children:e.text})]},e.id))})}function yK(t){return t.color?zu[t.color]||"var(--tandem-border)":t.suggestedText!==void 0||t.directedAt==="claude"?"var(--tandem-accent)":t.type==="flag"?"var(--tandem-error)":"var(--tandem-author-user)"}const rM=hn.memo(function({annotation:e,replies:n=[],isReviewTarget:r,onAccept:i,onDismiss:s,onUndo:l,onEdit:c,onReply:d,undoable:f,onClick:p}){const m=yK(e),g=e.status==="pending",[b,v]=O.useState(!1),[w,C]=O.useState(""),[E,I]=O.useState(""),[j,Q]=O.useState(""),[V,_]=O.useState(!1),[N,Z]=O.useState(""),[Y,ce]=O.useState(!1),ie=e.suggestedText!==void 0;function se(){ie?(I(e.suggestedText??""),Q(e.content)):C(e.content),v(!0)}function xe(){const T=ie?JSON.stringify({suggestedText:E,content:j}):w;c==null||c(e.id,T),v(!1)}function pe(){v(!1)}function U(T){T.key==="Escape"&&(T.stopPropagation(),pe())}function L(T){T.key==="Escape"&&(T.stopPropagation(),_(!1),Z(""))}async function G(){const T=N.trim();if(!(!T||Y)){ce(!0);try{await(d==null?void 0:d(e.id,T))!==!1&&(Z(""),_(!1))}finally{ce(!1)}}}const me={width:"100%",padding:"4px 6px",fontSize:"12px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",resize:"vertical",fontFamily:"inherit",minHeight:"40px",boxSizing:"border-box",background:"var(--tandem-surface)",color:"var(--tandem-fg)"},Ae={padding:"1px 4px",fontSize:"11px",border:"none",background:"none",color:"var(--tandem-fg-subtle)",cursor:"pointer",lineHeight:1},M=e.content?e.content.length>60?e.content.slice(0,57)+"...":e.content:"",D=ie?"replacement":e.directedAt==="claude"?"question":e.type,H=`${D} annotation${M?": "+M:""}, ${e.status}`;return k.jsxs("div",{onClick:p,"data-testid":`annotation-card-${e.id}`,role:"listitem","aria-label":H,"aria-current":r?"true":void 0,style:{padding:"8px 10px",marginBottom:"6px",borderLeft:`3px solid ${m}`,background:r?"var(--tandem-accent-bg)":"var(--tandem-surface)",borderRadius:"0 4px 4px 0",fontSize:"13px",opacity:g?1:.6,cursor:p?"pointer":"default",outline:r?"2px solid var(--tandem-accent)":"none",transition:"background 0.15s, outline 0.15s"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[k.jsxs("span",{style:{fontWeight:500,textTransform:"capitalize",display:"flex",alignItems:"center",gap:"4px"},children:[D,!g&&k.jsx("span",{style:{marginLeft:"6px",fontSize:"10px",color:e.status==="accepted"?"var(--tandem-success)":"var(--tandem-error)",fontWeight:600},children:e.status}),g&&c&&!r&&!b&&k.jsx("button",{"data-testid":`edit-btn-${e.id}`,onClick:T=>{T.stopPropagation(),se()},style:Ae,title:"Edit this annotation's content",children:"✎ Edit"})]}),k.jsxs("span",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",display:"flex",alignItems:"center",gap:"4px"},children:[e.editedAt&&k.jsx("span",{style:{fontStyle:"italic",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:"(edited)"}),e.author==="claude"?"Claude":e.author==="import"?"Imported":"You"]})]}),e.textSnapshot&&k.jsx("div",{"data-testid":`annotation-snippet-${e.id}`,style:{padding:"4px 8px",marginBottom:"6px",borderLeft:"3px solid var(--tandem-border-strong)",color:"var(--tandem-fg-muted)",fontSize:"12px",fontStyle:"italic",backgroundColor:"var(--tandem-surface-muted)",borderRadius:"2px"},children:e.textSnapshot.length>80?e.textSnapshot.slice(0,77)+"...":e.textSnapshot}),b?k.jsxs("div",{style:{marginTop:"4px"},onClick:T=>T.stopPropagation(),children:[ie?k.jsxs(k.Fragment,{children:[k.jsx("label",{style:{fontSize:"11px",color:"var(--tandem-fg-muted)",display:"block",marginBottom:"2px"},children:"Replacement text"}),k.jsx("textarea",{"data-testid":`edit-newtext-${e.id}`,value:E,onChange:T=>I(T.target.value),onKeyDown:U,style:me,autoFocus:!0}),k.jsx("label",{style:{fontSize:"11px",color:"var(--tandem-fg-muted)",display:"block",marginTop:"4px",marginBottom:"2px"},children:"Reason"}),k.jsx("textarea",{"data-testid":`edit-reason-${e.id}`,value:j,onChange:T=>Q(T.target.value),onKeyDown:U,style:me})]}):k.jsx("textarea",{"data-testid":`edit-text-${e.id}`,value:w,onChange:T=>C(T.target.value),onKeyDown:U,style:me,autoFocus:!0}),k.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[k.jsx("button",{"data-testid":`edit-save-btn-${e.id}`,onClick:T=>{T.stopPropagation(),xe()},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-success-bg)",color:"var(--tandem-success-fg-strong)",cursor:"pointer"},children:"Save"}),k.jsx("button",{"data-testid":`edit-cancel-btn-${e.id}`,onClick:T=>{T.stopPropagation(),pe()},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer"},children:"Cancel"})]})]}):k.jsx("div",{style:{margin:0,color:"var(--tandem-fg)",lineHeight:"1.4"},children:ie?k.jsxs(k.Fragment,{children:[k.jsxs("div",{"data-testid":`suggestion-diff-${e.id}`,style:{padding:"4px 8px",marginBottom:e.content?"4px":0,backgroundColor:"var(--tandem-surface-muted)",borderRadius:"3px",fontSize:"12px",lineHeight:"1.5"},children:[e.textSnapshot&&k.jsx("span",{style:{textDecoration:"line-through",color:"var(--tandem-error)",backgroundColor:"var(--tandem-error-bg)",padding:"0 2px",borderRadius:"2px"},children:e.textSnapshot}),e.textSnapshot&&" → ",k.jsx("span",{style:{color:"var(--tandem-success-fg-strong)",backgroundColor:"var(--tandem-success-bg)",padding:"0 2px",borderRadius:"2px"},children:e.suggestedText})]}),e.content&&k.jsx("p",{style:{margin:0,fontSize:"12px",color:"var(--tandem-fg-muted)"},children:e.content})]}):k.jsx("p",{style:{margin:0},children:e.content||"(no note)"})}),g&&!b&&(i||s)&&k.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"6px"},children:[i&&k.jsx("button",{"data-testid":`accept-btn-${e.id}`,onClick:T=>{T.stopPropagation(),i(e.id)},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-success-bg)",color:"var(--tandem-success-fg-strong)",cursor:"pointer"},children:"Accept"}),s&&k.jsx("button",{"data-testid":`dismiss-btn-${e.id}`,onClick:T=>{T.stopPropagation(),s(e.id)},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-error-bg)",color:"var(--tandem-error-fg-strong)",cursor:"pointer"},children:"Reject"})]}),!g&&f&&l&&k.jsxs("div",{style:{marginTop:"4px",position:"relative"},children:[k.jsx("button",{"data-testid":"undo-btn",onClick:T=>{T.stopPropagation(),l(e.id)},style:{padding:"1px 6px",fontSize:"11px",border:"none",background:"none",color:"var(--tandem-accent)",cursor:"pointer",textDecoration:"underline"},children:"Undo"}),k.jsx("div",{"data-testid":"undo-countdown",style:{height:"2px",marginTop:"2px",borderRadius:"1px",backgroundColor:"var(--tandem-accent)",animation:"undo-countdown-shrink 10s linear forwards"}}),k.jsx("style",{children:`@keyframes undo-countdown-shrink {
|
|
323
|
+
from { width: 100%; }
|
|
324
|
+
to { width: 0%; }
|
|
325
|
+
}`})]}),k.jsx(gK,{replies:n}),g&&d&&!b&&k.jsx("div",{style:{marginTop:"6px"},onClick:T=>T.stopPropagation(),children:V?k.jsxs("div",{children:[k.jsx("textarea",{"data-testid":`reply-input-${e.id}`,value:N,onChange:T=>Z(T.target.value),onKeyDown:L,placeholder:"Write a reply...",style:me,autoFocus:!0}),k.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[k.jsx("button",{"data-testid":`reply-send-btn-${e.id}`,onClick:G,disabled:!N.trim()||Y,style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:N.trim()?"var(--tandem-accent-bg)":"var(--tandem-surface-muted)",color:N.trim()?"var(--tandem-accent-fg-strong)":"var(--tandem-fg-subtle)",cursor:N.trim()?"pointer":"default"},children:"Send"}),k.jsx("button",{"data-testid":`reply-cancel-btn-${e.id}`,onClick:()=>{_(!1),Z("")},style:{padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)",cursor:"pointer"},children:"Cancel"})]})]}):k.jsxs("button",{"data-testid":`reply-btn-${e.id}`,onClick:()=>_(!0),style:{padding:"1px 4px",fontSize:"11px",border:"none",background:"none",color:"var(--tandem-fg-subtle)",cursor:"pointer"},children:["Reply",n.length>0?` (${n.length})`:""]})}),!g&&n.length>0&&!d&&k.jsxs("div",{style:{marginTop:"4px",fontSize:"11px",color:"var(--tandem-fg-subtle)"},children:[n.length," ",n.length===1?"reply":"replies"]})]})});function tb({value:t,onChange:e,options:n,testId:r}){return k.jsx("select",{"data-testid":r,value:t,onChange:i=>e(i.target.value),style:{padding:"2px 4px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",background:"var(--tandem-surface)",color:"var(--tandem-fg)",cursor:"pointer",outline:"none"},children:n.map(i=>k.jsx("option",{value:i.value,children:i.label},i.value))})}const hh={padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",cursor:"pointer"};function bK(t,e,n){if(t.suggestedText===void 0)return!1;const r=t.suggestedText,i=$p(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 nb({annotations:t,editor:e,ydoc:n,heldCount:r=0,tandemMode:i,onModeChange:s,activeDocFormat:l,documentId:c,reviewMode:d,onToggleReviewMode:f,onExitReviewMode:p,activeAnnotationId:m,onActiveAnnotationChange:g,reduceMotion:b}){const v=b?"auto":"smooth",[w,C]=O.useState("all"),[E,I]=O.useState("all"),[j,Q]=O.useState("all"),[V,_]=O.useState(0),N=O.useRef(0),[Z,Y]=O.useState(null),ce=O.useRef(Z);ce.current=Z;const ie=O.useRef(null),[se,xe]=O.useState(new Set),pe=O.useRef(null),U=O.useRef(new Map);O.useEffect(()=>{const K=U.current;return()=>{for(const ge of K.values())clearTimeout(ge)}},[]);const L=O.useRef(n),G=O.useRef(e);L.current=n,G.current=e;const[me,Ae]=O.useState(new Map);O.useEffect(()=>{if(!n){Ae(new Map);return}const K=n.getMap(jz);function ge(){const tt=new Map;K.forEach(re=>{const Le=re;if(Le&&typeof Le=="object"&&Le.annotationId){const nt=tt.get(Le.annotationId)??[];nt.push(Le),tt.set(Le.annotationId,nt)}});for(const re of tt.values())re.sort((Le,nt)=>Le.timestamp-nt.timestamp);Ae(tt)}ge();const De=()=>ge();return K.observe(De),()=>K.unobserve(De)},[n]);const{filtered:M,pending:D,resolved:H,allPending:T}=O.useMemo(()=>{const K=[],ge=[];for(const re of t){re.status==="pending"&&ge.push(re);let Le;w==="all"?Le=!0:w==="with-replacement"?Le=re.suggestedText!==void 0:w==="for-claude"?Le=re.directedAt==="claude":Le=re.type===w;const nt=E==="all"||re.author===E,Ge=j==="all"||re.status===j;Le&&nt&&Ge&&K.push(re)}const De=K.filter(re=>re.status==="pending"),tt=K.filter(re=>re.status!=="pending");return{filtered:K,pending:De,resolved:tt,allPending:ge}},[t,w,E,j]),F=T,ue=O.useRef(F);ue.current=F;function le(K,ge){const De=L.current;if(!De)return;const tt=De.getMap(xa),re=tt.get(K);if(!re)return;const Le=Tu(re);if(tt.set(K,{...Le,status:ge}),ge==="accepted"&&Le.suggestedText!==void 0&&G.current&&!bK(Le,G.current,L.current)){tt.set(K,{...Le,status:"pending"});return}pe.current=K,xe(jt=>new Set(jt).add(K));const nt=U.current.get(K);nt&&clearTimeout(nt);const Ge=setTimeout(()=>{U.current.delete(K),xe(jt=>{const he=new Set(jt);return he.delete(K),he}),pe.current===K&&(pe.current=null)},1e4);U.current.set(K,Ge)}function Re(K){const ge=L.current;if(!ge)return;const De=ge.getMap(xa),tt=De.get(K);if(!tt||tt.status==="pending")return;const re=Tu(tt);if(re.status==="accepted"&&re.suggestedText!==void 0&&G.current)try{const nt=re.suggestedText,Ge=re.textSnapshot;if(typeof nt=="string"&&typeof Ge=="string"){const jt=$p(re,G.current.state.doc,ge);if(!jt){console.warn(`[undo] Cannot resolve range for annotation ${K}, skipping`);return}if(G.current.state.doc.textBetween(jt.from,jt.to)!==nt){console.warn(`[undo] Text changed since accept for annotation ${K}, skipping`);return}G.current.chain().focus().deleteRange({from:jt.from,to:jt.to}).insertContentAt(jt.from,Ge).run()}}catch(nt){console.warn(`[undo] Failed to revert text for annotation ${K}:`,nt);return}De.set(K,{...re,status:"pending"});const Le=U.current.get(K);Le&&(clearTimeout(Le),U.current.delete(K)),xe(nt=>{const Ge=new Set(nt);return Ge.delete(K),Ge}),pe.current===K&&(pe.current=null)}function Be(K){le(K,"accepted")}function Ie(K){le(K,"dismissed")}function Xe(K){Re(K)}function Me(K,ge){const De=L.current;if(!De)return;const tt=De.getMap(xa),re=tt.get(K);if(!re)return;const Le=Tu(re);if(Le.suggestedText!==void 0){try{const nt=JSON.parse(ge);tt.set(K,{...Le,suggestedText:nt.suggestedText,content:nt.content,editedAt:Date.now()})}catch{console.warn(`[SidePanel] Failed to parse edit payload for annotation ${K}`)}return}tt.set(K,{...Le,content:ge,editedAt:Date.now()})}async function Ye(K,ge){try{const De=await fetch(`http://localhost:${Ga}/api/annotation-reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({annotationId:K,text:ge,documentId:c})});if(!De.ok){const tt=await De.json().catch(()=>({}));return console.warn(`[SidePanel] Reply failed (${De.status}): ${tt.message??"unknown error"}`),!1}return!0}catch(De){return console.error("[SidePanel] Reply request failed:",De),!1}}function At(){for(const K of D)le(K.id,"accepted");Y(null)}function Mt(){for(const K of D)le(K.id,"dismissed");Y(null)}const Jt=O.useCallback(K=>{const ge=G.current;if(!ge)return;const De=$p(K,ge.state.doc,L.current);if(!De)return;ge.chain().focus().setTextSelection({from:De.from,to:De.to}).run();const tt=ge.view.domAtPos(De.from),re=tt.node instanceof HTMLElement?tt.node:tt.node.parentElement;re==null||re.scrollIntoView({behavior:v,block:"center"})},[v]),Vn=O.useCallback(K=>{const ge=ue.current;if(ge.length===0)return;let De=N.current;De=K==="next"?(De+1)%ge.length:(De-1+ge.length)%ge.length,N.current=De,_(De),Jt(ge[De])},[Jt]),dr=O.useCallback(()=>{const K=ue.current;if(K.length===0)return;const ge=K[N.current];ge&&le(ge.id,"accepted")},[]),Pn=O.useCallback(()=>{const K=ue.current;if(K.length===0)return;const ge=K[N.current];ge&&le(ge.id,"dismissed")},[]),Ft=O.useRef(!1);O.useEffect(()=>{d&&!Ft.current&&F.length>0&&(N.current=0,_(0),Jt(F[0])),Ft.current=d},[d,F,Jt]),O.useEffect(()=>{var K;d&&F.length>0?g(((K=F[V])==null?void 0:K.id)??null):g(null)},[d,V,F,g]);const fr=O.useCallback(()=>{const ge=ue.current[N.current];ge&&Jt(ge),p()},[Jt,p]),Qr=O.useCallback(()=>{const K=pe.current;K&&Re(K)},[]),ji=O.useCallback(()=>{ce.current?Y(null):p()},[p]),Ar=O.useMemo(()=>({onToggleReviewMode:f,onExitReviewMode:p,navigateReview:Vn,acceptCurrent:dr,dismissCurrent:Pn,scrollToCurrentAndExit:fr,cancelBulkOrExit:ji,undoLast:Qr}),[f,p,Vn,dr,Pn,fr,ji,Qr]);pK(d,Ar),O.useEffect(()=>{var K;Z&&((K=ie.current)==null||K.focus())},[Z]),O.useEffect(()=>{Y(null)},[w,E,j]);const qt=O.useRef(null),Ii=O.useRef(!1),J=O.useRef(m);J.current=m,O.useEffect(()=>{var ge;if(!Ii.current){Ii.current=!0;return}const K=J.current;if(K){const De=document.querySelector(`[data-testid="annotation-card-${K}"]`);if(De){De.scrollIntoView({block:"center"});return}console.warn(`[tandem] SidePanel: active annotation ${K} not found on filter change; scrolling to top`)}(ge=qt.current)==null||ge.scrollTo({top:0})},[w,E,j]),O.useEffect(()=>{if(d&&N.current>=F.length){const K=Math.max(0,F.length-1);N.current=K,_(K)}},[d,F.length]),O.useEffect(()=>{d&&F.length===0&&p()},[d,F.length,p]),O.useEffect(()=>{if(!m)return;const K=setTimeout(()=>{const ge=document.querySelector(`[data-testid="annotation-card-${m}"]`);if(ge){ge.scrollIntoView({behavior:v,block:"nearest"}),ge.classList.add("tandem-annotation-flash");const De=()=>ge.classList.remove("tandem-annotation-flash");ge.addEventListener("animationend",De,{once:!0})}else console.warn(`[tandem] SidePanel: active annotation ${m} not found after 50ms delay; scroll-to-card skipped`)},50);return()=>clearTimeout(K)},[m,v]);const de=w!=="all"||E!=="all"||j!=="all",Ee=d&&F.length>0?F[V]:null;return k.jsxs("div",{ref:qt,"data-testid":"annotation-list-scroll-container",style:{width:"100%",background:"var(--tandem-surface-muted)",display:"flex",flexDirection:"column",overflowY:"auto"},children:[r>0&&k.jsxs("div",{style:{padding:"6px 16px",background:eb.background,borderBottom:`1px solid ${eb.border}`,fontSize:"12px",color:eb.color,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsxs("span",{"data-testid":"held-banner",children:[r," annotation",r!==1?"s":""," held"]}),k.jsx("button",{onClick:()=>s==null?void 0:s("tandem"),style:{fontSize:"11px",padding:"1px 8px",border:"1px solid var(--tandem-warning-border)",borderRadius:"4px",background:"var(--tandem-surface)",color:"var(--tandem-warning-fg-strong)",cursor:"pointer",fontWeight:500},children:"Show all"})]}),k.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--tandem-border)"},children:k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[k.jsxs("h3",{style:{fontSize:"14px",fontWeight:600,margin:0},children:["Annotations",T.length>0&&k.jsx("span",{style:{marginLeft:"8px",padding:"1px 6px",fontSize:"11px",background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",borderRadius:"10px"},children:T.length})]}),k.jsxs("span",{"aria-live":"polite",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)"},children:[T.length," pending annotation",T.length!==1?"s":""]}),T.length>0&&k.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end"},children:[k.jsx("button",{"data-testid":"review-mode-btn",onClick:f,title:"Keyboard review mode (Ctrl+Shift+R)","aria-pressed":d,style:{padding:"2px 8px",fontSize:"11px",border:`1px solid ${d?"var(--tandem-accent)":"var(--tandem-border-strong)"}`,borderRadius:"3px",background:d?"var(--tandem-accent-bg)":"var(--tandem-surface)",color:d?"var(--tandem-accent)":"var(--tandem-fg-muted)",cursor:"pointer",fontWeight:d?600:400},children:d?"Exit Review":"Review"}),k.jsx("div",{"data-testid":"review-shortcut-hints",style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"2px"},children:"Y / N / ↑↓ / Z"})]})]})}),d&&F.length>0&&k.jsxs("div",{style:{padding:"8px 16px",background:"var(--tandem-accent-bg)",borderBottom:"1px solid var(--tandem-border)",fontSize:"12px",color:"var(--tandem-accent-fg-strong)"},children:[k.jsxs("div",{"aria-live":"polite",style:{fontWeight:600,marginBottom:"2px"},children:["Reviewing ",V+1," / ",F.length]}),k.jsx("div",{style:{color:"var(--tandem-accent)"},children:"Tab: next · Shift+Tab: prev · Y: accept · N: dismiss · Z: undo · E: examine · Esc: exit"})]}),k.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid var(--tandem-border)",display:"flex",gap:"4px",flexWrap:"wrap",alignItems:"center"},children:[k.jsx(tb,{testId:"filter-type",value:w,onChange:K=>C(K),options:[{value:"all",label:"All types"},{value:"highlight",label:"Highlights"},{value:"comment",label:"Comments"},{value:"with-replacement",label:"With replacement"},{value:"for-claude",label:"For Claude"},{value:"flag",label:"Flags"}]}),k.jsx(tb,{testId:"filter-author",value:E,onChange:K=>I(K),options:[{value:"all",label:"Anyone"},{value:"claude",label:"Claude"},{value:"user",label:"You"},{value:"import",label:"Imported"}]}),k.jsx(tb,{testId:"filter-status",value:j,onChange:K=>Q(K),options:[{value:"all",label:"Any status"},{value:"pending",label:"Pending"},{value:"accepted",label:"Accepted"},{value:"dismissed",label:"Dismissed"}]}),de&&k.jsx("button",{"data-testid":"clear-filters-btn",onClick:()=>{C("all"),I("all"),Q("all")},style:{background:"none",border:"none",color:"var(--tandem-accent)",fontSize:"11px",cursor:"pointer",padding:"2px 4px"},children:"Clear"})]}),k.jsx("div",{style:{padding:"4px 16px 0"},children:k.jsx(hK,{annotations:t,activeDocFormat:l,documentId:c})}),D.length>1&&k.jsx("div",{style:{padding:"6px 16px",borderBottom:"1px solid var(--tandem-border)",display:"flex",gap:"6px",alignItems:"center"},children:Z?(()=>{const K=Z==="accept";return k.jsxs(k.Fragment,{children:[k.jsxs("span",{style:{fontSize:"11px",color:"var(--tandem-fg)"},children:[K?"Accept":"Reject"," ",D.length===T.length?`${D.length} annotations?`:`${D.length} of ${T.length} pending?`]}),k.jsx("button",{ref:ie,"data-testid":"bulk-confirm-btn",onClick:K?At:Mt,style:{...hh,background:K?"var(--tandem-success-bg)":"var(--tandem-error-bg)",color:K?"var(--tandem-success-fg-strong)":"var(--tandem-error-fg-strong)",fontWeight:600},children:"Confirm"}),k.jsx("button",{"data-testid":"bulk-cancel-btn",onClick:()=>Y(null),style:{...hh,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)"},children:"Cancel"})]})})():k.jsxs(k.Fragment,{children:[k.jsxs("button",{"data-testid":"bulk-accept-btn",onClick:()=>Y("accept"),style:{...hh,background:"var(--tandem-success-bg)",color:"var(--tandem-success-fg-strong)"},children:["Accept All (",D.length,")"]}),k.jsx("button",{"data-testid":"bulk-dismiss-btn",onClick:()=>Y("dismiss"),style:{...hh,background:"var(--tandem-error-bg)",color:"var(--tandem-error-fg-strong)"},children:"Reject All"})]})}),k.jsx("div",{style:{padding:"8px 16px",flex:1},role:"list","aria-label":"Annotations",children:M.length===0?k.jsx("p",{role:"status",style:{fontSize:"13px",color:"var(--tandem-fg-subtle)",marginTop:"8px"},children:de?"No annotations match filters.":"No annotations yet. Open a document to get started."}):k.jsxs(k.Fragment,{children:[D.map(K=>{const ge=(Ee==null?void 0:Ee.id)===K.id;return k.jsx(rM,{annotation:K,replies:me.get(K.id)??[],isReviewTarget:ge,onAccept:Be,onDismiss:Ie,onEdit:Me,onReply:Ye,onClick:()=>Jt(K)},K.id)}),H.length>0&&k.jsxs("details",{style:{marginTop:"12px"},children:[k.jsxs("summary",{style:{fontSize:"12px",color:"var(--tandem-fg-subtle)",cursor:"pointer"},children:[H.length," resolved"]}),k.jsx("div",{role:"list","aria-label":"Resolved annotations",children:H.map(K=>k.jsx(rM,{annotation:K,replies:me.get(K.id)??[],onUndo:Xe,undoable:se.has(K.id),onClick:()=>Jt(K)},K.id))})]})]})}),k.jsx("style",{children:`
|
|
326
|
+
@keyframes tandem-annotation-flash {
|
|
327
|
+
0% { background-color: var(--tandem-accent-bg); }
|
|
328
|
+
100% { background-color: transparent; }
|
|
329
|
+
}
|
|
330
|
+
.tandem-annotation-flash {
|
|
331
|
+
animation: tandem-annotation-flash 0.8s ease-out;
|
|
332
|
+
}
|
|
333
|
+
@media (prefers-reduced-motion: reduce) {
|
|
334
|
+
.tandem-annotation-flash { animation: none; }
|
|
335
|
+
}
|
|
336
|
+
body.tandem-reduce-motion .tandem-annotation-flash { animation: none; }
|
|
337
|
+
`})]})}const xK=2e3;function vK({connected:t,connectionStatus:e,reconnectAttempts:n,disconnectedSince:r,claudeStatus:i,claudeActive:s,readOnly:l,documentCount:c=0,saving:d=!1}){const{userName:f,setUserName:p}=xM(),[m,g]=O.useState(f),b=O.useRef(null),v=()=>{p(m)};O.useEffect(()=>{m!==f&&document.activeElement!==b.current&&g(f)},[f,m]);const[w,C]=O.useState(!1),[E,I]=O.useState(0),j=O.useRef(t);O.useEffect(()=>{const N=j.current;if(j.current=t,t&&!N){C(!0);const Z=setTimeout(()=>C(!1),xK);return()=>clearTimeout(Z)}},[t]),O.useEffect(()=>{if(r==null){I(0);return}I(Math.floor((Date.now()-r)/1e3));const N=setInterval(()=>{I(Math.floor((Date.now()-r)/1e3))},1e3);return()=>clearInterval(N)},[r]);const Q=e==="connecting",V=t?"var(--tandem-success)":Q?"var(--tandem-warning)":"var(--tandem-error)";let _;if(w)_="Reconnected";else if(e==="connected")_="Connected";else if(e==="connecting"){const N=["Reconnecting…"];if(n>0||E>0){const Z=[];n>0&&Z.push(`attempt ${n}`),E>0&&Z.push(`${E}s`),N.push(`(${Z.join(", ")})`)}_=N.join(" ")}else _="Disconnected — check that the server is running";return k.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 16px",height:"28px",borderTop:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",fontSize:"12px",color:"var(--tandem-fg-muted)",userSelect:"none"},children:[k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[k.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:V,display:"inline-block",animation:Q?"tandem-reconnect-pulse 1.2s ease-in-out infinite":"none"}}),k.jsx("span",{children:_}),c>0&&k.jsxs("span",{style:{color:"var(--tandem-fg-subtle)"},children:[c," doc",c!==1?"s":""," open"]}),d&&k.jsx("span",{"data-testid":"save-indicator",style:{color:"var(--tandem-accent)",fontStyle:"italic"},children:"Saving..."})]}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"11px",color:"var(--tandem-fg-subtle)"},children:[k.jsx("span",{children:"You:"}),k.jsx("input",{ref:b,"data-testid":"user-name-input",type:"text",value:m,onChange:N=>g(N.target.value),onBlur:v,onKeyDown:N=>{N.key==="Enter"&&N.currentTarget.blur(),N.key==="Escape"&&(g(f),N.currentTarget.blur())},"aria-label":"Display name",title:"Your display name",maxLength:fM,style:{background:"transparent",border:"none",borderBottom:"1px solid var(--tandem-border)",color:"var(--tandem-fg-muted)",fontSize:"11px",width:"80px",outline:"none",padding:"0 2px"}})]}),l&&k.jsx("span",{style:{padding:"1px 8px",fontSize:"11px",fontWeight:600,color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",borderRadius:"9999px",border:"1px solid var(--tandem-warning-border)"},children:"Review Only"}),k.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[k.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"var(--tandem-author-claude)",opacity:s?1:.4,display:"inline-block",transition:"opacity 0.3s ease",animation:s?"tandem-status-pulse 1.5s ease-in-out infinite":"none"}}),k.jsx("span",{style:{transition:"color 0.3s ease",color:s?"var(--tandem-fg)":"var(--tandem-fg-subtle)"},children:i?`Claude -- ${i}`:"Claude -- idle"})]}),k.jsx("style",{children:`
|
|
338
|
+
@keyframes tandem-status-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
|
|
339
|
+
@keyframes tandem-reconnect-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
|
|
340
|
+
`})]})}function Q2(t,e,n=Iz){const r=t.filter(i=>i!==e);return[e,...r].slice(0,n)}function eR(){try{const t=localStorage.getItem(Ax);if(!t)return[];const e=JSON.parse(t);return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}catch(t){return console.warn("[tandem] failed to load recent files:",t),[]}}function tR(t){try{localStorage.setItem(Ax,JSON.stringify(t))}catch(e){console.warn("[tandem] failed to save recent files:",e)}}function SK(){try{localStorage.removeItem(Ax)}catch(t){console.warn("[tandem] failed to clear recent files:",t)}}function wK({onClose:t}){const[e,n]=O.useState("path"),[r,i]=O.useState(""),[s,l]=O.useState(null),[c,d]=O.useState(!1),[f,p]=O.useState(!1),m=O.useRef(null),[g,b]=O.useState(eR),v=O.useCallback(V=>{b(_=>{const N=Q2(_,V);return tR(N),N})},[]),w=O.useCallback(()=>{SK(),b([])},[]),C=O.useCallback(async V=>{if(!c){l(null),d(!0);try{const _=await fetch(`${Bu}/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:V})}),N=await _.json();if(!_.ok){l(N.message??"Failed to open file");return}v(V),t()}catch(_){console.error("FileOpenDialog: path open failed",_),_ instanceof SyntaxError?l("Server returned an unexpected response"):_ instanceof TypeError?l("Unexpected response format"):l("Cannot reach server. Is it running?")}finally{d(!1)}}},[c,t,v]),E=O.useCallback(()=>{r.trim()&&C(r.trim())},[r,C]),I=O.useCallback(async V=>{if(!c){l(null),d(!0);try{const _=await yM(V),N=await fetch(`${Bu}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:V.name,content:_})}),Z=await N.json();if(!N.ok){l(Z.message??"Failed to upload file");return}t()}catch(_){console.error("FileOpenDialog: upload failed",_),_ instanceof SyntaxError?l("Server returned an unexpected response"):_ instanceof TypeError?l("Unexpected response format"):l("Cannot reach server. Is it running?")}finally{d(!1)}}},[c,t]),j=O.useCallback(V=>{V.preventDefault(),p(!1);const _=V.dataTransfer.files[0];_&&I(_)},[I]),Q=O.useCallback(V=>{var N;const _=(N=V.target.files)==null?void 0:N[0];_&&I(_)},[I]);return k.jsx("div",{style:{position:"fixed",inset:0,zIndex:1e3,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"80px",background:"rgba(0,0,0,0.3)"},onClick:V=>{V.target===V.currentTarget&&t()},onKeyDown:V=>{V.key==="Escape"&&t()},children:k.jsxs("div",{style:{background:"var(--tandem-surface)",borderRadius:"8px",boxShadow:"0 8px 30px rgba(0,0,0,0.15)",width:"440px",padding:"20px"},"data-testid":"file-open-dialog",children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"16px"},children:[k.jsx("h3",{style:{margin:0,fontSize:"15px",fontWeight:600,color:"var(--tandem-fg)"},children:"Open File"}),k.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",fontSize:"16px",color:"var(--tandem-fg-subtle)"},children:"×"})]}),k.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"16px"},children:[k.jsx("button",{onClick:()=>n("path"),style:{flex:1,padding:"6px",fontSize:"13px",border:"1px solid var(--tandem-border)",borderRadius:"4px",cursor:"pointer",background:e==="path"?"var(--tandem-accent)":"var(--tandem-surface)",color:e==="path"?"var(--tandem-accent-fg)":"var(--tandem-fg)"},children:"File Path"}),k.jsx("button",{onClick:()=>n("upload"),style:{flex:1,padding:"6px",fontSize:"13px",border:"1px solid var(--tandem-border)",borderRadius:"4px",cursor:"pointer",background:e==="upload"?"var(--tandem-accent)":"var(--tandem-surface)",color:e==="upload"?"var(--tandem-accent-fg)":"var(--tandem-fg)"},children:"Upload"})]}),e==="path"?k.jsxs("div",{children:[k.jsx("input",{autoFocus:!0,type:"text",placeholder:"Paste absolute file path...",value:r,onChange:V=>i(V.target.value),onKeyDown:V=>{V.key==="Enter"&&E()},style:{width:"100%",padding:"8px 10px",fontSize:"13px",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",boxSizing:"border-box",background:"var(--tandem-surface)",color:"var(--tandem-fg)"},"data-testid":"file-path-input"}),k.jsx("button",{onClick:E,disabled:c||!r.trim(),style:{marginTop:"10px",width:"100%",padding:"8px",fontSize:"13px",fontWeight:500,border:"none",borderRadius:"4px",cursor:c?"wait":"pointer",background:c?"var(--tandem-fg-subtle)":"var(--tandem-accent)",color:"var(--tandem-accent-fg)",opacity:r.trim()?1:.5},"data-testid":"file-open-submit",children:c?"Opening...":"Open"}),g.length>0&&k.jsxs("div",{"data-testid":"recent-files-list",style:{marginTop:"14px"},children:[k.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[k.jsx("span",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Recent"}),k.jsx("button",{"data-testid":"clear-recent-files",onClick:w,type:"button",style:{background:"none",border:"none",color:"var(--tandem-fg-subtle)",fontSize:"11px",cursor:"pointer",padding:0,textDecoration:"underline"},children:"Clear all"})]}),k.jsx("div",{style:{maxHeight:"150px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"2px"},children:g.map((V,_)=>{const N=V.split(/[/\\]/),Z=N.pop()??V,Y=N.join("/")||"/";return k.jsxs("button",{type:"button","data-testid":`recent-file-${_}`,onClick:()=>{i(V),C(V)},style:{background:"none",border:"none",padding:"6px 8px",borderRadius:"4px",cursor:"pointer",textAlign:"left",display:"flex",flexDirection:"column",gap:"1px"},onMouseEnter:ce=>{ce.currentTarget.style.background="var(--tandem-surface-muted)"},onMouseLeave:ce=>{ce.currentTarget.style.background="transparent"},children:[k.jsx("span",{style:{fontSize:"13px",color:"var(--tandem-fg)"},children:Z}),k.jsx("span",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"380px"},children:Y})]},V)})})]})]}):k.jsxs("div",{onDragOver:V=>{V.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:j,onClick:()=>{var V;return(V=m.current)==null?void 0:V.click()},style:{border:`2px dashed ${f?"var(--tandem-accent)":"var(--tandem-border-strong)"}`,borderRadius:"6px",padding:"32px 16px",textAlign:"center",cursor:c?"wait":"pointer",background:f?"var(--tandem-accent-bg)":"var(--tandem-surface-muted)",transition:"border-color 0.15s, background 0.15s"},"data-testid":"file-upload-zone",children:[k.jsx("input",{ref:m,type:"file",accept:".md,.txt,.html,.htm,.docx",onChange:Q,style:{display:"none"}}),k.jsx("div",{style:{fontSize:"13px",color:"var(--tandem-fg-muted)"},children:c?"Uploading...":"Drop a file here or click to browse"}),k.jsx("div",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",marginTop:"6px"},children:".md, .txt, .html, .docx"})]}),s&&k.jsx("div",{style:{marginTop:"10px",padding:"8px 10px",fontSize:"12px",color:"var(--tandem-error-fg-strong)",background:"var(--tandem-error-bg)",borderRadius:"4px",border:"1px solid var(--tandem-error-border)"},"data-testid":"file-open-error",children:s})]})})}function kK(t){const[e,n]=O.useState(!1),r=O.useRef(0),i=O.useRef(null);return O.useEffect(()=>{if(t.readOnly){n(!1);return}const{ydoc:s}=t,l=s.getXmlFragment("default"),c=s.getMap(mh);let d=!1;const f=setTimeout(()=>{d=!0,i.current=c.get(yC)??0,r.current=0,n(!1)},500),p=()=>{d&&(r.current++,n(!0))};l.observeDeep(p);const m=()=>{if(!d)return;const g=c.get(yC);g!==void 0&&g!==i.current&&(i.current=g,r.current=0,n(!1))};return c.observe(m),()=>{clearTimeout(f),l.unobserveDeep(p),c.unobserve(m)}},[t.ydoc,t.readOnly]),e}const CK={md:"M",txt:"T",html:"H",docx:"W"};function EK({tab:t,isActive:e,onSwitch:n,onClose:r,draggable:i,onDragStart:s,onDragOver:l,onDrop:c,onDragEnd:d,onDragLeave:f,dropIndicator:p,onKeyDown:m}){const g=kK(t);return k.jsxs("div",{"data-testid":`tab-${t.id}`,"data-active":e,onClick:()=>n(t.id),draggable:i,tabIndex:0,onDragStart:b=>s(b,t.id),onDragOver:b=>l(b,t.id),onDrop:b=>c(b,t.id),onDragEnd:d,onDragLeave:f,onKeyDown:b=>m(b,t.id),style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 12px",fontSize:"13px",cursor:"pointer",background:e?"var(--tandem-surface)":"transparent",color:e?"var(--tandem-fg)":"var(--tandem-fg-muted)",borderTop:e?"2px solid var(--tandem-accent)":"2px solid transparent",borderBottom:e?"1px solid var(--tandem-surface)":"1px solid transparent",borderLeft:p==="left"?"2px solid var(--tandem-accent)":"2px solid transparent",borderRight:p==="right"?"2px solid var(--tandem-accent)":"2px solid transparent",marginBottom:"-1px",userSelect:"none",whiteSpace:"nowrap",transition:"background 0.15s, color 0.15s",flexShrink:0},children:[g&&k.jsx("span",{"data-testid":`unsaved-indicator-${t.id}`,style:{color:"var(--tandem-warning)",fontSize:"10px"},children:"●"}),k.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:e?"var(--tandem-accent)":"var(--tandem-fg-subtle)",width:"14px",textAlign:"center"},children:CK[t.format]||"?"}),k.jsx("span",{"data-testid":`tab-name-${t.id}`,title:t.filePath,style:{fontWeight:e?500:400,maxWidth:"160px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.fileName}),t.readOnly&&k.jsx("span",{style:{fontSize:"9px",color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",padding:"0 3px",borderRadius:"2px"},children:"RO"}),k.jsx("button",{onClick:b=>{b.stopPropagation(),r(t.id)},onDragOver:b=>{b.stopPropagation(),b.preventDefault()},onDrop:b=>{b.stopPropagation(),b.preventDefault()},style:{background:"none",border:"none",cursor:"pointer",fontSize:"14px",lineHeight:1,color:"var(--tandem-fg-subtle)",padding:"0 2px",borderRadius:"2px"},onMouseEnter:b=>b.currentTarget.style.color="var(--tandem-error)",onMouseLeave:b=>b.currentTarget.style.color="var(--tandem-fg-subtle)",title:"Close document",children:"×"})]})}const Ex="tandem-tab-scroll-hide";function TK(){return k.jsx("style",{children:`
|
|
341
|
+
.${Ex} {
|
|
342
|
+
scrollbar-width: none;
|
|
343
|
+
-ms-overflow-style: none;
|
|
344
|
+
}
|
|
345
|
+
.${Ex}::-webkit-scrollbar {
|
|
346
|
+
display: none;
|
|
347
|
+
}
|
|
348
|
+
`})}const nR={display:"flex",alignItems:"center",justifyContent:"center",width:"28px",minWidth:"28px",background:"linear-gradient(to right, var(--tandem-surface-muted) 70%, transparent)",border:"none",cursor:"pointer",fontSize:"12px",color:"var(--tandem-fg-muted)",padding:0,zIndex:1},AK={...nR,background:"linear-gradient(to left, var(--tandem-surface-muted) 70%, transparent)"};function MK({tabs:t,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:i,reduceMotion:s}){const l=s?"auto":"smooth",[c,d]=O.useState(!1),f=O.useRef(new Set);O.useEffect(()=>{const U=new Set(t.map(L=>L.id));for(const L of f.current)U.has(L)||f.current.delete(L)},[t]);const p=O.useCallback(U=>{f.current.has(U)||(f.current.add(U),r(U))},[r]),m=O.useRef(null),[g,b]=O.useState(!1),[v,w]=O.useState(!1),[C,E]=O.useState(null),[I,j]=O.useState(null);function Q(){E(null),j(null)}const V=O.useCallback(()=>{const U=m.current;U&&(b(U.scrollLeft>0),w(U.scrollLeft+U.clientWidth<U.scrollWidth-1))},[]);O.useEffect(()=>{const U=m.current;if(!U)return;V(),U.addEventListener("scroll",V,{passive:!0});const L=new ResizeObserver(V);return L.observe(U),()=>{U.removeEventListener("scroll",V),L.disconnect()}},[V]),O.useEffect(()=>{V()},[t.length,V]),O.useEffect(()=>{if(!e||!m.current)return;const U=m.current.querySelector(`[data-testid="tab-${e}"]`);U&&U.scrollIntoView({inline:"nearest",block:"nearest",behavior:l})},[e,l]),O.useEffect(()=>{Q()},[t.length]);const _=O.useCallback((U,L)=>{E(L),U.dataTransfer.setData("text/plain",L),U.dataTransfer.effectAllowed="move"},[]),N=O.useCallback((U,L)=>{if(U.preventDefault(),!C||C===L){j(null);return}const G=U.currentTarget.getBoundingClientRect(),me=G.left+G.width/2,Ae=U.clientX<me?"left":"right";j({id:L,side:Ae})},[C]),Z=O.useCallback((U,L)=>{U.preventDefault();const G=U.dataTransfer.getData("text/plain");if(G&&G!==L&&i){const me=U.currentTarget.getBoundingClientRect(),Ae=me.left+me.width/2,M=U.clientX<Ae?"left":"right";i(G,L,M)}Q()},[i]),Y=O.useCallback(()=>{Q()},[]),ce=O.useCallback(()=>{j(null)},[]),ie=O.useCallback((U,L)=>{if(!U.altKey||!i||U.key!=="ArrowLeft"&&U.key!=="ArrowRight")return;U.preventDefault();const G=t.findIndex(me=>me.id===L);G!==-1&&(U.key==="ArrowLeft"&&G>0?i(L,t[G-1].id):U.key==="ArrowRight"&&G<t.length-1&&i(t[G+1].id,L))},[t,i]),se=O.useCallback(()=>{var U;(U=m.current)==null||U.scrollBy({left:-150,behavior:l})},[l]),xe=O.useCallback(()=>{var U;(U=m.current)==null||U.scrollBy({left:150,behavior:l})},[l]),pe=t.length<=1;return k.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",background:"var(--tandem-surface-muted)",borderBottom:"1px solid var(--tandem-border)",minHeight:"32px"},children:[k.jsx(TK,{}),g&&k.jsx("button",{"data-testid":"tab-scroll-left",onClick:se,style:{...nR,background:"linear-gradient(to right, var(--tandem-surface-muted) 70%, transparent)",color:"var(--tandem-fg-muted)"},title:"Scroll tabs left",children:"◀"}),k.jsx("div",{ref:m,"data-testid":"tab-scroll-container",className:Ex,style:{display:"flex",alignItems:"center",gap:"1px",flex:1,overflowX:"auto",overflowY:"hidden",padding:"0 4px"},children:t.map(U=>k.jsx(EK,{tab:U,isActive:U.id===e,onSwitch:n,onClose:p,draggable:!pe,onDragStart:_,onDragOver:N,onDrop:Z,onDragEnd:Y,onDragLeave:ce,dropIndicator:(I==null?void 0:I.id)===U.id?I.side:null,onKeyDown:ie},U.id))}),v&&k.jsx("button",{"data-testid":"tab-scroll-right",onClick:xe,style:{...AK,background:"linear-gradient(to left, var(--tandem-surface-muted) 70%, transparent)",color:"var(--tandem-fg-muted)"},title:"Scroll tabs right",children:"▶"}),k.jsx("button",{onClick:()=>d(!0),"data-testid":"open-file-btn",title:"Open file",style:{background:"none",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",cursor:"pointer",fontSize:"16px",lineHeight:1,color:"var(--tandem-fg-muted)",padding:"2px 8px",marginLeft:"4px",marginRight:"8px",flexShrink:0},onMouseEnter:U=>{U.currentTarget.style.color="var(--tandem-accent)",U.currentTarget.style.borderColor="var(--tandem-accent)"},onMouseLeave:U=>{U.currentTarget.style.color="var(--tandem-fg-muted)",U.currentTarget.style.borderColor="var(--tandem-border-strong)"},children:"+"}),c&&k.jsx(wK,{onClose:()=>d(!1)})]})}function iM({connected:t,claudeActive:e}){const[n,r]=O.useState(!1);return O.useEffect(()=>{if(t){r(!1);return}const i=setTimeout(()=>r(!0),Oz);return()=>clearTimeout(i)},[t]),k.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--tandem-fg-subtle)",gap:"8px"},children:n?k.jsx("span",{children:"Cannot reach the Tandem server. Is it running?"}):k.jsxs(k.Fragment,{children:[k.jsx("span",{children:"No document open. Click + in the tab bar or drop a file here."}),t&&!e&&k.jsx("span",{style:{fontSize:"0.85em",color:"var(--tandem-fg-subtle)"},children:"Tip: open Claude Code in this directory to start collaborating"})]})})}function OK({onDismiss:t}){return k.jsxs("div",{style:{padding:"8px 16px",background:"var(--tandem-error-bg)",borderBottom:"1px solid var(--tandem-error-border)",fontSize:"13px",color:"var(--tandem-error-fg-strong)",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",gap:"12px"},children:[k.jsx("span",{children:"Connection to the Tandem server has been lost. Ensure the server is running."}),k.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-error-fg-strong)",fontSize:"16px",lineHeight:1,padding:"0 4px"},"aria-label":"Dismiss connection banner",children:"\\u00d7"})]})}const rR=200,iR=600,sR=300;function ph(t){const e=lM[t];try{const n=localStorage.getItem(e);if(n){const r=parseInt(n,10);if(Number.isFinite(r))return Math.max(rR,Math.min(iR,r));console.warn(`[tandem] ignoring non-numeric panel width for ${e}: ${n}`)}}catch(n){console.warn(`[tandem] localStorage unavailable reading ${e}:`,n)}return sR}function _K(){DP();const{tabs:t,activeTabId:e,setActiveTabId:n,handleTabClose:r,connected:i,connectionStatus:s,reconnectAttempts:l,disconnectedSince:c,annotations:d,claudeStatus:f,claudeActive:p,readOnly:m,bootstrapYdoc:g,ready:b,serverRestarted:v}=F$(),{orderedTabs:w,reorder:C}=bP(t);gP(w,e,n),O.useEffect(()=>{if(t.length!==0)try{const he=eR();let Nt=he;for(const Yt of t)Vz(Yt.filePath)||(Nt=Q2(Nt,Yt.filePath));(Nt.length!==he.length||Nt.some((Yt,Zn)=>Yt!==he[Zn]))&&tR(Nt)}catch(he){console.warn("[tandem] failed to sync recent files:",he)}},[t.length]);const[E,I]=O.useState(()=>{try{const he=localStorage.getItem(Vf);return pL.safeParse(he).success?he:mC}catch(he){return console.warn(`[tandem] localStorage unavailable reading ${Vf}:`,he),mC}});O.useEffect(()=>{try{localStorage.setItem(Vf,E)}catch(he){console.warn(`[tandem] failed to persist ${Vf}:`,he)}},[E]),O.useEffect(()=>{if(!g)return;g.getMap(ib).set(zz,E)},[E,g]);const[j,Q]=O.useState(!1),[V,_]=O.useState(!1);O.useEffect(()=>{if(c==null){Q(!1),_(!1);return}const he=Date.now()-c,Nt=_z-he;if(Nt<=0){Q(!0);return}const Yt=setTimeout(()=>Q(!0),Nt);return()=>clearTimeout(Yt)},[c]);const{visibleAnnotations:N,heldCount:Z}=cP(d,E),Y=O.useMemo(()=>t.map(he=>({id:he.id,fileName:he.fileName})),[t]),{saving:ce}=fP(e),{toasts:ie,dismiss:se}=uP(),{fileDragOver:xe,handleEditorDragOver:pe,handleEditorDragLeave:U,handleEditorDrop:L}=lP(),{showReviewSummary:G,reviewSummaryData:me,dismissReviewSummary:Ae}=dP(d),{settings:M,updateSettings:D}=wP(),[H,T]=O.useState(!1),F=O.useRef(null),ue=O.useCallback(()=>{T(!0)},[]),le=O.useRef(H);le.current=H;const Re=O.useCallback(()=>{if(le.current){T(!1);return}ue()},[ue]);pP(Re),O.useEffect(()=>{if(!g)return;g.getMap(ib).set(Lz,M.selectionDwellMs)},[M.selectionDwellMs,g]),O.useEffect(()=>{const he=Ft.current;if(!he)return;const Nt=he.state.tr.setMeta(ma,{type:"toggle",visible:M.showAuthorship});he.view.dispatch(Nt)},[M.showAuthorship]),O.useEffect(()=>(document.body.classList.toggle("tandem-reduce-motion",M.reduceMotion),()=>document.body.classList.remove("tandem-reduce-motion")),[M.reduceMotion]),EP(M.theme),O.useEffect(()=>{const he=xP[M.textSize];return document.documentElement.style.setProperty("--tandem-editor-font-size",`${he}px`),()=>{document.documentElement.style.removeProperty("--tandem-editor-font-size")}},[M.textSize]);const[Be,Ie]=O.useState(!1),[Xe,Me]=O.useState(()=>M.primaryTab==="chat"),Ye=O.useMemo(()=>Xe?N.filter(he=>he.status==="pending").length:0,[N,Xe]),[At,Mt]=O.useState(null),[Jt,Vn]=O.useState(!1),[dr,Pn]=O.useState(null),Ft=O.useRef(null),fr=O.useRef(null),Qr=O.useCallback(he=>{Ft.current=he},[]),ji=O.useCallback(he=>{Me(!1),Mt(he)},[]),[Ar,qt]=O.useState(()=>M.layout==="three-panel"?{kind:"three-panel",left:ph("left"),right:ph("right")}:{kind:"tabbed",right:ph("right")});O.useEffect(()=>{qt(he=>M.layout==="three-panel"?he.kind==="three-panel"?he:{kind:"three-panel",left:ph("left"),right:he.right}:he.kind==="tabbed"?he:{kind:"tabbed",right:he.right})},[M.layout]);const Ii=M.editorWidthPercent<100?`${M.editorWidthPercent}%`:void 0,J=M.editorWidthPercent<100?"0 auto":void 0,de=O.useRef(Ar);de.current=Ar;const Ee=O.useRef(null);O.useEffect(()=>()=>{Ee.current&&(document.removeEventListener("mousemove",Ee.current.move),document.removeEventListener("mouseup",Ee.current.up),document.body.style.userSelect="",document.body.style.cursor="")},[]);const K=O.useCallback((he,Nt)=>{he.preventDefault();const Yt=he.clientX,Zn=de.current,Mr=Nt==="left"?Zn.kind==="three-panel"?Zn.left:sR:Zn.right,fi=lM[Nt];let hi=Mr;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const Bi=vl=>{const Sl=vl.clientX-Yt,So=Nt==="left"?Mr+Sl:Mr-Sl;hi=Math.max(rR,Math.min(iR,So)),qt(wo=>Nt==="right"?wo.kind==="three-panel"?{...wo,right:hi}:{kind:"tabbed",right:hi}:wo.kind!=="three-panel"?wo:{...wo,left:hi})},lc=()=>{document.removeEventListener("mousemove",Bi),document.removeEventListener("mouseup",lc),Ee.current=null,document.body.style.userSelect="",document.body.style.cursor="";try{localStorage.setItem(fi,String(hi))}catch(vl){console.warn(`[tandem] failed to persist ${fi}:`,vl)}};Ee.current={move:Bi,up:lc},document.addEventListener("mousemove",Bi),document.addEventListener("mouseup",lc)},[]),ge=O.useCallback(()=>{Ie(he=>!he)},[]),De=O.useCallback(()=>{Ie(!1)},[]),tt=O.useCallback(()=>{if(Xe)return;const he=Ft.current;if(!he)return;const{from:Nt,to:Yt}=he.state.selection;if(Nt===Yt)return;const Zn=n2(he.state.doc,{from:Kr(Nt),to:Kr(Yt)}),Mr=he.state.doc.textBetween(Nt,Yt,`
|
|
349
|
+
`);Pn({...Zn,textSnapshot:Mr.length>200?Mr.slice(0,197)+"...":Mr})},[Xe]);O.useEffect(()=>{const he=Nt=>{if(Nt.key!=="?")return;const Yt=Nt.target;Yt.tagName==="INPUT"||Yt.tagName==="TEXTAREA"||Yt.isContentEditable||Vn(Zn=>!Zn)};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[]);const re=t.find(he=>he.id===e),{tutorialActive:Le,currentStep:nt,dismissTutorial:Ge,nextStep:jt}=AP(d,Ft,re==null?void 0:re.fileName);return b?k.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh"},children:[v&&k.jsx("div",{style:{padding:"8px 16px",background:"var(--tandem-warning-bg)",borderBottom:"1px solid var(--tandem-warning-border)",fontSize:"13px",color:"var(--tandem-warning-fg-strong)",textAlign:"center"},children:"Server restarted — refreshing documents"}),j&&!V&&k.jsx(OK,{onDismiss:()=>_(!0)}),k.jsx(oP,{editor:Ft.current,ydoc:(re==null?void 0:re.ydoc)??null,onSettingsOpen:Re,settingsBtnRef:F,tandemMode:E,onModeChange:I,heldCount:Z}),k.jsx(MK,{tabs:w,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:C,reduceMotion:M.reduceMotion}),Ar.kind==="three-panel"?k.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[k.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${Ar.left}px`,borderRight:"1px solid var(--tandem-border)"},children:[k.jsx("div",{style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,color:"var(--tandem-fg-muted)",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},children:M.panelOrder==="chat-editor-annotations"?"Chat":"Annotations"}),k.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:M.panelOrder==="chat-editor-annotations"?k.jsx(Q0,{ctrlYdoc:g,editor:Ft.current,activeDocId:e,openDocs:Y,claudeActive:p,claudeStatus:f,visible:!0,capturedAnchor:dr,onCapturedAnchorChange:Pn,inputRef:fr,reduceMotion:M.reduceMotion}):k.jsx(nb,{annotations:N,editor:Ft.current,ydoc:(re==null?void 0:re.ydoc)??null,heldCount:Z,tandemMode:E,onModeChange:I,activeDocFormat:re==null?void 0:re.format,documentId:re==null?void 0:re.id,reviewMode:Be,onToggleReviewMode:ge,onExitReviewMode:De,activeAnnotationId:At,onActiveAnnotationChange:Mt,reduceMotion:M.reduceMotion})})]}),k.jsx("div",{"data-testid":"left-panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize left panel",tabIndex:0,onMouseDown:he=>K(he,"left"),style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:he=>{he.currentTarget.style.background="var(--tandem-border-strong)"},onMouseLeave:he=>{he.currentTarget.style.background="transparent"}}),k.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px 48px",border:xe?"2px dashed var(--tandem-accent)":"2px solid transparent",background:xe?"var(--tandem-accent-bg)":void 0,transition:"border-color 0.15s, background 0.15s"},onDragOver:pe,onDragLeave:U,onDrop:L,children:[k.jsx(HC,{visible:(re==null?void 0:re.readOnly)===!0&&(re==null?void 0:re.format)==="docx",documentId:re==null?void 0:re.id}),k.jsx("div",{style:{maxWidth:Ii,margin:J},children:re?k.jsx(oA,{ydoc:re.ydoc,provider:re.provider,readOnly:m,reviewMode:Be,activeAnnotationId:At,onEditorReady:Qr,onAnnotationClick:ji},re.id):k.jsx(iM,{connected:i,claudeActive:p})})]}),k.jsx("div",{"data-testid":"right-panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize right panel",tabIndex:0,onMouseDown:he=>K(he,"right"),style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:he=>{he.currentTarget.style.background="var(--tandem-border-strong)"},onMouseLeave:he=>{he.currentTarget.style.background="transparent"}}),k.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${Ar.right}px`,borderLeft:"1px solid var(--tandem-border)"},children:[k.jsx("div",{style:{padding:"6px 12px",fontSize:"11px",fontWeight:600,color:"var(--tandem-fg-muted)",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)",textTransform:"uppercase",letterSpacing:"0.5px"},children:M.panelOrder==="chat-editor-annotations"?"Annotations":"Chat"}),k.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:M.panelOrder==="chat-editor-annotations"?k.jsx(nb,{annotations:N,editor:Ft.current,ydoc:(re==null?void 0:re.ydoc)??null,heldCount:Z,tandemMode:E,onModeChange:I,activeDocFormat:re==null?void 0:re.format,documentId:re==null?void 0:re.id,reviewMode:Be,onToggleReviewMode:ge,onExitReviewMode:De,activeAnnotationId:At,onActiveAnnotationChange:Mt,reduceMotion:M.reduceMotion}):k.jsx(Q0,{ctrlYdoc:g,editor:Ft.current,activeDocId:e,openDocs:Y,claudeActive:p,claudeStatus:f,visible:!0,capturedAnchor:dr,onCapturedAnchorChange:Pn,inputRef:fr,reduceMotion:M.reduceMotion})})]})]}):k.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[k.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px 48px",border:xe?"2px dashed var(--tandem-accent)":"2px solid transparent",background:xe?"var(--tandem-accent-bg)":void 0,transition:"border-color 0.15s, background 0.15s"},onDragOver:pe,onDragLeave:U,onDrop:L,children:[k.jsx(HC,{visible:(re==null?void 0:re.readOnly)===!0&&(re==null?void 0:re.format)==="docx",documentId:re==null?void 0:re.id}),k.jsx("div",{style:{maxWidth:Ii,margin:J},children:re?k.jsx(oA,{ydoc:re.ydoc,provider:re.provider,readOnly:m,reviewMode:Be,activeAnnotationId:At,onEditorReady:Qr,onAnnotationClick:ji},re.id):k.jsx(iM,{connected:i,claudeActive:p})})]}),k.jsx("div",{"data-testid":"panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",tabIndex:0,onMouseDown:he=>K(he,"right"),style:{width:"4px",cursor:"col-resize",background:"transparent",flexShrink:0,transition:"background 0.15s"},onMouseEnter:he=>{he.currentTarget.style.background="var(--tandem-border-strong)"},onMouseLeave:he=>{he.currentTarget.style.background="transparent"}}),k.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${Ar.right}px`,borderLeft:"1px solid var(--tandem-border)"},children:[k.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)"},children:[k.jsxs("button",{"data-testid":"annotations-tab",onClick:()=>Me(!1),style:{flex:1,padding:"8px",fontSize:"12px",fontWeight:Xe?400:600,border:"none",borderBottom:Xe?"none":"2px solid var(--tandem-accent)",background:"transparent",cursor:"pointer",color:Xe?"var(--tandem-fg-muted)":"var(--tandem-accent)",position:"relative"},children:["Annotations",Xe&&Ye>0&&k.jsx("span",{style:{position:"absolute",top:"2px",right:"6px",background:"var(--tandem-error)",color:"var(--tandem-error-fg)",fontSize:"9px",width:"16px",height:"16px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:700},children:Ye>9?"9+":Ye})]}),k.jsx("button",{"data-testid":"chat-tab",onMouseDown:tt,onClick:()=>Me(!0),style:{flex:1,padding:"8px",fontSize:"12px",fontWeight:Xe?600:400,border:"none",borderBottom:Xe?"2px solid var(--tandem-accent)":"none",background:"transparent",cursor:"pointer",color:Xe?"var(--tandem-accent)":"var(--tandem-fg-muted)",position:"relative"},children:"Chat"})]}),k.jsx("div",{style:{display:Xe?"flex":"none",flexDirection:"column",flex:1,minHeight:0},children:k.jsx(Q0,{ctrlYdoc:g,editor:Ft.current,activeDocId:e,openDocs:Y,claudeActive:p,claudeStatus:f,visible:Xe,capturedAnchor:dr,onCapturedAnchorChange:Pn,inputRef:fr,reduceMotion:M.reduceMotion})}),k.jsx("div",{style:{display:Xe?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:k.jsx(nb,{annotations:N,editor:Ft.current,ydoc:(re==null?void 0:re.ydoc)??null,heldCount:Z,tandemMode:E,onModeChange:I,activeDocFormat:re==null?void 0:re.format,documentId:re==null?void 0:re.id,reviewMode:Be,onToggleReviewMode:ge,onExitReviewMode:De,activeAnnotationId:At,onActiveAnnotationChange:Mt,reduceMotion:M.reduceMotion})})]})]}),k.jsx(vK,{connected:i,connectionStatus:s,reconnectAttempts:l,disconnectedSince:c,claudeStatus:f,claudeActive:p,readOnly:m,documentCount:t.length,saving:ce}),G&&me&&k.jsx(fK,{accepted:me.accepted,dismissed:me.dismissed,total:me.total,onDismiss:Ae}),k.jsx(CL,{open:H,onClose:()=>T(!1),settings:M,onUpdate:D,returnFocusRef:F,anchorRef:F}),k.jsx(gL,{open:Jt,onClose:()=>Vn(!1)}),k.jsx(ML,{toasts:ie,onDismiss:se}),Le&&k.jsx(bL,{currentStep:nt,onNext:jt,onDismiss:Ge})]}):k.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",color:"var(--tandem-fg-subtle)"},children:"Connecting..."})}class DK extends hn.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("[Tandem] React error boundary caught:",e,n.componentStack)}render(){var e;return this.state.hasError?k.jsxs("div",{style:{padding:"2rem",fontFamily:"system-ui, sans-serif",color:"var(--tandem-fg)"},children:[k.jsx("h2",{children:"Something went wrong"}),k.jsx("p",{style:{color:"var(--tandem-fg-muted)"},children:"The editor encountered an unexpected error. Reload the page to continue."}),k.jsx("pre",{style:{background:"var(--tandem-surface-muted)",padding:"1rem",borderRadius:"4px",fontSize:"12px",overflow:"auto",maxHeight:"200px",color:"var(--tandem-fg)",border:"1px solid var(--tandem-border)"},children:(e=this.state.error)==null?void 0:e.message}),k.jsx("button",{onClick:()=>window.location.reload(),style:{marginTop:"1rem",padding:"8px 16px",cursor:"pointer",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",background:"var(--tandem-surface)",color:"var(--tandem-fg)"},children:"Reload"})]}):this.props.children}}const RK=Az.createRoot(document.getElementById("root"));RK.render(k.jsx(hn.StrictMode,{children:k.jsx(DK,{children:k.jsx(_K,{})})}));
|