tandem-editor 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/channel/index.js +0 -0
- package/dist/cli/index.js +56 -12
- package/dist/cli/index.js.map +1 -1
- package/dist/client/assets/index-DLTxaDBk.js +351 -0
- package/dist/client/index.html +1 -1
- package/dist/server/index.js +52 -7
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/index-B1Cd5UGT.js +0 -349
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
var lL=Object.defineProperty;var aL=(t,e,n)=>e in t?lL(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Wf=(t,e,n)=>aL(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 um(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var n0={exports:{}},iu={};/**
|
|
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 _C;function cL(){if(_C)return iu;_C=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 iu.Fragment=e,iu.jsx=n,iu.jsxs=n,iu}var DC;function uL(){return DC||(DC=1,n0.exports=cL()),n0.exports}var C=uL(),r0={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 RC;function dL(){if(RC)return Ue;RC=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),g=Symbol.iterator;function y(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(){}},S=Object.assign,k={};function E(D,$,T){this.props=D,this.context=$,this.refs=k,this.updater=T||v}E.prototype.isReactComponent={},E.prototype.setState=function(D,$){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,$,"setState")},E.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function j(){}j.prototype=E.prototype;function L(D,$,T){this.props=D,this.context=$,this.refs=k,this.updater=T||v}var J=L.prototype=new j;J.constructor=L,S(J,E.prototype),J.isPureReactComponent=!0;var U=Array.isArray;function M(){}var N={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function K(D,$,T){var F=T.ref;return{$$typeof:t,type:D,key:$,ref:F!==void 0?F:null,props:T}}function ce(D,$){return K(D.type,$,D.props)}function ie(D){return typeof D=="object"&&D!==null&&D.$$typeof===t}function se(D){var $={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(T){return $[T]})}var xe=/\/+/g;function pe(D,$){return typeof D=="object"&&D!==null&&D.key!=null?se(""+D.key):$.toString(36)}function H(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(M,M):(D.status="pending",D.then(function($){D.status==="pending"&&(D.status="fulfilled",D.value=$)},function($){D.status==="pending"&&(D.status="rejected",D.reason=$)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function I(D,$,T,F,ue){var le=typeof D;(le==="undefined"||le==="boolean")&&(D=null);var Ne=!1;if(D===null)Ne=!0;else switch(le){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(D.$$typeof){case t:case e:Ne=!0;break;case h:return Ne=D._init,I(Ne(D._payload),$,T,F,ue)}}if(Ne)return ue=ue(D),Ne=F===""?"."+pe(D,0):F,U(ue)?(T="",Ne!=null&&(T=Ne.replace(xe,"$&/")+"/"),I(ue,$,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,"$&/")+"/")+Ne)),$.push(ue)),1;Ne=0;var Be=F===""?".":F+":";if(U(D))for(var je=0;je<D.length;je++)F=D[je],le=Be+pe(F,je),Ne+=I(F,$,T,le,ue);else if(je=y(D),typeof je=="function")for(D=je.call(D),je=0;!(F=D.next()).done;)F=F.value,le=Be+pe(F,je++),Ne+=I(F,$,T,le,ue);else if(le==="object"){if(typeof D.then=="function")return I(H(D),$,T,F,ue);throw $=String(D),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function Z(D,$,T){if(D==null)return D;var F=[],ue=0;return I(D,F,"","",function(le){return $.call(T,le,ue++)}),F}function me(D){if(D._status===-1){var $=D._result;$=$(),$.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=$)}if(D._status===1)return D._result.default;throw D._result}var Me=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=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($))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},O={map:Z,forEach:function(D,$,T){Z(D,function(){$.apply(this,arguments)},T)},count:function(D){var $=0;return Z(D,function(){$++}),$},toArray:function(D){return Z(D,function($){return $})||[]},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=O,Ue.Component=E,Ue.Fragment=n,Ue.Profiler=i,Ue.PureComponent=L,Ue.StrictMode=r,Ue.Suspense=u,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,$,T){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var F=S({},D.props),ue=D.key;if($!=null)for(le in $.key!==void 0&&(ue=""+$.key),$)!G.call($,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&$.ref===void 0||(F[le]=$[le]);var le=arguments.length-2;if(le===1)F.children=T;else if(1<le){for(var Ne=Array(le),Be=0;Be<le;Be++)Ne[Be]=arguments[Be+2];F.children=Ne}return K(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,$,T){var F,ue={},le=null;if($!=null)for(F in $.key!==void 0&&(le=""+$.key),$)G.call($,F)&&F!=="key"&&F!=="__self"&&F!=="__source"&&(ue[F]=$[F]);var Ne=arguments.length-2;if(Ne===1)ue.children=T;else if(1<Ne){for(var Be=Array(Ne),je=0;je<Ne;je++)Be[je]=arguments[je+2];ue.children=Be}if(D&&D.defaultProps)for(F in Ne=D.defaultProps,Ne)ue[F]===void 0&&(ue[F]=Ne[F]);return K(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:h,_payload:{_status:-1,_result:D},_init:me}},Ue.memo=function(D,$){return{$$typeof:f,type:D,compare:$===void 0?null:$}},Ue.startTransition=function(D){var $=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(M,Me)}catch(le){Me(le)}finally{$!==null&&T.types!==null&&($.types=T.types),N.T=$}},Ue.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},Ue.use=function(D){return N.H.use(D)},Ue.useActionState=function(D,$,T){return N.H.useActionState(D,$,T)},Ue.useCallback=function(D,$){return N.H.useCallback(D,$)},Ue.useContext=function(D){return N.H.useContext(D)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(D,$){return N.H.useDeferredValue(D,$)},Ue.useEffect=function(D,$){return N.H.useEffect(D,$)},Ue.useEffectEvent=function(D){return N.H.useEffectEvent(D)},Ue.useId=function(){return N.H.useId()},Ue.useImperativeHandle=function(D,$,T){return N.H.useImperativeHandle(D,$,T)},Ue.useInsertionEffect=function(D,$){return N.H.useInsertionEffect(D,$)},Ue.useLayoutEffect=function(D,$){return N.H.useLayoutEffect(D,$)},Ue.useMemo=function(D,$){return N.H.useMemo(D,$)},Ue.useOptimistic=function(D,$){return N.H.useOptimistic(D,$)},Ue.useReducer=function(D,$,T){return N.H.useReducer(D,$,T)},Ue.useRef=function(D){return N.H.useRef(D)},Ue.useState=function(D){return N.H.useState(D)},Ue.useSyncExternalStore=function(D,$,T){return N.H.useSyncExternalStore(D,$,T)},Ue.useTransition=function(){return N.H.useTransition()},Ue.version="19.2.4",Ue}var NC;function Px(){return NC||(NC=1,r0.exports=dL()),r0.exports}var _=Px();const pn=um(_);var i0={exports:{}},su={},s0={exports:{}},o0={};/**
|
|
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 zC;function fL(){return zC||(zC=1,(function(t){function e(I,Z){var me=I.length;I.push(Z);e:for(;0<me;){var Me=me-1>>>1,O=I[Me];if(0<i(O,Z))I[Me]=Z,I[me]=O,me=Me;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var Z=I[0],me=I.pop();if(me!==Z){I[0]=me;e:for(var Me=0,O=I.length,D=O>>>1;Me<D;){var $=2*(Me+1)-1,T=I[$],F=$+1,ue=I[F];if(0>i(T,me))F<O&&0>i(ue,T)?(I[Me]=ue,I[F]=me,Me=F):(I[Me]=T,I[$]=me,Me=$);else if(F<O&&0>i(ue,me))I[Me]=ue,I[F]=me,Me=F;else break e}}return Z}function i(I,Z){var me=I.sortIndex-Z.sortIndex;return me!==0?me:I.id-Z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var u=[],f=[],h=1,m=null,g=3,y=!1,v=!1,S=!1,k=!1,E=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function J(I){for(var Z=n(f);Z!==null;){if(Z.callback===null)r(f);else if(Z.startTime<=I)r(f),Z.sortIndex=Z.expirationTime,e(u,Z);else break;Z=n(f)}}function U(I){if(S=!1,J(I),!v)if(n(u)!==null)v=!0,M||(M=!0,se());else{var Z=n(f);Z!==null&&H(U,Z.startTime-I)}}var M=!1,N=-1,G=5,K=-1;function ce(){return k?!0:!(t.unstable_now()-K<G)}function ie(){if(k=!1,M){var I=t.unstable_now();K=I;var Z=!0;try{e:{v=!1,S&&(S=!1,j(N),N=-1),y=!0;var me=g;try{t:{for(J(I),m=n(u);m!==null&&!(m.expirationTime>I&&ce());){var Me=m.callback;if(typeof Me=="function"){m.callback=null,g=m.priorityLevel;var O=Me(m.expirationTime<=I);if(I=t.unstable_now(),typeof O=="function"){m.callback=O,J(I),Z=!0;break t}m===n(u)&&r(u),J(I)}else r(u);m=n(u)}if(m!==null)Z=!0;else{var D=n(f);D!==null&&H(U,D.startTime-I),Z=!1}}break e}finally{m=null,g=me,y=!1}Z=void 0}}finally{Z?se():M=!1}}}var se;if(typeof L=="function")se=function(){L(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 H(I,Z){N=E(function(){I(t.unstable_now())},Z)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(I){I.callback=null},t.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<I?Math.floor(1e3/I):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(I){switch(g){case 1:case 2:case 3:var Z=3;break;default:Z=g}var me=g;g=Z;try{return I()}finally{g=me}},t.unstable_requestPaint=function(){k=!0},t.unstable_runWithPriority=function(I,Z){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var me=g;g=I;try{return Z()}finally{g=me}},t.unstable_scheduleCallback=function(I,Z,me){var Me=t.unstable_now();switch(typeof me=="object"&&me!==null?(me=me.delay,me=typeof me=="number"&&0<me?Me+me:Me):me=Me,I){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=me+O,I={id:h++,callback:Z,priorityLevel:I,startTime:me,expirationTime:O,sortIndex:-1},me>Me?(I.sortIndex=me,e(f,I),n(u)===null&&I===n(f)&&(S?(j(N),N=-1):S=!0,H(U,me-Me))):(I.sortIndex=O,e(u,I),v||y||(v=!0,M||(M=!0,se()))),I},t.unstable_shouldYield=ce,t.unstable_wrapCallback=function(I){var Z=g;return function(){var me=g;g=Z;try{return I.apply(this,arguments)}finally{g=me}}}})(o0)),o0}var LC;function hL(){return LC||(LC=1,s0.exports=fL()),s0.exports}var l0={exports:{}},Dn={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var IC;function pL(){if(IC)return Dn;IC=1;var t=Px();function e(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+u+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(u,f,h){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:u,containerInfo:f,implementation:h}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(u,f){if(u==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Dn.createPortal=function(u,f){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return s(u,f,null,h)},Dn.flushSync=function(u){var f=l.T,h=r.p;try{if(l.T=null,r.p=2,u)return u()}finally{l.T=f,r.p=h,r.d.f()}},Dn.preconnect=function(u,f){typeof u=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(u,f))},Dn.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},Dn.preinit=function(u,f){if(typeof u=="string"&&f&&typeof f.as=="string"){var h=f.as,m=c(h,f.crossOrigin),g=typeof f.integrity=="string"?f.integrity:void 0,y=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;h==="style"?r.d.S(u,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:g,fetchPriority:y}):h==="script"&&r.d.X(u,{crossOrigin:m,integrity:g,fetchPriority:y,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Dn.preinitModule=function(u,f){if(typeof u=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var h=c(f.as,f.crossOrigin);r.d.M(u,{crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(u)},Dn.preload=function(u,f){if(typeof u=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var h=f.as,m=c(h,f.crossOrigin);r.d.L(u,h,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Dn.preloadModule=function(u,f){if(typeof u=="string")if(f){var h=c(f.as,f.crossOrigin);r.d.m(u,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:h,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(u)},Dn.requestFormReset=function(u){r.d.r(u)},Dn.unstable_batchedUpdates=function(u,f){return u(f)},Dn.useFormState=function(u,f,h){return l.H.useFormState(u,f,h)},Dn.useFormStatus=function(){return l.H.useHostTransitionStatus()},Dn.version="19.2.4",Dn}var jC;function LM(){if(jC)return l0.exports;jC=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(),l0.exports=pL(),l0.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 BC;function mL(){if(BC)return su;BC=1;var t=hL(),e=Px(),n=LM();function r(o){var a="https://react.dev/errors/"+o;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)a+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function s(o){var a=o,d=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(d=a.return),o=a.return;while(o)}return a.tag===3?d:null}function l(o){if(o.tag===13){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function c(o){if(o.tag===31){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function u(o){if(s(o)!==o)throw Error(r(188))}function f(o){var a=o.alternate;if(!a){if(a=s(o),a===null)throw Error(r(188));return a!==o?null:o}for(var d=o,p=a;;){var b=d.return;if(b===null)break;var x=b.alternate;if(x===null){if(p=b.return,p!==null){d=p;continue}break}if(b.child===x.child){for(x=b.child;x;){if(x===d)return u(b),o;if(x===p)return u(b),a;x=x.sibling}throw Error(r(188))}if(d.return!==p.return)d=b,p=x;else{for(var w=!1,A=b.child;A;){if(A===d){w=!0,d=b,p=x;break}if(A===p){w=!0,p=b,d=x;break}A=A.sibling}if(!w){for(A=x.child;A;){if(A===d){w=!0,d=x,p=b;break}if(A===p){w=!0,p=x,d=b;break}A=A.sibling}if(!w)throw Error(r(189))}}if(d.alternate!==p)throw Error(r(190))}if(d.tag!==3)throw Error(r(188));return d.stateNode.current===d?o:a}function h(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o;for(o=o.child;o!==null;){if(a=h(o),a!==null)return a;o=o.sibling}return null}var m=Object.assign,g=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),L=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),K=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 S:return"Fragment";case E:return"Profiler";case k:return"StrictMode";case U:return"Suspense";case M:return"SuspenseList";case K:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case v:return"Portal";case L:return o.displayName||"Context";case j:return(o._context.displayName||"Context")+".Consumer";case J: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 G:a=o._payload,o=o._init;try{return pe(o(a))}catch{}}return null}var H=Array.isArray,I=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me={pending:!1,data:null,method:null,action:null},Me=[],O=-1;function D(o){return{current:o}}function $(o){0>O||(o.current=Me[O],Me[O]=null,O--)}function T(o,a){O++,Me[O]=o.current,o.current=a}var F=D(null),ue=D(null),le=D(null),Ne=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)?Qk(o):0;break;default:if(o=a.tagName,a=a.namespaceURI)a=Qk(a),o=eC(a,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}$(F),T(F,o)}function je(){$(F),$(ue),$(le)}function Xe(o){o.memoizedState!==null&&T(Ne,o);var a=F.current,d=eC(a,o.type);a!==d&&(T(ue,o),T(F,d))}function Oe(o){ue.current===o&&($(F),$(ue)),Ne.current===o&&($(Ne),eu._currentValue=me)}var Ke,Mt;function Ot(o){if(Ke===void 0)try{throw Error()}catch(d){var a=d.stack.trim().match(/\n( *(at )?)/);Ke=a&&a[1]||"",Mt=-1<d.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Ke+o+Mt}var Zt=!1;function $n(o,a){if(!o||Zt)return"";Zt=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(a){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(W){var q=W}Reflect.construct(o,[],ne)}else{try{ne.call()}catch(W){q=W}o.call(ne.prototype)}}else{try{throw Error()}catch(W){q=W}(ne=o())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(W){if(W&&q&&typeof W.stack=="string")return[W.stack,q.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=p.DetermineComponentFrameRoot(),w=x[0],A=x[1];if(w&&A){var R=w.split(`
|
|
44
|
+
`),P=A.split(`
|
|
45
|
+
`);for(b=p=0;p<R.length&&!R[p].includes("DetermineComponentFrameRoot");)p++;for(;b<P.length&&!P[b].includes("DetermineComponentFrameRoot");)b++;if(p===R.length||b===P.length)for(p=R.length-1,b=P.length-1;1<=p&&0<=b&&R[p]!==P[b];)b--;for(;1<=p&&0<=b;p--,b--)if(R[p]!==P[b]){if(p!==1||b!==1)do if(p--,b--,0>b||R[p]!==P[b]){var Q=`
|
|
46
|
+
`+R[p].replace(" at new "," at ");return o.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",o.displayName)),Q}while(1<=p&&0<=b);break}}}finally{Zt=!1,Error.prepareStackTrace=d}return(d=o?o.displayName||o.name:"")?Ot(d):""}function hr(o,a){switch(o.tag){case 26:case 27:case 5:return Ot(o.type);case 16:return Ot("Lazy");case 13:return o.child!==a&&a!==null?Ot("Suspense Fallback"):Ot("Suspense");case 19:return Ot("SuspenseList");case 0:case 15:return $n(o.type,!1);case 11:return $n(o.type.render,!1);case 1:return $n(o.type,!0);case 31:return Ot("Activity");default:return""}}function Vn(o){try{var a="",d=null;do a+=hr(o,d),d=o,o=o.return;while(o);return a}catch(p){return`
|
|
47
|
+
Error generating stack: `+p.message+`
|
|
48
|
+
`+p.stack}}var Ft=Object.prototype.hasOwnProperty,pr=t.unstable_scheduleCallback,ni=t.unstable_cancelCallback,Hi=t.unstable_shouldYield,_r=t.unstable_requestPaint,qt=t.unstable_now,$i=t.unstable_getCurrentPriorityLevel,X=t.unstable_ImmediatePriority,de=t.unstable_UserBlockingPriority,Te=t.unstable_NormalPriority,Y=t.unstable_LowPriority,ge=t.unstable_IdlePriority,Re=t.log,tt=t.unstable_setDisableYieldValue,re=null,Le=null;function nt(o){if(typeof Re=="function"&&tt(o),Le&&typeof Le.setStrictMode=="function")try{Le.setStrictMode(re,o)}catch{}}var Ge=Math.clz32?Math.clz32:Nt,It=Math.log,he=Math.LN2;function Nt(o){return o>>>=0,o===0?32:31-(It(o)/he|0)|0}var Kt=256,Xn=262144,Dr=4194304;function mi(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 gi(o,a,d){var p=o.pendingLanes;if(p===0)return 0;var b=0,x=o.suspendedLanes,w=o.pingedLanes;o=o.warmLanes;var A=p&134217727;return A!==0?(p=A&~x,p!==0?b=mi(p):(w&=A,w!==0?b=mi(w):d||(d=A&~o,d!==0&&(b=mi(d))))):(A=p&~x,A!==0?b=mi(A):w!==0?b=mi(w):d||(d=p&~o,d!==0&&(b=mi(d)))),b===0?0:a!==0&&a!==b&&(a&x)===0&&(x=b&-b,d=a&-a,x>=d||x===32&&(d&4194048)!==0)?a:b}function Vi(o,a){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&a)===0}function pc(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 Al(){var o=Dr;return Dr<<=1,(Dr&62914560)===0&&(Dr=4194304),o}function Ml(o){for(var a=[],d=0;31>d;d++)a.push(o);return a}function Eo(o,a){o.pendingLanes|=a,a!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function To(o,a,d,p,b,x){var w=o.pendingLanes;o.pendingLanes=d,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=d,o.entangledLanes&=d,o.errorRecoveryDisabledLanes&=d,o.shellSuspendCounter=0;var A=o.entanglements,R=o.expirationTimes,P=o.hiddenUpdates;for(d=w&~d;0<d;){var Q=31-Ge(d),ne=1<<Q;A[Q]=0,R[Q]=-1;var q=P[Q];if(q!==null)for(P[Q]=null,Q=0;Q<q.length;Q++){var W=q[Q];W!==null&&(W.lane&=-536870913)}d&=~ne}p!==0&&Lv(o,p,0),x!==0&&b===0&&o.tag!==0&&(o.suspendedLanes|=x&~(w&~a))}function Lv(o,a,d){o.pendingLanes|=a,o.suspendedLanes&=~a;var p=31-Ge(a);o.entangledLanes|=a,o.entanglements[p]=o.entanglements[p]|1073741824|d&261930}function Iv(o,a){var d=o.entangledLanes|=a;for(o=o.entanglements;d;){var p=31-Ge(d),b=1<<p;b&a|o[p]&a&&(o[p]|=a),d&=~b}}function jv(o,a){var d=a&-a;return d=(d&42)!==0?1:qm(d),(d&(o.suspendedLanes|a))!==0?0:d}function qm(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 Km(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function Bv(){var o=Z.p;return o!==0?o:(o=window.event,o===void 0?32:kC(o.type))}function Uv(o,a){var d=Z.p;try{return Z.p=o,a()}finally{Z.p=d}}var ks=Math.random().toString(36).slice(2),vn="__reactFiber$"+ks,Qn="__reactProps$"+ks,Ol="__reactContainer$"+ks,Ym="__reactEvents$"+ks,ZR="__reactListeners$"+ks,JR="__reactHandles$"+ks,Hv="__reactResources$"+ks,mc="__reactMarker$"+ks;function Wm(o){delete o[vn],delete o[Qn],delete o[Ym],delete o[ZR],delete o[JR]}function _l(o){var a=o[vn];if(a)return a;for(var d=o.parentNode;d;){if(a=d[Ol]||d[vn]){if(d=a.alternate,a.child!==null||d!==null&&d.child!==null)for(o=lC(o);o!==null;){if(d=o[vn])return d;o=lC(o)}return a}o=d,d=o.parentNode}return null}function Dl(o){if(o=o[vn]||o[Ol]){var a=o.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return o}return null}function gc(o){var a=o.tag;if(a===5||a===26||a===27||a===6)return o.stateNode;throw Error(r(33))}function Rl(o){var a=o[Hv];return a||(a=o[Hv]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function un(o){o[mc]=!0}var $v=new Set,Vv={};function Ao(o,a){Nl(o,a),Nl(o+"Capture",a)}function Nl(o,a){for(Vv[o]=a,o=0;o<a.length;o++)$v.add(a[o])}var XR=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]*$"),Pv={},Fv={};function QR(o){return Ft.call(Fv,o)?!0:Ft.call(Pv,o)?!1:XR.test(o)?Fv[o]=!0:(Pv[o]=!0,!1)}function Ld(o,a,d){if(QR(a))if(d===null)o.removeAttribute(a);else{switch(typeof d){case"undefined":case"function":case"symbol":o.removeAttribute(a);return;case"boolean":var p=a.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){o.removeAttribute(a);return}}o.setAttribute(a,""+d)}}function Id(o,a,d){if(d===null)o.removeAttribute(a);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(a);return}o.setAttribute(a,""+d)}}function Pi(o,a,d,p){if(p===null)o.removeAttribute(d);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(d);return}o.setAttributeNS(a,d,""+p)}}function Rr(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function qv(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function eN(o,a,d){var p=Object.getOwnPropertyDescriptor(o.constructor.prototype,a);if(!o.hasOwnProperty(a)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var b=p.get,x=p.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return b.call(this)},set:function(w){d=""+w,x.call(this,w)}}),Object.defineProperty(o,a,{enumerable:p.enumerable}),{getValue:function(){return d},setValue:function(w){d=""+w},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function Gm(o){if(!o._valueTracker){var a=qv(o)?"checked":"value";o._valueTracker=eN(o,a,""+o[a])}}function Kv(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var d=a.getValue(),p="";return o&&(p=qv(o)?o.checked?"true":"false":o.value),o=p,o!==d?(a.setValue(o),!0):!1}function jd(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 tN=/[\n"\\]/g;function Nr(o){return o.replace(tN,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Zm(o,a,d,p,b,x,w,A){o.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?o.type=w:o.removeAttribute("type"),a!=null?w==="number"?(a===0&&o.value===""||o.value!=a)&&(o.value=""+Rr(a)):o.value!==""+Rr(a)&&(o.value=""+Rr(a)):w!=="submit"&&w!=="reset"||o.removeAttribute("value"),a!=null?Jm(o,w,Rr(a)):d!=null?Jm(o,w,Rr(d)):p!=null&&o.removeAttribute("value"),b==null&&x!=null&&(o.defaultChecked=!!x),b!=null&&(o.checked=b&&typeof b!="function"&&typeof b!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?o.name=""+Rr(A):o.removeAttribute("name")}function Yv(o,a,d,p,b,x,w,A){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(o.type=x),a!=null||d!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){Gm(o);return}d=d!=null?""+Rr(d):"",a=a!=null?""+Rr(a):d,A||a===o.value||(o.value=a),o.defaultValue=a}p=p??b,p=typeof p!="function"&&typeof p!="symbol"&&!!p,o.checked=A?o.checked:!!p,o.defaultChecked=!!p,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(o.name=w),Gm(o)}function Jm(o,a,d){a==="number"&&jd(o.ownerDocument)===o||o.defaultValue===""+d||(o.defaultValue=""+d)}function zl(o,a,d,p){if(o=o.options,a){a={};for(var b=0;b<d.length;b++)a["$"+d[b]]=!0;for(d=0;d<o.length;d++)b=a.hasOwnProperty("$"+o[d].value),o[d].selected!==b&&(o[d].selected=b),b&&p&&(o[d].defaultSelected=!0)}else{for(d=""+Rr(d),a=null,b=0;b<o.length;b++){if(o[b].value===d){o[b].selected=!0,p&&(o[b].defaultSelected=!0);return}a!==null||o[b].disabled||(a=o[b])}a!==null&&(a.selected=!0)}}function Wv(o,a,d){if(a!=null&&(a=""+Rr(a),a!==o.value&&(o.value=a),d==null)){o.defaultValue!==a&&(o.defaultValue=a);return}o.defaultValue=d!=null?""+Rr(d):""}function Gv(o,a,d,p){if(a==null){if(p!=null){if(d!=null)throw Error(r(92));if(H(p)){if(1<p.length)throw Error(r(93));p=p[0]}d=p}d==null&&(d=""),a=d}d=Rr(a),o.defaultValue=d,p=o.textContent,p===d&&p!==""&&p!==null&&(o.value=p),Gm(o)}function Ll(o,a){if(a){var d=o.firstChild;if(d&&d===o.lastChild&&d.nodeType===3){d.nodeValue=a;return}}o.textContent=a}var nN=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 Zv(o,a,d){var p=a.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?p?o.setProperty(a,""):a==="float"?o.cssFloat="":o[a]="":p?o.setProperty(a,d):typeof d!="number"||d===0||nN.has(a)?a==="float"?o.cssFloat=d:o[a]=(""+d).trim():o[a]=d+"px"}function Jv(o,a,d){if(a!=null&&typeof a!="object")throw Error(r(62));if(o=o.style,d!=null){for(var p in d)!d.hasOwnProperty(p)||a!=null&&a.hasOwnProperty(p)||(p.indexOf("--")===0?o.setProperty(p,""):p==="float"?o.cssFloat="":o[p]="");for(var b in a)p=a[b],a.hasOwnProperty(b)&&d[b]!==p&&Zv(o,b,p)}else for(var x in a)a.hasOwnProperty(x)&&Zv(o,x,a[x])}function Xm(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 rN=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"]]),iN=/^[\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 Bd(o){return iN.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Fi(){}var Qm=null;function eg(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Il=null,jl=null;function Xv(o){var a=Dl(o);if(a&&(o=a.stateNode)){var d=o[Qn]||null;e:switch(o=a.stateNode,a.type){case"input":if(Zm(o,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),a=d.name,d.type==="radio"&&a!=null){for(d=o;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+Nr(""+a)+'"][type="radio"]'),a=0;a<d.length;a++){var p=d[a];if(p!==o&&p.form===o.form){var b=p[Qn]||null;if(!b)throw Error(r(90));Zm(p,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(a=0;a<d.length;a++)p=d[a],p.form===o.form&&Kv(p)}break e;case"textarea":Wv(o,d.value,d.defaultValue);break e;case"select":a=d.value,a!=null&&zl(o,!!d.multiple,a,!1)}}}var tg=!1;function Qv(o,a,d){if(tg)return o(a,d);tg=!0;try{var p=o(a);return p}finally{if(tg=!1,(Il!==null||jl!==null)&&(Tf(),Il&&(a=Il,o=jl,jl=Il=null,Xv(a),o)))for(a=0;a<o.length;a++)Xv(o[a])}}function yc(o,a){var d=o.stateNode;if(d===null)return null;var p=d[Qn]||null;if(p===null)return null;d=p[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(o=o.type,p=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!p;break e;default:o=!1}if(o)return null;if(d&&typeof d!="function")throw Error(r(231,a,typeof d));return d}var qi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ng=!1;if(qi)try{var bc={};Object.defineProperty(bc,"passive",{get:function(){ng=!0}}),window.addEventListener("test",bc,bc),window.removeEventListener("test",bc,bc)}catch{ng=!1}var Cs=null,rg=null,Ud=null;function eS(){if(Ud)return Ud;var o,a=rg,d=a.length,p,b="value"in Cs?Cs.value:Cs.textContent,x=b.length;for(o=0;o<d&&a[o]===b[o];o++);var w=d-o;for(p=1;p<=w&&a[d-p]===b[x-p];p++);return Ud=b.slice(o,1<p?1-p:void 0)}function Hd(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 $d(){return!0}function tS(){return!1}function er(o){function a(d,p,b,x,w){this._reactName=d,this._targetInst=b,this.type=p,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var A in o)o.hasOwnProperty(A)&&(d=o[A],this[A]=d?d(x):x[A]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?$d:tS,this.isPropagationStopped=tS,this}return m(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=$d)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=$d)},persist:function(){},isPersistent:$d}),a}var Mo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vd=er(Mo),xc=m({},Mo,{view:0,detail:0}),sN=er(xc),ig,sg,vc,Pd=m({},xc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lg,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!==vc&&(vc&&o.type==="mousemove"?(ig=o.screenX-vc.screenX,sg=o.screenY-vc.screenY):sg=ig=0,vc=o),ig)},movementY:function(o){return"movementY"in o?o.movementY:sg}}),nS=er(Pd),oN=m({},Pd,{dataTransfer:0}),lN=er(oN),aN=m({},xc,{relatedTarget:0}),og=er(aN),cN=m({},Mo,{animationName:0,elapsedTime:0,pseudoElement:0}),uN=er(cN),dN=m({},Mo,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),fN=er(dN),hN=m({},Mo,{data:0}),rS=er(hN),pN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mN={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"},gN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yN(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=gN[o])?!!a[o]:!1}function lg(){return yN}var bN=m({},xc,{key:function(o){if(o.key){var a=pN[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=Hd(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?mN[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lg,charCode:function(o){return o.type==="keypress"?Hd(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Hd(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),xN=er(bN),vN=m({},Pd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),iS=er(vN),SN=m({},xc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lg}),wN=er(SN),kN=m({},Mo,{propertyName:0,elapsedTime:0,pseudoElement:0}),CN=er(kN),EN=m({},Pd,{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}),TN=er(EN),AN=m({},Mo,{newState:0,oldState:0}),MN=er(AN),ON=[9,13,27,32],ag=qi&&"CompositionEvent"in window,Sc=null;qi&&"documentMode"in document&&(Sc=document.documentMode);var _N=qi&&"TextEvent"in window&&!Sc,sS=qi&&(!ag||Sc&&8<Sc&&11>=Sc),oS=" ",lS=!1;function aS(o,a){switch(o){case"keyup":return ON.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cS(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Bl=!1;function DN(o,a){switch(o){case"compositionend":return cS(a);case"keypress":return a.which!==32?null:(lS=!0,oS);case"textInput":return o=a.data,o===oS&&lS?null:o;default:return null}}function RN(o,a){if(Bl)return o==="compositionend"||!ag&&aS(o,a)?(o=eS(),Ud=rg=Cs=null,Bl=!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 sS&&a.locale!=="ko"?null:a.data;default:return null}}var NN={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 uS(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!NN[o.type]:a==="textarea"}function dS(o,a,d,p){Il?jl?jl.push(p):jl=[p]:Il=p,a=Nf(a,"onChange"),0<a.length&&(d=new Vd("onChange","change",null,d,p),o.push({event:d,listeners:a}))}var wc=null,kc=null;function zN(o){Yk(o,0)}function Fd(o){var a=gc(o);if(Kv(a))return o}function fS(o,a){if(o==="change")return a}var hS=!1;if(qi){var cg;if(qi){var ug="oninput"in document;if(!ug){var pS=document.createElement("div");pS.setAttribute("oninput","return;"),ug=typeof pS.oninput=="function"}cg=ug}else cg=!1;hS=cg&&(!document.documentMode||9<document.documentMode)}function mS(){wc&&(wc.detachEvent("onpropertychange",gS),kc=wc=null)}function gS(o){if(o.propertyName==="value"&&Fd(kc)){var a=[];dS(a,kc,o,eg(o)),Qv(zN,a)}}function LN(o,a,d){o==="focusin"?(mS(),wc=a,kc=d,wc.attachEvent("onpropertychange",gS)):o==="focusout"&&mS()}function IN(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Fd(kc)}function jN(o,a){if(o==="click")return Fd(a)}function BN(o,a){if(o==="input"||o==="change")return Fd(a)}function UN(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var mr=typeof Object.is=="function"?Object.is:UN;function Cc(o,a){if(mr(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var d=Object.keys(o),p=Object.keys(a);if(d.length!==p.length)return!1;for(p=0;p<d.length;p++){var b=d[p];if(!Ft.call(a,b)||!mr(o[b],a[b]))return!1}return!0}function yS(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function bS(o,a){var d=yS(o);o=0;for(var p;d;){if(d.nodeType===3){if(p=o+d.textContent.length,o<=a&&p>=a)return{node:d,offset:a-o};o=p}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=yS(d)}}function xS(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?xS(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function vS(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var a=jd(o.document);a instanceof o.HTMLIFrameElement;){try{var d=typeof a.contentWindow.location.href=="string"}catch{d=!1}if(d)o=a.contentWindow;else break;a=jd(o.document)}return a}function dg(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 HN=qi&&"documentMode"in document&&11>=document.documentMode,Ul=null,fg=null,Ec=null,hg=!1;function SS(o,a,d){var p=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;hg||Ul==null||Ul!==jd(p)||(p=Ul,"selectionStart"in p&&dg(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Ec&&Cc(Ec,p)||(Ec=p,p=Nf(fg,"onSelect"),0<p.length&&(a=new Vd("onSelect","select",null,a,d),o.push({event:a,listeners:p}),a.target=Ul)))}function Oo(o,a){var d={};return d[o.toLowerCase()]=a.toLowerCase(),d["Webkit"+o]="webkit"+a,d["Moz"+o]="moz"+a,d}var Hl={animationend:Oo("Animation","AnimationEnd"),animationiteration:Oo("Animation","AnimationIteration"),animationstart:Oo("Animation","AnimationStart"),transitionrun:Oo("Transition","TransitionRun"),transitionstart:Oo("Transition","TransitionStart"),transitioncancel:Oo("Transition","TransitionCancel"),transitionend:Oo("Transition","TransitionEnd")},pg={},wS={};qi&&(wS=document.createElement("div").style,"AnimationEvent"in window||(delete Hl.animationend.animation,delete Hl.animationiteration.animation,delete Hl.animationstart.animation),"TransitionEvent"in window||delete Hl.transitionend.transition);function _o(o){if(pg[o])return pg[o];if(!Hl[o])return o;var a=Hl[o],d;for(d in a)if(a.hasOwnProperty(d)&&d in wS)return pg[o]=a[d];return o}var kS=_o("animationend"),CS=_o("animationiteration"),ES=_o("animationstart"),$N=_o("transitionrun"),VN=_o("transitionstart"),PN=_o("transitioncancel"),TS=_o("transitionend"),AS=new Map,mg="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(" ");mg.push("scrollEnd");function ri(o,a){AS.set(o,a),Ao(a,[o])}var qd=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)},zr=[],$l=0,gg=0;function Kd(){for(var o=$l,a=gg=$l=0;a<o;){var d=zr[a];zr[a++]=null;var p=zr[a];zr[a++]=null;var b=zr[a];zr[a++]=null;var x=zr[a];if(zr[a++]=null,p!==null&&b!==null){var w=p.pending;w===null?b.next=b:(b.next=w.next,w.next=b),p.pending=b}x!==0&&MS(d,b,x)}}function Yd(o,a,d,p){zr[$l++]=o,zr[$l++]=a,zr[$l++]=d,zr[$l++]=p,gg|=p,o.lanes|=p,o=o.alternate,o!==null&&(o.lanes|=p)}function yg(o,a,d,p){return Yd(o,a,d,p),Wd(o)}function Do(o,a){return Yd(o,null,null,a),Wd(o)}function MS(o,a,d){o.lanes|=d;var p=o.alternate;p!==null&&(p.lanes|=d);for(var b=!1,x=o.return;x!==null;)x.childLanes|=d,p=x.alternate,p!==null&&(p.childLanes|=d),x.tag===22&&(o=x.stateNode,o===null||o._visibility&1||(b=!0)),o=x,x=x.return;return o.tag===3?(x=o.stateNode,b&&a!==null&&(b=31-Ge(d),o=x.hiddenUpdates,p=o[b],p===null?o[b]=[a]:p.push(a),a.lane=d|536870912),x):null}function Wd(o){if(50<Yc)throw Yc=0,Ty=null,Error(r(185));for(var a=o.return;a!==null;)o=a,a=o.return;return o.tag===3?o.stateNode:null}var Vl={};function FN(o,a,d,p){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gr(o,a,d,p){return new FN(o,a,d,p)}function bg(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Ki(o,a){var d=o.alternate;return d===null?(d=gr(o.tag,a,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=a,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&65011712,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,a=o.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d.refCleanup=o.refCleanup,d}function OS(o,a){o.flags&=65011714;var d=o.alternate;return d===null?(o.childLanes=0,o.lanes=a,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=d.childLanes,o.lanes=d.lanes,o.child=d.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=d.memoizedProps,o.memoizedState=d.memoizedState,o.updateQueue=d.updateQueue,o.type=d.type,a=d.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),o}function Gd(o,a,d,p,b,x){var w=0;if(p=o,typeof o=="function")bg(o)&&(w=1);else if(typeof o=="string")w=Gz(o,d,F.current)?26:o==="html"||o==="head"||o==="body"?27:5;else e:switch(o){case K:return o=gr(31,d,a,b),o.elementType=K,o.lanes=x,o;case S:return Ro(d.children,b,x,a);case k:w=8,b|=24;break;case E:return o=gr(12,d,a,b|2),o.elementType=E,o.lanes=x,o;case U:return o=gr(13,d,a,b),o.elementType=U,o.lanes=x,o;case M:return o=gr(19,d,a,b),o.elementType=M,o.lanes=x,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case L:w=10;break e;case j:w=9;break e;case J:w=11;break e;case N:w=14;break e;case G:w=16,p=null;break e}w=29,d=Error(r(130,o===null?"null":typeof o,"")),p=null}return a=gr(w,d,a,b),a.elementType=o,a.type=p,a.lanes=x,a}function Ro(o,a,d,p){return o=gr(7,o,p,a),o.lanes=d,o}function xg(o,a,d){return o=gr(6,o,null,a),o.lanes=d,o}function _S(o){var a=gr(18,null,null,0);return a.stateNode=o,a}function vg(o,a,d){return a=gr(4,o.children!==null?o.children:[],o.key,a),a.lanes=d,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}var DS=new WeakMap;function Lr(o,a){if(typeof o=="object"&&o!==null){var d=DS.get(o);return d!==void 0?d:(a={value:o,source:a,stack:Vn(a)},DS.set(o,a),a)}return{value:o,source:a,stack:Vn(a)}}var Pl=[],Fl=0,Zd=null,Tc=0,Ir=[],jr=0,Es=null,yi=1,bi="";function Yi(o,a){Pl[Fl++]=Tc,Pl[Fl++]=Zd,Zd=o,Tc=a}function RS(o,a,d){Ir[jr++]=yi,Ir[jr++]=bi,Ir[jr++]=Es,Es=o;var p=yi;o=bi;var b=32-Ge(p)-1;p&=~(1<<b),d+=1;var x=32-Ge(a)+b;if(30<x){var w=b-b%5;x=(p&(1<<w)-1).toString(32),p>>=w,b-=w,yi=1<<32-Ge(a)+b|d<<b|p,bi=x+o}else yi=1<<x|d<<b|p,bi=o}function Sg(o){o.return!==null&&(Yi(o,1),RS(o,1,0))}function wg(o){for(;o===Zd;)Zd=Pl[--Fl],Pl[Fl]=null,Tc=Pl[--Fl],Pl[Fl]=null;for(;o===Es;)Es=Ir[--jr],Ir[jr]=null,bi=Ir[--jr],Ir[jr]=null,yi=Ir[--jr],Ir[jr]=null}function NS(o,a){Ir[jr++]=yi,Ir[jr++]=bi,Ir[jr++]=Es,yi=a.id,bi=a.overflow,Es=o}var Sn=null,_t=null,ot=!1,Ts=null,Br=!1,kg=Error(r(519));function As(o){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ac(Lr(a,o)),kg}function zS(o){var a=o.stateNode,d=o.type,p=o.memoizedProps;switch(a[vn]=o,a[Qn]=p,d){case"dialog":et("cancel",a),et("close",a);break;case"iframe":case"object":case"embed":et("load",a);break;case"video":case"audio":for(d=0;d<Gc.length;d++)et(Gc[d],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),Yv(a,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":et("invalid",a);break;case"textarea":et("invalid",a),Gv(a,p.value,p.defaultValue,p.children)}d=p.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||a.textContent===""+d||p.suppressHydrationWarning===!0||Jk(a.textContent,d)?(p.popover!=null&&(et("beforetoggle",a),et("toggle",a)),p.onScroll!=null&&et("scroll",a),p.onScrollEnd!=null&&et("scrollend",a),p.onClick!=null&&(a.onclick=Fi),a=!0):a=!1,a||As(o,!0)}function LS(o){for(Sn=o.return;Sn;)switch(Sn.tag){case 5:case 31:case 13:Br=!1;return;case 27:case 3:Br=!0;return;default:Sn=Sn.return}}function ql(o){if(o!==Sn)return!1;if(!ot)return LS(o),ot=!0,!1;var a=o.tag,d;if((d=a!==3&&a!==27)&&((d=a===5)&&(d=o.type,d=!(d!=="form"&&d!=="button")||$y(o.type,o.memoizedProps)),d=!d),d&&_t&&As(o),LS(o),a===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));_t=oC(o)}else if(a===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(317));_t=oC(o)}else a===27?(a=_t,$s(o.type)?(o=Ky,Ky=null,_t=o):_t=a):_t=Sn?Hr(o.stateNode.nextSibling):null;return!0}function No(){_t=Sn=null,ot=!1}function Cg(){var o=Ts;return o!==null&&(ir===null?ir=o:ir.push.apply(ir,o),Ts=null),o}function Ac(o){Ts===null?Ts=[o]:Ts.push(o)}var Eg=D(null),zo=null,Wi=null;function Ms(o,a,d){T(Eg,a._currentValue),a._currentValue=d}function Gi(o){o._currentValue=Eg.current,$(Eg)}function Tg(o,a,d){for(;o!==null;){var p=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,p!==null&&(p.childLanes|=a)):p!==null&&(p.childLanes&a)!==a&&(p.childLanes|=a),o===d)break;o=o.return}}function Ag(o,a,d,p){var b=o.child;for(b!==null&&(b.return=o);b!==null;){var x=b.dependencies;if(x!==null){var w=b.child;x=x.firstContext;e:for(;x!==null;){var A=x;x=b;for(var R=0;R<a.length;R++)if(A.context===a[R]){x.lanes|=d,A=x.alternate,A!==null&&(A.lanes|=d),Tg(x.return,d,o),p||(w=null);break e}x=A.next}}else if(b.tag===18){if(w=b.return,w===null)throw Error(r(341));w.lanes|=d,x=w.alternate,x!==null&&(x.lanes|=d),Tg(w,d,o),w=null}else w=b.child;if(w!==null)w.return=b;else for(w=b;w!==null;){if(w===o){w=null;break}if(b=w.sibling,b!==null){b.return=w.return,w=b;break}w=w.return}b=w}}function Kl(o,a,d,p){o=null;for(var b=a,x=!1;b!==null;){if(!x){if((b.flags&524288)!==0)x=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var w=b.alternate;if(w===null)throw Error(r(387));if(w=w.memoizedProps,w!==null){var A=b.type;mr(b.pendingProps.value,w.value)||(o!==null?o.push(A):o=[A])}}else if(b===Ne.current){if(w=b.alternate,w===null)throw Error(r(387));w.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(o!==null?o.push(eu):o=[eu])}b=b.return}o!==null&&Ag(a,o,d,p),a.flags|=262144}function Jd(o){for(o=o.firstContext;o!==null;){if(!mr(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Lo(o){zo=o,Wi=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function wn(o){return IS(zo,o)}function Xd(o,a){return zo===null&&Lo(o),IS(o,a)}function IS(o,a){var d=a._currentValue;if(a={context:a,memoizedValue:d,next:null},Wi===null){if(o===null)throw Error(r(308));Wi=a,o.dependencies={lanes:0,firstContext:a},o.flags|=524288}else Wi=Wi.next=a;return d}var qN=typeof AbortController<"u"?AbortController:function(){var o=[],a=this.signal={aborted:!1,addEventListener:function(d,p){o.push(p)}};this.abort=function(){a.aborted=!0,o.forEach(function(d){return d()})}},KN=t.unstable_scheduleCallback,YN=t.unstable_NormalPriority,Jt={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mg(){return{controller:new qN,data:new Map,refCount:0}}function Mc(o){o.refCount--,o.refCount===0&&KN(YN,function(){o.controller.abort()})}var Oc=null,Og=0,Yl=0,Wl=null;function WN(o,a){if(Oc===null){var d=Oc=[];Og=0,Yl=Ry(),Wl={status:"pending",value:void 0,then:function(p){d.push(p)}}}return Og++,a.then(jS,jS),a}function jS(){if(--Og===0&&Oc!==null){Wl!==null&&(Wl.status="fulfilled");var o=Oc;Oc=null,Yl=0,Wl=null;for(var a=0;a<o.length;a++)(0,o[a])()}}function GN(o,a){var d=[],p={status:"pending",value:null,reason:null,then:function(b){d.push(b)}};return o.then(function(){p.status="fulfilled",p.value=a;for(var b=0;b<d.length;b++)(0,d[b])(a)},function(b){for(p.status="rejected",p.reason=b,b=0;b<d.length;b++)(0,d[b])(void 0)}),p}var BS=I.S;I.S=function(o,a){Sk=qt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&WN(o,a),BS!==null&&BS(o,a)};var Io=D(null);function _g(){var o=Io.current;return o!==null?o:St.pooledCache}function Qd(o,a){a===null?T(Io,Io.current):T(Io,a.pool)}function US(){var o=_g();return o===null?null:{parent:Jt._currentValue,pool:o}}var Gl=Error(r(460)),Dg=Error(r(474)),ef=Error(r(542)),tf={then:function(){}};function HS(o){return o=o.status,o==="fulfilled"||o==="rejected"}function $S(o,a,d){switch(d=o[d],d===void 0?o.push(a):d!==a&&(a.then(Fi,Fi),a=d),a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,PS(o),o;default:if(typeof a.status=="string")a.then(Fi,Fi);else{if(o=St,o!==null&&100<o.shellSuspendCounter)throw Error(r(482));o=a,o.status="pending",o.then(function(p){if(a.status==="pending"){var b=a;b.status="fulfilled",b.value=p}},function(p){if(a.status==="pending"){var b=a;b.status="rejected",b.reason=p}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw o=a.reason,PS(o),o}throw Bo=a,Gl}}function jo(o){try{var a=o._init;return a(o._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(Bo=d,Gl):d}}var Bo=null;function VS(){if(Bo===null)throw Error(r(459));var o=Bo;return Bo=null,o}function PS(o){if(o===Gl||o===ef)throw Error(r(483))}var Zl=null,_c=0;function nf(o){var a=_c;return _c+=1,Zl===null&&(Zl=[]),$S(Zl,o,a)}function Dc(o,a){a=a.props.ref,o.ref=a!==void 0?a:null}function rf(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 FS(o){function a(B,z){if(o){var V=B.deletions;V===null?(B.deletions=[z],B.flags|=16):V.push(z)}}function d(B,z){if(!o)return null;for(;z!==null;)a(B,z),z=z.sibling;return null}function p(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 b(B,z){return B=Ki(B,z),B.index=0,B.sibling=null,B}function x(B,z,V){return B.index=V,o?(V=B.alternate,V!==null?(V=V.index,V<z?(B.flags|=67108866,z):V):(B.flags|=67108866,z)):(B.flags|=1048576,z)}function w(B){return o&&B.alternate===null&&(B.flags|=67108866),B}function A(B,z,V,te){return z===null||z.tag!==6?(z=xg(V,B.mode,te),z.return=B,z):(z=b(z,V),z.return=B,z)}function R(B,z,V,te){var _e=V.type;return _e===S?Q(B,z,V.props.children,te,V.key):z!==null&&(z.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===G&&jo(_e)===z.type)?(z=b(z,V.props),Dc(z,V),z.return=B,z):(z=Gd(V.type,V.key,V.props,null,B.mode,te),Dc(z,V),z.return=B,z)}function P(B,z,V,te){return z===null||z.tag!==4||z.stateNode.containerInfo!==V.containerInfo||z.stateNode.implementation!==V.implementation?(z=vg(V,B.mode,te),z.return=B,z):(z=b(z,V.children||[]),z.return=B,z)}function Q(B,z,V,te,_e){return z===null||z.tag!==7?(z=Ro(V,B.mode,te,_e),z.return=B,z):(z=b(z,V),z.return=B,z)}function ne(B,z,V){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=xg(""+z,B.mode,V),z.return=B,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case y:return V=Gd(z.type,z.key,z.props,null,B.mode,V),Dc(V,z),V.return=B,V;case v:return z=vg(z,B.mode,V),z.return=B,z;case G:return z=jo(z),ne(B,z,V)}if(H(z)||se(z))return z=Ro(z,B.mode,V,null),z.return=B,z;if(typeof z.then=="function")return ne(B,nf(z),V);if(z.$$typeof===L)return ne(B,Xd(B,z),V);rf(B,z)}return null}function q(B,z,V,te){var _e=z!==null?z.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return _e!==null?null:A(B,z,""+V,te);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case y:return V.key===_e?R(B,z,V,te):null;case v:return V.key===_e?P(B,z,V,te):null;case G:return V=jo(V),q(B,z,V,te)}if(H(V)||se(V))return _e!==null?null:Q(B,z,V,te,null);if(typeof V.then=="function")return q(B,z,nf(V),te);if(V.$$typeof===L)return q(B,z,Xd(B,V),te);rf(B,V)}return null}function W(B,z,V,te,_e){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return B=B.get(V)||null,A(z,B,""+te,_e);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case y:return B=B.get(te.key===null?V:te.key)||null,R(z,B,te,_e);case v:return B=B.get(te.key===null?V:te.key)||null,P(z,B,te,_e);case G:return te=jo(te),W(B,z,V,te,_e)}if(H(te)||se(te))return B=B.get(V)||null,Q(z,B,te,_e,null);if(typeof te.then=="function")return W(B,z,V,nf(te),_e);if(te.$$typeof===L)return W(B,z,V,Xd(z,te),_e);rf(z,te)}return null}function ve(B,z,V,te){for(var _e=null,ct=null,Ce=z,Fe=z=0,it=null;Ce!==null&&Fe<V.length;Fe++){Ce.index>Fe?(it=Ce,Ce=null):it=Ce.sibling;var ut=q(B,Ce,V[Fe],te);if(ut===null){Ce===null&&(Ce=it);break}o&&Ce&&ut.alternate===null&&a(B,Ce),z=x(ut,z,Fe),ct===null?_e=ut:ct.sibling=ut,ct=ut,Ce=it}if(Fe===V.length)return d(B,Ce),ot&&Yi(B,Fe),_e;if(Ce===null){for(;Fe<V.length;Fe++)Ce=ne(B,V[Fe],te),Ce!==null&&(z=x(Ce,z,Fe),ct===null?_e=Ce:ct.sibling=Ce,ct=Ce);return ot&&Yi(B,Fe),_e}for(Ce=p(Ce);Fe<V.length;Fe++)it=W(Ce,B,Fe,V[Fe],te),it!==null&&(o&&it.alternate!==null&&Ce.delete(it.key===null?Fe:it.key),z=x(it,z,Fe),ct===null?_e=it:ct.sibling=it,ct=it);return o&&Ce.forEach(function(Ks){return a(B,Ks)}),ot&&Yi(B,Fe),_e}function ze(B,z,V,te){if(V==null)throw Error(r(151));for(var _e=null,ct=null,Ce=z,Fe=z=0,it=null,ut=V.next();Ce!==null&&!ut.done;Fe++,ut=V.next()){Ce.index>Fe?(it=Ce,Ce=null):it=Ce.sibling;var Ks=q(B,Ce,ut.value,te);if(Ks===null){Ce===null&&(Ce=it);break}o&&Ce&&Ks.alternate===null&&a(B,Ce),z=x(Ks,z,Fe),ct===null?_e=Ks:ct.sibling=Ks,ct=Ks,Ce=it}if(ut.done)return d(B,Ce),ot&&Yi(B,Fe),_e;if(Ce===null){for(;!ut.done;Fe++,ut=V.next())ut=ne(B,ut.value,te),ut!==null&&(z=x(ut,z,Fe),ct===null?_e=ut:ct.sibling=ut,ct=ut);return ot&&Yi(B,Fe),_e}for(Ce=p(Ce);!ut.done;Fe++,ut=V.next())ut=W(Ce,B,Fe,ut.value,te),ut!==null&&(o&&ut.alternate!==null&&Ce.delete(ut.key===null?Fe:ut.key),z=x(ut,z,Fe),ct===null?_e=ut:ct.sibling=ut,ct=ut);return o&&Ce.forEach(function(oL){return a(B,oL)}),ot&&Yi(B,Fe),_e}function vt(B,z,V,te){if(typeof V=="object"&&V!==null&&V.type===S&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case y:e:{for(var _e=V.key;z!==null;){if(z.key===_e){if(_e=V.type,_e===S){if(z.tag===7){d(B,z.sibling),te=b(z,V.props.children),te.return=B,B=te;break e}}else if(z.elementType===_e||typeof _e=="object"&&_e!==null&&_e.$$typeof===G&&jo(_e)===z.type){d(B,z.sibling),te=b(z,V.props),Dc(te,V),te.return=B,B=te;break e}d(B,z);break}else a(B,z);z=z.sibling}V.type===S?(te=Ro(V.props.children,B.mode,te,V.key),te.return=B,B=te):(te=Gd(V.type,V.key,V.props,null,B.mode,te),Dc(te,V),te.return=B,B=te)}return w(B);case v:e:{for(_e=V.key;z!==null;){if(z.key===_e)if(z.tag===4&&z.stateNode.containerInfo===V.containerInfo&&z.stateNode.implementation===V.implementation){d(B,z.sibling),te=b(z,V.children||[]),te.return=B,B=te;break e}else{d(B,z);break}else a(B,z);z=z.sibling}te=vg(V,B.mode,te),te.return=B,B=te}return w(B);case G:return V=jo(V),vt(B,z,V,te)}if(H(V))return ve(B,z,V,te);if(se(V)){if(_e=se(V),typeof _e!="function")throw Error(r(150));return V=_e.call(V),ze(B,z,V,te)}if(typeof V.then=="function")return vt(B,z,nf(V),te);if(V.$$typeof===L)return vt(B,z,Xd(B,V),te);rf(B,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,z!==null&&z.tag===6?(d(B,z.sibling),te=b(z,V),te.return=B,B=te):(d(B,z),te=xg(V,B.mode,te),te.return=B,B=te),w(B)):d(B,z)}return function(B,z,V,te){try{_c=0;var _e=vt(B,z,V,te);return Zl=null,_e}catch(Ce){if(Ce===Gl||Ce===ef)throw Ce;var ct=gr(29,Ce,null,B.mode);return ct.lanes=te,ct.return=B,ct}finally{}}}var Uo=FS(!0),qS=FS(!1),Os=!1;function Rg(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ng(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 _s(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ds(o,a,d){var p=o.updateQueue;if(p===null)return null;if(p=p.shared,(pt&2)!==0){var b=p.pending;return b===null?a.next=a:(a.next=b.next,b.next=a),p.pending=a,a=Wd(o),MS(o,null,d),a}return Yd(o,p,a,d),Wd(o)}function Rc(o,a,d){if(a=a.updateQueue,a!==null&&(a=a.shared,(d&4194048)!==0)){var p=a.lanes;p&=o.pendingLanes,d|=p,a.lanes=d,Iv(o,d)}}function zg(o,a){var d=o.updateQueue,p=o.alternate;if(p!==null&&(p=p.updateQueue,d===p)){var b=null,x=null;if(d=d.firstBaseUpdate,d!==null){do{var w={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};x===null?b=x=w:x=x.next=w,d=d.next}while(d!==null);x===null?b=x=a:x=x.next=a}else b=x=a;d={baseState:p.baseState,firstBaseUpdate:b,lastBaseUpdate:x,shared:p.shared,callbacks:p.callbacks},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=a:o.next=a,d.lastBaseUpdate=a}var Lg=!1;function Nc(){if(Lg){var o=Wl;if(o!==null)throw o}}function zc(o,a,d,p){Lg=!1;var b=o.updateQueue;Os=!1;var x=b.firstBaseUpdate,w=b.lastBaseUpdate,A=b.shared.pending;if(A!==null){b.shared.pending=null;var R=A,P=R.next;R.next=null,w===null?x=P:w.next=P,w=R;var Q=o.alternate;Q!==null&&(Q=Q.updateQueue,A=Q.lastBaseUpdate,A!==w&&(A===null?Q.firstBaseUpdate=P:A.next=P,Q.lastBaseUpdate=R))}if(x!==null){var ne=b.baseState;w=0,Q=P=R=null,A=x;do{var q=A.lane&-536870913,W=q!==A.lane;if(W?(rt&q)===q:(p&q)===q){q!==0&&q===Yl&&(Lg=!0),Q!==null&&(Q=Q.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var ve=o,ze=A;q=a;var vt=d;switch(ze.tag){case 1:if(ve=ze.payload,typeof ve=="function"){ne=ve.call(vt,ne,q);break e}ne=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=ze.payload,q=typeof ve=="function"?ve.call(vt,ne,q):ve,q==null)break e;ne=m({},ne,q);break e;case 2:Os=!0}}q=A.callback,q!==null&&(o.flags|=64,W&&(o.flags|=8192),W=b.callbacks,W===null?b.callbacks=[q]:W.push(q))}else W={lane:q,tag:A.tag,payload:A.payload,callback:A.callback,next:null},Q===null?(P=Q=W,R=ne):Q=Q.next=W,w|=q;if(A=A.next,A===null){if(A=b.shared.pending,A===null)break;W=A,A=W.next,W.next=null,b.lastBaseUpdate=W,b.shared.pending=null}}while(!0);Q===null&&(R=ne),b.baseState=R,b.firstBaseUpdate=P,b.lastBaseUpdate=Q,x===null&&(b.shared.lanes=0),Is|=w,o.lanes=w,o.memoizedState=ne}}function KS(o,a){if(typeof o!="function")throw Error(r(191,o));o.call(a)}function YS(o,a){var d=o.callbacks;if(d!==null)for(o.callbacks=null,o=0;o<d.length;o++)KS(d[o],a)}var Jl=D(null),sf=D(0);function WS(o,a){o=is,T(sf,o),T(Jl,a),is=o|a.baseLanes}function Ig(){T(sf,is),T(Jl,Jl.current)}function jg(){is=sf.current,$(Jl),$(sf)}var yr=D(null),Ur=null;function Rs(o){var a=o.alternate;T(Yt,Yt.current&1),T(yr,o),Ur===null&&(a===null||Jl.current!==null||a.memoizedState!==null)&&(Ur=o)}function Bg(o){T(Yt,Yt.current),T(yr,o),Ur===null&&(Ur=o)}function GS(o){o.tag===22?(T(Yt,Yt.current),T(yr,o),Ur===null&&(Ur=o)):Ns()}function Ns(){T(Yt,Yt.current),T(yr,yr.current)}function br(o){$(yr),Ur===o&&(Ur=null),$(Yt)}var Yt=D(0);function of(o){for(var a=o;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Fy(d)||qy(d)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Zi=0,Pe=null,bt=null,Xt=null,lf=!1,Xl=!1,Ho=!1,af=0,Lc=0,Ql=null,ZN=0;function jt(){throw Error(r(321))}function Ug(o,a){if(a===null)return!1;for(var d=0;d<a.length&&d<o.length;d++)if(!mr(o[d],a[d]))return!1;return!0}function Hg(o,a,d,p,b,x){return Zi=x,Pe=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,I.H=o===null||o.memoizedState===null?Rw:ty,Ho=!1,x=d(p,b),Ho=!1,Xl&&(x=JS(a,d,p,b)),ZS(o),x}function ZS(o){I.H=Bc;var a=bt!==null&&bt.next!==null;if(Zi=0,Xt=bt=Pe=null,lf=!1,Lc=0,Ql=null,a)throw Error(r(300));o===null||Qt||(o=o.dependencies,o!==null&&Jd(o)&&(Qt=!0))}function JS(o,a,d,p){Pe=o;var b=0;do{if(Xl&&(Ql=null),Lc=0,Xl=!1,25<=b)throw Error(r(301));if(b+=1,Xt=bt=null,o.updateQueue!=null){var x=o.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}I.H=Nw,x=a(d,p)}while(Xl);return x}function JN(){var o=I.H,a=o.useState()[0];return a=typeof a.then=="function"?Ic(a):a,o=o.useState()[0],(bt!==null?bt.memoizedState:null)!==o&&(Pe.flags|=1024),a}function $g(){var o=af!==0;return af=0,o}function Vg(o,a,d){a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~d}function Pg(o){if(lf){for(o=o.memoizedState;o!==null;){var a=o.queue;a!==null&&(a.pending=null),o=o.next}lf=!1}Zi=0,Xt=bt=Pe=null,Xl=!1,Lc=af=0,Ql=null}function Pn(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xt===null?Pe.memoizedState=Xt=o:Xt=Xt.next=o,Xt}function Wt(){if(bt===null){var o=Pe.alternate;o=o!==null?o.memoizedState:null}else o=bt.next;var a=Xt===null?Pe.memoizedState:Xt.next;if(a!==null)Xt=a,bt=o;else{if(o===null)throw Pe.alternate===null?Error(r(467)):Error(r(310));bt=o,o={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Xt===null?Pe.memoizedState=Xt=o:Xt=Xt.next=o}return Xt}function cf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ic(o){var a=Lc;return Lc+=1,Ql===null&&(Ql=[]),o=$S(Ql,o,a),a=Pe,(Xt===null?a.memoizedState:Xt.next)===null&&(a=a.alternate,I.H=a===null||a.memoizedState===null?Rw:ty),o}function uf(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return Ic(o);if(o.$$typeof===L)return wn(o)}throw Error(r(438,String(o)))}function Fg(o){var a=null,d=Pe.updateQueue;if(d!==null&&(a=d.memoCache),a==null){var p=Pe.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(a={data:p.data.map(function(b){return b.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),d===null&&(d=cf(),Pe.updateQueue=d),d.memoCache=a,d=a.data[a.index],d===void 0)for(d=a.data[a.index]=Array(o),p=0;p<o;p++)d[p]=ce;return a.index++,d}function Ji(o,a){return typeof a=="function"?a(o):a}function df(o){var a=Wt();return qg(a,bt,o)}function qg(o,a,d){var p=o.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=d;var b=o.baseQueue,x=p.pending;if(x!==null){if(b!==null){var w=b.next;b.next=x.next,x.next=w}a.baseQueue=b=x,p.pending=null}if(x=o.baseState,b===null)o.memoizedState=x;else{a=b.next;var A=w=null,R=null,P=a,Q=!1;do{var ne=P.lane&-536870913;if(ne!==P.lane?(rt&ne)===ne:(Zi&ne)===ne){var q=P.revertLane;if(q===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),ne===Yl&&(Q=!0);else if((Zi&q)===q){P=P.next,q===Yl&&(Q=!0);continue}else ne={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},R===null?(A=R=ne,w=x):R=R.next=ne,Pe.lanes|=q,Is|=q;ne=P.action,Ho&&d(x,ne),x=P.hasEagerState?P.eagerState:d(x,ne)}else q={lane:ne,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},R===null?(A=R=q,w=x):R=R.next=q,Pe.lanes|=ne,Is|=ne;P=P.next}while(P!==null&&P!==a);if(R===null?w=x:R.next=A,!mr(x,o.memoizedState)&&(Qt=!0,Q&&(d=Wl,d!==null)))throw d;o.memoizedState=x,o.baseState=w,o.baseQueue=R,p.lastRenderedState=x}return b===null&&(p.lanes=0),[o.memoizedState,p.dispatch]}function Kg(o){var a=Wt(),d=a.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=o;var p=d.dispatch,b=d.pending,x=a.memoizedState;if(b!==null){d.pending=null;var w=b=b.next;do x=o(x,w.action),w=w.next;while(w!==b);mr(x,a.memoizedState)||(Qt=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),d.lastRenderedState=x}return[x,p]}function XS(o,a,d){var p=Pe,b=Wt(),x=ot;if(x){if(d===void 0)throw Error(r(407));d=d()}else d=a();var w=!mr((bt||b).memoizedState,d);if(w&&(b.memoizedState=d,Qt=!0),b=b.queue,Gg(tw.bind(null,p,b,o),[o]),b.getSnapshot!==a||w||Xt!==null&&Xt.memoizedState.tag&1){if(p.flags|=2048,ea(9,{destroy:void 0},ew.bind(null,p,b,d,a),null),St===null)throw Error(r(349));x||(Zi&127)!==0||QS(p,a,d)}return d}function QS(o,a,d){o.flags|=16384,o={getSnapshot:a,value:d},a=Pe.updateQueue,a===null?(a=cf(),Pe.updateQueue=a,a.stores=[o]):(d=a.stores,d===null?a.stores=[o]:d.push(o))}function ew(o,a,d,p){a.value=d,a.getSnapshot=p,nw(a)&&rw(o)}function tw(o,a,d){return d(function(){nw(a)&&rw(o)})}function nw(o){var a=o.getSnapshot;o=o.value;try{var d=a();return!mr(o,d)}catch{return!0}}function rw(o){var a=Do(o,2);a!==null&&sr(a,o,2)}function Yg(o){var a=Pn();if(typeof o=="function"){var d=o;if(o=d(),Ho){nt(!0);try{d()}finally{nt(!1)}}}return a.memoizedState=a.baseState=o,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ji,lastRenderedState:o},a}function iw(o,a,d,p){return o.baseState=d,qg(o,bt,typeof p=="function"?p:Ji)}function XN(o,a,d,p,b){if(pf(o))throw Error(r(485));if(o=a.action,o!==null){var x={payload:b,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};I.T!==null?d(!0):x.isTransition=!1,p(x),d=a.pending,d===null?(x.next=a.pending=x,sw(a,x)):(x.next=d.next,a.pending=d.next=x)}}function sw(o,a){var d=a.action,p=a.payload,b=o.state;if(a.isTransition){var x=I.T,w={};I.T=w;try{var A=d(b,p),R=I.S;R!==null&&R(w,A),ow(o,a,A)}catch(P){Wg(o,a,P)}finally{x!==null&&w.types!==null&&(x.types=w.types),I.T=x}}else try{x=d(b,p),ow(o,a,x)}catch(P){Wg(o,a,P)}}function ow(o,a,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(p){lw(o,a,p)},function(p){return Wg(o,a,p)}):lw(o,a,d)}function lw(o,a,d){a.status="fulfilled",a.value=d,aw(a),o.state=d,a=o.pending,a!==null&&(d=a.next,d===a?o.pending=null:(d=d.next,a.next=d,sw(o,d)))}function Wg(o,a,d){var p=o.pending;if(o.pending=null,p!==null){p=p.next;do a.status="rejected",a.reason=d,aw(a),a=a.next;while(a!==p)}o.action=null}function aw(o){o=o.listeners;for(var a=0;a<o.length;a++)(0,o[a])()}function cw(o,a){return a}function uw(o,a){if(ot){var d=St.formState;if(d!==null){e:{var p=Pe;if(ot){if(_t){t:{for(var b=_t,x=Br;b.nodeType!==8;){if(!x){b=null;break t}if(b=Hr(b.nextSibling),b===null){b=null;break t}}x=b.data,b=x==="F!"||x==="F"?b:null}if(b){_t=Hr(b.nextSibling),p=b.data==="F!";break e}}As(p)}p=!1}p&&(a=d[0])}}return d=Pn(),d.memoizedState=d.baseState=a,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cw,lastRenderedState:a},d.queue=p,d=Ow.bind(null,Pe,p),p.dispatch=d,p=Yg(!1),x=ey.bind(null,Pe,!1,p.queue),p=Pn(),b={state:a,dispatch:null,action:o,pending:null},p.queue=b,d=XN.bind(null,Pe,b,x,d),b.dispatch=d,p.memoizedState=o,[a,d,!1]}function dw(o){var a=Wt();return fw(a,bt,o)}function fw(o,a,d){if(a=qg(o,a,cw)[0],o=df(Ji)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var p=Ic(a)}catch(w){throw w===Gl?ef:w}else p=a;a=Wt();var b=a.queue,x=b.dispatch;return d!==a.memoizedState&&(Pe.flags|=2048,ea(9,{destroy:void 0},QN.bind(null,b,d),null)),[p,x,o]}function QN(o,a){o.action=a}function hw(o){var a=Wt(),d=bt;if(d!==null)return fw(a,d,o);Wt(),a=a.memoizedState,d=Wt();var p=d.queue.dispatch;return d.memoizedState=o,[a,p,!1]}function ea(o,a,d,p){return o={tag:o,create:d,deps:p,inst:a,next:null},a=Pe.updateQueue,a===null&&(a=cf(),Pe.updateQueue=a),d=a.lastEffect,d===null?a.lastEffect=o.next=o:(p=d.next,d.next=o,o.next=p,a.lastEffect=o),o}function pw(){return Wt().memoizedState}function ff(o,a,d,p){var b=Pn();Pe.flags|=o,b.memoizedState=ea(1|a,{destroy:void 0},d,p===void 0?null:p)}function hf(o,a,d,p){var b=Wt();p=p===void 0?null:p;var x=b.memoizedState.inst;bt!==null&&p!==null&&Ug(p,bt.memoizedState.deps)?b.memoizedState=ea(a,x,d,p):(Pe.flags|=o,b.memoizedState=ea(1|a,x,d,p))}function mw(o,a){ff(8390656,8,o,a)}function Gg(o,a){hf(2048,8,o,a)}function ez(o){Pe.flags|=4;var a=Pe.updateQueue;if(a===null)a=cf(),Pe.updateQueue=a,a.events=[o];else{var d=a.events;d===null?a.events=[o]:d.push(o)}}function gw(o){var a=Wt().memoizedState;return ez({ref:a,nextImpl:o}),function(){if((pt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function yw(o,a){return hf(4,2,o,a)}function bw(o,a){return hf(4,4,o,a)}function xw(o,a){if(typeof a=="function"){o=o();var d=a(o);return function(){typeof d=="function"?d():a(null)}}if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function vw(o,a,d){d=d!=null?d.concat([o]):null,hf(4,4,xw.bind(null,a,o),d)}function Zg(){}function Sw(o,a){var d=Wt();a=a===void 0?null:a;var p=d.memoizedState;return a!==null&&Ug(a,p[1])?p[0]:(d.memoizedState=[o,a],o)}function ww(o,a){var d=Wt();a=a===void 0?null:a;var p=d.memoizedState;if(a!==null&&Ug(a,p[1]))return p[0];if(p=o(),Ho){nt(!0);try{o()}finally{nt(!1)}}return d.memoizedState=[p,a],p}function Jg(o,a,d){return d===void 0||(Zi&1073741824)!==0&&(rt&261930)===0?o.memoizedState=a:(o.memoizedState=d,o=kk(),Pe.lanes|=o,Is|=o,d)}function kw(o,a,d,p){return mr(d,a)?d:Jl.current!==null?(o=Jg(o,d,p),mr(o,a)||(Qt=!0),o):(Zi&42)===0||(Zi&1073741824)!==0&&(rt&261930)===0?(Qt=!0,o.memoizedState=d):(o=kk(),Pe.lanes|=o,Is|=o,a)}function Cw(o,a,d,p,b){var x=Z.p;Z.p=x!==0&&8>x?x:8;var w=I.T,A={};I.T=A,ey(o,!1,a,d);try{var R=b(),P=I.S;if(P!==null&&P(A,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var Q=GN(R,p);jc(o,a,Q,Sr(o))}else jc(o,a,p,Sr(o))}catch(ne){jc(o,a,{then:function(){},status:"rejected",reason:ne},Sr())}finally{Z.p=x,w!==null&&A.types!==null&&(w.types=A.types),I.T=w}}function tz(){}function Xg(o,a,d,p){if(o.tag!==5)throw Error(r(476));var b=Ew(o).queue;Cw(o,b,a,me,d===null?tz:function(){return Tw(o),d(p)})}function Ew(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:Ji,lastRenderedState:me},next:null};var d={};return a.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ji,lastRenderedState:d},next:null},o.memoizedState=a,o=o.alternate,o!==null&&(o.memoizedState=a),a}function Tw(o){var a=Ew(o);a.next===null&&(a=o.alternate.memoizedState),jc(o,a.next.queue,{},Sr())}function Qg(){return wn(eu)}function Aw(){return Wt().memoizedState}function Mw(){return Wt().memoizedState}function nz(o){for(var a=o.return;a!==null;){switch(a.tag){case 24:case 3:var d=Sr();o=_s(d);var p=Ds(a,o,d);p!==null&&(sr(p,a,d),Rc(p,a,d)),a={cache:Mg()},o.payload=a;return}a=a.return}}function rz(o,a,d){var p=Sr();d={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},pf(o)?_w(a,d):(d=yg(o,a,d,p),d!==null&&(sr(d,o,p),Dw(d,a,p)))}function Ow(o,a,d){var p=Sr();jc(o,a,d,p)}function jc(o,a,d,p){var b={lane:p,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(pf(o))_w(a,b);else{var x=o.alternate;if(o.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var w=a.lastRenderedState,A=x(w,d);if(b.hasEagerState=!0,b.eagerState=A,mr(A,w))return Yd(o,a,b,0),St===null&&Kd(),!1}catch{}finally{}if(d=yg(o,a,b,p),d!==null)return sr(d,o,p),Dw(d,a,p),!0}return!1}function ey(o,a,d,p){if(p={lane:2,revertLane:Ry(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},pf(o)){if(a)throw Error(r(479))}else a=yg(o,d,p,2),a!==null&&sr(a,o,2)}function pf(o){var a=o.alternate;return o===Pe||a!==null&&a===Pe}function _w(o,a){Xl=lf=!0;var d=o.pending;d===null?a.next=a:(a.next=d.next,d.next=a),o.pending=a}function Dw(o,a,d){if((d&4194048)!==0){var p=a.lanes;p&=o.pendingLanes,d|=p,a.lanes=d,Iv(o,d)}}var Bc={readContext:wn,use:uf,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};Bc.useEffectEvent=jt;var Rw={readContext:wn,use:uf,useCallback:function(o,a){return Pn().memoizedState=[o,a===void 0?null:a],o},useContext:wn,useEffect:mw,useImperativeHandle:function(o,a,d){d=d!=null?d.concat([o]):null,ff(4194308,4,xw.bind(null,a,o),d)},useLayoutEffect:function(o,a){return ff(4194308,4,o,a)},useInsertionEffect:function(o,a){ff(4,2,o,a)},useMemo:function(o,a){var d=Pn();a=a===void 0?null:a;var p=o();if(Ho){nt(!0);try{o()}finally{nt(!1)}}return d.memoizedState=[p,a],p},useReducer:function(o,a,d){var p=Pn();if(d!==void 0){var b=d(a);if(Ho){nt(!0);try{d(a)}finally{nt(!1)}}}else b=a;return p.memoizedState=p.baseState=b,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:b},p.queue=o,o=o.dispatch=rz.bind(null,Pe,o),[p.memoizedState,o]},useRef:function(o){var a=Pn();return o={current:o},a.memoizedState=o},useState:function(o){o=Yg(o);var a=o.queue,d=Ow.bind(null,Pe,a);return a.dispatch=d,[o.memoizedState,d]},useDebugValue:Zg,useDeferredValue:function(o,a){var d=Pn();return Jg(d,o,a)},useTransition:function(){var o=Yg(!1);return o=Cw.bind(null,Pe,o.queue,!0,!1),Pn().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,a,d){var p=Pe,b=Pn();if(ot){if(d===void 0)throw Error(r(407));d=d()}else{if(d=a(),St===null)throw Error(r(349));(rt&127)!==0||QS(p,a,d)}b.memoizedState=d;var x={value:d,getSnapshot:a};return b.queue=x,mw(tw.bind(null,p,x,o),[o]),p.flags|=2048,ea(9,{destroy:void 0},ew.bind(null,p,x,d,a),null),d},useId:function(){var o=Pn(),a=St.identifierPrefix;if(ot){var d=bi,p=yi;d=(p&~(1<<32-Ge(p)-1)).toString(32)+d,a="_"+a+"R_"+d,d=af++,0<d&&(a+="H"+d.toString(32)),a+="_"}else d=ZN++,a="_"+a+"r_"+d.toString(32)+"_";return o.memoizedState=a},useHostTransitionStatus:Qg,useFormState:uw,useActionState:uw,useOptimistic:function(o){var a=Pn();a.memoizedState=a.baseState=o;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=d,a=ey.bind(null,Pe,!0,d),d.dispatch=a,[o,a]},useMemoCache:Fg,useCacheRefresh:function(){return Pn().memoizedState=nz.bind(null,Pe)},useEffectEvent:function(o){var a=Pn(),d={impl:o};return a.memoizedState=d,function(){if((pt&2)!==0)throw Error(r(440));return d.impl.apply(void 0,arguments)}}},ty={readContext:wn,use:uf,useCallback:Sw,useContext:wn,useEffect:Gg,useImperativeHandle:vw,useInsertionEffect:yw,useLayoutEffect:bw,useMemo:ww,useReducer:df,useRef:pw,useState:function(){return df(Ji)},useDebugValue:Zg,useDeferredValue:function(o,a){var d=Wt();return kw(d,bt.memoizedState,o,a)},useTransition:function(){var o=df(Ji)[0],a=Wt().memoizedState;return[typeof o=="boolean"?o:Ic(o),a]},useSyncExternalStore:XS,useId:Aw,useHostTransitionStatus:Qg,useFormState:dw,useActionState:dw,useOptimistic:function(o,a){var d=Wt();return iw(d,bt,o,a)},useMemoCache:Fg,useCacheRefresh:Mw};ty.useEffectEvent=gw;var Nw={readContext:wn,use:uf,useCallback:Sw,useContext:wn,useEffect:Gg,useImperativeHandle:vw,useInsertionEffect:yw,useLayoutEffect:bw,useMemo:ww,useReducer:Kg,useRef:pw,useState:function(){return Kg(Ji)},useDebugValue:Zg,useDeferredValue:function(o,a){var d=Wt();return bt===null?Jg(d,o,a):kw(d,bt.memoizedState,o,a)},useTransition:function(){var o=Kg(Ji)[0],a=Wt().memoizedState;return[typeof o=="boolean"?o:Ic(o),a]},useSyncExternalStore:XS,useId:Aw,useHostTransitionStatus:Qg,useFormState:hw,useActionState:hw,useOptimistic:function(o,a){var d=Wt();return bt!==null?iw(d,bt,o,a):(d.baseState=o,[o,d.queue.dispatch])},useMemoCache:Fg,useCacheRefresh:Mw};Nw.useEffectEvent=gw;function ny(o,a,d,p){a=o.memoizedState,d=d(p,a),d=d==null?a:m({},a,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var ry={enqueueSetState:function(o,a,d){o=o._reactInternals;var p=Sr(),b=_s(p);b.payload=a,d!=null&&(b.callback=d),a=Ds(o,b,p),a!==null&&(sr(a,o,p),Rc(a,o,p))},enqueueReplaceState:function(o,a,d){o=o._reactInternals;var p=Sr(),b=_s(p);b.tag=1,b.payload=a,d!=null&&(b.callback=d),a=Ds(o,b,p),a!==null&&(sr(a,o,p),Rc(a,o,p))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var d=Sr(),p=_s(d);p.tag=2,a!=null&&(p.callback=a),a=Ds(o,p,d),a!==null&&(sr(a,o,d),Rc(a,o,d))}};function zw(o,a,d,p,b,x,w){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(p,x,w):a.prototype&&a.prototype.isPureReactComponent?!Cc(d,p)||!Cc(b,x):!0}function Lw(o,a,d,p){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(d,p),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(d,p),a.state!==o&&ry.enqueueReplaceState(a,a.state,null)}function $o(o,a){var d=a;if("ref"in a){d={};for(var p in a)p!=="ref"&&(d[p]=a[p])}if(o=o.defaultProps){d===a&&(d=m({},d));for(var b in o)d[b]===void 0&&(d[b]=o[b])}return d}function Iw(o){qd(o)}function jw(o){console.error(o)}function Bw(o){qd(o)}function mf(o,a){try{var d=o.onUncaughtError;d(a.value,{componentStack:a.stack})}catch(p){setTimeout(function(){throw p})}}function Uw(o,a,d){try{var p=o.onCaughtError;p(d.value,{componentStack:d.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function iy(o,a,d){return d=_s(d),d.tag=3,d.payload={element:null},d.callback=function(){mf(o,a)},d}function Hw(o){return o=_s(o),o.tag=3,o}function $w(o,a,d,p){var b=d.type.getDerivedStateFromError;if(typeof b=="function"){var x=p.value;o.payload=function(){return b(x)},o.callback=function(){Uw(a,d,p)}}var w=d.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(o.callback=function(){Uw(a,d,p),typeof b!="function"&&(js===null?js=new Set([this]):js.add(this));var A=p.stack;this.componentDidCatch(p.value,{componentStack:A!==null?A:""})})}function iz(o,a,d,p,b){if(d.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(a=d.alternate,a!==null&&Kl(a,d,b,!0),d=yr.current,d!==null){switch(d.tag){case 31:case 13:return Ur===null?Af():d.alternate===null&&Bt===0&&(Bt=3),d.flags&=-257,d.flags|=65536,d.lanes=b,p===tf?d.flags|=16384:(a=d.updateQueue,a===null?d.updateQueue=new Set([p]):a.add(p),Oy(o,p,b)),!1;case 22:return d.flags|=65536,p===tf?d.flags|=16384:(a=d.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([p])},d.updateQueue=a):(d=a.retryQueue,d===null?a.retryQueue=new Set([p]):d.add(p)),Oy(o,p,b)),!1}throw Error(r(435,d.tag))}return Oy(o,p,b),Af(),!1}if(ot)return a=yr.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=b,p!==kg&&(o=Error(r(422),{cause:p}),Ac(Lr(o,d)))):(p!==kg&&(a=Error(r(423),{cause:p}),Ac(Lr(a,d))),o=o.current.alternate,o.flags|=65536,b&=-b,o.lanes|=b,p=Lr(p,d),b=iy(o.stateNode,p,b),zg(o,b),Bt!==4&&(Bt=2)),!1;var x=Error(r(520),{cause:p});if(x=Lr(x,d),Kc===null?Kc=[x]:Kc.push(x),Bt!==4&&(Bt=2),a===null)return!0;p=Lr(p,d),d=a;do{switch(d.tag){case 3:return d.flags|=65536,o=b&-b,d.lanes|=o,o=iy(d.stateNode,p,o),zg(d,o),!1;case 1:if(a=d.type,x=d.stateNode,(d.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(js===null||!js.has(x))))return d.flags|=65536,b&=-b,d.lanes|=b,b=Hw(b),$w(b,o,d,p),zg(d,b),!1}d=d.return}while(d!==null);return!1}var sy=Error(r(461)),Qt=!1;function kn(o,a,d,p){a.child=o===null?qS(a,null,d,p):Uo(a,o.child,d,p)}function Vw(o,a,d,p,b){d=d.render;var x=a.ref;if("ref"in p){var w={};for(var A in p)A!=="ref"&&(w[A]=p[A])}else w=p;return Lo(a),p=Hg(o,a,d,w,x,b),A=$g(),o!==null&&!Qt?(Vg(o,a,b),Xi(o,a,b)):(ot&&A&&Sg(a),a.flags|=1,kn(o,a,p,b),a.child)}function Pw(o,a,d,p,b){if(o===null){var x=d.type;return typeof x=="function"&&!bg(x)&&x.defaultProps===void 0&&d.compare===null?(a.tag=15,a.type=x,Fw(o,a,x,p,b)):(o=Gd(d.type,null,p,a,a.mode,b),o.ref=a.ref,o.return=a,a.child=o)}if(x=o.child,!hy(o,b)){var w=x.memoizedProps;if(d=d.compare,d=d!==null?d:Cc,d(w,p)&&o.ref===a.ref)return Xi(o,a,b)}return a.flags|=1,o=Ki(x,p),o.ref=a.ref,o.return=a,a.child=o}function Fw(o,a,d,p,b){if(o!==null){var x=o.memoizedProps;if(Cc(x,p)&&o.ref===a.ref)if(Qt=!1,a.pendingProps=p=x,hy(o,b))(o.flags&131072)!==0&&(Qt=!0);else return a.lanes=o.lanes,Xi(o,a,b)}return oy(o,a,d,p,b)}function qw(o,a,d,p){var b=p.children,x=o!==null?o.memoizedState:null;if(o===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|d:d,o!==null){for(p=a.child=o.child,b=0;p!==null;)b=b|p.lanes|p.childLanes,p=p.sibling;p=b&~x}else p=0,a.child=null;return Kw(o,a,x,d,p)}if((d&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},o!==null&&Qd(a,x!==null?x.cachePool:null),x!==null?WS(a,x):Ig(),GS(a);else return p=a.lanes=536870912,Kw(o,a,x!==null?x.baseLanes|d:d,d,p)}else x!==null?(Qd(a,x.cachePool),WS(a,x),Ns(),a.memoizedState=null):(o!==null&&Qd(a,null),Ig(),Ns());return kn(o,a,b,d),a.child}function Uc(o,a){return o!==null&&o.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Kw(o,a,d,p,b){var x=_g();return x=x===null?null:{parent:Jt._currentValue,pool:x},a.memoizedState={baseLanes:d,cachePool:x},o!==null&&Qd(a,null),Ig(),GS(a),o!==null&&Kl(o,a,p,!0),a.childLanes=b,null}function gf(o,a){return a=bf({mode:a.mode,children:a.children},o.mode),a.ref=o.ref,o.child=a,a.return=o,a}function Yw(o,a,d){return Uo(a,o.child,null,d),o=gf(a,a.pendingProps),o.flags|=2,br(a),a.memoizedState=null,o}function sz(o,a,d){var p=a.pendingProps,b=(a.flags&128)!==0;if(a.flags&=-129,o===null){if(ot){if(p.mode==="hidden")return o=gf(a,p),a.lanes=536870912,Uc(null,o);if(Bg(a),(o=_t)?(o=sC(o,Br),o=o!==null&&o.data==="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:Es!==null?{id:yi,overflow:bi}:null,retryLane:536870912,hydrationErrors:null},d=_S(o),d.return=a,a.child=d,Sn=a,_t=null)):o=null,o===null)throw As(a);return a.lanes=536870912,null}return gf(a,p)}var x=o.memoizedState;if(x!==null){var w=x.dehydrated;if(Bg(a),b)if(a.flags&256)a.flags&=-257,a=Yw(o,a,d);else if(a.memoizedState!==null)a.child=o.child,a.flags|=128,a=null;else throw Error(r(558));else if(Qt||Kl(o,a,d,!1),b=(d&o.childLanes)!==0,Qt||b){if(p=St,p!==null&&(w=jv(p,d),w!==0&&w!==x.retryLane))throw x.retryLane=w,Do(o,w),sr(p,o,w),sy;Af(),a=Yw(o,a,d)}else o=x.treeContext,_t=Hr(w.nextSibling),Sn=a,ot=!0,Ts=null,Br=!1,o!==null&&NS(a,o),a=gf(a,p),a.flags|=4096;return a}return o=Ki(o.child,{mode:p.mode,children:p.children}),o.ref=a.ref,a.child=o,o.return=a,o}function yf(o,a){var d=a.ref;if(d===null)o!==null&&o.ref!==null&&(a.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(r(284));(o===null||o.ref!==d)&&(a.flags|=4194816)}}function oy(o,a,d,p,b){return Lo(a),d=Hg(o,a,d,p,void 0,b),p=$g(),o!==null&&!Qt?(Vg(o,a,b),Xi(o,a,b)):(ot&&p&&Sg(a),a.flags|=1,kn(o,a,d,b),a.child)}function Ww(o,a,d,p,b,x){return Lo(a),a.updateQueue=null,d=JS(a,p,d,b),ZS(o),p=$g(),o!==null&&!Qt?(Vg(o,a,x),Xi(o,a,x)):(ot&&p&&Sg(a),a.flags|=1,kn(o,a,d,x),a.child)}function Gw(o,a,d,p,b){if(Lo(a),a.stateNode===null){var x=Vl,w=d.contextType;typeof w=="object"&&w!==null&&(x=wn(w)),x=new d(p,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=ry,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=p,x.state=a.memoizedState,x.refs={},Rg(a),w=d.contextType,x.context=typeof w=="object"&&w!==null?wn(w):Vl,x.state=a.memoizedState,w=d.getDerivedStateFromProps,typeof w=="function"&&(ny(a,d,w,p),x.state=a.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&ry.enqueueReplaceState(x,x.state,null),zc(a,p,x,b),Nc(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),p=!0}else if(o===null){x=a.stateNode;var A=a.memoizedProps,R=$o(d,A);x.props=R;var P=x.context,Q=d.contextType;w=Vl,typeof Q=="object"&&Q!==null&&(w=wn(Q));var ne=d.getDerivedStateFromProps;Q=typeof ne=="function"||typeof x.getSnapshotBeforeUpdate=="function",A=a.pendingProps!==A,Q||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(A||P!==w)&&Lw(a,x,p,w),Os=!1;var q=a.memoizedState;x.state=q,zc(a,p,x,b),Nc(),P=a.memoizedState,A||q!==P||Os?(typeof ne=="function"&&(ny(a,d,ne,p),P=a.memoizedState),(R=Os||zw(a,d,R,p,q,P,w))?(Q||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=p,a.memoizedState=P),x.props=p,x.state=P,x.context=w,p=R):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),p=!1)}else{x=a.stateNode,Ng(o,a),w=a.memoizedProps,Q=$o(d,w),x.props=Q,ne=a.pendingProps,q=x.context,P=d.contextType,R=Vl,typeof P=="object"&&P!==null&&(R=wn(P)),A=d.getDerivedStateFromProps,(P=typeof A=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==ne||q!==R)&&Lw(a,x,p,R),Os=!1,q=a.memoizedState,x.state=q,zc(a,p,x,b),Nc();var W=a.memoizedState;w!==ne||q!==W||Os||o!==null&&o.dependencies!==null&&Jd(o.dependencies)?(typeof A=="function"&&(ny(a,d,A,p),W=a.memoizedState),(Q=Os||zw(a,d,Q,p,q,W,R)||o!==null&&o.dependencies!==null&&Jd(o.dependencies))?(P||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(p,W,R),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(p,W,R)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===o.memoizedProps&&q===o.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===o.memoizedProps&&q===o.memoizedState||(a.flags|=1024),a.memoizedProps=p,a.memoizedState=W),x.props=p,x.state=W,x.context=R,p=Q):(typeof x.componentDidUpdate!="function"||w===o.memoizedProps&&q===o.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===o.memoizedProps&&q===o.memoizedState||(a.flags|=1024),p=!1)}return x=p,yf(o,a),p=(a.flags&128)!==0,x||p?(x=a.stateNode,d=p&&typeof d.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,o!==null&&p?(a.child=Uo(a,o.child,null,b),a.child=Uo(a,null,d,b)):kn(o,a,d,b),a.memoizedState=x.state,o=a.child):o=Xi(o,a,b),o}function Zw(o,a,d,p){return No(),a.flags|=256,kn(o,a,d,p),a.child}var ly={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ay(o){return{baseLanes:o,cachePool:US()}}function cy(o,a,d){return o=o!==null?o.childLanes&~d:0,a&&(o|=vr),o}function Jw(o,a,d){var p=a.pendingProps,b=!1,x=(a.flags&128)!==0,w;if((w=x)||(w=o!==null&&o.memoizedState===null?!1:(Yt.current&2)!==0),w&&(b=!0,a.flags&=-129),w=(a.flags&32)!==0,a.flags&=-33,o===null){if(ot){if(b?Rs(a):Ns(),(o=_t)?(o=sC(o,Br),o=o!==null&&o.data!=="&"?o:null,o!==null&&(a.memoizedState={dehydrated:o,treeContext:Es!==null?{id:yi,overflow:bi}:null,retryLane:536870912,hydrationErrors:null},d=_S(o),d.return=a,a.child=d,Sn=a,_t=null)):o=null,o===null)throw As(a);return qy(o)?a.lanes=32:a.lanes=536870912,null}var A=p.children;return p=p.fallback,b?(Ns(),b=a.mode,A=bf({mode:"hidden",children:A},b),p=Ro(p,b,d,null),A.return=a,p.return=a,A.sibling=p,a.child=A,p=a.child,p.memoizedState=ay(d),p.childLanes=cy(o,w,d),a.memoizedState=ly,Uc(null,p)):(Rs(a),uy(a,A))}var R=o.memoizedState;if(R!==null&&(A=R.dehydrated,A!==null)){if(x)a.flags&256?(Rs(a),a.flags&=-257,a=dy(o,a,d)):a.memoizedState!==null?(Ns(),a.child=o.child,a.flags|=128,a=null):(Ns(),A=p.fallback,b=a.mode,p=bf({mode:"visible",children:p.children},b),A=Ro(A,b,d,null),A.flags|=2,p.return=a,A.return=a,p.sibling=A,a.child=p,Uo(a,o.child,null,d),p=a.child,p.memoizedState=ay(d),p.childLanes=cy(o,w,d),a.memoizedState=ly,a=Uc(null,p));else if(Rs(a),qy(A)){if(w=A.nextSibling&&A.nextSibling.dataset,w)var P=w.dgst;w=P,p=Error(r(419)),p.stack="",p.digest=w,Ac({value:p,source:null,stack:null}),a=dy(o,a,d)}else if(Qt||Kl(o,a,d,!1),w=(d&o.childLanes)!==0,Qt||w){if(w=St,w!==null&&(p=jv(w,d),p!==0&&p!==R.retryLane))throw R.retryLane=p,Do(o,p),sr(w,o,p),sy;Fy(A)||Af(),a=dy(o,a,d)}else Fy(A)?(a.flags|=192,a.child=o.child,a=null):(o=R.treeContext,_t=Hr(A.nextSibling),Sn=a,ot=!0,Ts=null,Br=!1,o!==null&&NS(a,o),a=uy(a,p.children),a.flags|=4096);return a}return b?(Ns(),A=p.fallback,b=a.mode,R=o.child,P=R.sibling,p=Ki(R,{mode:"hidden",children:p.children}),p.subtreeFlags=R.subtreeFlags&65011712,P!==null?A=Ki(P,A):(A=Ro(A,b,d,null),A.flags|=2),A.return=a,p.return=a,p.sibling=A,a.child=p,Uc(null,p),p=a.child,A=o.child.memoizedState,A===null?A=ay(d):(b=A.cachePool,b!==null?(R=Jt._currentValue,b=b.parent!==R?{parent:R,pool:R}:b):b=US(),A={baseLanes:A.baseLanes|d,cachePool:b}),p.memoizedState=A,p.childLanes=cy(o,w,d),a.memoizedState=ly,Uc(o.child,p)):(Rs(a),d=o.child,o=d.sibling,d=Ki(d,{mode:"visible",children:p.children}),d.return=a,d.sibling=null,o!==null&&(w=a.deletions,w===null?(a.deletions=[o],a.flags|=16):w.push(o)),a.child=d,a.memoizedState=null,d)}function uy(o,a){return a=bf({mode:"visible",children:a},o.mode),a.return=o,o.child=a}function bf(o,a){return o=gr(22,o,null,a),o.lanes=0,o}function dy(o,a,d){return Uo(a,o.child,null,d),o=uy(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function Xw(o,a,d){o.lanes|=a;var p=o.alternate;p!==null&&(p.lanes|=a),Tg(o.return,a,d)}function fy(o,a,d,p,b,x){var w=o.memoizedState;w===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:p,tail:d,tailMode:b,treeForkCount:x}:(w.isBackwards=a,w.rendering=null,w.renderingStartTime=0,w.last=p,w.tail=d,w.tailMode=b,w.treeForkCount=x)}function Qw(o,a,d){var p=a.pendingProps,b=p.revealOrder,x=p.tail;p=p.children;var w=Yt.current,A=(w&2)!==0;if(A?(w=w&1|2,a.flags|=128):w&=1,T(Yt,w),kn(o,a,p,d),p=ot?Tc:0,!A&&o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Xw(o,d,a);else if(o.tag===19)Xw(o,d,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break e;for(;o.sibling===null;){if(o.return===null||o.return===a)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(b){case"forwards":for(d=a.child,b=null;d!==null;)o=d.alternate,o!==null&&of(o)===null&&(b=d),d=d.sibling;d=b,d===null?(b=a.child,a.child=null):(b=d.sibling,d.sibling=null),fy(a,!1,b,d,x,p);break;case"backwards":case"unstable_legacy-backwards":for(d=null,b=a.child,a.child=null;b!==null;){if(o=b.alternate,o!==null&&of(o)===null){a.child=b;break}o=b.sibling,b.sibling=d,d=b,b=o}fy(a,!0,d,null,x,p);break;case"together":fy(a,!1,null,null,void 0,p);break;default:a.memoizedState=null}return a.child}function Xi(o,a,d){if(o!==null&&(a.dependencies=o.dependencies),Is|=a.lanes,(d&a.childLanes)===0)if(o!==null){if(Kl(o,a,d,!1),(d&a.childLanes)===0)return null}else return null;if(o!==null&&a.child!==o.child)throw Error(r(153));if(a.child!==null){for(o=a.child,d=Ki(o,o.pendingProps),a.child=d,d.return=a;o.sibling!==null;)o=o.sibling,d=d.sibling=Ki(o,o.pendingProps),d.return=a;d.sibling=null}return a.child}function hy(o,a){return(o.lanes&a)!==0?!0:(o=o.dependencies,!!(o!==null&&Jd(o)))}function oz(o,a,d){switch(a.tag){case 3:Be(a,a.stateNode.containerInfo),Ms(a,Jt,o.memoizedState.cache),No();break;case 27:case 5:Xe(a);break;case 4:Be(a,a.stateNode.containerInfo);break;case 10:Ms(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Bg(a),null;break;case 13:var p=a.memoizedState;if(p!==null)return p.dehydrated!==null?(Rs(a),a.flags|=128,null):(d&a.child.childLanes)!==0?Jw(o,a,d):(Rs(a),o=Xi(o,a,d),o!==null?o.sibling:null);Rs(a);break;case 19:var b=(o.flags&128)!==0;if(p=(d&a.childLanes)!==0,p||(Kl(o,a,d,!1),p=(d&a.childLanes)!==0),b){if(p)return Qw(o,a,d);a.flags|=128}if(b=a.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),T(Yt,Yt.current),p)break;return null;case 22:return a.lanes=0,qw(o,a,d,a.pendingProps);case 24:Ms(a,Jt,o.memoizedState.cache)}return Xi(o,a,d)}function ek(o,a,d){if(o!==null)if(o.memoizedProps!==a.pendingProps)Qt=!0;else{if(!hy(o,d)&&(a.flags&128)===0)return Qt=!1,oz(o,a,d);Qt=(o.flags&131072)!==0}else Qt=!1,ot&&(a.flags&1048576)!==0&&RS(a,Tc,a.index);switch(a.lanes=0,a.tag){case 16:e:{var p=a.pendingProps;if(o=jo(a.elementType),a.type=o,typeof o=="function")bg(o)?(p=$o(o,p),a.tag=1,a=Gw(null,a,o,p,d)):(a.tag=0,a=oy(null,a,o,p,d));else{if(o!=null){var b=o.$$typeof;if(b===J){a.tag=11,a=Vw(null,a,o,p,d);break e}else if(b===N){a.tag=14,a=Pw(null,a,o,p,d);break e}}throw a=pe(o)||o,Error(r(306,a,""))}}return a;case 0:return oy(o,a,a.type,a.pendingProps,d);case 1:return p=a.type,b=$o(p,a.pendingProps),Gw(o,a,p,b,d);case 3:e:{if(Be(a,a.stateNode.containerInfo),o===null)throw Error(r(387));p=a.pendingProps;var x=a.memoizedState;b=x.element,Ng(o,a),zc(a,p,null,d);var w=a.memoizedState;if(p=w.cache,Ms(a,Jt,p),p!==x.cache&&Ag(a,[Jt],d,!0),Nc(),p=w.element,x.isDehydrated)if(x={element:p,isDehydrated:!1,cache:w.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=Zw(o,a,p,d);break e}else if(p!==b){b=Lr(Error(r(424)),a),Ac(b),a=Zw(o,a,p,d);break e}else{switch(o=a.stateNode.containerInfo,o.nodeType){case 9:o=o.body;break;default:o=o.nodeName==="HTML"?o.ownerDocument.body:o}for(_t=Hr(o.firstChild),Sn=a,ot=!0,Ts=null,Br=!0,d=qS(a,null,p,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling}else{if(No(),p===b){a=Xi(o,a,d);break e}kn(o,a,p,d)}a=a.child}return a;case 26:return yf(o,a),o===null?(d=dC(a.type,null,a.pendingProps,null))?a.memoizedState=d:ot||(d=a.type,o=a.pendingProps,p=zf(le.current).createElement(d),p[vn]=a,p[Qn]=o,Cn(p,d,o),un(p),a.stateNode=p):a.memoizedState=dC(a.type,o.memoizedProps,a.pendingProps,o.memoizedState),null;case 27:return Xe(a),o===null&&ot&&(p=a.stateNode=aC(a.type,a.pendingProps,le.current),Sn=a,Br=!0,b=_t,$s(a.type)?(Ky=b,_t=Hr(p.firstChild)):_t=b),kn(o,a,a.pendingProps.children,d),yf(o,a),o===null&&(a.flags|=4194304),a.child;case 5:return o===null&&ot&&((b=p=_t)&&(p=Iz(p,a.type,a.pendingProps,Br),p!==null?(a.stateNode=p,Sn=a,_t=Hr(p.firstChild),Br=!1,b=!0):b=!1),b||As(a)),Xe(a),b=a.type,x=a.pendingProps,w=o!==null?o.memoizedProps:null,p=x.children,$y(b,x)?p=null:w!==null&&$y(b,w)&&(a.flags|=32),a.memoizedState!==null&&(b=Hg(o,a,JN,null,null,d),eu._currentValue=b),yf(o,a),kn(o,a,p,d),a.child;case 6:return o===null&&ot&&((o=d=_t)&&(d=jz(d,a.pendingProps,Br),d!==null?(a.stateNode=d,Sn=a,_t=null,o=!0):o=!1),o||As(a)),null;case 13:return Jw(o,a,d);case 4:return Be(a,a.stateNode.containerInfo),p=a.pendingProps,o===null?a.child=Uo(a,null,p,d):kn(o,a,p,d),a.child;case 11:return Vw(o,a,a.type,a.pendingProps,d);case 7:return kn(o,a,a.pendingProps,d),a.child;case 8:return kn(o,a,a.pendingProps.children,d),a.child;case 12:return kn(o,a,a.pendingProps.children,d),a.child;case 10:return p=a.pendingProps,Ms(a,a.type,p.value),kn(o,a,p.children,d),a.child;case 9:return b=a.type._context,p=a.pendingProps.children,Lo(a),b=wn(b),p=p(b),a.flags|=1,kn(o,a,p,d),a.child;case 14:return Pw(o,a,a.type,a.pendingProps,d);case 15:return Fw(o,a,a.type,a.pendingProps,d);case 19:return Qw(o,a,d);case 31:return sz(o,a,d);case 22:return qw(o,a,d,a.pendingProps);case 24:return Lo(a),p=wn(Jt),o===null?(b=_g(),b===null&&(b=St,x=Mg(),b.pooledCache=x,x.refCount++,x!==null&&(b.pooledCacheLanes|=d),b=x),a.memoizedState={parent:p,cache:b},Rg(a),Ms(a,Jt,b)):((o.lanes&d)!==0&&(Ng(o,a),zc(a,null,null,d),Nc()),b=o.memoizedState,x=a.memoizedState,b.parent!==p?(b={parent:p,cache:p},a.memoizedState=b,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=b),Ms(a,Jt,p)):(p=x.cache,Ms(a,Jt,p),p!==b.cache&&Ag(a,[Jt],d,!0))),kn(o,a,a.pendingProps.children,d),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Qi(o){o.flags|=4}function py(o,a,d,p,b){if((a=(o.mode&32)!==0)&&(a=!1),a){if(o.flags|=16777216,(b&335544128)===b)if(o.stateNode.complete)o.flags|=8192;else if(Ak())o.flags|=8192;else throw Bo=tf,Dg}else o.flags&=-16777217}function tk(o,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!gC(a))if(Ak())o.flags|=8192;else throw Bo=tf,Dg}function xf(o,a){a!==null&&(o.flags|=4),o.flags&16384&&(a=o.tag!==22?Al():536870912,o.lanes|=a,ia|=a)}function Hc(o,a){if(!ot)switch(o.tailMode){case"hidden":a=o.tail;for(var d=null;a!==null;)a.alternate!==null&&(d=a),a=a.sibling;d===null?o.tail=null:d.sibling=null;break;case"collapsed":d=o.tail;for(var p=null;d!==null;)d.alternate!==null&&(p=d),d=d.sibling;p===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:p.sibling=null}}function Dt(o){var a=o.alternate!==null&&o.alternate.child===o.child,d=0,p=0;if(a)for(var b=o.child;b!==null;)d|=b.lanes|b.childLanes,p|=b.subtreeFlags&65011712,p|=b.flags&65011712,b.return=o,b=b.sibling;else for(b=o.child;b!==null;)d|=b.lanes|b.childLanes,p|=b.subtreeFlags,p|=b.flags,b.return=o,b=b.sibling;return o.subtreeFlags|=p,o.childLanes=d,a}function lz(o,a,d){var p=a.pendingProps;switch(wg(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(a),null;case 1:return Dt(a),null;case 3:return d=a.stateNode,p=null,o!==null&&(p=o.memoizedState.cache),a.memoizedState.cache!==p&&(a.flags|=2048),Gi(Jt),je(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(o===null||o.child===null)&&(ql(a)?Qi(a):o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Cg())),Dt(a),null;case 26:var b=a.type,x=a.memoizedState;return o===null?(Qi(a),x!==null?(Dt(a),tk(a,x)):(Dt(a),py(a,b,null,p,d))):x?x!==o.memoizedState?(Qi(a),Dt(a),tk(a,x)):(Dt(a),a.flags&=-16777217):(o=o.memoizedProps,o!==p&&Qi(a),Dt(a),py(a,b,o,p,d)),null;case 27:if(Oe(a),d=le.current,b=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==p&&Qi(a);else{if(!p){if(a.stateNode===null)throw Error(r(166));return Dt(a),null}o=F.current,ql(a)?zS(a):(o=aC(b,p,d),a.stateNode=o,Qi(a))}return Dt(a),null;case 5:if(Oe(a),b=a.type,o!==null&&a.stateNode!=null)o.memoizedProps!==p&&Qi(a);else{if(!p){if(a.stateNode===null)throw Error(r(166));return Dt(a),null}if(x=F.current,ql(a))zS(a);else{var w=zf(le.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof p.is=="string"?w.createElement("select",{is:p.is}):w.createElement("select"),p.multiple?x.multiple=!0:p.size&&(x.size=p.size);break;default:x=typeof p.is=="string"?w.createElement(b,{is:p.is}):w.createElement(b)}}x[vn]=a,x[Qn]=p;e:for(w=a.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===a)break e;for(;w.sibling===null;){if(w.return===null||w.return===a)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}a.stateNode=x;e:switch(Cn(x,b,p),b){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&Qi(a)}}return Dt(a),py(a,a.type,o===null?null:o.memoizedProps,a.pendingProps,d),null;case 6:if(o&&a.stateNode!=null)o.memoizedProps!==p&&Qi(a);else{if(typeof p!="string"&&a.stateNode===null)throw Error(r(166));if(o=le.current,ql(a)){if(o=a.stateNode,d=a.memoizedProps,p=null,b=Sn,b!==null)switch(b.tag){case 27:case 5:p=b.memoizedProps}o[vn]=a,o=!!(o.nodeValue===d||p!==null&&p.suppressHydrationWarning===!0||Jk(o.nodeValue,d)),o||As(a,!0)}else o=zf(o).createTextNode(p),o[vn]=a,a.stateNode=o}return Dt(a),null;case 31:if(d=a.memoizedState,o===null||o.memoizedState!==null){if(p=ql(a),d!==null){if(o===null){if(!p)throw Error(r(318));if(o=a.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(r(557));o[vn]=a}else No(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Dt(a),o=!1}else d=Cg(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=d),o=!0;if(!o)return a.flags&256?(br(a),a):(br(a),null);if((a.flags&128)!==0)throw Error(r(558))}return Dt(a),null;case 13:if(p=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(b=ql(a),p!==null&&p.dehydrated!==null){if(o===null){if(!b)throw Error(r(318));if(b=a.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(r(317));b[vn]=a}else No(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Dt(a),b=!1}else b=Cg(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=b),b=!0;if(!b)return a.flags&256?(br(a),a):(br(a),null)}return br(a),(a.flags&128)!==0?(a.lanes=d,a):(d=p!==null,o=o!==null&&o.memoizedState!==null,d&&(p=a.child,b=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(b=p.alternate.memoizedState.cachePool.pool),x=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(x=p.memoizedState.cachePool.pool),x!==b&&(p.flags|=2048)),d!==o&&d&&(a.child.flags|=8192),xf(a,a.updateQueue),Dt(a),null);case 4:return je(),o===null&&Iy(a.stateNode.containerInfo),Dt(a),null;case 10:return Gi(a.type),Dt(a),null;case 19:if($(Yt),p=a.memoizedState,p===null)return Dt(a),null;if(b=(a.flags&128)!==0,x=p.rendering,x===null)if(b)Hc(p,!1);else{if(Bt!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(x=of(o),x!==null){for(a.flags|=128,Hc(p,!1),o=x.updateQueue,a.updateQueue=o,xf(a,o),a.subtreeFlags=0,o=d,d=a.child;d!==null;)OS(d,o),d=d.sibling;return T(Yt,Yt.current&1|2),ot&&Yi(a,p.treeForkCount),a.child}o=o.sibling}p.tail!==null&&qt()>Cf&&(a.flags|=128,b=!0,Hc(p,!1),a.lanes=4194304)}else{if(!b)if(o=of(x),o!==null){if(a.flags|=128,b=!0,o=o.updateQueue,a.updateQueue=o,xf(a,o),Hc(p,!0),p.tail===null&&p.tailMode==="hidden"&&!x.alternate&&!ot)return Dt(a),null}else 2*qt()-p.renderingStartTime>Cf&&d!==536870912&&(a.flags|=128,b=!0,Hc(p,!1),a.lanes=4194304);p.isBackwards?(x.sibling=a.child,a.child=x):(o=p.last,o!==null?o.sibling=x:a.child=x,p.last=x)}return p.tail!==null?(o=p.tail,p.rendering=o,p.tail=o.sibling,p.renderingStartTime=qt(),o.sibling=null,d=Yt.current,T(Yt,b?d&1|2:d&1),ot&&Yi(a,p.treeForkCount),o):(Dt(a),null);case 22:case 23:return br(a),jg(),p=a.memoizedState!==null,o!==null?o.memoizedState!==null!==p&&(a.flags|=8192):p&&(a.flags|=8192),p?(d&536870912)!==0&&(a.flags&128)===0&&(Dt(a),a.subtreeFlags&6&&(a.flags|=8192)):Dt(a),d=a.updateQueue,d!==null&&xf(a,d.retryQueue),d=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),p=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(p=a.memoizedState.cachePool.pool),p!==d&&(a.flags|=2048),o!==null&&$(Io),null;case 24:return d=null,o!==null&&(d=o.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Gi(Jt),Dt(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function az(o,a){switch(wg(a),a.tag){case 1:return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return Gi(Jt),je(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 26:case 27:case 5:return Oe(a),null;case 31:if(a.memoizedState!==null){if(br(a),a.alternate===null)throw Error(r(340));No()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 13:if(br(a),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(r(340));No()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return $(Yt),null;case 4:return je(),null;case 10:return Gi(a.type),null;case 22:case 23:return br(a),jg(),o!==null&&$(Io),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 24:return Gi(Jt),null;case 25:return null;default:return null}}function nk(o,a){switch(wg(a),a.tag){case 3:Gi(Jt),je();break;case 26:case 27:case 5:Oe(a);break;case 4:je();break;case 31:a.memoizedState!==null&&br(a);break;case 13:br(a);break;case 19:$(Yt);break;case 10:Gi(a.type);break;case 22:case 23:br(a),jg(),o!==null&&$(Io);break;case 24:Gi(Jt)}}function $c(o,a){try{var d=a.updateQueue,p=d!==null?d.lastEffect:null;if(p!==null){var b=p.next;d=b;do{if((d.tag&o)===o){p=void 0;var x=d.create,w=d.inst;p=x(),w.destroy=p}d=d.next}while(d!==b)}}catch(A){yt(a,a.return,A)}}function zs(o,a,d){try{var p=a.updateQueue,b=p!==null?p.lastEffect:null;if(b!==null){var x=b.next;p=x;do{if((p.tag&o)===o){var w=p.inst,A=w.destroy;if(A!==void 0){w.destroy=void 0,b=a;var R=d,P=A;try{P()}catch(Q){yt(b,R,Q)}}}p=p.next}while(p!==x)}}catch(Q){yt(a,a.return,Q)}}function rk(o){var a=o.updateQueue;if(a!==null){var d=o.stateNode;try{YS(a,d)}catch(p){yt(o,o.return,p)}}}function ik(o,a,d){d.props=$o(o.type,o.memoizedProps),d.state=o.memoizedState;try{d.componentWillUnmount()}catch(p){yt(o,a,p)}}function Vc(o,a){try{var d=o.ref;if(d!==null){switch(o.tag){case 26:case 27:case 5:var p=o.stateNode;break;case 30:p=o.stateNode;break;default:p=o.stateNode}typeof d=="function"?o.refCleanup=d(p):d.current=p}}catch(b){yt(o,a,b)}}function xi(o,a){var d=o.ref,p=o.refCleanup;if(d!==null)if(typeof p=="function")try{p()}catch(b){yt(o,a,b)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(b){yt(o,a,b)}else d.current=null}function sk(o){var a=o.type,d=o.memoizedProps,p=o.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":d.autoFocus&&p.focus();break e;case"img":d.src?p.src=d.src:d.srcSet&&(p.srcset=d.srcSet)}}catch(b){yt(o,o.return,b)}}function my(o,a,d){try{var p=o.stateNode;_z(p,o.type,d,a),p[Qn]=a}catch(b){yt(o,o.return,b)}}function ok(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&$s(o.type)||o.tag===4}function gy(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||ok(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&&$s(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 yy(o,a,d){var p=o.tag;if(p===5||p===6)o=o.stateNode,a?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(o,a):(a=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,a.appendChild(o),d=d._reactRootContainer,d!=null||a.onclick!==null||(a.onclick=Fi));else if(p!==4&&(p===27&&$s(o.type)&&(d=o.stateNode,a=null),o=o.child,o!==null))for(yy(o,a,d),o=o.sibling;o!==null;)yy(o,a,d),o=o.sibling}function vf(o,a,d){var p=o.tag;if(p===5||p===6)o=o.stateNode,a?d.insertBefore(o,a):d.appendChild(o);else if(p!==4&&(p===27&&$s(o.type)&&(d=o.stateNode),o=o.child,o!==null))for(vf(o,a,d),o=o.sibling;o!==null;)vf(o,a,d),o=o.sibling}function lk(o){var a=o.stateNode,d=o.memoizedProps;try{for(var p=o.type,b=a.attributes;b.length;)a.removeAttributeNode(b[0]);Cn(a,p,d),a[vn]=o,a[Qn]=d}catch(x){yt(o,o.return,x)}}var es=!1,en=!1,by=!1,ak=typeof WeakSet=="function"?WeakSet:Set,dn=null;function cz(o,a){if(o=o.containerInfo,Uy=$f,o=vS(o),dg(o)){if("selectionStart"in o)var d={start:o.selectionStart,end:o.selectionEnd};else e:{d=(d=o.ownerDocument)&&d.defaultView||window;var p=d.getSelection&&d.getSelection();if(p&&p.rangeCount!==0){d=p.anchorNode;var b=p.anchorOffset,x=p.focusNode;p=p.focusOffset;try{d.nodeType,x.nodeType}catch{d=null;break e}var w=0,A=-1,R=-1,P=0,Q=0,ne=o,q=null;t:for(;;){for(var W;ne!==d||b!==0&&ne.nodeType!==3||(A=w+b),ne!==x||p!==0&&ne.nodeType!==3||(R=w+p),ne.nodeType===3&&(w+=ne.nodeValue.length),(W=ne.firstChild)!==null;)q=ne,ne=W;for(;;){if(ne===o)break t;if(q===d&&++P===b&&(A=w),q===x&&++Q===p&&(R=w),(W=ne.nextSibling)!==null)break;ne=q,q=ne.parentNode}ne=W}d=A===-1||R===-1?null:{start:A,end:R}}else d=null}d=d||{start:0,end:0}}else d=null;for(Hy={focusedElem:o,selectionRange:d},$f=!1,dn=a;dn!==null;)if(a=dn,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,dn=o;else for(;dn!==null;){switch(a=dn,x=a.alternate,o=a.flags,a.tag){case 0:if((o&4)!==0&&(o=a.updateQueue,o=o!==null?o.events:null,o!==null))for(d=0;d<o.length;d++)b=o[d],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&x!==null){o=void 0,d=a,b=x.memoizedProps,x=x.memoizedState,p=d.stateNode;try{var ve=$o(d.type,b);o=p.getSnapshotBeforeUpdate(ve,x),p.__reactInternalSnapshotBeforeUpdate=o}catch(ze){yt(d,d.return,ze)}}break;case 3:if((o&1024)!==0){if(o=a.stateNode.containerInfo,d=o.nodeType,d===9)Py(o);else if(d===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":Py(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,dn=o;break}dn=a.return}}function ck(o,a,d){var p=d.flags;switch(d.tag){case 0:case 11:case 15:ns(o,d),p&4&&$c(5,d);break;case 1:if(ns(o,d),p&4)if(o=d.stateNode,a===null)try{o.componentDidMount()}catch(w){yt(d,d.return,w)}else{var b=$o(d.type,a.memoizedProps);a=a.memoizedState;try{o.componentDidUpdate(b,a,o.__reactInternalSnapshotBeforeUpdate)}catch(w){yt(d,d.return,w)}}p&64&&rk(d),p&512&&Vc(d,d.return);break;case 3:if(ns(o,d),p&64&&(o=d.updateQueue,o!==null)){if(a=null,d.child!==null)switch(d.child.tag){case 27:case 5:a=d.child.stateNode;break;case 1:a=d.child.stateNode}try{YS(o,a)}catch(w){yt(d,d.return,w)}}break;case 27:a===null&&p&4&&lk(d);case 26:case 5:ns(o,d),a===null&&p&4&&sk(d),p&512&&Vc(d,d.return);break;case 12:ns(o,d);break;case 31:ns(o,d),p&4&&fk(o,d);break;case 13:ns(o,d),p&4&&hk(o,d),p&64&&(o=d.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(d=bz.bind(null,d),Bz(o,d))));break;case 22:if(p=d.memoizedState!==null||es,!p){a=a!==null&&a.memoizedState!==null||en,b=es;var x=en;es=p,(en=a)&&!x?rs(o,d,(d.subtreeFlags&8772)!==0):ns(o,d),es=b,en=x}break;case 30:break;default:ns(o,d)}}function uk(o){var a=o.alternate;a!==null&&(o.alternate=null,uk(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&Wm(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,tr=!1;function ts(o,a,d){for(d=d.child;d!==null;)dk(o,a,d),d=d.sibling}function dk(o,a,d){if(Le&&typeof Le.onCommitFiberUnmount=="function")try{Le.onCommitFiberUnmount(re,d)}catch{}switch(d.tag){case 26:en||xi(d,a),ts(o,a,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:en||xi(d,a);var p=zt,b=tr;$s(d.type)&&(zt=d.stateNode,tr=!1),ts(o,a,d),Jc(d.stateNode),zt=p,tr=b;break;case 5:en||xi(d,a);case 6:if(p=zt,b=tr,zt=null,ts(o,a,d),zt=p,tr=b,zt!==null)if(tr)try{(zt.nodeType===9?zt.body:zt.nodeName==="HTML"?zt.ownerDocument.body:zt).removeChild(d.stateNode)}catch(x){yt(d,a,x)}else try{zt.removeChild(d.stateNode)}catch(x){yt(d,a,x)}break;case 18:zt!==null&&(tr?(o=zt,rC(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,d.stateNode),fa(o)):rC(zt,d.stateNode));break;case 4:p=zt,b=tr,zt=d.stateNode.containerInfo,tr=!0,ts(o,a,d),zt=p,tr=b;break;case 0:case 11:case 14:case 15:zs(2,d,a),en||zs(4,d,a),ts(o,a,d);break;case 1:en||(xi(d,a),p=d.stateNode,typeof p.componentWillUnmount=="function"&&ik(d,a,p)),ts(o,a,d);break;case 21:ts(o,a,d);break;case 22:en=(p=en)||d.memoizedState!==null,ts(o,a,d),en=p;break;default:ts(o,a,d)}}function fk(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{fa(o)}catch(d){yt(a,a.return,d)}}}function hk(o,a){if(a.memoizedState===null&&(o=a.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{fa(o)}catch(d){yt(a,a.return,d)}}function uz(o){switch(o.tag){case 31:case 13:case 19:var a=o.stateNode;return a===null&&(a=o.stateNode=new ak),a;case 22:return o=o.stateNode,a=o._retryCache,a===null&&(a=o._retryCache=new ak),a;default:throw Error(r(435,o.tag))}}function Sf(o,a){var d=uz(o);a.forEach(function(p){if(!d.has(p)){d.add(p);var b=xz.bind(null,o,p);p.then(b,b)}})}function nr(o,a){var d=a.deletions;if(d!==null)for(var p=0;p<d.length;p++){var b=d[p],x=o,w=a,A=w;e:for(;A!==null;){switch(A.tag){case 27:if($s(A.type)){zt=A.stateNode,tr=!1;break e}break;case 5:zt=A.stateNode,tr=!1;break e;case 3:case 4:zt=A.stateNode.containerInfo,tr=!0;break e}A=A.return}if(zt===null)throw Error(r(160));dk(x,w,b),zt=null,tr=!1,x=b.alternate,x!==null&&(x.return=null),b.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)pk(a,o),a=a.sibling}var ii=null;function pk(o,a){var d=o.alternate,p=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:nr(a,o),rr(o),p&4&&(zs(3,o,o.return),$c(3,o),zs(5,o,o.return));break;case 1:nr(a,o),rr(o),p&512&&(en||d===null||xi(d,d.return)),p&64&&es&&(o=o.updateQueue,o!==null&&(p=o.callbacks,p!==null&&(d=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=d===null?p:d.concat(p))));break;case 26:var b=ii;if(nr(a,o),rr(o),p&512&&(en||d===null||xi(d,d.return)),p&4){var x=d!==null?d.memoizedState:null;if(p=o.memoizedState,d===null)if(p===null)if(o.stateNode===null){e:{p=o.type,d=o.memoizedProps,b=b.ownerDocument||b;t:switch(p){case"title":x=b.getElementsByTagName("title")[0],(!x||x[mc]||x[vn]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=b.createElement(p),b.head.insertBefore(x,b.querySelector("head > title"))),Cn(x,p,d),x[vn]=o,un(x),p=x;break e;case"link":var w=pC("link","href",b).get(p+(d.href||""));if(w){for(var A=0;A<w.length;A++)if(x=w[A],x.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&x.getAttribute("rel")===(d.rel==null?null:d.rel)&&x.getAttribute("title")===(d.title==null?null:d.title)&&x.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){w.splice(A,1);break t}}x=b.createElement(p),Cn(x,p,d),b.head.appendChild(x);break;case"meta":if(w=pC("meta","content",b).get(p+(d.content||""))){for(A=0;A<w.length;A++)if(x=w[A],x.getAttribute("content")===(d.content==null?null:""+d.content)&&x.getAttribute("name")===(d.name==null?null:d.name)&&x.getAttribute("property")===(d.property==null?null:d.property)&&x.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&x.getAttribute("charset")===(d.charSet==null?null:d.charSet)){w.splice(A,1);break t}}x=b.createElement(p),Cn(x,p,d),b.head.appendChild(x);break;default:throw Error(r(468,p))}x[vn]=o,un(x),p=x}o.stateNode=p}else mC(b,o.type,o.stateNode);else o.stateNode=hC(b,p,o.memoizedProps);else x!==p?(x===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):x.count--,p===null?mC(b,o.type,o.stateNode):hC(b,p,o.memoizedProps)):p===null&&o.stateNode!==null&&my(o,o.memoizedProps,d.memoizedProps)}break;case 27:nr(a,o),rr(o),p&512&&(en||d===null||xi(d,d.return)),d!==null&&p&4&&my(o,o.memoizedProps,d.memoizedProps);break;case 5:if(nr(a,o),rr(o),p&512&&(en||d===null||xi(d,d.return)),o.flags&32){b=o.stateNode;try{Ll(b,"")}catch(ve){yt(o,o.return,ve)}}p&4&&o.stateNode!=null&&(b=o.memoizedProps,my(o,b,d!==null?d.memoizedProps:b)),p&1024&&(by=!0);break;case 6:if(nr(a,o),rr(o),p&4){if(o.stateNode===null)throw Error(r(162));p=o.memoizedProps,d=o.stateNode;try{d.nodeValue=p}catch(ve){yt(o,o.return,ve)}}break;case 3:if(jf=null,b=ii,ii=Lf(a.containerInfo),nr(a,o),ii=b,rr(o),p&4&&d!==null&&d.memoizedState.isDehydrated)try{fa(a.containerInfo)}catch(ve){yt(o,o.return,ve)}by&&(by=!1,mk(o));break;case 4:p=ii,ii=Lf(o.stateNode.containerInfo),nr(a,o),rr(o),ii=p;break;case 12:nr(a,o),rr(o);break;case 31:nr(a,o),rr(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,Sf(o,p)));break;case 13:nr(a,o),rr(o),o.child.flags&8192&&o.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(kf=qt()),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,Sf(o,p)));break;case 22:b=o.memoizedState!==null;var R=d!==null&&d.memoizedState!==null,P=es,Q=en;if(es=P||b,en=Q||R,nr(a,o),en=Q,es=P,rr(o),p&8192)e:for(a=o.stateNode,a._visibility=b?a._visibility&-2:a._visibility|1,b&&(d===null||R||es||en||Vo(o)),d=null,a=o;;){if(a.tag===5||a.tag===26){if(d===null){R=d=a;try{if(x=R.stateNode,b)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{A=R.stateNode;var ne=R.memoizedProps.style,q=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;A.style.display=q==null||typeof q=="boolean"?"":(""+q).trim()}}catch(ve){yt(R,R.return,ve)}}}else if(a.tag===6){if(d===null){R=a;try{R.stateNode.nodeValue=b?"":R.memoizedProps}catch(ve){yt(R,R.return,ve)}}}else if(a.tag===18){if(d===null){R=a;try{var W=R.stateNode;b?iC(W,!0):iC(R.stateNode,!1)}catch(ve){yt(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;d===a&&(d=null),a=a.return}d===a&&(d=null),a.sibling.return=a.return,a=a.sibling}p&4&&(p=o.updateQueue,p!==null&&(d=p.retryQueue,d!==null&&(p.retryQueue=null,Sf(o,d))));break;case 19:nr(a,o),rr(o),p&4&&(p=o.updateQueue,p!==null&&(o.updateQueue=null,Sf(o,p)));break;case 30:break;case 21:break;default:nr(a,o),rr(o)}}function rr(o){var a=o.flags;if(a&2){try{for(var d,p=o.return;p!==null;){if(ok(p)){d=p;break}p=p.return}if(d==null)throw Error(r(160));switch(d.tag){case 27:var b=d.stateNode,x=gy(o);vf(o,x,b);break;case 5:var w=d.stateNode;d.flags&32&&(Ll(w,""),d.flags&=-33);var A=gy(o);vf(o,A,w);break;case 3:case 4:var R=d.stateNode.containerInfo,P=gy(o);yy(o,P,R);break;default:throw Error(r(161))}}catch(Q){yt(o,o.return,Q)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function mk(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var a=o;mk(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),o=o.sibling}}function ns(o,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)ck(o,a.alternate,a),a=a.sibling}function Vo(o){for(o=o.child;o!==null;){var a=o;switch(a.tag){case 0:case 11:case 14:case 15:zs(4,a,a.return),Vo(a);break;case 1:xi(a,a.return);var d=a.stateNode;typeof d.componentWillUnmount=="function"&&ik(a,a.return,d),Vo(a);break;case 27:Jc(a.stateNode);case 26:case 5:xi(a,a.return),Vo(a);break;case 22:a.memoizedState===null&&Vo(a);break;case 30:Vo(a);break;default:Vo(a)}o=o.sibling}}function rs(o,a,d){for(d=d&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var p=a.alternate,b=o,x=a,w=x.flags;switch(x.tag){case 0:case 11:case 15:rs(b,x,d),$c(4,x);break;case 1:if(rs(b,x,d),p=x,b=p.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(P){yt(p,p.return,P)}if(p=x,b=p.updateQueue,b!==null){var A=p.stateNode;try{var R=b.shared.hiddenCallbacks;if(R!==null)for(b.shared.hiddenCallbacks=null,b=0;b<R.length;b++)KS(R[b],A)}catch(P){yt(p,p.return,P)}}d&&w&64&&rk(x),Vc(x,x.return);break;case 27:lk(x);case 26:case 5:rs(b,x,d),d&&p===null&&w&4&&sk(x),Vc(x,x.return);break;case 12:rs(b,x,d);break;case 31:rs(b,x,d),d&&w&4&&fk(b,x);break;case 13:rs(b,x,d),d&&w&4&&hk(b,x);break;case 22:x.memoizedState===null&&rs(b,x,d),Vc(x,x.return);break;case 30:break;default:rs(b,x,d)}a=a.sibling}}function xy(o,a){var d=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),o=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(o=a.memoizedState.cachePool.pool),o!==d&&(o!=null&&o.refCount++,d!=null&&Mc(d))}function vy(o,a){o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&Mc(o))}function si(o,a,d,p){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)gk(o,a,d,p),a=a.sibling}function gk(o,a,d,p){var b=a.flags;switch(a.tag){case 0:case 11:case 15:si(o,a,d,p),b&2048&&$c(9,a);break;case 1:si(o,a,d,p);break;case 3:si(o,a,d,p),b&2048&&(o=null,a.alternate!==null&&(o=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==o&&(a.refCount++,o!=null&&Mc(o)));break;case 12:if(b&2048){si(o,a,d,p),o=a.stateNode;try{var x=a.memoizedProps,w=x.id,A=x.onPostCommit;typeof A=="function"&&A(w,a.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(R){yt(a,a.return,R)}}else si(o,a,d,p);break;case 31:si(o,a,d,p);break;case 13:si(o,a,d,p);break;case 23:break;case 22:x=a.stateNode,w=a.alternate,a.memoizedState!==null?x._visibility&2?si(o,a,d,p):Pc(o,a):x._visibility&2?si(o,a,d,p):(x._visibility|=2,ta(o,a,d,p,(a.subtreeFlags&10256)!==0||!1)),b&2048&&xy(w,a);break;case 24:si(o,a,d,p),b&2048&&vy(a.alternate,a);break;default:si(o,a,d,p)}}function ta(o,a,d,p,b){for(b=b&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=o,w=a,A=d,R=p,P=w.flags;switch(w.tag){case 0:case 11:case 15:ta(x,w,A,R,b),$c(8,w);break;case 23:break;case 22:var Q=w.stateNode;w.memoizedState!==null?Q._visibility&2?ta(x,w,A,R,b):Pc(x,w):(Q._visibility|=2,ta(x,w,A,R,b)),b&&P&2048&&xy(w.alternate,w);break;case 24:ta(x,w,A,R,b),b&&P&2048&&vy(w.alternate,w);break;default:ta(x,w,A,R,b)}a=a.sibling}}function Pc(o,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var d=o,p=a,b=p.flags;switch(p.tag){case 22:Pc(d,p),b&2048&&xy(p.alternate,p);break;case 24:Pc(d,p),b&2048&&vy(p.alternate,p);break;default:Pc(d,p)}a=a.sibling}}var Fc=8192;function na(o,a,d){if(o.subtreeFlags&Fc)for(o=o.child;o!==null;)yk(o,a,d),o=o.sibling}function yk(o,a,d){switch(o.tag){case 26:na(o,a,d),o.flags&Fc&&o.memoizedState!==null&&Zz(d,ii,o.memoizedState,o.memoizedProps);break;case 5:na(o,a,d);break;case 3:case 4:var p=ii;ii=Lf(o.stateNode.containerInfo),na(o,a,d),ii=p;break;case 22:o.memoizedState===null&&(p=o.alternate,p!==null&&p.memoizedState!==null?(p=Fc,Fc=16777216,na(o,a,d),Fc=p):na(o,a,d));break;default:na(o,a,d)}}function bk(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 qc(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var d=0;d<a.length;d++){var p=a[d];dn=p,vk(p,o)}bk(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)xk(o),o=o.sibling}function xk(o){switch(o.tag){case 0:case 11:case 15:qc(o),o.flags&2048&&zs(9,o,o.return);break;case 3:qc(o);break;case 12:qc(o);break;case 22:var a=o.stateNode;o.memoizedState!==null&&a._visibility&2&&(o.return===null||o.return.tag!==13)?(a._visibility&=-3,wf(o)):qc(o);break;default:qc(o)}}function wf(o){var a=o.deletions;if((o.flags&16)!==0){if(a!==null)for(var d=0;d<a.length;d++){var p=a[d];dn=p,vk(p,o)}bk(o)}for(o=o.child;o!==null;){switch(a=o,a.tag){case 0:case 11:case 15:zs(8,a,a.return),wf(a);break;case 22:d=a.stateNode,d._visibility&2&&(d._visibility&=-3,wf(a));break;default:wf(a)}o=o.sibling}}function vk(o,a){for(;dn!==null;){var d=dn;switch(d.tag){case 0:case 11:case 15:zs(8,d,a);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var p=d.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:Mc(d.memoizedState.cache)}if(p=d.child,p!==null)p.return=d,dn=p;else e:for(d=o;dn!==null;){p=dn;var b=p.sibling,x=p.return;if(uk(p),p===d){dn=null;break e}if(b!==null){b.return=x,dn=b;break e}dn=x}}}var dz={getCacheForType:function(o){var a=wn(Jt),d=a.data.get(o);return d===void 0&&(d=o(),a.data.set(o,d)),d},cacheSignal:function(){return wn(Jt).controller.signal}},fz=typeof WeakMap=="function"?WeakMap:Map,pt=0,St=null,Qe=null,rt=0,gt=0,xr=null,Ls=!1,ra=!1,Sy=!1,is=0,Bt=0,Is=0,Po=0,wy=0,vr=0,ia=0,Kc=null,ir=null,ky=!1,kf=0,Sk=0,Cf=1/0,Ef=null,js=null,on=0,Bs=null,sa=null,ss=0,Cy=0,Ey=null,wk=null,Yc=0,Ty=null;function Sr(){return(pt&2)!==0&&rt!==0?rt&-rt:I.T!==null?Ry():Bv()}function kk(){if(vr===0)if((rt&536870912)===0||ot){var o=Xn;Xn<<=1,(Xn&3932160)===0&&(Xn=262144),vr=o}else vr=536870912;return o=yr.current,o!==null&&(o.flags|=32),vr}function sr(o,a,d){(o===St&&(gt===2||gt===9)||o.cancelPendingCommit!==null)&&(oa(o,0),Us(o,rt,vr,!1)),Eo(o,d),((pt&2)===0||o!==St)&&(o===St&&((pt&2)===0&&(Po|=d),Bt===4&&Us(o,rt,vr,!1)),vi(o))}function Ck(o,a,d){if((pt&6)!==0)throw Error(r(327));var p=!d&&(a&127)===0&&(a&o.expiredLanes)===0||Vi(o,a),b=p?mz(o,a):My(o,a,!0),x=p;do{if(b===0){ra&&!p&&Us(o,a,0,!1);break}else{if(d=o.current.alternate,x&&!hz(d)){b=My(o,a,!1),x=!1;continue}if(b===2){if(x=a,o.errorRecoveryDisabledLanes&x)var w=0;else w=o.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){a=w;e:{var A=o;b=Kc;var R=A.current.memoizedState.isDehydrated;if(R&&(oa(A,w).flags|=256),w=My(A,w,!1),w!==2){if(Sy&&!R){A.errorRecoveryDisabledLanes|=x,Po|=x,b=4;break e}x=ir,ir=b,x!==null&&(ir===null?ir=x:ir.push.apply(ir,x))}b=w}if(x=!1,b!==2)continue}}if(b===1){oa(o,0),Us(o,a,0,!0);break}e:{switch(p=o,x=b,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Us(p,a,vr,!Ls);break e;case 2:ir=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(b=kf+300-qt(),10<b)){if(Us(p,a,vr,!Ls),gi(p,0,!0)!==0)break e;ss=a,p.timeoutHandle=tC(Ek.bind(null,p,d,ir,Ef,ky,a,vr,Po,ia,Ls,x,"Throttled",-0,0),b);break e}Ek(p,d,ir,Ef,ky,a,vr,Po,ia,Ls,x,null,-0,0)}}break}while(!0);vi(o)}function Ek(o,a,d,p,b,x,w,A,R,P,Q,ne,q,W){if(o.timeoutHandle=-1,ne=a.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fi},yk(a,x,ne);var ve=(x&62914560)===x?kf-qt():(x&4194048)===x?Sk-qt():0;if(ve=Jz(ne,ve),ve!==null){ss=x,o.cancelPendingCommit=ve(Nk.bind(null,o,a,x,d,p,b,w,A,R,Q,ne,null,q,W)),Us(o,x,w,!P);return}}Nk(o,a,x,d,p,b,w,A,R)}function hz(o){for(var a=o;;){var d=a.tag;if((d===0||d===11||d===15)&&a.flags&16384&&(d=a.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var p=0;p<d.length;p++){var b=d[p],x=b.getSnapshot;b=b.value;try{if(!mr(x(),b))return!1}catch{return!1}}if(d=a.child,a.subtreeFlags&16384&&d!==null)d.return=a,a=d;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Us(o,a,d,p){a&=~wy,a&=~Po,o.suspendedLanes|=a,o.pingedLanes&=~a,p&&(o.warmLanes|=a),p=o.expirationTimes;for(var b=a;0<b;){var x=31-Ge(b),w=1<<x;p[x]=-1,b&=~w}d!==0&&Lv(o,d,a)}function Tf(){return(pt&6)===0?(Wc(0),!1):!0}function Ay(){if(Qe!==null){if(gt===0)var o=Qe.return;else o=Qe,Wi=zo=null,Pg(o),Zl=null,_c=0,o=Qe;for(;o!==null;)nk(o.alternate,o),o=o.return;Qe=null}}function oa(o,a){var d=o.timeoutHandle;d!==-1&&(o.timeoutHandle=-1,Nz(d)),d=o.cancelPendingCommit,d!==null&&(o.cancelPendingCommit=null,d()),ss=0,Ay(),St=o,Qe=d=Ki(o.current,null),rt=a,gt=0,xr=null,Ls=!1,ra=Vi(o,a),Sy=!1,ia=vr=wy=Po=Is=Bt=0,ir=Kc=null,ky=!1,(a&8)!==0&&(a|=a&32);var p=o.entangledLanes;if(p!==0)for(o=o.entanglements,p&=a;0<p;){var b=31-Ge(p),x=1<<b;a|=o[b],p&=~x}return is=a,Kd(),d}function Tk(o,a){Pe=null,I.H=Bc,a===Gl||a===ef?(a=VS(),gt=3):a===Dg?(a=VS(),gt=4):gt=a===sy?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,xr=a,Qe===null&&(Bt=1,mf(o,Lr(a,o.current)))}function Ak(){var o=yr.current;return o===null?!0:(rt&4194048)===rt?Ur===null:(rt&62914560)===rt||(rt&536870912)!==0?o===Ur:!1}function Mk(){var o=I.H;return I.H=Bc,o===null?Bc:o}function Ok(){var o=I.A;return I.A=dz,o}function Af(){Bt=4,Ls||(rt&4194048)!==rt&&yr.current!==null||(ra=!0),(Is&134217727)===0&&(Po&134217727)===0||St===null||Us(St,rt,vr,!1)}function My(o,a,d){var p=pt;pt|=2;var b=Mk(),x=Ok();(St!==o||rt!==a)&&(Ef=null,oa(o,a)),a=!1;var w=Bt;e:do try{if(gt!==0&&Qe!==null){var A=Qe,R=xr;switch(gt){case 8:Ay(),w=6;break e;case 3:case 2:case 9:case 6:yr.current===null&&(a=!0);var P=gt;if(gt=0,xr=null,la(o,A,R,P),d&&ra){w=0;break e}break;default:P=gt,gt=0,xr=null,la(o,A,R,P)}}pz(),w=Bt;break}catch(Q){Tk(o,Q)}while(!0);return a&&o.shellSuspendCounter++,Wi=zo=null,pt=p,I.H=b,I.A=x,Qe===null&&(St=null,rt=0,Kd()),w}function pz(){for(;Qe!==null;)_k(Qe)}function mz(o,a){var d=pt;pt|=2;var p=Mk(),b=Ok();St!==o||rt!==a?(Ef=null,Cf=qt()+500,oa(o,a)):ra=Vi(o,a);e:do try{if(gt!==0&&Qe!==null){a=Qe;var x=xr;t:switch(gt){case 1:gt=0,xr=null,la(o,a,x,1);break;case 2:case 9:if(HS(x)){gt=0,xr=null,Dk(a);break}a=function(){gt!==2&>!==9||St!==o||(gt=7),vi(o)},x.then(a,a);break e;case 3:gt=7;break e;case 4:gt=5;break e;case 7:HS(x)?(gt=0,xr=null,Dk(a)):(gt=0,xr=null,la(o,a,x,7));break;case 5:var w=null;switch(Qe.tag){case 26:w=Qe.memoizedState;case 5:case 27:var A=Qe;if(w?gC(w):A.stateNode.complete){gt=0,xr=null;var R=A.sibling;if(R!==null)Qe=R;else{var P=A.return;P!==null?(Qe=P,Mf(P)):Qe=null}break t}}gt=0,xr=null,la(o,a,x,5);break;case 6:gt=0,xr=null,la(o,a,x,6);break;case 8:Ay(),Bt=6;break e;default:throw Error(r(462))}}gz();break}catch(Q){Tk(o,Q)}while(!0);return Wi=zo=null,I.H=p,I.A=b,pt=d,Qe!==null?0:(St=null,rt=0,Kd(),Bt)}function gz(){for(;Qe!==null&&!Hi();)_k(Qe)}function _k(o){var a=ek(o.alternate,o,is);o.memoizedProps=o.pendingProps,a===null?Mf(o):Qe=a}function Dk(o){var a=o,d=a.alternate;switch(a.tag){case 15:case 0:a=Ww(d,a,a.pendingProps,a.type,void 0,rt);break;case 11:a=Ww(d,a,a.pendingProps,a.type.render,a.ref,rt);break;case 5:Pg(a);default:nk(d,a),a=Qe=OS(a,is),a=ek(d,a,is)}o.memoizedProps=o.pendingProps,a===null?Mf(o):Qe=a}function la(o,a,d,p){Wi=zo=null,Pg(a),Zl=null,_c=0;var b=a.return;try{if(iz(o,b,a,d,rt)){Bt=1,mf(o,Lr(d,o.current)),Qe=null;return}}catch(x){if(b!==null)throw Qe=b,x;Bt=1,mf(o,Lr(d,o.current)),Qe=null;return}a.flags&32768?(ot||p===1?o=!0:ra||(rt&536870912)!==0?o=!1:(Ls=o=!0,(p===2||p===9||p===3||p===6)&&(p=yr.current,p!==null&&p.tag===13&&(p.flags|=16384))),Rk(a,o)):Mf(a)}function Mf(o){var a=o;do{if((a.flags&32768)!==0){Rk(a,Ls);return}o=a.return;var d=lz(a.alternate,a,is);if(d!==null){Qe=d;return}if(a=a.sibling,a!==null){Qe=a;return}Qe=a=o}while(a!==null);Bt===0&&(Bt=5)}function Rk(o,a){do{var d=az(o.alternate,o);if(d!==null){d.flags&=32767,Qe=d;return}if(d=o.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!a&&(o=o.sibling,o!==null)){Qe=o;return}Qe=o=d}while(o!==null);Bt=6,Qe=null}function Nk(o,a,d,p,b,x,w,A,R){o.cancelPendingCommit=null;do Of();while(on!==0);if((pt&6)!==0)throw Error(r(327));if(a!==null){if(a===o.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=gg,To(o,d,x,w,A,R),o===St&&(Qe=St=null,rt=0),sa=a,Bs=o,ss=d,Cy=x,Ey=b,wk=p,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,vz(Te,function(){return Bk(),null})):(o.callbackNode=null,o.callbackPriority=0),p=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||p){p=I.T,I.T=null,b=Z.p,Z.p=2,w=pt,pt|=4;try{cz(o,a,d)}finally{pt=w,Z.p=b,I.T=p}}on=1,zk(),Lk(),Ik()}}function zk(){if(on===1){on=0;var o=Bs,a=sa,d=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||d){d=I.T,I.T=null;var p=Z.p;Z.p=2;var b=pt;pt|=4;try{pk(a,o);var x=Hy,w=vS(o.containerInfo),A=x.focusedElem,R=x.selectionRange;if(w!==A&&A&&A.ownerDocument&&xS(A.ownerDocument.documentElement,A)){if(R!==null&&dg(A)){var P=R.start,Q=R.end;if(Q===void 0&&(Q=P),"selectionStart"in A)A.selectionStart=P,A.selectionEnd=Math.min(Q,A.value.length);else{var ne=A.ownerDocument||document,q=ne&&ne.defaultView||window;if(q.getSelection){var W=q.getSelection(),ve=A.textContent.length,ze=Math.min(R.start,ve),vt=R.end===void 0?ze:Math.min(R.end,ve);!W.extend&&ze>vt&&(w=vt,vt=ze,ze=w);var B=bS(A,ze),z=bS(A,vt);if(B&&z&&(W.rangeCount!==1||W.anchorNode!==B.node||W.anchorOffset!==B.offset||W.focusNode!==z.node||W.focusOffset!==z.offset)){var V=ne.createRange();V.setStart(B.node,B.offset),W.removeAllRanges(),ze>vt?(W.addRange(V),W.extend(z.node,z.offset)):(V.setEnd(z.node,z.offset),W.addRange(V))}}}}for(ne=[],W=A;W=W.parentNode;)W.nodeType===1&&ne.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<ne.length;A++){var te=ne[A];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}$f=!!Uy,Hy=Uy=null}finally{pt=b,Z.p=p,I.T=d}}o.current=a,on=2}}function Lk(){if(on===2){on=0;var o=Bs,a=sa,d=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||d){d=I.T,I.T=null;var p=Z.p;Z.p=2;var b=pt;pt|=4;try{ck(o,a.alternate,a)}finally{pt=b,Z.p=p,I.T=d}}on=3}}function Ik(){if(on===4||on===3){on=0,_r();var o=Bs,a=sa,d=ss,p=wk;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?on=5:(on=0,sa=Bs=null,jk(o,o.pendingLanes));var b=o.pendingLanes;if(b===0&&(js=null),Km(d),a=a.stateNode,Le&&typeof Le.onCommitFiberRoot=="function")try{Le.onCommitFiberRoot(re,a,void 0,(a.current.flags&128)===128)}catch{}if(p!==null){a=I.T,b=Z.p,Z.p=2,I.T=null;try{for(var x=o.onRecoverableError,w=0;w<p.length;w++){var A=p[w];x(A.value,{componentStack:A.stack})}}finally{I.T=a,Z.p=b}}(ss&3)!==0&&Of(),vi(o),b=o.pendingLanes,(d&261930)!==0&&(b&42)!==0?o===Ty?Yc++:(Yc=0,Ty=o):Yc=0,Wc(0)}}function jk(o,a){(o.pooledCacheLanes&=a)===0&&(a=o.pooledCache,a!=null&&(o.pooledCache=null,Mc(a)))}function Of(){return zk(),Lk(),Ik(),Bk()}function Bk(){if(on!==5)return!1;var o=Bs,a=Cy;Cy=0;var d=Km(ss),p=I.T,b=Z.p;try{Z.p=32>d?32:d,I.T=null,d=Ey,Ey=null;var x=Bs,w=ss;if(on=0,sa=Bs=null,ss=0,(pt&6)!==0)throw Error(r(331));var A=pt;if(pt|=4,xk(x.current),gk(x,x.current,w,d),pt=A,Wc(0,!1),Le&&typeof Le.onPostCommitFiberRoot=="function")try{Le.onPostCommitFiberRoot(re,x)}catch{}return!0}finally{Z.p=b,I.T=p,jk(o,a)}}function Uk(o,a,d){a=Lr(d,a),a=iy(o.stateNode,a,2),o=Ds(o,a,2),o!==null&&(Eo(o,2),vi(o))}function yt(o,a,d){if(o.tag===3)Uk(o,o,d);else for(;a!==null;){if(a.tag===3){Uk(a,o,d);break}else if(a.tag===1){var p=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(js===null||!js.has(p))){o=Lr(d,o),d=Hw(2),p=Ds(a,d,2),p!==null&&($w(d,p,a,o),Eo(p,2),vi(p));break}}a=a.return}}function Oy(o,a,d){var p=o.pingCache;if(p===null){p=o.pingCache=new fz;var b=new Set;p.set(a,b)}else b=p.get(a),b===void 0&&(b=new Set,p.set(a,b));b.has(d)||(Sy=!0,b.add(d),o=yz.bind(null,o,a,d),a.then(o,o))}function yz(o,a,d){var p=o.pingCache;p!==null&&p.delete(a),o.pingedLanes|=o.suspendedLanes&d,o.warmLanes&=~d,St===o&&(rt&d)===d&&(Bt===4||Bt===3&&(rt&62914560)===rt&&300>qt()-kf?(pt&2)===0&&oa(o,0):wy|=d,ia===rt&&(ia=0)),vi(o)}function Hk(o,a){a===0&&(a=Al()),o=Do(o,a),o!==null&&(Eo(o,a),vi(o))}function bz(o){var a=o.memoizedState,d=0;a!==null&&(d=a.retryLane),Hk(o,d)}function xz(o,a){var d=0;switch(o.tag){case 31:case 13:var p=o.stateNode,b=o.memoizedState;b!==null&&(d=b.retryLane);break;case 19:p=o.stateNode;break;case 22:p=o.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(a),Hk(o,d)}function vz(o,a){return pr(o,a)}var _f=null,aa=null,_y=!1,Df=!1,Dy=!1,Hs=0;function vi(o){o!==aa&&o.next===null&&(aa===null?_f=aa=o:aa=aa.next=o),Df=!0,_y||(_y=!0,wz())}function Wc(o,a){if(!Dy&&Df){Dy=!0;do for(var d=!1,p=_f;p!==null;){if(o!==0){var b=p.pendingLanes;if(b===0)var x=0;else{var w=p.suspendedLanes,A=p.pingedLanes;x=(1<<31-Ge(42|o)+1)-1,x&=b&~(w&~A),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(d=!0,Fk(p,x))}else x=rt,x=gi(p,p===St?x:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(x&3)===0||Vi(p,x)||(d=!0,Fk(p,x));p=p.next}while(d);Dy=!1}}function Sz(){$k()}function $k(){Df=_y=!1;var o=0;Hs!==0&&Rz()&&(o=Hs);for(var a=qt(),d=null,p=_f;p!==null;){var b=p.next,x=Vk(p,a);x===0?(p.next=null,d===null?_f=b:d.next=b,b===null&&(aa=d)):(d=p,(o!==0||(x&3)!==0)&&(Df=!0)),p=b}on!==0&&on!==5||Wc(o),Hs!==0&&(Hs=0)}function Vk(o,a){for(var d=o.suspendedLanes,p=o.pingedLanes,b=o.expirationTimes,x=o.pendingLanes&-62914561;0<x;){var w=31-Ge(x),A=1<<w,R=b[w];R===-1?((A&d)===0||(A&p)!==0)&&(b[w]=pc(A,a)):R<=a&&(o.expiredLanes|=A),x&=~A}if(a=St,d=rt,d=gi(o,o===a?d:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p=o.callbackNode,d===0||o===a&&(gt===2||gt===9)||o.cancelPendingCommit!==null)return p!==null&&p!==null&&ni(p),o.callbackNode=null,o.callbackPriority=0;if((d&3)===0||Vi(o,d)){if(a=d&-d,a===o.callbackPriority)return a;switch(p!==null&&ni(p),Km(d)){case 2:case 8:d=de;break;case 32:d=Te;break;case 268435456:d=ge;break;default:d=Te}return p=Pk.bind(null,o),d=pr(d,p),o.callbackPriority=a,o.callbackNode=d,a}return p!==null&&p!==null&&ni(p),o.callbackPriority=2,o.callbackNode=null,2}function Pk(o,a){if(on!==0&&on!==5)return o.callbackNode=null,o.callbackPriority=0,null;var d=o.callbackNode;if(Of()&&o.callbackNode!==d)return null;var p=rt;return p=gi(o,o===St?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),p===0?null:(Ck(o,p,a),Vk(o,qt()),o.callbackNode!=null&&o.callbackNode===d?Pk.bind(null,o):null)}function Fk(o,a){if(Of())return null;Ck(o,a,!0)}function wz(){zz(function(){(pt&6)!==0?pr(X,Sz):$k()})}function Ry(){if(Hs===0){var o=Yl;o===0&&(o=Kt,Kt<<=1,(Kt&261888)===0&&(Kt=256)),Hs=o}return Hs}function qk(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Bd(""+o)}function Kk(o,a){var d=a.ownerDocument.createElement("input");return d.name=a.name,d.value=a.value,o.id&&d.setAttribute("form",o.id),a.parentNode.insertBefore(d,a),o=new FormData(o),d.parentNode.removeChild(d),o}function kz(o,a,d,p,b){if(a==="submit"&&d&&d.stateNode===b){var x=qk((b[Qn]||null).action),w=p.submitter;w&&(a=(a=w[Qn]||null)?qk(a.formAction):w.getAttribute("formAction"),a!==null&&(x=a,w=null));var A=new Vd("action","action",null,p,b);o.push({event:A,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(Hs!==0){var R=w?Kk(b,w):new FormData(b);Xg(d,{pending:!0,data:R,method:b.method,action:x},null,R)}}else typeof x=="function"&&(A.preventDefault(),R=w?Kk(b,w):new FormData(b),Xg(d,{pending:!0,data:R,method:b.method,action:x},x,R))},currentTarget:b}]})}}for(var Ny=0;Ny<mg.length;Ny++){var zy=mg[Ny],Cz=zy.toLowerCase(),Ez=zy[0].toUpperCase()+zy.slice(1);ri(Cz,"on"+Ez)}ri(kS,"onAnimationEnd"),ri(CS,"onAnimationIteration"),ri(ES,"onAnimationStart"),ri("dblclick","onDoubleClick"),ri("focusin","onFocus"),ri("focusout","onBlur"),ri($N,"onTransitionRun"),ri(VN,"onTransitionStart"),ri(PN,"onTransitionCancel"),ri(TS,"onTransitionEnd"),Nl("onMouseEnter",["mouseout","mouseover"]),Nl("onMouseLeave",["mouseout","mouseover"]),Nl("onPointerEnter",["pointerout","pointerover"]),Nl("onPointerLeave",["pointerout","pointerover"]),Ao("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ao("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ao("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ao("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ao("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ao("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Gc="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(" "),Tz=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Gc));function Yk(o,a){a=(a&4)!==0;for(var d=0;d<o.length;d++){var p=o[d],b=p.event;p=p.listeners;e:{var x=void 0;if(a)for(var w=p.length-1;0<=w;w--){var A=p[w],R=A.instance,P=A.currentTarget;if(A=A.listener,R!==x&&b.isPropagationStopped())break e;x=A,b.currentTarget=P;try{x(b)}catch(Q){qd(Q)}b.currentTarget=null,x=R}else for(w=0;w<p.length;w++){if(A=p[w],R=A.instance,P=A.currentTarget,A=A.listener,R!==x&&b.isPropagationStopped())break e;x=A,b.currentTarget=P;try{x(b)}catch(Q){qd(Q)}b.currentTarget=null,x=R}}}}function et(o,a){var d=a[Ym];d===void 0&&(d=a[Ym]=new Set);var p=o+"__bubble";d.has(p)||(Wk(a,o,2,!1),d.add(p))}function Ly(o,a,d){var p=0;a&&(p|=4),Wk(d,o,p,a)}var Rf="_reactListening"+Math.random().toString(36).slice(2);function Iy(o){if(!o[Rf]){o[Rf]=!0,$v.forEach(function(d){d!=="selectionchange"&&(Tz.has(d)||Ly(d,!1,o),Ly(d,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[Rf]||(a[Rf]=!0,Ly("selectionchange",!1,a))}}function Wk(o,a,d,p){switch(kC(a)){case 2:var b=eL;break;case 8:b=tL;break;default:b=Jy}d=b.bind(null,a,d,o),b=void 0,!ng||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(b=!0),p?b!==void 0?o.addEventListener(a,d,{capture:!0,passive:b}):o.addEventListener(a,d,!0):b!==void 0?o.addEventListener(a,d,{passive:b}):o.addEventListener(a,d,!1)}function jy(o,a,d,p,b){var x=p;if((a&1)===0&&(a&2)===0&&p!==null)e:for(;;){if(p===null)return;var w=p.tag;if(w===3||w===4){var A=p.stateNode.containerInfo;if(A===b)break;if(w===4)for(w=p.return;w!==null;){var R=w.tag;if((R===3||R===4)&&w.stateNode.containerInfo===b)return;w=w.return}for(;A!==null;){if(w=_l(A),w===null)return;if(R=w.tag,R===5||R===6||R===26||R===27){p=x=w;continue e}A=A.parentNode}}p=p.return}Qv(function(){var P=x,Q=eg(d),ne=[];e:{var q=AS.get(o);if(q!==void 0){var W=Vd,ve=o;switch(o){case"keypress":if(Hd(d)===0)break e;case"keydown":case"keyup":W=xN;break;case"focusin":ve="focus",W=og;break;case"focusout":ve="blur",W=og;break;case"beforeblur":case"afterblur":W=og;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":W=nS;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=lN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=wN;break;case kS:case CS:case ES:W=uN;break;case TS:W=CN;break;case"scroll":case"scrollend":W=sN;break;case"wheel":W=TN;break;case"copy":case"cut":case"paste":W=fN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=iS;break;case"toggle":case"beforetoggle":W=MN}var ze=(a&4)!==0,vt=!ze&&(o==="scroll"||o==="scrollend"),B=ze?q!==null?q+"Capture":null:q;ze=[];for(var z=P,V;z!==null;){var te=z;if(V=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||V===null||B===null||(te=yc(z,B),te!=null&&ze.push(Zc(z,te,V))),vt)break;z=z.return}0<ze.length&&(q=new W(q,ve,null,d,Q),ne.push({event:q,listeners:ze}))}}if((a&7)===0){e:{if(q=o==="mouseover"||o==="pointerover",W=o==="mouseout"||o==="pointerout",q&&d!==Qm&&(ve=d.relatedTarget||d.fromElement)&&(_l(ve)||ve[Ol]))break e;if((W||q)&&(q=Q.window===Q?Q:(q=Q.ownerDocument)?q.defaultView||q.parentWindow:window,W?(ve=d.relatedTarget||d.toElement,W=P,ve=ve?_l(ve):null,ve!==null&&(vt=s(ve),ze=ve.tag,ve!==vt||ze!==5&&ze!==27&&ze!==6)&&(ve=null)):(W=null,ve=P),W!==ve)){if(ze=nS,te="onMouseLeave",B="onMouseEnter",z="mouse",(o==="pointerout"||o==="pointerover")&&(ze=iS,te="onPointerLeave",B="onPointerEnter",z="pointer"),vt=W==null?q:gc(W),V=ve==null?q:gc(ve),q=new ze(te,z+"leave",W,d,Q),q.target=vt,q.relatedTarget=V,te=null,_l(Q)===P&&(ze=new ze(B,z+"enter",ve,d,Q),ze.target=V,ze.relatedTarget=vt,te=ze),vt=te,W&&ve)t:{for(ze=Az,B=W,z=ve,V=0,te=B;te;te=ze(te))V++;te=0;for(var _e=z;_e;_e=ze(_e))te++;for(;0<V-te;)B=ze(B),V--;for(;0<te-V;)z=ze(z),te--;for(;V--;){if(B===z||z!==null&&B===z.alternate){ze=B;break t}B=ze(B),z=ze(z)}ze=null}else ze=null;W!==null&&Gk(ne,q,W,ze,!1),ve!==null&&vt!==null&&Gk(ne,vt,ve,ze,!0)}}e:{if(q=P?gc(P):window,W=q.nodeName&&q.nodeName.toLowerCase(),W==="select"||W==="input"&&q.type==="file")var ct=fS;else if(uS(q))if(hS)ct=BN;else{ct=IN;var Ce=LN}else W=q.nodeName,!W||W.toLowerCase()!=="input"||q.type!=="checkbox"&&q.type!=="radio"?P&&Xm(P.elementType)&&(ct=fS):ct=jN;if(ct&&(ct=ct(o,P))){dS(ne,ct,d,Q);break e}Ce&&Ce(o,q,P),o==="focusout"&&P&&q.type==="number"&&P.memoizedProps.value!=null&&Jm(q,"number",q.value)}switch(Ce=P?gc(P):window,o){case"focusin":(uS(Ce)||Ce.contentEditable==="true")&&(Ul=Ce,fg=P,Ec=null);break;case"focusout":Ec=fg=Ul=null;break;case"mousedown":hg=!0;break;case"contextmenu":case"mouseup":case"dragend":hg=!1,SS(ne,d,Q);break;case"selectionchange":if(HN)break;case"keydown":case"keyup":SS(ne,d,Q)}var Fe;if(ag)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 Bl?aS(o,d)&&(it="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(it="onCompositionStart");it&&(sS&&d.locale!=="ko"&&(Bl||it!=="onCompositionStart"?it==="onCompositionEnd"&&Bl&&(Fe=eS()):(Cs=Q,rg="value"in Cs?Cs.value:Cs.textContent,Bl=!0)),Ce=Nf(P,it),0<Ce.length&&(it=new rS(it,o,null,d,Q),ne.push({event:it,listeners:Ce}),Fe?it.data=Fe:(Fe=cS(d),Fe!==null&&(it.data=Fe)))),(Fe=_N?DN(o,d):RN(o,d))&&(it=Nf(P,"onBeforeInput"),0<it.length&&(Ce=new rS("onBeforeInput","beforeinput",null,d,Q),ne.push({event:Ce,listeners:it}),Ce.data=Fe)),kz(ne,o,P,d,Q)}Yk(ne,a)})}function Zc(o,a,d){return{instance:o,listener:a,currentTarget:d}}function Nf(o,a){for(var d=a+"Capture",p=[];o!==null;){var b=o,x=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||x===null||(b=yc(o,d),b!=null&&p.unshift(Zc(o,b,x)),b=yc(o,a),b!=null&&p.push(Zc(o,b,x))),o.tag===3)return p;o=o.return}return[]}function Az(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function Gk(o,a,d,p,b){for(var x=a._reactName,w=[];d!==null&&d!==p;){var A=d,R=A.alternate,P=A.stateNode;if(A=A.tag,R!==null&&R===p)break;A!==5&&A!==26&&A!==27||P===null||(R=P,b?(P=yc(d,x),P!=null&&w.unshift(Zc(d,P,R))):b||(P=yc(d,x),P!=null&&w.push(Zc(d,P,R)))),d=d.return}w.length!==0&&o.push({event:a,listeners:w})}var Mz=/\r\n?/g,Oz=/\u0000|\uFFFD/g;function Zk(o){return(typeof o=="string"?o:""+o).replace(Mz,`
|
|
49
|
+
`).replace(Oz,"")}function Jk(o,a){return a=Zk(a),Zk(o)===a}function xt(o,a,d,p,b,x){switch(d){case"children":typeof p=="string"?a==="body"||a==="textarea"&&p===""||Ll(o,p):(typeof p=="number"||typeof p=="bigint")&&a!=="body"&&Ll(o,""+p);break;case"className":Id(o,"class",p);break;case"tabIndex":Id(o,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":Id(o,d,p);break;case"style":Jv(o,p,x);break;case"data":if(a!=="object"){Id(o,"data",p);break}case"src":case"href":if(p===""&&(a!=="a"||d!=="href")){o.removeAttribute(d);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(d);break}p=Bd(""+p),o.setAttribute(d,p);break;case"action":case"formAction":if(typeof p=="function"){o.setAttribute(d,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(d==="formAction"?(a!=="input"&&xt(o,a,"name",b.name,b,null),xt(o,a,"formEncType",b.formEncType,b,null),xt(o,a,"formMethod",b.formMethod,b,null),xt(o,a,"formTarget",b.formTarget,b,null)):(xt(o,a,"encType",b.encType,b,null),xt(o,a,"method",b.method,b,null),xt(o,a,"target",b.target,b,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){o.removeAttribute(d);break}p=Bd(""+p),o.setAttribute(d,p);break;case"onClick":p!=null&&(o.onclick=Fi);break;case"onScroll":p!=null&&et("scroll",o);break;case"onScrollEnd":p!=null&&et("scrollend",o);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(d=p.__html,d!=null){if(b.children!=null)throw Error(r(60));o.innerHTML=d}}break;case"multiple":o.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":o.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){o.removeAttribute("xlink:href");break}d=Bd(""+p),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(d,""+p):o.removeAttribute(d);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":p&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(d,""):o.removeAttribute(d);break;case"capture":case"download":p===!0?o.setAttribute(d,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?o.setAttribute(d,p):o.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?o.setAttribute(d,p):o.removeAttribute(d);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?o.removeAttribute(d):o.setAttribute(d,p);break;case"popover":et("beforetoggle",o),et("toggle",o),Ld(o,"popover",p);break;case"xlinkActuate":Pi(o,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":Pi(o,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":Pi(o,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":Pi(o,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":Pi(o,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":Pi(o,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":Pi(o,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":Pi(o,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":Pi(o,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":Ld(o,"is",p);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=rN.get(d)||d,Ld(o,d,p))}}function By(o,a,d,p,b,x){switch(d){case"style":Jv(o,p,x);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(d=p.__html,d!=null){if(b.children!=null)throw Error(r(60));o.innerHTML=d}}break;case"children":typeof p=="string"?Ll(o,p):(typeof p=="number"||typeof p=="bigint")&&Ll(o,""+p);break;case"onScroll":p!=null&&et("scroll",o);break;case"onScrollEnd":p!=null&&et("scrollend",o);break;case"onClick":p!=null&&(o.onclick=Fi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Vv.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(b=d.endsWith("Capture"),a=d.slice(2,b?d.length-7:void 0),x=o[Qn]||null,x=x!=null?x[d]:null,typeof x=="function"&&o.removeEventListener(a,x,b),typeof p=="function")){typeof x!="function"&&x!==null&&(d in o?o[d]=null:o.hasAttribute(d)&&o.removeAttribute(d)),o.addEventListener(a,p,b);break e}d in o?o[d]=p:p===!0?o.setAttribute(d,""):Ld(o,d,p)}}}function Cn(o,a,d){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 p=!1,b=!1,x;for(x in d)if(d.hasOwnProperty(x)){var w=d[x];if(w!=null)switch(x){case"src":p=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:xt(o,a,x,w,d,null)}}b&&xt(o,a,"srcSet",d.srcSet,d,null),p&&xt(o,a,"src",d.src,d,null);return;case"input":et("invalid",o);var A=x=w=b=null,R=null,P=null;for(p in d)if(d.hasOwnProperty(p)){var Q=d[p];if(Q!=null)switch(p){case"name":b=Q;break;case"type":w=Q;break;case"checked":R=Q;break;case"defaultChecked":P=Q;break;case"value":x=Q;break;case"defaultValue":A=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(r(137,a));break;default:xt(o,a,p,Q,d,null)}}Yv(o,x,A,R,P,w,b,!1);return;case"select":et("invalid",o),p=w=x=null;for(b in d)if(d.hasOwnProperty(b)&&(A=d[b],A!=null))switch(b){case"value":x=A;break;case"defaultValue":w=A;break;case"multiple":p=A;default:xt(o,a,b,A,d,null)}a=x,d=w,o.multiple=!!p,a!=null?zl(o,!!p,a,!1):d!=null&&zl(o,!!p,d,!0);return;case"textarea":et("invalid",o),x=b=p=null;for(w in d)if(d.hasOwnProperty(w)&&(A=d[w],A!=null))switch(w){case"value":p=A;break;case"defaultValue":b=A;break;case"children":x=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(r(91));break;default:xt(o,a,w,A,d,null)}Gv(o,p,b,x);return;case"option":for(R in d)if(d.hasOwnProperty(R)&&(p=d[R],p!=null))switch(R){case"selected":o.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:xt(o,a,R,p,d,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(p=0;p<Gc.length;p++)et(Gc[p],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(P in d)if(d.hasOwnProperty(P)&&(p=d[P],p!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:xt(o,a,P,p,d,null)}return;default:if(Xm(a)){for(Q in d)d.hasOwnProperty(Q)&&(p=d[Q],p!==void 0&&By(o,a,Q,p,d,void 0));return}}for(A in d)d.hasOwnProperty(A)&&(p=d[A],p!=null&&xt(o,a,A,p,d,null))}function _z(o,a,d,p){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,x=null,w=null,A=null,R=null,P=null,Q=null;for(W in d){var ne=d[W];if(d.hasOwnProperty(W)&&ne!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":R=ne;default:p.hasOwnProperty(W)||xt(o,a,W,null,p,ne)}}for(var q in p){var W=p[q];if(ne=d[q],p.hasOwnProperty(q)&&(W!=null||ne!=null))switch(q){case"type":x=W;break;case"name":b=W;break;case"checked":P=W;break;case"defaultChecked":Q=W;break;case"value":w=W;break;case"defaultValue":A=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,a));break;default:W!==ne&&xt(o,a,q,W,p,ne)}}Zm(o,w,A,R,P,Q,x,b);return;case"select":W=w=A=q=null;for(x in d)if(R=d[x],d.hasOwnProperty(x)&&R!=null)switch(x){case"value":break;case"multiple":W=R;default:p.hasOwnProperty(x)||xt(o,a,x,null,p,R)}for(b in p)if(x=p[b],R=d[b],p.hasOwnProperty(b)&&(x!=null||R!=null))switch(b){case"value":q=x;break;case"defaultValue":A=x;break;case"multiple":w=x;default:x!==R&&xt(o,a,b,x,p,R)}a=A,d=w,p=W,q!=null?zl(o,!!d,q,!1):!!p!=!!d&&(a!=null?zl(o,!!d,a,!0):zl(o,!!d,d?[]:"",!1));return;case"textarea":W=q=null;for(A in d)if(b=d[A],d.hasOwnProperty(A)&&b!=null&&!p.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:xt(o,a,A,null,p,b)}for(w in p)if(b=p[w],x=d[w],p.hasOwnProperty(w)&&(b!=null||x!=null))switch(w){case"value":q=b;break;case"defaultValue":W=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(r(91));break;default:b!==x&&xt(o,a,w,b,p,x)}Wv(o,q,W);return;case"option":for(var ve in d)if(q=d[ve],d.hasOwnProperty(ve)&&q!=null&&!p.hasOwnProperty(ve))switch(ve){case"selected":o.selected=!1;break;default:xt(o,a,ve,null,p,q)}for(R in p)if(q=p[R],W=d[R],p.hasOwnProperty(R)&&q!==W&&(q!=null||W!=null))switch(R){case"selected":o.selected=q&&typeof q!="function"&&typeof q!="symbol";break;default:xt(o,a,R,q,p,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 ze in d)q=d[ze],d.hasOwnProperty(ze)&&q!=null&&!p.hasOwnProperty(ze)&&xt(o,a,ze,null,p,q);for(P in p)if(q=p[P],W=d[P],p.hasOwnProperty(P)&&q!==W&&(q!=null||W!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(r(137,a));break;default:xt(o,a,P,q,p,W)}return;default:if(Xm(a)){for(var vt in d)q=d[vt],d.hasOwnProperty(vt)&&q!==void 0&&!p.hasOwnProperty(vt)&&By(o,a,vt,void 0,p,q);for(Q in p)q=p[Q],W=d[Q],!p.hasOwnProperty(Q)||q===W||q===void 0&&W===void 0||By(o,a,Q,q,p,W);return}}for(var B in d)q=d[B],d.hasOwnProperty(B)&&q!=null&&!p.hasOwnProperty(B)&&xt(o,a,B,null,p,q);for(ne in p)q=p[ne],W=d[ne],!p.hasOwnProperty(ne)||q===W||q==null&&W==null||xt(o,a,ne,q,p,W)}function Xk(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Dz(){if(typeof performance.getEntriesByType=="function"){for(var o=0,a=0,d=performance.getEntriesByType("resource"),p=0;p<d.length;p++){var b=d[p],x=b.transferSize,w=b.initiatorType,A=b.duration;if(x&&A&&Xk(w)){for(w=0,A=b.responseEnd,p+=1;p<d.length;p++){var R=d[p],P=R.startTime;if(P>A)break;var Q=R.transferSize,ne=R.initiatorType;Q&&Xk(ne)&&(R=R.responseEnd,w+=Q*(R<A?1:(A-P)/(R-P)))}if(--p,a+=8*(x+w)/(b.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 Uy=null,Hy=null;function zf(o){return o.nodeType===9?o:o.ownerDocument}function Qk(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 eC(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 $y(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 Vy=null;function Rz(){var o=window.event;return o&&o.type==="popstate"?o===Vy?!1:(Vy=o,!0):(Vy=null,!1)}var tC=typeof setTimeout=="function"?setTimeout:void 0,Nz=typeof clearTimeout=="function"?clearTimeout:void 0,nC=typeof Promise=="function"?Promise:void 0,zz=typeof queueMicrotask=="function"?queueMicrotask:typeof nC<"u"?function(o){return nC.resolve(null).then(o).catch(Lz)}:tC;function Lz(o){setTimeout(function(){throw o})}function $s(o){return o==="head"}function rC(o,a){var d=a,p=0;do{var b=d.nextSibling;if(o.removeChild(d),b&&b.nodeType===8)if(d=b.data,d==="/$"||d==="/&"){if(p===0){o.removeChild(b),fa(a);return}p--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")p++;else if(d==="html")Jc(o.ownerDocument.documentElement);else if(d==="head"){d=o.ownerDocument.head,Jc(d);for(var x=d.firstChild;x;){var w=x.nextSibling,A=x.nodeName;x[mc]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&x.rel.toLowerCase()==="stylesheet"||d.removeChild(x),x=w}}else d==="body"&&Jc(o.ownerDocument.body);d=b}while(d);fa(a)}function iC(o,a){var d=o;o=0;do{var p=d.nextSibling;if(d.nodeType===1?a?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(a?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),p&&p.nodeType===8)if(d=p.data,d==="/$"){if(o===0)break;o--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||o++;d=p}while(d)}function Py(o){var a=o.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var d=a;switch(a=a.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":Py(d),Wm(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}o.removeChild(d)}}function Iz(o,a,d,p){for(;o.nodeType===1;){var b=d;if(o.nodeName.toLowerCase()!==a.toLowerCase()){if(!p&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(p){if(!o[mc])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!==b.rel||o.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||o.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||o.getAttribute("title")!==(b.title==null?null:b.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(x=o.getAttribute("src"),(x!==(b.src==null?null:b.src)||o.getAttribute("type")!==(b.type==null?null:b.type)||o.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&x&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(a==="input"&&o.type==="hidden"){var x=b.name==null?null:""+b.name;if(b.type==="hidden"&&o.getAttribute("name")===x)return o}else return o;if(o=Hr(o.nextSibling),o===null)break}return null}function jz(o,a,d){if(a==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!d||(o=Hr(o.nextSibling),o===null))return null;return o}function sC(o,a){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=Hr(o.nextSibling),o===null))return null;return o}function Fy(o){return o.data==="$?"||o.data==="$~"}function qy(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function Bz(o,a){var d=o.ownerDocument;if(o.data==="$~")o._reactRetry=a;else if(o.data!=="$?"||d.readyState!=="loading")a();else{var p=function(){a(),d.removeEventListener("DOMContentLoaded",p)};d.addEventListener("DOMContentLoaded",p),o._reactRetry=p}}function Hr(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 Ky=null;function oC(o){o=o.nextSibling;for(var a=0;o;){if(o.nodeType===8){var d=o.data;if(d==="/$"||d==="/&"){if(a===0)return Hr(o.nextSibling);a--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||a++}o=o.nextSibling}return null}function lC(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var d=o.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(a===0)return o;a--}else d!=="/$"&&d!=="/&"||a++}o=o.previousSibling}return null}function aC(o,a,d){switch(a=zf(d),o){case"html":if(o=a.documentElement,!o)throw Error(r(452));return o;case"head":if(o=a.head,!o)throw Error(r(453));return o;case"body":if(o=a.body,!o)throw Error(r(454));return o;default:throw Error(r(451))}}function Jc(o){for(var a=o.attributes;a.length;)o.removeAttributeNode(a[0]);Wm(o)}var $r=new Map,cC=new Set;function Lf(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var ls=Z.d;Z.d={f:Uz,r:Hz,D:$z,C:Vz,L:Pz,m:Fz,X:Kz,S:qz,M:Yz};function Uz(){var o=ls.f(),a=Tf();return o||a}function Hz(o){var a=Dl(o);a!==null&&a.tag===5&&a.type==="form"?Tw(a):ls.r(o)}var ca=typeof document>"u"?null:document;function uC(o,a,d){var p=ca;if(p&&typeof a=="string"&&a){var b=Nr(a);b='link[rel="'+o+'"][href="'+b+'"]',typeof d=="string"&&(b+='[crossorigin="'+d+'"]'),cC.has(b)||(cC.add(b),o={rel:o,crossOrigin:d,href:a},p.querySelector(b)===null&&(a=p.createElement("link"),Cn(a,"link",o),un(a),p.head.appendChild(a)))}}function $z(o){ls.D(o),uC("dns-prefetch",o,null)}function Vz(o,a){ls.C(o,a),uC("preconnect",o,a)}function Pz(o,a,d){ls.L(o,a,d);var p=ca;if(p&&o&&a){var b='link[rel="preload"][as="'+Nr(a)+'"]';a==="image"&&d&&d.imageSrcSet?(b+='[imagesrcset="'+Nr(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(b+='[imagesizes="'+Nr(d.imageSizes)+'"]')):b+='[href="'+Nr(o)+'"]';var x=b;switch(a){case"style":x=ua(o);break;case"script":x=da(o)}$r.has(x)||(o=m({rel:"preload",href:a==="image"&&d&&d.imageSrcSet?void 0:o,as:a},d),$r.set(x,o),p.querySelector(b)!==null||a==="style"&&p.querySelector(Xc(x))||a==="script"&&p.querySelector(Qc(x))||(a=p.createElement("link"),Cn(a,"link",o),un(a),p.head.appendChild(a)))}}function Fz(o,a){ls.m(o,a);var d=ca;if(d&&o){var p=a&&typeof a.as=="string"?a.as:"script",b='link[rel="modulepreload"][as="'+Nr(p)+'"][href="'+Nr(o)+'"]',x=b;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=da(o)}if(!$r.has(x)&&(o=m({rel:"modulepreload",href:o},a),$r.set(x,o),d.querySelector(b)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(Qc(x)))return}p=d.createElement("link"),Cn(p,"link",o),un(p),d.head.appendChild(p)}}}function qz(o,a,d){ls.S(o,a,d);var p=ca;if(p&&o){var b=Rl(p).hoistableStyles,x=ua(o);a=a||"default";var w=b.get(x);if(!w){var A={loading:0,preload:null};if(w=p.querySelector(Xc(x)))A.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":a},d),(d=$r.get(x))&&Yy(o,d);var R=w=p.createElement("link");un(R),Cn(R,"link",o),R._p=new Promise(function(P,Q){R.onload=P,R.onerror=Q}),R.addEventListener("load",function(){A.loading|=1}),R.addEventListener("error",function(){A.loading|=2}),A.loading|=4,If(w,a,p)}w={type:"stylesheet",instance:w,count:1,state:A},b.set(x,w)}}}function Kz(o,a){ls.X(o,a);var d=ca;if(d&&o){var p=Rl(d).hoistableScripts,b=da(o),x=p.get(b);x||(x=d.querySelector(Qc(b)),x||(o=m({src:o,async:!0},a),(a=$r.get(b))&&Wy(o,a),x=d.createElement("script"),un(x),Cn(x,"link",o),d.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(b,x))}}function Yz(o,a){ls.M(o,a);var d=ca;if(d&&o){var p=Rl(d).hoistableScripts,b=da(o),x=p.get(b);x||(x=d.querySelector(Qc(b)),x||(o=m({src:o,async:!0,type:"module"},a),(a=$r.get(b))&&Wy(o,a),x=d.createElement("script"),un(x),Cn(x,"link",o),d.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(b,x))}}function dC(o,a,d,p){var b=(b=le.current)?Lf(b):null;if(!b)throw Error(r(446));switch(o){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(a=ua(d.href),d=Rl(b).hoistableStyles,p=d.get(a),p||(p={type:"style",instance:null,count:0,state:null},d.set(a,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){o=ua(d.href);var x=Rl(b).hoistableStyles,w=x.get(o);if(w||(b=b.ownerDocument||b,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(o,w),(x=b.querySelector(Xc(o)))&&!x._p&&(w.instance=x,w.state.loading=5),$r.has(o)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},$r.set(o,d),x||Wz(b,o,d,w.state))),a&&p===null)throw Error(r(528,""));return w}if(a&&p!==null)throw Error(r(529,""));return null;case"script":return a=d.async,d=d.src,typeof d=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=da(d),d=Rl(b).hoistableScripts,p=d.get(a),p||(p={type:"script",instance:null,count:0,state:null},d.set(a,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,o))}}function ua(o){return'href="'+Nr(o)+'"'}function Xc(o){return'link[rel="stylesheet"]['+o+"]"}function fC(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function Wz(o,a,d,p){o.querySelector('link[rel="preload"][as="style"]['+a+"]")?p.loading=1:(a=o.createElement("link"),p.preload=a,a.addEventListener("load",function(){return p.loading|=1}),a.addEventListener("error",function(){return p.loading|=2}),Cn(a,"link",d),un(a),o.head.appendChild(a))}function da(o){return'[src="'+Nr(o)+'"]'}function Qc(o){return"script[async]"+o}function hC(o,a,d){if(a.count++,a.instance===null)switch(a.type){case"style":var p=o.querySelector('style[data-href~="'+Nr(d.href)+'"]');if(p)return a.instance=p,un(p),p;var b=m({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return p=(o.ownerDocument||o).createElement("style"),un(p),Cn(p,"style",b),If(p,d.precedence,o),a.instance=p;case"stylesheet":b=ua(d.href);var x=o.querySelector(Xc(b));if(x)return a.state.loading|=4,a.instance=x,un(x),x;p=fC(d),(b=$r.get(b))&&Yy(p,b),x=(o.ownerDocument||o).createElement("link"),un(x);var w=x;return w._p=new Promise(function(A,R){w.onload=A,w.onerror=R}),Cn(x,"link",p),a.state.loading|=4,If(x,d.precedence,o),a.instance=x;case"script":return x=da(d.src),(b=o.querySelector(Qc(x)))?(a.instance=b,un(b),b):(p=d,(b=$r.get(x))&&(p=m({},d),Wy(p,b)),o=o.ownerDocument||o,b=o.createElement("script"),un(b),Cn(b,"link",p),o.head.appendChild(b),a.instance=b);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(p=a.instance,a.state.loading|=4,If(p,d.precedence,o));return a.instance}function If(o,a,d){for(var p=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=p.length?p[p.length-1]:null,x=b,w=0;w<p.length;w++){var A=p[w];if(A.dataset.precedence===a)x=A;else if(x!==b)break}x?x.parentNode.insertBefore(o,x.nextSibling):(a=d.nodeType===9?d.head:d,a.insertBefore(o,a.firstChild))}function Yy(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.title==null&&(o.title=a.title)}function Wy(o,a){o.crossOrigin==null&&(o.crossOrigin=a.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=a.referrerPolicy),o.integrity==null&&(o.integrity=a.integrity)}var jf=null;function pC(o,a,d){if(jf===null){var p=new Map,b=jf=new Map;b.set(d,p)}else b=jf,p=b.get(d),p||(p=new Map,b.set(d,p));if(p.has(o))return p;for(p.set(o,null),d=d.getElementsByTagName(o),b=0;b<d.length;b++){var x=d[b];if(!(x[mc]||x[vn]||o==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(a)||"";w=o+w;var A=p.get(w);A?A.push(x):p.set(w,[x])}}return p}function mC(o,a,d){o=o.ownerDocument||o,o.head.insertBefore(d,a==="title"?o.querySelector("head > title"):null)}function Gz(o,a,d){if(d===1||a.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return o=a.disabled,typeof a.precedence=="string"&&o==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function gC(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function Zz(o,a,d,p){if(d.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var b=ua(p.href),x=a.querySelector(Xc(b));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(o.count++,o=Bf.bind(o),a.then(o,o)),d.state.loading|=4,d.instance=x,un(x);return}x=a.ownerDocument||a,p=fC(p),(b=$r.get(b))&&Yy(p,b),x=x.createElement("link"),un(x);var w=x;w._p=new Promise(function(A,R){w.onload=A,w.onerror=R}),Cn(x,"link",p),d.instance=x}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(d,a),(a=d.state.preload)&&(d.state.loading&3)===0&&(o.count++,d=Bf.bind(o),a.addEventListener("load",d),a.addEventListener("error",d))}}var Gy=0;function Jz(o,a){return o.stylesheets&&o.count===0&&Hf(o,o.stylesheets),0<o.count||0<o.imgCount?function(d){var p=setTimeout(function(){if(o.stylesheets&&Hf(o,o.stylesheets),o.unsuspend){var x=o.unsuspend;o.unsuspend=null,x()}},6e4+a);0<o.imgBytes&&Gy===0&&(Gy=62500*Dz());var b=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Hf(o,o.stylesheets),o.unsuspend)){var x=o.unsuspend;o.unsuspend=null,x()}},(o.imgBytes>Gy?50:800)+a);return o.unsuspend=d,function(){o.unsuspend=null,clearTimeout(p),clearTimeout(b)}}:null}function Bf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hf(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Uf=null;function Hf(o,a){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Uf=new Map,a.forEach(Xz,o),Uf=null,Bf.call(o))}function Xz(o,a){if(!(a.state.loading&4)){var d=Uf.get(o);if(d)var p=d.get(null);else{d=new Map,Uf.set(o,d);for(var b=o.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<b.length;x++){var w=b[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(d.set(w.dataset.precedence,w),p=w)}p&&d.set(null,p)}b=a.instance,w=b.getAttribute("data-precedence"),x=d.get(w)||p,x===p&&d.set(null,b),d.set(w,b),this.count++,p=Bf.bind(this),b.addEventListener("load",p),b.addEventListener("error",p),x?x.parentNode.insertBefore(b,x.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(b,o.firstChild)),a.state.loading|=4}}var eu={$$typeof:L,Provider:null,Consumer:null,_currentValue:me,_currentValue2:me,_threadCount:0};function Qz(o,a,d,p,b,x,w,A,R){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ml(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ml(0),this.hiddenUpdates=Ml(null),this.identifierPrefix=p,this.onUncaughtError=b,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function yC(o,a,d,p,b,x,w,A,R,P,Q,ne){return o=new Qz(o,a,d,w,R,P,Q,ne,A),a=1,x===!0&&(a|=24),x=gr(3,null,null,a),o.current=x,x.stateNode=o,a=Mg(),a.refCount++,o.pooledCache=a,a.refCount++,x.memoizedState={element:p,isDehydrated:d,cache:a},Rg(x),o}function bC(o){return o?(o=Vl,o):Vl}function xC(o,a,d,p,b,x){b=bC(b),p.context===null?p.context=b:p.pendingContext=b,p=_s(a),p.payload={element:d},x=x===void 0?null:x,x!==null&&(p.callback=x),d=Ds(o,p,a),d!==null&&(sr(d,o,a),Rc(d,o,a))}function vC(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<a?d:a}}function Zy(o,a){vC(o,a),(o=o.alternate)&&vC(o,a)}function SC(o){if(o.tag===13||o.tag===31){var a=Do(o,67108864);a!==null&&sr(a,o,67108864),Zy(o,67108864)}}function wC(o){if(o.tag===13||o.tag===31){var a=Sr();a=qm(a);var d=Do(o,a);d!==null&&sr(d,o,a),Zy(o,a)}}var $f=!0;function eL(o,a,d,p){var b=I.T;I.T=null;var x=Z.p;try{Z.p=2,Jy(o,a,d,p)}finally{Z.p=x,I.T=b}}function tL(o,a,d,p){var b=I.T;I.T=null;var x=Z.p;try{Z.p=8,Jy(o,a,d,p)}finally{Z.p=x,I.T=b}}function Jy(o,a,d,p){if($f){var b=Xy(p);if(b===null)jy(o,a,p,Vf,d),CC(o,p);else if(rL(b,o,a,d,p))p.stopPropagation();else if(CC(o,p),a&4&&-1<nL.indexOf(o)){for(;b!==null;){var x=Dl(b);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=mi(x.pendingLanes);if(w!==0){var A=x;for(A.pendingLanes|=2,A.entangledLanes|=2;w;){var R=1<<31-Ge(w);A.entanglements[1]|=R,w&=~R}vi(x),(pt&6)===0&&(Cf=qt()+500,Wc(0))}}break;case 31:case 13:A=Do(x,2),A!==null&&sr(A,x,2),Tf(),Zy(x,2)}if(x=Xy(p),x===null&&jy(o,a,p,Vf,d),x===b)break;b=x}b!==null&&p.stopPropagation()}else jy(o,a,p,null,d)}}function Xy(o){return o=eg(o),Qy(o)}var Vf=null;function Qy(o){if(Vf=null,o=_l(o),o!==null){var a=s(o);if(a===null)o=null;else{var d=a.tag;if(d===13){if(o=l(a),o!==null)return o;o=null}else if(d===31){if(o=c(a),o!==null)return o;o=null}else if(d===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null)}}return Vf=o,null}function kC(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($i()){case X:return 2;case de:return 8;case Te:case Y:return 32;case ge:return 268435456;default:return 32}default:return 32}}var e0=!1,Vs=null,Ps=null,Fs=null,tu=new Map,nu=new Map,qs=[],nL="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 CC(o,a){switch(o){case"focusin":case"focusout":Vs=null;break;case"dragenter":case"dragleave":Ps=null;break;case"mouseover":case"mouseout":Fs=null;break;case"pointerover":case"pointerout":tu.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":nu.delete(a.pointerId)}}function ru(o,a,d,p,b,x){return o===null||o.nativeEvent!==x?(o={blockedOn:a,domEventName:d,eventSystemFlags:p,nativeEvent:x,targetContainers:[b]},a!==null&&(a=Dl(a),a!==null&&SC(a)),o):(o.eventSystemFlags|=p,a=o.targetContainers,b!==null&&a.indexOf(b)===-1&&a.push(b),o)}function rL(o,a,d,p,b){switch(a){case"focusin":return Vs=ru(Vs,o,a,d,p,b),!0;case"dragenter":return Ps=ru(Ps,o,a,d,p,b),!0;case"mouseover":return Fs=ru(Fs,o,a,d,p,b),!0;case"pointerover":var x=b.pointerId;return tu.set(x,ru(tu.get(x)||null,o,a,d,p,b)),!0;case"gotpointercapture":return x=b.pointerId,nu.set(x,ru(nu.get(x)||null,o,a,d,p,b)),!0}return!1}function EC(o){var a=_l(o.target);if(a!==null){var d=s(a);if(d!==null){if(a=d.tag,a===13){if(a=l(d),a!==null){o.blockedOn=a,Uv(o.priority,function(){wC(d)});return}}else if(a===31){if(a=c(d),a!==null){o.blockedOn=a,Uv(o.priority,function(){wC(d)});return}}else if(a===3&&d.stateNode.current.memoizedState.isDehydrated){o.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}o.blockedOn=null}function Pf(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var d=Xy(o.nativeEvent);if(d===null){d=o.nativeEvent;var p=new d.constructor(d.type,d);Qm=p,d.target.dispatchEvent(p),Qm=null}else return a=Dl(d),a!==null&&SC(a),o.blockedOn=d,!1;a.shift()}return!0}function TC(o,a,d){Pf(o)&&d.delete(a)}function iL(){e0=!1,Vs!==null&&Pf(Vs)&&(Vs=null),Ps!==null&&Pf(Ps)&&(Ps=null),Fs!==null&&Pf(Fs)&&(Fs=null),tu.forEach(TC),nu.forEach(TC)}function Ff(o,a){o.blockedOn===a&&(o.blockedOn=null,e0||(e0=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,iL)))}var qf=null;function AC(o){qf!==o&&(qf=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){qf===o&&(qf=null);for(var a=0;a<o.length;a+=3){var d=o[a],p=o[a+1],b=o[a+2];if(typeof p!="function"){if(Qy(p||d)===null)continue;break}var x=Dl(d);x!==null&&(o.splice(a,3),a-=3,Xg(x,{pending:!0,data:b,method:d.method,action:p},p,b))}}))}function fa(o){function a(R){return Ff(R,o)}Vs!==null&&Ff(Vs,o),Ps!==null&&Ff(Ps,o),Fs!==null&&Ff(Fs,o),tu.forEach(a),nu.forEach(a);for(var d=0;d<qs.length;d++){var p=qs[d];p.blockedOn===o&&(p.blockedOn=null)}for(;0<qs.length&&(d=qs[0],d.blockedOn===null);)EC(d),d.blockedOn===null&&qs.shift();if(d=(o.ownerDocument||o).$$reactFormReplay,d!=null)for(p=0;p<d.length;p+=3){var b=d[p],x=d[p+1],w=b[Qn]||null;if(typeof x=="function")w||AC(d);else if(w){var A=null;if(x&&x.hasAttribute("formAction")){if(b=x,w=x[Qn]||null)A=w.formAction;else if(Qy(b)!==null)continue}else A=w.action;typeof A=="function"?d[p+1]=A:(d.splice(p,3),p-=3),AC(d)}}}function MC(){function o(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return b=w})},focusReset:"manual",scroll:"manual"})}function a(){b!==null&&(b(),b=null),p||setTimeout(d,20)}function d(){if(!p&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,b=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(d,100),function(){p=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),b!==null&&(b(),b=null)}}}function t0(o){this._internalRoot=o}Kf.prototype.render=t0.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(r(409));var d=a.current,p=Sr();xC(d,p,o,a,null,null)},Kf.prototype.unmount=t0.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;xC(o.current,2,null,o,null,null),Tf(),a[Ol]=null}};function Kf(o){this._internalRoot=o}Kf.prototype.unstable_scheduleHydration=function(o){if(o){var a=Bv();o={blockedOn:null,target:o,priority:a};for(var d=0;d<qs.length&&a!==0&&a<qs[d].priority;d++);qs.splice(d,0,o),d===0&&EC(o)}};var OC=e.version;if(OC!=="19.2.4")throw Error(r(527,OC,"19.2.4"));Z.findDOMNode=function(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(r(188)):(o=Object.keys(o).join(","),Error(r(268,o)));return o=f(a),o=o!==null?h(o):null,o=o===null?null:o.stateNode,o};var sL={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yf.isDisabled&&Yf.supportsFiber)try{re=Yf.inject(sL),Le=Yf}catch{}}return su.createRoot=function(o,a){if(!i(o))throw Error(r(299));var d=!1,p="",b=Iw,x=jw,w=Bw;return a!=null&&(a.unstable_strictMode===!0&&(d=!0),a.identifierPrefix!==void 0&&(p=a.identifierPrefix),a.onUncaughtError!==void 0&&(b=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError)),a=yC(o,1,!1,null,null,d,p,null,b,x,w,MC),o[Ol]=a.current,Iy(o),new t0(a)},su.hydrateRoot=function(o,a,d){if(!i(o))throw Error(r(299));var p=!1,b="",x=Iw,w=jw,A=Bw,R=null;return d!=null&&(d.unstable_strictMode===!0&&(p=!0),d.identifierPrefix!==void 0&&(b=d.identifierPrefix),d.onUncaughtError!==void 0&&(x=d.onUncaughtError),d.onCaughtError!==void 0&&(w=d.onCaughtError),d.onRecoverableError!==void 0&&(A=d.onRecoverableError),d.formState!==void 0&&(R=d.formState)),a=yC(o,1,!0,a,d??null,p,b,R,x,w,A,MC),a.context=bC(null),d=a.current,p=Sr(),p=qm(p),b=_s(p),b.callback=null,Ds(d,b,p),d=p,a.current.lanes=d,Eo(a,d),vi(a),o[Ol]=a.current,Iy(o),new Kf(a)},su.version="19.2.4",su}var UC;function gL(){if(UC)return i0.exports;UC=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),i0.exports=mL(),i0.exports}var yL=gL();const HC=3478,nc=3479,bL=3e3,xL=3e3,vL=3e4,$u={yellow:"rgba(255, 235, 59, 0.3)",red:"rgba(244, 67, 54, 0.3)",green:"rgba(76, 175, 80, 0.3)",blue:"rgba(33, 150, 243, 0.3)",purple:"rgba(156, 39, 176, 0.3)"},$C="tandem",Gf="tandem:mode",IM="tandem:settings",SL="tandem-panel-width",wL="tandem-left-panel-width",jM={left:wL,right:SL},BM=1e3,Fh=500,qh=3e3,kL="__tandem_ctrl__",Ta="annotations",UM="awareness",vb="userAwareness",CL="mode",EL="selectionDwellMs",VC="chat",Eh="documentMeta",TL="annotationReplies",PC="savedAtVersion",FC="authorship",HM="tandem:showAuthorship",Fx="tandem:recentFiles",AL=20,qx="tandem:userName",$M="You",Sb="tandem:user-name-changed",VM=40,qC={error:8e3,warning:6e3,info:4e3},ML=5,PM="tandem:tutorialCompleted",OL="tutorial-",KC="tandem:zoomLevel",YC=.5,WC=2,ou=1,_L="upload://";function DL(t){return t.startsWith(_L)}const Th=t=>t,Zr=t=>t;var ft;(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})(ft||(ft={}));var GC;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(GC||(GC={}));const ke=ft.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Zs=t=>{switch(typeof t){case"undefined":return ke.undefined;case"string":return ke.string;case"number":return Number.isNaN(t)?ke.nan:ke.number;case"boolean":return ke.boolean;case"function":return ke.function;case"bigint":return ke.bigint;case"symbol":return ke.symbol;case"object":return Array.isArray(t)?ke.array:t===null?ke.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ke.promise:typeof Map<"u"&&t instanceof Map?ke.map:typeof Set<"u"&&t instanceof Set?ke.set:typeof Date<"u"&&t instanceof Date?ke.date:ke.object;default:return ke.unknown}},fe=ft.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 vs extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const l of s.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)r._errors.push(n(l));else{let c=r,u=0;for(;u<l.path.length;){const f=l.path[u];u===l.path.length-1?(c[f]=c[f]||{_errors:[]},c[f]._errors.push(n(l))):c[f]=c[f]||{_errors:[]},c=c[f],u++}}};return i(this),r}static assert(e){if(!(e instanceof vs))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ft.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()}}vs.create=t=>new vs(t);const wb=(t,e)=>{let n;switch(t.code){case fe.invalid_type:t.received===ke.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case fe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,ft.jsonStringifyReplacer)}`;break;case fe.unrecognized_keys:n=`Unrecognized key(s) in object: ${ft.joinValues(t.keys,", ")}`;break;case fe.invalid_union:n="Invalid input";break;case fe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ft.joinValues(t.options)}`;break;case fe.invalid_enum_value:n=`Invalid enum value. Expected ${ft.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}"`:ft.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,ft.assertNever(t)}return{message:n}};let RL=wb;function NL(){return RL}const zL=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],l={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let c="";const u=r.filter(f=>!!f).slice().reverse();for(const f of u)c=f(l,{data:e,defaultError:c}).message;return{...i,path:s,message:c}};function be(t,e){const n=NL(),r=zL({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===wb?void 0:wb].filter(i=>!!i)});t.common.issues.push(r)}class Or{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 Or.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"}),mu=t=>({status:"dirty",value:t}),ti=t=>({status:"valid",value:t}),ZC=t=>t.status==="aborted",JC=t=>t.status==="dirty",Ua=t=>t.status==="valid",Kh=t=>typeof Promise<"u"&&t instanceof Promise;var Ee;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Ee||(Ee={}));class po{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 XC=(t,e)=>{if(Ua(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 vs(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:u}=t;return l.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??r??c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:u??n??c.defaultError}},description:i}}class at{get description(){return this._def.description}_getType(e){return Zs(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Zs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Or,ctx:{common:e.parent.common,data:e.data,parsedType:Zs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Kh(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:Zs(e)},i=this._parseSync({data:e,path:r.path,parent:r});return XC(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:Zs(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:n});return Ua(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=>Ua(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:Zs(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Kh(i)?i:Promise.resolve(i));return XC(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(u=>u?!0:(c(),!1)):l?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new $a({schema:this,typeName:$e.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 ao.create(this,this._def)}nullable(){return Va.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mi.create(this)}promise(){return Zh.create(this,this._def)}or(e){return Wh.create([this,e],this._def)}and(e){return Gh.create(this,e,this._def)}transform(e){return new $a({...Je(this._def),schema:this,typeName:$e.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Cb({...Je(this._def),innerType:this,defaultValue:n,typeName:$e.ZodDefault})}brand(){return new r3({typeName:$e.ZodBranded,type:this,...Je(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Eb({...Je(this._def),innerType:this,catchValue:n,typeName:$e.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Kx.create(this,e)}readonly(){return Tb.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const LL=/^c[^\s-]{8,}$/i,IL=/^[0-9a-z]+$/,jL=/^[0-9A-HJKMNP-TV-Z]{26}$/i,BL=/^[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,UL=/^[a-z0-9_-]{21}$/i,HL=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$L=/^[-+]?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)?)??$/,VL=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,PL="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let a0;const FL=/^(?:(?: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])$/,qL=/^(?:(?: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])$/,KL=/^(([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]))$/,YL=/^(([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])$/,WL=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,GL=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,FM="((\\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])))",ZL=new RegExp(`^${FM}$`);function qM(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 JL(t){return new RegExp(`^${qM(t)}$`)}function XL(t){let e=`${FM}T${qM(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 QL(t,e){return!!((e==="v4"||!e)&&FL.test(t)||(e==="v6"||!e)&&KL.test(t))}function e3(t,e){if(!HL.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 t3(t,e){return!!((e==="v4"||!e)&&qL.test(t)||(e==="v6"||!e)&&YL.test(t))}class Wo extends at{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ke.string){const s=this._getOrReturnCtx(e);return be(s,{code:fe.invalid_type,expected:ke.string,received:s.parsedType}),He}const r=new Or;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")VL.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")a0||(a0=new RegExp(PL,"u")),a0.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")BL.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")UL.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")LL.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")IL.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")jL.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"?XL(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"?ZL.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{code:fe.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?JL(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"?$L.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"duration",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?QL(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"?e3(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"?t3(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"?WL.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"base64",code:fe.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?GL.test(e.data)||(i=this._getOrReturnCtx(e,i),be(i,{validation:"base64url",code:fe.invalid_string,message:s.message}),r.dirty()):ft.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,...Ee.errToObj(r)})}_addCheck(e){return new Wo({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ee.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ee.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ee.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ee.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ee.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ee.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ee.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ee.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ee.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ee.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ee.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ee.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ee.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Ee.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Ee.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ee.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ee.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Ee.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ee.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ee.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ee.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ee.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ee.errToObj(n)})}nonempty(e){return this.min(1,Ee.errToObj(e))}trim(){return new Wo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wo({...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}}Wo.create=t=>new Wo({checks:[],typeName:$e.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Je(t)});function n3(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 Vu extends at{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)!==ke.number){const s=this._getOrReturnCtx(e);return be(s,{code:fe.invalid_type,expected:ke.number,received:s.parsedType}),He}let r;const i=new Or;for(const s of this._def.checks)s.kind==="int"?ft.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"?n3(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()):ft.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ee.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ee.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ee.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ee.toString(n))}setLimit(e,n,r,i){return new Vu({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ee.toString(i)}]})}_addCheck(e){return new Vu({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ee.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ee.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ee.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ee.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ee.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ee.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ee.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ee.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ee.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ft.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)}}Vu.create=t=>new Vu({checks:[],typeName:$e.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Je(t)});class Pu extends at{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)!==ke.bigint)return this._getInvalidInput(e);let r;const i=new Or;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()):ft.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return be(n,{code:fe.invalid_type,expected:ke.bigint,received:n.parsedType}),He}gte(e,n){return this.setLimit("min",e,!0,Ee.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ee.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ee.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ee.toString(n))}setLimit(e,n,r,i){return new Pu({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Ee.toString(i)}]})}_addCheck(e){return new Pu({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ee.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ee.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ee.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ee.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ee.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Pu.create=t=>new Pu({checks:[],typeName:$e.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Je(t)});class QC extends at{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ke.boolean){const r=this._getOrReturnCtx(e);return be(r,{code:fe.invalid_type,expected:ke.boolean,received:r.parsedType}),He}return ti(e.data)}}QC.create=t=>new QC({typeName:$e.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Je(t)});class Yh extends at{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ke.date){const s=this._getOrReturnCtx(e);return be(s,{code:fe.invalid_type,expected:ke.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 Or;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()):ft.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Yh({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ee.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ee.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Yh.create=t=>new Yh({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:$e.ZodDate,...Je(t)});class eE extends at{_parse(e){if(this._getType(e)!==ke.symbol){const r=this._getOrReturnCtx(e);return be(r,{code:fe.invalid_type,expected:ke.symbol,received:r.parsedType}),He}return ti(e.data)}}eE.create=t=>new eE({typeName:$e.ZodSymbol,...Je(t)});class tE extends at{_parse(e){if(this._getType(e)!==ke.undefined){const r=this._getOrReturnCtx(e);return be(r,{code:fe.invalid_type,expected:ke.undefined,received:r.parsedType}),He}return ti(e.data)}}tE.create=t=>new tE({typeName:$e.ZodUndefined,...Je(t)});class nE extends at{_parse(e){if(this._getType(e)!==ke.null){const r=this._getOrReturnCtx(e);return be(r,{code:fe.invalid_type,expected:ke.null,received:r.parsedType}),He}return ti(e.data)}}nE.create=t=>new nE({typeName:$e.ZodNull,...Je(t)});class rE extends at{constructor(){super(...arguments),this._any=!0}_parse(e){return ti(e.data)}}rE.create=t=>new rE({typeName:$e.ZodAny,...Je(t)});class iE extends at{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ti(e.data)}}iE.create=t=>new iE({typeName:$e.ZodUnknown,...Je(t)});class mo extends at{_parse(e){const n=this._getOrReturnCtx(e);return be(n,{code:fe.invalid_type,expected:ke.never,received:n.parsedType}),He}}mo.create=t=>new mo({typeName:$e.ZodNever,...Je(t)});class sE extends at{_parse(e){if(this._getType(e)!==ke.undefined){const r=this._getOrReturnCtx(e);return be(r,{code:fe.invalid_type,expected:ke.void,received:r.parsedType}),He}return ti(e.data)}}sE.create=t=>new sE({typeName:$e.ZodVoid,...Je(t)});class Mi extends at{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==ke.array)return be(n,{code:fe.invalid_type,expected:ke.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 po(n,l,n.path,c)))).then(l=>Or.mergeArray(r,l));const s=[...n.data].map((l,c)=>i.type._parseSync(new po(n,l,n.path,c)));return Or.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new Mi({...this._def,minLength:{value:e,message:Ee.toString(n)}})}max(e,n){return new Mi({...this._def,maxLength:{value:e,message:Ee.toString(n)}})}length(e,n){return new Mi({...this._def,exactLength:{value:e,message:Ee.toString(n)}})}nonempty(e){return this.min(1,e)}}Mi.create=(t,e)=>new Mi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:$e.ZodArray,...Je(e)});function ba(t){if(t instanceof ln){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ao.create(ba(r))}return new ln({...t._def,shape:()=>e})}else return t instanceof Mi?new Mi({...t._def,type:ba(t.element)}):t instanceof ao?ao.create(ba(t.unwrap())):t instanceof Va?Va.create(ba(t.unwrap())):t instanceof cl?cl.create(t.items.map(e=>ba(e))):t}class ln extends at{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=ft.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==ke.object){const f=this._getOrReturnCtx(e);return be(f,{code:fe.invalid_type,expected:ke.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 mo&&this._def.unknownKeys==="strip"))for(const f in i.data)l.includes(f)||c.push(f);const u=[];for(const f of l){const h=s[f],m=i.data[f];u.push({key:{status:"valid",value:f},value:h._parse(new po(i,m,i.path,f)),alwaysSet:f in i.data})}if(this._def.catchall instanceof mo){const f=this._def.unknownKeys;if(f==="passthrough")for(const h of c)u.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(f==="strict")c.length>0&&(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 h of c){const m=i.data[h];u.push({key:{status:"valid",value:h},value:f._parse(new po(i,m,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const f=[];for(const h of u){const m=await h.key,g=await h.value;f.push({key:m,value:g,alwaysSet:h.alwaysSet})}return f}).then(f=>Or.mergeObjectSync(r,f)):Or.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return Ee.errToObj,new ln({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var s,l;const i=((l=(s=this._def).errorMap)==null?void 0:l.call(s,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:Ee.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new ln({...this._def,unknownKeys:"strip"})}passthrough(){return new ln({...this._def,unknownKeys:"passthrough"})}extend(e){return new ln({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ln({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:$e.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new ln({...this._def,catchall:e})}pick(e){const n={};for(const r of ft.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new ln({...this._def,shape:()=>n})}omit(e){const n={};for(const r of ft.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new ln({...this._def,shape:()=>n})}deepPartial(){return ba(this)}partial(e){const n={};for(const r of ft.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new ln({...this._def,shape:()=>n})}required(e){const n={};for(const r of ft.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof ao;)s=s._def.innerType;n[r]=s}return new ln({...this._def,shape:()=>n})}keyof(){return KM(ft.objectKeys(this.shape))}}ln.create=(t,e)=>new ln({shape:()=>t,unknownKeys:"strip",catchall:mo.create(),typeName:$e.ZodObject,...Je(e)});ln.strictCreate=(t,e)=>new ln({shape:()=>t,unknownKeys:"strict",catchall:mo.create(),typeName:$e.ZodObject,...Je(e)});ln.lazycreate=(t,e)=>new ln({shape:t,unknownKeys:"strip",catchall:mo.create(),typeName:$e.ZodObject,...Je(e)});class Wh extends at{_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 vs(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 u of r){const f={...n,common:{...n.common,issues:[]},parent:null},h=u._parseSync({data:n.data,path:n.path,parent:f});if(h.status==="valid")return h;h.status==="dirty"&&!s&&(s={result:h,ctx:f}),f.common.issues.length&&l.push(f.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const c=l.map(u=>new vs(u));return be(n,{code:fe.invalid_union,unionErrors:c}),He}}get options(){return this._def.options}}Wh.create=(t,e)=>new Wh({options:t,typeName:$e.ZodUnion,...Je(e)});function kb(t,e){const n=Zs(t),r=Zs(e);if(t===e)return{valid:!0,data:t};if(n===ke.object&&r===ke.object){const i=ft.objectKeys(e),s=ft.objectKeys(t).filter(c=>i.indexOf(c)!==-1),l={...t,...e};for(const c of s){const u=kb(t[c],e[c]);if(!u.valid)return{valid:!1};l[c]=u.data}return{valid:!0,data:l}}else if(n===ke.array&&r===ke.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const l=t[s],c=e[s],u=kb(l,c);if(!u.valid)return{valid:!1};i.push(u.data)}return{valid:!0,data:i}}else return n===ke.date&&r===ke.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Gh extends at{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,l)=>{if(ZC(s)||ZC(l))return He;const c=kb(s.value,l.value);return c.valid?((JC(s)||JC(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}))}}Gh.create=(t,e,n)=>new Gh({left:t,right:e,typeName:$e.ZodIntersection,...Je(n)});class cl extends at{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ke.array)return be(r,{code:fe.invalid_type,expected:ke.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 u=this._def.items[c]||this._def.rest;return u?u._parse(new po(r,l,r.path,c)):null}).filter(l=>!!l);return r.common.async?Promise.all(s).then(l=>Or.mergeArray(n,l)):Or.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new cl({...this._def,rest:e})}}cl.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new cl({items:t,typeName:$e.ZodTuple,rest:null,...Je(e)})};class oE extends at{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!==ke.map)return be(r,{code:fe.invalid_type,expected:ke.map,received:r.parsedType}),He;const i=this._def.keyType,s=this._def.valueType,l=[...r.data.entries()].map(([c,u],f)=>({key:i._parse(new po(r,c,r.path,[f,"key"])),value:s._parse(new po(r,u,r.path,[f,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const u of l){const f=await u.key,h=await u.value;if(f.status==="aborted"||h.status==="aborted")return He;(f.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(f.value,h.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const u of l){const f=u.key,h=u.value;if(f.status==="aborted"||h.status==="aborted")return He;(f.status==="dirty"||h.status==="dirty")&&n.dirty(),c.set(f.value,h.value)}return{status:n.value,value:c}}}}oE.create=(t,e,n)=>new oE({valueType:e,keyType:t,typeName:$e.ZodMap,...Je(n)});class Fu extends at{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==ke.set)return be(r,{code:fe.invalid_type,expected:ke.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(u){const f=new Set;for(const h of u){if(h.status==="aborted")return He;h.status==="dirty"&&n.dirty(),f.add(h.value)}return{status:n.value,value:f}}const c=[...r.data.values()].map((u,f)=>s._parse(new po(r,u,r.path,f)));return r.common.async?Promise.all(c).then(u=>l(u)):l(c)}min(e,n){return new Fu({...this._def,minSize:{value:e,message:Ee.toString(n)}})}max(e,n){return new Fu({...this._def,maxSize:{value:e,message:Ee.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Fu.create=(t,e)=>new Fu({valueType:t,minSize:null,maxSize:null,typeName:$e.ZodSet,...Je(e)});class lE extends at{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})}}lE.create=(t,e)=>new lE({getter:t,typeName:$e.ZodLazy,...Je(e)});class aE extends at{_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}}aE.create=(t,e)=>new aE({value:t,typeName:$e.ZodLiteral,...Je(e)});function KM(t,e){return new Ha({values:t,typeName:$e.ZodEnum,...Je(e)})}class Ha extends at{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return be(n,{expected:ft.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 ti(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 Ha.create(e,{...this._def,...n})}exclude(e,n=this._def){return Ha.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Ha.create=KM;class cE extends at{_parse(e){const n=ft.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==ke.string&&r.parsedType!==ke.number){const i=ft.objectValues(n);return be(r,{expected:ft.joinValues(i),received:r.parsedType,code:fe.invalid_type}),He}if(this._cache||(this._cache=new Set(ft.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=ft.objectValues(n);return be(r,{received:r.data,code:fe.invalid_enum_value,options:i}),He}return ti(e.data)}get enum(){return this._def.values}}cE.create=(t,e)=>new cE({values:t,typeName:$e.ZodNativeEnum,...Je(e)});class Zh extends at{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==ke.promise&&n.common.async===!1)return be(n,{code:fe.invalid_type,expected:ke.promise,received:n.parsedType}),He;const r=n.parsedType===ke.promise?n.data:Promise.resolve(n.data);return ti(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Zh.create=(t,e)=>new Zh({type:t,typeName:$e.ZodPromise,...Je(e)});class $a extends at{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$e.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 u=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return u.status==="aborted"?He:u.status==="dirty"||n.value==="dirty"?mu(u.value):u});{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"?mu(c.value):c}}if(i.type==="refinement"){const l=c=>{const u=i.refinement(c,s);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?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(!Ua(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=>Ua(l)?Promise.resolve(i.transform(l.value,s)).then(c=>({status:n.value,value:c})):He);ft.assertNever(i)}}$a.create=(t,e,n)=>new $a({schema:t,typeName:$e.ZodEffects,effect:e,...Je(n)});$a.createWithPreprocess=(t,e,n)=>new $a({schema:e,effect:{type:"preprocess",transform:t},typeName:$e.ZodEffects,...Je(n)});class ao extends at{_parse(e){return this._getType(e)===ke.undefined?ti(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ao.create=(t,e)=>new ao({innerType:t,typeName:$e.ZodOptional,...Je(e)});class Va extends at{_parse(e){return this._getType(e)===ke.null?ti(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Va.create=(t,e)=>new Va({innerType:t,typeName:$e.ZodNullable,...Je(e)});class Cb extends at{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===ke.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Cb.create=(t,e)=>new Cb({innerType:t,typeName:$e.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Je(e)});class Eb extends at{_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 Kh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new vs(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new vs(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Eb.create=(t,e)=>new Eb({innerType:t,typeName:$e.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Je(e)});class uE extends at{_parse(e){if(this._getType(e)!==ke.nan){const r=this._getOrReturnCtx(e);return be(r,{code:fe.invalid_type,expected:ke.nan,received:r.parsedType}),He}return{status:"valid",value:e.data}}}uE.create=t=>new uE({typeName:$e.ZodNaN,...Je(t)});class r3 extends at{_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 Kx extends at{_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(),mu(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 Kx({in:e,out:n,typeName:$e.ZodPipeline})}}class Tb extends at{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Ua(i)&&(i.value=Object.freeze(i.value)),i);return Kh(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Tb.create=(t,e)=>new Tb({innerType:t,typeName:$e.ZodReadonly,...Je(e)});var $e;(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"})($e||($e={}));mo.create;Mi.create;Wh.create;Gh.create;cl.create;const fi=Ha.create;Zh.create;ao.create;Va.create;fi(["highlight","comment","flag"]);fi(["pending","accepted","dismissed"]);fi(["yellow","red","green","blue","purple"]);fi(["info","warning","error","success"]);const i3=fi(["solo","tandem"]);fi(["user","claude","import"]);fi(["user","claude"]);fi(["accept","dismiss"]);fi(["markdown","json"]);fi(["md","txt","html","docx"]);fi(["RANGE_GONE","RANGE_MOVED","FILE_LOCKED","FILE_NOT_FOUND","NO_DOCUMENT","INVALID_RANGE","FORMAT_ERROR","PERMISSION_DENIED"]);const s3=[{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 o3({open:t,onClose:e}){return _.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,e]),t?C.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:C.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:[C.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"16px"},children:[C.jsx("h2",{style:{margin:0,fontSize:"16px",fontWeight:600,color:"var(--tandem-fg)"},children:"Keyboard Shortcuts"}),C.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:"✕"})]}),s3.map(n=>C.jsxs("div",{style:{marginBottom:"18px"},children:[C.jsx("div",{style:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:n.title}),C.jsx("table",{style:{width:"100%",borderCollapse:"collapse"},children:C.jsx("tbody",{children:n.rows.map(r=>C.jsxs("tr",{children:[C.jsx("td",{style:{paddingBottom:"5px",paddingRight:"16px",whiteSpace:"nowrap",verticalAlign:"middle",width:"1%"},children:C.jsx("span",{style:{display:"flex",gap:"4px",alignItems:"center"},children:r.keys.map((i,s)=>C.jsxs("span",{children:[C.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&&C.jsx("span",{style:{color:"var(--tandem-fg-subtle)",fontSize:"11px",margin:"0 2px"},children:"+"})]},i))})}),C.jsx("td",{style:{paddingBottom:"5px",fontSize:"13px",color:"var(--tandem-fg-muted)",verticalAlign:"middle"},children:r.description})]},r.description))})})]},n.title)),C.jsxs("div",{style:{marginTop:"12px",paddingTop:"10px",borderTop:"1px solid var(--tandem-border)",fontSize:"11px",color:"var(--tandem-fg-subtle)",textAlign:"center"},children:["Press"," ",C.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"," ",C.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 l3=[{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."}],Zf=3;function a3({currentStep:t,onNext:e,onDismiss:n}){const r=l3[t];if(!r)return null;const i=t>=Zf;return C.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&&C.jsx("div",{style:{display:"flex",gap:6,marginBottom:12},children:Array.from({length:Zf},(s,l)=>C.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:l<=t?"var(--tandem-accent)":"var(--tandem-border)",transition:"background 0.2s"}},l))}),C.jsx("div",{style:{fontSize:14,fontWeight:600,color:"var(--tandem-fg)",marginBottom:6},children:r.title}),C.jsx("div",{style:{fontSize:13,lineHeight:1.5,color:"var(--tandem-fg-muted)",marginBottom:i?0:14},children:r.text}),!i&&C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[C.jsxs("span",{style:{fontSize:11,color:"var(--tandem-fg-subtle)"},children:["Step ",t+1," of ",Zf]}),C.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[C.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"}),C.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===Zf-1?"Done":"Next"})]})]})]})}const qu=`http://localhost:${nc}/api`;function c3(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 u3(t){return t.toLowerCase().endsWith(".docx")}async function YM(t){if(u3(t.name)){const e=await t.arrayBuffer();return c3(e)}return t.text()}const dE="tandem:reviewOnlyBannerDismissed";function fE({visible:t,documentId:e}){const[n,r]=_.useState(()=>{try{return localStorage.getItem(dE)==="true"}catch{return!1}}),[i,s]=_.useState(!1),[l,c]=_.useState(null);if(!t||n)return null;async function u(){if(!(!e||i)){s(!0),c(null);try{const f=await fetch(`${qu}/convert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:e})});if(!f.ok){const h=await f.json().catch(()=>null);c((h==null?void 0:h.message)??`Conversion failed (HTTP ${f.status}).`)}}catch{c("Could not reach the server.")}finally{s(!1)}}}return C.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:[C.jsx("span",{children:"This document is open in review-only mode. You can add annotations and review, but cannot edit directly."}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[l&&C.jsx("span",{style:{color:"var(--tandem-error-fg-strong)",fontSize:"12px",maxWidth:"200px"},children:l}),e&&C.jsx("button",{type:"button","data-testid":"convert-to-markdown-btn",onClick:u,disabled:i,style:{background:"var(--tandem-info)",border:"none",color:"var(--tandem-info-fg)",cursor:i?"default":"pointer",fontWeight:500,fontSize:"12px",padding:"4px 10px",borderRadius:"4px",whiteSpace:"nowrap",opacity:i?.6:1},children:i?"Converting…":"Convert to Markdown"}),C.jsx("button",{type:"button","data-testid":"review-only-dismiss",onClick:()=>{try{localStorage.setItem(dE,"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 lu(t,e,n,r){const i=r?e.filter(u=>!r(u)):e,s=u=>{var k;const{key:f}=u;if(f!=="ArrowLeft"&&f!=="ArrowRight"&&f!=="ArrowUp"&&f!=="ArrowDown"&&f!=="Home"&&f!=="End"||i.length===0)return;u.preventDefault();const h=i.indexOf(t),m=i.length-1;let g;f==="Home"?g=0:f==="End"?g=m:f==="ArrowLeft"||f==="ArrowUp"?g=h<=0?m:h-1:g=h>=m?0:h+1;const y=i[g];n(y);const v=u.currentTarget.querySelectorAll('[role="radio"]'),S=e.indexOf(y);(k=v[S])==null||k.focus()},l=r!=null&&r(t)?i[0]:t;return{handleKeyDown:s,tabIndexFor:u=>r!=null&&r(u)?-1:u===l?0:-1}}function Yx(t){return(t==null?void 0:t.trim())||$M}function Wx(){try{return Yx(localStorage.getItem(qx))}catch{return $M}}function d3(t){const e=Yx(t);try{localStorage.setItem(qx,e)}catch{}return typeof window<"u"&&window.dispatchEvent(new Event(Sb)),e}function WM(t){const e=()=>t(Wx()),n=r=>{r.key===qx&&t(Yx(r.newValue))};return window.addEventListener(Sb,e),window.addEventListener("storage",n),()=>{window.removeEventListener(Sb,e),window.removeEventListener("storage",n)}}function GM(){const[t,e]=_.useState(Wx);_.useEffect(()=>WM(e),[]);const n=_.useCallback(r=>{const i=d3(r);e(i)},[]);return{userName:t,setUserName:n}}const f3=320,hE="tandem-settings-heading",h3='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function p3({open:t,onClose:e,settings:n,onUpdate:r,returnFocusRef:i,anchorRef:s}){const l=_.useRef(null),c=_.useRef(null),[u,f]=_.useState(window.innerWidth),h=u<768,{userName:m,setUserName:g}=GM(),[y,v]=_.useState(m);_.useEffect(()=>{y!==m&&document.activeElement!==c.current&&v(m)},[m,y]);const S=lu(n.theme,["light","dark","system"],M=>r({theme:M})),k=lu(n.layout,["tabbed","three-panel"],M=>r({layout:M}),M=>M==="three-panel"&&h),E=lu(n.primaryTab,["chat","annotations"],M=>r({primaryTab:M})),j=lu(n.panelOrder,["chat-editor-annotations","annotations-editor-chat"],M=>r({panelOrder:M})),L=lu(n.textSize,["s","m","l"],M=>r({textSize:M}));if(_.useEffect(()=>{if(!t)return;f(window.innerWidth);const M=()=>f(window.innerWidth);return window.addEventListener("resize",M),()=>window.removeEventListener("resize",M)},[t]),_.useEffect(()=>{if(!t)return;const M=l.current;return M==null||M.focus(),()=>{var N;(N=i==null?void 0:i.current)==null||N.focus()}},[t,i]),_.useEffect(()=>{if(!t)return;const M=G=>{var ce;const K=G.target;(ce=s==null?void 0:s.current)!=null&&ce.contains(K)||l.current&&!l.current.contains(K)&&e()},N=setTimeout(()=>document.addEventListener("pointerdown",M),0);return()=>{clearTimeout(N),document.removeEventListener("pointerdown",M)}},[t,e,s]),_.useEffect(()=>{if(!t)return;const M=N=>{if(N.key==="Escape"){e();return}if(N.key!=="Tab"||!l.current)return;const G=l.current.querySelectorAll(h3);if(G.length===0)return;const K=G[0],ce=G[G.length-1],ie=document.activeElement;if(!l.current.contains(ie)){N.preventDefault(),K.focus();return}N.shiftKey&&ie===K?(N.preventDefault(),ce.focus()):!N.shiftKey&&ie===ce&&(N.preventDefault(),K.focus())};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[t,e]),!t)return null;const J={fontSize:"11px",fontWeight:600,color:"var(--tandem-fg)",marginBottom:"6px",textTransform:"uppercase",letterSpacing:"0.5px"},U=(M,N)=>({flex:1,padding:"8px",minHeight:"24px",border:`2px solid ${M?"var(--tandem-accent)":"var(--tandem-border)"}`,borderRadius:"6px",background:N?"var(--tandem-surface-muted)":M?"var(--tandem-accent-bg)":"var(--tandem-surface)",cursor:N?"not-allowed":"pointer",textAlign:"center",fontSize:"11px",color:N?"var(--tandem-fg-subtle)":M?"var(--tandem-accent-fg-strong)":"var(--tandem-fg-muted)",fontWeight:M?600:400,opacity:N?.6:1,transition:"border-color 0.15s, background 0.15s"});return C.jsxs("div",{ref:l,"data-testid":"settings-popover",role:"dialog","aria-modal":"true","aria-labelledby":hE,tabIndex:-1,style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",maxHeight:"calc(100vh - 32px)",overflowY:"auto",width:`${f3}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:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[C.jsx("span",{id:hE,style:{fontSize:"13px",fontWeight:600,color:"var(--tandem-fg)"},children:"Settings"}),C.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:"×"})]}),C.jsxs("div",{children:[C.jsx("label",{htmlFor:"settings-display-name",style:J,children:"Display Name"}),C.jsx("input",{ref:c,id:"settings-display-name","data-testid":"settings-display-name",type:"text",value:y,onChange:M=>v(M.target.value),onBlur:()=>g(y),onKeyDown:M=>{M.key==="Enter"&&M.currentTarget.blur(),M.key==="Escape"&&(v(m),M.currentTarget.blur())},maxLength:VM,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"}})]}),C.jsxs("div",{children:[C.jsx("div",{id:"settings-theme-label",style:J,children:"Theme"}),C.jsx("div",{role:"radiogroup","aria-labelledby":"settings-theme-label",onKeyDown:S.handleKeyDown,style:{display:"flex",gap:"8px"},children:["light","dark","system"].map(M=>C.jsx("button",{"data-testid":`theme-${M}-btn`,role:"radio","aria-checked":n.theme===M,tabIndex:S.tabIndexFor(M),onClick:()=>r({theme:M}),style:U(n.theme===M),children:M==="light"?"Light":M==="dark"?"Dark":"System"},M))})]}),C.jsxs("div",{children:[C.jsx("div",{id:"settings-layout-label",style:J,children:"Layout"}),C.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-layout-label",onKeyDown:k.handleKeyDown,style:{display:"flex",gap:"8px"},children:[C.jsxs("button",{"data-testid":"layout-tabbed-btn",role:"radio","aria-checked":n.layout==="tabbed",tabIndex:k.tabIndexFor("tabbed"),onClick:()=>r({layout:"tabbed"}),style:U(n.layout==="tabbed"),children:[C.jsx("div",{style:{fontSize:"18px",marginBottom:"2px"},children:"[=|]"}),"Tabbed"]}),C.jsxs("button",{"data-testid":"layout-three-panel-btn",role:"radio","aria-checked":n.layout==="three-panel","aria-disabled":h||void 0,tabIndex:k.tabIndexFor("three-panel"),onClick:()=>{h||r({layout:"three-panel"})},style:U(n.layout==="three-panel",h),title:h?"Requires viewport wider than 768px":void 0,children:[C.jsx("div",{style:{fontSize:"18px",marginBottom:"2px"},children:"[|||]"}),"Three-Panel"]})]}),h&&C.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Three-panel requires a wider viewport"})]}),n.layout==="tabbed"&&C.jsxs("div",{children:[C.jsx("div",{id:"settings-default-tab-label",style:J,children:"Default Tab"}),C.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-default-tab-label",onKeyDown:E.handleKeyDown,style:{display:"flex",gap:"8px"},children:[C.jsx("button",{"data-testid":"default-tab-chat-btn",role:"radio","aria-checked":n.primaryTab==="chat",tabIndex:E.tabIndexFor("chat"),onClick:()=>r({primaryTab:"chat"}),style:U(n.primaryTab==="chat"),children:"Chat"}),C.jsx("button",{"data-testid":"default-tab-annotations-btn",role:"radio","aria-checked":n.primaryTab==="annotations",tabIndex:E.tabIndexFor("annotations"),onClick:()=>r({primaryTab:"annotations"}),style:U(n.primaryTab==="annotations"),children:"Annotations"})]})]}),n.layout==="three-panel"&&C.jsxs("div",{children:[C.jsx("div",{id:"settings-panel-order-label",style:J,children:"Panel Order"}),C.jsxs("div",{role:"radiogroup","aria-labelledby":"settings-panel-order-label",onKeyDown:j.handleKeyDown,style:{display:"flex",gap:"8px"},children:[C.jsx("button",{"data-testid":"panel-order-cea-btn",role:"radio","aria-checked":n.panelOrder==="chat-editor-annotations",tabIndex:j.tabIndexFor("chat-editor-annotations"),onClick:()=>r({panelOrder:"chat-editor-annotations"}),style:U(n.panelOrder==="chat-editor-annotations"),children:"Chat | Editor | Ann."}),C.jsx("button",{"data-testid":"panel-order-aec-btn",role:"radio","aria-checked":n.panelOrder==="annotations-editor-chat",tabIndex:j.tabIndexFor("annotations-editor-chat"),onClick:()=>r({panelOrder:"annotations-editor-chat"}),style:U(n.panelOrder==="annotations-editor-chat"),children:"Ann. | Editor | Chat"})]})]}),C.jsxs("div",{children:[C.jsxs("div",{style:J,children:["Editor Width:"," ",C.jsxs("span",{style:{fontWeight:400,textTransform:"none"},children:[n.editorWidthPercent,"%"]})]}),C.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:"How much of the available space the editor text fills"}),C.jsx("input",{"data-testid":"editor-width-slider",type:"range",min:50,max:100,step:5,value:n.editorWidthPercent,onChange:M=>r({editorWidthPercent:Number(M.target.value)}),style:{width:"100%",accentColor:"var(--tandem-accent)"},"aria-label":"Editor width"}),C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[C.jsx("span",{children:"50%"}),C.jsx("span",{children:"100%"})]})]}),C.jsxs("div",{children:[C.jsx("div",{style:J,children:"Authorship"}),C.jsxs("label",{"data-testid":"authorship-toggle",style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",fontSize:"12px",color:"var(--tandem-fg)",minHeight:"24px"},children:[C.jsx("input",{type:"checkbox",checked:n.showAuthorship,onChange:M=>r({showAuthorship:M.target.checked}),style:{accentColor:"var(--tandem-accent)"}}),C.jsx("span",{children:"Show who wrote what"})]}),C.jsxs("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:["Highlights text by author: ",C.jsx("span",{style:{color:"var(--tandem-author-user)"},children:"you"})," ","/ ",C.jsx("span",{style:{color:"var(--tandem-author-claude)"},children:"Claude"})]})]}),C.jsxs("div",{children:[C.jsx("div",{id:"settings-text-size-label",style:J,children:"Text Size"}),C.jsx("div",{role:"radiogroup","aria-labelledby":"settings-text-size-label",onKeyDown:L.handleKeyDown,style:{display:"flex",gap:"8px"},children:["s","m","l"].map(M=>C.jsx("button",{"data-testid":`text-size-${M}-btn`,role:"radio","aria-checked":n.textSize===M,tabIndex:L.tabIndexFor(M),onClick:()=>r({textSize:M}),style:U(n.textSize===M),children:M==="s"?"Small":M==="m"?"Medium":"Large"},M))}),C.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."})]}),C.jsxs("div",{children:[C.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:[C.jsx("input",{type:"checkbox",checked:n.reduceMotion,onChange:M=>r({reduceMotion:M.target.checked}),style:{accentColor:"var(--tandem-accent)"}}),C.jsx("span",{children:"Reduce motion"})]}),C.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"4px"},children:"Disables smooth autoscroll and the annotation flash animation."})]}),C.jsxs("div",{children:[C.jsxs("div",{style:J,children:["Selection Sensitivity:"," ",C.jsxs("span",{style:{fontWeight:400,textTransform:"none"},children:[(n.selectionDwellMs/1e3).toFixed(1),"s"]})]}),C.jsx("div",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginBottom:"6px"},children:"How long you must hold a selection before Claude notices it"}),C.jsx("input",{"data-testid":"dwell-time-slider",type:"range",min:Fh,max:qh,step:100,value:n.selectionDwellMs,onChange:M=>r({selectionDwellMs:Number(M.target.value)}),style:{width:"100%",accentColor:"var(--tandem-accent)"},"aria-label":"Selection dwell time"}),C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[C.jsxs("span",{children:[(Fh/1e3).toFixed(1),"s"]}),C.jsxs("span",{children:[(qh/1e3).toFixed(1),"s"]})]})]})]})}const m3={error:"var(--tandem-error)",warning:"var(--tandem-warning)",info:"var(--tandem-accent)"},g3={error:"var(--tandem-error-bg)",warning:"var(--tandem-warning-bg)",info:"var(--tandem-accent-bg)"},y3={error:"var(--tandem-error-fg-strong)",warning:"var(--tandem-warning-fg-strong)",info:"var(--tandem-accent-fg-strong)"};function b3({toasts:t,onDismiss:e}){return t.length===0?null:C.jsxs(C.Fragment,{children:[C.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
|
+
`}),C.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=>C.jsx(x3,{toast:n,onDismiss:e},n.id))})]})}function x3({toast:t,onDismiss:e}){const n=m3[t.severity],r=g3[t.severity],i=y3[t.severity],s=t.severity==="info"?"status":"alert";return C.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:[C.jsx("span",{children:t.message}),t.count>1&&C.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]}),C.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 En(t){this.content=t}En.prototype={constructor:En,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 En(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 En(n)},addToStart:function(t,e){return new En([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new En(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 En(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=En.from(t),t.size?new En(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=En.from(t),t.size?new En(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=En.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}};En.from=function(t){if(t instanceof En)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new En(e)};function ZM(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=ZM(i.content,s.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function JM(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let l=t.child(--i),c=e.child(--s),u=l.nodeSize;if(l==c){n-=u,r-=u;continue}if(!l.sameMarkup(c))return{a:n,b:r};if(l.isText&&l.text!=c.text){let f=0,h=Math.min(l.text.length,c.text.length);for(;f<h&&l.text[l.text.length-f-1]==c.text[c.text.length-f-1];)f++,n--,r--;return{a:n,b:r}}if(l.content.size||c.content.size){let f=JM(l.content,c.content,n-1,r-1);if(f)return f}n-=u,r-=u}}class ee{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let l=0,c=0;c<n;l++){let u=this.content[l],f=c+u.nodeSize;if(f>e&&r(u,i+c,s||null,l)!==!1&&u.content.size){let h=c+1;u.nodesBetween(Math.max(0,e-h),Math.min(u.content.size,n-h),r,i+h)}c=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",l=!0;return this.nodesBetween(e,n,(c,u)=>{let f=c.isText?c.text.slice(Math.max(e,u)-u,n-u):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&f||c.isTextblock)&&r&&(l?l=!1:s+=r),s+=f},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new ee(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,l=0;l<n;s++){let c=this.content[s],u=l+c.nodeSize;u>e&&((l<e||u>n)&&(c.isText?c=c.cut(Math.max(0,e-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,e-l-1),Math.min(c.content.size,n-l-1))),r.push(c),i+=c.nodeSize),l=u}return new ee(r,i)}cutByIndex(e,n){return e==n?ee.empty:e==0&&n==this.content.length?this:new ee(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 ee(i,s)}addToStart(e){return new ee([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ee(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 ZM(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return JM(this,e,n,r)}findIndex(e){if(e==0)return Jf(0,e);if(e==this.size)return Jf(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?Jf(n+1,s):Jf(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return ee.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ee(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ee.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 ee(n||e,r)}static from(e){if(!e)return ee.empty;if(e instanceof ee)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ee([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ee.empty=new ee([],0);const c0={index:0,offset:0};function Jf(t,e){return c0.index=t,c0.offset=e,c0}function Jh(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(!Jh(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Jh(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let kt=class Ab{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&&Jh(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 Ab.none;if(e instanceof Ab)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};kt.none=[];class Xh extends Error{}class 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=QM(this.content,e+this.openStart,n);return r&&new ye(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ye(XM(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(ee.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(ee.empty,0,0);function XM(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(XM(s.content,e-i-1,n-i-1)))}function QM(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=QM(l.content,e-s-1,n,l);return c&&t.replaceChild(i,l.copy(c))}function v3(t,e,n){if(n.openStart>t.depth)throw new Xh("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Xh("Inconsistent open depths");return eO(t,e,n,0)}function eO(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=eO(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 nl(l,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}else{let{start:l,end:c}=S3(n,t);return nl(s,nO(t,l,c,e,r))}else return nl(s,Qh(t,e,r))}function tO(t,e){if(!e.type.compatibleContent(t.type))throw new Xh("Cannot join "+e.type.name+" onto "+t.type.name)}function Mb(t,e,n){let r=t.node(n);return tO(r,e.node(n)),r}function tl(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 Su(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&&(tl(t.nodeAfter,r),s++));for(let c=s;c<l;c++)tl(i.child(c),r);e&&e.depth==n&&e.textOffset&&tl(e.nodeBefore,r)}function nl(t,e){return t.type.checkContent(e),t.copy(e)}function nO(t,e,n,r,i){let s=t.depth>i&&Mb(t,e,i+1),l=r.depth>i&&Mb(n,r,i+1),c=[];return Su(null,t,i,c),s&&l&&e.index(i)==n.index(i)?(tO(s,l),tl(nl(s,nO(t,e,n,r,i+1)),c)):(s&&tl(nl(s,Qh(t,e,i+1)),c),Su(e,n,i,c),l&&tl(nl(l,Qh(n,r,i+1)),c)),Su(r,null,i,c),new ee(c)}function Qh(t,e,n){let r=[];if(Su(null,t,n,r),t.depth>n){let i=Mb(t,e,n+1);tl(nl(i,Qh(t,e,n+1)),r)}return Su(e,null,n,r),new ee(r)}function S3(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(ee.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Ku{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return kt.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let c=r;r=i,i=c}let s=r.marks;for(var 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 ep(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let l=e;;){let{index:c,offset:u}=l.content.findIndex(s),f=s-u;if(r.push(l,c,i+u),!f||(l=l.child(c),l.isText))break;s=f-1,i+=u+1}return new Ku(n,r,s)}static resolveCached(e,n){let r=pE.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 pE.set(e,r=new w3);let i=r.elts[r.i]=Ku.resolve(e,n);return r.i=(r.i+1)%k3,i}}class w3{constructor(){this.elts=[],this.i=0}}const k3=12,pE=new WeakMap;class ep{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 C3=Object.create(null);let gs=class Ob{constructor(e,n,r,i=kt.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||ee.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&&Jh(this.attrs,n||e.defaultAttrs||C3)&&kt.sameSet(this.marks,r||kt.none)}copy(e=null){return e==this.content?this:new Ob(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ob(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 v3(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Ku.resolveCached(this,e)}resolveNoCache(e){return Ku.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),rO(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=ee.empty,i=0,s=r.childCount){let l=this.contentMatchAt(e).matchFragment(r,i,s),c=l&&l.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let u=i;u<s;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),l=s&&s.matchFragment(this.content,n);return l?l.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=kt.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!kt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=ee.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};gs.prototype.text=void 0;class tp extends gs{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):rO(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 tp(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new tp(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 rO(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ul{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new E3(e,n);if(r.next==null)return ul.empty;let i=iO(r);r.next&&r.err("Unexpected trailing text");let s=R3(D3(i));return N3(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(l,c){let u=l.matchFragment(e,r);if(u&&(!n||u.validEnd))return ee.from(c.map(f=>f.createAndFill()));for(let f=0;f<l.next.length;f++){let{type:h,next:m}=l.next[f];if(!(h.isText||h.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let g=s(m,c.concat(h));if(g)return g}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let l=[];for(let c=i;c.type;c=c.via)l.push(c.type);return l.reverse()}for(let l=0;l<s.next.length;l++){let{type:c,next:u}=s.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!i.type||u.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),n[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)s+=(l?", ":"")+r.next[l].type.name+"->"+e.indexOf(r.next[l].next);return s}).join(`
|
|
61
|
+
`)}}ul.empty=new ul(!0);class E3{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 iO(t){let e=[];do e.push(T3(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function T3(t){let e=[];do e.push(A3(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function A3(t){let e=_3(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=M3(t,e);else break;return e}function mE(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function M3(t,e){let n=mE(t),r=n;return t.eat(",")&&(t.next!="}"?r=mE(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function O3(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 _3(t){if(t.eat("(")){let e=iO(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=O3(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 D3(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(l,c,u){let f={term:u,to:c};return e[l].push(f),f}function i(l,c){l.forEach(u=>u.to=c)}function s(l,c){if(l.type=="choice")return l.exprs.reduce((u,f)=>u.concat(s(f,c)),[]);if(l.type=="seq")for(let u=0;;u++){let f=s(l.exprs[u],c);if(u==l.exprs.length-1)return f;i(f,c=n())}else if(l.type=="star"){let u=n();return r(c,u),i(s(l.expr,u),u),[r(u)]}else if(l.type=="plus"){let u=n();return i(s(l.expr,c),u),i(s(l.expr,u),u),[r(u)]}else{if(l.type=="opt")return[r(c)].concat(s(l.expr,c));if(l.type=="range"){let u=c;for(let f=0;f<l.min;f++){let h=n();i(s(l.expr,u),h),u=h}if(l.max==-1)i(s(l.expr,u),u);else for(let f=l.min;f<l.max;f++){let h=n();r(u,h),i(s(l.expr,u),h),u=h}return[r(u)]}else{if(l.type=="name")return[r(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function sO(t,e){return e-t}function gE(t,e){let n=[];return r(e),n.sort(sO);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let l=0;l<s.length;l++){let{term:c,to:u}=s[l];!c&&n.indexOf(u)==-1&&r(u)}}}function R3(t){let e=Object.create(null);return n(gE(t,0));function n(r){let i=[];r.forEach(l=>{t[l].forEach(({term:c,to:u})=>{if(!c)return;let f;for(let h=0;h<i.length;h++)i[h][0]==c&&(f=i[h][1]);gE(t,u).forEach(h=>{f||i.push([c,f=[]]),f.indexOf(h)==-1&&f.push(h)})})});let s=e[r.join(",")]=new ul(r.indexOf(t.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(sO);s.next.push({type:i[l][0],next:e[c.join(",")]||n(c)})}return s}}function N3(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,l=[];for(let c=0;c<i.next.length;c++){let{type:u,next:f}=i.next[c];l.push(u.name),s&&!(u.isText||u.hasRequiredAttrs())&&(s=!1),r.indexOf(f)==-1&&r.push(f)}s&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function oO(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 lO(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 aO(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 cO(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new L3(t,r,e[r]);return n}let yE=class uO{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=cO(e,r.attrs),this.defaultAttrs=oO(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==ul.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:lO(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new gs(this,this.computeAttrs(e),ee.from(n),kt.setFrom(r))}createChecked(e=null,n,r){return n=ee.from(n),this.checkContent(n),new gs(this,this.computeAttrs(e),n,kt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ee.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(ee.empty,!0);return s?new gs(this,e,n.append(s),kt.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){aO(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:kt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,l)=>r[s]=new uO(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 z3(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 L3{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?z3(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class dm{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=cO(e,i.attrs),this.excluded=null;let s=oO(this.attrs);this.instance=s?new kt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new kt(this,lO(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,l)=>r[s]=new dm(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){aO(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let Gx=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=En.from(e.nodes),n.marks=En.from(e.marks||{}),this.nodes=yE.compile(this.spec.nodes,this),this.marks=dm.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]=ul.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?bE(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==""?[]:bE(this,l.split(" "))}this.nodeFromJSON=i=>gs.fromJSON(this,i),this.markFromJSON=i=>kt.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof yE){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 tp(r,r.defaultAttrs,e,kt.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function bE(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],l=s;if(s)n.push(s);else for(let c in t.marks){let u=t.marks[c];(i=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(i)>-1)&&n.push(l=u)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function I3(t){return t.tag!=null}function j3(t){return t.style!=null}let co=class _b{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(I3(i))this.tags.push(i);else if(j3(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 vE(this,n,!1);return r.addAll(e,kt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new vE(this,n,!0);return r.addAll(e,kt.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(H3(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let l=this.styles[s],c=l.style;if(!(c.indexOf(e)!=0||l.context&&!r.matchesContext(l.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(l.getAttrs){let u=l.getAttrs(n);if(u===!1)continue;l.attrs=u||void 0}return l}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,l=0;for(;l<n.length;l++){let c=n[l];if((c.priority==null?50:c.priority)<s)break}n.splice(l,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(l=>{r(l=SE(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=SE(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new _b(e,_b.schemaRules(e)))}};const dO={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},B3={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},fO={ol:!0,ul:!0},Yu=1,Db=2,wu=4;function xE(t,e,n){return e!=null?(e?Yu:0)|(e==="full"?Db:0):t&&t.whitespace=="pre"?Yu|Db:n&~wu}class Xf{constructor(e,n,r,i,s,l){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=l,this.content=[],this.activeMarks=kt.none,this.match=s||(l&wu?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ee.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Yu)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=ee.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ee.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&&!dO.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class vE{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=xE(null,n.preserveWhitespace,0)|(r?wu:0);i?s=new Xf(i.type,i.attrs,kt.none,!0,n.topMatch||i.type.contentMatch,l):r?s=new Xf(null,null,kt.none,!0,null,l):s=new Xf(e.schema.topNodeType,null,kt.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&Db?"full":this.localPreserveWS||(i.options&Yu)>0,{schema:l}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
62
|
+
`);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let u=0;u<c.length;u++)u&&this.insertNode(l.linebreakReplacement.create(),n,!0),c[u]&&this.insertNode(l.text(c[u]),n,!/\S/.test(c[u]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let c=i.content[i.content.length-1],u=e.previousSibling;(!c||u&&u.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(r=r.slice(1))}r&&this.insertNode(l.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),c;fO.hasOwnProperty(l)&&this.parser.normalizeLists&&U3(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(u?u.ignore:B3.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let f,h=this.needsBlock;if(dO.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),f=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=u&&u.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),f&&this.sync(s),this.needsBlock=h}else{let f=this.readStyles(e,n);f&&this.addElementByRule(e,u,f,u.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
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 u=this.parser.matchStyle(s,l,this,c);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(f=>!u.clearMark(f)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)c=u;else break}}return n}addElementByRule(e,n,r,i){let s,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(l,n.attrs||null,r,n.preserveWhitespace);u&&(s=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let c=this.top;if(l&&l.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}s&&this.sync(c)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let l=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];l!=c;l=l.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(l,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let l=this.open,c=0;l>=0;l--){let u=this.nodes[l],f=u.findWrapping(e);if(f&&(!i||i.length>f.length+c)&&(i=f,s=u,!f.length))break;if(u.solid){if(r)break;c+=2}}if(!i)return null;this.sync(s);for(let l=0;l<i.length;l++)n=this.enterInner(i[l],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let l=kt.none;for(let c of i.concat(e.marks))(s.type?s.type.allowsMarkType(c.type):wE(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=xE(e,s,l.options);l.options&wu&&l.content.length==0&&(c|=wu);let u=kt.none;return r=r.filter(f=>(l.type?l.type.allowsMarkType(f.type):wE(f.type,e))?(u=f.addToSet(u),!1):!0),this.nodes.push(new Xf(e,n,u,i,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Yu)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),l=(c,u)=>{for(;c>=0;c--){let f=n[c];if(f==""){if(c==n.length-1||c==0)continue;for(;u>=s;u--)if(l(c-1,u))return!0;return!1}else{let h=u>0||u==0&&i?this.nodes[u].type:r&&u>=s?r.node(u-s).type:null;if(!h||h.name!=f&&!h.isInGroup(f))return!1;u--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function U3(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&fO.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function H3(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function SE(t){let e={};for(let n in t)e[n]=t[n];return e}function wE(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],l=c=>{s.push(c);for(let u=0;u<c.edgeCount;u++){let{type:f,next:h}=c.edge(u);if(f==e||s.indexOf(h)<0&&l(h))return!0}};if(l(i.contentMatch))return!0}}class wl{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=u0(n).createDocumentFragment());let i=r,s=[];return e.forEach(l=>{if(s.length||l.marks.length){let c=0,u=0;for(;c<s.length&&u<l.marks.length;){let f=l.marks[u];if(!this.marks[f.type.name]){u++;continue}if(!f.eq(s[c][0])||f.type.spec.spanning===!1)break;c++,u++}for(;c<s.length;)i=s.pop()[1];for(;u<l.marks.length;){let f=l.marks[u++],h=this.serializeMark(f,l.isInline,n);h&&(s.push([f,i]),i.appendChild(h.dom),i=h.contentDOM||h.dom)}}i.appendChild(this.serializeNodeInner(l,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Ah(u0(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&&Ah(u0(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Ah(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new wl(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=kE(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return kE(e.marks)}}function kE(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function u0(t){return t.document||window.document}const CE=new WeakMap;function $3(t){let e=CE.get(t);return e===void 0&&CE.set(t,e=V3(t)),e}function V3(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 Ah(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=$3(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=i.indexOf(" ");l>0&&(n=i.slice(0,l),i=i.slice(l+1));let c,u=n?t.createElementNS(n,i):t.createElement(i),f=e[1],h=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){h=2;for(let m in f)if(f[m]!=null){let g=m.indexOf(" ");g>0?u.setAttributeNS(m.slice(0,g),m.slice(g+1),f[m]):m=="style"&&u.style?u.style.cssText=f[m]:u.setAttribute(m,f[m])}}for(let m=h;m<e.length;m++){let g=e[m];if(g===0){if(m<e.length-1||m>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:y,contentDOM:v}=Ah(t,g,n,r);if(u.appendChild(y),v){if(c)throw new RangeError("Multiple content holes");c=v}}}return{dom:u,contentDOM:c}}const hO=65535,pO=Math.pow(2,16);function P3(t,e){return t+e*pO}function EE(t){return t&hO}function F3(t){return(t-(t&hO))/pO}const mO=1,gO=2,Mh=4,yO=8;class Rb{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&yO)>0}get deletedBefore(){return(this.delInfo&(mO|Mh))>0}get deletedAfter(){return(this.delInfo&(gO|Mh))>0}get deletedAcross(){return(this.delInfo&Mh)>0}}class Er{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Er.empty)return Er.empty}recover(e){let n=0,r=EE(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+F3(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?i:0);if(u>e)break;let f=this.ranges[c+s],h=this.ranges[c+l],m=u+f;if(e<=m){let g=f?e==u?-1:e==m?1:n:n,y=u+i+(g<0?0:h);if(r)return y;let v=e==(n<0?u:m)?null:P3(c/3,e-u),S=e==u?gO:e==m?mO:Mh;return(n<0?e!=u:e!=m)&&(S|=yO),new Rb(y,S,v)}i+=h-f}return r?e+i:new Rb(e+i,0,null)}touches(e,n){let r=0,i=EE(n),s=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let u=this.ranges[c]-(this.inverted?r:0);if(u>e)break;let f=this.ranges[c+s],h=u+f;if(e<=h&&c==i*3)return!0;r+=this.ranges[c+l]-f}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let l=this.ranges[i],c=l-(this.inverted?s:0),u=l+(this.inverted?0:s),f=this.ranges[i+n],h=this.ranges[i+r];e(c,c+f,u,u+h),s+=h-f}}invert(){return new Er(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Er.empty:new Er(e<0?[0,-e,0]:[0,0,e])}}Er.empty=new Er([]);class Wu{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Wu(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Wu;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let l=this._maps[s],c=l.mapResult(e,n);if(c.recover!=null){let u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new Rb(e,i,null)}}const d0=Object.create(null);class Un{getMap(){return Er.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=d0[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 d0)throw new RangeError("Duplicate use of step JSON ID "+e);return d0[e]=n,n.prototype.jsonID=e,n}}class nn{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new nn(e,null)}static fail(e){return new nn(null,e)}static fromReplace(e,n,r,i){try{return nn.ok(e.replace(n,r,i))}catch(s){if(s instanceof Xh)return nn.fail(s.message);throw s}}}function Zx(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Zx(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return ee.fromArray(r)}class io 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(Zx(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 nn.fromReplace(e,this.from,this.to,s)}invert(){return new Ai(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 io(n.pos,r.pos,this.mark)}merge(e){return e instanceof io&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new io(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 io(n.from,n.to,e.markFromJSON(n.mark))}}Un.jsonID("addMark",io);class Ai 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(Zx(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return nn.fromReplace(e,this.from,this.to,r)}invert(){return new io(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 Ai(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ai&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ai(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 Ai(n.from,n.to,e.markFromJSON(n.mark))}}Un.jsonID("removeMark",Ai);class so extends Un{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return nn.fromReplace(e,this.pos,this.pos+1,new ye(ee.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 so(this.pos,n.marks[i]);return new so(this.pos,this.mark)}}return new dl(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new so(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 so(n.pos,e.markFromJSON(n.mark))}}Un.jsonID("addNodeMark",so);class dl extends Un{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return nn.fromReplace(e,this.pos,this.pos+1,new ye(ee.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new so(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new dl(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 dl(n.pos,e.markFromJSON(n.mark))}}Un.jsonID("removeNodeMark",dl);class an 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&&Nb(e,this.from,this.to)?nn.fail("Structure replace would overwrite content"):nn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Er([this.from,this.to-this.from,this.slice.size])}invert(e){return new an(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 an(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof an)||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 an(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 an(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 an(n.from,n.to,ye.fromJSON(e,n.slice),!!n.structure)}}Un.jsonID("replace",an);class cn 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&&(Nb(e,this.from,this.gapFrom)||Nb(e,this.gapTo,this.to)))return nn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return nn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?nn.fromReplace(e,this.from,this.to,r):nn.fail("Content does not fit in gap")}getMap(){return new Er([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 cn(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 cn(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 cn(n.from,n.to,n.gapFrom,n.gapTo,ye.fromJSON(e,n.slice),n.insert,!!n.structure)}}Un.jsonID("replaceAround",cn);function Nb(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 q3(t,e,n,r){let i=[],s=[],l,c;t.doc.nodesBetween(e,n,(u,f,h)=>{if(!u.isInline)return;let m=u.marks;if(!r.isInSet(m)&&h.type.allowsMarkType(r.type)){let g=Math.max(f,e),y=Math.min(f+u.nodeSize,n),v=r.addToSet(m);for(let S=0;S<m.length;S++)m[S].isInSet(v)||(l&&l.to==g&&l.mark.eq(m[S])?l.to=y:i.push(l=new Ai(g,y,m[S])));c&&c.to==g?c.to=y:s.push(c=new io(g,y,r))}}),i.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function K3(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(l,c)=>{if(!l.isInline)return;s++;let u=null;if(r instanceof dm){let f=l.marks,h;for(;h=r.isInSet(f);)(u||(u=[])).push(h),f=h.removeFromSet(f)}else r?r.isInSet(l.marks)&&(u=[r]):u=l.marks;if(u&&u.length){let f=Math.min(c+l.nodeSize,n);for(let h=0;h<u.length;h++){let m=u[h],g;for(let y=0;y<i.length;y++){let v=i[y];v.step==s-1&&m.eq(i[y].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 Ai(l.from,l.to,l.style)))}function Jx(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),l=[],c=e+1;for(let u=0;u<s.childCount;u++){let f=s.child(u),h=c+f.nodeSize,m=r.matchType(f.type);if(!m)l.push(new an(c,h,ye.empty));else{r=m;for(let g=0;g<f.marks.length;g++)n.allowsMarkType(f.marks[g].type)||t.step(new Ai(c,h,f.marks[g]));if(i&&f.isText&&n.whitespace!="pre"){let g,y=/\r?\n|\r/g,v;for(;g=y.exec(f.text);)v||(v=new ye(ee.from(n.schema.text(" ",n.allowedMarks(f.marks))),0,0)),l.push(new an(c+g.index,c+g.index+g[0].length,v))}}c=h}if(!r.validEnd){let u=r.fillBefore(ee.empty,!0);t.replace(c,c,new ye(u,0,0))}for(let u=l.length-1;u>=0;u--)t.step(l[u])}function Y3(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function kl(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let l=t.$from.node(r),c=t.$from.index(r)+i,u=t.$to.indexAfter(r)-s;if(r<t.depth&&l.canReplace(c,u,n))return r;if(r==0||l.type.spec.isolating||!Y3(l,c,u))break;c&&(i=1),u<l.childCount&&(s=1)}return null}function W3(t,e,n){let{$from:r,$to:i,depth:s}=e,l=r.before(s+1),c=i.after(s+1),u=l,f=c,h=ee.empty,m=0;for(let v=s,S=!1;v>n;v--)S||r.index(v)>0?(S=!0,h=ee.from(r.node(v).copy(h)),m++):u--;let g=ee.empty,y=0;for(let v=s,S=!1;v>n;v--)S||i.after(v+1)<i.end(v)?(S=!0,g=ee.from(i.node(v).copy(g)),y++):f++;t.step(new cn(u,f,l,c,new ye(h.append(g),m,y),h.size-m,!0))}function Xx(t,e,n=null,r=t){let i=G3(t,e),s=i&&Z3(r,e);return s?i.map(TE).concat({type:e,attrs:n}).concat(s.map(TE)):null}function TE(t){return{type:t,attrs:null}}function G3(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 Z3(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),l=e.contentMatch.findWrapping(s.type);if(!l)return null;let u=(l.length?l[l.length-1]:e).contentMatch;for(let f=r;u&&f<i;f++)u=u.matchType(n.child(f).type);return!u||!u.validEnd?null:l}function J3(t,e,n){let r=ee.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=ee.from(n[l].type.create(n[l].attrs,r))}let i=e.start,s=e.end;t.step(new cn(i,s,i,s,new ye(r,0,0),n.length,!0))}function X3(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(l,c)=>{let u=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,u)&&Q3(t.doc,t.mapping.slice(s).map(c),r)){let f=null;if(r.schema.linebreakReplacement){let y=r.whitespace=="pre",v=!!r.contentMatch.matchType(r.schema.linebreakReplacement);y&&!v?f=!1:!y&&v&&(f=!0)}f===!1&&xO(t,l,c,s),Jx(t,t.mapping.slice(s).map(c,1),r,void 0,f===null);let h=t.mapping.slice(s),m=h.map(c,1),g=h.map(c+l.nodeSize,1);return t.step(new cn(m,g,m+1,g-1,new ye(ee.from(r.create(u,null,l.marks)),0,0),1,!0)),f===!0&&bO(t,l,c,s),!1}})}function bO(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(i.text);){let u=t.mapping.slice(r).map(n+1+s+l.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function xO(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 Q3(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function e4(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 cn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new ye(ee.from(l),0,0),1,!0))}function Mr(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,l=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let f=i.depth-1,h=n-2;f>s;f--,h--){let m=i.node(f),g=i.index(f);if(m.type.spec.isolating)return!1;let y=m.content.cutByIndex(g,m.childCount),v=r&&r[h+1];v&&(y=y.replaceChild(0,v.type.create(v.attrs)));let S=r&&r[h]||m;if(!m.canReplace(g+1,m.childCount)||!S.type.validContent(y))return!1}let c=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(c,c,u?u.type:i.node(s+1).type)}function t4(t,e,n=1,r){let i=t.doc.resolve(e),s=ee.empty,l=ee.empty;for(let c=i.depth,u=i.depth-n,f=n-1;c>u;c--,f--){s=ee.from(i.node(c).copy(s));let h=r&&r[f];l=ee.from(h?h.type.create(h.attrs,l):i.node(c).copy(l))}t.step(new an(e,e,new ye(s.append(l),n,n),!0))}function ji(t,e){let n=t.resolve(e),r=n.index();return vO(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function n4(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 vO(t,e){return!!(t&&e&&!t.isLeaf&&n4(t,e))}function rc(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&&vO(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 r4(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),l=s.node().type;if(i&&l.inlineContent){let h=l.whitespace=="pre",m=!!l.contentMatch.matchType(i);h&&!m?r=!1:!h&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let h=t.doc.resolve(e+n);xO(t,h.node(),h.before(),c)}l.inlineContent&&Jx(t,e+n-1,l,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(c),f=u.map(e-n);if(t.step(new an(f,u.map(e+n,-1),ye.empty,!0)),r===!0){let h=t.doc.resolve(f);bO(t,h.node(),h.before(),t.steps.length)}return t}function i4(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 SO(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let l=r.depth;l>=0;l--){let c=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,u=r.index(l)+(c>0?1:0),f=r.node(l),h=!1;if(s==1)h=f.canReplace(u,u,i);else{let m=f.contentMatchAt(u).findWrapping(i.firstChild.type);h=m&&f.canReplaceWith(u,u,m[0])}if(h)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function fm(t,e,n=e,r=ye.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return wO(i,s,r)?new an(e,n,r):new s4(i,s,r).fit()}function wO(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class s4{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ee.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=ee.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let f=this.findFittable();f?this.placeNodes(f):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,l=r.depth,c=i.depth;for(;l&&c&&s.childCount==1;)s=s.firstChild.content,l--,c--;let u=new ye(s,l,c);return e>-1?new cn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new an(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=f0(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let l=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:u,match:f}=this.frontier[c],h,m=null;if(n==1&&(l?f.matchType(l.type)||(m=f.fillBefore(ee.from(l),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:c,parent:s,inject:m};if(n==2&&l&&(h=f.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:c,parent:s,wrap:h};if(s&&f.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=f0(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=f0(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new ye(gu(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new ye(gu(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 S=0;S<s.length;S++)this.openFrontierNode(s[S]);let l=this.unplaced,c=r?r.content:l.content,u=l.openStart-e,f=0,h=[],{match:m,type:g}=this.frontier[n];if(i){for(let S=0;S<i.childCount;S++)h.push(i.child(S));m=m.matchFragment(i)}let y=c.size+e-(l.content.size-l.openEnd);for(;f<c.childCount;){let S=c.child(f),k=m.matchType(S.type);if(!k)break;f++,(f>1||u==0||S.content.size)&&(m=k,h.push(kO(S.mark(g.allowedMarks(S.marks)),f==1?u:0,f==c.childCount?y:-1)))}let v=f==c.childCount;v||(y=-1),this.placed=yu(this.placed,n,ee.from(h)),this.frontier[n].match=m,v&&y<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let S=0,k=c;S<y;S++){let E=k.lastChild;this.frontier.push({type:E.type,match:E.contentMatchAt(E.childCount)}),k=E.content}this.unplaced=v?e==0?ye.empty:new ye(gu(l.content,e-1,1),e-1,y<0?l.openEnd:e-1):new ye(gu(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||!h0(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=h0(e,n,i,r,s);if(l){for(let c=n-1;c>=0;c--){let{match:u,type:f}=this.frontier[c],h=h0(e,c,f,u,!0);if(!h||h.childCount)continue e}return{depth:n,fit:l,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=yu(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=yu(this.placed,this.depth,ee.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ee.empty,!0);n.childCount&&(this.placed=yu(this.placed,this.frontier.length,n))}}function gu(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(gu(t.firstChild.content,e-1,n)))}function yu(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(yu(t.lastChild.content,e-1,n)))}function f0(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function kO(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,kO(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(ee.empty,!0)))),t.copy(r)}function h0(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&&!o4(n,s.content,l)?c:null}function o4(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function l4(t){return t.spec.defining||t.spec.definingForContent}function a4(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(wO(i,s,r))return t.step(new an(e,n,r));let l=EO(i,s);l[l.length-1]==0&&l.pop();let c=-(i.depth+1);l.unshift(c);for(let g=i.depth,y=i.pos-1;g>0;g--,y--){let v=i.node(g).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;l.indexOf(g)>-1?c=g:i.before(g)==y&&l.splice(1,0,-g)}let u=l.indexOf(c),f=[],h=r.openStart;for(let g=r.content,y=0;;y++){let v=g.firstChild;if(f.push(v),y==r.openStart)break;g=v.content}for(let g=h-1;g>=0;g--){let y=f[g],v=l4(y.type);if(v&&!y.sameMarkup(i.node(Math.abs(c)-1)))h=g;else if(v||!y.type.isTextblock)break}for(let g=r.openStart;g>=0;g--){let y=(g+h+1)%(r.openStart+1),v=f[y];if(v)for(let S=0;S<l.length;S++){let k=l[(S+u)%l.length],E=!0;k<0&&(E=!1,k=-k);let j=i.node(k-1),L=i.index(k-1);if(j.canReplaceWith(L,L,v.type,v.marks))return t.replace(i.before(k),E?s.after(k):n,new ye(CO(r.content,0,r.openStart,y),y,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 y=l[g];y<0||(e=i.before(y),n=s.after(y))}}function CO(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(CO(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(ee.empty,!0))}return t}function c4(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=i4(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new ye(ee.from(r),0,0))}function u4(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),s=EO(r,i);for(let l=0;l<s.length;l++){let c=s[l],u=l==s.length-1;if(u&&c==0||r.node(c).type.contentMatch.validEnd)return t.delete(r.start(c),i.end(c));if(c>0&&(u||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return t.delete(r.before(c),i.after(c))}for(let l=1;l<=r.depth&&l<=i.depth;l++)if(e-r.start(l)==r.depth-l&&n>r.end(l)&&i.end(l)-n!=i.depth-l&&r.start(l-1)==i.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),i.index(l-1)))return t.delete(r.before(l),n);t.delete(e,n)}function EO(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class Aa extends 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 nn.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 nn.fromReplace(e,this.pos,this.pos+1,new ye(ee.from(i),0,n.isLeaf?0:1))}getMap(){return Er.empty}invert(e){return new Aa(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Aa(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Aa(n.pos,n.attr,n.value)}}Un.jsonID("attr",Aa);class Gu 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 nn.ok(r)}getMap(){return Er.empty}invert(e){return new Gu(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Gu(n.attr,n.value)}}Un.jsonID("docAttr",Gu);let Pa=class extends Error{};Pa=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Pa.prototype=Object.create(Error.prototype);Pa.prototype.constructor=Pa;Pa.prototype.name="TransformError";class Qx{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Wu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Pa(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,l,c,u)=>{e=Math.min(e,c),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ye.empty){let i=fm(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new ye(ee.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 a4(this,e,n,r),this}replaceRangeWith(e,n,r){return c4(this,e,n,r),this}deleteRange(e,n){return u4(this,e,n),this}lift(e,n){return W3(this,e,n),this}join(e,n=1){return r4(this,e,n),this}wrap(e,n){return J3(this,e,n),this}setBlockType(e,n=e,r,i=null){return X3(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return e4(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Aa(e,n,r)),this}setDocAttribute(e,n){return this.step(new Gu(e,n)),this}addNodeMark(e,n){return this.step(new so(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof kt)n.isInSet(r.marks)&&this.step(new dl(e,n));else{let i=r.marks,s,l=[];for(;s=n.isInSet(i);)l.push(new dl(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 t4(this,e,n,r),this}addMark(e,n,r){return q3(this,e,n,r),this}removeMark(e,n,r){return K3(this,e,n,r),this}clearIncompatible(e,n,r){return Jx(this,e,n,r),this}}const p0=Object.create(null);class De{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new TO(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:u,$to:f}=l[c],h=e.mapping.slice(s);e.replaceRange(h.map(u.pos),h.map(f.pos),c?ye.empty:n),c==0&&OE(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:c}=i[s],u=e.mapping.slice(r),f=u.map(l.pos),h=u.map(c.pos);s?e.deleteRange(f,h):(e.replaceRangeWith(f,h,n),OE(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Se(e):xa(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?xa(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):xa(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 qn(e.node(0))}static atStart(e){return xa(e,e,0,0,1)||new qn(e)}static atEnd(e){return xa(e,e,e.content.size,e.childCount,-1)||new qn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=p0[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 p0)throw new RangeError("Duplicate use of selection JSON ID "+e);return p0[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Se.between(this.$anchor,this.$head).getBookmark()}}De.prototype.visible=!0;class TO{constructor(e,n){this.$from=e,this.$to=n}}let AE=!1;function ME(t){!AE&&!t.parent.inlineContent&&(AE=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Se extends De{constructor(e,n=e){ME(e),ME(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return De.near(r);let i=e.resolve(n.map(this.anchor));return new Se(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 Se&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new hm(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 Se(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=De.findFrom(n,r,!0)||De.findFrom(n,-r,!0);if(s)n=s.$head;else return De.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(De.findFrom(e,-r,!0)||De.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Se(e,n)}}De.jsonID("text",Se);class hm{constructor(e,n){this.anchor=e,this.head=n}map(e){return new hm(e.map(this.anchor),e.map(this.head))}resolve(e){return Se.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ae extends De{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?De.near(s):new Ae(s)}content(){return new ye(ee.from(this.node),0,0)}eq(e){return e instanceof Ae&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new e1(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ae(e.resolve(n.anchor))}static create(e,n){return new Ae(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ae.prototype.visible=!1;De.jsonID("node",Ae);class e1{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new hm(r,r):new e1(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ae.isSelectable(r)?new Ae(n):De.near(n)}}class qn extends De{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=De.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new qn(e)}map(e){return new qn(e)}eq(e){return e instanceof qn}getBookmark(){return d4}}De.jsonID("all",qn);const d4={map(){return this},resolve(t){return new qn(t)}};function xa(t,e,n,r,i,s=!1){if(e.inlineContent)return Se.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&&Ae.isSelectable(c))return Ae.create(t,n-(i<0?c.nodeSize:0))}else{let u=xa(t,c,n+i,i<0?c.childCount:0,i,s);if(u)return u}n+=c.nodeSize*i}return null}function OE(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof an||i instanceof cn))return;let s=t.mapping.maps[r],l;s.forEach((c,u,f,h)=>{l==null&&(l=h)}),t.setSelection(De.near(t.doc.resolve(l),n))}const _E=1,Qf=2,DE=4;let f4=class extends Qx{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|_E)&~Qf,this.storedMarks=null,this}get selectionSet(){return(this.updated&_E)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Qf,this}ensureMarks(e){return kt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&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)||kt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let 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(De.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=DE,this}get scrolledIntoView(){return(this.updated&DE)>0}};function RE(t,e){return!e||!t?t:t.bind(e)}class bu{constructor(e,n,r){this.name=e,this.init=RE(n.init,r),this.apply=RE(n.apply,r)}}const h4=[new bu("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new bu("selection",{init(t,e){return t.selection||De.atStart(e.doc)},apply(t){return t.selection}}),new bu("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new bu("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class m0{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=h4.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 bu(r.key,r.spec.state,r))})}}class ka{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let l=0;l<this.config.plugins.length;l++){let c=this.config.plugins[l];if(c.spec.appendTransaction){let u=i?i[l].n:0,f=i?i[l].state:this,h=u<n.length&&c.spec.appendTransaction.call(c,u?n.slice(u):n,f,r);if(h&&r.filterTransaction(h,l)){if(h.setMeta("appendedTransaction",e),!i){i=[];for(let m=0;m<this.config.plugins.length;m++)i.push(m<l?{state:r,n:n.length}:{state:this,n:0})}n.push(h),r=r.applyInner(h),s=!0}i&&(i[l]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ka(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 f4(this)}static create(e){let n=new m0(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ka(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 m0(this.schema,e.plugins),r=n.fields,i=new ka(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 m0(e.schema,e.plugins),s=new ka(i);return i.fields.forEach(l=>{if(l.name=="doc")s.doc=gs.fromJSON(e.schema,n.doc);else if(l.name=="selection")s.selection=De.fromJSON(s.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let u=r[c],f=u.spec.state;if(u.key==l.name&&f&&f.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){s[l.name]=f.fromJSON.call(u,e,n[c],s);return}}s[l.name]=l.init(e,s)}}),s}}function AO(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=AO(i,e,{})),n[r]=i}return n}class lt{constructor(e){this.spec=e,this.props={},e.props&&AO(e.props,this,this.props),this.key=e.key?e.key.key:MO("plugin")}getState(e){return e[this.key]}}const g0=Object.create(null);function MO(t){return t in g0?t+"$"+ ++g0[t]:(g0[t]=0,t+"$")}class ht{constructor(e="key"){this.key=MO(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const An=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Fa=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let zb=null;const ps=function(t,e,n){let r=zb||(zb=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},p4=function(){zb=null},fl=function(t,e,n,r){return n&&(NE(t,e,n,r,-1)||NE(t,e,n,r,1))},m4=/^(img|br|input|textarea|hr)$/i;function NE(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Yr(t))){let l=t.parentNode;if(!l||l.nodeType!=1||kd(t)||m4.test(t.nodeName)||t.contentEditable=="false")return!1;e=An(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?Yr(t):0}else return!1}}function Yr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function g4(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=Yr(t)}else if(t.parentNode&&!kd(t))e=An(t),t=t.parentNode;else return null}}function y4(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&&!kd(t))e=An(t)+1,t=t.parentNode;else return null}}function b4(t,e,n){for(let r=e==0,i=e==Yr(t);r||i;){if(t==n)return!0;let s=An(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Yr(t)}}function kd(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 pm=function(t){return t.focusNode&&fl(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function qo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function x4(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function v4(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Yr(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Yr(r.startContainer),r.startOffset)}}}const Di=typeof navigator<"u"?navigator:null,zE=typeof document<"u"?document:null,So=Di&&Di.userAgent||"",Lb=/Edge\/(\d+)/.exec(So),OO=/MSIE \d/.exec(So),Ib=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(So),cr=!!(OO||Ib||Lb),uo=OO?document.documentMode:Ib?+Ib[1]:Lb?+Lb[1]:0,Jr=!cr&&/gecko\/(\d+)/i.test(So);Jr&&+(/Firefox\/(\d+)/.exec(So)||[0,0])[1];const jb=!cr&&/Chrome\/(\d+)/.exec(So),On=!!jb,_O=jb?+jb[1]:0,Ln=!cr&&!!Di&&/Apple Computer/.test(Di.vendor),qa=Ln&&(/Mobile\/\w+/.test(So)||!!Di&&Di.maxTouchPoints>2),qr=qa||(Di?/Mac/.test(Di.platform):!1),DO=Di?/Win/.test(Di.platform):!1,ms=/Android \d/.test(So),Cd=!!zE&&"webkitFontSmoothing"in zE.documentElement.style,S4=Cd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function w4(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 as(t,e){return typeof t=="number"?t:t[e]}function k4(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 LE(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=Fa(l);continue}let c=l,u=c==s.body,f=u?w4(s):k4(c),h=0,m=0;if(e.top<f.top+as(r,"top")?m=-(f.top-e.top+as(i,"top")):e.bottom>f.bottom-as(r,"bottom")&&(m=e.bottom-e.top>f.bottom-f.top?e.top+as(i,"top")-f.top:e.bottom-f.bottom+as(i,"bottom")),e.left<f.left+as(r,"left")?h=-(f.left-e.left+as(i,"left")):e.right>f.right-as(r,"right")&&(h=e.right-f.right+as(i,"right")),h||m)if(u)s.defaultView.scrollBy(h,m);else{let y=c.scrollLeft,v=c.scrollTop;m&&(c.scrollTop+=m),h&&(c.scrollLeft+=h);let S=c.scrollLeft-y,k=c.scrollTop-v;e={left:e.left-S,top:e.top-k,right:e.right-S,bottom:e.bottom-k}}let g=u?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(g))break;l=g=="absolute"?l.offsetParent:Fa(l)}}function C4(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,l=n+1;l<Math.min(innerHeight,e.bottom);l+=5){let c=t.root.elementFromPoint(s,l);if(!c||c==t.dom||!t.dom.contains(c))continue;let u=c.getBoundingClientRect();if(u.top>=n-20){r=c,i=u.top;break}}return{refDOM:r,refTop:i,stack: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=Fa(r));return e}function E4({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;NO(n,r==0?0:r-e)}function NO(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 ha=null;function T4(t){if(t.setActive)return t.setActive();if(ha)return t.focus(ha);let e=RO(t);t.focus(ha==null?{get preventScroll(){return ha={preventScroll:!0},!0}}:void 0),ha||(ha=!1,NO(e,0))}function zO(t,e){let n,r=2e8,i,s=0,l=e.top,c=e.top,u,f;for(let h=t.firstChild,m=0;h;h=h.nextSibling,m++){let g;if(h.nodeType==1)g=h.getClientRects();else if(h.nodeType==3)g=ps(h).getClientRects();else continue;for(let y=0;y<g.length;y++){let v=g[y];if(v.top<=l&&v.bottom>=c){l=Math.max(v.bottom,l),c=Math.min(v.top,c);let S=v.left>e.left?v.left-e.left:v.right<e.left?e.left-v.right:0;if(S<r){n=h,r=S,i=S&&n.nodeType==3?{left:v.right<e.left?v.right:v.left,top:e.top}:e,h.nodeType==1&&S&&(s=m+(e.left>=(v.left+v.right)/2?1:0));continue}}else v.top>e.top&&!u&&v.left<=e.left&&v.right>=e.left&&(u=h,f={left:Math.max(v.left,Math.min(v.right,e.left)),top:v.top});!n&&(e.left>=v.right&&e.top>=v.top||e.left>=v.left&&e.top>=v.bottom)&&(s=m+1)}}return!n&&u&&(n=u,i=f,r=0),n&&n.nodeType==3?A4(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:zO(n,i)}function A4(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=Gs(r,1);if(l.top!=l.bottom&&t1(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 t1(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function M4(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function O4(t,e,n){let{node:r,offset:i}=zO(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 _4(t,e,n,r){let i=-1;for(let s=e,l=!1;s!=t.dom;){let c=t.docView.nearestDesc(s,!0),u;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((u=c.dom.getBoundingClientRect()).width||u.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!l&&u.left>r.left||u.top>r.top?i=c.posBefore:(!l&&u.right<r.left||u.bottom<r.top)&&(i=c.posAfter),l=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?c.posBefore:c.posAfter;s=c.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function LO(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let l=t.childNodes[s];if(l.nodeType==1){let c=l.getClientRects();for(let u=0;u<c.length;u++){let f=c[u];if(t1(e,f))return LO(l,e,f)}}if((s=(s+1)%r)==i)break}return t}function D4(t,e){let n=t.dom.ownerDocument,r,i=0,s=v4(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(!t1(e,f)||(l=LO(t.dom,e,f),!l))return null}if(Ln)for(let f=l;r&&f;f=Fa(f))f.draggable&&(r=void 0);if(l=M4(l,e),r){if(Jr&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let h=r.childNodes[i],m;h.nodeName=="IMG"&&(m=h.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&i++}let f;Cd&&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=_4(t,r,i,e))}c==null&&(c=O4(t,l,e));let u=t.docView.nearestDesc(l,!0);return{pos:c,inside:u?u.posAtStart-u.border:-1}}function IE(t){return t.top<t.bottom||t.left<t.right}function Gs(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(IE(r))return r}return Array.prototype.find.call(n,IE)||t.getBoundingClientRect()}const R4=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function IO(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),l=Cd||Jr;if(r.nodeType==3)if(l&&(R4.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let u=Gs(ps(r,i,i),n);if(Jr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let f=Gs(ps(r,i-1,i-1),-1);if(f.top==u.top){let h=Gs(ps(r,i,i+1),-1);if(h.top!=u.top)return au(h,h.left<f.left)}}return u}else{let u=i,f=i,h=n<0?1:-1;return n<0&&!i?(f++,h=-1):n>=0&&i==r.nodeValue.length?(u--,h=1):n<0?u--:f++,au(Gs(ps(r,u,f),h),h<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Yr(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return y0(u.getBoundingClientRect(),!1)}if(s==null&&i<Yr(r)){let u=r.childNodes[i];if(u.nodeType==1)return y0(u.getBoundingClientRect(),!0)}return y0(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Yr(r))){let u=r.childNodes[i-1],f=u.nodeType==3?ps(u,Yr(u)-(l?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(f)return au(Gs(f,1),!1)}if(s==null&&i<Yr(r)){let u=r.childNodes[i];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let f=u?u.nodeType==3?ps(u,0,l?0:1):u.nodeType==1?u:null:null;if(f)return au(Gs(f,-1),!0)}return au(Gs(r.nodeType==3?ps(r):r,-n),n>=0)}function au(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 y0(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 jO(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 N4(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return jO(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=IO(t,i.pos,1);for(let c=s.firstChild;c;c=c.nextSibling){let u;if(c.nodeType==1)u=c.getClientRects();else if(c.nodeType==3)u=ps(c,0,c.nodeValue.length).getClientRects();else continue;for(let f=0;f<u.length;f++){let h=u[f];if(h.bottom>h.top+1&&(n=="up"?l.top-h.top>(h.bottom-l.top)*2:h.bottom-l.bottom>(l.bottom-h.top)*2))return!1}}return!0})}const z4=/[\u0590-\u08ac]/;function L4(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?!z4.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?s:l:jO(t,e,()=>{let{focusNode:u,focusOffset:f,anchorNode:h,anchorOffset:m}=t.domSelectionRange(),g=c.caretBidiLevel;c.modify("move",n,"character");let y=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:v,focusOffset:S}=t.domSelectionRange(),k=v&&!y.contains(v.nodeType==1?v:v.parentNode)||u==v&&f==S;try{c.collapse(h,m),u&&(u!=h||f!=m)&&c.extend&&c.extend(u,f)}catch{}return g!=null&&(c.caretBidiLevel=g),k}):r.pos==r.start()||r.pos==r.end()}let jE=null,BE=null,UE=!1;function I4(t,e,n){return jE==e&&BE==n?UE:(jE=e,BE=n,UE=n=="up"||n=="down"?N4(t,e,n):L4(t,e,n))}const Xr=0,HE=1,Go=2,Ri=3;class Ed{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Xr,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>An(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 BO&&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?An(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?An(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let l=r,c=0;;c++){let u=this.children[c],f=l+u.size;if(i==-1&&e<=f){let h=l+u.border;if(e>=h&&n<=f-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,h);e=l;for(let m=c;m>0;m--){let g=this.children[m-1];if(g.size&&g.dom.parentNode==this.contentDOM&&!g.emptyChildAt(1)){i=An(g.dom)+1;break}e-=g.size}i==-1&&(i=0)}if(i>-1&&(f>n||c==this.children.length-1)){n=f;for(let h=c+1;h<this.children.length;h++){let m=this.children[h];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){s=An(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 y=0,v=0;y<this.children.length;y++){let S=this.children[y],k=v+S.size;if(s>v&&l<k)return S.setSelection(e-v-S.border,n-v-S.border,r,i);v=k}let c=this.domFromPos(e,e?-1:1),u=n==e?c:this.domFromPos(n,n?-1:1),f=r.root.getSelection(),h=r.domSelectionRange(),m=!1;if((Jr||Ln)&&e==n){let{node:y,offset:v}=c;if(y.nodeType==3){if(m=!!(v&&y.nodeValue[v-1]==`
|
|
65
|
+
`),m&&v==y.nodeValue.length)for(let S=y,k;S;S=S.parentNode){if(k=S.nextSibling){k.nodeName=="BR"&&(c=u={node:k.parentNode,offset:An(k)+1});break}let E=S.pmViewDesc;if(E&&E.node&&E.node.isBlock)break}}else{let S=y.childNodes[v-1];m=S&&(S.nodeName=="BR"||S.contentEditable=="false")}}if(Jr&&h.focusNode&&h.focusNode!=u.node&&h.focusNode.nodeType==1){let y=h.focusNode.childNodes[h.focusOffset];y&&y.contentEditable=="false"&&(i=!0)}if(!(i||m&&Ln)&&fl(c.node,c.offset,h.anchorNode,h.anchorOffset)&&fl(u.node,u.offset,h.focusNode,h.focusOffset))return;let g=!1;if((f.extend||e==n)&&!(m&&Jr)){f.collapse(c.node,c.offset);try{e!=n&&f.extend(u.node,u.offset),g=!0}catch{}}if(!g){if(e>n){let v=c;c=u,u=v}let y=document.createRange();y.setEnd(u.node,u.offset),y.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(y)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],l=r+s.size;if(r==l?e<=l&&n>=r:e<l&&n>r){let c=r+s.border,u=l-s.border;if(e>=c&&n<=u){this.dirty=e==r||n==l?Go:HE,e==c&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Ri:s.markDirty(e-c,n-c);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Go:Ri}r=l}this.dirty=Go}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Go:HE;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class BO extends Ed{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==Xr&&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 j4 extends Ed{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 hl extends Ed{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=wl.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new hl(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Ri||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ri&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Xr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Xr}}slice(e,n,r){let i=hl.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;n<l&&(s=Ub(s,n,l,r)),e>0&&(s=Ub(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 fo extends Ed{constructor(e,n,r,i,s,l,c,u,f){super(e,[],s,l),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(e,n,r,i,s,l){let c=s.nodeViews[n.type.name],u,f=c&&c(n,s,()=>{if(!u)return l;if(u.parent)return u.parent.posBeforeChild(u)},r,i),h=f&&f.dom,m=f&&f.contentDOM;if(n.isText){if(!h)h=document.createTextNode(n.text);else if(h.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else h||({dom:h,contentDOM:m}=wl.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&h.nodeName!="BR"&&(h.hasAttribute("contenteditable")||(h.contentEditable="false"),n.type.spec.draggable&&(h.draggable=!0));let g=h;return h=VO(h,r,n),f?u=new B4(e,n,r,i,h,m||null,g,f,s,l+1):n.isText?new mm(e,n,r,i,h,g,s):new fo(e,n,r,i,h,m||null,g,s,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ee.empty)}return e}matchesNode(e,n,r){return this.dirty==Xr&&e.eq(this.node)&&np(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,l=s&&s.pos>-1?s:null,c=s&&s.pos<0,u=new H4(this,l&&l.node,e);P4(this.node,this.innerDeco,(f,h,m)=>{f.spec.marks?u.syncToMarks(f.spec.marks,r,e,h):f.type.side>=0&&!m&&u.syncToMarks(h==this.node.childCount?kt.none:this.node.child(h).marks,r,e,h),u.placeWidget(f,e,i)},(f,h,m,g)=>{u.syncToMarks(f.marks,r,e,g);let y;u.findNodeMatch(f,h,m,g)||c&&e.state.selection.from>i&&e.state.selection.to<i+f.nodeSize&&(y=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(f,h,m,y,e)||u.updateNextNode(f,h,m,e,g,i)||u.addNode(f,h,m,e,i),i+=f.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Go)&&(l&&this.protectLocalComposition(e,l),HO(this.contentDOM,this.children,e),qa&&F4(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Se)||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=q4(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 j4(this,s,n,i);e.input.compositionNodes.push(l),this.children=Ub(this.children,r,r+i.length,e,l)}update(e,n,r,i){return this.dirty==Ri||!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=Xr}updateOuterDeco(e){if(np(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=$O(this.dom,this.nodeDOM,Bb(this.outerDeco,this.node,n),Bb(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 $E(t,e,n,r,i){VO(r,e,t);let s=new fo(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class mm extends fo{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==Ri||this.dirty!=Xr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Xr||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=Xr,!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 mm(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=Ri)}get domAtom(){return!1}isText(e){return this.node.text==e}}class UO extends Ed{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Xr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class B4 extends fo{constructor(e,n,r,i,s,l,c,u,f,h){super(e,n,r,i,s,l,c,f,h),this.spec=u}update(e,n,r,i){if(this.dirty==Ri)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 HO(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=VE(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(c,r);if(l instanceof hl){let u=r?r.previousSibling:t.lastChild;HO(l.contentDOM,l.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=VE(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const ku=function(t){t&&(this.nodeName=t)};ku.prototype=Object.create(null);const Zo=[new ku];function Bb(t,e,n){if(t.length==0)return Zo;let r=n?Zo[0]:new ku,i=[r];for(let s=0;s<t.length;s++){let l=t[s].type.attrs;if(l){l.nodeName&&i.push(r=new ku(l.nodeName));for(let c in l){let u=l[c];u!=null&&(n&&i.length==1&&i.push(r=new ku(e.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+u:c=="style"?r.style=(r.style?r.style+";":"")+u:c!="nodeName"&&(r[c]=u))}}}return i}function $O(t,e,n,r){if(n==Zo&&r==Zo)return e;let i=e;for(let s=0;s<r.length;s++){let l=r[s],c=n[s];if(s){let u;c&&c.nodeName==l.nodeName&&i!=t&&(u=i.parentNode)&&u.nodeName.toLowerCase()==l.nodeName||(u=document.createElement(l.nodeName),u.pmIsDeco=!0,u.appendChild(i),c=Zo[0]),i=u}U4(i,c||Zo[0],l)}return i}function U4(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 VO(t,e,n){return $O(t,t,Zo,Bb(e,n,t.nodeType!=1))}function np(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 VE(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class H4{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=$4(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=Xr,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let u=-1,f=this.top.children.length;i<this.preMatch.index&&(f=Math.min(this.index+3,f));for(let h=this.index;h<f;h++){let m=this.top.children[h];if(m.matchesMark(e[l])&&!this.isLocked(m.dom)){u=h;break}}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let h=hl.create(this.top,e[l],n,r);this.top.children.splice(this.index,0,h),this.top=h,this.changed=!0}this.index=0,l++}}findNodeMatch(e,n,r,i){let s=-1,l;if(i>=this.preMatch.index&&(l=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&l.matchesNode(e,n,r))s=this.top.children.indexOf(l,this.index);else for(let c=this.index,u=Math.min(this.top.children.length,c+5);c<u;c++){let f=this.top.children[c];if(f.matchesNode(e,n,r)&&!this.preMatch.matched.has(f)){s=c;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let l=this.top.children[i];return l.dirty==Ri&&l.dom==l.contentDOM&&(l.dirty=Go),l.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,l){for(let c=this.index;c<this.top.children.length;c++){let u=this.top.children[c];if(u instanceof fo){let f=this.preMatch.matched.get(u);if(f!=null&&f!=s)return!1;let h=u.dom,m,g=this.isLocked(h)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=Ri&&np(n,u.outerDeco));if(!g&&u.update(e,n,r,i))return this.destroyBetween(this.index,c),u.dom!=h&&(this.changed=!0),this.index++,!0;if(!g&&(m=this.recreateWrapper(u,e,n,r,i,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=Go,m.updateChildren(i,l+1),m.dirty=Xr),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)||!np(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let c=fo.create(this.top,n,r,i,s,l);if(c.contentDOM){c.children=e.children,e.children=[];for(let u of c.children)u.parent=c}return e.destroy(),c}addNode(e,n,r,i,s){let l=fo.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 BO(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 hl;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof mm)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Ln||On)&&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 $4(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 hl)n=f,r=f.children.length;else{c=f,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=c.node;if(u){if(u!=t.child(i-1))break;--i,s.set(c,i),l.push(c)}}return{index:i,matched:s,matches:l.reverse()}}function V4(t,e){return t.type.side-e.type.side}function P4(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let f=0;f<t.childCount;f++){let h=t.child(f);r(h,i,e.forChild(s,h),f),s+=h.nodeSize}return}let l=0,c=[],u=null;for(let f=0;;){let h,m;for(;l<i.length&&i[l].to==s;){let k=i[l++];k.widget&&(h?(m||(m=[h])).push(k):h=k)}if(h)if(m){m.sort(V4);for(let k=0;k<m.length;k++)n(m[k],f,!!u)}else n(h,f,!!u);let g,y;if(u)y=-1,g=u,u=null;else if(f<t.childCount)y=f,g=t.child(f++);else break;for(let k=0;k<c.length;k++)c[k].to<=s&&c.splice(k--,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 k=v;l<i.length&&i[l].from<k&&(k=i[l].from);for(let E=0;E<c.length;E++)c[E].to<k&&(k=c[E].to);k<v&&(u=g.cut(k-s),g=g.cut(0,k-s),v=k,y=-1)}else for(;l<i.length&&i[l].to<v;)l++;let S=g.isInline&&!g.isLeaf?c.filter(k=>!k.inline):c.slice();r(g,S,e.forChild(s,g),y),s=v}}function F4(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 q4(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let l=t.child(i++),c=s;if(s+=l.nodeSize,!l.isText)continue;let u=l.text;for(;i<t.childCount;){let f=t.child(i++);if(s+=f.nodeSize,!f.isText)break;u+=f.text}if(s>=n){if(s>=r&&u.slice(r-e.length-c,r-c)==e)return r-e.length;let f=c<r?u.lastIndexOf(e,r-c-1):-1;if(f>=0&&f+e.length+c>=n)return c+f;if(n==r&&u.length>=r+e.length-c&&u.slice(r-c,r-c+e.length)==e)return r}}return-1}function Ub(t,e,n,r,i){let s=[];for(let l=0,c=0;l<t.length;l++){let u=t[l],f=c,h=c+=u.size;f>=n||h<=e?s.push(u):(f<e&&s.push(u.slice(0,e-f,r)),i&&(s.push(i),i=void 0),h>n&&s.push(u.slice(n-f,u.size,r)))}return s}function n1(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c=r.resolve(l),u,f;if(pm(n)){for(u=l;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Ae.isSelectable(m)&&i.parent&&!(m.isInline&&b4(n.focusNode,n.focusOffset,i.dom))){let g=i.posBefore;f=new Ae(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 y=0;y<n.rangeCount;y++){let v=n.getRangeAt(y);m=Math.min(m,t.docView.posFromDOM(v.startContainer,v.startOffset,1)),g=Math.max(g,t.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(m<0)return null;[u,l]=g==t.state.selection.anchor?[g,m]:[m,g],c=r.resolve(l)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let h=r.resolve(u);if(!f){let m=e=="pointer"||t.state.selection.head<c.pos&&!s?1:-1;f=r1(t,h,c,m)}return f}function PO(t){return t.editable?t.hasFocus():qO(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function ys(t,e=!1){let n=t.state.selection;if(FO(t,n),!!PO(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&On){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&fl(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Y4(t);else{let{anchor:r,head:i}=n,s,l;PE&&!(n instanceof Se)&&(n.$from.parent.inlineContent||(s=FE(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=FE(t,n.to))),t.docView.setSelection(r,i,t,e),PE&&(s&&qE(s),l&&qE(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&K4(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const PE=Ln||On&&_O<63;function FE(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Ln&&i&&i.contentEditable=="false")return b0(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return b0(i);if(s)return b0(s)}}function b0(t){return t.contentEditable="true",Ln&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function qE(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function K4(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 Y4(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,An(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&cr&&uo<=11&&(n.disabled=!0,n.disabled=!1)}function FO(t,e){if(e instanceof Ae){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(KE(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else KE(t)}function KE(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function r1(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Se.between(e,n,r)}function YE(t){return t.editable&&!t.hasFocus()?!1:qO(t)}function qO(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 W4(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return fl(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Hb(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&De.findFrom(s,e)}function Js(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 Se)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 Js(t,new Se(r.$anchor,l))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=Hb(t.state,e);return i&&i instanceof Ae?Js(t,i):!1}else if(!(qr&&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?Ae.isSelectable(s)?Js(t,new Ae(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Cd?Js(t,new Se(t.state.doc.resolve(e<0?c:c+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ae&&r.node.isInline)return Js(t,new Se(e>0?r.$to:r.$from));{let i=Hb(t.state,e);return i?Js(t,i):!1}}}function rp(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Cu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function pa(t,e){return e<0?G4(t):Z4(t)}function G4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,l=!1;for(Jr&&n.nodeType==1&&r<rp(n)&&Cu(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Cu(c,-1))i=n,s=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(KO(n))break;{let c=n.previousSibling;for(;c&&Cu(c,-1);)i=n.parentNode,s=An(c),c=c.previousSibling;if(c)n=c,r=rp(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}l?$b(t,n,r):i&&$b(t,i,s)}function Z4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=rp(n),s,l;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(Cu(c,1))s=n,l=++r;else break}else{if(KO(n))break;{let c=n.nextSibling;for(;c&&Cu(c,1);)s=c.parentNode,l=An(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=rp(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&$b(t,s,l)}function KO(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function J4(t,e){for(;t&&e==t.childNodes.length&&!kd(t);)e=An(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 X4(t,e){for(;t&&!e&&!kd(t);)e=An(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 $b(t,e,n){if(e.nodeType!=3){let s,l;(l=J4(e,n))?(e=l,n=0):(s=X4(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(pm(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&&ys(t)},50)}function GE(t,e){let n=t.state.doc.resolve(e);if(!(On||DO)&&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 ZE(t,e,n){let r=t.state.selection;if(r instanceof Se&&!r.empty||n.indexOf("s")>-1||qr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=Hb(t.state,e);if(l&&l instanceof Ae)return Js(t,l)}if(!i.parent.inlineContent){let l=e<0?i:s,c=r instanceof qn?De.near(l,e):De.findFrom(l,e);return c?Js(t,c):!1}return!1}function JE(t,e){if(!(t.state.selection instanceof Se))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 XE(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Q4(t){if(!Ln||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;XE(t,r,"true"),setTimeout(()=>XE(t,r,"false"),20)}return!1}function eI(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function tI(t,e){let n=e.keyCode,r=eI(e);if(n==8||qr&&n==72&&r=="c")return JE(t,-1)||pa(t,-1);if(n==46&&!e.shiftKey||qr&&n==68&&r=="c")return JE(t,1)||pa(t,1);if(n==13||n==27)return!0;if(n==37||qr&&n==66&&r=="c"){let i=n==37?GE(t,t.state.selection.from)=="ltr"?-1:1:-1;return WE(t,i,r)||pa(t,i)}else if(n==39||qr&&n==70&&r=="c"){let i=n==39?GE(t,t.state.selection.from)=="ltr"?1:-1:1;return WE(t,i,r)||pa(t,i)}else{if(n==38||qr&&n==80&&r=="c")return ZE(t,-1,r)||pa(t,-1);if(n==40||qr&&n==78&&r=="c")return Q4(t)||ZE(t,1,r)||pa(t,1);if(r==(qr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function i1(t,e){t.someProp("transformCopied",y=>{e=y(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let y=r.firstChild;n.push(y.type.name,y.attrs!=y.type.defaultAttrs?y.attrs:null),r=y.content}let l=t.someProp("clipboardSerializer")||wl.fromSchema(t.state.schema),c=XO(),u=c.createElement("div");u.appendChild(l.serializeFragment(r,{document:c}));let f=u.firstChild,h,m=0;for(;f&&f.nodeType==1&&(h=JO[f.nodeName.toLowerCase()]);){for(let y=h.length-1;y>=0;y--){let v=c.createElement(h[y]);for(;u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),m++}f=u.firstChild}f&&f.nodeType==1&&f.setAttribute("data-pm-slice",`${i} ${s}${m?` -${m}`:""} ${JSON.stringify(n)}`);let g=t.someProp("clipboardTextSerializer",y=>y(e,t))||e.content.textBetween(0,e.content.size,`
|
|
66
|
+
|
|
67
|
+
`);return{dom:u,text:g,slice:e}}function YO(t,e,n,r,i){let s=i.parent.type.spec.code,l,c;if(!n&&!e)return null;let u=!!e&&(r||s||!n);if(u){if(t.someProp("transformPastedText",g=>{e=g(e,s||r,t)}),s)return c=new ye(ee.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:y}=t.state,v=wl.fromSchema(y);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(S=>{let k=l.appendChild(document.createElement("p"));S&&k.appendChild(v.serializeNode(y.text(S,g)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),l=sI(n),Cd&&oI(l);let f=l&&l.querySelector("[data-pm-slice]"),h=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let m=+h[3];m>0;m--){let g=l.firstChild;for(;g&&g.nodeType!=1;)g=g.nextSibling;if(!g)break;l=g}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||co.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(u||h),context:i,ruleFromNode(g){return g.nodeName=="BR"&&!g.nextSibling&&g.parentNode&&!nI.test(g.parentNode.nodeName)?{ignore:!0}:null}})),h)c=lI(QE(c,+h[1],+h[2]),h[4]);else if(c=ye.maxOpen(rI(c.content,i),!0),c.openStart||c.openEnd){let m=0,g=0;for(let y=c.content.firstChild;m<c.openStart&&!y.type.spec.isolating;m++,y=y.firstChild);for(let y=c.content.lastChild;g<c.openEnd&&!y.type.spec.isolating;g++,y=y.lastChild);c=QE(c,m,g)}return t.someProp("transformPasted",m=>{c=m(c,t,u)}),c}const nI=/^(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 rI(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,l=[];if(t.forEach(c=>{if(!l)return;let u=i.findWrapping(c.type),f;if(!u)return l=null;if(f=l.length&&s.length&&GO(u,s,c,l[l.length-1],0))l[l.length-1]=f;else{l.length&&(l[l.length-1]=ZO(l[l.length-1],s.length));let h=WO(c,u);l.push(h),i=i.matchType(h.type),s=u}}),l)return ee.from(l)}return t}function WO(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ee.from(t));return t}function GO(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=GO(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(ee.from(WO(n,t,i+1))))}}function ZO(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,ZO(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(ee.empty,!0);return t.copy(n.append(r))}function Vb(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=Vb(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(ee.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(c))}function QE(t,e,n){return e<t.openStart&&(t=new ye(Vb(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ye(Vb(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const JO={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 eT=null;function XO(){return eT||(eT=document.implementation.createHTMLDocument("title"))}let x0=null;function iI(t){let e=window.trustedTypes;return e?(x0||(x0=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),x0.createHTML(t)):t}function sI(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=XO().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&JO[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=iI(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function oI(t){let e=t.querySelectorAll(On?"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 lI(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:l}=t;for(let c=r.length-2;c>=0;c-=2){let u=n.nodes[r[c]];if(!u||u.hasRequiredAttrs())break;i=ee.from(u.create(r[c+1],i)),s++,l++}return new ye(i,s,l)}const Wn={},Gn={},aI={touchstart:!0,touchmove:!0};class cI{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 uI(t){for(let e in Wn){let n=Wn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{fI(t,r)&&!s1(t,r)&&(t.editable||!(r.type in Gn))&&n(t,r)},aI[e]?{passive:!0}:void 0)}Ln&&t.dom.addEventListener("input",()=>null),Pb(t)}function oo(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function dI(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 Pb(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>s1(t,r))})}function s1(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function fI(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 hI(t,e){!s1(t,e)&&Wn[e.type]&&(t.editable||!(e.type in Gn))&&Wn[e.type](t,e)}Gn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!e_(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ms&&On&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),qa&&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,qo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||tI(t,n)?n.preventDefault():oo(t,"key")};Gn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Gn.keypress=(t,e)=>{let n=e;if(e_(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||qr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Se)||!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 gm(t){return{left:t.clientX,top:t.clientY}}function pI(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function o1(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 Ma(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 mI(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ae.isSelectable(r)?(Ma(t,new Ae(n)),!0):!1}function gI(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Ae&&(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(Ae.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?(Ma(t,Ae.create(t.state.doc,i)),!0):!1}function yI(t,e,n,r,i){return o1(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?gI(t,n):mI(t,n))}function bI(t,e,n,r){return o1(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function xI(t,e,n,r){return o1(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||vI(t,n,r)}function vI(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ma(t,Se.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)Ma(t,Se.create(r,c+1,c+1+l.content.size));else if(Ae.isSelectable(l))Ma(t,Ae.create(r,c));else continue;return!0}}function l1(t){return ip(t)}const QO=qr?"metaKey":"ctrlKey";Wn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=l1(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&pI(n,t.input.lastClick)&&!n[QO]&&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(gm(n));l&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new SI(t,l,n,!!r)):(s=="doubleClick"?bI:xI)(t,l.pos,l.inside,n)?n.preventDefault():oo(t,"pointer"))};class SI{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[QO],this.allowDefault=r.shiftKey;let s,l;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),l=n.inside;else{let h=e.state.doc.resolve(n.pos);s=h.parent,l=h.depth?h.before():0}const c=i?null:r.target,u=c?e.docView.nearestDesc(c,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:f}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||f instanceof Ae&&f.from<=l&&f.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Jr&&!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)),oo(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(()=>ys(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(gm(e))),this.updateAllowDefault(e),this.allowDefault||!n?oo(this.view,"pointer"):yI(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Ln&&this.mightDrag&&!this.mightDrag.node.isAtom||On&&!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)?(Ma(this.view,De.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):oo(this.view,"pointer")}move(e){this.updateAllowDefault(e),oo(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)}}Wn.touchstart=t=>{t.input.lastTouch=Date.now(),l1(t),oo(t,"pointer")};Wn.touchmove=t=>{t.input.lastTouch=Date.now(),oo(t,"pointer")};Wn.contextmenu=t=>l1(t);function e_(t,e){return t.composing?!0:Ln&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const wI=ms?5e3:-1;Gn.compositionstart=Gn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Se&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||On&&DO&&kI(t)))t.markCursor=t.state.storedMarks||n.marks(),ip(t,!0),t.markCursor=null;else if(ip(t,!e.selection.empty),Jr&&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}t_(t,wI)};function kI(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"}Gn.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++,t_(t,20))};function t_(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>ip(t),e))}function n_(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=EI());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function CI(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=g4(e.focusNode,e.focusOffset),r=y4(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 EI(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function ip(t,e=!1){if(!(ms&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),n_(t),e||t.docView&&t.docView.dirty){let n=n1(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 TI(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Zu=cr&&uo<15||qa&&S4<604;Wn.copy=Gn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=Zu?null:n.clipboardData,l=r.content(),{dom:c,text:u}=i1(t,l);s?(n.preventDefault(),s.clearData(),s.setData("text/html",c.innerHTML),s.setData("text/plain",u)):TI(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function AI(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function MI(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ju(t,r.value,null,i,e):Ju(t,r.textContent,r.innerHTML,i,e)},50)}function Ju(t,e,n,r,i){let s=YO(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,s||ye.empty)))return!0;if(!s)return!1;let l=AI(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 r_(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," "):""}Gn.paste=(t,e)=>{let n=e;if(t.composing&&!ms)return;let r=Zu?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Ju(t,r_(r),r.getData("text/html"),i,n)?n.preventDefault():MI(t,n)};class i_{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const OI=qr?"altKey":"ctrlKey";function s_(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[OI]}Wn.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(gm(n)),l;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Ae?i.to-1:i.to))){if(r&&r.mightDrag)l=Ae.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=Ae.create(t.state.doc,m.posBefore))}}let c=(l||t.state.selection).content(),{dom:u,text:f,slice:h}=i1(t,c);(!n.dataTransfer.files.length||!On||_O>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Zu?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",Zu||n.dataTransfer.setData("text/plain",f),t.dragging=new i_(h,s_(t,n),l)};Wn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Gn.dragover=Gn.dragenter=(t,e)=>e.preventDefault();Gn.drop=(t,e)=>{try{_I(t,e,t.dragging)}finally{t.dragging=null}};function _I(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(gm(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",y=>{s=y(s,t,!1)}):s=YO(t,r_(e.dataTransfer),Zu?null:e.dataTransfer.getData("text/html"),!1,i);let l=!!(n&&s_(t,e));if(t.someProp("handleDrop",y=>y(t,e,s||ye.empty,l))){e.preventDefault();return}if(!s)return;e.preventDefault();let c=s?SO(t.state.doc,i.pos,s):i.pos;c==null&&(c=i.pos);let u=t.state.tr;if(l){let{node:y}=n;y?y.replace(u):u.deleteSelection()}let f=u.mapping.map(c),h=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,m=u.doc;if(h?u.replaceRangeWith(f,f,s.content.firstChild):u.replaceRange(f,f,s),u.doc.eq(m))return;let g=u.doc.resolve(f);if(h&&Ae.isSelectable(s.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new Ae(g));else{let y=u.mapping.map(c);u.mapping.maps[u.mapping.maps.length-1].forEach((v,S,k,E)=>y=E),u.setSelection(r1(t,g,u.doc.resolve(y)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}Wn.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())&&ys(t)},20))};Wn.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)};Wn.beforeinput=(t,e)=>{if(On&&ms&&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,qo(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 Gn)Wn[t]=Gn[t];function Xu(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class sp{constructor(e,n){this.toDOM=e,this.spec=n||rl,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:l}=e.mapResult(n.from+i,this.side<0?-1:1);return l?null:new Vt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof sp&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Xu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ho{constructor(e,n){this.attrs=e,this.spec=n||rl}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,l=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=l?null:new Vt(s,l,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof ho&&Xu(this.attrs,e.attrs)&&Xu(this.spec,e.spec)}static is(e){return e.type instanceof ho}destroy(){}}class a1{constructor(e,n){this.attrs=e,this.spec=n||rl}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let l=e.mapResult(n.to+i,-1);return l.deleted||l.pos<=s.pos?null:new Vt(s.pos-r,l.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof a1&&Xu(this.attrs,e.attrs)&&Xu(this.spec,e.spec)}destroy(){}}class Vt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Vt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new Vt(e,e,new sp(n,r))}static inline(e,n,r,i){return new Vt(e,n,new ho(r,i))}static node(e,n,r,i){return new Vt(e,n,new a1(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ho}get widget(){return this.type instanceof sp}}const va=[],rl={};class dt{constructor(e,n){this.local=e.length?e:va,this.children=n.length?n:va}static create(e,n){return n.length?op(n,e,0,rl):Rn}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let l=0;l<this.local.length;l++){let c=this.local[l];c.from<=n&&c.to>=e&&(!s||s(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<n&&this.children[l+1]>e){let c=this.children[l]+1;this.children[l+2].findInner(e-c,n-c,r,i+c,s)}}map(e,n,r){return this==Rn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||rl)}mapInner(e,n,r,i,s){let l;for(let c=0;c<this.local.length;c++){let u=this.local[c].map(e,r,i);u&&u.type.valid(n,u)?(l||(l=[])).push(u):s.onRemove&&s.onRemove(this.local[c].spec)}return this.children.length?DI(this.children,l||[],e,n,r,i,s):l?new dt(l.sort(il),va):Rn}add(e,n){return n.length?this==Rn?dt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((c,u)=>{let f=u+r,h;if(h=l_(n,c,f)){for(i||(i=this.children.slice());s<i.length&&i[s]<u;)s+=3;i[s]==u?i[s+2]=i[s+2].addInner(c,h,f+1):i.splice(s,0,u,u+c.nodeSize,op(h,c,f+1,rl)),s+=3}});let l=o_(s?a_(n):n,-r);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||l.splice(c--,1);return new dt(l.length?this.local.concat(l).sort(il):this.local,i||this.children)}remove(e){return e.length==0||this==Rn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let l,c=r[s]+n,u=r[s+1]+n;for(let h=0,m;h<e.length;h++)(m=e[h])&&m.from>c&&m.to<u&&(e[h]=null,(l||(l=[])).push(m));if(!l)continue;r==this.children&&(r=this.children.slice());let f=r[s+2].removeInner(l,c+1);f!=Rn?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 dt(i,r):Rn}forChild(e,n){if(this==Rn)return this;if(n.isLeaf)return dt.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=e){this.children[c]==e&&(r=this.children[c+2]);break}let s=e+1,l=s+n.content.size;for(let c=0;c<this.local.length;c++){let u=this.local[c];if(u.from<l&&u.to>s&&u.type instanceof ho){let f=Math.max(s,u.from)-s,h=Math.min(l,u.to)-s;f<h&&(i||(i=[])).push(u.copy(f,h))}}if(i){let c=new dt(i.sort(il),va);return r?new eo([c,r]):c}return r||Rn}eq(e){if(this==e)return!0;if(!(e instanceof dt)||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 c1(this.localsInner(e))}localsInner(e){if(this==Rn)return va;if(e.inlineContent||!this.local.some(ho.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ho||n.push(this.local[r]);return n}forEachSet(e){e(this)}}dt.empty=new dt([],[]);dt.removeOverlap=c1;const Rn=dt.empty;class eo{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,rl));return eo.from(r)}forChild(e,n){if(n.isLeaf)return dt.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Rn&&(s instanceof eo?r=r.concat(s.members):r.push(s))}return eo.from(r)}eq(e){if(!(e instanceof eo)||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?c1(r?n:n.sort(il)):va}static from(e){switch(e.length){case 0:return Rn;case 1:return e[0];default:return new eo(e.every(n=>n instanceof dt)?e:e.reduce((n,r)=>n.concat(r instanceof dt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function DI(t,e,n,r,i,s,l){let c=t.slice();for(let f=0,h=s;f<n.maps.length;f++){let m=0;n.maps[f].forEach((g,y,v,S)=>{let k=S-v-(y-g);for(let E=0;E<c.length;E+=3){let j=c[E+1];if(j<0||g>j+h-m)continue;let L=c[E]+h-m;y>=L?c[E+1]=g<=L?-2:-1:g>=h&&k&&(c[E]+=k,c[E+1]+=k)}m+=k}),h=n.maps[f].map(h,-1)}let u=!1;for(let f=0;f<c.length;f+=3)if(c[f+1]<0){if(c[f+1]==-2){u=!0,c[f+1]=-1;continue}let h=n.map(t[f]+s),m=h-i;if(m<0||m>=r.content.size){u=!0;continue}let g=n.map(t[f+1]+s,-1),y=g-i,{index:v,offset:S}=r.content.findIndex(m),k=r.maybeChild(v);if(k&&S==m&&S+k.nodeSize==y){let E=c[f+2].mapInner(n,k,h+1,t[f]+s+1,l);E!=Rn?(c[f]=m,c[f+1]=y,c[f+2]=E):(c[f+1]=-2,u=!0)}else u=!0}if(u){let f=RI(c,t,e,n,i,s,l),h=op(f,r,0,l);e=h.local;for(let m=0;m<c.length;m+=3)c[m+1]<0&&(c.splice(m,3),m-=3);for(let m=0,g=0;m<h.children.length;m+=3){let y=h.children[m];for(;g<c.length&&c[g]<y;)g+=3;c.splice(g,0,h.children[m],h.children[m+1],h.children[m+2])}}return new dt(e.sort(il),c)}function o_(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new Vt(i.from+e,i.to+e,i.type))}return n}function RI(t,e,n,r,i,s,l){function c(u,f){for(let h=0;h<u.local.length;h++){let m=u.local[h].map(r,i,f);m?n.push(m):l.onRemove&&l.onRemove(u.local[h].spec)}for(let h=0;h<u.children.length;h+=3)c(u.children[h+2],u.children[h]+f+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&c(t[u+2],e[u]+s+1);return n}function l_(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 a_(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function op(t,e,n,r){let i=[],s=!1;e.forEach((c,u)=>{let f=l_(t,c,u+n);if(f){s=!0;let h=op(f,c,n+u+1,r);h!=Rn&&i.push(u,u+c.nodeSize,h)}});let l=o_(s?a_(t):t,-n).sort(il);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 dt(l,i):Rn}function il(t,e){return t.from-e.from||t.to-e.to}function c1(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),tT(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),tT(e,i,r.copy(s.from,r.to)));break}}}return e}function tT(t,e,n){for(;e<t.length&&il(n,t[e])>0;)e++;t.splice(e,0,n)}function v0(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Rn&&e.push(r)}),t.cursorWrapper&&e.push(dt.create(t.state.doc,[t.cursorWrapper.deco])),eo.from(e)}const NI={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},zI=cr&&uo<=11;class LI{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 II{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new LI,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]);cr&&uo<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Ln&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),zI&&(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,NI)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(YE(this.view)){if(this.suppressingSelectionUpdates)return ys(this.view);if(cr&&uo<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&fl(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=Fa(s))n.add(s);for(let s=e.anchorNode;s;s=Fa(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&YE(e)&&!this.ignoreSelectionChange(r),s=-1,l=-1,c=!1,u=[];if(e.editable)for(let h=0;h<n.length;h++){let m=this.registerMutation(n[h],u);m&&(s=s<0?m.from:Math.min(m.from,s),l=l<0?m.to:Math.max(m.to,l),m.typeOver&&(c=!0))}if(u.some(h=>h.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let h of u)if(h.nodeName=="BR"&&h.parentNode){let m=h.nextSibling;for(;m&&m.nodeType==1;){if(m.contentEditable=="false"){h.parentNode.removeChild(h);break}m=m.firstChild}}}else if(Jr&&u.length){let h=u.filter(m=>m.nodeName=="BR");if(h.length==2){let[m,g]=h;m.parentNode&&m.parentNode.parentNode==g.parentNode?g.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let g of h){let y=g.parentNode;y&&y.nodeName=="LI"&&(!m||UI(e,m)!=y)&&g.remove()}}}let f=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&pm(r)&&(f=n1(e))&&f.eq(De.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ys(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,l),jI(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,HI(e,u)),this.handleDOMChange(s,l,c,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ys(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let h=0;h<e.addedNodes.length;h++){let m=e.addedNodes[h];n.push(m),m.nodeType==3&&(this.lastChangedTextNode=m)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(cr&&uo<=11&&e.addedNodes.length)for(let h=0;h<e.addedNodes.length;h++){let{previousSibling:m,nextSibling:g}=e.addedNodes[h];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(i=m),(!g||Array.prototype.indexOf.call(e.addedNodes,g)<0)&&(s=g)}let l=i&&i.parentNode==e.target?An(i)+1:0,c=r.localPosFromDOM(e.target,l,-1),u=s&&s.parentNode==e.target?An(s):e.target.childNodes.length,f=r.localPosFromDOM(e.target,u,1);return{from:c,to:f}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let nT=new WeakMap,rT=!1;function jI(t){if(!nT.has(t)&&(nT.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Jr,rT)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."),rT=!0}}function iT(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return fl(l.node,l.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function BI(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return iT(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?iT(t,n):null}function UI(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 HI(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let l=s.nextSibling;for(;l&&l.nodeName!="TD"&&l.nodeName!="TH";)l=l.nextSibling;if(l){let c=l;for(;;){let u=c.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;c=u}c.insertBefore(s,c.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function $I(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:l,to:c}=t.docView.parseRange(e,n),u=t.domSelectionRange(),f,h=u.anchorNode;if(h&&t.dom.contains(h.nodeType==1?h:h.parentNode)&&(f=[{node:h,offset:u.anchorOffset}],pm(u)||f.push({node:u.focusNode,offset:u.focusOffset})),On&&t.input.lastKeyCode===8)for(let k=s;k>i;k--){let E=r.childNodes[k-1],j=E.pmViewDesc;if(E.nodeName=="BR"&&!j){s=k;break}if(!j||j.size)break}let m=t.state.doc,g=t.someProp("domParser")||co.fromSchema(t.state.schema),y=m.resolve(l),v=null,S=g.parse(r,{topNode:y.parent,topMatch:y.parent.contentMatchAt(y.index()),topOpen:!0,from:i,to:s,preserveWhitespace:y.parent.type.whitespace=="pre"?"full":!0,findPositions:f,ruleFromNode:VI,context:y});if(f&&f[0].pos!=null){let k=f[0].pos,E=f[1]&&f[1].pos;E==null&&(E=k),v={anchor:k+l,head:E+l}}return{doc:S,sel:v,from:l,to:c}}function VI(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Ln&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Ln&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const PI=/^(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 FI(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,G=n1(t,N);if(G&&!t.state.selection.eq(G)){if(On&&ms&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",ce=>ce(t,qo(13,"Enter"))))return;let K=t.state.tr.setSelection(G);N=="pointer"?K.setMeta("pointer",!0):N=="key"&&K.scrollIntoView(),s&&K.setMeta("composition",s),t.dispatch(K)}return}let l=t.state.doc.resolve(e),c=l.sharedDepth(n);e=l.before(c+1),n=t.state.doc.resolve(n).after(c+1);let u=t.state.selection,f=$I(t,e,n),h=t.state.doc,m=h.slice(f.from,f.to),g,y;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(g=t.state.selection.to,y="end"):(g=t.state.selection.from,y="start"),t.input.lastKeyCode=null;let v=YI(m.content,f.doc.content,f.from,g,y);if(v&&t.input.domChangeCount++,(qa&&t.input.lastIOSEnter>Date.now()-225||ms)&&i.some(N=>N.nodeType==1&&!PI.test(N.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",N=>N(t,qo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!v)if(r&&u instanceof Se&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(f.sel){let N=sT(t,t.state.doc,f.sel);if(N&&!N.eq(t.state.selection)){let G=t.state.tr.setSelection(N);s&&G.setMeta("composition",s),t.dispatch(G)}}return}t.state.selection.from<t.state.selection.to&&v.start==v.endB&&t.state.selection instanceof Se&&(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)),cr&&uo<=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 S=f.doc.resolveNoCache(v.start-f.from),k=f.doc.resolveNoCache(v.endB-f.from),E=h.resolve(v.start),j=S.sameParent(k)&&S.parent.inlineContent&&E.end()>=v.endA;if((qa&&t.input.lastIOSEnter>Date.now()-225&&(!j||i.some(N=>N.nodeName=="DIV"||N.nodeName=="P"))||!j&&S.pos<f.doc.content.size&&(!S.sameParent(k)||!S.parent.inlineContent)&&S.pos<k.pos&&!/\S/.test(f.doc.textBetween(S.pos,k.pos,"","")))&&t.someProp("handleKeyDown",N=>N(t,qo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>v.start&&KI(h,v.start,v.endA,S,k)&&t.someProp("handleKeyDown",N=>N(t,qo(8,"Backspace")))){ms&&On&&t.domObserver.suppressSelectionUpdates();return}On&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),ms&&!j&&S.start()!=k.start()&&k.parentOffset==0&&S.depth==k.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==v.endA&&(v.endB-=2,k=f.doc.resolveNoCache(v.endB-f.from),setTimeout(()=>{t.someProp("handleKeyDown",function(N){return N(t,qo(13,"Enter"))})},20));let L=v.start,J=v.endA,U=N=>{let G=N||t.state.tr.replace(L,J,f.doc.slice(v.start-f.from,v.endB-f.from));if(f.sel){let K=sT(t,G.doc,f.sel);K&&!(On&&t.composing&&K.empty&&(v.start!=v.endB||t.input.lastChromeDelete<Date.now()-100)&&(K.head==L||K.head==G.mapping.map(J)-1)||cr&&K.empty&&K.head==L)&&G.setSelection(K)}return s&&G.setMeta("composition",s),G.scrollIntoView()},M;if(j)if(S.pos==k.pos){cr&&uo<=11&&S.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>ys(t),20));let N=U(t.state.tr.delete(L,J)),G=h.resolve(v.start).marksAcross(h.resolve(v.endA));G&&N.ensureMarks(G),t.dispatch(N)}else if(v.endA==v.endB&&(M=qI(S.parent.content.cut(S.parentOffset,k.parentOffset),E.parent.content.cut(E.parentOffset,v.endA-E.start())))){let N=U(t.state.tr);M.type=="add"?N.addMark(L,J,M.mark):N.removeMark(L,J,M.mark),t.dispatch(N)}else if(S.parent.child(S.index()).isText&&S.index()==k.index()-(k.textOffset?0:1)){let N=S.parent.textBetween(S.parentOffset,k.parentOffset),G=()=>U(t.state.tr.insertText(N,L,J));t.someProp("handleTextInput",K=>K(t,L,J,N,G))||t.dispatch(G())}else t.dispatch(U());else t.dispatch(U())}function sT(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:r1(t,e.resolve(n.anchor),e.resolve(n.head))}function qI(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,l,c,u;for(let h=0;h<r.length;h++)i=r[h].removeFromSet(i);for(let h=0;h<n.length;h++)s=n[h].removeFromSet(s);if(i.length==1&&s.length==0)c=i[0],l="add",u=h=>h.mark(c.addToSet(h.marks));else if(i.length==0&&s.length==1)c=s[0],l="remove",u=h=>h.mark(c.removeFromSet(h.marks));else return null;let f=[];for(let h=0;h<e.childCount;h++)f.push(u(e.child(h)));if(ee.from(f).eq(t))return{mark:c,type:l}}function KI(t,e,n,r,i){if(n-e<=i.pos-r.pos||S0(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(S0(s,!0,!0));return!l.parent.isTextblock||l.pos>n||S0(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function S0(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 YI(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:l,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let u=Math.max(0,s-Math.min(l,c));r-=l+u-s}if(l<s&&t.size<e.size){let u=r<=s&&r>=l?s-r:0;s-=u,s&&s<e.size&&oT(e.textBetween(s-1,s+1))&&(s+=u?1:-1),c=s+(c-l),l=s}else if(c<s){let u=r<=s&&r>=c?s-r:0;s-=u,s&&s<t.size&&oT(t.textBetween(s-1,s+1))&&(s+=u?1:-1),l=s+(l-c),c=s}return{start:s,endA:l,endB:c}}function oT(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 c_{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 cI,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(dT),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=cT(this),aT(this),this.nodeViews=uT(this),this.docView=$E(this.state.doc,lT(this),v0(this),this.dom,this),this.domObserver=new II(this,(r,i,s,l)=>FI(this,r,i,s,l)),this.domObserver.start(),uI(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&&Pb(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(dT),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&&(n_(this),l=!0),this.state=e;let c=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let y=uT(this);GI(y,this.nodeViews)&&(this.nodeViews=y,s=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&Pb(this),this.editable=cT(this),aT(this);let u=v0(this),f=lT(this),h=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",m=s||!this.docView.matchesNode(e.doc,f,u);(m||!e.selection.eq(i.selection))&&(l=!0);let g=h=="preserve"&&l&&this.dom.style.overflowAnchor==null&&C4(this);if(l){this.domObserver.stop();let y=m&&(cr||On)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&WI(i.selection,e.selection);if(m){let v=On?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=CI(this)),(s||!this.docView.update(e.doc,f,u,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=$E(e.doc,f,u,this.dom,this)),v&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(y=!0)}y||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&W4(this))?ys(this,y):(FO(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),h=="reset"?this.dom.scrollTop=0:h=="to selection"?this.scrollToSelection():g&&E4(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 Ae){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&LE(this,n.getBoundingClientRect(),e)}else LE(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 i_(e.slice,e.move,i<0?void 0:Ae.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(cr){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&&T4(this.dom),ys(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 D4(this,e)}coordsAtPos(e,n=1){return IO(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 I4(this,n||this.state,e)}pasteHTML(e,n){return Ju(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Ju(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return i1(this,e)}destroy(){this.docView&&(dI(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],v0(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,p4())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return hI(this,e)}domSelectionRange(){let e=this.domSelection();return e?Ln&&this.root.nodeType===11&&x4(this.dom.ownerDocument)==this.dom&&BI(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}c_.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function lT(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[Vt.node(0,t.state.doc.content.size,e)]}function aT(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Vt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function cT(t){return!t.someProp("editable",e=>e(t.state)===!1)}function WI(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 uT(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 GI(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 dT(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 go={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:"'"},lp={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ZI=typeof navigator<"u"&&/Mac/.test(navigator.platform),JI=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Mn=0;Mn<10;Mn++)go[48+Mn]=go[96+Mn]=String(Mn);for(var Mn=1;Mn<=24;Mn++)go[Mn+111]="F"+Mn;for(var Mn=65;Mn<=90;Mn++)go[Mn]=String.fromCharCode(Mn+32),lp[Mn]=String.fromCharCode(Mn);for(var w0 in go)lp.hasOwnProperty(w0)||(lp[w0]=go[w0]);function XI(t){var e=ZI&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||JI&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?lp:go)[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 QI=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ej=typeof navigator<"u"&&/Win/.test(navigator.platform);function tj(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<e.length-1;c++){let u=e[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))QI?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),l&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function nj(t){let e=Object.create(null);for(let n in t)e[tj(n)]=t[n];return e}function k0(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 rj(t){return new lt({props:{handleKeyDown:u1(t)}})}function u1(t){let e=nj(t);return function(n,r){let i=XI(r),s,l=e[k0(i,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[k0(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(ej&&r.ctrlKey&&r.altKey)&&(s=go[r.keyCode])&&s!=i){let c=e[k0(s,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}const ym=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function u_(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const d1=(t,e,n)=>{let r=u_(t,n);if(!r)return!1;let i=h1(r);if(!i){let l=r.blockRange(),c=l&&kl(l);return c==null?!1:(e&&e(t.tr.lift(l,c).scrollIntoView()),!0)}let s=i.nodeBefore;if(v_(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Ka(s,"end")||Ae.isSelectable(s)))for(let l=r.depth;;l--){let c=fm(t.doc,r.before(l),r.after(l),ye.empty);if(c&&c.slice.size<c.to-c.from){if(e){let u=t.tr.step(c);u.setSelection(Ka(s,"end")?De.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):Ae.create(u.doc,i.pos-s.nodeSize)),e(u.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},d_=(t,e,n)=>{let r=u_(t,n);if(!r)return!1;let i=h1(r);return i?h_(t,i,e):!1},f_=(t,e,n)=>{let r=p_(t,n);if(!r)return!1;let i=g1(r);return i?h_(t,i,e):!1};function h_(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let h=i.lastChild;if(!h)return!1;i=h}let l=e.nodeAfter,c=l,u=e.pos+1;for(;!c.isTextblock;u++){if(c.type.spec.isolating)return!1;let h=c.firstChild;if(!h)return!1;c=h}let f=fm(t.doc,s,u,ye.empty);if(!f||f.from!=s||f instanceof an&&f.slice.size>=u-s)return!1;if(n){let h=t.tr.step(f);h.setSelection(Se.create(h.doc,s)),n(h.scrollIntoView())}return!0}function Ka(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const f1=(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=h1(r)}let l=s&&s.nodeBefore;return!l||!Ae.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Ae.create(t.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function h1(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 p_(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const p1=(t,e,n)=>{let r=p_(t,n);if(!r)return!1;let i=g1(r);if(!i)return!1;let s=i.nodeAfter;if(v_(t,i,e,1))return!0;if(r.parent.content.size==0&&(Ka(s,"start")||Ae.isSelectable(s))){let l=fm(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(Ka(s,"start")?De.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Ae.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},m1=(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=g1(r)}let l=s&&s.nodeAfter;return!l||!Ae.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Ae.create(t.doc,s.pos)).scrollIntoView()),!0)};function g1(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 m_=(t,e)=>{let n=t.selection,r=n instanceof Ae,i;if(r){if(n.node.isTextblock||!ji(t.doc,n.from))return!1;i=n.from}else if(i=rc(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(Ae.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},g_=(t,e)=>{let n=t.selection,r;if(n instanceof Ae){if(n.node.isTextblock||!ji(t.doc,n.to))return!1;r=n.to}else if(r=rc(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},y_=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&kl(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},y1=(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 b1(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 b_=(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=b1(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(e){let c=n.after(),u=t.tr.replaceWith(c,c,l.createAndFill());u.setSelection(De.near(u.doc.resolve(c),1)),e(u.scrollIntoView())}return!0},x1=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof qn||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=b1(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(Se.create(c.doc,l+1)),e(c.scrollIntoView())}return!0},v1=(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(Mr(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&kl(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function ij(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Ae&&e.selection.node.isBlock)return!r.parentOffset||!Mr(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,c,u=!1,f=!1;for(let y=r.depth;;y--)if(r.node(y).isBlock){u=r.end(y)==r.pos+(r.depth-y),f=r.start(y)==r.pos-(r.depth-y),c=b1(r.node(y-1).contentMatchAt(r.indexAfter(y-1))),s.unshift(u&&c?{type:c}:null),l=y;break}else{if(y==1)return!1;s.unshift(null)}let h=e.tr;(e.selection instanceof Se||e.selection instanceof qn)&&h.deleteSelection();let m=h.mapping.map(r.pos),g=Mr(h.doc,m,s.length,s);if(g||(s[0]=c?{type:c}:null,g=Mr(h.doc,m,s.length,s)),!g)return!1;if(h.split(m,s.length,s),!u&&f&&r.node(l).type!=c){let y=h.mapping.map(r.before(l)),v=h.doc.resolve(y);c&&r.node(l-1).canReplaceWith(v.index(),v.index()+1,c)&&h.setNodeMarkup(h.mapping.map(r.before(l)),c)}return n&&n(h.scrollIntoView()),!0}}const sj=ij(),x_=(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(Ae.create(t.doc,i))),!0)};function oj(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||ji(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function v_(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,l,c,u=i.type.spec.isolating||s.type.spec.isolating;if(!u&&oj(t,e,n))return!0;let f=!u&&e.parent.canReplace(e.index(),e.index()+1);if(f&&(l=(c=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&c.matchType(l[0]||s.type).validEnd){if(n){let y=e.pos+s.nodeSize,v=ee.empty;for(let E=l.length-1;E>=0;E--)v=ee.from(l[E].create(null,v));v=ee.from(i.copy(v));let S=t.tr.step(new cn(e.pos-1,y,e.pos,y,new ye(v,1,0),l.length,!0)),k=S.doc.resolve(y+2*l.length);k.nodeAfter&&k.nodeAfter.type==i.type&&ji(S.doc,k.pos)&&S.join(k.pos),n(S.scrollIntoView())}return!0}let h=s.type.spec.isolating||r>0&&u?null:De.findFrom(e,1),m=h&&h.$from.blockRange(h.$to),g=m&&kl(m);if(g!=null&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(f&&Ka(s,"start",!0)&&Ka(i,"end")){let y=i,v=[];for(;v.push(y),!y.isTextblock;)y=y.lastChild;let S=s,k=1;for(;!S.isTextblock;S=S.firstChild)k++;if(y.canReplace(y.childCount,y.childCount,S.content)){if(n){let E=ee.empty;for(let L=v.length-1;L>=0;L--)E=ee.from(v[L].copy(E));let j=t.tr.step(new cn(e.pos-v.length,e.pos+s.nodeSize,e.pos+k,e.pos+s.nodeSize-k,new ye(E,v.length,0),0,!0));n(j.scrollIntoView())}return!0}}return!1}function S_(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(Se.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const w_=S_(-1),k_=S_(1);function C_(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,l=i.blockRange(s),c=l&&Xx(l,t,e);return c?(r&&r(n.tr.wrap(l,c).scrollIntoView()),!0):!1}}function ap(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];n.doc.nodesBetween(l,c,(u,f)=>{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let h=n.doc.resolve(f),m=h.index();i=h.parent.canReplaceWith(m,m+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let l=0;l<n.selection.ranges.length;l++){let{$from:{pos:c},$to:{pos:u}}=n.selection.ranges[l];s.setBlockType(c,u,t,e)}r(s.scrollIntoView())}return!0}}function S1(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}S1(ym,d1,f1);S1(ym,p1,m1);S1(y1,x1,v1,sj);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function E_(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 lj(c,l,t,e)?(r&&r(c.scrollIntoView()),!0):!1}}function lj(t,e,n,r=null){let i=!1,s=e,l=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=l.resolve(e.start-2);s=new ep(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new ep(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=Xx(s,n,r,e);return c?(t&&aj(t,e,c,i,n),!0):!1}function aj(t,e,n,r,i){let s=ee.empty;for(let h=n.length-1;h>=0;h--)s=ee.from(n[h].type.create(n[h].attrs,s));t.step(new cn(e.start-(r?2:0),e.end,e.start,e.end,new ye(s,0,0),n.length,!0));let l=0;for(let h=0;h<n.length;h++)n[h].type==i&&(l=h+1);let c=n.length-l,u=e.start+n.length-(r?2:0),f=e.parent;for(let h=e.startIndex,m=e.endIndex,g=!0;h<m;h++,g=!1)!g&&Mr(t.doc,u,c)&&(t.split(u,c),u+=2*c),u+=f.child(h).nodeSize;return t}function T_(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?cj(e,n,t,s):uj(e,n,s):!0:!1}}function cj(t,e,n,r){let i=t.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(i.step(new cn(s-1,l,s,l,new ye(ee.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ep(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=kl(r);if(c==null)return!1;i.lift(r,c);let u=i.doc.resolve(i.mapping.map(s,-1)-1);return ji(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&i.join(u.pos),e(i.scrollIntoView()),!0}function uj(t,e,n){let r=t.tr,i=n.parent;for(let y=n.end,v=n.endIndex-1,S=n.startIndex;v>S;v--)y-=i.child(v).nodeSize,r.delete(y-1,y+1);let s=r.doc.resolve(n.start),l=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,u=n.endIndex==i.childCount,f=s.node(-1),h=s.index(-1);if(!f.canReplace(h+(c?0:1),h+1,l.content.append(u?ee.empty:ee.from(i))))return!1;let m=s.pos,g=m+l.nodeSize;return r.step(new cn(m-(c?1:0),g+(u?1:0),m+1,g-1,new ye((c?ee.empty:ee.from(i.copy(ee.empty))).append(u?ee.empty:ee.from(i.copy(ee.empty))),c?0:1,u?0:1),c?0:1)),e(r.scrollIntoView()),!0}function A_(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,f=>f.childCount>0&&f.firstChild.type==t);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let c=s.parent,u=c.child(l-1);if(u.type!=t)return!1;if(n){let f=u.lastChild&&u.lastChild.type==c.type,h=ee.from(f?t.create():null),m=new ye(ee.from(t.create(null,ee.from(c.type.create(null,h)))),f?3:1,0),g=s.start,y=s.end;n(e.tr.step(new cn(g-(f?3:1),y,g,y,m,1,!0)).scrollIntoView())}return!0}}function bm(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}}}let xm=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,l=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>{const m=u(...h)(l);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),m}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c=[],u=!!e,f=e||s.tr,h=()=>(!u&&n&&!f.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(f),c.every(g=>g===!0)),m={...Object.fromEntries(Object.entries(r).map(([g,y])=>[g,(...S)=>{const k=this.buildProps(f,n),E=y(...S)(k);return c.push(E),m}])),run:h};return m}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,l=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([u,f])=>[u,(...h)=>f(...h)({...l,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c={tr:e,editor:i,view:l,state:bm({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([u,f])=>[u,(...h)=>f(...h)(c)]))}};return c}},dj=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}};function we(t,e,n){return t.config[e]===void 0&&t.parent?we(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?we(t.parent,e,n):null}):t.config[e]}function vm(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 M_(t){const e=[],{nodeExtensions:n,markExtensions:r}=vm(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(l=>{const c={name:l.name,options:l.options,storage:l.storage,extensions:i},u=we(l,"addGlobalAttributes",c);if(!u)return;u().forEach(h=>{h.types.forEach(m=>{Object.entries(h.attributes).forEach(([g,y])=>{e.push({type:m,name:g,attribute:{...s,...y}})})})})}),i.forEach(l=>{const c={name:l.name,options:l.options,storage:l.storage},u=we(l,"addAttributes",c);if(!u)return;const f=u();Object.entries(f).forEach(([h,m])=>{const g={...s,...m};typeof(g==null?void 0:g.default)=="function"&&(g.default=g.default()),g!=null&&g.isRequired&&(g==null?void 0:g.default)===void 0&&delete g.default,e.push({type:l.name,name:h,attribute:g})})}),e}function yn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Pt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const c=s?String(s).split(" "):[],u=r[i]?r[i].split(" "):[],f=c.filter(h=>!u.includes(h));r[i]=[...u,...f].join(" ")}else if(i==="style"){const c=s?s.split(";").map(h=>h.trim()).filter(Boolean):[],u=r[i]?r[i].split(";").map(h=>h.trim()).filter(Boolean):[],f=new Map;u.forEach(h=>{const[m,g]=h.split(":").map(y=>y.trim());f.set(m,g)}),c.forEach(h=>{const[m,g]=h.split(":").map(y=>y.trim());f.set(m,g)}),r[i]=Array.from(f.entries()).map(([h,m])=>`${h}: ${m}`).join("; ")}else r[i]=s}),r},{})}function Fb(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Pt(n,r),{})}function O_(t){return typeof t=="function"}function We(t,e=void 0,...n){return O_(t)?e?t.bind(e)(...n):t(...n):t}function fj(t={}){return Object.keys(t).length===0&&t.constructor===Object}function hj(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function fT(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):hj(n.getAttribute(l.name));return c==null?s:{...s,[l.name]:c}},{});return{...r,...i}}}}function hT(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&fj(n)?!1:n!=null))}function pj(t,e){var n;const r=M_(t),{nodeExtensions:i,markExtensions:s}=vm(t),l=(n=i.find(f=>we(f,"topNode")))===null||n===void 0?void 0:n.name,c=Object.fromEntries(i.map(f=>{const h=r.filter(E=>E.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((E,j)=>{const L=we(j,"extendNodeSchema",m);return{...E,...L?L(f):{}}},{}),y=hT({...g,content:We(we(f,"content",m)),marks:We(we(f,"marks",m)),group:We(we(f,"group",m)),inline:We(we(f,"inline",m)),atom:We(we(f,"atom",m)),selectable:We(we(f,"selectable",m)),draggable:We(we(f,"draggable",m)),code:We(we(f,"code",m)),whitespace:We(we(f,"whitespace",m)),linebreakReplacement:We(we(f,"linebreakReplacement",m)),defining:We(we(f,"defining",m)),isolating:We(we(f,"isolating",m)),attrs:Object.fromEntries(h.map(E=>{var j;return[E.name,{default:(j=E==null?void 0:E.attribute)===null||j===void 0?void 0:j.default}]}))}),v=We(we(f,"parseHTML",m));v&&(y.parseDOM=v.map(E=>fT(E,h)));const S=we(f,"renderHTML",m);S&&(y.toDOM=E=>S({node:E,HTMLAttributes:Fb(E,h)}));const k=we(f,"renderText",m);return k&&(y.toText=k),[f.name,y]})),u=Object.fromEntries(s.map(f=>{const h=r.filter(k=>k.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},g=t.reduce((k,E)=>{const j=we(E,"extendMarkSchema",m);return{...k,...j?j(f):{}}},{}),y=hT({...g,inclusive:We(we(f,"inclusive",m)),excludes:We(we(f,"excludes",m)),group:We(we(f,"group",m)),spanning:We(we(f,"spanning",m)),code:We(we(f,"code",m)),attrs:Object.fromEntries(h.map(k=>{var E;return[k.name,{default:(E=k==null?void 0:k.attribute)===null||E===void 0?void 0:E.default}]}))}),v=We(we(f,"parseHTML",m));v&&(y.parseDOM=v.map(k=>fT(k,h)));const S=we(f,"renderHTML",m);return S&&(y.toDOM=k=>S({mark:k,HTMLAttributes:Fb(k,h)})),[f.name,y]}));return new Gx({topNode:l,nodes:c,marks:u})}function C0(t,e){return e.nodes[t]||e.marks[t]||null}function pT(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function w1(t,e){const n=wl.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const mj=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,l,c)=>{var u,f;const h=((f=(u=i.type.spec).toText)===null||f===void 0?void 0:f.call(u,{node:i,pos:s,parent:l,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?h:h.slice(0,Math.max(0,r-s))}),n};function k1(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Sm{constructor(e){this.find=e.find,this.handler=e.handler}}const gj=(t,e)=>{if(k1(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function eh(t){var e;const{editor:n,from:r,to:i,text:s,rules:l,plugin:c}=t,{view:u}=n;if(u.composing)return!1;const f=u.state.doc.resolve(r);if(f.parent.type.spec.code||!((e=f.nodeBefore||f.nodeAfter)===null||e===void 0)&&e.marks.find(g=>g.type.spec.code))return!1;let h=!1;const m=mj(f)+s;return l.forEach(g=>{if(h)return;const y=gj(m,g.find);if(!y)return;const v=u.state.tr,S=bm({state:u.state,transaction:v}),k={from:r-(y[0].length-s.length),to:i},{commands:E,chain:j,can:L}=new xm({editor:n,state:S});g.handler({state:S,range:k,match:y,commands:E,chain:j,can:L})===null||!v.steps.length||(v.setMeta(c,{transform:v,from:r,to:i,text:s}),u.dispatch(v),h=!0)}),h}function yj(t){const{editor:e,rules:n}=t,r=new lt({state:{init(){return null},apply(i,s,l){const c=i.getMeta(r);if(c)return c;const u=i.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:h}=u;typeof h=="string"?h=h:h=w1(ee.from(h),l.schema);const{from:m}=u,g=m+h.length;eh({editor:e,from:m,to:g,text:h,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,l,c){return eh({editor:e,from:s,to:l,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&eh({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:l}=i.state.selection;return l?eh({editor:e,from:l.pos,to:l.pos,text:`
|
|
70
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function bj(t){return Object.prototype.toString.call(t).slice(8,-1)}function th(t){return bj(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function wm(t,e){const n={...t};return th(t)&&th(e)&&Object.keys(e).forEach(r=>{th(e[r])&&th(t[r])?n[r]=wm(t[r],e[r]):n[r]=e[r]}),n}class Ni{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(we(this,"addOptions",{name:this.name}))),this.storage=We(we(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ni(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>wm(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ni(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(we(n,"addOptions",{name:n.name})),n.storage=We(we(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const l=i.marks();if(!!!l.find(f=>(f==null?void 0:f.type.name)===n.name))return!1;const u=l.find(f=>(f==null?void 0:f.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function xj(t){return typeof t=="number"}class vj{constructor(e){this.find=e.find,this.handler=e.handler}}const Sj=(t,e,n)=>{if(k1(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 wj(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:l,dropEvent:c}=t,{commands:u,chain:f,can:h}=new xm({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(y,v)=>{if(!y.isTextblock||y.type.spec.code)return;const S=Math.max(r,v),k=Math.min(i,v+y.content.size),E=y.textBetween(S-v,k-v,void 0,"");Sj(E,s.find,l).forEach(L=>{if(L.index===void 0)return;const J=S+L.index+1,U=J+L[0].length,M={from:n.tr.mapping.map(J),to:n.tr.mapping.map(U)},N=s.handler({state:n,range:M,match:L,commands:u,chain:f,can:h,pasteEvent:l,dropEvent:c});m.push(N)})}),m.every(y=>y!==null)}let nh=null;const kj=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 Cj(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const u=({state:h,from:m,to:g,rule:y,pasteEvt:v})=>{const S=h.tr,k=bm({state:h,transaction:S});if(!(!wj({editor:e,state:k,from:Math.max(m-1,0),to:g.b-1,rule:y,pasteEvent:v,dropEvent:c})||!S.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,S}};return n.map(h=>new lt({view(m){const g=v=>{var S;r=!((S=m.dom.parentElement)===null||S===void 0)&&S.contains(v.target)?m.dom.parentElement:null,r&&(nh=e)},y=()=>{nh&&(nh=null)};return window.addEventListener("dragstart",g),window.addEventListener("dragend",y),{destroy(){window.removeEventListener("dragstart",g),window.removeEventListener("dragend",y)}}},props:{handleDOMEvents:{drop:(m,g)=>{if(s=r===m.dom.parentElement,c=g,!s){const y=nh;y!=null&&y.isEditable&&setTimeout(()=>{const v=y.state.selection;v&&y.commands.deleteRange({from:v.from,to:v.to})},10)}return!1},paste:(m,g)=>{var y;const v=(y=g.clipboardData)===null||y===void 0?void 0:y.getData("text/html");return l=g,i=!!(v!=null&&v.includes("data-pm-slice")),!1}}},appendTransaction:(m,g,y)=>{const v=m[0],S=v.getMeta("uiEvent")==="paste"&&!i,k=v.getMeta("uiEvent")==="drop"&&!s,E=v.getMeta("applyPasteRules"),j=!!E;if(!S&&!k&&!j)return;if(j){let{text:U}=E;typeof U=="string"?U=U:U=w1(ee.from(U),y.schema);const{from:M}=E,N=M+U.length,G=kj(U);return u({rule:h,state:y,from:M,to:{b:N},pasteEvt:G})}const L=g.doc.content.findDiffStart(y.doc.content),J=g.doc.content.findDiffEnd(y.doc.content);if(!(!xj(L)||!J||L===J.b))return u({rule:h,state:y,from:L,to:J,pasteEvt:l})}}))}function Ej(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class Ca{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Ca.resolve(e),this.schema=pj(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Ca.sort(Ca.flatten(e)),r=Ej(n.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=we(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=we(r,"priority")||100,l=we(i,"priority")||100;return s>l?-1:s<l?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:C0(n.name,this.schema)},i=we(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Ca.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(l=>{const c={name:l.name,options:l.options,storage:l.storage,editor:e,type:C0(l.name,this.schema)},u=[],f=we(l,"addKeyboardShortcuts",c);let h={};if(l.type==="mark"&&we(l,"exitable",c)&&(h.ArrowRight=()=>Ni.handleExit({editor:e,mark:l})),f){const S=Object.fromEntries(Object.entries(f()).map(([k,E])=>[k,()=>E({editor:e})]));h={...h,...S}}const m=rj(h);u.push(m);const g=we(l,"addInputRules",c);pT(l,e.options.enableInputRules)&&g&&r.push(...g());const y=we(l,"addPasteRules",c);pT(l,e.options.enablePasteRules)&&y&&i.push(...y());const v=we(l,"addProseMirrorPlugins",c);if(v){const S=v();u.push(...S)}return u}).flat();return[yj({editor:e,rules:r}),...Cj({editor:e,rules:i}),...s]}get attributes(){return M_(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=vm(this.extensions);return Object.fromEntries(n.filter(r=>!!we(r,"addNodeView")).map(r=>{const i=this.attributes.filter(u=>u.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:yn(r.name,this.schema)},l=we(r,"addNodeView",s);if(!l)return[];const c=(u,f,h,m,g)=>{const y=Fb(u,i);return l()({node:u,view:f,getPos:h,decorations:m,innerDecorations:g,editor:e,extension:r,HTMLAttributes:y})};return[r.name,c]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:C0(e.name,this.schema)};e.type==="mark"&&(!((n=We(we(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=we(e,"onBeforeCreate",r),s=we(e,"onCreate",r),l=we(e,"onUpdate",r),c=we(e,"onSelectionUpdate",r),u=we(e,"onTransaction",r),f=we(e,"onFocus",r),h=we(e,"onBlur",r),m=we(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),l&&this.editor.on("update",l),c&&this.editor.on("selectionUpdate",c),u&&this.editor.on("transaction",u),f&&this.editor.on("focus",f),h&&this.editor.on("blur",h),m&&this.editor.on("destroy",m)})}}let Zn=class qb{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(we(this,"addOptions",{name:this.name}))),this.storage=We(we(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new qb(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>wm(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new qb({...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(we(n,"addOptions",{name:n.name})),n.storage=We(we(n,"addStorage",{name:n.name,options:n.options})),n}};function __(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
71
|
+
|
|
72
|
+
`,textSerializers:l={}}=n||{};let c="";return t.nodesBetween(r,i,(u,f,h,m)=>{var g;u.isBlock&&f>r&&(c+=s);const y=l==null?void 0:l[u.type.name];if(y)return h&&(c+=y({node:u,pos:f,parent:h,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)===null||g===void 0?void 0:g.slice(Math.max(r,f)-f,i-f))}),c}function D_(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const Tj=Zn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new lt({key:new ht("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,l=Math.min(...s.map(h=>h.$from.pos)),c=Math.max(...s.map(h=>h.$to.pos)),u=D_(n);return __(r,{from:l,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),Aj=()=>({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),Mj=(t=!1)=>({commands:e})=>e.setContent("",t),Oj=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:l})=>{t.doc.nodesBetween(s.pos,l.pos,(c,u)=>{if(c.type.isText)return;const{doc:f,mapping:h}=e,m=f.resolve(h.map(u)),g=f.resolve(h.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const v=kl(y);if(c.type.isTextblock){const{defaultType:S}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,S)}(v||v===0)&&e.lift(y,v)})}),!0},_j=t=>e=>t(e),Dj=()=>({state:t,dispatch:e})=>x1(t,e),Rj=(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 Se(r.doc.resolve(Math.max(l-1,0)))),!0},Nj=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const c=i.before(s),u=i.after(s);t.delete(c,u).scrollIntoView()}return!0}return!1},zj=t=>({tr:e,state:n,dispatch:r})=>{const i=yn(t,n.schema),s=e.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===i){if(r){const u=s.before(l),f=s.after(l);e.delete(u,f).scrollIntoView()}return!0}return!1},Lj=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},Ij=()=>({state:t,dispatch:e})=>ym(t,e),jj=()=>({commands:t})=>t.keyboardShortcut("Enter"),Bj=()=>({state:t,dispatch:e})=>b_(t,e);function cp(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:k1(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function R_(t,e,n={}){return t.find(r=>r.type===e&&cp(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function mT(t,e,n={}){return!!R_(t,e,n)}function C1(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(h=>h.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(h=>h.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!R_([...i.node.marks],e,n)))return;let l=i.index,c=t.start()+i.offset,u=l+1,f=c+i.node.nodeSize;for(;l>0&&mT([...t.parent.child(l-1).marks],e,n);)l-=1,c-=t.parent.child(l).nodeSize;for(;u<t.parent.childCount&&mT([...t.parent.child(u).marks],e,n);)f+=t.parent.child(u).nodeSize,u+=1;return{from:c,to:f}}function wo(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 Uj=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=wo(t,r.schema),{doc:l,selection:c}=n,{$from:u,from:f,to:h}=c;if(i){const m=C1(u,s,e);if(m&&m.from<=f&&m.to>=h){const g=Se.create(l,m.from,m.to);n.setSelection(g)}}return!0},Hj=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 N_(t){return t instanceof Se}function Jo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function z_(t,e=null){if(!e)return null;const n=De.atStart(t),r=De.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?Se.create(t,Jo(0,i,s),Jo(t.content.size,i,s)):Se.create(t,Jo(e,i,s),Jo(e,i,s))}function gT(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function up(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function $j(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const Vj=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(up()||gT())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),$j()&&!up()&&!gT()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!N_(n.state.selection))return l(),!0;const c=z_(i.doc,t)||n.state.selection,u=n.state.selection.eq(c);return s&&(u||i.setSelection(c),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},Pj=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),Fj=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),L_=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&&L_(r)}return t};function rh(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return L_(n)}function Qu(t,e,n){if(t instanceof gs||t instanceof ee)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 ee.fromArray(t.map(c=>e.nodeFromJSON(c)));const l=e.nodeFromJSON(t);return n.errorOnInvalidContent&&l.check(),l}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Qu("",e,n)}if(i){if(n.errorOnInvalidContent){let l=!1,c="";const u=new Gx({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?co.fromSchema(u).parseSlice(rh(t),n.parseOptions):co.fromSchema(u).parse(rh(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=co.fromSchema(e);return n.slice?s.parseSlice(rh(t),n.parseOptions).content:s.parse(rh(t),n.parseOptions)}return Qu("",e,n)}function qj(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof an||i instanceof cn))return;const s=t.mapping.maps[r];let l=0;s.forEach((c,u,f,h)=>{l===0&&(l=h)}),t.setSelection(De.near(t.doc.resolve(l),n))}const Kj=t=>!("type"in t),Yj=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var l;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=k=>{s.emit("contentError",{editor:s,error:k,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},f={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Qu(e,s.schema,{parseOptions:f,errorOnInvalidContent:!0})}catch(k){u(k)}try{c=Qu(e,s.schema,{parseOptions:f,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:s.options.enableContentCheck})}catch(k){return u(k),!1}let{from:h,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((Kj(c)?c:[c]).forEach(k=>{k.check(),g=g?k.isText&&k.marks.length===0:!1,y=y?k.isBlock:!1}),h===m&&y){const{parent:k}=r.doc.resolve(h);k.isTextblock&&!k.type.spec.code&&!k.childCount&&(h-=1,m+=1)}let S;if(g){if(Array.isArray(e))S=e.map(k=>k.text||"").join("");else if(e instanceof ee){let k="";e.forEach(E=>{E.text&&(k+=E.text)}),S=k}else typeof e=="object"&&e&&e.text?S=e.text:S=e;r.insertText(S,h,m)}else S=c,r.replaceWith(h,m,S);n.updateSelection&&qj(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:h,text:S}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:h,text:S})}return!0},Wj=()=>({state:t,dispatch:e})=>m_(t,e),Gj=()=>({state:t,dispatch:e})=>g_(t,e),Zj=()=>({state:t,dispatch:e})=>d1(t,e),Jj=()=>({state:t,dispatch:e})=>p1(t,e),Xj=()=>({state:t,dispatch:e,tr:n})=>{try{const r=rc(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},Qj=()=>({state:t,dispatch:e,tr:n})=>{try{const r=rc(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},eB=()=>({state:t,dispatch:e})=>d_(t,e),tB=()=>({state:t,dispatch:e})=>f_(t,e);function I_(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function nB(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<e.length-1;c+=1){const u=e[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))up()||I_()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const rB=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=nB(t).split(/-(?!$)/),l=s.find(f=>!["Alt","Ctrl","Meta","Shift"].includes(f)),c=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",f=>f(n,c))});return u==null||u.steps.forEach(f=>{const h=f.map(r.mapping);h&&i&&r.maybeStep(h)}),!0};function ed(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,l=e?yn(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(m,g)=>{if(m.isText)return;const y=Math.max(r,g),v=Math.min(i,g+m.nodeSize);c.push({node:m,from:y,to:v})});const u=i-r,f=c.filter(m=>l?l.name===m.node.type.name:!0).filter(m=>cp(m.node.attrs,n,{strict:!1}));return s?!!f.length:f.reduce((m,g)=>m+g.to-g.from,0)>=u}const iB=(t,e={})=>({state:n,dispatch:r})=>{const i=yn(t,n.schema);return ed(n,i,e)?y_(n,r):!1},sB=()=>({state:t,dispatch:e})=>v1(t,e),oB=t=>({state:e,dispatch:n})=>{const r=yn(t,e.schema);return T_(r)(e,n)},lB=()=>({state:t,dispatch:e})=>y1(t,e);function km(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function yT(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 aB=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=km(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=yn(t,r.schema)),c==="mark"&&(l=wo(t,r.schema)),i&&n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(f,h)=>{s&&s===f.type&&n.setNodeMarkup(h,void 0,yT(f.attrs,e)),l&&f.marks.length&&f.marks.forEach(m=>{l===m.type&&n.addMark(h,h+f.nodeSize,l.create(yT(m.attrs,e)))})})}),!0):!1},cB=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),uB=()=>({tr:t,dispatch:e})=>{if(e){const n=new qn(t.doc);t.setSelection(n)}return!0},dB=()=>({state:t,dispatch:e})=>f1(t,e),fB=()=>({state:t,dispatch:e})=>m1(t,e),hB=()=>({state:t,dispatch:e})=>x_(t,e),pB=()=>({state:t,dispatch:e})=>k_(t,e),mB=()=>({state:t,dispatch:e})=>w_(t,e);function Kb(t,e,n={},r={}){return Qu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const gB=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:l,commands:c})=>{var u,f;const{doc:h}=s;if(n.preserveWhitespace!=="full"){const m=Kb(t,i.schema,n,{errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck});return l&&s.replaceWith(0,h.content.size,m).setMeta("preventUpdate",!e),!0}return l&&s.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:h.content.size},t,{parseOptions:n,errorOnInvalidContent:(f=r.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck})};function j_(t,e){const n=wo(e,t.schema),{from:r,to:i,empty:s}=t.selection,l=[];s?(t.storedMarks&&l.push(...t.storedMarks),l.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{l.push(...u.marks)});const c=l.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function yB(t,e){const n=new Qx(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function bB(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 xB(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function B_(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 E1(t){return e=>B_(e.$from,t)}function vB(t,e){const n={from:0,to:t.content.size};return __(t,n,e)}function SB(t,e){const n=yn(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 U_(t,e){const n=km(typeof e=="string"?e:e.name,t.schema);return n==="node"?SB(t,e):n==="mark"?j_(t,e):{}}function wB(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 kB(t){const e=wB(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 CB(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const l=[];if(i.ranges.length)i.forEach((c,u)=>{l.push({from:c,to:u})});else{const{from:c,to:u}=n[s];if(c===void 0||u===void 0)return;l.push({from:c,to:u})}l.forEach(({from:c,to:u})=>{const f=e.slice(s).map(c,-1),h=e.slice(s).map(u),m=e.invert().map(f,-1),g=e.invert().map(h);r.push({oldRange:{from:m,to:g},newRange:{from:f,to:h}})})}),kB(r)}function T1(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),l=C1(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 Oh(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 Yb(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?wo(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>cp(m.attrs,n,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:m,$to:g})=>{const y=m.pos,v=g.pos;t.doc.nodesBetween(y,v,(S,k)=>{if(!S.isText&&!S.marks.length)return;const E=Math.max(y,k),j=Math.min(v,k+S.nodeSize),L=j-E;l+=L,c.push(...S.marks.map(J=>({mark:J,from:E,to:j})))})}),l===0)return!1;const u=c.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>cp(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),f=c.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+f:u)>=l}function EB(t,e,n={}){if(!e)return ed(t,null,n)||Yb(t,null,n);const r=km(e,t.schema);return r==="node"?ed(t,e,n):r==="mark"?Yb(t,e,n):!1}function bT(t,e){const{nodeExtensions:n}=vm(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(we(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Cm(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&&(Cm(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function TB(t){return t instanceof Ae}function AB(t,e,n){var r;const{selection:i}=e;let s=null;if(N_(i)&&(s=i.$cursor),s){const c=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(c)||!c.some(u=>u.type.excludes(n))}const{ranges:l}=i;return l.some(({$from:c,$to:u})=>{let f=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(h,m,g)=>{if(f)return!1;if(h.isInline){const y=!g||g.type.allowsMarkType(n),v=!!n.isInSet(h.marks)||!h.marks.some(S=>S.type.excludes(n));f=y&&v}return!f}),f})}const MB=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:l,ranges:c}=s,u=wo(t,r.schema);if(i)if(l){const f=j_(r,u);n.addStoredMark(u.create({...f,...e}))}else c.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;r.doc.nodesBetween(h,m,(g,y)=>{const v=Math.max(y,h),S=Math.min(y+g.nodeSize,m);g.marks.find(E=>E.type===u)?g.marks.forEach(E=>{u===E.type&&n.addMark(v,S,u.create({...E.attrs,...e}))}):n.addMark(v,S,u.create(e))})});return AB(r,n,u)},OB=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),_B=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=yn(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})=>ap(s,{...l,...e})(n)?!0:c.clearNodes()).command(({state:c})=>ap(s,{...l,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},DB=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Jo(t,0,r.content.size),s=Ae.create(r,i);e.setSelection(s)}return!0},RB=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,l=Se.atStart(r).from,c=Se.atEnd(r).to,u=Jo(i,l,c),f=Jo(s,l,c),h=Se.create(r,u,f);e.setSelection(h)}return!0},NB=t=>({state:e,dispatch:n})=>{const r=yn(t,e.schema);return A_(r)(e,n)};function xT(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 zB=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:l}=e,{$from:c,$to:u}=s,f=i.extensionManager.attributes,h=Oh(f,c.node().type.name,c.node().attrs);if(s instanceof Ae&&s.node.isBlock)return!c.parentOffset||!Mr(l,c.pos)?!1:(r&&(t&&xT(n,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:bB(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:h}]:void 0,v=Mr(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!v&&Mr(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(v=!0,y=g?[{type:g,attrs:h}]:void 0),r){if(v&&(s instanceof Se&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const S=e.mapping.map(c.before()),k=e.doc.resolve(S);c.node(-1).canReplaceWith(k.index(),k.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&xT(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return v},LB=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var l;const c=yn(t,r.schema),{$from:u,$to:f}=r.selection,h=r.selection.node;if(h&&h.isBlock||u.depth<2||!u.sameParent(f))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let E=ee.empty;const j=u.index(-1)?1:u.index(-2)?2:3;for(let G=u.depth-j;G>=u.depth-3;G-=1)E=ee.from(u.node(G).copy(E));const L=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,J={...Oh(g,u.node().type.name,u.node().attrs),...e},U=((l=c.contentMatch.defaultType)===null||l===void 0?void 0:l.createAndFill(J))||void 0;E=E.append(ee.from(c.createAndFill(null,U)||void 0));const M=u.before(u.depth-(j-1));n.replace(M,u.after(-L),new ye(E,4-j,0));let N=-1;n.doc.nodesBetween(M,n.doc.content.size,(G,K)=>{if(N>-1)return!1;G.isTextblock&&G.content.size===0&&(N=K+1)}),N>-1&&n.setSelection(Se.near(n.doc.resolve(N))),n.scrollIntoView()}return!0}const y=f.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={...Oh(g,m.type.name,m.attrs),...e},S={...Oh(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,f.pos);const k=y?[{type:c,attrs:v},{type:y,attrs:S}]:[{type:c,attrs:v}];if(!Mr(n.doc,u.pos,2))return!1;if(i){const{selection:E,storedMarks:j}=r,{splittableMarks:L}=s.extensionManager,J=j||E.$to.parentOffset&&E.$from.marks();if(n.split(u.pos,2,k).scrollIntoView(),!J||!i)return!0;const U=J.filter(M=>L.includes(M.type.name));n.ensureMarks(U)}return!0},E0=(t,e)=>{const n=E1(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)&&ji(t.doc,n.pos)&&t.join(n.pos),!0},T0=(t,e)=>{const n=E1(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)&&ji(t.doc,r)&&t.join(r),!0},IB=(t,e,n,r={})=>({editor:i,tr:s,state:l,dispatch:c,chain:u,commands:f,can:h})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,y=yn(t,l.schema),v=yn(e,l.schema),{selection:S,storedMarks:k}=l,{$from:E,$to:j}=S,L=E.blockRange(j),J=k||S.$to.parentOffset&&S.$from.marks();if(!L)return!1;const U=E1(M=>bT(M.type.name,m))(S);if(L.depth>=1&&U&&L.depth-U.depth<=1){if(U.node.type===y)return f.liftListItem(v);if(bT(U.node.type.name,m)&&y.validContent(U.node.content)&&c)return u().command(()=>(s.setNodeMarkup(U.pos,y),!0)).command(()=>E0(s,y)).command(()=>T0(s,y)).run()}return!n||!J||!c?u().command(()=>h().wrapInList(y,r)?!0:f.clearNodes()).wrapInList(y,r).command(()=>E0(s,y)).command(()=>T0(s,y)).run():u().command(()=>{const M=h().wrapInList(y,r),N=J.filter(G=>g.includes(G.type.name));return s.ensureMarks(N),M?!0:f.clearNodes()}).wrapInList(y,r).command(()=>E0(s,y)).command(()=>T0(s,y)).run()},jB=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,l=wo(t,r.schema);return Yb(r,l,e)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,e)},BB=(t,e,n={})=>({state:r,commands:i})=>{const s=yn(t,r.schema),l=yn(e,r.schema),c=ed(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?i.setNode(l,u):i.setNode(s,{...u,...n})},UB=(t,e={})=>({state:n,commands:r})=>{const i=yn(t,n.schema);return ed(n,i,e)?r.lift(i):r.wrapIn(i,e)},HB=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const l=t.tr,c=s.transform;for(let u=c.steps.length-1;u>=0;u-=1)l.step(c.steps[u].invert(c.docs[u]));if(s.text){const u=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else l.delete(s.from,s.to)}return!0}}return!1},$B=()=>({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},VB=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:c}=n,u=wo(t,r.schema),{$from:f,empty:h,ranges:m}=c;if(!i)return!0;if(h&&l){let{from:g,to:y}=c;const v=(s=f.marks().find(k=>k.type===u))===null||s===void 0?void 0:s.attrs,S=C1(f,u,v);S&&(g=S.from,y=S.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},PB=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=km(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=yn(t,r.schema)),c==="mark"&&(l=wo(t,r.schema)),i&&n.selection.ranges.forEach(u=>{const f=u.$from.pos,h=u.$to.pos;let m,g,y,v;n.selection.empty?r.doc.nodesBetween(f,h,(S,k)=>{s&&s===S.type&&(y=Math.max(k,f),v=Math.min(k+S.nodeSize,h),m=k,g=S)}):r.doc.nodesBetween(f,h,(S,k)=>{k<f&&s&&s===S.type&&(y=Math.max(k,f),v=Math.min(k+S.nodeSize,h),m=k,g=S),k>=f&&k<=h&&(s&&s===S.type&&n.setNodeMarkup(k,void 0,{...S.attrs,...e}),l&&S.marks.length&&S.marks.forEach(E=>{if(l===E.type){const j=Math.max(k,f),L=Math.min(k+S.nodeSize,h);n.addMark(j,L,l.create({...E.attrs,...e}))}}))}),g&&(m!==void 0&&n.setNodeMarkup(m,void 0,{...g.attrs,...e}),l&&g.marks.length&&g.marks.forEach(S=>{l===S.type&&n.addMark(y,v,l.create({...S.attrs,...e}))}))}),!0):!1},FB=(t,e={})=>({state:n,dispatch:r})=>{const i=yn(t,n.schema);return C_(i,e)(n,r)},qB=(t,e={})=>({state:n,dispatch:r})=>{const i=yn(t,n.schema);return E_(i,e)(n,r)};var KB=Object.freeze({__proto__:null,blur:Aj,clearContent:Mj,clearNodes:Oj,command:_j,createParagraphNear:Dj,cut:Rj,deleteCurrentNode:Nj,deleteNode:zj,deleteRange:Lj,deleteSelection:Ij,enter:jj,exitCode:Bj,extendMarkRange:Uj,first:Hj,focus:Vj,forEach:Pj,insertContent:Fj,insertContentAt:Yj,joinBackward:Zj,joinDown:Gj,joinForward:Jj,joinItemBackward:Xj,joinItemForward:Qj,joinTextblockBackward:eB,joinTextblockForward:tB,joinUp:Wj,keyboardShortcut:rB,lift:iB,liftEmptyBlock:sB,liftListItem:oB,newlineInCode:lB,resetAttributes:aB,scrollIntoView:cB,selectAll:uB,selectNodeBackward:dB,selectNodeForward:fB,selectParentNode:hB,selectTextblockEnd:pB,selectTextblockStart:mB,setContent:gB,setMark:MB,setMeta:OB,setNode:_B,setNodeSelection:DB,setTextSelection:RB,sinkListItem:NB,splitBlock:zB,splitListItem:LB,toggleList:IB,toggleMark:jB,toggleNode:BB,toggleWrap:UB,undoInputRule:HB,unsetAllMarks:$B,unsetMark:VB,updateAttributes:PB,wrapIn:FB,wrapInList:qB});const YB=Zn.create({name:"commands",addCommands(){return{...KB}}}),WB=Zn.create({name:"drop",addProseMirrorPlugins(){return[new lt({key:new ht("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),GB=Zn.create({name:"editable",addProseMirrorPlugins(){return[new lt({key:new ht("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ZB=new ht("focusEvents"),JB=Zn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new lt({key:ZB,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}}}})]}}),XB=Zn.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:u,doc:f}=c,{empty:h,$anchor:m}=u,{pos:g,parent:y}=m,v=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,S=v.parent.type.spec.isolating,k=m.pos-m.parentOffset,E=S&&v.parent.childCount===1?k===m.pos:De.atStart(f).from===g;return!h||!y.type.isTextblock||y.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 up()||I_()?s:i},addProseMirrorPlugins(){return[new lt({key:new ht("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(S=>S.getMeta("composition")))return;const r=t.some(S=>S.docChanged)&&!e.doc.eq(n.doc),i=t.some(S=>S.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:l,to:c}=e.selection,u=De.atStart(e.doc).from,f=De.atEnd(e.doc).to;if(s||!(l===u&&c===f)||!Cm(n.doc))return;const g=n.tr,y=bm({state:n,transaction:g}),{commands:v}=new xm({editor:this.editor,state:y});if(v.clearNodes(),!!g.steps.length)return g}})]}}),QB=Zn.create({name:"paste",addProseMirrorPlugins(){return[new lt({key:new ht("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),e6=Zn.create({name:"tabindex",addProseMirrorPlugins(){return[new lt({key:new ht("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Ko{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 Ko(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 Ko(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 Ko(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const c=this.resolvedPos.doc.resolve(l);if(!i&&c.depth<=this.depth)return;const u=new Ko(c,this.editor,i,i?n:null);i&&(u.actualDepth=this.depth+1),e.push(new Ko(c,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,l=Object.keys(n);for(let c=0;c<l.length;c+=1){const u=l[c];if(s[u]!==n[u])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(l=>{r&&i.length>0||(l.node.type.name===e&&s.every(u=>n[u]===l.node.attrs[u])&&i.push(l),!(r&&i.length>0)&&(i=i.concat(l.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const t6=`.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 n6(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 r6=class extends dj{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=n6(t6,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=O_(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?[GB,Tj.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),YB,JB,XB,e6,WB,QB].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 Ca(i,this)}createCommandManager(){this.commandManager=new xm({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Kb(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=Kb(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=z_(n,this.options.autofocus);this.view=new c_(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:ka.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 U_(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return EB(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return w1(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
|
|
147
|
+
|
|
148
|
+
`,textSerializers:r={}}=e||{};return vB(this.state.doc,{blockSeparator:n,textSerializers:{...D_(this.schema),...r}})}get isEmpty(){return Cm(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 Ko(n,this)}get $doc(){return this.$pos(0)}};function pl(t){return new Sm({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 u=c.search(/\S/),f=n.from+c.indexOf(l),h=f+l.length;if(T1(n.from,n.to,e.doc).filter(y=>y.mark.type.excluded.find(S=>S===t.type&&S!==y.mark.type)).filter(y=>y.to>f).length)return null;h<n.to&&s.delete(h,n.to),f>n.from&&s.delete(n.from+u,f);const g=n.from+u+l.length;s.addMark(n.from+u,g,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function i6(t){return new Sm({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 u=t.type.create(i);if(r[1]){const f=r[0].lastIndexOf(r[1]);let h=l+f;h>c?h=c:c=h+r[1].length;const m=r[0][r[0].length-1];s.insertText(m,l+r[0].length-1),s.replaceWith(h,c,u)}else if(r[0]){const f=t.type.isInline?l:l-1;s.insert(f,t.type.create(i)).delete(s.mapping.map(l),s.mapping.map(c))}s.scrollIntoView()}})}function Wb(t){return new Sm({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 td(t){return new Sm({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),u=l.doc.resolve(n.from).blockRange(),f=u&&Xx(u,t.type,s);if(!f)return null;if(l.wrap(u,f),t.keepMarks&&t.editor){const{selection:m,storedMarks:g}=e,{splittableMarks:y}=t.editor.extensionManager,v=g||m.$to.parentOffset&&m.$from.marks();if(v){const S=v.filter(k=>y.includes(k.type.name));l.ensureMarks(S)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,s).run()}const h=l.doc.resolve(n.from-1).nodeBefore;h&&h.type===t.type&&ji(l.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,h))&&l.join(n.from-1)}})}class bn{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(we(this,"addOptions",{name:this.name}))),this.storage=We(we(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new bn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>wm(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new bn(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(we(n,"addOptions",{name:n.name})),n.storage=We(we(n,"addStorage",{name:n.name,options:n.options})),n}}function yo(t){return new vj({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],u=r[0];let f=n.to;if(c){const h=u.search(/\S/),m=n.from+u.indexOf(c),g=m+c.length;if(T1(n.from,n.to,e.doc).filter(v=>v.mark.type.excluded.find(k=>k===t.type&&k!==v.mark.type)).filter(v=>v.to>m).length)return null;g<n.to&&l.delete(g,n.to),m>n.from&&l.delete(n.from+h,m),f=n.from+h+c.length,l.addMark(n.from+h,f,t.type.create(s||{})),l.removeStoredMark(t.type)}}})}function s6(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ae){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 Qr=()=>new Map,Gb=t=>{const e=Qr();return t.forEach((n,r)=>{e.set(r,n)}),e},Bi=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},o6=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},l6=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},ml=()=>new Set,A0=t=>t[t.length-1],a6=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},bo=Array.from,A1=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},M1=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},c6=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},Ya=Array.isArray;class H_{constructor(){this._observers=Qr()}on(e,n){return Bi(this._observers,e,ml).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 bo((this._observers.get(e)||Qr()).values()).forEach(r=>r(...n))}destroy(){this._observers=Qr()}}const ai=Math.floor,_h=Math.abs,bs=(t,e)=>t<e?t:e,ci=(t,e)=>t>e?t:e,$_=t=>t!==0?t<0:1/t<0,vT=1,ST=2,M0=4,O0=8,nd=32,xs=64,Kn=128,u6=1<<29,Em=31,Zb=63,sl=127,d6=2147483647,dp=Number.MAX_SAFE_INTEGER,wT=Number.MIN_SAFE_INTEGER,f6=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&ai(t)===t),V_=String.fromCharCode,h6=t=>t.toLowerCase(),p6=/^\s*/g,m6=t=>t.replace(p6,""),g6=/([A-Z])/g,kT=(t,e)=>m6(t.replace(g6,n=>`${e}${h6(n)}`)),y6=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},rd=typeof TextEncoder<"u"?new TextEncoder:null,b6=t=>rd.encode(t),x6=rd?b6:y6;let Eu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Eu&&Eu.decode(new Uint8Array).length===1&&(Eu=null);const v6=(t,e)=>c6(e,()=>t).join("");let Td=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const Ad=()=>new Td,S6=t=>{const e=Ad();return t(e),li(e)},w6=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},li=t=>{const e=new Uint8Array(w6(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},k6=(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(ci(n,e)*2),t.cpos=0)},hn=(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},Jb=hn,st=(t,e)=>{for(;e>sl;)hn(t,Kn|sl&e),e=ai(e/128);hn(t,sl&e)},O1=(t,e)=>{const n=$_(e);for(n&&(e=-e),hn(t,(e>Zb?Kn:0)|(n?xs:0)|Zb&e),e=ai(e/64);e>0;)hn(t,(e>sl?Kn:0)|sl&e),e=ai(e/128)},Xb=new Uint8Array(3e4),C6=Xb.length/3,E6=(t,e)=>{if(e.length<C6){const n=rd.encodeInto(e,Xb).written||0;st(t,n);for(let r=0;r<n;r++)hn(t,Xb[r])}else kr(t,x6(e))},T6=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;st(t,r);for(let i=0;i<r;i++)hn(t,n.codePointAt(i))},Oa=rd&&rd.encodeInto?E6:T6,Tm=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=bs(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(ci(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},kr=(t,e)=>{st(t,e.byteLength),Tm(t,e)},_1=(t,e)=>{k6(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},A6=(t,e)=>_1(t,4).setFloat32(0,e,!1),M6=(t,e)=>_1(t,8).setFloat64(0,e,!1),O6=(t,e)=>_1(t,8).setBigInt64(0,e,!1),CT=new DataView(new ArrayBuffer(4)),_6=t=>(CT.setFloat32(0,t),CT.getFloat32(0)===t),Wa=(t,e)=>{switch(typeof e){case"string":hn(t,119),Oa(t,e);break;case"number":f6(e)&&_h(e)<=d6?(hn(t,125),O1(t,e)):_6(e)?(hn(t,124),A6(t,e)):(hn(t,123),M6(t,e));break;case"bigint":hn(t,122),O6(t,e);break;case"object":if(e===null)hn(t,126);else if(Ya(e)){hn(t,117),st(t,e.length);for(let n=0;n<e.length;n++)Wa(t,e[n])}else if(e instanceof Uint8Array)hn(t,116),kr(t,e);else{hn(t,118);const n=Object.keys(e);st(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];Oa(t,i),Wa(t,e[i])}}break;case"boolean":hn(t,e?120:121);break;default:hn(t,127)}};class ET extends Td{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&&(O1(t.encoder,t.count===1?t.s:-t.s),t.count>1&&st(t.encoder,t.count-2))};class Dh{constructor(){this.encoder=new Td,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),li(this.encoder)}}const AT=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);O1(t.encoder,e),t.count>1&&st(t.encoder,t.count-2)}};class _0{constructor(){this.encoder=new Td,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(AT(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return AT(this),li(this.encoder)}}class D6{constructor(){this.sarr=[],this.s="",this.lensE=new Dh}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 Td;return this.sarr.push(this.s),this.s="",Oa(e,this.sarr.join("")),Tm(e,this.lensE.toUint8Array()),li(e)}}const zi=t=>new Error(t),ei=()=>{throw zi("Method unimplemented")},In=()=>{throw zi("Unexpected case")},P_=zi("Unexpected end of array"),F_=zi("Integer out of Range");let Am=class{constructor(e){this.arr=e,this.pos=0}};const ic=t=>new Am(t),R6=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},Cr=t=>N6(t,Ze(t)),Ga=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&sl)*n,n*=128,i<Kn)return e;if(e>dp)throw F_}throw P_},D1=t=>{let e=t.arr[t.pos++],n=e&Zb,r=64;const i=(e&xs)>0?-1:1;if((e&Kn)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&sl)*r,r*=128,e<Kn)return i*n;if(n>dp)throw F_}throw P_},z6=t=>{let e=Ze(t);if(e===0)return"";{let n=String.fromCodePoint(Ga(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Ga(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))}},L6=t=>Eu.decode(Cr(t)),_a=Eu?L6:z6,R1=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},I6=t=>R1(t,4).getFloat32(0,!1),j6=t=>R1(t,8).getFloat64(0,!1),B6=t=>R1(t,8).getBigInt64(0,!1),U6=[t=>{},t=>null,D1,I6,j6,B6,t=>!1,t=>!0,_a,t=>{const e=Ze(t),n={};for(let r=0;r<e;r++){const i=_a(t);n[i]=id(t)}return n},t=>{const e=Ze(t),n=[];for(let r=0;r<e;r++)n.push(id(t));return n},Cr],id=t=>U6[127-Ga(t)](t);class MT extends Am{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),R6(this)?this.count=Ze(this)+1:this.count=-1),this.count--,this.s}}class Rh extends Am{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=D1(this);const e=$_(this.s);this.count=1,e&&(this.s=-this.s,this.count=Ze(this)+2)}return this.count--,this.s}}class D0 extends Am{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=D1(this),n=e&1;this.diff=ai(e/2),this.count=1,n&&(this.count=Ze(this)+2)}return this.s+=this.diff,this.count--,this.s}}class H6{constructor(e){this.decoder=new Rh(e),this.str=_a(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 $6=crypto.getRandomValues.bind(crypto),V6=Math.random,q_=()=>$6(new Uint32Array(1))[0],P6=t=>t[ai(V6()*t.length)],F6="10000000-1000-4000-8000"+-1e11,q6=()=>F6.replace(/[018]/g,t=>(t^q_()&15>>t/4).toString(16)),K6=Date.now,OT=t=>new Promise(t);Promise.all.bind(Promise);const _T=t=>t===void 0?null:t;class Y6{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let K_=new Y6,W6=!0;try{typeof localStorage<"u"&&localStorage&&(K_=localStorage,W6=!1)}catch{}const G6=K_,sd=Symbol("Equality"),Y_=(t,e)=>{var n;return t===e||!!((n=t==null?void 0:t[sd])!=null&&n.call(t,e))||!1},Z6=t=>typeof t=="object",J6=Object.assign,W_=Object.keys,X6=(t,e)=>{for(const n in t)e(t[n],n)},fp=t=>W_(t).length,Q6=t=>{for(const e in t)return!1;return!0},sc=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},N1=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),e5=(t,e)=>t===e||fp(t)===fp(e)&&sc(t,(n,r)=>(n!==void 0||N1(e,r))&&Y_(e[r],n)),t5=Object.freeze,G_=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&G_(t[e])}return t5(t)},z1=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&z1(t,e,n+1)}},n5=t=>t,Nh=(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[sd]!=null)return t[sd](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)||!Nh(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(fp(t)!==fp(e))return!1;for(const n in t)if(!N1(t,n)||!Nh(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(!Nh(t[n],e[n]))return!1;break;default:return!1}return!0},r5=(t,e)=>e.includes(t);var Z_={};const Za=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",J_=typeof window<"u"&&typeof document<"u"&&!Za;let Si;const i5=()=>{if(Si===void 0)if(Za){Si=Qr();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&Si.set(e,""),e=r):e!==null&&(Si.set(e,r),e=null)}e!==null&&Si.set(e,"")}else typeof location=="object"?(Si=Qr(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");Si.set(`--${kT(e,"-")}`,n),Si.set(`-${kT(e,"-")}`,n)}})):Si=Qr();return Si},Qb=t=>i5().has(t),hp=t=>_T(Za?Z_[t.toUpperCase().replaceAll("-","_")]:G6.getItem(t)),X_=t=>Qb("--"+t)||hp(t)!==null,s5=X_("production"),o5=Za&&r5(Z_.FORCE_COLOR,["true","1","2"]),l5=o5||!Qb("--no-colors")&&!X_("no-color")&&(!Za||process.stdout.isTTY)&&(!Za||Qb("--color")||hp("COLORTERM")!==null||(hp("TERM")||"").includes("color")),a5=t=>new Uint8Array(t),c5=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=V_(t[n]);return btoa(e)},u5=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),d5=J_?c5:u5,f5=t=>{const e=a5(t.byteLength);return e.set(t),e},h5=t=>S6(e=>Wa(e,t));class p5{constructor(e,n){this.left=e,this.right=n}}const cs=(t,e)=>new p5(t,e),DT=t=>t.next()>=.5,R0=(t,e,n)=>ai(t.next()*(n+1-e)+e),Q_=(t,e,n)=>ai(t.next()*(n+1-e)+e),L1=(t,e,n)=>Q_(t,e,n),m5=t=>V_(L1(t,97,122)),g5=(t,e=0,n=20)=>{const r=L1(t,e,n);let i="";for(let s=0;s<r;s++)i+=m5(t);return i},N0=(t,e)=>e[L1(t,0,e.length-1)],y5=Symbol("0schema");class b5{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(v6(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
|
|
149
|
+
`)}}const ex=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[sd]?Y_(t,e):Ya(t)?A1(t,n=>M1(e,r=>ex(n,r))):Z6(t)?sc(t,(n,r)=>ex(n,e[r])):!1;var xb;let Jn=(xb=class{extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),ex(n,r)}equals(e){return this.constructor===e.constructor&&Nh(this.shape,e.shape)}[y5](){return!0}[sd](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){ei()}get nullable(){return oc(this,Rm)}get optional(){return new nD(this)}cast(e){return RT(e,this),e}expect(e){return RT(e,this),e}},Wf(xb,"_dilutes",!1),xb);class I1 extends Jn{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 sn=(t,e=null)=>new I1(t,e);sn(I1);class j1 extends Jn{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 xn=t=>new j1(t);sn(j1);class Mm extends Jn{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(i=>i===e);return!r&&(n==null||n.extend(null,this.shape.join(" | "),e.toString())),r}}const Om=(...t)=>new Mm(t),eD=sn(Mm),x5=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),tD=t=>{if(Ja.check(t))return[x5(t)];if(eD.check(t))return t.shape.map(e=>e+"");if(dD.check(t))return["[+-]?\\d+.?\\d*"];if(fD.check(t))return[".*"];if(mp.check(t))return t.shape.map(tD).flat(1);In()};class v5 extends Jn{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(tD).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}}sn(v5);const S5=Symbol("optional");class nD extends Jn{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[S5](){return!0}}const w5=sn(nD);class k5 extends Jn{check(e,n){return n==null||n.extend(null,"never",typeof e),!1}}sn(k5);const cm=class cm extends Jn{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}get partial(){return new cm(this.shape,!0)}check(e,n){return e==null?(n==null||n.extend(null,"object","null"),!1):sc(this.shape,(r,i)=>{const s=this._isPartial&&!N1(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})}};Wf(cm,"_dilutes",!0);let pp=cm;const C5=t=>new pp(t),E5=sn(pp),T5=xn(t=>t!=null&&(t.constructor===Object||t.constructor==null));class rD extends Jn{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&sc(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 iD=(t,e)=>new rD(t,e),A5=sn(rD);class sD extends Jn{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&sc(this.shape,(r,i)=>{const s=r.check(e[i],n);return!s&&(n==null||n.extend(i.toString(),"Tuple",typeof r)),s})}}const M5=(...t)=>new sD(t);sn(sD);class oD extends Jn{constructor(e){super(),this.shape=e.length===1?e[0]:new _m(e)}check(e,n){const r=Ya(e)&&A1(e,i=>this.shape.check(i));return!r&&(n==null||n.extend(null,"Array","")),r}}const lD=(...t)=>new oD(t),O5=sn(oD),_5=xn(t=>Ya(t));class aD extends Jn{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 D5=(t,e=null)=>new aD(t,e);sn(aD);const R5=D5(Jn);class N5 extends Jn{constructor(e){super(),this.len=e.length-1,this.args=M5(...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 z5=sn(N5),L5=xn(t=>typeof t=="function");class I5 extends Jn{constructor(e){super(),this.shape=e}check(e,n){const r=A1(this.shape,i=>i.check(e,n));return!r&&(n==null||n.extend(null,"Intersectinon",typeof e)),r}}sn(I5,t=>t.shape.length>0);class _m extends Jn{constructor(e){super(),this.shape=e}check(e,n){const r=M1(this.shape,i=>i.check(e,n));return n==null||n.extend(null,"Union",typeof e),r}}Wf(_m,"_dilutes",!0);const oc=(...t)=>t.findIndex(e=>mp.check(e))>=0?oc(...t.map(e=>od(e)).map(e=>mp.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new _m(t),mp=sn(_m),cD=()=>!0,gp=xn(cD),j5=sn(j1,t=>t.shape===cD),B1=xn(t=>typeof t=="bigint"),B5=xn(t=>t===B1),uD=xn(t=>typeof t=="symbol");xn(t=>t===uD);const Da=xn(t=>typeof t=="number"),dD=xn(t=>t===Da),Ja=xn(t=>typeof t=="string"),fD=xn(t=>t===Ja),Dm=xn(t=>typeof t=="boolean"),U5=xn(t=>t===Dm),hD=Om(void 0);sn(Mm,t=>t.shape.length===1&&t.shape[0]===void 0);Om(void 0);const Rm=Om(null),H5=sn(Mm,t=>t.shape.length===1&&t.shape[0]===null);sn(Uint8Array);sn(I1,t=>t.shape===Uint8Array);const $5=oc(Da,Ja,Rm,hD,B1,Dm,uD);(()=>{const t=lD(gp),e=iD(Ja,gp),n=oc(Da,Ja,Rm,Dm,t,e);return t.shape=n,e.shape.values=n,n})();const od=t=>{if(R5.check(t))return t;if(T5.check(t)){const e={};for(const n in t)e[n]=od(t[n]);return C5(e)}else{if(_5.check(t))return oc(...t.map(od));if($5.check(t))return Om(t);if(L5.check(t))return sn(t)}In()},RT=s5?()=>{}:(t,e)=>{const n=new b5;if(!e.check(t,n))throw zi(`Expected value to be of type ${e.constructor.name}.
|
|
150
|
+
${n.toString()}`)};class V5{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:od(e),h:n}),this}else(e){return this.if(gp,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 zi("Unhandled pattern")}}}const P5=t=>new V5(t),pD=P5(gp).if(dD,(t,e)=>R0(e,wT,dp)).if(fD,(t,e)=>g5(e)).if(U5,(t,e)=>DT(e)).if(B5,(t,e)=>BigInt(R0(e,wT,dp))).if(mp,(t,e)=>ma(e,N0(e,t.shape))).if(E5,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(w5.check(i)){if(DT(e))continue;i=i.shape}n[r]=pD(i,e)}return n}).if(O5,(t,e)=>{const n=[],r=Q_(e,0,42);for(let i=0;i<r;i++)n.push(ma(e,t.shape));return n}).if(eD,(t,e)=>N0(e,t.shape)).if(H5,(t,e)=>null).if(z5,(t,e)=>{const n=ma(e,t.res);return()=>n}).if(j5,(t,e)=>ma(e,N0(e,[Da,Ja,Rm,hD,B1,Dm,lD(Da),iD(oc("a","b","c"),Da)]))).if(A5,(t,e)=>{const n={},r=R0(e,0,3);for(let i=0;i<r;i++){const s=ma(e,t.shape.keys),l=ma(e,t.shape.values);n[s]=l}return n}).done(),ma=(t,e)=>pD(od(e),t),Md=typeof document<"u"?document:{};xn(t=>t.nodeType===W5);typeof DOMParser<"u"&&new DOMParser;xn(t=>t.nodeType===q5);xn(t=>t.nodeType===K5);const F5=t=>o6(t,(e,n)=>`${n}:${e};`).join(""),q5=Md.ELEMENT_NODE,K5=Md.TEXT_NODE,Y5=Md.DOCUMENT_NODE,W5=Md.DOCUMENT_FRAGMENT_NODE;xn(t=>t.nodeType===Y5);const G5=t=>class{constructor(n){this._=n}destroy(){t(this._)}},Z5=G5(clearTimeout),U1=(t,e)=>new Z5(setTimeout(e,t)),ws=Symbol,mD=ws(),gD=ws(),J5=ws(),X5=ws(),Q5=ws(),yD=ws(),eU=ws(),H1=ws(),tU=ws(),nU=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},rU={[mD]:cs("font-weight","bold"),[gD]:cs("font-weight","normal"),[J5]:cs("color","blue"),[Q5]:cs("color","green"),[X5]:cs("color","grey"),[yD]:cs("color","red"),[eU]:cs("color","purple"),[H1]:cs("color","orange"),[tU]:cs("color","black")},iU=t=>{var l;t.length===1&&((l=t[0])==null?void 0:l.constructor)===Function&&(t=t[0]());const e=[],n=[],r=Qr();let i=[],s=0;for(;s<t.length;s++){const c=t[s],u=rU[c];if(u!==void 0)r.set(u.left,u.right);else{if(c===void 0)break;if(c.constructor===String||c.constructor===Number){const f=F5(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},bD=l5?iU:nU,sU=(...t)=>{console.log(...bD(t)),vD.forEach(e=>e.print(t))},xD=(...t)=>{console.warn(...bD(t)),t.unshift(H1),vD.forEach(e=>e.print(t))},vD=ml(),SD=t=>({[Symbol.iterator](){return this},next:t}),oU=(t,e)=>SD(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),z0=(t,e)=>SD(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class Nm{constructor(e,n){this.clock=e,this.len=n}}class lc{constructor(){this.clients=new Map}}const xo=(t,e,n)=>e.clients.forEach((r,i)=>{const s=t.doc.store.clients.get(i);if(s!=null){const l=s[s.length-1],c=l.id.clock+l.length;for(let u=0,f=r[u];u<r.length&&f.clock<c;f=r[++u])LD(t,s,f.clock,f.len,n)}}),lU=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=ai((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},ac=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&lU(n,e.clock)!==null},$1=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 Nm(i.clock,ci(i.len,s.clock+s.len-i.clock)):(r<n&&(e[r]=s),r++)}e.length=r})},tx=t=>{const e=new lc;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++)a6(s,t[l].clients.get(i)||[]);e.clients.set(i,s)}});return $1(e),e},ld=(t,e,n,r)=>{Bi(t.clients,e,()=>[]).push(new Nm(n,r))},wD=()=>new lc,kD=t=>{const e=wD();return t.clients.forEach((n,r)=>{const i=[];for(let s=0;s<n.length;s++){const l=n[s];if(l.deleted){const c=l.id.clock;let u=l.length;if(s+1<n.length)for(let f=n[s+1];s+1<n.length&&f.deleted;f=n[++s+1])u+=f.length;i.push(new Nm(c,u))}}i.length>0&&e.clients.set(r,i)}),e},cc=(t,e)=>{st(t.restEncoder,e.clients.size),bo(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)}})},V1=t=>{const e=new lc,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=Bi(e.clients,i,()=>[]);for(let c=0;c<s;c++)l.push(new Nm(t.readDsClock(),t.readDsLen()))}}return e},NT=(t,e,n)=>{const r=new lc,i=Ze(t.restDecoder);for(let s=0;s<i;s++){t.resetDsCurVal();const l=Ze(t.restDecoder),c=Ze(t.restDecoder),u=n.clients.get(l)||[],f=Gt(n,l);for(let h=0;h<c;h++){const m=t.readDsClock(),g=m+t.readDsLen();if(m<f){f<g&&ld(r,l,f,g-f);let y=ui(u,m),v=u[y];for(!v.deleted&&v.id.clock<m&&(u.splice(y+1,0,kp(e,v,m-v.id.clock)),y++);y<u.length&&(v=u[y++],v.id.clock<g);)v.deleted||(g<v.id.clock+v.length&&u.splice(y,0,kp(e,v,g-v.id.clock)),v.delete(e))}else ld(r,l,m,g-m)}}if(r.clients.size>0){const s=new gl;return st(s.restEncoder,0),cc(s,r),s.toUint8Array()}return null},CD=q_;class Li extends H_{constructor({guid:e=q6(),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=CD(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new ND,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=OT(f=>{this.on("load",()=>{this.isLoaded=!0,f(this)})});const u=()=>OT(f=>{const h=m=>{(m===void 0||m===!0)&&(this.off("sync",h),f())};this.on("sync",h)});this.on("sync",f=>{f===!1&&this.isSynced&&(this.whenSynced=u()),this.isSynced=f===void 0||f===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=u()}load(){const e=this._item;e!==null&&!this.shouldLoad&&wt(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(bo(this.subdocs).map(e=>e.guid))}transact(e,n=null){return wt(this,e,n)}get(e,n=mn){const r=Bi(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==mn&&i!==n)if(i===mn){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,za)}getText(e=""){return this.get(e,vo)}getMap(e=""){return this.get(e,Qa)}getXmlElement(e=""){return this.get(e,_n)}getXmlFragment(e=""){return this.get(e,yl)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,bo(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new Li({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,wt(e.parent.doc,r=>{const i=n.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class ED{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Ze(this.restDecoder)}readDsLen(){return Ze(this.restDecoder)}}class TD extends ED{readLeftID(){return Ve(Ze(this.restDecoder),Ze(this.restDecoder))}readRightID(){return Ve(Ze(this.restDecoder),Ze(this.restDecoder))}readClient(){return Ze(this.restDecoder)}readInfo(){return Ga(this.restDecoder)}readString(){return _a(this.restDecoder)}readParentInfo(){return Ze(this.restDecoder)===1}readTypeRef(){return Ze(this.restDecoder)}readLen(){return Ze(this.restDecoder)}readAny(){return id(this.restDecoder)}readBuf(){return f5(Cr(this.restDecoder))}readJSON(){return JSON.parse(_a(this.restDecoder))}readKey(){return _a(this.restDecoder)}}class aU{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 Xa extends aU{constructor(e){super(e),this.keys=[],Ze(e),this.keyClockDecoder=new D0(Cr(e)),this.clientDecoder=new Rh(Cr(e)),this.leftClockDecoder=new D0(Cr(e)),this.rightClockDecoder=new D0(Cr(e)),this.infoDecoder=new MT(Cr(e),Ga),this.stringDecoder=new H6(Cr(e)),this.parentInfoDecoder=new MT(Cr(e),Ga),this.typeRefDecoder=new Rh(Cr(e)),this.lenDecoder=new Rh(Cr(e))}readLeftID(){return new Ra(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Ra(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 id(this.restDecoder)}readBuf(){return Cr(this.restDecoder)}readJSON(){return id(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 AD{constructor(){this.restEncoder=Ad()}toUint8Array(){return li(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){st(this.restEncoder,e)}writeDsLen(e){st(this.restEncoder,e)}}class Od extends AD{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){Jb(this.restEncoder,e)}writeString(e){Oa(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){Wa(this.restEncoder,e)}writeBuf(e){kr(this.restEncoder,e)}writeJSON(e){Oa(this.restEncoder,JSON.stringify(e))}writeKey(e){Oa(this.restEncoder,e)}}class MD{constructor(){this.restEncoder=Ad(),this.dsCurrVal=0}toUint8Array(){return li(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 gl extends MD{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new _0,this.clientEncoder=new Dh,this.leftClockEncoder=new _0,this.rightClockEncoder=new _0,this.infoEncoder=new ET(Jb),this.stringEncoder=new D6,this.parentInfoEncoder=new ET(Jb),this.typeRefEncoder=new Dh,this.lenEncoder=new Dh}toUint8Array(){const e=Ad();return st(e,0),kr(e,this.keyClockEncoder.toUint8Array()),kr(e,this.clientEncoder.toUint8Array()),kr(e,this.leftClockEncoder.toUint8Array()),kr(e,this.rightClockEncoder.toUint8Array()),kr(e,li(this.infoEncoder)),kr(e,this.stringEncoder.toUint8Array()),kr(e,li(this.parentInfoEncoder)),kr(e,this.typeRefEncoder.toUint8Array()),kr(e,this.lenEncoder.toUint8Array()),Tm(e,li(this.restEncoder)),li(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){Wa(this.restEncoder,e)}writeBuf(e){kr(this.restEncoder,e)}writeJSON(e){Wa(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 cU=(t,e,n,r)=>{r=ci(r,e[0].id.clock);const i=ui(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)},P1=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{Gt(e,s)>i&&r.set(s,i)}),_d(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),st(t.restEncoder,r.size),bo(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{cU(t,e.clients.get(i),i,s)})},uU=(t,e)=>{const n=Qr(),r=Ze(t.restDecoder);for(let i=0;i<r;i++){const s=Ze(t.restDecoder),l=new Array(s),c=t.readClient();let u=Ze(t.restDecoder);n.set(c,{i:0,refs:l});for(let f=0;f<s;f++){const h=t.readInfo();switch(Em&h){case 0:{const m=t.readLen();l[f]=new Wr(Ve(c,u),m),u+=m;break}case 10:{const m=Ze(t.restDecoder);l[f]=new Gr(Ve(c,u),m),u+=m;break}default:{const m=(h&(xs|Kn))===0,g=new Tt(Ve(c,u),null,(h&Kn)===Kn?t.readLeftID():null,null,(h&xs)===xs?t.readRightID():null,m?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,m&&(h&nd)===nd?t.readString():null,r2(t,h));l[f]=g,u+=g.length}}}}return n},dU=(t,e,n)=>{const r=[];let i=bo(n.keys()).sort((y,v)=>y-v);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let y=n.get(i[i.length-1]);for(;y.refs.length===y.i;)if(i.pop(),i.length>0)y=n.get(i[i.length-1]);else return null;return y};let l=s();if(l===null)return null;const c=new ND,u=new Map,f=(y,v)=>{const S=u.get(y);(S==null||S>v)&&u.set(y,v)};let h=l.refs[l.i++];const m=new Map,g=()=>{for(const y of r){const v=y.id.client,S=n.get(v);S?(S.i--,c.clients.set(v,S.refs.slice(S.i)),n.delete(v),S.i=0,S.refs=[]):c.clients.set(v,[y]),i=i.filter(k=>k!==v)}r.length=0};for(;;){if(h.constructor!==Gr){const v=Bi(m,h.id.client,()=>Gt(e,h.id.client))-h.id.clock;if(v<0)r.push(h),f(h.id.client,h.id.clock-1),g();else{const S=h.getMissing(t,e);if(S!==null){r.push(h);const k=n.get(S)||{refs:[],i:0};if(k.refs.length===k.i)f(S,Gt(e,S)),g();else{h=k.refs[k.i++];continue}}else(v===0||v<h.length)&&(h.integrate(t,v),m.set(h.id.client,h.id.clock+h.length))}}if(r.length>0)h=r.pop();else if(l!==null&&l.i<l.refs.length)h=l.refs[l.i++];else{if(l=s(),l===null)break;h=l.refs[l.i++]}}if(c.clients.size>0){const y=new gl;return P1(y,c,new Map),st(y.restEncoder,0),{missing:u,update:y.toUint8Array()}}return null},fU=(t,e)=>P1(t,e.doc.store,e.beforeState),hU=(t,e,n,r=new Xa(t))=>wt(e,i=>{i.local=!1;let s=!1;const l=i.doc,c=l.store,u=uU(r,l),f=dU(i,c,u),h=c.pendingStructs;if(h){for(const[g,y]of h.missing)if(y<Gt(c,g)){s=!0;break}if(f){for(const[g,y]of f.missing){const v=h.missing.get(g);(v==null||v>y)&&h.missing.set(g,y)}h.update=bp([h.update,f.update])}}else c.pendingStructs=f;const m=NT(r,i,c);if(c.pendingDs){const g=new Xa(ic(c.pendingDs));Ze(g.restDecoder);const y=NT(g,i,c);m&&y?c.pendingDs=bp([m,y]):c.pendingDs=m||y}else c.pendingDs=m;if(s){const g=c.pendingStructs.update;c.pendingStructs=null,yp(i.doc,g)}},n,!1),yp=(t,e,n,r=Xa)=>{const i=ic(e);hU(i,t,n,new r(i))},pU=(t,e,n)=>yp(t,e,n,TD),mU=(t,e,n=new Map)=>{P1(t,e.store,n),cc(t,kD(e.store))},gU=(t,e=new Uint8Array([0]),n=new gl)=>{const r=OD(e);mU(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(LU(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===Od)return NU(i.map((s,l)=>l===0?s:jU(s)));if(n.constructor===gl)return bp(i)}return i[0]},yU=(t,e)=>gU(t,e,new Od),bU=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},OD=t=>bU(new ED(ic(t))),_D=(t,e)=>(st(t.restEncoder,e.size),bo(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{st(t.restEncoder,n),st(t.restEncoder,r)}),t),xU=(t,e)=>_D(t,_d(e.store)),vU=(t,e=new MD)=>(t instanceof Map?_D(e,t):xU(e,t),e.toUint8Array()),SU=t=>vU(t,new AD);class wU{constructor(){this.l=[]}}const zT=()=>new wU,LT=(t,e)=>t.l.push(e),IT=(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.")},DD=(t,e,n)=>z1(t.l,[e,n]);class Ra{constructor(e,n){this.client=e,this.clock=n}}const Ea=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Ve=(t,e)=>new Ra(t,e),ad=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw In()},cd=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class ud{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const ol=t=>new ud(t.type==null?null:Ve(t.type.client,t.type.clock),t.tname??null,t.item==null?null:Ve(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class kU{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const CU=(t,e,n=0)=>new kU(t,e,n),ih=(t,e,n)=>{let r=null,i=null;return t._item===null?i=ad(t):r=Ve(t._item.id.client,t._item.id.clock),new ud(r,i,e,n)},L0=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return ih(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return ih(t,Ve(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return ih(t,r.lastId,n);r=r.right}return ih(t,null,n)},EU=(t,e)=>{const n=Na(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},nx=(t,e,n=!0)=>{const r=e.store,i=t.item,s=t.type,l=t.tname,c=t.assoc;let u=null,f=0;if(i!==null){if(Gt(r,i.client)<=i.clock)return null;const h=n?ox(r,i):EU(r,i),m=h.item;if(!(m instanceof Tt))return null;if(u=m.parent,u._item===null||!u._item.deleted){f=m.deleted||!m.countable?0:h.diff+(c>=0?0:1);let g=m.left;for(;g!==null;)!g.deleted&&g.countable&&(f+=g.length),g=g.left}}else{if(l!==null)u=e.get(l);else if(s!==null){if(Gt(r,s.client)<=s.clock)return null;const{item:h}=n?ox(r,s):{item:Na(r,s)};if(h instanceof Tt&&h.content instanceof hi)u=h.content.type;else return null}else throw In();c>=0?f=u._length:f=0}return CU(u,f,t.assoc)},jT=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&Ea(t.item,e.item)&&Ea(t.type,e.type)&&t.assoc===e.assoc;class F1{constructor(e,n){this.ds=e,this.sv=n}}const RD=(t,e)=>new F1(t,e),I0=t=>RD(kD(t.store),_d(t.store)),Yo=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!ac(e.ds,t.id),rx=(t,e)=>{const n=Bi(t.meta,rx,ml),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<Gt(r,s)&&ar(t,Ve(s,i))}),xo(t,e.ds,i=>{}),n.add(e))};class ND{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const _d=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},zD=(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)},ui=(t,e)=>{let n=0,r=t.length-1,i=t[r],s=i.id.clock;if(s===e)return r;let l=ai(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=ai((n+r)/2)}throw In()},TU=(t,e)=>{const n=t.clients.get(e.client);return n[ui(n,e.clock)]},Na=TU,ix=(t,e,n)=>{const r=ui(e,n),i=e[r];return i.id.clock<n&&i instanceof Tt?(e.splice(r+1,0,kp(t,i,n-i.id.clock)),r+1):r},ar=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[ix(t,n,e.clock)]},BT=(t,e,n)=>{const r=e.clients.get(n.client),i=ui(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==Wr&&r.splice(i+1,0,kp(t,s,n.clock-s.id.clock+1)),s},AU=(t,e,n)=>{const r=t.clients.get(e.id.client);r[ui(r,e.id.clock)]=n},LD=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let l=ix(t,e,n),c;do c=e[l++],s<c.id.clock+c.length&&ix(t,e,s),i(c);while(l<e.length&&e[l].id.clock<s)};class MU{constructor(e,n,r){this.doc=e,this.deleteSet=new lc,this.beforeState=_d(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const UT=(t,e)=>e.deleteSet.clients.size===0&&!l6(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:($1(e.deleteSet),fU(t,e),cc(t,e.deleteSet),!0),HT=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Bi(t.changed,e,ml).add(n)},zh=(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 Tt&&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},OU=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const s=e.clients.get(r);for(let l=i.length-1;l>=0;l--){const c=i[l],u=c.clock+c.len;for(let f=ui(s,c.clock),h=s[f];f<s.length&&h.id.clock<u;h=s[++f]){const m=s[f];if(c.clock+c.len<=m.id.clock)break;m instanceof Tt&&m.deleted&&!m.keep&&n(m)&&m.gc(e,!1)}}}},_U=(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=bs(i.length-1,1+ui(i,l.clock+l.len-1));for(let u=c,f=i[u];u>0&&f.id.clock>=l.clock;f=i[u])u-=1+zh(i,u)}})},ID=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,l=n._mergeStructs;try{$1(s),n.afterState=_d(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const c=[];n.changed.forEach((u,f)=>c.push(()=>{(f._item===null||!f._item.deleted)&&f._callObserver(n,u)})),c.push(()=>{n.changedParentTypes.forEach((u,f)=>{f._dEH.l.length>0&&(f._item===null||!f._item.deleted)&&(u=u.filter(h=>h.target._item===null||!h.target._item.deleted),u.forEach(h=>{h.currentTarget=f,h._path=null}),u.sort((h,m)=>h.path.length-m.path.length),c.push(()=>{DD(f._dEH,u,n)}))}),c.push(()=>r.emit("afterTransaction",[n,r])),c.push(()=>{n._needFormattingCleanup&&JU(n)})}),z1(c,[])}finally{r.gc&&OU(s,i,r.gcFilter),_U(s,i),n.afterState.forEach((h,m)=>{const g=n.beforeState.get(m)||0;if(g!==h){const y=i.clients.get(m),v=ci(ui(y,g),1);for(let S=y.length-1;S>=v;)S-=1+zh(y,S)}});for(let h=l.length-1;h>=0;h--){const{client:m,clock:g}=l[h].id,y=i.clients.get(m),v=ui(y,g);v+1<y.length&&zh(y,v+1)>1||v>0&&zh(y,v)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(sU(H1,mD,"[yjs] ",gD,yD,"Changed the client-id because another client seems to be using it."),r.clientID=CD()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const h=new Od;UT(h,n)&&r.emit("update",[h.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const h=new gl;UT(h,n)&&r.emit("updateV2",[h.toUint8Array(),n.origin,r,n])}const{subdocsAdded:c,subdocsLoaded:u,subdocsRemoved:f}=n;(c.size>0||f.size>0||u.size>0)&&(c.forEach(h=>{h.clientID=r.clientID,h.collectionid==null&&(h.collectionid=r.collectionid),r.subdocs.add(h)}),f.forEach(h=>r.subdocs.delete(h)),r.emit("subdocs",[{loaded:u,added:c,removed:f},r,n]),f.forEach(h=>h.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):ID(t,e+1)}}},wt=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,l=null;t._transaction===null&&(s=!0,t._transaction=new MU(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&&ID(i,0)}}return l};class DU{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const $T=(t,e,n)=>{xo(t,n.deletions,r=>{r instanceof Tt&&e.scope.some(i=>i===t.doc||cd(i,r))&&X1(r,!1)})},VT=(t,e,n)=>{let r=null;const i=t.doc,s=t.scope;wt(i,c=>{for(;e.length>0&&t.currStackItem===null;){const u=i.store,f=e.pop(),h=new Set,m=[];let g=!1;xo(c,f.insertions,y=>{if(y instanceof Tt){if(y.redone!==null){let{item:v,diff:S}=ox(u,y.id);S>0&&(v=ar(c,Ve(v.id.client,v.id.clock+S))),y=v}!y.deleted&&s.some(v=>v===c.doc||cd(v,y))&&m.push(y)}}),xo(c,f.deletions,y=>{y instanceof Tt&&s.some(v=>v===c.doc||cd(v,y))&&!ac(f.insertions,y.id)&&h.add(y)}),h.forEach(y=>{g=n2(c,y,h,f.insertions,t.ignoreRemoteMapChanges,t)!==null||g});for(let y=m.length-1;y>=0;y--){const v=m[y];t.deleteFilter(v)&&(v.delete(c),g=!0)}t.currStackItem=g?f:null}c.changed.forEach((u,f)=>{u.has(null)&&f._searchMarker&&(f._searchMarker.length=0)}),r=c},t);const l=t.currStackItem;if(l!=null){const c=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:l,type:n,changedParentTypes:c,origin:t},t]),t.currStackItem=null}return l};class jD extends H_{constructor(e,{captureTimeout:n=500,captureTransaction:r=u=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:l=!1,doc:c=Ya(e)?e[0].doc:e instanceof Li?e:e.doc}={}){super(),this.scope=[],this.doc=c,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=l,this.captureTimeout=n,this.afterTransactionHandler=u=>{if(!this.captureTransaction(u)||!this.scope.some(k=>u.changedParentTypes.has(k)||k===this.doc)||!this.trackedOrigins.has(u.origin)&&(!u.origin||!this.trackedOrigins.has(u.origin.constructor)))return;const f=this.undoing,h=this.redoing,m=f?this.redoStack:this.undoStack;f?this.stopCapturing():h||this.clear(!1,!0);const g=new lc;u.afterState.forEach((k,E)=>{const j=u.beforeState.get(E)||0,L=k-j;L>0&&ld(g,E,j,L)});const y=K6();let v=!1;if(this.lastChange>0&&y-this.lastChange<this.captureTimeout&&m.length>0&&!f&&!h){const k=m[m.length-1];k.deletions=tx([k.deletions,u.deleteSet]),k.insertions=tx([k.insertions,g])}else m.push(new DU(u.deleteSet,g)),v=!0;!f&&!h&&(this.lastChange=y),xo(u,u.deleteSet,k=>{k instanceof Tt&&this.scope.some(E=>E===u.doc||cd(E,k))&&X1(k,!0)});const S=[{stackItem:m[m.length-1],origin:u.origin,type:f?"redo":"undo",changedParentTypes:u.changedParentTypes},this];v?this.emit("stack-item-added",S):this.emit("stack-item-updated",S)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=Ya(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof mn?r.doc!==this.doc:r!==this.doc)&&xD("[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=>$T(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>$T(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=VT(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=VT(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*RU(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 u=Ze(t.restDecoder);yield new Gr(Ve(i,s),u),s+=u}else if((Em&c)!==0){const u=(c&(xs|Kn))===0,f=new Tt(Ve(i,s),null,(c&Kn)===Kn?t.readLeftID():null,null,(c&xs)===xs?t.readRightID():null,u?t.readParentInfo()?t.readString():t.readLeftID():null,u&&(c&nd)===nd?t.readString():null,r2(t,c));yield f,s+=f.length}else{const u=t.readLen();yield new Wr(Ve(i,s),u),s+=u}}}}class q1{constructor(e,n){this.gen=RU(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===Gr);return this.curr}}class K1{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const NU=t=>bp(t,TD,Od),zU=(t,e)=>{if(t.constructor===Wr){const{client:n,clock:r}=t.id;return new Wr(Ve(n,r+e),t.length-e)}else if(t.constructor===Gr){const{client:n,clock:r}=t.id;return new Gr(Ve(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new Tt(Ve(r,i+e),null,Ve(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},bp=(t,e=Xa,n=gl)=>{if(t.length===1)return t[0];const r=t.map(h=>new e(ic(h)));let i=r.map(h=>new q1(h,!0)),s=null;const l=new n,c=new K1(l);for(;i=i.filter(g=>g.curr!==null),i.sort((g,y)=>{if(g.curr.id.client===y.curr.id.client){const v=g.curr.id.clock-y.curr.id.clock;return v===0?g.curr.constructor===y.curr.constructor?0:g.curr.constructor===Gr?1:-1:v}else return y.curr.id.client-g.curr.id.client}),i.length!==0;){const h=i[0],m=h.curr.id.client;if(s!==null){let g=h.curr,y=!1;for(;g!==null&&g.id.clock+g.length<=s.struct.id.clock+s.struct.length&&g.id.client>=s.struct.id.client;)g=h.next(),y=!0;if(g===null||g.id.client!==m||y&&g.id.clock>s.struct.id.clock+s.struct.length)continue;if(m!==s.struct.id.client)to(c,s.struct,s.offset),s={struct:g,offset:0},h.next();else if(s.struct.id.clock+s.struct.length<g.id.clock)if(s.struct.constructor===Gr)s.struct.length=g.id.clock+g.length-s.struct.id.clock;else{to(c,s.struct,s.offset);const v=g.id.clock-s.struct.id.clock-s.struct.length;s={struct:new Gr(Ve(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===Gr?s.struct.length-=v:g=zU(g,v)),s.struct.mergeWith(g)||(to(c,s.struct,s.offset),s={struct:g,offset:0},h.next())}}else s={struct:h.curr,offset:0},h.next();for(let g=h.curr;g!==null&&g.id.client===m&&g.id.clock===s.struct.id.clock+s.struct.length&&g.constructor!==Gr;g=h.next())to(c,s.struct,s.offset),s={struct:g,offset:0}}s!==null&&(to(c,s.struct,s.offset),s=null),Y1(c);const u=r.map(h=>V1(h)),f=tx(u);return cc(l,f),l.toUint8Array()},LU=(t,e,n=Xa,r=gl)=>{const i=OD(e),s=new r,l=new K1(s),c=new n(ic(t)),u=new q1(c,!1);for(;u.curr;){const h=u.curr,m=h.id.client,g=i.get(m)||0;if(u.curr.constructor===Gr){u.next();continue}if(h.id.clock+h.length>g)for(to(l,h,ci(g-h.id.clock,0)),u.next();u.curr&&u.curr.id.client===m;)to(l,u.curr,0),u.next();else for(;u.curr&&u.curr.id.client===m&&u.curr.id.clock+u.curr.length<=g;)u.next()}Y1(l);const f=V1(c);return cc(s,f),s.toUint8Array()},BD=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:li(t.encoder.restEncoder)}),t.encoder.restEncoder=Ad(),t.written=0)},to=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&BD(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++},Y1=t=>{BD(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),Tm(e,r.restEncoder)}},IU=(t,e,n,r)=>{const i=new n(ic(t)),s=new q1(i,!1),l=new r,c=new K1(l);for(let f=s.curr;f!==null;f=s.next())to(c,e(f),0);Y1(c);const u=V1(i);return cc(l,u),l.toUint8Array()},jU=t=>IU(t,n5,Xa,Od),PT="You must not compute changes after the event-handler fired.";class zm{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=BU(this.currentTarget,this.target))}deletes(e){return ac(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw zi(PT);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const s=n._map.get(i);let l,c;if(this.adds(s)){let u=s.left;for(;u!==null&&this.adds(u);)u=u.left;if(this.deletes(s))if(u!==null&&this.deletes(u))l="delete",c=A0(u.content.getContent());else return;else u!==null&&this.deletes(u)?(l="update",c=A0(u.content.getContent())):(l="add",c=void 0)}else if(this.deletes(s))l="delete",c=A0(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 zi(PT);const n=this.target,r=ml(),i=ml(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let c=null;const u=()=>{c&&s.push(c)};for(let f=n._start;f!==null;f=f.right)f.deleted?this.deletes(f)&&!this.adds(f)&&((c===null||c.delete===void 0)&&(u(),c={delete:0}),c.delete+=f.length,i.add(f)):this.adds(f)?((c===null||c.insert===void 0)&&(u(),c={insert:[]}),c.insert=c.insert.concat(f.content.getContent()),r.add(f)):((c===null||c.retain===void 0)&&(u(),c={retain:0}),c.retain+=f.length);c!==null&&c.retain===void 0&&u()}this._changes=e}return e}}const BU=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;n.unshift(r)}e=e._item.parent}return n},Nn=()=>{xD("Invalid access: Add Yjs type to a document before reading data.")},UD=80;let W1=0;class UU{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=W1++}}const HU=t=>{t.timestamp=W1++},HD=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=W1++},$U=(t,e,n)=>{if(t.length>=UD){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return HD(r,e,n),r}else{const r=new UU(e,n);return t.push(r),r}},Lm=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((s,l)=>_h(e-s.index)<_h(e-l.index)?s:l);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,HU(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&&_h(n.index-i)<r.parent.length/UD?(HD(n,r,i),n):$U(t._searchMarker,r,i)},dd=(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=ci(e,i.index+n))}},Im=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;Bi(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;DD(r._eH,n,e)};class mn{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=zT(),this._dEH=zT(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw ei()}clone(){throw ei()}_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){LT(this._eH,e)}observeDeep(e){LT(this._dEH,e)}unobserve(e){IT(this._eH,e)}unobserveDeep(e){IT(this._dEH,e)}toJSON(){}}const $D=(t,e,n)=>{t.doc??Nn(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let s=t._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const l=s.content.getContent();if(l.length<=e)e-=l.length;else{for(let c=e;c<l.length&&r>0;c++)i.push(l[c]),r--;e=0}}s=s.right}return i},VD=t=>{t.doc??Nn();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}n=n.right}return e},PD=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&Yo(r,e)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},fd=(t,e)=>{let n=0,r=t._start;for(t.doc??Nn();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],n++,t)}r=r.right}},FD=(t,e)=>{const n=[];return fd(t,(r,i)=>{n.push(e(r,i,t))}),n},VU=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}}}},qD=(t,e)=>{t.doc??Nn();const n=Lm(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},xp=(t,e,n,r)=>{let i=n;const s=t.doc,l=s.clientID,c=s.store,u=n===null?e._start:n.right;let f=[];const h=()=>{f.length>0&&(i=new Tt(Ve(l,Gt(c,l)),i,i&&i.lastId,u,u&&u.id,e,null,new bl(f)),i.integrate(t,0),f=[])};r.forEach(m=>{if(m===null)f.push(m);else switch(m.constructor){case Number:case Object:case Boolean:case Array:case String:f.push(m);break;default:switch(h(),m.constructor){case Uint8Array:case ArrayBuffer:i=new Tt(Ve(l,Gt(c,l)),i,i&&i.lastId,u,u&&u.id,e,null,new Dd(new Uint8Array(m))),i.integrate(t,0);break;case Li:i=new Tt(Ve(l,Gt(c,l)),i,i&&i.lastId,u,u&&u.id,e,null,new Rd(m)),i.integrate(t,0);break;default:if(m instanceof mn)i=new Tt(Ve(l,Gt(c,l)),i,i&&i.lastId,u,u&&u.id,e,null,new hi(m)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),h()},KD=()=>zi("Length exceeded!"),YD=(t,e,n,r)=>{if(n>e._length)throw KD();if(n===0)return e._searchMarker&&dd(e._searchMarker,n,r.length),xp(t,e,null,r);const i=n,s=Lm(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&&ar(t,Ve(l.id.client,l.id.clock+n));break}n-=l.length}return e._searchMarker&&dd(e._searchMarker,i,r.length),xp(t,e,l,r)},PU=(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 xp(t,e,i,n)},WD=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,l=Lm(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&&ar(t,Ve(c.id.client,c.id.clock+n)),n-=c.length);for(;r>0&&c!==null;)c.deleted||(r<c.length&&ar(t,Ve(c.id.client,c.id.clock+r)),c.delete(t),r-=c.length),c=c.right;if(r>0)throw KD();e._searchMarker&&dd(e._searchMarker,i,-s+r)},vp=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},G1=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,l=s.clientID;let c;if(r==null)c=new bl([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:c=new bl([r]);break;case Uint8Array:c=new Dd(r);break;case Li:c=new Rd(r);break;default:if(r instanceof mn)c=new hi(r);else throw new Error("Unexpected content type")}new Tt(Ve(l,Gt(s.store,l)),i,i&&i.lastId,null,null,e,n,c).integrate(t,0)},Z1=(t,e)=>{t.doc??Nn();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},GD=t=>{const e={};return t.doc??Nn(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},ZD=(t,e)=>{t.doc??Nn();const n=t._map.get(e);return n!==void 0&&!n.deleted},FU=(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&&Yo(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},sh=t=>(t.doc??Nn(),oU(t._map.entries(),e=>!e[1].deleted));class qU extends zm{}class za extends mn{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new za;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new za}clone(){const e=new za;return e.insert(0,this.toArray().map(n=>n instanceof mn?n.clone():n)),e}get length(){return this.doc??Nn(),this._length}_callObserver(e,n){super._callObserver(e,n),Im(this,e,new qU(this,e))}insert(e,n){this.doc!==null?wt(this.doc,r=>{YD(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?wt(this.doc,n=>{PU(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?wt(this.doc,r=>{WD(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return qD(this,e)}toArray(){return VD(this)}slice(e=0,n=this.length){return $D(this,e,n)}toJSON(){return this.map(e=>e instanceof mn?e.toJSON():e)}map(e){return FD(this,e)}forEach(e){fd(this,e)}[Symbol.iterator](){return VU(this)}_write(e){e.writeTypeRef(gH)}}const KU=t=>new za;class YU extends zm{constructor(e,n,r){super(e,n),this.keysChanged=r}}class Qa extends mn{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 Qa}clone(){const e=new Qa;return this.forEach((n,r)=>{e.set(r,n instanceof mn?n.clone():n)}),e}_callObserver(e,n){Im(this,e,new YU(this,e,n))}toJSON(){this.doc??Nn();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof mn?i.toJSON():i}}),e}get size(){return[...sh(this)].length}keys(){return z0(sh(this),e=>e[0])}values(){return z0(sh(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return z0(sh(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Nn(),this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?wt(this.doc,n=>{vp(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?wt(this.doc,r=>{G1(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return Z1(this,e)}has(e){return ZD(this,e)}clear(){this.doc!==null?wt(this.doc,e=>{this.forEach(function(n,r,i){vp(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(yH)}}const WU=t=>new Qa,lo=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&e5(t,e);class sx{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 rn:this.right.deleted||uc(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 FT=(t,e,n)=>{for(;e.right!==null&&n>0;){switch(e.right.content.constructor){case rn:e.right.deleted||uc(e.currentAttributes,e.right.content);break;default:e.right.deleted||(n<e.right.length&&ar(t,Ve(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},oh=(t,e,n,r)=>{const i=new Map,s=r?Lm(e,n):null;if(s){const l=new sx(s.p.left,s.p,s.index,i);return FT(t,l,n-s.index)}else{const l=new sx(null,e._start,0,i);return FT(t,l,n)}},JD=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===rn&&lo(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=t.doc,s=i.clientID;r.forEach((l,c)=>{const u=n.left,f=n.right,h=new Tt(Ve(s,Gt(i.store,s)),u,u&&u.lastId,f,f&&f.id,e,null,new rn(c,l));h.integrate(t,0),n.right=h,n.forward()})},uc=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},XD=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===rn&&lo(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},QD=(t,e,n,r)=>{const i=t.doc,s=i.clientID,l=new Map;for(const c in r){const u=r[c],f=n.currentAttributes.get(c)??null;if(!lo(f,u)){l.set(c,f);const{left:h,right:m}=n;n.right=new Tt(Ve(s,Gt(i.store,s)),h,h&&h.lastId,m,m&&m.id,e,null,new rn(c,u)),n.right.integrate(t,0),n.forward()}}return l},j0=(t,e,n,r,i)=>{n.currentAttributes.forEach((g,y)=>{i[y]===void 0&&(i[y]=null)});const s=t.doc,l=s.clientID;XD(n,i);const c=QD(t,e,n,i),u=r.constructor===String?new di(r):r instanceof mn?new hi(r):new Cl(r);let{left:f,right:h,index:m}=n;e._searchMarker&&dd(e._searchMarker,n.index,u.getLength()),h=new Tt(Ve(l,Gt(s.store,l)),f,f&&f.lastId,h,h&&h.id,e,null,u),h.integrate(t,0),n.right=h,n.index=m,n.forward(),JD(t,e,n,c)},qT=(t,e,n,r,i)=>{const s=t.doc,l=s.clientID;XD(n,i);const c=QD(t,e,n,i);e:for(;n.right!==null&&(r>0||c.size>0&&(n.right.deleted||n.right.content.constructor===rn));){if(!n.right.deleted)switch(n.right.content.constructor){case rn:{const{key:u,value:f}=n.right.content,h=i[u];if(h!==void 0){if(lo(h,f))c.delete(u);else{if(r===0)break e;c.set(u,f)}n.right.delete(t)}else n.currentAttributes.set(u,f);break}default:r<n.right.length&&ar(t,Ve(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let u="";for(;r>0;r--)u+=`
|
|
151
|
+
`;n.right=new Tt(Ve(l,Gt(s.store,l)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new di(u)),n.right.integrate(t,0),n.forward()}JD(t,e,n,c)},e2=(t,e,n,r,i)=>{let s=e;const l=Qr();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===rn){const f=s.content;l.set(f.key,f)}s=s.right}let c=0,u=!1;for(;e!==s;){if(n===e&&(u=!0),!e.deleted){const f=e.content;switch(f.constructor){case rn:{const{key:h,value:m}=f,g=r.get(h)??null;(l.get(h)!==f||g===m)&&(e.delete(t),c++,!u&&(i.get(h)??null)===m&&g!==m&&(g===null?i.delete(h):i.set(h,g))),!u&&!e.deleted&&uc(i,f);break}}}e=e.right}return c},GU=(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===rn){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},ZU=t=>{let e=0;return wt(t.doc,n=>{let r=t._start,i=t._start,s=Qr();const l=Gb(s);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case rn:uc(l,i.content);break;default:e+=e2(n,r,i,s,l),s=Gb(l),r=i;break}i=i.right}}),e},JU=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&&LD(t,n.store.clients.get(r),s,i,l=>{!l.deleted&&l.content.constructor===rn&&l.constructor!==Wr&&e.add(l.parent)})}wt(n,r=>{xo(t,t.deleteSet,i=>{if(i instanceof Wr||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===rn?e.add(s):GU(r,i)});for(const i of e)ZU(i)})},KT=(t,e,n)=>{const r=n,i=Gb(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case hi:case Cl:case di:n<e.right.length&&ar(t,Ve(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&e2(t,s,e.right,i,e.currentAttributes);const l=(e.left||e.right).parent;return l._searchMarker&&dd(l._searchMarker,e.index,-r+n),e};class XU extends zm{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];wt(e,r=>{const i=new Map,s=new Map;let l=this.target._start,c=null;const u={};let f="",h=0,m=0;const g=()=>{if(c!==null){let y=null;switch(c){case"delete":m>0&&(y={delete:m}),m=0;break;case"insert":(typeof f=="object"||f.length>0)&&(y={insert:f},i.size>0&&(y.attributes={},i.forEach((v,S)=>{v!==null&&(y.attributes[S]=v)}))),f="";break;case"retain":h>0&&(y={retain:h},Q6(u)||(y.attributes=J6({},u))),h=0;break}y&&n.push(y),c=null}};for(;l!==null;){switch(l.content.constructor){case hi:case Cl:this.adds(l)?this.deletes(l)||(g(),c="insert",f=l.content.getContent()[0],g()):this.deletes(l)?(c!=="delete"&&(g(),c="delete"),m+=1):l.deleted||(c!=="retain"&&(g(),c="retain"),h+=1);break;case di:this.adds(l)?this.deletes(l)||(c!=="insert"&&(g(),c="insert"),f+=l.content.str):this.deletes(l)?(c!=="delete"&&(g(),c="delete"),m+=l.length):l.deleted||(c!=="retain"&&(g(),c="retain"),h+=l.length);break;case rn:{const{key:y,value:v}=l.content;if(this.adds(l)){if(!this.deletes(l)){const S=i.get(y)??null;lo(S,v)?v!==null&&l.delete(r):(c==="retain"&&g(),lo(v,s.get(y)??null)?delete u[y]:u[y]=v)}}else if(this.deletes(l)){s.set(y,v);const S=i.get(y)??null;lo(S,v)||(c==="retain"&&g(),u[y]=S)}else if(!l.deleted){s.set(y,v);const S=u[y];S!==void 0&&(lo(S,v)?S!==null&&l.delete(r):(c==="retain"&&g(),v===null?delete u[y]:u[y]=v))}l.deleted||(c==="insert"&&g(),uc(i,l.content));break}}l=l.right}for(g();n.length>0;){const y=n[n.length-1];if(y.retain!==void 0&&y.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class vo extends mn{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Nn(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new vo}clone(){const e=new vo;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new XU(this,e,n);Im(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Nn();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===di&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?wt(this.doc,r=>{const i=new sx(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)&&j0(r,this,i,c,l.attributes||{})}else l.retain!==void 0?qT(r,this,i,l.retain,l.attributes||{}):l.delete!==void 0&&KT(r,i,l.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??Nn();const i=[],s=new Map,l=this.doc;let c="",u=this._start;function f(){if(c.length>0){const m={};let g=!1;s.forEach((v,S)=>{g=!0,m[S]=v});const y={insert:c};g&&(y.attributes=m),i.push(y),c=""}}const h=()=>{for(;u!==null;){if(Yo(u,e)||n!==void 0&&Yo(u,n))switch(u.content.constructor){case di:{const m=s.get("ychange");e!==void 0&&!Yo(u,e)?(m===void 0||m.user!==u.id.client||m.type!=="removed")&&(f(),s.set("ychange",r?r("removed",u.id):{type:"removed"})):n!==void 0&&!Yo(u,n)?(m===void 0||m.user!==u.id.client||m.type!=="added")&&(f(),s.set("ychange",r?r("added",u.id):{type:"added"})):m!==void 0&&(f(),s.delete("ychange")),c+=u.content.str;break}case hi:case Cl:{f();const m={insert:u.content.getContent()[0]};if(s.size>0){const g={};m.attributes=g,s.forEach((y,v)=>{g[v]=y})}i.push(m);break}case rn:Yo(u,e)&&(f(),uc(s,u.content));break}u=u.right}f()};return e||n?wt(l,m=>{e&&rx(m,e),n&&rx(m,n),h()},"cleanup"):h(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?wt(i,s=>{const l=oh(s,this,e,!r);r||(r={},l.currentAttributes.forEach((c,u)=>{r[u]=c})),j0(s,this,l,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?wt(i,s=>{const l=oh(s,this,e,!r);j0(s,this,l,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?wt(r,i=>{KT(i,oh(i,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const i=this.doc;i!==null?wt(i,s=>{const l=oh(s,this,e,!1);l.right!==null&&qT(s,this,l,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?wt(this.doc,n=>{vp(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?wt(this.doc,r=>{G1(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return Z1(this,e)}getAttributes(){return GD(this)}_write(e){e.writeTypeRef(bH)}}const QU=t=>new vo;class B0{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Nn()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===_n||n.constructor===yl)&&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 yl extends mn{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 yl}clone(){const e=new yl;return e.insert(0,this.toArray().map(n=>n instanceof mn?n.clone():n)),e}get length(){return this.doc??Nn(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new B0(this,e)}querySelector(e){e=e.toUpperCase();const r=new B0(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),bo(new B0(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Im(this,e,new nH(this,n,e))}toString(){return FD(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),fd(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?wt(this.doc,r=>{YD(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)wt(this.doc,r=>{const i=e&&e instanceof mn?e._item:e;xp(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 zi("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?wt(this.doc,r=>{WD(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return VD(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return qD(this,e)}slice(e=0,n=this.length){return $D(this,e,n)}forEach(e){fd(this,e)}_write(e){e.writeTypeRef(vH)}}const eH=t=>new yl;class _n extends yl{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 _n(this.nodeName)}clone(){const e=new _n(this.nodeName),n=this.getAttributes();return X6(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof mn?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const c in e)r.push(c);r.sort();const i=r.length;for(let c=0;c<i;c++){const u=r[c];n.push(u+'="'+e[u]+'"')}const s=this.nodeName.toLocaleLowerCase(),l=n.length>0?" "+n.join(" "):"";return`<${s}${l}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?wt(this.doc,n=>{vp(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?wt(this.doc,r=>{G1(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return Z1(this,e)}hasAttribute(e){return ZD(this,e)}getAttributes(e){return e?FU(this,e):GD(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 fd(this,l=>{i.appendChild(l.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(xH),e.writeKey(this.nodeName)}}const tH=t=>new _n(t.readKey());class nH extends zm{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 Sp extends Qa{constructor(e){super(),this.hookName=e}_copy(){return new Sp(this.hookName)}clone(){const e=new Sp(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(SH),e.writeKey(this.hookName)}}const rH=t=>new Sp(t.readKey());class Yn extends vo{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(wH)}}const iH=t=>new Yn;class J1{constructor(e,n){this.id=e,this.length=n}get deleted(){throw ei()}mergeWith(e){return!1}write(e,n,r){throw ei()}integrate(e,n){throw ei()}}const sH=0;class Wr extends J1{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),zD(e.doc.store,this)}write(e,n){e.writeInfo(sH),e.writeLen(this.length-n)}getMissing(e,n){return null}}class Dd{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new Dd(this.content)}splice(e){throw ei()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const oH=t=>new Dd(t.readBuf());class hd{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new hd(this.len)}splice(e){const n=new hd(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){ld(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 lH=t=>new hd(t.readLen()),t2=(t,e)=>new Li({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class Rd{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 Rd(t2(this.doc.guid,this.opts))}splice(e){throw ei()}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 aH=t=>new Rd(t2(t.readString(),t.readAny()));class Cl{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Cl(this.embed)}splice(e){throw ei()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const cH=t=>new Cl(t.readJSON());class rn{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new rn(this.key,this.value)}splice(e){throw ei()}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 uH=t=>new rn(t.readKey(),t.readJSON());class wp{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new wp(this.arr)}splice(e){const n=new wp(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 dH=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 wp(n)},fH=hp("node_env")==="development";class bl{constructor(e){this.arr=e,fH&&G_(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new bl(this.arr)}splice(e){const n=new bl(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 hH=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new bl(n)};class di{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new di(this.str)}splice(e){const n=new di(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 pH=t=>new di(t.readString()),mH=[KU,WU,QU,tH,eH,rH,iH],gH=0,yH=1,bH=2,xH=3,vH=4,SH=5,wH=6;class hi{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new hi(this.type._copy())}splice(e){throw ei()}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 kH=t=>new hi(mH[t.readTypeRef()](t)),ox=(t,e)=>{let n=e,r=0,i;do r>0&&(n=Ve(n.client,n.clock+r)),i=Na(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof Tt);return{item:i,diff:r}},X1=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},kp=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new Tt(Ve(r,i+n),e,Ve(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=Ve(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},YT=(t,e)=>M1(t,n=>ac(n.deletions,e)),n2=(t,e,n,r,i,s)=>{const l=t.doc,c=l.store,u=l.clientID,f=e.redone;if(f!==null)return ar(t,f);let h=e.parent._item,m=null,g;if(h!==null&&h.deleted===!0){if(h.redone===null&&(!n.has(h)||n2(t,h,n,r,i,s)===null))return null;for(;h.redone!==null;)h=ar(t,h.redone)}const y=h===null?e.parent:h.content.type;if(e.parentSub===null){for(m=e.left,g=e;m!==null;){let E=m;for(;E!==null&&E.parent._item!==h;)E=E.redone===null?null:ar(t,E.redone);if(E!==null&&E.parent._item===h){m=E;break}m=m.left}for(;g!==null;){let E=g;for(;E!==null&&E.parent._item!==h;)E=E.redone===null?null:ar(t,E.redone);if(E!==null&&E.parent._item===h){g=E;break}g=g.right}}else if(g=null,e.right&&!i){for(m=e;m!==null&&m.right!==null&&(m.right.redone||ac(r,m.right.id)||YT(s.undoStack,m.right.id)||YT(s.redoStack,m.right.id));)for(m=m.right;m.redone;)m=ar(t,m.redone);if(m&&m.right!==null)return null}else m=y._map.get(e.parentSub)||null;const v=Gt(c,u),S=Ve(u,v),k=new Tt(S,m,m&&m.lastId,g,g&&g.id,y,e.parentSub,e.content.copy());return e.redone=S,X1(k,!0),k.integrate(t,0),k};let Tt=class lx extends J1{constructor(e,n,r,i,s,l,c,u){super(e,u.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=l,this.parentSub=c,this.redone=null,this.content=u,this.info=this.content.isCountable()?ST:0}set marker(e){(this.info&O0)>0!==e&&(this.info^=O0)}get marker(){return(this.info&O0)>0}get keep(){return(this.info&vT)>0}set keep(e){this.keep!==e&&(this.info^=vT)}get countable(){return(this.info&ST)>0}get deleted(){return(this.info&M0)>0}set deleted(e){this.deleted!==e&&(this.info^=M0)}markDeleted(){this.info|=M0}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===Ra&&this.id.client!==this.parent.client&&this.parent.clock>=Gt(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=BT(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=ar(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Wr||this.right&&this.right.constructor===Wr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===lx?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===lx&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Ra){const r=Na(n,this.parent);r.constructor===Wr?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=BT(e,e.doc.store,Ve(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),Ea(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(Ea(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&l.has(Na(e.doc.store,i.origin)))s.has(Na(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),zD(e.doc.store,this),this.content.integrate(e,this),HT(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Wr(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:Ve(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Ea(e.origin,this.lastId)&&this.right===e&&Ea(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(),ld(e.deleteSet,this.id.client,this.id.clock,this.length),HT(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw In();this.content.gc(e),n?AU(e,this,new Wr(this.id,this.length)):this.content=new hd(this.length)}write(e,n){const r=n>0?Ve(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,l=this.content.getRef()&Em|(r===null?0:Kn)|(i===null?0:xs)|(s===null?0:nd);if(e.writeInfo(l),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const c=this.parent;if(c._item!==void 0){const u=c._item;if(u===null){const f=ad(c);e.writeParentInfo(!0),e.writeString(f)}else e.writeParentInfo(!1),e.writeLeftID(u.id)}else c.constructor===String?(e.writeParentInfo(!0),e.writeString(c)):c.constructor===Ra?(e.writeParentInfo(!1),e.writeLeftID(c)):In();s!==null&&e.writeString(s)}this.content.write(e,n)}};const r2=(t,e)=>CH[e&Em](t),CH=[()=>{In()},lH,dH,oH,pH,cH,uH,kH,hH,aH,()=>{In()}],EH=10;class Gr extends J1{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(EH),st(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const i2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},s2="__ $YJS$ __";i2[s2]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");i2[s2]=!0;const TH=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},AH=/[\uD800-\uDBFF]/,MH=/[\uDC00-\uDFFF]/,OH=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&AH.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&&MH.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},_H=OH,Lt=new ht("y-sync"),Oi=new ht("y-undo"),lh=new ht("yjs-cursor"),_i=(t,e)=>t>>>e|t<<32-e,DH=t=>_i(t,2)^_i(t,13)^_i(t,22),RH=t=>_i(t,6)^_i(t,11)^_i(t,25),NH=t=>_i(t,7)^_i(t,18)^t>>>3,zH=t=>_i(t,17)^_i(t,19)^t>>>10,LH=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]),IH=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class jH{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(IH),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let m=16;m<64;m++)n[m]=zH(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],u=e[5],f=e[6],h=e[7];for(let m=0,g,y;m<64;m++)g=h+RH(c)+(c&u^~c&f)+LH[m]+n[m]>>>0,y=DH(r)+(r&i^r&s^i&s)>>>0,h=f,f=u,u=c,c=l+g>>>0,l=s,s=i,i=r,r=g+y>>>0;e[0]+=r,e[1]+=i,e[2]+=s,e[3]+=l,e[4]+=c,e[5]+=u,e[6]+=f,e[7]+=h}digest(e){let n=0;for(;n+56<=e.length;){let l=0;for(;l<16&&n+3<e.length;l++)this._W[l]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,l,16);n<e.length;)this._W[l]|=e[n]<<(3-n%4)*8,n++;this._W[l]|=Kn<<(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)]|=Kn<<(3-n%4)*8),this._W[14]=e.byteLength/u6,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 BH=t=>new jH().digest(t),UH=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},HH=t=>d5(UH(BH(h5(t)))),Cp=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!ac(e.ds,t.id),$H=[{light:"#ecd44433",dark:"#ecd444"}],VH=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=ml();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,P6(e))}return t.get(n)},PH=(t,{colors:e=$H,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let l=!1;const c=new qH(t,s),u=new lt({props:{editable:f=>{const h=Lt.getState(f);return h.snapshot==null&&h.prevSnapshot==null}},key:Lt,state:{init:(f,h)=>({type:t,doc:t.doc,binding:c,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(f,h)=>{const m=f.getMeta(Lt);if(m!==void 0){h=Object.assign({},h);for(const g in m)h[g]=m[g]}return h.addToHistory=f.getMeta("addToHistory")!==!1,h.isChangeOrigin=m!==void 0&&!!m.isChangeOrigin,h.isUndoRedoOperation=m!==void 0&&!!m.isChangeOrigin&&!!m.isUndoRedoOperation,c.prosemirrorView!==null&&m!==void 0&&(m.snapshot!=null||m.prevSnapshot!=null)&&U1(0,()=>{c.prosemirrorView!=null&&(m.restore==null?c._renderSnapshot(m.snapshot,m.prevSnapshot,h):(c._renderSnapshot(m.snapshot,m.snapshot,h),delete h.restore,delete h.snapshot,delete h.prevSnapshot,c.mux(()=>{c._prosemirrorChanged(c.prosemirrorView.state.doc)})))}),h}},view:f=>(c.initView(f),s==null&&c._forceRerender(),i(),{update:()=>{const h=u.getState(f.state);if(h.snapshot==null&&h.prevSnapshot==null&&(l||f.state.doc.content.findDiffStart(f.state.doc.type.createAndFill().content)!==null)){if(l=!0,h.addToHistory===!1&&!h.isChangeOrigin){const m=Oi.getState(f.state),g=m&&m.undoManager;g&&g.stopCapturing()}c.mux(()=>{h.doc.transact(m=>{m.meta.set("addToHistory",h.addToHistory),c._prosemirrorChanged(f.state.doc)},Lt)})}},destroy:()=>{c.destroy()}})});return u},FH=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new qn(t.doc));else if(e.type==="node"){const r=La(n.doc,n.type,e.anchor,n.mapping);t.setSelection(Ae.create(t.doc,r))}else{const r=La(n.doc,n.type,e.anchor,n.mapping),i=La(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const s=Se.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(s)}}},ax=(t,e)=>({type:e.selection.jsonID,anchor:Tp(e.selection.anchor,t.type,t.mapping),head:Tp(e.selection.head,t.type,t.mapping)});class qH{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=TH(),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=ax(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()?(J_&&this._domSelectionInView===null&&(U1(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=Md.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=RD(wD(),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=>Lh(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ye(ee.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=>Lh(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ye(ee.from(n),0,0));if(e){const i=bs(ci(e.anchor,0),r.doc.content.size),s=bs(ci(e.head,0),r.doc.content.size);r.setSelection(Se.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=I0(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&In(),i=new Li({gc:!1}),yp(i,n),n=I0(i),yp(i,e),e=I0(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=ui(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=>{xo(l,m,g=>{})});const u=(m,g)=>{const y=m==="added"?c.getUserByClientId(g.client):c.getUserByDeletedId(g);return{user:y,type:m,color:VH(r.colorMapping,r.colors,y)}},f=PD(s,new F1(n.ds,e.sv)).map(m=>!m._item.deleted||Cp(m._item,e)||Cp(m._item,n)?Lh(m,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,u):null).filter(m=>m!==null),h=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ye(ee.from(f),0,0));this.prosemirrorView.dispatch(h.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,u)=>this.mapping.delete(u);xo(n,n.deleteSet,c=>{if(c.constructor===Tt){const u=c.content.type;u&&this.mapping.delete(u)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(c=>o2(c,this.prosemirrorView.state.schema,this)).filter(c=>c!==null);let l=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ye(ee.from(s),0,0));FH(l,this.beforeTransactionSelection,this),l=l.setMeta(Lt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof jD}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&l.scrollIntoView(),this.prosemirrorView.dispatch(l)})}_prosemirrorChanged(e){this.doc.transact(()=>{ux(this.doc,this.type,e,this),this.beforeTransactionSelection=ax(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 o2=(t,e,n,r,i,s)=>{const l=n.mapping.get(t);if(l===void 0){if(t instanceof _n)return Lh(t,e,n,r,i,s);throw ei()}return l},Lh=(t,e,n,r,i,s)=>{const l=[],c=u=>{var f,h;if(u instanceof _n){const m=o2(u,e,n,r,i,s);m!==null&&l.push(m)}else{const m=(h=(f=u._item.right)==null?void 0:f.content)==null?void 0:h.type;m instanceof vo&&!m._item.deleted&&m._item.id.client===m.doc.clientID&&(u.applyDelta([{retain:u.length},...m.toDelta()]),m.doc.transact(y=>{m._item.delete(y)}));const g=KH(u,e,n,r,i,s);g!==null&&g.forEach(y=>{y!==null&&l.push(y)})}};r===void 0||i===void 0?t.toArray().forEach(c):PD(t,new F1(i.ds,r.sv)).forEach(c);try{const u=t.getAttributes(r);r!==void 0&&(Cp(t._item,r)?Cp(t._item,i)||(u.ychange=s?s("added",t._item.id):{type:"added"}):u.ychange=s?s("removed",t._item.id):{type:"removed"});const f=e.node(t.nodeName,u,l);return n.mapping.set(t,f),f}catch{return t.doc.transact(f=>{t._item.delete(f)},Lt),n.mapping.delete(t),null}},KH=(t,e,n,r,i,s)=>{const l=[],c=t.toDelta(r,i,s);try{for(let u=0;u<c.length;u++){const f=c[u];l.push(e.text(f.insert,XH(f.attributes,e)))}}catch{return t.doc.transact(f=>{t._item.delete(f)},Lt),null}return l},YH=(t,e)=>{const n=new Yn,r=t.map(i=>({insert:i.text,attributes:a2(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},WH=(t,e)=>{const n=new _n(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,jm(t).map(r=>cx(r,e))),e.mapping.set(n,t),n},cx=(t,e)=>t instanceof Array?YH(t,e):WH(t,e),WT=t=>typeof t=="object"&&t!==null,Q1=(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||WT(l)&&WT(c)&&Q1(l,c)}return r},jm=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},l2=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&W_(r.attributes||{}).length===e[i].marks.length&&sc(r.attributes,(s,l)=>{var f;const c=ev(l),u=e[i].marks;return Q1(s,(f=u.find(h=>h.type.name===c))==null?void 0:f.attrs)}))},pd=(t,e)=>{if(t instanceof _n&&!(e instanceof Array)&&dx(t,e)){const n=jm(e);return t._length===n.length&&Q1(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>pd(r,n[i]))}return t instanceof Yn&&e instanceof Array&&l2(t,e)},Ep=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),GT=(t,e,n)=>{const r=t.toArray(),i=jm(e),s=i.length,l=r.length,c=bs(l,s);let u=0,f=0,h=!1;for(;u<c;u++){const m=r[u],g=i[u];if(Ep(n.mapping.get(m),g))h=!0;else if(!pd(m,g))break}for(;u+f<c;f++){const m=r[l-f-1],g=i[s-f-1];if(Ep(n.mapping.get(m),g))h=!0;else if(!pd(m,g))break}return{equalityFactor:u+f,foundMappedChild:h}},GH=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof di?e+=n.content.str:n.content instanceof rn&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},ZH=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=GH(t),s=e.map(f=>({insert:f.text,attributes:Object.assign({},r,a2(f.marks,n))})),{insert:l,remove:c,index:u}=_H(i,s.map(f=>f.insert).join(""));t.delete(u,c),t.insert(u,l),t.applyDelta(s.map(f=>({retain:f.insert.length,attributes:f.attributes})))},JH=/(.*)(--[a-zA-Z0-9+/=]{8})$/,ev=t=>{var e;return((e=JH.exec(t))==null?void 0:e[1])??t},XH=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(ev(r),t[r]));return n},a2=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=Bi(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${HH(r.toJSON())}`:r.type.name]=r.attrs}}),n},ux=(t,e,n,r)=>{if(e instanceof _n&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof _n){const m=e.getAttributes(),g=n.attrs;for(const y in g)g[y]!==null?m[y]!==g[y]&&y!=="ychange"&&e.setAttribute(y,g[y]):e.removeAttribute(y);for(const y in m)g[y]===void 0&&e.removeAttribute(y)}const i=jm(n),s=i.length,l=e.toArray(),c=l.length,u=bs(s,c);let f=0,h=0;for(;f<u;f++){const m=l[f],g=i[f];if(!Ep(r.mapping.get(m),g))if(pd(m,g))r.mapping.set(m,g);else break}for(;h+f<u;h++){const m=l[c-h-1],g=i[s-h-1];if(!Ep(r.mapping.get(m),g))if(pd(m,g))r.mapping.set(m,g);else break}t.transact(()=>{for(;c-f-h>0&&s-f-h>0;){const g=l[f],y=i[f],v=l[c-h-1],S=i[s-h-1];if(g instanceof Yn&&y instanceof Array)l2(g,y)||ZH(g,y,r),f+=1;else{let k=g instanceof _n&&dx(g,y),E=v instanceof _n&&dx(v,S);if(k&&E){const j=GT(g,y,r),L=GT(v,S,r);j.foundMappedChild&&!L.foundMappedChild?E=!1:!j.foundMappedChild&&L.foundMappedChild||j.equalityFactor<L.equalityFactor?k=!1:E=!1}k?(ux(t,g,y,r),f+=1):E?(ux(t,v,S,r),h+=1):(r.mapping.delete(e.get(f)),e.delete(f,1),e.insert(f,[cx(y,r)]),f+=1)}}const m=c-f-h;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+h<s){const g=[];for(let y=f;y<s-h;y++)g.push(cx(i[y],r));e.insert(f,g)}},Lt)},dx=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let Tu=null;const QH=()=>{const t=Tu;Tu=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))})},e8=(t,e,n)=>{Tu||(Tu=new Map,U1(0,QH)),Bi(Tu,t,Qr).set(e,n)},Tp=(t,e,n)=>{if(t===0)return L0(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 L0(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 ud(r._item===null?null:r._item.id,r._item===null?ad(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 ud(r._item===null?null:r._item.id,r._item===null?ad(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 t8(r._item.parent,r._item)}return L0(e,e._length,e.length===0?-1:0)},t8=(t,e)=>{let n=null,r=null;return t._item===null?r=ad(t):n=Ve(t._item.id.client,t._item.id.clock),new ud(n,r,e.id)},La=(t,e,n,r)=>{const i=nx(n,t);if(i===null||i.type!==e&&!cd(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,u=0;for(;u<s._length&&u<i.index&&c!==null;){if(!c.deleted){const f=c.content.type;u++,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 u=c._first;for(;u!==null;){const f=u.content.type;if(f===s)break;u.deleted||(f instanceof Yn?l+=f._length:l+=r.get(f).nodeSize),u=u.right}}s=c}return l-1};function n8(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(u=>{const f=l.attributes[u],m={type:ev(u)};return Object.keys(f)&&(m.attrs=f),m})),c});else if(r instanceof _n){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 r8=(t,e,n)=>t!==e,i8=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},c2=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),s8=/^#[0-9a-fA-F]{6}$/,ZT=(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?dt.create(t.doc,[]):(e.getStates().forEach((u,f)=>{if(n(l.clientID,f,u)&&u.cursor!=null){const h=u.user||{};h.color==null?h.color="#ffa500":s8.test(h.color)||console.warn("A user uses an unsupported color format",h),h.name==null&&(h.name=`User: ${f}`);let m=La(l,s.type,ol(u.cursor.anchor),s.binding.mapping),g=La(l,s.type,ol(u.cursor.head),s.binding.mapping);if(m!==null&&g!==null){const y=ci(t.doc.content.size-1,0);m=bs(m,y),g=bs(g,y),c.push(Vt.widget(g,()=>r(h,f),{key:f+"",side:10}));const v=bs(m,g),S=ci(m,g);c.push(Vt.inline(v,S,i(h,f),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),dt.create(t.doc,c))},o8=(t,{awarenessStateFilter:e=r8,cursorBuilder:n=i8,selectionBuilder:r=c2,getSelection:i=l=>l.selection}={},s="cursor")=>new lt({key:lh,state:{init(l,c){return ZT(c,t,e,n,r)},apply(l,c,u,f){const h=Lt.getState(f),m=l.getMeta(lh);return h&&h.isChangeOrigin||m&&m.awarenessUpdated?ZT(f,t,e,n,r):c.map(l.mapping,l.doc)}},props:{decorations:l=>lh.getState(l)},view:l=>{const c=()=>{l.docView&&e8(l,lh,{awarenessUpdated:!0})},u=()=>{const f=Lt.getState(l.state),h=t.getLocalState()||{};if(l.hasFocus()){const m=i(l.state),g=Tp(m.anchor,f.type,f.binding.mapping),y=Tp(m.head,f.type,f.binding.mapping);(h.cursor==null||!jT(ol(h.cursor.anchor),g)||!jT(ol(h.cursor.head),y))&&t.setLocalStateField(s,{anchor:g,head:y})}else h.cursor!=null&&La(f.doc,f.type,ol(h.cursor.anchor),f.binding.mapping)!==null&&t.setLocalStateField(s,null)};return t.on("change",c),l.dom.addEventListener("focusin",u),l.dom.addEventListener("focusout",u),{update:u,destroy:()=>{l.dom.removeEventListener("focusin",u),l.dom.removeEventListener("focusout",u),t.off("change",c),t.setLocalStateField(s,null)}}}}),l8=t=>{var e,n;return((n=(e=Oi.getState(t))==null?void 0:e.undoManager)==null?void 0:n.undo())!=null},a8=t=>{var e,n;return((n=(e=Oi.getState(t))==null?void 0:e.undoManager)==null?void 0:n.redo())!=null},c8=new Set(["paragraph"]),u8=(t,e)=>!(t instanceof Tt)||!(t.content instanceof hi)||!(t.content.type instanceof vo||t.content.type instanceof _n&&e.has(t.content.type.nodeName))||t.content.type._length===0,d8=({protectedNodes:t=c8,trackedOrigins:e=[],undoManager:n=null}={})=>new lt({key:Oi,state:{init:(r,i)=>{const s=Lt.getState(i),l=n||new jD(s.type,{trackedOrigins:new Set([Lt].concat(e)),deleteFilter:c=>u8(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,u=i.undoManager,f=u.undoStack.length>0,h=u.redoStack.length>0;return c?{undoManager:u,prevSel:ax(c,s),hasUndoOps:f,hasRedoOps:h}:f!==i.hasUndoOps||h!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:u.undoStack.length>0,hasRedoOps:u.redoStack.length>0}):i}},view:r=>{const i=Lt.getState(r.state),s=Oi.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:l})=>{const c=i.binding;c&&l.meta.set(c,Oi.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()}}}}),f8=Zn.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),Oi.getState(e).undoManager.undoStack.length===0?!1:n?l8(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),Oi.getState(e).undoManager.redoStack.length===0?!1:n?a8(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=d8(this.options.yUndoOptions),r=n.spec.view;n.spec.view=l=>{const{undoManager:c}=Oi.getState(l.state);c.restore&&(c.restore(),c.restore=()=>{});const u=r?r(l):void 0;return{destroy:()=>{const f=c.trackedOrigins.has(c),h=c._observers;c.restore=()=>{f&&c.trackedOrigins.add(c),c.doc.on("afterTransaction",c.afterTransactionHandler),c._observers=h},u!=null&&u.destroy&&u.destroy()}}};const i={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},s=PH(e,i);return this.editor.options.enableContentCheck&&((t=e.doc)===null||t===void 0||t.on("beforeTransaction",()=>{try{const l=n8(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 lt({key:new ht("filterInvalidContent"),filterTransaction:()=>{var l;return this.storage.isDisabled&&((l=e.doc)===null||l===void 0||l.destroy()),!0}})].filter(Boolean)}}),JT=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n.user})),XT=()=>null,h8=Zn.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:c2,onUpdate:XT}},onCreate(){if(this.options.onUpdate!==XT&&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[o8((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=JT(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=JT(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),p8=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,m8=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,g8=Ni.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[pl({find:p8,type:this.type})]},addPasteRules(){return[yo({find:m8,type:this.type})]}}),y8="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",b8="ελ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",fx="numeric",hx="ascii",px="alpha",Au="asciinumeric",xu="alphanumeric",mx="domain",u2="emoji",x8="scheme",v8="slashscheme",U0="whitespace";function S8(t,e){return t in e||(e[t]=[]),e[t]}function Xo(t,e,n){e[fx]&&(e[Au]=!0,e[xu]=!0),e[hx]&&(e[Au]=!0,e[px]=!0),e[Au]&&(e[xu]=!0),e[px]&&(e[xu]=!0),e[xu]&&(e[mx]=!0),e[u2]&&(e[mx]=!0);for(const r in e){const i=S8(r,n);i.indexOf(t)<0&&i.push(t)}}function w8(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function lr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}lr.groups={};lr.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||lr.groups;let i;return e&&e.j?i=e:(i=new lr(e),n&&r&&Xo(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||lr.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 lr,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new lr,s){if(r)if(l.t&&typeof l.t=="string"){const u=Object.assign(w8(l.t,r),n);Xo(s,u,r)}else n&&Xo(s,n,r);l.t=s}return i.j[t]=l,l}};const Ye=(t,e,n,r,i)=>t.ta(e,n,r,i),Ut=(t,e,n,r,i)=>t.tr(e,n,r,i),QT=(t,e,n,r,i)=>t.ts(e,n,r,i),oe=(t,e,n,r,i)=>t.tt(e,n,r,i),fs="WORD",gx="UWORD",d2="ASCIINUMERICAL",f2="ALPHANUMERICAL",md="LOCALHOST",yx="TLD",bx="UTLD",Ih="SCHEME",Sa="SLASH_SCHEME",tv="NUM",xx="WS",nv="NL",Mu="OPENBRACE",Ou="CLOSEBRACE",Ap="OPENBRACKET",Mp="CLOSEBRACKET",Op="OPENPAREN",_p="CLOSEPAREN",Dp="OPENANGLEBRACKET",Rp="CLOSEANGLEBRACKET",Np="FULLWIDTHLEFTPAREN",zp="FULLWIDTHRIGHTPAREN",Lp="LEFTCORNERBRACKET",Ip="RIGHTCORNERBRACKET",jp="LEFTWHITECORNERBRACKET",Bp="RIGHTWHITECORNERBRACKET",Up="FULLWIDTHLESSTHAN",Hp="FULLWIDTHGREATERTHAN",$p="AMPERSAND",Vp="APOSTROPHE",Pp="ASTERISK",Xs="AT",Fp="BACKSLASH",qp="BACKTICK",Kp="CARET",no="COLON",rv="COMMA",Yp="DOLLAR",wi="DOT",Wp="EQUALS",iv="EXCLAMATION",Fr="HYPHEN",_u="PERCENT",Gp="PIPE",Zp="PLUS",Jp="POUND",Du="QUERY",sv="QUOTE",h2="FULLWIDTHMIDDLEDOT",ov="SEMI",ki="SLASH",Ru="TILDE",Xp="UNDERSCORE",p2="EMOJI",Qp="SYM";var m2=Object.freeze({__proto__:null,ALPHANUMERICAL:f2,AMPERSAND:$p,APOSTROPHE:Vp,ASCIINUMERICAL:d2,ASTERISK:Pp,AT:Xs,BACKSLASH:Fp,BACKTICK:qp,CARET:Kp,CLOSEANGLEBRACKET:Rp,CLOSEBRACE:Ou,CLOSEBRACKET:Mp,CLOSEPAREN:_p,COLON:no,COMMA:rv,DOLLAR:Yp,DOT:wi,EMOJI:p2,EQUALS:Wp,EXCLAMATION:iv,FULLWIDTHGREATERTHAN:Hp,FULLWIDTHLEFTPAREN:Np,FULLWIDTHLESSTHAN:Up,FULLWIDTHMIDDLEDOT:h2,FULLWIDTHRIGHTPAREN:zp,HYPHEN:Fr,LEFTCORNERBRACKET:Lp,LEFTWHITECORNERBRACKET:jp,LOCALHOST:md,NL:nv,NUM:tv,OPENANGLEBRACKET:Dp,OPENBRACE:Mu,OPENBRACKET:Ap,OPENPAREN:Op,PERCENT:_u,PIPE:Gp,PLUS:Zp,POUND:Jp,QUERY:Du,QUOTE:sv,RIGHTCORNERBRACKET:Ip,RIGHTWHITECORNERBRACKET:Bp,SCHEME:Ih,SEMI:ov,SLASH:ki,SLASH_SCHEME:Sa,SYM:Qp,TILDE:Ru,TLD:yx,UNDERSCORE:Xp,UTLD:bx,UWORD:gx,WORD:fs,WS:xx});const us=/[a-z]/,cu=new RegExp("\\p{L}","u"),H0=new RegExp("\\p{Emoji}","u"),ds=/\d/,$0=/\s/,eA="\r",V0=`
|
|
153
|
+
`,k8="️",C8="",P0="";let ah=null,ch=null;function E8(t=[]){const e={};lr.groups=e;const n=new lr;ah==null&&(ah=tA(y8)),ch==null&&(ch=tA(b8)),oe(n,"'",Vp),oe(n,"{",Mu),oe(n,"}",Ou),oe(n,"[",Ap),oe(n,"]",Mp),oe(n,"(",Op),oe(n,")",_p),oe(n,"<",Dp),oe(n,">",Rp),oe(n,"(",Np),oe(n,")",zp),oe(n,"「",Lp),oe(n,"」",Ip),oe(n,"『",jp),oe(n,"』",Bp),oe(n,"<",Up),oe(n,">",Hp),oe(n,"&",$p),oe(n,"*",Pp),oe(n,"@",Xs),oe(n,"`",qp),oe(n,"^",Kp),oe(n,":",no),oe(n,",",rv),oe(n,"$",Yp),oe(n,".",wi),oe(n,"=",Wp),oe(n,"!",iv),oe(n,"-",Fr),oe(n,"%",_u),oe(n,"|",Gp),oe(n,"+",Zp),oe(n,"#",Jp),oe(n,"?",Du),oe(n,'"',sv),oe(n,"/",ki),oe(n,";",ov),oe(n,"~",Ru),oe(n,"_",Xp),oe(n,"\\",Fp),oe(n,"・",h2);const r=Ut(n,ds,tv,{[fx]:!0});Ut(r,ds,r);const i=Ut(r,us,d2,{[Au]:!0}),s=Ut(r,cu,f2,{[xu]:!0}),l=Ut(n,us,fs,{[hx]:!0});Ut(l,ds,i),Ut(l,us,l),Ut(i,ds,i),Ut(i,us,i);const c=Ut(n,cu,gx,{[px]:!0});Ut(c,us),Ut(c,ds,s),Ut(c,cu,c),Ut(s,ds,s),Ut(s,us),Ut(s,cu,s);const u=oe(n,V0,nv,{[U0]:!0}),f=oe(n,eA,xx,{[U0]:!0}),h=Ut(n,$0,xx,{[U0]:!0});oe(n,P0,h),oe(f,V0,u),oe(f,P0,h),Ut(f,$0,h),oe(h,eA),oe(h,V0),Ut(h,$0,h),oe(h,P0,h);const m=Ut(n,H0,p2,{[u2]:!0});oe(m,"#"),Ut(m,H0,m),oe(m,k8,m);const g=oe(m,C8);oe(g,"#"),Ut(g,H0,m);const y=[[us,l],[ds,i]],v=[[us,null],[cu,c],[ds,s]];for(let S=0;S<ah.length;S++)Ys(n,ah[S],yx,fs,y);for(let S=0;S<ch.length;S++)Ys(n,ch[S],bx,gx,v);Xo(yx,{tld:!0,ascii:!0},e),Xo(bx,{utld:!0,alpha:!0},e),Ys(n,"file",Ih,fs,y),Ys(n,"mailto",Ih,fs,y),Ys(n,"http",Sa,fs,y),Ys(n,"https",Sa,fs,y),Ys(n,"ftp",Sa,fs,y),Ys(n,"ftps",Sa,fs,y),Xo(Ih,{scheme:!0,ascii:!0},e),Xo(Sa,{slashscheme:!0,ascii:!0},e),t=t.sort((S,k)=>S[0]>k[0]?1:-1);for(let S=0;S<t.length;S++){const k=t[S][0],j=t[S][1]?{[x8]:!0}:{[v8]:!0};k.indexOf("-")>=0?j[mx]=!0:us.test(k)?ds.test(k)?j[Au]=!0:j[hx]=!0:j[fx]=!0,QT(n,k,k,j)}return QT(n,"localhost",md,{ascii:!0}),n.jd=new lr(Qp),{start:n,tokens:Object.assign({groups:e},m2)}}function g2(t,e){const n=T8(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let s=0,l=0;for(;l<r;){let c=t,u=null,f=0,h=null,m=-1,g=-1;for(;l<r&&(u=c.go(n[l]));)c=u,c.accepts()?(m=0,g=0,h=c):m>=0&&(m+=n[l].length,g++),f+=n[l].length,s+=n[l].length,l++;s-=m,l-=g,f-=m,i.push({t:h.t,v:e.slice(s-f,s),s:s-f,e:s})}return i}function T8(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 Ys(t,e,n,r,i){let s;const l=e.length;for(let c=0;c<l-1;c++){const u=e[c];t.j[u]?s=t.j[u]:(s=new lr(r),s.jr=i.slice(),t.j[u]=s),t=s}return s=new lr(n),s.jr=i.slice(),t.j[e[l-1]]=s,s}function tA(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 gd={defaultProtocol:"http",events:null,format:nA,formatHref:nA,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function lv(t,e=null){let n=Object.assign({},gd);t&&(n=Object.assign(n,t instanceof lv?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}lv.prototype={o:gd,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]:gd[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 nA(t){return t}function y2(t,e){this.t="token",this.v=t,this.tk=e}y2.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=gd.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),l={},c=t.get("className",n,e),u=t.get("target",n,e),f=t.get("rel",n,e),h=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return l.href=r,c&&(l.class=c),u&&(l.target=u),f&&(l.rel=f),h&&Object.assign(l,h),{tagName:i,attributes:l,content:s,eventListeners:m}}};function Bm(t,e){class n extends y2{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 rA=Bm("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),iA=Bm("text"),A8=Bm("nl"),uh=Bm("url",{isLink:!0,toHref(t=gd.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==md&&t[1].t===no}}),Vr=t=>new lr(t);function M8({groups:t}){const e=t.domain.concat([$p,Pp,Xs,Fp,qp,Kp,Yp,Wp,Fr,tv,_u,Gp,Zp,Jp,ki,Qp,Ru,Xp]),n=[Vp,no,rv,wi,iv,_u,Du,sv,ov,Dp,Rp,Mu,Ou,Mp,Ap,Op,_p,Np,zp,Lp,Ip,jp,Bp,Up,Hp],r=[$p,Vp,Pp,Fp,qp,Kp,Yp,Wp,Fr,Mu,Ou,_u,Gp,Zp,Jp,Du,ki,Qp,Ru,Xp],i=Vr(),s=oe(i,Ru);Ye(s,r,s),Ye(s,t.domain,s);const l=Vr(),c=Vr(),u=Vr();Ye(i,t.domain,l),Ye(i,t.scheme,c),Ye(i,t.slashscheme,u),Ye(l,r,s),Ye(l,t.domain,l);const f=oe(l,Xs);oe(s,Xs,f),oe(c,Xs,f),oe(u,Xs,f);const h=oe(s,wi);Ye(h,r,s),Ye(h,t.domain,s);const m=Vr();Ye(f,t.domain,m),Ye(m,t.domain,m);const g=oe(m,wi);Ye(g,t.domain,m);const y=Vr(rA);Ye(g,t.tld,y),Ye(g,t.utld,y),oe(f,md,y);const v=oe(m,Fr);oe(v,Fr,v),Ye(v,t.domain,m),Ye(y,t.domain,m),oe(y,wi,g),oe(y,Fr,v);const S=oe(y,no);Ye(S,t.numeric,rA);const k=oe(l,Fr),E=oe(l,wi);oe(k,Fr,k),Ye(k,t.domain,l),Ye(E,r,s),Ye(E,t.domain,l);const j=Vr(uh);Ye(E,t.tld,j),Ye(E,t.utld,j),Ye(j,t.domain,l),Ye(j,r,s),oe(j,wi,E),oe(j,Fr,k),oe(j,Xs,f);const L=oe(j,no),J=Vr(uh);Ye(L,t.numeric,J);const U=Vr(uh),M=Vr();Ye(U,e,U),Ye(U,n,M),Ye(M,e,U),Ye(M,n,M),oe(j,ki,U),oe(J,ki,U);const N=oe(c,no),G=oe(u,no),K=oe(G,ki),ce=oe(K,ki);Ye(c,t.domain,l),oe(c,wi,E),oe(c,Fr,k),Ye(u,t.domain,l),oe(u,wi,E),oe(u,Fr,k),Ye(N,t.domain,U),oe(N,ki,U),oe(N,Du,U),Ye(ce,t.domain,U),Ye(ce,e,U),oe(ce,ki,U);const ie=[[Mu,Ou],[Ap,Mp],[Op,_p],[Dp,Rp],[Np,zp],[Lp,Ip],[jp,Bp],[Up,Hp]];for(let se=0;se<ie.length;se++){const[xe,pe]=ie[se],H=oe(U,xe);oe(M,xe,H),oe(H,pe,U);const I=Vr(uh);Ye(H,e,I);const Z=Vr();Ye(H,n),Ye(I,e,I),Ye(I,n,Z),Ye(Z,e,I),Ye(Z,n,Z),oe(I,pe,U),oe(Z,pe,U)}return oe(i,md,j),oe(i,nv,A8),{start:i,tokens:m2}}function O8(t,e,n){let r=n.length,i=0,s=[],l=[];for(;i<r;){let c=t,u=null,f=null,h=0,m=null,g=-1;for(;i<r&&!(u=c.go(n[i].t));)l.push(n[i++]);for(;i<r&&(f=u||c.go(n[i].t));)u=null,c=f,c.accepts()?(g=0,m=c):g>=0&&g++,i++,h++;if(g<0)i-=h,i<r&&(l.push(n[i]),i++);else{l.length>0&&(s.push(F0(iA,e,l)),l=[]),i-=g,h-=g;const y=m.t,v=n.slice(i-h,i);s.push(F0(y,e,v))}}return l.length>0&&s.push(F0(iA,e,l)),s}function F0(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 _8=typeof console<"u"&&console&&console.warn||(()=>{}),D8="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Rt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function R8(){return lr.groups={},Rt.scanner=null,Rt.parser=null,Rt.tokenQueue=[],Rt.pluginQueue=[],Rt.customSchemes=[],Rt.initialized=!1,Rt}function sA(t,e=!1){if(Rt.initialized&&_8(`linkifyjs: already initialized - will not register custom scheme "${t}" ${D8}`),!/^[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`);Rt.customSchemes.push([t,e])}function N8(){Rt.scanner=E8(Rt.customSchemes);for(let t=0;t<Rt.tokenQueue.length;t++)Rt.tokenQueue[t][1]({scanner:Rt.scanner});Rt.parser=M8(Rt.scanner.tokens);for(let t=0;t<Rt.pluginQueue.length;t++)Rt.pluginQueue[t][1]({scanner:Rt.scanner,parser:Rt.parser});return Rt.initialized=!0,Rt}function av(t){return Rt.initialized||N8(),O8(Rt.parser.start,t,g2(Rt.scanner.start,t))}av.scan=g2;function b2(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 lv(n),i=av(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 cv="[\0- -\u2029 ]",z8=new RegExp(cv),L8=new RegExp(`${cv}$`),I8=new RegExp(cv,"g");function j8(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function B8(t){return new lt({key:new ht("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=yB(n.doc,[...e]);if(CB(c).forEach(({newRange:f})=>{const h=xB(r.doc,f,y=>y.isTextblock);let m,g;if(h.length>1)m=h[0],g=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(h.length){const y=r.doc.textBetween(f.from,f.to," "," ");if(!L8.test(y))return;m=h[0],g=r.doc.textBetween(m.pos,f.to,void 0," ")}if(m&&g){const y=g.split(z8).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],S=m.pos+g.lastIndexOf(v);if(!v)return!1;const k=av(v).map(E=>E.toObject(t.defaultProtocol));if(!j8(k))return!1;k.filter(E=>E.isLink).map(E=>({...E,from:S+E.start+1,to:S+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=>{T1(E.from,E.to,r.doc).some(j=>j.mark.type===t.type)||l.addMark(E.from,E.to,t.type.create({href:E.href}))})}}),!!l.steps.length)return l}})}function U8(t){return new lt({key:new ht("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let l=r.target;const c=[];for(;l.nodeName!=="DIV";)c.push(l),l=l.parentNode;if(!c.find(g=>g.nodeName==="A"))return!1;const u=U_(e.state,t.type.name),f=r.target,h=(i=f==null?void 0:f.href)!==null&&i!==void 0?i:u.href,m=(s=f==null?void 0:f.target)!==null&&s!==void 0?s:u.target;return f&&h?(window.open(h,m),!0):!1}}})}function H8(t){return new lt({key:new ht("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let c="";r.content.forEach(f=>{c+=f.textContent});const u=b2(c,{defaultProtocol:t.defaultProtocol}).find(f=>f.isLink&&f.value===c);return!c||!u?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}function Fo(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(I8,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const $8=Ni.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"){sA(t);return}sA(t.scheme,t.optionalSlashes)})},onDestroy(){R8()},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)=>!!Fo(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=>!!Fo(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=>!!Fo(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Pt(this.options.HTMLAttributes,t),0]:["a",Pt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Fo(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=>!!Fo(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[yo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=b2(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!Fo(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(B8({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Fo(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(U8({type:this.type})),this.options.linkOnPaste&&t.push(H8({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),V8=Zn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new lt({key:new ht("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,i=[];if(!n)return null;const s=this.editor.isEmpty;return t.descendants((l,c)=>{const u=r>=c&&r<=c+l.nodeSize,f=!l.isLeaf&&Cm(l);if((u||!this.options.showOnlyCurrent)&&f){const h=[this.options.emptyNodeClass];s&&h.push(this.options.emptyEditorClass);const m=Vt.node(c,c+l.nodeSize,{class:h.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:c,hasAnchor:u}):this.options.placeholder});i.push(m)}return this.options.includeChildren}),dt.create(t,i)}}})]}});let vx,Sx;if(typeof WeakMap<"u"){let t=new WeakMap;vx=e=>t.get(e),Sx=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;vx=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Sx=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var $t=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,l=i+1;for(let c=1;s<this.width&&this.map[e+c]==n;c++)s++;for(let c=1;l<this.height&&this.map[e+this.width*c]==n;c++)l++;return{left:r,top:i,right:s,bottom:l}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:l}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:l==this.height)?null:this.map[r+this.width*(n<0?s-1:l)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:l,right:c,top:u,bottom:f}=this.findCell(e);return{left:Math.min(n,l),top:Math.min(i,u),right:Math.max(r,c),bottom:Math.max(s,f)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,l=this.map[s];n[l]||(n[l]=!0,!(i==t.left&&i&&this.map[s-1]==l||r==t.top&&r&&this.map[s-this.width]==l)&&e.push(l))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let l=e+t*this.width;const c=(t+1)*this.width;for(;l<c&&this.map[l]<i;)l++;return l==c?s-1:this.map[l]}i=s}}static get(t){return vx(t)||Sx(t,P8(t))}};function P8(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=F8(t),n=t.childCount,r=[];let i=0,s=null;const l=[];for(let f=0,h=e*n;f<h;f++)r[f]=0;for(let f=0,h=0;f<n;f++){const m=t.child(f);h++;for(let v=0;;v++){for(;i<r.length&&r[i]!=0;)i++;if(v==m.childCount)break;const S=m.child(v),{colspan:k,rowspan:E,colwidth:j}=S.attrs;for(let L=0;L<E;L++){if(L+f>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:h,n:E-L});break}const J=i+L*e;for(let U=0;U<k;U++){r[J+U]==0?r[J+U]=h:(s||(s=[])).push({type:"collision",row:f,pos:h,n:k-U});const M=j&&j[U];if(M){const N=(J+U)%e*2,G=l[N];G==null||G!=M&&l[N+1]==1?(l[N]=M,l[N+1]=1):G==M&&l[N+1]++}}}i+=k,h+=S.nodeSize}const g=(f+1)*e;let y=0;for(;i<g;)r[i++]==0&&y++;y&&(s||(s=[])).push({type:"missing",row:f,n:y}),h++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const c=new $t(e,n,r,s);let u=!1;for(let f=0;!u&&f<l.length;f+=2)l[f]!=null&&l[f+1]<n&&(u=!0);return u&&q8(c,l,t),c}function F8(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let l=0;l<r;l++){const c=t.child(l);for(let u=0;u<c.childCount;u++){const f=c.child(u);l+f.attrs.rowspan>r&&(s+=f.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const c=i.child(l);s+=c.attrs.colspan,c.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function q8(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const l=n.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let c=null;const u=l.attrs;for(let f=0;f<u.colspan;f++){const h=e[(i+f)%t.width*2];h!=null&&(!u.colwidth||u.colwidth[f]!=h)&&((c||(c=K8(u)))[f]=h)}c&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:c})}}function K8(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function jn(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 ro=new ht("selectingCells");function xl(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 Y8(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 pi(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Um(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=xl(e.$head)||W8(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function W8(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 wx(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function G8(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function uv(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function x2(t,e,n){const r=t.node(-1),i=$t.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 vl(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 v2(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 Z8(t,e,n){const r=jn(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var At=class hs extends De{constructor(e,n=e){const r=e.node(-1),i=$t.get(r),s=e.start(-1),l=i.rectBetween(e.pos-s,n.pos-s),c=e.node(0),u=i.cellsInRect(l).filter(h=>h!=n.pos-s);u.unshift(n.pos-s);const f=u.map(h=>{const m=r.nodeAt(h);if(!m)throw new RangeError(`No cell with offset ${h} found`);const g=s+h+1;return new TO(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(wx(r)&&wx(i)&&uv(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?hs.rowSelection(r,i):s&&this.isColSelection()?hs.colSelection(r,i):new hs(r,i)}return Se.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=$t.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},l=[];for(let u=i.top;u<i.bottom;u++){const f=[];for(let h=u*n.width+i.left,m=i.left;m<i.right;m++,h++){const g=n.map[h];if(s[g])continue;s[g]=!0;const y=n.findCell(g);let v=e.nodeAt(g);if(!v)throw new RangeError(`No cell with offset ${g} found`);const S=i.left-y.left,k=y.right-i.right;if(S>0||k>0){let E=v.attrs;if(S>0&&(E=vl(E,0,S)),k>0&&(E=vl(E,E.colspan-k,k)),y.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(y.top<i.top||y.bottom>i.bottom){const E={...v.attrs,rowspan:Math.min(y.bottom,i.bottom)-Math.max(y.top,i.top)};y.top<i.top?v=v.type.createAndFill(E):v=v.type.create(E,v.content)}f.push(v)}l.push(e.child(u).copy(ee.from(f)))}const c=this.isColSelection()&&this.isRowSelection()?e:l;return new ye(ee.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:u}=i[l],f=e.mapping.slice(r);e.replace(f.map(c.pos),f.map(u.pos),l?ye.empty:n)}const s=De.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new ye(ee.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=$t.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=$t.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),u=e.node(0);return l.top<=c.top?(l.top>0&&(e=u.resolve(s+i.map[l.left])),c.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+c.right-1]))):(c.top>0&&(n=u.resolve(s+i.map[c.left])),l.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))),new hs(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=$t.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 hs&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=$t.get(r),s=e.start(-1),l=i.findCell(e.pos-s),c=i.findCell(n.pos-s),u=e.node(0);return l.left<=c.left?(l.left>0&&(e=u.resolve(s+i.map[l.top*i.width])),c.right<i.width&&(n=u.resolve(s+i.map[i.width*(c.top+1)-1]))):(c.left>0&&(n=u.resolve(s+i.map[c.top*i.width])),l.right<i.width&&(e=u.resolve(s+i.map[i.width*(l.top+1)-1]))),new hs(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new hs(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new hs(e.resolve(n),e.resolve(r))}getBookmark(){return new J8(this.$anchorCell.pos,this.$headCell.pos)}};At.prototype.visible=!1;De.jsonID("cell",At);var J8=class S2{constructor(e,n){this.anchor=e,this.head=n}map(e){return new S2(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&&uv(n,r)?new At(n,r):De.near(r,1)}};function X8(t){if(!(t.selection instanceof At))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(Vt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),dt.create(t.doc,e)}function Q8({$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 e$({$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 t$(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,l;if(r instanceof Ae&&(l=r.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=At.create(i,r.from);else if(l=="row"){const c=i.resolve(r.from+1);s=At.rowSelection(c,c)}else if(!n){const c=$t.get(r.node),u=r.from+1,f=u+c.map[c.width*c.height-1];s=At.create(i,u+1,f)}}else r instanceof Se&&Q8(r)?s=Se.create(i,r.from):r instanceof Se&&e$(r)&&(s=Se.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const n$=new ht("fix-tables");function w2(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let l=0,c=0;l<s;l++){const u=e.child(l);for(let f=c,h=Math.min(i,l+3);f<h;f++)if(t.child(f)==u){c=f+1,n+=u.nodeSize;continue e}r(u,n),c<i&&t.child(c).sameMarkup(u)?w2(t.child(c),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function k2(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=r$(t,i,s,n))};return e?e.doc!=t.doc&&w2(e.doc,t.doc,0,r):t.doc.descendants(r),n}function r$(t,e,n,r){const i=$t.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const f=i.problems[u];if(f.type=="collision"){const h=e.nodeAt(f.pos);if(!h)continue;const m=h.attrs;for(let g=0;g<m.rowspan;g++)s[f.row+g]+=f.n;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,vl(m,m.colspan-f.n,f.n))}else if(f.type=="missing")s[f.row]+=f.n;else if(f.type=="overlong_rowspan"){const h=e.nodeAt(f.pos);if(!h)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...h.attrs,rowspan:h.attrs.rowspan-f.n})}else if(f.type=="colwidth mismatch"){const h=e.nodeAt(f.pos);if(!h)continue;r.setNodeMarkup(r.mapping.map(n+1+f.pos),null,{...h.attrs,colwidth:f.colwidth})}else if(f.type=="zero_sized"){const h=r.mapping.map(n);r.delete(h,h+e.nodeSize)}}let l,c;for(let u=0;u<s.length;u++)s[u]&&(l==null&&(l=u),c=u);for(let u=0,f=n+1;u<i.height;u++){const h=e.child(u),m=f+h.nodeSize,g=s[u];if(g>0){let y="cell";h.firstChild&&(y=h.firstChild.type.spec.tableRole);const v=[];for(let k=0;k<g;k++){const E=jn(t.schema)[y].createAndFill();E&&v.push(E)}const S=(u==0||l==u-1)&&c==u?f+1:m-1;r.insert(r.mapping.map(S),v)}f=m}return r.setMeta(n$,{fixTables:!0})}function Ui(t){const e=t.selection,n=Um(t),r=n.node(-1),i=n.start(-1),s=$t.get(r);return{...e instanceof At?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function C2(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;Z8(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let l=0;l<e.height;l++){const c=l*e.width+i;if(i>0&&i<e.width&&e.map[c-1]==e.map[c]){const u=e.map[c],f=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,v2(f.attrs,i-e.colCount(u))),l+=f.attrs.rowspan-1}else{const u=s==null?jn(r.type.schema).cell:r.nodeAt(e.map[c+s]).type,f=e.positionAt(l,i,r);t.insert(t.mapping.map(n+f),u.createAndFill())}}return t}function i$(t,e){if(!pi(t))return!1;if(e){const n=Ui(t);e(C2(t.tr,n,n.left))}return!0}function s$(t,e){if(!pi(t))return!1;if(e){const n=Ui(t);e(C2(t.tr,n,n.right))}return!0}function o$(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let l=0;l<e.height;){const c=l*e.width+i,u=e.map[c],f=n.nodeAt(u),h=f.attrs;if(i>0&&e.map[c-1]==u||i<e.width-1&&e.map[c+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,vl(h,i-e.colCount(u)));else{const m=t.mapping.slice(s).map(r+u);t.delete(m,m+f.nodeSize)}l+=h.rowspan}}function l$(t,e){if(!pi(t))return!1;if(e){const n=Ui(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;o$(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=$t.get(s)}e(r)}return!0}function a$(t,e,n){var r;const i=jn(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 E2(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;a$(e,r,i+c)&&(c=i==0||i==e.height?null:0);for(let f=0,h=e.width*i;f<e.width;f++,h++)if(i>0&&i<e.height&&e.map[h]==e.map[h-e.width]){const m=e.map[h],g=r.nodeAt(m).attrs;t.setNodeMarkup(n+m,null,{...g,rowspan:g.rowspan+1}),f+=g.colspan-1}else{var u;const m=c==null?jn(r.type.schema).cell:(u=r.nodeAt(e.map[h+c*e.width]))===null||u===void 0?void 0:u.type,g=m==null?void 0:m.createAndFill();g&&l.push(g)}return t.insert(s,jn(r.type.schema).row.create(null,l)),t}function c$(t,e){if(!pi(t))return!1;if(e){const n=Ui(t);e(E2(t.tr,n,n.top))}return!0}function u$(t,e){if(!pi(t))return!1;if(e){const n=Ui(t);e(E2(t.tr,n,n.bottom))}return!0}function d$(t,{map:e,table:n,tableStart:r},i){let s=0;for(let f=0;f<i;f++)s+=n.child(f).nodeSize;const l=s+n.child(i).nodeSize,c=t.mapping.maps.length;t.delete(s+r,l+r);const u=new Set;for(let f=0,h=i*e.width;f<e.width;f++,h++){const m=e.map[h];if(!u.has(m)){if(u.add(m),i>0&&m==e.map[h-e.width]){const g=n.nodeAt(m).attrs;t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g,rowspan:g.rowspan-1}),f+=g.colspan-1}else if(i<e.height&&m==e.map[h+e.width]){const g=n.nodeAt(m),y=g.attrs,v=g.type.create({...y,rowspan:g.attrs.rowspan-1},g.content),S=e.positionAt(i+1,f,n);t.insert(t.mapping.slice(c).map(r+S),v),f+=y.colspan-1}}}}function f$(t,e){if(!pi(t))return!1;if(e){const n=Ui(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;d$(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=$t.get(n.table)}e(r)}return!0}function oA(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function h$({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,l=(r.bottom-1)*t+r.left,c=i+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[c]==n[c+1])return!0;s+=t,c+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[l]==n[l+t])return!0;i++,l++}return!1}function lA(t,e){const n=t.selection;if(!(n instanceof At)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Ui(t),{map:i}=r;if(h$(i,r))return!1;if(e){const s=t.tr,l={};let c=ee.empty,u,f;for(let h=r.top;h<r.bottom;h++)for(let m=r.left;m<r.right;m++){const g=i.map[h*i.width+m],y=r.table.nodeAt(g);if(!(l[g]||!y))if(l[g]=!0,u==null)u=g,f=y;else{oA(y)||(c=c.append(y.content));const v=s.mapping.map(g+r.tableStart);s.delete(v,v+y.nodeSize)}}if(u==null||f==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...v2(f.attrs,f.attrs.colspan,r.right-r.left-f.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){const h=u+1+f.content.size,m=oA(f)?u+1:h;s.replaceWith(m+r.tableStart,h+r.tableStart,c)}s.setSelection(new At(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function aA(t,e){const n=jn(t.schema);return p$(({node:r})=>n[r.type.spec.tableRole])(t,e)}function p$(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof At){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var l;if(i=Y8(r.$from),!i)return!1;s=(l=xl(r.$from))===null||l===void 0?void 0:l.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let c=i.attrs;const u=[],f=c.colwidth;c.rowspan>1&&(c={...c,rowspan:1}),c.colspan>1&&(c={...c,colspan:1});const h=Ui(e),m=e.tr;for(let y=0;y<h.right-h.left;y++)u.push(f?{...c,colwidth:f&&f[y]?[f[y]]:null}:c);let g;for(let y=h.top;y<h.bottom;y++){let v=h.map.positionAt(y,h.left,h.table);y==h.top&&(v+=i.nodeSize);for(let S=h.left,k=0;S<h.right;S++,k++)S==h.left&&y==h.top||m.insert(g=m.mapping.map(v+h.tableStart,1),t({node:i,row:y,col:S}).createAndFill(u[k]))}m.setNodeMarkup(s,t({node:i,row:h.top,col:h.left}),u[0]),r instanceof At&&m.setSelection(new At(m.doc.resolve(r.$anchorCell.pos),g?m.doc.resolve(g):void 0)),n(m)}return!0}}function m$(t,e){return function(n,r){if(!pi(n))return!1;const i=Um(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof At?n.selection.forEachCell((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 g$(t){return function(e,n){if(!pi(e))return!1;if(n){const r=jn(e.schema),i=Ui(e),s=e.tr,l=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),c=l.map(u=>i.table.nodeAt(u));for(let u=0;u<l.length;u++)c[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+l[u],r.cell,c[u].attrs);if(s.steps.length===0)for(let u=0;u<l.length;u++)s.setNodeMarkup(i.tableStart+l[u],r.header_cell,c[u].attrs);n(s)}return!0}}function cA(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 yd(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?g$(t):function(n,r){if(!pi(n))return!1;if(r){const i=jn(n.schema),s=Ui(n),l=n.tr,c=cA("row",s,i),u=cA("column",s,i),f=(t==="column"?c:t==="row"&&u)?1:0,h=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?u?i.cell:i.header_cell:t=="row"?c?i.cell:i.header_cell:i.cell;s.map.cellsInRect(h).forEach(g=>{const y=g+s.tableStart,v=l.doc.nodeAt(y);v&&l.setNodeMarkup(y,m,v.attrs)}),r(l)}return!0}}yd("row",{useDeprecatedLogic:!0});yd("column",{useDeprecatedLogic:!0});const y$=yd("cell",{useDeprecatedLogic:!0});function b$(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 uA(t){return function(e,n){if(!pi(e))return!1;const r=b$(Um(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Se.between(i,G8(i))).scrollIntoView())}return!0}}function x$(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 dh(t,e){const n=t.selection;if(!(n instanceof At))return!1;if(e){const r=t.tr,i=jn(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 v$(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,l=i.type.schema,c=[];if(s=="row")for(let u=0;u<e.childCount;u++){let f=e.child(u).content;const h=u?0:Math.max(0,n-1),m=u<e.childCount-1?0:Math.max(0,r-1);(h||m)&&(f=kx(jn(l).row,new ye(f,h,m)).content),c.push(f)}else if(s=="cell"||s=="header_cell")c.push(n||r?kx(jn(l).row,new ye(e,n,r)).content:e);else return null;return S$(l,c)}function S$(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let l=s.childCount-1;l>=0;l--){const{rowspan:c,colspan:u}=s.child(l).attrs;for(let f=i;f<i+c;f++)n[f]=(n[f]||0)+u}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(ee.empty),n[i]<r){const s=jn(t).cell.createAndFill(),l=[];for(let c=n[i];c<r;c++)l.push(s);e[i]=e[i].append(ee.from(l))}return{height:e.length,width:r,rows:e}}function kx(t,e){const n=t.createAndFill();return new Qx(n).replace(0,n.content.size,e).doc}function w$({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],l=[];for(let c=0;c<n.length;c++){const u=n[c],f=[];for(let h=s[c]||0,m=0;h<r;m++){let g=u.child(m%u.childCount);h+g.attrs.colspan>r&&(g=g.type.createChecked(vl(g.attrs,g.attrs.colspan,h+g.attrs.colspan-r),g.content)),f.push(g),h+=g.attrs.colspan;for(let y=1;y<g.attrs.rowspan;y++)s[c+y]=(s[c+y]||0)+g.attrs.colspan}l.push(ee.from(f))}n=l,t=r}if(e!=i){const s=[];for(let l=0,c=0;l<i;l++,c++){const u=[],f=n[c%e];for(let h=0;h<f.childCount;h++){let m=f.child(h);l+m.attrs.rowspan>i&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,i-m.attrs.rowspan)},m.content)),u.push(m)}s.push(ee.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function k$(t,e,n,r,i,s,l){const c=t.doc.type.schema,u=jn(c);let f,h;if(i>e.width)for(let m=0,g=0;m<e.height;m++){const y=n.child(m);g+=y.nodeSize;const v=[];let S;y.lastChild==null||y.lastChild.type==u.cell?S=f||(f=u.cell.createAndFill()):S=h||(h=u.header_cell.createAndFill());for(let k=e.width;k<i;k++)v.push(S);t.insert(t.mapping.slice(l).map(g-1+r),v)}if(s>e.height){const m=[];for(let v=0,S=(e.height-1)*e.width;v<Math.max(e.width,i);v++){const k=v>=e.width?!1:n.nodeAt(e.map[S+v]).type==u.header_cell;m.push(k?h||(h=u.header_cell.createAndFill()):f||(f=u.cell.createAndFill()))}const g=u.row.create(null,ee.from(m)),y=[];for(let v=e.height;v<s;v++)y.push(g);t.insert(t.mapping.slice(l).map(r+n.nodeSize-2),y)}return!!(f||h)}function dA(t,e,n,r,i,s,l,c){if(l==0||l==e.height)return!1;let u=!1;for(let f=i;f<s;f++){const h=l*e.width+f,m=e.map[h];if(e.map[h-e.width]==m){u=!0;const g=n.nodeAt(m),{top:y,left:v}=e.findCell(m);t.setNodeMarkup(t.mapping.slice(c).map(m+r),null,{...g.attrs,rowspan:l-y}),t.insert(t.mapping.slice(c).map(e.positionAt(l,v,n)),g.type.createAndFill({...g.attrs,rowspan:y+g.attrs.rowspan-l})),f+=g.attrs.colspan-1}}return u}function fA(t,e,n,r,i,s,l,c){if(l==0||l==e.width)return!1;let u=!1;for(let f=i;f<s;f++){const h=f*e.width+l,m=e.map[h];if(e.map[h-1]==m){u=!0;const g=n.nodeAt(m),y=e.colCount(m),v=t.mapping.slice(c).map(m+r);t.setNodeMarkup(v,null,vl(g.attrs,l-y,g.attrs.colspan-(l-y))),t.insert(v+g.nodeSize,g.type.createAndFill(vl(g.attrs,0,l-y))),f+=g.attrs.rowspan-1}}return u}function hA(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=$t.get(s);const{top:c,left:u}=r,f=u+i.width,h=c+i.height,m=t.tr;let g=0;function y(){if(s=n?m.doc.nodeAt(n-1):m.doc,!s)throw new Error("No table found");l=$t.get(s),g=m.mapping.maps.length}k$(m,l,s,n,f,h,g)&&y(),dA(m,l,s,n,u,f,c,g)&&y(),dA(m,l,s,n,u,f,h,g)&&y(),fA(m,l,s,n,c,h,u,g)&&y(),fA(m,l,s,n,c,h,f,g)&&y();for(let v=c;v<h;v++){const S=l.positionAt(v,u,s),k=l.positionAt(v,f,s);m.replace(m.mapping.slice(g).map(S+n),m.mapping.slice(g).map(k+n),new ye(i.rows[v-c],0,0))}y(),m.setSelection(new At(m.doc.resolve(n+l.positionAt(c,u,s)),m.doc.resolve(n+l.positionAt(h-1,f-1,s)))),e(m)}const C$=u1({ArrowLeft:fh("horiz",-1),ArrowRight:fh("horiz",1),ArrowUp:fh("vert",-1),ArrowDown:fh("vert",1),"Shift-ArrowLeft":hh("horiz",-1),"Shift-ArrowRight":hh("horiz",1),"Shift-ArrowUp":hh("vert",-1),"Shift-ArrowDown":hh("vert",1),Backspace:dh,"Mod-Backspace":dh,Delete:dh,"Mod-Delete":dh});function jh(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function fh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof At)return jh(n,r,De.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const l=T2(i,t,e);if(l==null)return!1;if(t=="horiz")return jh(n,r,De.near(n.doc.resolve(s.head+e),e));{const c=n.doc.resolve(l),u=x2(c,t,e);let f;return u?f=De.near(u,1):e<0?f=De.near(n.doc.resolve(c.before(-1)),-1):f=De.near(n.doc.resolve(c.after(-1)),1),jh(n,r,f)}}}function hh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let l;if(s instanceof At)l=s;else{const u=T2(i,t,e);if(u==null)return!1;l=new At(n.doc.resolve(u))}const c=x2(l.$headCell,t,e);return c?jh(n,r,new At(l.$anchorCell,c)):!1}}function E$(t,e){const n=t.state.doc,r=xl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new At(r))),!0):!1}function T$(t,e,n){if(!pi(t.state))return!1;let r=v$(n);const i=t.state.selection;if(i instanceof At){r||(r={width:1,height:1,rows:[ee.from(kx(jn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),l=i.$anchorCell.start(-1),c=$t.get(s).rectBetween(i.$anchorCell.pos-l,i.$headCell.pos-l);return r=w$(r,c.right-c.left,c.bottom-c.top),hA(t.state,t.dispatch,l,c,r),!0}else if(r){const s=Um(t.state),l=s.start(-1);return hA(t.state,t.dispatch,l,$t.get(s.node(-1)).findCell(s.pos-l),r),!0}else return!1}function A$(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=pA(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof At)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=xl(t.state.selection.$anchor))!=null&&((n=q0(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,f){let h=q0(t,f);const m=ro.getState(t.state)==null;if(!h||!uv(u,h))if(m)h=u;else return;const g=new At(u,h);if(m||!t.state.selection.eq(g)){const y=t.state.tr.setSelection(g);m&&y.setMeta(ro,u.pos),t.dispatch(y)}}function l(){t.root.removeEventListener("mouseup",l),t.root.removeEventListener("dragstart",l),t.root.removeEventListener("mousemove",c),ro.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(ro,-1))}function c(u){const f=u,h=ro.getState(t.state);let m;if(h!=null)m=t.state.doc.resolve(h);else if(pA(t,f.target)!=r&&(m=q0(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 T2(t,e,n){if(!(t.state.selection instanceof Se))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 pA(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function q0(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&&xl(t.state.doc.resolve(r))||xl(t.state.doc.resolve(i))}var M$=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")),Cx(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,Cx(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Cx(t,e,n,r,i,s){let l=0,c=!0,u=e.firstChild;const f=t.firstChild;if(f){for(let m=0,g=0;m<f.childCount;m++){const{colspan:y,colwidth:v}=f.child(m).attrs;for(let S=0;S<y;S++,g++){const k=i==g?s:v&&v[S],E=k?k+"px":"";if(l+=k||r,k||(c=!1),u)u.style.width!=E&&(u.style.width=E),u=u.nextSibling;else{const j=document.createElement("col");j.style.width=E,e.appendChild(j)}}}for(;u;){var h;const m=u.nextSibling;(h=u.parentNode)===null||h===void 0||h.removeChild(u),u=m}c?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}const Tr=new ht("tableColumnResizing");function O$({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=M$,lastColumnResizable:i=!0}={}){const s=new lt({key:Tr,state:{init(l,c){var u;const f=(u=s.spec)===null||u===void 0||(u=u.props)===null||u===void 0?void 0:u.nodeViews,h=jn(c.schema).table.name;return r&&f&&(f[h]=(m,g)=>new r(m,n,g)),new _$(-1,!1)},apply(l,c){return c.apply(l)}},props:{attributes:l=>{const c=Tr.getState(l);return c&&c.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,c)=>{D$(l,c,t,i)},mouseleave:l=>{R$(l)},mousedown:(l,c)=>{N$(l,c,e,n)}},decorations:l=>{const c=Tr.getState(l);if(c&&c.activeHandle>-1)return B$(l,c.activeHandle)},nodeViews:{}}});return s}var _$=class Bh{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Tr);if(r&&r.setHandle!=null)return new Bh(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Bh(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return wx(e.doc.resolve(i))||(i=-1),new Bh(i,n.dragging)}return n}};function D$(t,e,n,r){if(!t.editable)return;const i=Tr.getState(t.state);if(i&&!i.dragging){const s=L$(e.target);let l=-1;if(s){const{left:c,right:u}=s.getBoundingClientRect();e.clientX-c<=n?l=mA(t,e,"left",n):u-e.clientX<=n&&(l=mA(t,e,"right",n))}if(l!=i.activeHandle){if(!r&&l!==-1){const c=t.state.doc.resolve(l),u=c.node(-1),f=$t.get(u),h=c.start(-1);if(f.colCount(c.pos-h)+c.nodeAfter.attrs.colspan-1==f.width-1)return}A2(t,l)}}}function R$(t){if(!t.editable)return;const e=Tr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&A2(t,-1)}function N$(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=Tr.getState(t.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const c=t.state.doc.nodeAt(l.activeHandle),u=z$(t,l.activeHandle,c.attrs);t.dispatch(t.state.tr.setMeta(Tr,{setDragging:{startX:e.clientX,startWidth:u}}));function f(m){s.removeEventListener("mouseup",f),s.removeEventListener("mousemove",h);const g=Tr.getState(t.state);g!=null&&g.dragging&&(I$(t,g.activeHandle,gA(g.dragging,m,n)),t.dispatch(t.state.tr.setMeta(Tr,{setDragging:null})))}function h(m){if(!m.which)return f(m);const g=Tr.getState(t.state);if(g&&g.dragging){const y=gA(g.dragging,m,n);yA(t,g.activeHandle,y,r)}}return yA(t,l.activeHandle,u,r),s.addEventListener("mouseup",f),s.addEventListener("mousemove",h),e.preventDefault(),!0}function z$(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,c=n;if(r)for(let u=0;u<n;u++)r[u]&&(l-=r[u],c--);return l/c}function L$(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function mA(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=xl(t.state.doc.resolve(l));if(!c)return-1;if(n=="right")return c.pos;const u=$t.get(c.node(-1)),f=c.start(-1),h=u.map.indexOf(c.pos-f);return h%u.width==0?-1:f+u.map[h-1]}function gA(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function A2(t,e){t.dispatch(t.state.tr.setMeta(Tr,{setHandle:e}))}function I$(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=$t.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let f=0;f<s.height;f++){const h=f*s.width+c;if(f&&s.map[h]==s.map[h-s.width])continue;const m=s.map[h],g=i.nodeAt(m).attrs,y=g.colspan==1?0:c-s.colCount(m);if(g.colwidth&&g.colwidth[y]==n)continue;const v=g.colwidth?g.colwidth.slice():j$(g.colspan);v[y]=n,u.setNodeMarkup(l+m,null,{...g,colwidth:v})}u.docChanged&&t.dispatch(u)}function yA(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),l=i.start(-1),c=$t.get(s).colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&Cx(s,u.firstChild,u,r,c,n)}function j$(t){return Array(t).fill(0)}function B$(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return dt.empty;const s=$t.get(i),l=r.start(-1),c=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1;for(let f=0;f<s.height;f++){const h=c+f*s.width;if((c==s.width-1||s.map[h]!=s.map[h+1])&&(f==0||s.map[h]!=s.map[h-s.width])){var u;const m=s.map[h],g=l+m+i.nodeAt(m).nodeSize-1,y=document.createElement("div");y.className="column-resize-handle",!((u=Tr.getState(t))===null||u===void 0)&&u.dragging&&n.push(Vt.node(l+m,l+m+i.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),n.push(Vt.widget(g,y))}}return dt.create(t.doc,n)}function U$({allowTableNodeSelection:t=!1}={}){return new lt({key:ro,state:{init(){return null},apply(e,n){const r=e.getMeta(ro);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:X8,handleDOMEvents:{mousedown:A$},createSelectionBetween(e){return ro.getState(e.state)!=null?e.state.selection:null},handleTripleClick:E$,handleKeyDown:C$,handlePaste:T$},appendTransaction(e,n,r){return t$(r,k2(r,n),t)}})}function Ex(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function bA(t,e,n,r,i,s){var l;let c=0,u=!0,f=e.firstChild;const h=t.firstChild;if(h!==null)for(let m=0,g=0;m<h.childCount;m+=1){const{colspan:y,colwidth:v}=h.child(m).attrs;for(let S=0;S<y;S+=1,g+=1){const k=i===g?s:v&&v[S],E=k?`${k}px`:"";if(c+=k||r,k||(u=!1),f){if(f.style.width!==E){const[j,L]=Ex(r,k);f.style.setProperty(j,L)}f=f.nextSibling}else{const j=document.createElement("col"),[L,J]=Ex(r,k);j.style.setProperty(L,J),e.appendChild(j)}}}for(;f;){const m=f.nextSibling;(l=f.parentNode)===null||l===void 0||l.removeChild(f),f=m}u?(n.style.width=`${c}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${c}px`)}class H${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")),bA(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,bA(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function $$(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:y,colwidth:v}=c.child(m).attrs;for(let S=0;S<y;S+=1,g+=1){const k=n===g?r:v&&v[S];i+=k||e,k||(s=!1);const[E,j]=Ex(e,k);l.push(["col",{style:`${E}: ${j}`}])}}const u=s?`${i}px`:"",f=s?"":`${i}px`;return{colgroup:["colgroup",{},...l],tableWidth:u,tableMinWidth:f}}function xA(t,e){return t.createAndFill()}function V$(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 P$(t,e,n,r,i){const s=V$(t),l=[],c=[];for(let f=0;f<n;f+=1){const h=xA(s.cell);if(h&&c.push(h),r){const m=xA(s.header_cell);m&&l.push(m)}}const u=[];for(let f=0;f<e;f+=1)u.push(s.row.createChecked(null,r&&f===0?l:c));return s.table.createChecked(null,u)}function F$(t){return t instanceof At}const ph=({editor:t})=>{const{selection:e}=t.state;if(!F$(e))return!1;let n=0;const r=B_(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},q$=bn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:H$,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}=$$(t,this.options.cellMinWidth),s=["table",Pt(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const l=P$(s.schema,t,e,n);if(i){const c=r.selection.from+1;r.replaceSelectionWith(l).scrollIntoView().setSelection(Se.near(r.doc.resolve(c)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>i$(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>s$(t,e),deleteColumn:()=>({state:t,dispatch:e})=>l$(t,e),addRowBefore:()=>({state:t,dispatch:e})=>c$(t,e),addRowAfter:()=>({state:t,dispatch:e})=>u$(t,e),deleteRow:()=>({state:t,dispatch:e})=>f$(t,e),deleteTable:()=>({state:t,dispatch:e})=>x$(t,e),mergeCells:()=>({state:t,dispatch:e})=>lA(t,e),splitCell:()=>({state:t,dispatch:e})=>aA(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>yd("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>yd("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>y$(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>lA(t,e)?!0:aA(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>m$(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>uA(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>uA(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&k2(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=At.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:ph,"Mod-Backspace":ph,Delete:ph,"Mod-Delete":ph}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[O$({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],U$({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:We(we(t,"tableRole",e))}}}),K$=bn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Pt(this.options.HTMLAttributes,t),0]}}),Y$=bn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Pt(this.options.HTMLAttributes,t),0]}}),W$=bn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Pt(this.options.HTMLAttributes,t),0]}});var G$=LM();const Z$=um(G$);function J$(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var M2={exports:{}},K0={};/**
|
|
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 vA;function X$(){if(vA)return K0;vA=1;var t=pn;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 y=g(),v=r({inst:{value:y,getSnapshot:g}}),S=v[0].inst,k=v[1];return s(function(){S.value=y,S.getSnapshot=g,u(S)&&k({inst:S})},[m,y,g]),i(function(){return u(S)&&k({inst:S}),m(function(){u(S)&&k({inst:S})})},[m]),l(y),y}function u(m){var g=m.getSnapshot;m=m.value;try{var y=g();return!n(m,y)}catch{return!0}}function f(m,g){return g()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return K0.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,K0}M2.exports=X$();var dv=M2.exports;const Q$=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},eV=({contentComponent:t})=>{const e=dv.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return pn.createElement(pn.Fragment,null,Object.values(e))};function tV(){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]:Z$.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 nV extends pn.Component{constructor(e){var n;super(e),this.editorContentRef=pn.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=tV(),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 pn.createElement(pn.Fragment,null,pn.createElement("div",{ref:Q$(n,this.editorContentRef),...r}),(e==null?void 0:e.contentComponent)&&pn.createElement(eV,{contentComponent:e.contentComponent}))}}const rV=_.forwardRef((t,e)=>{const n=pn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return pn.createElement(nV,{key:n,innerRef:e,...t})}),iV=pn.memo(rV);var sV=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=J$(sV),O2={exports:{}},Y0={};/**
|
|
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 SA;function lV(){if(SA)return Y0;SA=1;var t=pn,e=dv;function n(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,l=t.useEffect,c=t.useMemo,u=t.useDebugValue;return Y0.useSyncExternalStoreWithSelector=function(f,h,m,g,y){var v=s(null);if(v.current===null){var S={hasValue:!1,value:null};v.current=S}else S=v.current;v=c(function(){function E(M){if(!j){if(j=!0,L=M,M=g(M),y!==void 0&&S.hasValue){var N=S.value;if(y(N,M))return J=N}return J=M}if(N=J,r(L,M))return N;var G=g(M);return y!==void 0&&y(N,G)?N:(L=M,J=G)}var j=!1,L,J,U=m===void 0?null:m;return[function(){return E(h())},U===null?void 0:function(){return E(U())}]},[h,m,g,y]);var k=i(f,v[0],v[1]);return l(function(){S.hasValue=!0,S.value=k},[k]),u(k),k},Y0}O2.exports=lV();var aV=O2.exports;const cV=typeof window<"u"?_.useLayoutEffect:_.useEffect;class uV{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 dV(t){var e;const[n]=_.useState(()=>new uV(t.editor)),r=aV.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:oV);return cV(()=>n.watch(t.editor),[t.editor,n]),_.useDebugValue(r),r}const fV=!1,Tx=typeof window>"u",hV=Tx||!!(typeof window<"u"&&window.next);class fv{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?Tx||hV?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 r6(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?fv.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 pV(t={},e=[]){const n=_.useRef(t);n.current=t;const[r]=_.useState(()=>new fv(n)),i=dv.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return _.useDebugValue(i),_.useEffect(r.onRender(e)),dV({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&s===0?0:s+1}),i}const mV=_.createContext({editor:null});mV.Consumer;const gV=_.createContext({onDragStart:void 0}),yV=()=>_.useContext(gV);pn.forwardRef((t,e)=>{const{onDragStart:n}=yV(),r=t.as||"div";return pn.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});const bV=/^\s*>\s$/,xV=bn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[td({find:bV,type:this.type})]}}),vV=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,SV=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,wV=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,kV=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,CV=Ni.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[pl({find:vV,type:this.type}),pl({find:wV,type:this.type})]},addPasteRules(){return[yo({find:SV,type:this.type}),yo({find:kV,type:this.type})]}}),EV="listItem",wA="textStyle",kA=/^\s*([-+*])\s$/,TV=bn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(EV,this.editor.getAttributes(wA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=td({find:kA,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=td({find:kA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(wA),editor:this.editor})),[t]}}),AV=/(^|[^`])`([^`]+)`(?!`)/,MV=/(^|[^`])`([^`]+)`(?!`)/g,OV=Ni.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[pl({find:AV,type:this.type})]},addPasteRules(){return[yo({find:MV,type:this.type})]}}),_V=/^```([a-z]+)?[\s\n]$/,DV=/^~~~([a-z]+)?[\s\n]$/,RV=bn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,s=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(l=>l.startsWith(n)).map(l=>l.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Pt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,l=r.parent.textContent.endsWith(`
|
|
173
|
+
|
|
174
|
+
`);return!s||!l?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const c=i.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:f})=>(f.setSelection(De.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[Wb({find:_V,type:this.type,getAttributes:t=>({language:t[1]})}),Wb({find:DV,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new lt({key:new ht("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i==null?void 0:i.mode;if(!n||!s)return!1;const{tr:l,schema:c}=t.state,u=c.text(n.replace(/\r\n?/g,`
|
|
175
|
+
`));return l.replaceSelectionWith(this.type.create({language:s},u)),l.selection.$from.parent.type!==this.type&&l.setSelection(Se.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),NV=bn.create({name:"doc",topNode:!0,content:"block+"});function zV(t={}){return new lt({view(e){return new LV(e,t)}})}class LV{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 y=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(y){let v=y.getBoundingClientRect(),S=m?v.bottom:v.top;m&&g&&(S=(S+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let k=this.width/2*c;r={left:v.left,right:v.right,top:S-k,bottom:S+k}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),g=this.width/2*l;r={left:m.left-g,right:m.left+g,top:m.top,bottom:m.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let f,h;if(!u||u==document.body&&getComputedStyle(u).position=="static")f=-pageXOffset,h=-pageYOffset;else{let m=u.getBoundingClientRect(),g=m.width/u.offsetWidth,y=m.height/u.offsetHeight;f=m.left-u.scrollLeft*g,h=m.top-u.scrollTop*y}this.element.style.left=(r.left-f)/l+"px",this.element.style.top=(r.top-h)/c+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=SO(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 IV=Zn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[zV(this.options)]}});class Ht extends De{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Ht.valid(r)?new Ht(r):De.near(r)}content(){return 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 hv(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!jV(e)||!BV(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 u=e.doc.resolve(i);if(Ht.valid(u))return u}for(;;){let l=n>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!Ae.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;De.jsonID("gapcursor",Ht);class hv{constructor(e){this.pos=e}map(e){return new hv(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ht.valid(n)?new Ht(n):De.near(n)}}function _2(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function jV(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||_2(i.type))return!0;if(i.inlineContent)return!1}}return!0}function BV(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||_2(i.type))return!0;if(i.inlineContent)return!1}}return!0}function UV(){return new lt({props:{decorations:PV,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ht.valid(n)?new Ht(n):null},handleClick:$V,handleKeyDown:HV,handleDOMEvents:{beforeinput:VV}}})}const HV=u1({ArrowLeft:mh("horiz",-1),ArrowRight:mh("horiz",1),ArrowUp:mh("vert",-1),ArrowDown:mh("vert",1)});function mh(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let l=r.selection,c=e>0?l.$to:l.$from,u=l.empty;if(l instanceof Se){if(!s.endOfTextblock(n)||c.depth==0)return!1;u=!1,c=r.doc.resolve(e>0?c.after():c.before())}let f=Ht.findGapCursorFrom(c,e,u);return f?(i&&i(r.tr.setSelection(new Ht(f))),!0):!1}}function $V(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&&Ae.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ht(r))),!0)}function VV(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=ee.empty;for(let l=r.length-1;l>=0;l--)i=ee.from(r[l].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new ye(i,0,0));return s.setSelection(Se.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function PV(t){if(!(t.selection instanceof Ht))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",dt.create(t.doc,[Vt.widget(t.selection.head,e,{key:"gapcursor"})])}const FV=Zn.create({name:"gapCursor",addProseMirrorPlugins(){return[UV()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=We(we(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),qV=bn.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Pt(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
176
|
+
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:c}=r.extensionManager,u=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:f,dispatch:h})=>{if(h&&u&&l){const m=u.filter(g=>c.includes(g.type.name));f.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),KV=bn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Pt(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Wb({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var em=200,gn=function(){};gn.prototype.append=function(e){return e.length?(e=gn.from(e),!this.length&&e||e.length<em&&this.leafAppend(e)||this.length<em&&e.leafPrepend(this)||this.appendInner(e)):this};gn.prototype.prepend=function(e){return e.length?gn.from(e).append(this):this};gn.prototype.appendInner=function(e){return new YV(this,e)};gn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?gn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};gn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};gn.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)};gn.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};gn.from=function(e){return e instanceof gn?e:e&&e.length?new D2(e):gn.empty};var D2=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,l,c){for(var u=s;u<l;u++)if(i(this.values[u],c+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,l,c){for(var u=s-1;u>=l;u--)if(i(this.values[u],c+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=em)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=em)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})(gn);gn.empty=new D2([]);var YV=(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})(gn);const WV=500;class oi{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let l=e.tr,c,u,f=[],h=[];return this.items.forEach((m,g)=>{if(!m.step){i||(i=this.remapping(r,g+1),s=i.maps.length),s--,h.push(m);return}if(i){h.push(new Ci(m.map));let y=m.step.map(i.slice(s)),v;y&&l.maybeStep(y).doc&&(v=l.mapping.maps[l.mapping.maps.length-1],f.push(new Ci(v,void 0,void 0,f.length+h.length))),s--,v&&i.appendMap(v,s)}else l.maybeStep(m.step);if(m.selection)return c=i?m.selection.map(i.slice(s)):m.selection,u=new oi(this.items.slice(0,r).append(h.reverse().concat(f)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:c}}addTransform(e,n,r,i){let s=[],l=this.eventCount,c=this.items,u=!i&&c.length?c.get(c.length-1):null;for(let h=0;h<e.steps.length;h++){let m=e.steps[h].invert(e.docs[h]),g=new Ci(e.mapping.maps[h],m,n),y;(y=u&&u.merge(g))&&(g=y,h?s.pop():c=c.slice(0,c.length-1)),s.push(g),n&&(l++,n=void 0),i||(u=g)}let f=l-r.depth;return f>ZV&&(c=GV(c,f),l-=f),new oi(c.append(s),l)}remapping(e,n){let r=new Wu;return this.items.forEach((i,s)=>{let l=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,l)},e,n),r}addMaps(e){return this.eventCount==0?this:new oi(this.items.append(e.map(n=>new Ci(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,l=e.steps.length,c=this.eventCount;this.items.forEach(g=>{g.selection&&c--},i);let u=n;this.items.forEach(g=>{let y=s.getMirror(--u);if(y==null)return;l=Math.min(l,y);let v=s.maps[y];if(g.step){let S=e.steps[y].invert(e.docs[y]),k=g.selection&&g.selection.map(s.slice(u+1,y));k&&c++,r.push(new Ci(v,S,k))}else r.push(new Ci(v))},i);let f=[];for(let g=n;g<l;g++)f.push(new Ci(s.maps[g]));let h=this.items.slice(0,i).append(f).append(r),m=new oi(h,c);return m.emptyItemCount()>WV&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((l,c)=>{if(c>=e)i.push(l),l.selection&&s++;else if(l.step){let u=l.step.map(n.slice(r)),f=u&&u.getMap();if(r--,f&&n.appendMap(f,r),u){let h=l.selection&&l.selection.map(n.slice(r));h&&s++;let m=new Ci(f.invert(),u,h),g,y=i.length-1;(g=i.length&&i[y].merge(m))?i[y]=g:i.push(m)}}else l.map&&r--},this.items.length,0),new oi(gn.from(i.reverse()),s)}}oi.empty=new oi(gn.empty,0);function GV(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Ci{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 Ci(n.getMap().invert(),n,this.selection)}}}class Qs{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const ZV=20;function JV(t,e,n,r){let i=n.getMeta(ll),s;if(i)return i.historyState;n.getMeta(eP)&&(t=new Qs(t.done,t.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(l&&l.getMeta(ll))return l.getMeta(ll).redo?new Qs(t.done.addTransform(n,void 0,r,Uh(e)),t.undone,CA(n.mapping.maps),t.prevTime,t.prevComposition):new Qs(t.done,t.undone.addTransform(n,void 0,r,Uh(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),u=t.prevTime==0||!l&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!XV(n,t.prevRanges)),f=l?W0(t.prevRanges,n.mapping):CA(n.mapping.maps);return new Qs(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,Uh(e)),oi.empty,f,n.time,c??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Qs(t.done.rebased(n,s),t.undone.rebased(n,s),W0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Qs(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),W0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function XV(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 CA(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 W0(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 QV(t,e,n){let r=Uh(e),i=ll.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),c=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),u=new Qs(n?c:s.remaining,n?s.remaining:c,null,0,-1);return s.transform.setSelection(l).setMeta(ll,{redo:n,historyState:u})}let G0=!1,EA=null;function Uh(t){let e=t.plugins;if(EA!=e){G0=!1,EA=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){G0=!0;break}}return G0}const ll=new ht("history"),eP=new ht("closeHistory");function tP(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new lt({key:ll,state:{init(){return new Qs(oi.empty,oi.empty,null,0,-1)},apply(e,n,r){return JV(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?N2:r=="historyRedo"?z2:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function R2(t,e){return(n,r)=>{let i=ll.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=QV(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const N2=R2(!1,!0),z2=R2(!0,!0),nP=Zn.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>N2(t,e),redo:()=>({state:t,dispatch:e})=>z2(t,e)}},addProseMirrorPlugins(){return[tP(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()}}}),rP=bn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Pt(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!s6(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}):TB(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:l,dispatch:c})=>{var u;if(c){const{$to:f}=l.selection,h=f.end();if(f.nodeAfter)f.nodeAfter.isTextblock?l.setSelection(Se.create(l.doc,f.pos+1)):f.nodeAfter.isBlock?l.setSelection(Ae.create(l.doc,f.pos)):l.setSelection(Se.create(l.doc,f.pos));else{const m=(u=f.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();m&&(l.insert(h,m),l.setSelection(Se.create(l.doc,h+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[i6({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),iP=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,sP=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,oP=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,lP=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,aP=Ni.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[pl({find:iP,type:this.type}),pl({find:oP,type:this.type})]},addPasteRules(){return[yo({find:sP,type:this.type}),yo({find:lP,type:this.type})]}}),cP=bn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Pt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),uP="listItem",TA="textStyle",AA=/^(\d+)\.\s$/,dP=bn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Pt(this.options.HTMLAttributes,n),0]:["ol",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(uP,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=td({find:AA,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=td({find:AA,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]}}),fP=bn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),hP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,pP=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,mP=Ni.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Pt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[pl({find:hP,type:this.type})]},addPasteRules(){return[yo({find:pP,type:this.type})]}}),gP=bn.create({name:"text",group:"inline"}),yP=Zn.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(CV.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(xV.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(TV.configure(this.options.bulletList)),this.options.code!==!1&&t.push(OV.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(RV.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(NV.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(IV.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(FV.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(qV.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(KV.configure(this.options.heading)),this.options.history!==!1&&t.push(nP.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(rP.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(aP.configure(this.options.italic)),this.options.listItem!==!1&&t.push(cP.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(dP.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(fP.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(mP.configure(this.options.strike)),this.options.text!==!1&&t.push(gP.configure(this.options.text)),t}});function L2(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 bP{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,l=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([c,u])=>[c,(...h)=>{const m=u(...h)(l);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),m}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c=[],u=!!e,f=e||s.tr,h=()=>(!u&&n&&!f.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(f),c.every(g=>g===!0)),m={...Object.fromEntries(Object.entries(r).map(([g,y])=>[g,(...S)=>{const k=this.buildProps(f,n),E=y(...S)(k);return c.push(E),m}])),run:h};return m}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,l=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([u,f])=>[u,(...h)=>f(...h)({...l,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:l}=i,c={tr:e,editor:i,view:l,state:L2({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([u,f])=>[u,(...h)=>f(...h)(c)]))}};return c}}function Qo(t,e,n){return t.config[e]===void 0&&t.parent?Qo(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Qo(t.parent,e,n):null}):t.config[e]}function xP(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 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 vP(t){return typeof t=="function"}function vu(t,e=void 0,...n){return vP(t)?e?t.bind(e)(...n):t(...n):t}function SP(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function wP(t){return Object.prototype.toString.call(t).slice(8,-1)}function gh(t){return wP(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function I2(t,e){const n={...t};return gh(t)&&gh(e)&&Object.keys(e).forEach(r=>{gh(e[r])&&gh(t[r])?n[r]=I2(t[r],e[r]):n[r]=e[r]}),n}class dr{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=vu(Qo(this,"addOptions",{name:this.name}))),this.storage=vu(Qo(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new dr(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>I2(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new dr({...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=vu(Qo(n,"addOptions",{name:n.name})),n.storage=vu(Qo(n,"addStorage",{name:n.name,options:n.options})),n}}function kP(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
177
|
+
|
|
178
|
+
`,textSerializers:l={}}=n||{};let c="";return t.nodesBetween(r,i,(u,f,h,m)=>{var g;u.isBlock&&f>r&&(c+=s);const y=l==null?void 0:l[u.type.name];if(y)return h&&(c+=y({node:u,pos:f,parent:h,index:m,range:e})),!1;u.isText&&(c+=(g=u==null?void 0:u.text)===null||g===void 0?void 0:g.slice(Math.max(r,f)-f,i-f))}),c}function CP(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}dr.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new lt({key:new ht("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,l=Math.min(...s.map(h=>h.$from.pos)),c=Math.max(...s.map(h=>h.$to.pos)),u=CP(n);return kP(r,{from:l,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}});const EP=()=>({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),TP=(t=!1)=>({commands:e})=>e.setContent("",t),AP=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:l})=>{t.doc.nodesBetween(s.pos,l.pos,(c,u)=>{if(c.type.isText)return;const{doc:f,mapping:h}=e,m=f.resolve(h.map(u)),g=f.resolve(h.map(u+c.nodeSize)),y=m.blockRange(g);if(!y)return;const v=kl(y);if(c.type.isTextblock){const{defaultType:S}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(y.start,S)}(v||v===0)&&e.lift(y,v)})}),!0},MP=t=>e=>t(e),OP=()=>({state:t,dispatch:e})=>x1(t,e),_P=(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 Se(r.doc.resolve(Math.max(l-1,0)))),!0},DP=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const c=i.before(s),u=i.after(s);t.delete(c,u).scrollIntoView()}return!0}return!1},RP=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 u=s.before(l),f=s.after(l);e.delete(u,f).scrollIntoView()}return!0}return!1},NP=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},zP=()=>({state:t,dispatch:e})=>ym(t,e),LP=()=>({commands:t})=>t.keyboardShortcut("Enter"),IP=()=>({state:t,dispatch:e})=>b_(t,e);function tm(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:SP(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function j2(t,e,n={}){return t.find(r=>r.type===e&&tm(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function MA(t,e,n={}){return!!j2(t,e,n)}function B2(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(h=>h.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(h=>h.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!j2([...i.node.marks],e,n)))return;let l=i.index,c=t.start()+i.offset,u=l+1,f=c+i.node.nodeSize;for(;l>0&&MA([...t.parent.child(l-1).marks],e,n);)l-=1,c-=t.parent.child(l).nodeSize;for(;u<t.parent.childCount&&MA([...t.parent.child(u).marks],e,n);)f+=t.parent.child(u).nodeSize,u+=1;return{from:c,to:f}}function ko(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 jP=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=ko(t,r.schema),{doc:l,selection:c}=n,{$from:u,from:f,to:h}=c;if(i){const m=B2(u,s,e);if(m&&m.from<=f&&m.to>=h){const g=Se.create(l,m.from,m.to);n.setSelection(g)}}return!0},BP=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 U2(t){return t instanceof Se}function el(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function UP(t,e=null){if(!e)return null;const n=De.atStart(t),r=De.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?Se.create(t,el(0,i,s),el(t.content.size,i,s)):Se.create(t,el(e,i,s),el(e,i,s))}function OA(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function nm(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function HP(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const $P=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(nm()||OA())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),HP()&&!nm()&&!OA()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!U2(n.state.selection))return l(),!0;const c=UP(i.doc,t)||n.state.selection,u=n.state.selection.eq(c);return s&&(u||i.setSelection(c),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},VP=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),PP=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),H2=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&&H2(r)}return t};function yh(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return H2(n)}function bd(t,e,n){if(t instanceof gs||t instanceof ee)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 ee.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),bd("",e,n)}if(i){if(n.errorOnInvalidContent){let l=!1,c="";const u=new Gx({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?co.fromSchema(u).parseSlice(yh(t),n.parseOptions):co.fromSchema(u).parse(yh(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const s=co.fromSchema(e);return n.slice?s.parseSlice(yh(t),n.parseOptions).content:s.parse(yh(t),n.parseOptions)}return bd("",e,n)}function FP(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof an||i instanceof cn))return;const s=t.mapping.maps[r];let l=0;s.forEach((c,u,f,h)=>{l===0&&(l=h)}),t.setSelection(De.near(t.doc.resolve(l),n))}const qP=t=>!("type"in t),KP=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var l;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const u=k=>{s.emit("contentError",{editor:s,error:k,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},f={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{bd(e,s.schema,{parseOptions:f,errorOnInvalidContent:!0})}catch(k){u(k)}try{c=bd(e,s.schema,{parseOptions:f,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:s.options.enableContentCheck})}catch(k){return u(k),!1}let{from:h,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},g=!0,y=!0;if((qP(c)?c:[c]).forEach(k=>{k.check(),g=g?k.isText&&k.marks.length===0:!1,y=y?k.isBlock:!1}),h===m&&y){const{parent:k}=r.doc.resolve(h);k.isTextblock&&!k.type.spec.code&&!k.childCount&&(h-=1,m+=1)}let S;if(g){if(Array.isArray(e))S=e.map(k=>k.text||"").join("");else if(e instanceof ee){let k="";e.forEach(E=>{E.text&&(k+=E.text)}),S=k}else typeof e=="object"&&e&&e.text?S=e.text:S=e;r.insertText(S,h,m)}else S=c,r.replaceWith(h,m,S);n.updateSelection&&FP(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:h,text:S}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:h,text:S})}return!0},YP=()=>({state:t,dispatch:e})=>m_(t,e),WP=()=>({state:t,dispatch:e})=>g_(t,e),GP=()=>({state:t,dispatch:e})=>d1(t,e),ZP=()=>({state:t,dispatch:e})=>p1(t,e),JP=()=>({state:t,dispatch:e,tr:n})=>{try{const r=rc(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},XP=()=>({state:t,dispatch:e,tr:n})=>{try{const r=rc(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},QP=()=>({state:t,dispatch:e})=>d_(t,e),e9=()=>({state:t,dispatch:e})=>f_(t,e);function $2(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function t9(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,l;for(let c=0;c<e.length-1;c+=1){const u=e[c];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))nm()||$2()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const n9=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=t9(t).split(/-(?!$)/),l=s.find(f=>!["Alt","Ctrl","Meta","Shift"].includes(f)),c=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",f=>f(n,c))});return u==null||u.steps.forEach(f=>{const h=f.map(r.mapping);h&&i&&r.maybeStep(h)}),!0};function pv(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 y=Math.max(r,g),v=Math.min(i,g+m.nodeSize);c.push({node:m,from:y,to:v})});const u=i-r,f=c.filter(m=>l?l.name===m.node.type.name:!0).filter(m=>tm(m.node.attrs,n,{strict:!1}));return s?!!f.length:f.reduce((m,g)=>m+g.to-g.from,0)>=u}const r9=(t,e={})=>({state:n,dispatch:r})=>{const i=Bn(t,n.schema);return pv(n,i,e)?y_(n,r):!1},i9=()=>({state:t,dispatch:e})=>v1(t,e),s9=t=>({state:e,dispatch:n})=>{const r=Bn(t,e.schema);return T_(r)(e,n)},o9=()=>({state:t,dispatch:e})=>y1(t,e);function V2(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function _A(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 l9=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=V2(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=Bn(t,r.schema)),c==="mark"&&(l=ko(t,r.schema)),i&&n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(f,h)=>{s&&s===f.type&&n.setNodeMarkup(h,void 0,_A(f.attrs,e)),l&&f.marks.length&&f.marks.forEach(m=>{l===m.type&&n.addMark(h,h+f.nodeSize,l.create(_A(m.attrs,e)))})})}),!0):!1},a9=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),c9=()=>({tr:t,dispatch:e})=>{if(e){const n=new qn(t.doc);t.setSelection(n)}return!0},u9=()=>({state:t,dispatch:e})=>f1(t,e),d9=()=>({state:t,dispatch:e})=>m1(t,e),f9=()=>({state:t,dispatch:e})=>x_(t,e),h9=()=>({state:t,dispatch:e})=>k_(t,e),p9=()=>({state:t,dispatch:e})=>w_(t,e);function m9(t,e,n={},r={}){return bd(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const g9=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:l,commands:c})=>{var u,f;const{doc:h}=s;if(n.preserveWhitespace!=="full"){const m=m9(t,i.schema,n,{errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck});return l&&s.replaceWith(0,h.content.size,m).setMeta("preventUpdate",!e),!0}return l&&s.setMeta("preventUpdate",!e),c.insertContentAt({from:0,to:h.content.size},t,{parseOptions:n,errorOnInvalidContent:(f=r.errorOnInvalidContent)!==null&&f!==void 0?f:i.options.enableContentCheck})};function y9(t,e){const n=ko(e,t.schema),{from:r,to:i,empty:s}=t.selection,l=[];s?(t.storedMarks&&l.push(...t.storedMarks),l.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{l.push(...u.marks)});const c=l.find(u=>u.type.name===n.name);return c?{...c.attrs}:{}}function b9(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 x9(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 mv(t){return e=>x9(e.$from,t)}function Hh(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 v9(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?ko(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>s?s.name===m.type.name:!0).find(m=>tm(m.attrs,n,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:m,$to:g})=>{const y=m.pos,v=g.pos;t.doc.nodesBetween(y,v,(S,k)=>{if(!S.isText&&!S.marks.length)return;const E=Math.max(y,k),j=Math.min(v,k+S.nodeSize),L=j-E;l+=L,c.push(...S.marks.map(J=>({mark:J,from:E,to:j})))})}),l===0)return!1;const u=c.filter(m=>s?s.name===m.mark.type.name:!0).filter(m=>tm(m.mark.attrs,n,{strict:!1})).reduce((m,g)=>m+g.to-g.from,0),f=c.filter(m=>s?m.mark.type!==s&&m.mark.type.excludes(s):!0).reduce((m,g)=>m+g.to-g.from,0);return(u>0?u+f:u)>=l}function DA(t,e){const{nodeExtensions:n}=xP(e),r=n.find(l=>l.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=vu(Qo(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function P2(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&&(P2(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function S9(t,e,n){var r;const{selection:i}=e;let s=null;if(U2(i)&&(s=i.$cursor),s){const c=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(c)||!c.some(u=>u.type.excludes(n))}const{ranges:l}=i;return l.some(({$from:c,$to:u})=>{let f=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,u.pos,(h,m,g)=>{if(f)return!1;if(h.isInline){const y=!g||g.type.allowsMarkType(n),v=!!n.isInSet(h.marks)||!h.marks.some(S=>S.type.excludes(n));f=y&&v}return!f}),f})}const w9=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:l,ranges:c}=s,u=ko(t,r.schema);if(i)if(l){const f=y9(r,u);n.addStoredMark(u.create({...f,...e}))}else c.forEach(f=>{const h=f.$from.pos,m=f.$to.pos;r.doc.nodesBetween(h,m,(g,y)=>{const v=Math.max(y,h),S=Math.min(y+g.nodeSize,m);g.marks.find(E=>E.type===u)?g.marks.forEach(E=>{u===E.type&&n.addMark(v,S,u.create({...E.attrs,...e}))}):n.addMark(v,S,u.create(e))})});return S9(r,n,u)},k9=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),C9=(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})=>ap(s,{...l,...e})(n)?!0:c.clearNodes()).command(({state:c})=>ap(s,{...l,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},E9=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=el(t,0,r.content.size),s=Ae.create(r,i);e.setSelection(s)}return!0},T9=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,l=Se.atStart(r).from,c=Se.atEnd(r).to,u=el(i,l,c),f=el(s,l,c),h=Se.create(r,u,f);e.setSelection(h)}return!0},A9=t=>({state:e,dispatch:n})=>{const r=Bn(t,e.schema);return A_(r)(e,n)};function RA(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 M9=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:l}=e,{$from:c,$to:u}=s,f=i.extensionManager.attributes,h=Hh(f,c.node().type.name,c.node().attrs);if(s instanceof Ae&&s.node.isBlock)return!c.parentOffset||!Mr(l,c.pos)?!1:(r&&(t&&RA(n,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=u.parentOffset===u.parent.content.size,g=c.depth===0?void 0:b9(c.node(-1).contentMatchAt(c.indexAfter(-1)));let y=m&&g?[{type:g,attrs:h}]:void 0,v=Mr(e.doc,e.mapping.map(c.pos),1,y);if(!y&&!v&&Mr(e.doc,e.mapping.map(c.pos),1,g?[{type:g}]:void 0)&&(v=!0,y=g?[{type:g,attrs:h}]:void 0),r){if(v&&(s instanceof Se&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,y),g&&!m&&!c.parentOffset&&c.parent.type!==g)){const S=e.mapping.map(c.before()),k=e.doc.resolve(S);c.node(-1).canReplaceWith(k.index(),k.index()+1,g)&&e.setNodeMarkup(e.mapping.map(c.before()),g)}t&&RA(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return v},O9=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var l;const c=Bn(t,r.schema),{$from:u,$to:f}=r.selection,h=r.selection.node;if(h&&h.isBlock||u.depth<2||!u.sameParent(f))return!1;const m=u.node(-1);if(m.type!==c)return!1;const g=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let E=ee.empty;const j=u.index(-1)?1:u.index(-2)?2:3;for(let G=u.depth-j;G>=u.depth-3;G-=1)E=ee.from(u.node(G).copy(E));const L=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,J={...Hh(g,u.node().type.name,u.node().attrs),...e},U=((l=c.contentMatch.defaultType)===null||l===void 0?void 0:l.createAndFill(J))||void 0;E=E.append(ee.from(c.createAndFill(null,U)||void 0));const M=u.before(u.depth-(j-1));n.replace(M,u.after(-L),new ye(E,4-j,0));let N=-1;n.doc.nodesBetween(M,n.doc.content.size,(G,K)=>{if(N>-1)return!1;G.isTextblock&&G.content.size===0&&(N=K+1)}),N>-1&&n.setSelection(Se.near(n.doc.resolve(N))),n.scrollIntoView()}return!0}const y=f.pos===u.end()?m.contentMatchAt(0).defaultType:null,v={...Hh(g,m.type.name,m.attrs),...e},S={...Hh(g,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,f.pos);const k=y?[{type:c,attrs:v},{type:y,attrs:S}]:[{type:c,attrs:v}];if(!Mr(n.doc,u.pos,2))return!1;if(i){const{selection:E,storedMarks:j}=r,{splittableMarks:L}=s.extensionManager,J=j||E.$to.parentOffset&&E.$from.marks();if(n.split(u.pos,2,k).scrollIntoView(),!J||!i)return!0;const U=J.filter(M=>L.includes(M.type.name));n.ensureMarks(U)}return!0},Z0=(t,e)=>{const n=mv(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)&&ji(t.doc,n.pos)&&t.join(n.pos),!0},J0=(t,e)=>{const n=mv(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)&&ji(t.doc,r)&&t.join(r),!0},_9=(t,e,n,r={})=>({editor:i,tr:s,state:l,dispatch:c,chain:u,commands:f,can:h})=>{const{extensions:m,splittableMarks:g}=i.extensionManager,y=Bn(t,l.schema),v=Bn(e,l.schema),{selection:S,storedMarks:k}=l,{$from:E,$to:j}=S,L=E.blockRange(j),J=k||S.$to.parentOffset&&S.$from.marks();if(!L)return!1;const U=mv(M=>DA(M.type.name,m))(S);if(L.depth>=1&&U&&L.depth-U.depth<=1){if(U.node.type===y)return f.liftListItem(v);if(DA(U.node.type.name,m)&&y.validContent(U.node.content)&&c)return u().command(()=>(s.setNodeMarkup(U.pos,y),!0)).command(()=>Z0(s,y)).command(()=>J0(s,y)).run()}return!n||!J||!c?u().command(()=>h().wrapInList(y,r)?!0:f.clearNodes()).wrapInList(y,r).command(()=>Z0(s,y)).command(()=>J0(s,y)).run():u().command(()=>{const M=h().wrapInList(y,r),N=J.filter(G=>g.includes(G.type.name));return s.ensureMarks(N),M?!0:f.clearNodes()}).wrapInList(y,r).command(()=>Z0(s,y)).command(()=>J0(s,y)).run()},D9=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,l=ko(t,r.schema);return v9(r,l,e)?i.unsetMark(l,{extendEmptyMarkRange:s}):i.setMark(l,e)},R9=(t,e,n={})=>({state:r,commands:i})=>{const s=Bn(t,r.schema),l=Bn(e,r.schema),c=pv(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),c?i.setNode(l,u):i.setNode(s,{...u,...n})},N9=(t,e={})=>({state:n,commands:r})=>{const i=Bn(t,n.schema);return pv(n,i,e)?r.lift(i):r.wrapIn(i,e)},z9=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const l=t.tr,c=s.transform;for(let u=c.steps.length-1;u>=0;u-=1)l.step(c.steps[u].invert(c.docs[u]));if(s.text){const u=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else l.delete(s.from,s.to)}return!0}}return!1},L9=()=>({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},I9=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:c}=n,u=ko(t,r.schema),{$from:f,empty:h,ranges:m}=c;if(!i)return!0;if(h&&l){let{from:g,to:y}=c;const v=(s=f.marks().find(k=>k.type===u))===null||s===void 0?void 0:s.attrs,S=B2(f,u,v);S&&(g=S.from,y=S.to),n.removeMark(g,y,u)}else m.forEach(g=>{n.removeMark(g.$from.pos,g.$to.pos,u)});return n.removeStoredMark(u),!0},j9=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,l=null;const c=V2(typeof t=="string"?t:t.name,r.schema);return c?(c==="node"&&(s=Bn(t,r.schema)),c==="mark"&&(l=ko(t,r.schema)),i&&n.selection.ranges.forEach(u=>{const f=u.$from.pos,h=u.$to.pos;let m,g,y,v;n.selection.empty?r.doc.nodesBetween(f,h,(S,k)=>{s&&s===S.type&&(y=Math.max(k,f),v=Math.min(k+S.nodeSize,h),m=k,g=S)}):r.doc.nodesBetween(f,h,(S,k)=>{k<f&&s&&s===S.type&&(y=Math.max(k,f),v=Math.min(k+S.nodeSize,h),m=k,g=S),k>=f&&k<=h&&(s&&s===S.type&&n.setNodeMarkup(k,void 0,{...S.attrs,...e}),l&&S.marks.length&&S.marks.forEach(E=>{if(l===E.type){const j=Math.max(k,f),L=Math.min(k+S.nodeSize,h);n.addMark(j,L,l.create({...E.attrs,...e}))}}))}),g&&(m!==void 0&&n.setNodeMarkup(m,void 0,{...g.attrs,...e}),l&&g.marks.length&&g.marks.forEach(S=>{l===S.type&&n.addMark(y,v,l.create({...S.attrs,...e}))}))}),!0):!1},B9=(t,e={})=>({state:n,dispatch:r})=>{const i=Bn(t,n.schema);return C_(i,e)(n,r)},U9=(t,e={})=>({state:n,dispatch:r})=>{const i=Bn(t,n.schema);return E_(i,e)(n,r)};var H9=Object.freeze({__proto__:null,blur:EP,clearContent:TP,clearNodes:AP,command:MP,createParagraphNear:OP,cut:_P,deleteCurrentNode:DP,deleteNode:RP,deleteRange:NP,deleteSelection:zP,enter:LP,exitCode:IP,extendMarkRange:jP,first:BP,focus:$P,forEach:VP,insertContent:PP,insertContentAt:KP,joinBackward:GP,joinDown:WP,joinForward:ZP,joinItemBackward:JP,joinItemForward:XP,joinTextblockBackward:QP,joinTextblockForward:e9,joinUp:YP,keyboardShortcut:n9,lift:r9,liftEmptyBlock:i9,liftListItem:s9,newlineInCode:o9,resetAttributes:l9,scrollIntoView:a9,selectAll:c9,selectNodeBackward:u9,selectNodeForward:d9,selectParentNode:f9,selectTextblockEnd:h9,selectTextblockStart:p9,setContent:g9,setMark:w9,setMeta:k9,setNode:C9,setNodeSelection:E9,setTextSelection:T9,sinkListItem:A9,splitBlock:M9,splitListItem:O9,toggleList:_9,toggleMark:D9,toggleNode:R9,toggleWrap:N9,undoInputRule:z9,unsetAllMarks:L9,unsetMark:I9,updateAttributes:j9,wrapIn:B9,wrapInList:U9});dr.create({name:"commands",addCommands(){return{...H9}}});dr.create({name:"drop",addProseMirrorPlugins(){return[new lt({key:new ht("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}});dr.create({name:"editable",addProseMirrorPlugins(){return[new lt({key:new ht("editable"),props:{editable:()=>this.editor.options.editable}})]}});const $9=new ht("focusEvents");dr.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new lt({key:$9,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}}}})]}});dr.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:u,doc:f}=c,{empty:h,$anchor:m}=u,{pos:g,parent:y}=m,v=m.parent.isTextblock&&g>0?c.doc.resolve(g-1):m,S=v.parent.type.spec.isolating,k=m.pos-m.parentOffset,E=S&&v.parent.childCount===1?k===m.pos:De.atStart(f).from===g;return!h||!y.type.isTextblock||y.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 nm()||$2()?s:i},addProseMirrorPlugins(){return[new lt({key:new ht("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(S=>S.getMeta("composition")))return;const r=t.some(S=>S.docChanged)&&!e.doc.eq(n.doc),i=t.some(S=>S.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:l,to:c}=e.selection,u=De.atStart(e.doc).from,f=De.atEnd(e.doc).to;if(s||!(l===u&&c===f)||!P2(n.doc))return;const g=n.tr,y=L2({state:n,transaction:g}),{commands:v}=new bP({editor:this.editor,state:y});if(v.clearNodes(),!!g.steps.length)return g}})]}});dr.create({name:"paste",addProseMirrorPlugins(){return[new lt({key:new ht("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}});dr.create({name:"tabindex",addProseMirrorPlugins(){return[new lt({key:new ht("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});function Nu(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 F2(t){return t?t+1:0}function Sl(t,e){let n=0,r=0;const i=t.childCount;for(let s=0;s<i;s++){const l=t.child(s),c=r+1,u=l.type.name==="heading"?F2(l.attrs.level||1):0,f=l.textContent.length,h=u+f;if(n+h>e){const m=e-n,g=Math.max(0,m-u);return Zr(c+Math.min(g,f))}if(n+=h,r+=l.nodeSize,s<i-1&&(n+=1,n>e))return Zr(c+f)}return Zr(t.content.size)}function ec(t,e){let n=0,r=0;const i=t.childCount;for(let s=0;s<i;s++){const l=t.child(s),c=r+1,u=l.type.name==="heading"?F2(l.attrs.level||1):0,f=l.textContent.length,h=c+f;if(e<=h){if(e<=c)return Th(n+u);const m=e-c;return Th(n+u+Math.min(m,f))}n+=u+f,r+=l.nodeSize,s<i-1&&(n+=1)}return Th(n)}function NA(t,e,n){let r=0;const i=Math.min(t.childCount,e.length);for(let s=0;s<i;s++){const l=e.get(s),c=t.child(s),u=r+1;if(l instanceof _n){let f=0;for(let h=0;h<l.length;h++){const m=l.get(h);if(m instanceof Yn){if(m===n.type)return Zr(u+Math.min(f+n.index,c.textContent.length));f+=m.length}}}r+=c.nodeSize}return null}function q2(t,e,n){let r,i;try{const u=ol(n.fromRel),f=ol(n.toRel);r=nx(u,t),i=nx(f,t)}catch(u){return console.warn("[positions] relRangeToPmPositions: failed to resolve relRange:",u),null}if(!r||!i)return null;const s=t.getXmlFragment("default"),l=NA(e,s,r),c=NA(e,s,i);return l===null||c===null?null:{from:l,to:c}}function rm(t,e,n){if(t.relRange&&n){const r=q2(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:Sl(e,t.range.from),to:Sl(e,t.range.to),method:"flat"}:null}function K2(t,e){return{from:ec(t,e.from),to:ec(t,e.to)}}const bh=new ht("tandemAnnotations");function zA(t,e,n){const r=[],i=t.content.size;return e.forEach(s=>{const l=Nu(s);if(l.status!=="pending"||!l.range&&!l.relRange)return;const c=rm(l,t,n);if(!c)return;l.relRange&&c.method==="flat"&&console.warn("[annotation] relRange-equipped annotation %s fell back to flat offsets",l.id);const{from:u,to:f}=c;if(u>=f||u<0||f>i)return;let h={};switch(l.type){case"highlight":{const m=l.color||"yellow",g=$u[m]||$u.yellow;h={class:`tandem-highlight tandem-highlight--${m}`,style:`background: ${g}; border-radius: 2px; padding: 1px 0;`,"data-annotation-id":l.id,"aria-label":`Highlight annotation (${m})`};break}case"comment":l.suggestedText!==void 0?h={class:"tandem-suggestion",style:"background: var(--tandem-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"?h={class:"tandem-question",style:"background: var(--tandem-accent-bg); border-bottom: 2px solid var(--tandem-accent); padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Question annotation"}:h={class:"tandem-comment",style:"border-bottom: 2px dashed var(--tandem-author-user); padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Comment annotation"};break;case"flag":h={class:"tandem-flag",style:"background: var(--tandem-error-bg); border-bottom: 2px solid var(--tandem-error); padding-bottom: 1px;","data-annotation-id":l.id,"aria-label":"Flag annotation"};break;default:{console.warn("[annotation] Unhandled annotation type in buildDecorations, skipping");return}}try{r.push(Vt.inline(u,f,h))}catch(m){if(!(m instanceof RangeError))throw m;console.debug("[annotation] RangeError for %s (from=%d, to=%d), skipping",l.id,u,f)}}),dt.create(t,r)}const V9=dr.create({name:"tandemAnnotations",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(Ta);return[new lt({key:bh,state:{init(n,r){return zA(r.doc,e,t)},apply(n,r,i,s){return n.getMeta(bh)?zA(s.doc,e,t):n.docChanged?r.map(n.mapping,n.doc):r}},props:{decorations(n){return bh.getState(n)}},view(n){const r=()=>{const i=n.state.tr.setMeta(bh,!0);n.dispatch(i)};return e.observe(r),{destroy(){e.unobserve(r)}}}})]}});function gv(t){return`${t}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function P9(){return gv("ann")}function F9(){return gv("msg")}function q9(t){return gv(t)}const wa=new ht("tandemAuthorship");function K9(t,e,n){if(t.relRange){const r=q2(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=Sl(e,t.range.from),i=Sl(e,t.range.to);if(r<i)return{from:r,to:i}}return null}function X0(t,e,n,r){if(!r)return dt.empty;const i=[],s=t.content.size;return e.forEach(l=>{const c=l;if(!c.author||!c.range)return;const u=K9(c,t,n);if(!u)return;const{from:f,to:h}=u;if(f>=h||f<0||h>s)return;const m={class:`tandem-authorship tandem-authorship--${c.author}`};try{i.push(Vt.inline(f,h,m))}catch(g){if(!(g instanceof RangeError))throw g;console.warn("[authorship] Decoration RangeError for entry",c.id,g)}}),dt.create(t,i)}const Y9=dr.create({name:"tandemAuthorship",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(FC);let n=!1;try{n=localStorage.getItem(HM)==="true"}catch(r){console.warn("[authorship] localStorage unavailable",r)}return[new lt({key:wa,state:{init(r,i){return{visible:n,decorations:X0(i.doc,e,t,n)}},apply(r,i,s,l){const c=r.getMeta(wa);if((c==null?void 0:c.type)==="toggle"){const u=c.visible;return{visible:u,decorations:X0(l.doc,e,t,u)}}return(c==null?void 0:c.type)==="rebuild"?{visible:i.visible,decorations:X0(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=wa.getState(r))==null?void 0:i.decorations)??dt.empty}},view(r){const i=()=>{const l=r.state.tr.setMeta(wa,{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(wa)||!t.docChanged)return;const n=e.getMap(FC),r=t.doc;t.steps.forEach(i=>{i.getMap().forEach((l,c,u,f)=>{if(f-u-(c-l)>0)try{const m=ec(r,Zr(u)),g=ec(r,Zr(f));if(g<=m)return;const y=q9("user"),v={id:y,author:"user",range:{from:m,to:g},timestamp:Date.now()};n.set(y,v)}catch(m){console.warn("[authorship] Position conversion failed during user attribution",m)}})})}}),xh=new ht("tandemAwareness");function LA(t,e){if(!e)return dt.empty;const n=[],{focusParagraph:r,focusOffset:i,active:s}=e;if(r!==null&&r>=0){let l=0;t.forEach((c,u)=>{l===r&&n.push(Vt.node(u,u+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=Sl(t,Th(i)),c=s===!1?" tandem-claude-cursor-idle":"";n.push(Vt.widget(l,()=>{const u=document.createElement("span");u.className=`tandem-claude-cursor${c}`,u.setAttribute("aria-hidden","true");const f=document.createElement("span");return f.className="tandem-claude-cursor-label",f.textContent="Claude",u.appendChild(f),u}))}catch(l){console.warn("[awareness] cursor decoration failed, falling back to gutter-only:",l)}return n.length===0?dt.empty:dt.create(t,n)}const W9=dr.create({name:"tandemAwareness",addOptions(){return{ydoc:null}},addProseMirrorPlugins(){const t=this.options.ydoc;if(!t)return[];const e=t.getMap(UM),n=t.getMap(vb);return[new lt({key:xh,state:{init(r,i){const s=e.get("claude");return LA(i.doc,s??null)},apply(r,i,s,l){if(r.getMeta(xh)){const c=e.get("claude");return LA(l.doc,c??null)}return r.docChanged?i.map(r.mapping,r.doc):i}},props:{decorations(r){return xh.getState(r)}},view(r){const i=()=>{const s=r.state.tr.setMeta(xh,!0);r.dispatch(s)};return e.observe(i),{destroy(){e.unobserve(i)}}}}),new lt({key:new ht("tandemUserAwareness"),view(){let r=null,i=null,s=null,l=!1,c=-1;return{update(u,f){const{state:h}=u;if(!h.selection.eq(f.selection)){const m=K2(h.doc,{from:Zr(h.selection.from),to:Zr(h.selection.to)});if(h.selection.from===h.selection.to)s&&(clearTimeout(s),s=null),n.set("selection",{...m,timestamp:Date.now()});else{const g=h.doc.textBetween(h.selection.from,h.selection.to,`
|
|
179
|
+
`),y=g.length>200?g.slice(0,197)+"...":g;s&&clearTimeout(s),s=setTimeout(()=>{s=null,n.set("selection",{...m,selectedText:y,timestamp:Date.now()})},150)}}h.doc!==f.doc&&(c=h.selection.from,l=!0,i||(i=setTimeout(()=>{i=null,l&&n.set("activity",{isTyping:!0,cursor:c,lastEdit:Date.now()})},200)),r&&clearTimeout(r),r=setTimeout(()=>{l=!1,n.set("activity",{isTyping:!1,cursor:u.state.selection.from,lastEdit:Date.now()})},bL))},destroy(){r&&clearTimeout(r),i&&clearTimeout(i),s&&clearTimeout(s)}}}})]}});function IA({ydoc:t,provider:e,readOnly:n,reviewMode:r,activeAnnotationId:i,onEditorReady:s,onAnnotationClick:l}){const c=pV({extensions:[yP.configure({history:!1}),g8.configure({multicolor:!0}),$8.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer",target:"_blank"}}),V8.configure({placeholder:"Open a document with Claude to get started..."}),q$.configure({resizable:!0}),W$,K$,Y$,f8.configure({document:t}),h8.configure({provider:e,user:{name:Wx(),color:"var(--tandem-warning)"}}),V9.configure({ydoc:t}),Y9.configure({ydoc:t}),W9.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]);_.useEffect(()=>{c&&c.setEditable(!n)},[c,n]),_.useEffect(()=>{if(c)return WM(h=>c.commands.updateUser({name:h}))},[c]),_.useEffect(()=>(s==null||s(c),()=>s==null?void 0:s(null)),[c,s]),_.useEffect(()=>{if(!c)return;const h=c.view.dom;h.querySelectorAll(".tandem-annotation-active").forEach(m=>{m.classList.remove("tandem-annotation-active")}),i&&r&&h.querySelectorAll(`[data-annotation-id="${CSS.escape(i)}"]`).forEach(m=>{m.classList.add("tandem-annotation-active")})},[c,i,r]);const u=_.useCallback(h=>{const m=h.target.closest("[data-annotation-id]");if(!m)return;const g=m.getAttribute("data-annotation-id");g&&l&&l(g)},[l]),f=r?"tandem-review-dimmed":"";return C.jsxs("div",{className:f,onClick:u,children:[C.jsx(iV,{editor:c}),C.jsx("style",{children:`
|
|
180
|
+
.tandem-editor h1 { font-size: 2em; font-weight: 700; margin: 0.67em 0; }
|
|
181
|
+
.tandem-editor h2 { font-size: 1.5em; font-weight: 600; margin: 0.75em 0; }
|
|
182
|
+
.tandem-editor h3 { font-size: 1.17em; font-weight: 600; margin: 0.83em 0; }
|
|
183
|
+
.tandem-editor p { margin: 0.5em 0; }
|
|
184
|
+
.tandem-editor ul, .tandem-editor ol { padding-left: 1.5em; }
|
|
185
|
+
.tandem-editor table { border-collapse: collapse; width: 100%; margin: 1em 0; }
|
|
186
|
+
.tandem-editor td, .tandem-editor th { border: 1px solid var(--tandem-border); padding: 8px; }
|
|
187
|
+
.tandem-editor th { background: var(--tandem-surface-muted); font-weight: 600; }
|
|
188
|
+
.tandem-editor blockquote {
|
|
189
|
+
border-left: 3px solid var(--tandem-border-strong);
|
|
190
|
+
margin: 0.5em 0;
|
|
191
|
+
padding-left: 1em;
|
|
192
|
+
color: var(--tandem-fg-muted);
|
|
193
|
+
}
|
|
194
|
+
.collaboration-cursor__caret {
|
|
195
|
+
position: relative;
|
|
196
|
+
border-left: 2px solid;
|
|
197
|
+
border-right: none;
|
|
198
|
+
margin-left: -1px;
|
|
199
|
+
}
|
|
200
|
+
.collaboration-cursor__label {
|
|
201
|
+
position: absolute;
|
|
202
|
+
top: -1.4em;
|
|
203
|
+
left: -1px;
|
|
204
|
+
font-size: 12px;
|
|
205
|
+
white-space: nowrap;
|
|
206
|
+
padding: 0 4px;
|
|
207
|
+
border-radius: 3px 3px 3px 0;
|
|
208
|
+
color: var(--tandem-accent-fg);
|
|
209
|
+
}
|
|
210
|
+
.ProseMirror-focused { outline: none; }
|
|
211
|
+
.ProseMirror p.is-empty::before {
|
|
212
|
+
content: attr(data-placeholder);
|
|
213
|
+
color: var(--tandem-fg-subtle);
|
|
214
|
+
pointer-events: none;
|
|
215
|
+
float: left;
|
|
216
|
+
height: 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* Annotation decorations */
|
|
220
|
+
.tandem-highlight { cursor: pointer; }
|
|
221
|
+
.tandem-highlight:hover { filter: brightness(0.95); }
|
|
222
|
+
.tandem-comment { cursor: pointer; }
|
|
223
|
+
.tandem-comment:hover { border-bottom-style: solid; }
|
|
224
|
+
.tandem-suggestion { cursor: pointer; }
|
|
225
|
+
|
|
226
|
+
/* Review mode dimming — grays out text, keeps annotated spans readable */
|
|
227
|
+
.tandem-review-dimmed .ProseMirror {
|
|
228
|
+
color: var(--tandem-fg-subtle);
|
|
229
|
+
transition: color 0.2s;
|
|
230
|
+
}
|
|
231
|
+
.tandem-review-dimmed .tandem-highlight,
|
|
232
|
+
.tandem-review-dimmed .tandem-comment,
|
|
233
|
+
.tandem-review-dimmed .tandem-suggestion {
|
|
234
|
+
color: var(--tandem-fg);
|
|
235
|
+
}
|
|
236
|
+
.tandem-review-dimmed .tandem-annotation-active {
|
|
237
|
+
outline: 2px solid var(--tandem-accent);
|
|
238
|
+
outline-offset: 1px;
|
|
239
|
+
border-radius: 2px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Authorship decorations — user=blue, claude=orange */
|
|
243
|
+
.tandem-authorship { transition: color 0.2s; }
|
|
244
|
+
.tandem-authorship--user { color: var(--tandem-author-user); }
|
|
245
|
+
.tandem-authorship--claude { color: var(--tandem-author-claude); }
|
|
246
|
+
|
|
247
|
+
/* Claude focus paragraph */
|
|
248
|
+
.tandem-claude-focus {
|
|
249
|
+
position: relative;
|
|
250
|
+
}
|
|
251
|
+
.tandem-claude-focus::before {
|
|
252
|
+
content: '';
|
|
253
|
+
position: absolute;
|
|
254
|
+
left: -24px;
|
|
255
|
+
top: 0;
|
|
256
|
+
bottom: 0;
|
|
257
|
+
width: 3px;
|
|
258
|
+
background: var(--tandem-accent);
|
|
259
|
+
border-radius: 2px;
|
|
260
|
+
animation: tandem-gutter-pulse 2s ease-in-out infinite;
|
|
261
|
+
}
|
|
262
|
+
@keyframes tandem-gutter-pulse {
|
|
263
|
+
0%, 100% { opacity: 0.4; }
|
|
264
|
+
50% { opacity: 1; }
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/* Claude character-level cursor */
|
|
268
|
+
.tandem-claude-cursor {
|
|
269
|
+
position: relative;
|
|
270
|
+
display: inline;
|
|
271
|
+
border-left: 2px solid var(--tandem-author-claude);
|
|
272
|
+
margin-left: -1px;
|
|
273
|
+
z-index: 10;
|
|
274
|
+
animation: tandem-claude-blink 1.2s step-end infinite;
|
|
275
|
+
}
|
|
276
|
+
.tandem-claude-cursor-idle {
|
|
277
|
+
opacity: 0.3;
|
|
278
|
+
animation: none;
|
|
279
|
+
}
|
|
280
|
+
.tandem-claude-cursor-label {
|
|
281
|
+
position: absolute;
|
|
282
|
+
top: -1.4em;
|
|
283
|
+
left: -1px;
|
|
284
|
+
font-size: 11px;
|
|
285
|
+
font-weight: 500;
|
|
286
|
+
white-space: nowrap;
|
|
287
|
+
padding: 0 4px;
|
|
288
|
+
border-radius: 3px 3px 3px 0;
|
|
289
|
+
background: var(--tandem-author-claude);
|
|
290
|
+
color: var(--tandem-accent-fg);
|
|
291
|
+
pointer-events: none;
|
|
292
|
+
z-index: 11;
|
|
293
|
+
}
|
|
294
|
+
@keyframes tandem-claude-blink {
|
|
295
|
+
0%, 100% { opacity: 1; }
|
|
296
|
+
50% { opacity: 0; }
|
|
297
|
+
}
|
|
298
|
+
`})]})}function fn({label:t,ariaLabel:e,shortcut:n,disabled:r,disabledTitle:i,active:s,onMouseDown:l,onClick:c,style:u}){let f="1px solid var(--tandem-border)",h="var(--tandem-surface)",m="var(--tandem-fg)";r?(h="var(--tandem-surface-muted)",m="var(--tandem-fg-subtle)"):s&&(f="1px solid var(--tandem-accent)",h="var(--tandem-accent-bg)",m="var(--tandem-accent)");const g=e??(typeof t=="string"?t:void 0),y=g??"";return C.jsx("button",{type:"button",disabled:r,title:r&&i?i:n?`${y} (${n})`:y,"aria-label":g,onMouseDown:l,onClick:c,style:{padding:"4px 10px",fontSize:"13px",borderRadius:"4px",cursor:r?"not-allowed":"pointer",...u,border:f,background:h,color:m},children:t})}const G9=C.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[C.jsx("circle",{cx:"2",cy:"4",r:"1.5",fill:"currentColor"}),C.jsx("circle",{cx:"2",cy:"8",r:"1.5",fill:"currentColor"}),C.jsx("circle",{cx:"2",cy:"12",r:"1.5",fill:"currentColor"}),C.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),C.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),C.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"})]}),Z9=C.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[C.jsx("rect",{x:"5",y:"3",width:"9",height:"2",rx:"1",fill:"currentColor"}),C.jsx("rect",{x:"5",y:"7",width:"9",height:"2",rx:"1",fill:"currentColor"}),C.jsx("rect",{x:"5",y:"11",width:"9",height:"2",rx:"1",fill:"currentColor"}),C.jsx("text",{x:"0",y:"5.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"1."}),C.jsx("text",{x:"0",y:"9.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"2."}),C.jsx("text",{x:"0",y:"13.5",fontSize:"4.5",fill:"currentColor",fontFamily:"monospace",fontWeight:"bold",children:"3."})]}),J9=C.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[C.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"}),C.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"})]}),X9=C.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[C.jsx("path",{d:"M5 4L1 8l4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),C.jsx("path",{d:"M11 4l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),C.jsx("path",{d:"M9 2l-2 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Q9=C.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[C.jsx("rect",{x:"0",y:"2",width:"3",height:"12",rx:"1.5",fill:"currentColor"}),C.jsx("rect",{x:"5",y:"4",width:"9",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),C.jsx("rect",{x:"5",y:"8",width:"7",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"}),C.jsx("rect",{x:"5",y:"12",width:"8",height:"2",rx:"1",fill:"currentColor",opacity:"0.7"})]}),eF=C.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[C.jsx("path",{d:"M4 7L1 4l3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),C.jsx("path",{d:"M1 4h9a5 5 0 0 1 0 10H7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),tF=C.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[C.jsx("path",{d:"M12 7l3-3-3-3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),C.jsx("path",{d:"M15 4H6a5 5 0 0 0 0 10h3",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Y2=[1,2,3],nF={1:700,2:600,3:500};function rF(t){for(const e of Y2)if(t.isActive("heading",{level:e}))return e;return null}function Pr(t){return e=>{e.preventDefault(),t()}}function iF({editor:t,disabled:e}){var v,S;const[,n]=_.useState(0),[r,i]=_.useState(!1),s=_.useRef(null);if(_.useEffect(()=>{if(!t)return;const k=()=>{t.isDestroyed||n(E=>E+1)};return t.on("transaction",k),()=>{t.off("transaction",k)}},[t]),_.useEffect(()=>{if(!r)return;function k(E){s.current&&!s.current.contains(E.target)&&i(!1)}return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[r]),!t)return null;const c=!t.isEditable||!!e,u=Oi.getState(t.state),f=!c&&(((v=u==null?void 0:u.undoManager)==null?void 0:v.undoStack.length)??0)>0,h=!c&&(((S=u==null?void 0:u.undoManager)==null?void 0:S.redoStack.length)??0)>0,m=rF(t);function g(k){return E=>{E.preventDefault(),!(!t||t.isDestroyed)&&(t.chain().focus().toggleHeading({level:k}).run(),i(!1))}}const y=m?`H${m}`:"H";return C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px"},children:[C.jsx(fn,{label:eF,ariaLabel:"Undo",shortcut:"Ctrl+Z",disabled:!f,onMouseDown:Pr(()=>t.commands.undo()),style:{minWidth:"30px",padding:"4px 6px"}}),C.jsx(fn,{label:tF,ariaLabel:"Redo",shortcut:"Ctrl+Shift+Z",disabled:!h,onMouseDown:Pr(()=>t.commands.redo()),style:{minWidth:"30px",padding:"4px 6px"}}),C.jsx("div",{style:{width:"1px",height:"16px",background:"var(--tandem-border)",margin:"0 2px"}}),C.jsx(fn,{label:"B",shortcut:"Ctrl+B",disabled:c,active:t.isActive("bold"),onMouseDown:Pr(()=>t.chain().focus().toggleBold().run()),style:{fontWeight:700,minWidth:"30px"}}),C.jsx(fn,{label:"I",shortcut:"Ctrl+I",disabled:c,active:t.isActive("italic"),onMouseDown:Pr(()=>t.chain().focus().toggleItalic().run()),style:{fontStyle:"italic",minWidth:"30px"}}),C.jsx(fn,{label:"S",shortcut:"Ctrl+Shift+X",disabled:c,active:t.isActive("strike"),onMouseDown:Pr(()=>t.chain().focus().toggleStrike().run()),style:{textDecoration:"line-through",minWidth:"30px"}}),C.jsx(fn,{label:"<>",shortcut:"Ctrl+E",disabled:c,active:t.isActive("code"),onMouseDown:Pr(()=>t.chain().focus().toggleCode().run()),style:{fontFamily:"monospace",minWidth:"30px"}}),C.jsxs("div",{style:{position:"relative"},ref:s,onKeyDown:k=>{k.key==="Escape"&&i(!1)},children:[C.jsx(fn,{label:y,disabled:c,active:m!==null,onMouseDown:k=>{k.preventDefault(),i(E=>!E)},style:{minWidth:"30px"}}),r&&C.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:Y2.map(k=>C.jsxs("button",{type:"button",role:"menuitem",onMouseDown:g(k),style:{padding:"4px 12px",fontSize:"13px",border:"none",borderRadius:"4px",background:m===k?"var(--tandem-accent-bg)":"transparent",color:m===k?"var(--tandem-accent)":"var(--tandem-fg)",cursor:"pointer",textAlign:"left",fontWeight:nF[k],whiteSpace:"nowrap"},children:["Heading ",k]},k))})]}),C.jsx("div",{style:{width:"1px",height:"16px",background:"var(--tandem-border)",margin:"0 2px"}}),C.jsx(fn,{label:G9,ariaLabel:"Bullet list",shortcut:"Ctrl+Shift+8",disabled:c,active:t.isActive("bulletList"),onMouseDown:Pr(()=>t.chain().focus().toggleBulletList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),C.jsx(fn,{label:Z9,ariaLabel:"Ordered list",shortcut:"Ctrl+Shift+7",disabled:c,active:t.isActive("orderedList"),onMouseDown:Pr(()=>t.chain().focus().toggleOrderedList().run()),style:{minWidth:"30px",padding:"4px 6px"}}),C.jsx(fn,{label:Q9,ariaLabel:"Blockquote",shortcut:"Ctrl+Shift+B",disabled:c,active:t.isActive("blockquote"),onMouseDown:Pr(()=>t.chain().focus().toggleBlockquote().run()),style:{minWidth:"30px",padding:"4px 6px"}}),C.jsx("div",{style:{width:"1px",height:"16px",background:"var(--tandem-border)",margin:"0 2px"}}),C.jsx(fn,{label:J9,ariaLabel:"Link",shortcut:"Ctrl+K",disabled:c||!t.isActive("link")&&t.state.selection.from===t.state.selection.to,active:t.isActive("link"),onMouseDown:Pr(()=>{if(t.isActive("link"))t.chain().focus().unsetLink().run();else{const k=window.prompt("Enter URL:");k&&t.chain().focus().setLink({href:k}).run()}}),style:{minWidth:"30px",padding:"4px 6px"}}),C.jsx(fn,{label:"—",ariaLabel:"Horizontal rule",disabled:c,onMouseDown:Pr(()=>t.chain().focus().setHorizontalRule().run()),style:{minWidth:"30px"}}),C.jsx(fn,{label:X9,ariaLabel:"Code block",disabled:c,active:t.isActive("codeBlock"),onMouseDown:Pr(()=>t.chain().focus().toggleCodeBlock().run()),style:{minWidth:"30px",padding:"4px 6px"}})]})}function sF({inputRef:t,value:e,onChange:n,onKeyDown:r,onSubmit:i,onCancel:s,placeholder:l,submitLabel:c,borderColor:u,canSubmit:f,secondaryInput:h}){return C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[C.jsx("input",{ref:t,type:"text",value:e,onChange:m=>n(m.target.value),onKeyDown:r,placeholder:l,style:{padding:"3px 8px",fontSize:"13px",border:`1px solid ${u}`,borderRadius:"4px",outline:"none",minWidth:"120px",flex:"1 1 200px",background:"var(--tandem-surface)",color:"var(--tandem-fg)"}}),h,C.jsx(fn,{label:c,disabled:!f,onClick:i}),C.jsx(fn,{label:"Cancel",disabled:!1,onClick:s})]})}const oF=[{value:"yellow",label:"Yellow"},{value:"red",label:"Red"},{value:"green",label:"Green"},{value:"blue",label:"Blue"},{value:"purple",label:"Purple"}];function lF({editor:t,ydoc:e,onSettingsOpen:n,settingsBtnRef:r,tandemMode:i,onModeChange:s,heldCount:l}){const[c,u]=_.useState(!1),[f,h]=_.useState("yellow"),[m,g]=_.useState(!1),[y,v]=_.useState("idle"),[S,k]=_.useState(""),[E,j]=_.useState(!1),[L,J]=_.useState(""),[U,M]=_.useState(!1),N=_.useRef(null),G=_.useRef(null),K=_.useRef(null);_.useEffect(()=>{if(!t)return;const F=t;function ue(){const{from:le,to:Ne}=F.state.selection,Be=le!==Ne;u(je=>je===Be?je:Be)}return t.on("selectionUpdate",ue),()=>{t.off("selectionUpdate",ue)}},[t]),_.useEffect(()=>{y==="comment"&&G.current&&G.current.focus()},[y]),_.useEffect(()=>{if(!m)return;function F(ue){K.current&&!K.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 Ne=N.current??t.state.selection,{from:Be,to:je}=Ne;if(Be===je)return;const Xe=ec(t.state.doc,Zr(Be)),Oe=ec(t.state.doc,Zr(je)),Ke=P9(),Mt={id:Ke,author:"user",type:F,range:{from:Xe,to:Oe},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(Ta).set(Ke,Mt),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=y!=="idle";function pe(F){F.preventDefault(),ce("highlight","",{color:f})}function H(F){F.preventDefault(),g(ue=>!ue)}function I(F){h(F),g(!1)}const Z=_.useCallback(F=>ue=>{ue.preventDefault(),ie(),v(F),k(""),J(""),j(!1),M(!1)},[t]),me=_.useMemo(()=>Z("comment"),[Z]);function Me(){v("idle"),k(""),J(""),j(!1),M(!1),se()}function O(){if(!S.trim()&&!L.trim()){Me();return}const F={};E&&L.trim()&&(F.suggestedText=L.trim()),U&&(F.directedAt="claude"),ce("comment",S.trim(),F),v("idle"),k(""),J(""),j(!1),M(!1),t==null||t.chain().focus().run()}function D(F){F.key==="Enter"?(F.preventDefault(),O()):F.key==="Escape"&&Me()}function $(F){F.preventDefault(),ce("flag","")}const T=t&&e&&c;return C.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:[C.jsx("span",{style:{fontWeight:700,fontSize:"15px",color:"var(--tandem-accent)",letterSpacing:"-0.02em"},children:"Tandem"}),C.jsx("div",{style:{width:"1px",height:"20px",background:"var(--tandem-border)",margin:"0 8px"}}),C.jsx(iF,{editor:t,disabled:xe}),C.jsx("div",{style:{width:"1px",height:"20px",background:"var(--tandem-border)",margin:"0 8px"}}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"2px",position:"relative"},children:[C.jsx(fn,{label:"Highlight",disabled:!T||xe,disabledTitle:"Select text first",onMouseDown:pe,style:{borderRadius:"4px 0 0 4px",borderRight:"none"}}),C.jsx("button",{disabled:!T||xe,onMouseDown:H,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:C.jsx("span",{style:{display:"inline-block",width:"12px",height:"12px",borderRadius:"2px",background:$u[f],border:"1px solid rgba(0,0,0,0.15)"}})}),m&&C.jsxs("div",{ref:K,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:[oF.map(({value:F,label:ue})=>C.jsx("button",{title:ue,onClick:()=>I(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:$u[F],cursor:"pointer",padding:0}},F)),C.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:"✕"})]})]}),C.jsx(fn,{label:"Comment",disabled:!T||xe,disabledTitle:"Select text first",onMouseDown:me}),y==="comment"&&C.jsx(sF,{inputRef:G,value:S,onChange:k,onKeyDown:D,onSubmit:O,onCancel:Me,placeholder:U?"Ask about this text...":"Add a comment...",submitLabel:E?"Suggest":U?"Ask":"Add",borderColor:E?"var(--tandem-author-user)":U?"var(--tandem-accent)":"var(--tandem-author-user)",canSubmit:!!S.trim()||E&&!!L.trim(),secondaryInput:C.jsxs(C.Fragment,{children:[E&&C.jsx("input",{type:"text",value:L,onChange:F=>J(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)"}}),C.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[C.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:[C.jsx("input",{type:"checkbox",checked:E,onChange:F=>{j(F.target.checked),F.target.checked||J("")},style:{margin:0}}),"Replace"]}),C.jsxs("label",{style:{fontSize:"11px",color:U?"var(--tandem-accent)":"var(--tandem-fg-subtle)",cursor:"pointer",display:"flex",alignItems:"center",gap:"3px",userSelect:"none"},children:[C.jsx("input",{type:"checkbox",checked:U,onChange:F=>M(F.target.checked),style:{margin:0}}),"@Claude"]})]})]})}),C.jsx(fn,{label:"Flag",disabled:!T||xe,onMouseDown:$}),C.jsx("div",{style:{flex:1}}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[(l??0)>0&&C.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&&C.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:[C.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"&&C.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--tandem-fg-subtle)",display:"inline-block"}}),"Solo"]}),C.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"&&C.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--tandem-success)",display:"inline-block"}}),"Tandem"]})]}),n&&C.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 aF(){const[t,e]=_.useState(!1),n=_.useCallback(s=>{s.dataTransfer.types.includes("Files")&&(s.preventDefault(),e(!0))},[]),r=_.useCallback(s=>{(s.currentTarget===s.target||!s.currentTarget.contains(s.relatedTarget))&&e(!1)},[]),i=_.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 u=await fetch(`${qu}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:l.name,content:c})});if(!u.ok){const f=await u.json().catch(()=>({message:"Upload failed"}));console.error("[useFileDrop] Upload failed:",u.status,f.message??f.error)}}catch{console.error("[useFileDrop] Server unreachable — file drop ignored")}},[]);return{fileDragOver:t,handleEditorDragOver:n,handleEditorDragLeave:r,handleEditorDrop:i}}function cF(t,e){return t.status!=="pending"||e==="tandem"?!0:t.author!=="claude"}function uF(t,e){return _.useMemo(()=>{const n=[];let r=0;for(const i of t)cF(i,e)?n.push(i):i.status==="pending"&&r++;return{visibleAnnotations:n,heldCount:r}},[t,e])}function dF(){const[t,e]=_.useState([]),n=_.useRef(new Map),r=_.useCallback((l,c)=>{const u=n.current.get(l);u&&clearTimeout(u);const f=qC[c]??qC.info,h=setTimeout(()=>{e(m=>m.filter(g=>g.id!==l)),n.current.delete(l)},f);n.current.set(l,h)},[]),i=_.useCallback(l=>{const c=n.current.get(l);c&&(clearTimeout(c),n.current.delete(l))},[]),s=_.useCallback(l=>{e(c=>c.filter(u=>u.id!==l)),i(l)},[i]);return _.useEffect(()=>{const l=`http://localhost:${nc}/api/notify-stream`,c=new EventSource(l);return c.onmessage=u=>{let f;try{f=JSON.parse(u.data)}catch{console.warn("[useNotifications] Malformed SSE data:",u.data);return}e(h=>{if(f.dedupKey){const y=h.findIndex(v=>v.dedupKey===f.dedupKey);if(y!==-1){const v=h[y];i(v.id);const S={...f,count:v.count+1},k=[...h];return k[y]=S,r(S.id,S.severity),k}}const m={...f,count:1},g=[...h,m];for(;g.length>ML;){const y=g.shift();i(y.id)}return r(m.id,m.severity),g})},c.onerror=()=>{c.readyState===EventSource.CLOSED&&console.warn("[useNotifications] EventSource permanently closed. Notifications will not be delivered. Is the server running?")},()=>{c.close();for(const u of n.current.values())clearTimeout(u);n.current.clear()}},[r,i]),{toasts:t,dismiss:s}}function fF(t){const[e,n]=_.useState(!1),[r,i]=_.useState(null),s=_.useRef(0),{pendingCount:l,acceptedCount:c,dismissedCount:u}=_.useMemo(()=>{let h=0,m=0,g=0;for(const y of t)y.status==="pending"?h++:y.status==="accepted"?m++:y.status==="dismissed"&&g++;return{pendingCount:h,acceptedCount:m,dismissedCount:g}},[t]);_.useEffect(()=>{const h=c+u;s.current>0&&l===0&&h>0&&(i({accepted:c,dismissed:u,total:h}),n(!0)),s.current=l},[l,c,u]);const f=_.useCallback(()=>{n(!1)},[]);return{pendingCount:l,showReviewSummary:e,reviewSummaryData:r,dismissReviewSummary:f}}function hF(t){const[e,n]=_.useState(!1),r=_.useRef(!1),i=_.useCallback(async()=>{if(!(!t||r.current)){r.current=!0,n(!0);try{const s=await fetch(`http://localhost:${nc}/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 _.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 pF(t){return t.isComposing||t.code!=="Comma"?!1:t.ctrlKey||t.metaKey}function mF(t){_.useEffect(()=>{const e=n=>{pF(n)&&(n.preventDefault(),t())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t])}function gF(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 yF(t,e,n){const r=_.useRef(t);r.current=t;const i=_.useRef(e);i.current=e,_.useEffect(()=>{const s=l=>{if(!l.ctrlKey&&!l.metaKey||l.key!=="Tab")return;const c=gF(r.current,i.current,l.shiftKey);c&&(l.preventDefault(),n(c))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n])}function jA(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 bF(t,e,n,r,i="left"){const s=t.filter(m=>r.has(m)),l=s.indexOf(e),c=s.indexOf(n);if(l===-1||c===-1)return s;const u=[...s];u.splice(l,1);const f=u.indexOf(n),h=i==="right"?f+1:f;return u.splice(h,0,e),u}function xF(t){const[e,n]=_.useState([]),r=_.useMemo(()=>{const l=new Map(t.map(f=>[f.id,f])),c=t.map(f=>f.id);return jA(e,c).map(f=>l.get(f)).filter(Boolean)},[t,e]),i=_.useMemo(()=>t.map(l=>l.id),[t]);_.useEffect(()=>{n(l=>{const c=jA(l,i);return l.length===c.length&&l.every((u,f)=>u===c[f])?l:c})},[i]);const s=_.useCallback(function(c,u,f="left"){if(c===u)return;const h=new Set(i);n(m=>bF(m,c,u,h,f))},[i]);return{orderedTabs:r,reorder:s}}const vF={s:14,m:16,l:18};function BA(){try{return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}const uu={layout:"three-panel",primaryTab:"chat",panelOrder:"chat-editor-annotations",editorWidthPercent:50,selectionDwellMs:BM,showAuthorship:!1,reduceMotion:!1,textSize:"m",theme:"system"};function SF(){let t;try{t=localStorage.getItem(IM)}catch{t=null}if(t)try{const e=JSON.parse(t);return{layout:e.layout==="three-panel"||e.layout==="tabbed"?e.layout:uu.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)||uu.editorWidthPercent)),selectionDwellMs:Math.max(Fh,Math.min(qh,Number(e.selectionDwellMs)||BM)),showAuthorship:e.showAuthorship===!0,reduceMotion:typeof e.reduceMotion=="boolean"?e.reduceMotion:BA(),textSize:e.textSize==="s"||e.textSize==="m"||e.textSize==="l"?e.textSize:uu.textSize,theme:e.theme==="light"||e.theme==="dark"||e.theme==="system"?e.theme:uu.theme}}catch(e){console.warn("[tandem] settings JSON is corrupt, resetting to defaults:",e)}return{...uu,reduceMotion:BA()}}function wF(t,e){const n={...t,...e};return{...n,editorWidthPercent:Math.max(50,Math.min(100,n.editorWidthPercent)),selectionDwellMs:Math.max(Fh,Math.min(qh,n.selectionDwellMs))}}function kF(){const[t,e]=_.useState(SF),n=_.useCallback(r=>{e(i=>{const s=wF(i,r);try{localStorage.setItem(IM,JSON.stringify(s)),localStorage.setItem(HM,String(s.showAuthorship))}catch{}return s})},[]);return{settings:t,updateSettings:n}}function W2(){try{return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function CF(t){return t==="system"?W2():t}function EF(t){const e=document.documentElement;if(e.setAttribute("data-theme",CF(t)),t!=="system")return()=>e.removeAttribute("data-theme");const n=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>e.setAttribute("data-theme",W2());return n.addEventListener("change",r),()=>{n.removeEventListener("change",r),e.removeAttribute("data-theme")}}function TF(t){_.useEffect(()=>EF(t),[t])}function AF(){try{return localStorage.getItem(PM)==="true"}catch{return!1}}function UA(){try{localStorage.setItem(PM,"true")}catch{}}function MF(t,e,n){const[r,i]=_.useState(AF),[s,l]=_.useState(0),c=_.useRef(0),f=!r&&n==="welcome.md";_.useEffect(()=>{if(!f||s!==0)return;const y=t.filter(S=>S.id.startsWith(OL));if(y.length===0)return;y.some(S=>S.status!=="pending")&&(c.current=Date.now(),l(1))},[f,s,t]),_.useEffect(()=>{if(!f||s!==1)return;t.some(v=>v.author==="user")&&(c.current=Date.now(),l(2))},[f,s,t]);const h=e.current;_.useEffect(()=>{if(!f||s!==2||!h)return;const y=()=>{Date.now()-c.current<2e3||h.isFocused&&(c.current=Date.now(),l(3))};return h.on("update",y),()=>{h.off("update",y)}},[f,s,h]),_.useEffect(()=>{if(!f||s!==3)return;const y=setTimeout(()=>{UA(),i(!0)},3e3);return()=>clearTimeout(y)},[f,s]);const m=_.useCallback(()=>{UA(),i(!0)},[]),g=_.useCallback(()=>{c.current=Date.now(),l(y=>Math.min(y+1,3))},[]);return{tutorialActive:f,currentStep:s,dismissTutorial:m,nextStep:g}}const OF="modulepreload",_F=function(t){return"/"+t},HA={},DF=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),u=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));i=l(n.map(f=>{if(f=_F(f),f in HA)return;HA[f]=!0;const h=f.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const g=document.createElement("link");if(g.rel=h?"stylesheet":OF,h||(g.as="script"),g.crossOrigin="",g.href=f,u&&g.setAttribute("nonce",u),document.head.appendChild(g),h)return new Promise((y,v)=>{g.addEventListener("load",y),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 RF(){_.useEffect(()=>{let t=!1,e;return DF(async()=>{const{getCurrentWebview:n}=await import("./webview-0tvvWtyc.js");return{getCurrentWebview:n}},[]).then(({getCurrentWebview:n})=>{if(t)return;const r=n();let i=ou;try{const f=localStorage.getItem(KC);if(f!==null){const h=Number(f);Number.isFinite(h)?i=Math.max(YC,Math.min(WC,h)):console.warn(`[tandem] ignoring invalid stored zoom: ${f}`)}}catch{}i!==ou&&r.setZoom(i).catch(f=>{console.warn("[tandem] failed to restore zoom level:",f)});function s(f){try{localStorage.setItem(KC,String(f))}catch{}}const l=f=>{!(f.metaKey||f.ctrlKey)||f.key!=="0"||(f.preventDefault(),f.stopPropagation(),i=ou,r.setZoom(ou).catch(m=>{console.warn("[tandem] failed to reset zoom:",m)}),s(ou))},c=.1,u=f=>{if(!(f.metaKey||f.ctrlKey))return;const m=f.key==="+"||f.key==="=",g=f.key==="-"||f.key==="_";if(!m&&!g)return;const y=m?i+c:i-c;i=Math.max(YC,Math.min(WC,Math.round(y*100)/100)),s(i)};window.addEventListener("keydown",l,{capture:!0}),window.addEventListener("keydown",u,{capture:!0}),e=()=>{window.removeEventListener("keydown",l,{capture:!0}),window.removeEventListener("keydown",u,{capture:!0})}}).catch(()=>{}),()=>{t=!0,e==null||e()}},[])}const NF=Math.floor,zF=(t,e)=>t<e?t:e,LF=(t,e)=>t>e?t:e,G2=128,$h=127,IF=Number.MAX_SAFE_INTEGER,jF=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},xd=typeof TextEncoder<"u"?new TextEncoder:null,BF=t=>xd.encode(t),UF=xd?BF:jF;let zu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});zu&&zu.decode(new Uint8Array).length===1&&(zu=null);const im=(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},Hm=(t,e)=>{for(;e>$h;)im(t,G2|$h&e),e=NF(e/128);im(t,$h&e)},Ax=new Uint8Array(3e4),HF=Ax.length/3,$F=(t,e)=>{if(e.length<HF){const n=xd.encodeInto(e,Ax).written||0;Hm(t,n);for(let r=0;r<n;r++)im(t,Ax[r])}else qF(t,UF(e))},VF=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Hm(t,r);for(let i=0;i<r;i++)im(t,n.codePointAt(i))},PF=xd&&xd.encodeInto?$F:VF,FF=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=zF(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(LF(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},qF=(t,e)=>{Hm(t,e.byteLength),FF(t,e)},Z2=t=>new Error(t),KF=Z2("Unexpected end of array"),YF=Z2("Integer out of Range"),WF=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},GF=t=>WF(t,yv(t)),$A=t=>t.arr[t.pos++],yv=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<G2)return e;if(e>IF)throw YF}throw KF},ZF=t=>{let e=yv(t);if(e===0)return"";{let n=String.fromCodePoint($A(t));if(--e<100)for(;e--;)n+=String.fromCodePoint($A(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))}},JF=t=>zu.decode(GF(t)),VA=zu?JF:ZF;var Ia;(function(t){t[t.Token=0]="Token",t[t.PermissionDenied=1]="PermissionDenied",t[t.Authenticated=2]="Authenticated"})(Ia||(Ia={}));const XF=(t,e)=>{Hm(t,Ia.Token),PF(t,e)},QF=(t,e,n,r)=>{switch(yv(t)){case Ia.Token:{e();break}case Ia.PermissionDenied:{n(VA(t));break}case Ia.Authenticated:{r(VA(t));break}}},PA=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n}));var Mx;(function(t){t[t.Connecting=0]="Connecting",t[t.Open=1]="Open",t[t.Closing=2]="Closing",t[t.Closed=3]="Closed"})(Mx||(Mx={}));function e7(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 Q0(t){return new Promise(e=>setTimeout(e,t))}function t7(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 n7(t,e){const n=e7(e);for(const c of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const u=n[c];if(!Number.isInteger(u)||u<0)throw new Error(`Value for ${c} must be an integer greater than or equal to 0`)}if(n.factor.constructor!==Number||n.factor<0)throw new Error("Value for factor must be a number greater than or equal to 0");if(n.delay<n.minDelay)throw new Error(`delay cannot be less than minDelay (delay: ${n.delay}, minDelay: ${n.minDelay}`);const r={attemptNum:0,attemptsRemaining:n.maxAttempts?n.maxAttempts:-1,aborted:!1,abort(){r.aborted=!0}},i=n.calculateDelay||t7;async function s(){if(n.beforeAttempt&&n.beforeAttempt(r,n),r.aborted){const u=new Error("Attempt aborted");throw u.code="ATTEMPT_ABORTED",u}const c=async u=>{if(n.handleError&&await n.handleError(u,r,n),r.aborted||r.attemptsRemaining===0)throw u;r.attemptNum++;const f=i(r,n);return f&&await Q0(f),s()};return r.attemptsRemaining>0&&r.attemptsRemaining--,n.timeout?new Promise((u,f)=>{const h=setTimeout(()=>{if(n.handleTimeout)try{u(n.handleTimeout(r,n))}catch(m){f(m)}else{const m=new Error(`Retry timeout (attemptNum: ${r.attemptNum}, timeout: ${n.timeout})`);m.code="ATTEMPT_TIMEOUT",f(m)}},n.timeout);t(r,n).then(m=>{clearTimeout(h),u(m)}).catch(m=>{clearTimeout(h),c(m).then(u).catch(f)})}):t(r,n).catch(c)}const l=n.calculateDelay?n.calculateDelay(r,n):n.initialDelay;if(l&&await Q0(l),r.attemptNum<1&&n.initialJitter){const c=i(r,n);c&&await Q0(c)}return s()}const J2=Math.floor,r7=(t,e)=>t<e?t:e,i7=(t,e)=>t>e?t:e,s7=64,sm=128,o7=63,Lu=127,X2=Number.MAX_SAFE_INTEGER,l7=()=>new Set,a7=Array.from,c7=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},vd=typeof TextEncoder<"u"?new TextEncoder:null,u7=t=>vd.encode(t),d7=vd?u7:c7;let Iu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Iu&&Iu.decode(new Uint8Array).length===1&&(Iu=null);class f7{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const bv=()=>new f7,Q2=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},xv=t=>{const e=new Uint8Array(Q2(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},om=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},zn=(t,e)=>{for(;e>Lu;)om(t,sm|Lu&e),e=J2(e/128);om(t,Lu&e)},Ox=new Uint8Array(3e4),h7=Ox.length/3,p7=(t,e)=>{if(e.length<h7){const n=vd.encodeInto(e,Ox).written||0;zn(t,n);for(let r=0;r<n;r++)om(t,Ox[r])}else dc(t,d7(e))},m7=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;zn(t,r);for(let i=0;i<r;i++)om(t,n.codePointAt(i))},Ss=vd&&vd.encodeInto?p7:m7,g7=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=r7(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(i7(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},dc=(t,e)=>{zn(t,e.byteLength),g7(t,e)},eR=t=>new Error(t),tR=eR("Unexpected end of array"),nR=eR("Integer out of Range");class y7{constructor(e){this.arr=e,this.pos=0}}const rR=t=>new y7(t),b7=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},$m=t=>b7(t,al(t)),FA=t=>t.arr[t.pos++],al=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&Lu)*n,n*=128,i<sm)return e;if(e>X2)throw nR}throw tR},x7=t=>{let e=t.arr[t.pos++],n=e&o7,r=64;const i=(e&s7)>0?-1:1;if((e&sm)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&Lu)*r,r*=128,e<sm)return i*n;if(n>X2)throw nR}throw tR},v7=t=>{let e=al(t);if(e===0)return"";{let n=String.fromCodePoint(FA(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(FA(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))}},S7=t=>Iu.decode($m(t)),Sd=Iu?S7:v7,w7=t=>{const e=t.pos,n=Sd(t);return t.pos=e,n},tc=Date.now,eb=()=>new Map,k7=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r};class C7{constructor(){this._observers=eb()}on(e,n){k7(this._observers,e,l7).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 a7((this._observers.get(e)||eb()).values()).forEach(r=>r(...n))}destroy(){this._observers=eb()}}const E7=Object.keys,qA=t=>E7(t).length,T7=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),A7=(t,e)=>t===e,ju=(t,e)=>{if(t==null||e==null)return A7(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)||!ju(t.get(n),e.get(n)))return!1;break}case Object:if(qA(t)!==qA(e))return!1;for(const n in t)if(!T7(t,n)||!ju(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(!ju(t[n],e[n]))return!1;break;default:return!1}return!0},tb=3e4;class M7 extends C7{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=tc();this.getLocalState()!==null&&tb/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const r=[];this.meta.forEach((i,s)=>{s!==this.clientID&&tb<=n-i.lastUpdated&&this.states.has(s)&&r.push(s)}),r.length>0&&Vh(this,r,"timeout")},J2(tb/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:tc()});const l=[],c=[],u=[],f=[];e===null?f.push(n):s==null?e!=null&&l.push(n):(c.push(n),ju(s,e)||u.push(n)),(l.length>0||u.length>0||f.length>0)&&this.emit("change",[{added:l,updated:u,removed:f},"local"]),this.emit("update",[{added:l,updated:c,removed:f},"local"])}setLocalStateField(e,n){const r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}}const Vh=(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:tc()})}r.push(s)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},_x=(t,e,n=t.states)=>{const r=e.length,i=bv();zn(i,r);for(let s=0;s<r;s++){const l=e[s],c=n.get(l)||null,u=t.meta.get(l).clock;zn(i,l),zn(i,u),Ss(i,JSON.stringify(c))}return xv(i)},O7=(t,e,n)=>{const r=rR(e),i=tc(),s=[],l=[],c=[],u=[],f=al(r);for(let h=0;h<f;h++){const m=al(r);let g=al(r);const y=JSON.parse(Sd(r)),v=t.meta.get(m),S=t.states.get(m),k=v===void 0?0:v.clock;(k<g||k===g&&y===null&&t.states.has(m))&&(y===null?m===t.clientID&&t.getLocalState()!=null?g++:t.states.delete(m):t.states.set(m,y),t.meta.set(m,{clock:g,lastUpdated:i}),v===void 0&&y!==null?s.push(m):v!==void 0&&y===null?u.push(m):y!==null&&(ju(y,S)||c.push(m),l.push(m)))}(s.length>0||c.length>0||u.length>0)&&t.emit("change",[{added:s,updated:c,removed:u},n]),(s.length>0||l.length>0||u.length>0)&&t.emit("update",[{added:s,updated:l,removed:u},n])};class iR{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 Dx{constructor(e){this.data=e,this.encoder=bv(),this.decoder=rR(new Uint8Array(this.data))}peekVarString(){return w7(this.decoder)}readVarUint(){return al(this.decoder)}readVarString(){return Sd(this.decoder)}readVarUint8Array(){return $m(this.decoder)}writeVarUint(e){return zn(this.encoder,e)}writeVarString(e){return Ss(this.encoder,e)}writeVarUint8Array(e){return dc(this.encoder,e)}length(){return Q2(this.encoder)}}var Tn;(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"})(Tn||(Tn={}));var Fn;(function(t){t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected"})(Fn||(Fn={}));class El{constructor(){this.encoder=bv()}get(e){return e.encoder}toUint8Array(){return xv(this.encoder)}}class _7 extends El{constructor(){super(...arguments),this.type=Tn.CLOSE,this.description="Ask the server to close the connection"}get(e){return Ss(this.encoder,e.documentName),zn(this.encoder,this.type),this.encoder}}class D7 extends iR{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(_7,{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:n7(this.createWebSocketConnection.bind(this),{delay:this.configuration.delay,initialDelay:this.configuration.initialDelay,factor:this.configuration.factor,maxAttempts:this.configuration.maxAttempts,minDelay:this.configuration.minDelay,maxDelay:this.configuration.maxDelay,jitter:this.configuration.jitter,timeout:this.configuration.timeout,handleTimeout:this.configuration.handleTimeout,beforeAttempt:l=>{(!this.shouldConnect||i)&&l.abort()}}).catch(l=>{if(l&&l.code!=="ATTEMPT_ABORTED")throw l}),cancelFunc:()=>{i=!0}}},{retryPromise:n,cancelFunc:r}=e();return this.cancelWebsocketRetry=r,n}attachWebSocketListeners(e,n){const{identifier:r}=e,i=f=>this.emit("message",f),s=f=>this.emit("close",{event:f}),l=f=>this.emit("open",f),c=f=>{n(f)};this.webSocketHandlers[r]={message:i,close:s,open:l,error:c};const u=this.webSocketHandlers[e.identifier];Object.keys(u).forEach(f=>{e.addEventListener(f,u[f])})}cleanupWebSocket(){if(!this.webSocket)return;const{identifier:e}=this.webSocket,n=this.webSocketHandlers[e];Object.keys(n).forEach(r=>{var i;(i=this.webSocket)===null||i===void 0||i.removeEventListener(r,n[r]),delete this.webSocketHandlers[e]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((e,n)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;const r=new this.configuration.WebSocketPolyfill(this.url);r.binaryType="arraybuffer",r.identifier=this.identifier,this.attachWebSocketListeners(r,n),this.webSocket=r,this.status=Fn.Connecting,this.emit("status",{status:Fn.Connecting}),this.connectionAttempt={resolve:e,reject:n}})}onMessage(e){var n;this.resolveConnectionAttempt(),this.lastMessageReceived=tc();const i=new Dx(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>=tc()-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)===Mx.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 sR=0,vv=1,oR=2,R7=(t,e)=>{zn(t,sR);const n=SU(e);dc(t,n)},N7=(t,e,n)=>{zn(t,vv),dc(t,yU(e,n))},z7=(t,e,n)=>N7(e,n,$m(t)),lR=(t,e,n)=>{try{pU(e,$m(t),n)}catch(r){console.error("Caught error while handling a Yjs update",r)}},L7=(t,e)=>{zn(t,oR),dc(t,e)},I7=lR,j7=(t,e,n,r)=>{const i=al(t);switch(i){case sR:z7(t,e,n);break;case vv:lR(t,n,r);break;case oR:I7(t,n,r);break;default:throw new Error("Unknown message type")}return i};class B7{constructor(e){this.message=e}apply(e,n){const{message:r}=this,i=r.readVarUint(),s=r.length();switch(i){case Tn.Sync:this.applySyncMessage(e,n);break;case Tn.Awareness:this.applyAwarenessMessage(e);break;case Tn.Auth:this.applyAuthMessage(e);break;case Tn.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case Tn.Stateless:e.receiveStateless(Sd(r.decoder));break;case Tn.SyncStatus:this.applySyncStatusMessage(e,x7(r.decoder)===1);break;case Tn.CLOSE:const l={code:1e3,reason:Sd(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(El,{encoder:r.encoder})}applySyncMessage(e,n){const{message:r}=this;r.writeVarUint(Tn.Sync);const i=j7(r.decoder,r.encoder,e.document,e);n&&i===vv&&(e.synced=!0)}applySyncStatusMessage(e,n){n&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;O7(e.awareness,n.readVarUint8Array(),e)}applyAuthMessage(e){const{message:n}=this;QF(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(Tn.Awareness),n.writeVarUint8Array(_x(e.awareness,Array.from(e.awareness.getStates().keys())))}}class U7{constructor(e,n={}){this.message=new e,this.encoder=this.message.get(n)}create(){return xv(this.encoder)}send(e){e==null||e.send(this.create())}}class H7 extends El{constructor(){super(...arguments),this.type=Tn.Auth,this.description="Authentication"}get(e){if(typeof e.token>"u")throw new Error("The authentication message requires `token` as an argument.");return Ss(this.encoder,e.documentName),zn(this.encoder,this.type),XF(this.encoder,e.token),this.encoder}}class KA extends El{constructor(){super(...arguments),this.type=Tn.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");Ss(this.encoder,e.documentName),zn(this.encoder,this.type);let n;return e.states===void 0?n=_x(e.awareness,e.clients):n=_x(e.awareness,e.clients,e.states),dc(this.encoder,n),this.encoder}}class $7 extends El{constructor(){super(...arguments),this.type=Tn.Stateless,this.description="A stateless message"}get(e){var n;return Ss(this.encoder,e.documentName),zn(this.encoder,this.type),Ss(this.encoder,(n=e.payload)!==null&&n!==void 0?n:""),this.encoder}}class YA extends El{constructor(){super(...arguments),this.type=Tn.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 Ss(this.encoder,e.documentName),zn(this.encoder,this.type),R7(this.encoder,e.document),this.encoder}}class V7 extends El{constructor(){super(...arguments),this.type=Tn.Sync,this.description="A document update"}get(e){return Ss(this.encoder,e.documentName),zn(this.encoder,this.type),L7(this.encoder,e.update),this.encoder}}class P7 extends Error{constructor(){super(...arguments),this.code=1001}}class WA extends iR{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 Li,this.configuration.awareness=e.awareness!==void 0?e.awareness:new M7(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:PA(this.awareness.getStates())})}),(r=this.awareness)===null||r===void 0||r.on("change",()=>{this.emit("awarenessChange",{states:PA(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 D7(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&&Vh(this.awareness,[this.document.clientID],"page hide")}registerEventListeners(){typeof window>"u"||!("addEventListener"in window)||window.addEventListener("pagehide",this.boundPageHide)}sendStateless(e){this.send($7,{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(H7,{token:e??"",documentName:this.configuration.name})}documentUpdateHandler(e,n){n!==this&&(this.incrementUnsyncedChanges(),this.send(V7,{update:e,documentName:this.configuration.name}))}awarenessUpdateHandler({added:e,updated:n,removed:r},i){const s=e.concat(n).concat(r);this.send(KA,{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(KA,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(e,n){if(!this._isAttached)return;const r=new U7(e,n);this.emit("outgoingMessage",{message:r.message}),r.send(this.configuration.websocketProvider)}onMessage(e){const n=new Dx(e.data),r=n.readVarString();n.writeVarString(r),this.emit("message",{event:e,message:new Dx(e.data)}),new B7(n).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&Vh(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&&(Vh(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 P7(`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 F7(t,e,n){return t.filter(r=>!e.has(r.id)&&!n.has(r.id))}function q7(){var O;const[t,e]=_.useState([]),[n,r]=_.useState(null),[i,s]=_.useState(!1),[l,c]=_.useState("connecting"),[u,f]=_.useState(0),[h,m]=_.useState(null),[g,y]=_.useState([]),[v,S]=_.useState(null),[k,E]=_.useState(!1),[j,L]=_.useState(!1),[J,U]=_.useState(!1),[M,N]=_.useState(!1),G=_.useRef(null),K=_.useRef(!1),ce=_.useRef(null),ie=_.useRef(null),se=_.useRef([]);se.current=t;const xe=_.useRef(new Set),pe=_.useRef(new Map);for(const D of t)xe.current.delete(D.id),pe.current.delete(D.id);const H=_.useRef(new Map),I=_.useRef(new Map),Z=_.useRef(void 0),me=_.useCallback(D=>{const{ydoc:$}=D,T=$.getMap(Ta),F=()=>{const Ke=[];T.forEach(Mt=>{Ke.push(Nu(Mt))}),y(Ke)};T.observe(F),F();const ue=$.getMap(UM);let le=null,Ne=!1;const Be=()=>{const Ke=ue.get("claude"),Mt=(Ke==null?void 0:Ke.status)??null,Ot=(Ke==null?void 0:Ke.active)??!1;Mt!==le&&(le=Mt,S(Mt)),Ot!==Ne&&(Ne=Ot,E(Ot))};ue.observe(Be),Be();const je=$.getMap(Eh);let Xe=!1;const Oe=()=>{const Ke=je.get("readOnly")===!0;Ke!==Xe&&(Xe=Ke,L(Ke))};return je.observe(Oe),Oe(),()=>{T.unobserve(F),ue.unobserve(Be),je.unobserve(Oe)}},[]);Z.current=(D,$)=>{var je,Xe;const T=se.current,F=new Set(T.map(Oe=>Oe.id)),ue=new Set(D.map(Oe=>Oe.id));for(const[Oe,Ke]of pe.current)ue.has(Oe)||((je=I.current.get(Oe))==null||je(),I.current.delete(Oe),Ke.provider.destroy(),Ke.ydoc.destroy(),pe.current.delete(Oe),xe.current.delete(Oe));const le=F7(D,F,xe.current),Ne=[];for(const Oe of le){xe.current.add(Oe.id);const Ke=new Li,Mt=new WA({url:`ws://localhost:${HC}`,name:Oe.id,document:Ke});pe.current.set(Oe.id,{ydoc:Ke,provider:Mt});const Ot=Ke.getMap(Eh),Zt=()=>{var Vn;const $n=Ot.get("openDocuments"),hr=Ot.get("activeDocumentId");$n&&((Vn=Z.current)==null||Vn.call(Z,$n,hr??null))};Ot.observe(Zt),I.current.set(Oe.id,()=>Ot.unobserve(Zt)),Ne.push({...Oe,ydoc:Ke,provider:Mt})}const Be=T.filter(Oe=>!ue.has(Oe.id));for(const Oe of Be){const Ke=H.current.get(Oe.id);Ke&&(Ke.cleanup(),H.current.delete(Oe.id)),(Xe=I.current.get(Oe.id))==null||Xe(),I.current.delete(Oe.id),xe.current.delete(Oe.id),pe.current.delete(Oe.id),Oe.provider.destroy(),Oe.ydoc.destroy()}e(Oe=>[...Oe.filter(Mt=>ue.has(Mt.id)),...Ne]),$!==null&&r(Oe=>Oe===null||!ue.has(Oe)?$:Be.length>0&&$===Oe?Oe:$)},_.useEffect(()=>{const D=new Li,$=new WA({url:`ws://localhost:${HC}`,name:kL,document:D});return ce.current={ydoc:D,provider:$},$.on("status",({status:T})=>{s(T==="connected"),c(T),T==="connected"?(K.current=!0,f(0),m(null)):T==="disconnected"?m(F=>F??Date.now()):T==="connecting"&&(K.current&&f(F=>F+1),m(F=>F??Date.now()))}),U(!0),()=>{$.destroy(),D.destroy(),ce.current=null}},[]),_.useEffect(()=>{if(!ce.current)return;const D=ce.current.ydoc.getMap(Eh),$=()=>{var le;const T=D.get("generationId");T&&ie.current&&T!==ie.current&&(console.warn("[Tandem] Server restarted — refreshing documents"),N(!0),G.current&&clearTimeout(G.current),G.current=setTimeout(()=>N(!1),5e3)),T&&(ie.current=T);const F=D.get("openDocuments"),ue=D.get("activeDocumentId");F&&((le=Z.current)==null||le.call(Z,F,ue??null))};return D.observe($),$(),()=>{D.unobserve($),G.current&&clearTimeout(G.current)}},[]),_.useEffect(()=>{for(const $ of H.current.values())$.cleanup();H.current.clear();const D=se.current.find($=>$.id===n);if(D){const $=me(D);H.current.set(D.id,{cleanup:$})}else y([]),S(null),E(!1),L(!1)},[n,me]);const Me=_.useCallback(D=>{r($=>{if($!==D)return $;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:${nc}/api/close`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:D})}).then($=>{$.ok||console.warn("[Tandem] Server rejected close:",$.status)}).catch($=>{console.warn("[Tandem] Failed to close document on server:",$)})},[]);return{tabs:t,activeTabId:n,setActiveTabId:r,handleTabClose:Me,connected:i,connectionStatus:l,reconnectAttempts:u,disconnectedSince:h,annotations:g,claudeStatus:v,claudeActive:k,readOnly:j,bootstrapYdoc:((O=ce.current)==null?void 0:O.ydoc)??null,ready:J,serverRestarted:M}}function K7(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Y7=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,W7=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,G7={};function GA(t,e){return(G7.jsx?W7:Y7).test(t)}const Z7=/[ \t\n\f\r]/g;function J7(t){return typeof t=="object"?t.type==="text"?ZA(t.value):!1:ZA(t)}function ZA(t){return t.replace(Z7,"")===""}class Nd{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Nd.prototype.normal={};Nd.prototype.property={};Nd.prototype.space=void 0;function aR(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new Nd(n,r,e)}function Rx(t){return t.toLowerCase()}class fr{constructor(e,n){this.attribute=n,this.property=e}}fr.prototype.attribute="";fr.prototype.booleanish=!1;fr.prototype.boolean=!1;fr.prototype.commaOrSpaceSeparated=!1;fr.prototype.commaSeparated=!1;fr.prototype.defined=!1;fr.prototype.mustUseProperty=!1;fr.prototype.number=!1;fr.prototype.overloadedBoolean=!1;fr.prototype.property="";fr.prototype.spaceSeparated=!1;fr.prototype.space=void 0;let X7=0;const qe=Tl(),tn=Tl(),Nx=Tl(),ae=Tl(),Ct=Tl(),ja=Tl(),wr=Tl();function Tl(){return 2**++X7}const zx=Object.freeze(Object.defineProperty({__proto__:null,boolean:qe,booleanish:tn,commaOrSpaceSeparated:wr,commaSeparated:ja,number:ae,overloadedBoolean:Nx,spaceSeparated:Ct},Symbol.toStringTag,{value:"Module"})),nb=Object.keys(zx);class Sv extends fr{constructor(e,n,r,i){let s=-1;if(super(e,n),JA(this,"space",i),typeof r=="number")for(;++s<nb.length;){const l=nb[s];JA(this,nb[s],(r&zx[l])===zx[l])}}}Sv.prototype.defined=!0;function JA(t,e,n){n&&(t[e]=n)}function fc(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new Sv(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[Rx(r)]=r,n[Rx(s.attribute)]=r}return new Nd(e,n,t.space)}const cR=fc({properties:{ariaActiveDescendant:null,ariaAtomic:tn,ariaAutoComplete:null,ariaBusy:tn,ariaChecked:tn,ariaColCount:ae,ariaColIndex:ae,ariaColSpan:ae,ariaControls:Ct,ariaCurrent:null,ariaDescribedBy:Ct,ariaDetails:null,ariaDisabled:tn,ariaDropEffect:Ct,ariaErrorMessage:null,ariaExpanded:tn,ariaFlowTo:Ct,ariaGrabbed:tn,ariaHasPopup:null,ariaHidden:tn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ct,ariaLevel:ae,ariaLive:null,ariaModal:tn,ariaMultiLine:tn,ariaMultiSelectable:tn,ariaOrientation:null,ariaOwns:Ct,ariaPlaceholder:null,ariaPosInSet:ae,ariaPressed:tn,ariaReadOnly:tn,ariaRelevant:null,ariaRequired:tn,ariaRoleDescription:Ct,ariaRowCount:ae,ariaRowIndex:ae,ariaRowSpan:ae,ariaSelected:tn,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 uR(t,e){return e in t?t[e]:e}function dR(t,e){return uR(t,e.toLowerCase())}const Q7=fc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ja,acceptCharset:Ct,accessKey:Ct,action:null,allow:null,allowFullScreen:qe,allowPaymentRequest:qe,allowUserMedia:qe,alt:null,as:null,async:qe,autoCapitalize:null,autoComplete:Ct,autoFocus:qe,autoPlay:qe,blocking:Ct,capture:null,charSet:null,checked:qe,cite:null,className:Ct,cols:ae,colSpan:null,content:null,contentEditable:tn,controls:qe,controlsList:Ct,coords:ae|ja,crossOrigin:null,data:null,dateTime:null,decoding:null,default:qe,defer:qe,dir:null,dirName:null,disabled:qe,download:Nx,draggable:tn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:qe,formTarget:null,headers:Ct,height:ae,hidden:Nx,high:ae,href:null,hrefLang:null,htmlFor:Ct,httpEquiv:Ct,id:null,imageSizes:null,imageSrcSet:null,inert:qe,inputMode:null,integrity:null,is:null,isMap:qe,itemId:null,itemProp:Ct,itemRef:Ct,itemScope:qe,itemType:Ct,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:Ct,placeholder:null,playsInline:qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:qe,referrerPolicy:null,rel:Ct,required:qe,reversed:qe,rows:ae,rowSpan:ae,sandbox:Ct,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:tn,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:tn,width:ae,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ct,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:tn,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:dR}),eq=fc({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:wr,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:Ct,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:ja,g2:ja,glyphName:ja,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:wr,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:Ct,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ae,pointsAtY:ae,pointsAtZ:ae,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:wr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:wr,rev:wr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:wr,requiredFeatures:wr,requiredFonts:wr,requiredFormats:wr,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:wr,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:wr,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:wr,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:uR}),fR=fc({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()}}),hR=fc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:dR}),pR=fc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),tq={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"},nq=/[A-Z]/g,XA=/-[a-z]/g,rq=/^data[-\w.:]+$/i;function iq(t,e){const n=Rx(e);let r=e,i=fr;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&rq.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(XA,oq);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!XA.test(s)){let l=s.replace(nq,sq);l.charAt(0)!=="-"&&(l="-"+l),e="data"+l}}i=Sv}return new i(r,e)}function sq(t){return"-"+t.toLowerCase()}function oq(t){return t.charAt(1).toUpperCase()}const lq=aR([cR,Q7,fR,hR,pR],"html"),wv=aR([cR,eq,fR,hR,pR],"svg");function aq(t){return t.join(" ").trim()}var ga={},rb,QA;function cq(){if(QA)return rb;QA=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,u=`
|
|
299
|
+
`,f="/",h="*",m="",g="comment",y="declaration";function v(k,E){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];E=E||{};var j=1,L=1;function J(pe){var H=pe.match(e);H&&(j+=H.length);var I=pe.lastIndexOf(u);L=~I?pe.length-I:L+pe.length}function U(){var pe={line:j,column:L};return function(H){return H.position=new M(pe),K(),H}}function M(pe){this.start=pe,this.end={line:j,column:L},this.source=E.source}M.prototype.content=k;function N(pe){var H=new Error(E.source+":"+j+":"+L+": "+pe);if(H.reason=pe,H.filename=E.source,H.line=j,H.column=L,H.source=k,!E.silent)throw H}function G(pe){var H=pe.exec(k);if(H){var I=H[0];return J(I),k=k.slice(I.length),H}}function K(){G(n)}function ce(pe){var H;for(pe=pe||[];H=ie();)H!==!1&&pe.push(H);return pe}function ie(){var pe=U();if(!(f!=k.charAt(0)||h!=k.charAt(1))){for(var H=2;m!=k.charAt(H)&&(h!=k.charAt(H)||f!=k.charAt(H+1));)++H;if(H+=2,m===k.charAt(H-1))return N("End of comment missing");var I=k.slice(2,H-2);return L+=2,J(I),k=k.slice(H),L+=2,pe({type:g,comment:I})}}function se(){var pe=U(),H=G(r);if(H){if(ie(),!G(i))return N("property missing ':'");var I=G(s),Z=pe({type:y,property:S(H[0].replace(t,m)),value:I?S(I[0].replace(t,m)):m});return G(l),Z}}function xe(){var pe=[];ce(pe);for(var H;H=se();)H!==!1&&(pe.push(H),ce(pe));return pe}return K(),xe()}function S(k){return k?k.replace(c,m):m}return rb=v,rb}var eM;function uq(){if(eM)return ga;eM=1;var t=ga&&ga.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ga,"__esModule",{value:!0}),ga.default=n;const e=t(cq());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const l=(0,e.default)(r),c=typeof i=="function";return l.forEach(u=>{if(u.type!=="declaration")return;const{property:f,value:h}=u;c?i(f,h,u):h&&(s=s||{},s[f]=h)}),s}return ga}var du={},tM;function dq(){if(tM)return du;tM=1,Object.defineProperty(du,"__esModule",{value:!0}),du.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(f){return!f||n.test(f)||t.test(f)},l=function(f,h){return h.toUpperCase()},c=function(f,h){return"".concat(h,"-")},u=function(f,h){return h===void 0&&(h={}),s(f)?f:(f=f.toLowerCase(),h.reactCompat?f=f.replace(i,c):f=f.replace(r,c),f.replace(e,l))};return du.camelCase=u,du}var fu,nM;function fq(){if(nM)return fu;nM=1;var t=fu&&fu.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(uq()),n=dq();function r(i,s){var l={};return!i||typeof i!="string"||(0,e.default)(i,function(c,u){c&&u&&(l[(0,n.camelCase)(c,s)]=u)}),l}return r.default=r,fu=r,fu}var hq=fq();const pq=um(hq),mR=gR("end"),kv=gR("start");function gR(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 mq(t){const e=kv(t),n=mR(t);if(e&&n)return{start:e,end:n}}function Bu(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?rM(t.position):"start"in t||"end"in t?rM(t):"line"in t||"column"in t?Lx(t):""}function Lx(t){return iM(t&&t.line)+":"+iM(t&&t.column)}function rM(t){return Lx(t&&t.start)+"-"+Lx(t&&t.end)}function iM(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 u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const c=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=c?c.line:void 0,this.name=Bu(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 Cv={}.hasOwnProperty,gq=new Map,yq=/[A-Z]/g,bq=new Set(["table","tbody","thead","tfoot","tr"]),xq=new Set(["td","th"]),yR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function vq(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=Mq(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=Aq(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"?wv:lq,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=bR(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function bR(t,e,n){if(e.type==="element")return Sq(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return wq(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Cq(t,e,n);if(e.type==="mdxjsEsm")return kq(t,e);if(e.type==="root")return Eq(t,e,n);if(e.type==="text")return Tq(t,e)}function Sq(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=wv,t.schema=i),t.ancestors.push(e);const s=vR(t,e.tagName,!1),l=Oq(t,e);let c=Tv(t,e);return bq.has(e.tagName)&&(c=c.filter(function(u){return typeof u=="string"?!J7(u):!0})),xR(t,l,s,e),Ev(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function wq(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)}wd(t,e.position)}function kq(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);wd(t,e.position)}function Cq(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=wv,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:vR(t,e.name,!0),l=_q(t,e),c=Tv(t,e);return xR(t,l,s,e),Ev(l,c),t.ancestors.pop(),t.schema=r,t.create(e,s,l,n)}function Eq(t,e,n){const r={};return Ev(r,Tv(t,e)),t.create(e,t.Fragment,r,n)}function Tq(t,e){return e.value}function xR(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function Ev(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Aq(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 Mq(t,e){return n;function n(r,i,s,l){const c=Array.isArray(s.children),u=kv(r);return e(i,s,l,c,{columnNumber:u?u.column-1:void 0,fileName:t,lineNumber:u?u.line:void 0},void 0)}}function Oq(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&Cv.call(e.properties,i)){const s=Dq(t,i,e.properties[i]);if(s){const[l,c]=s;t.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&xq.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 _q(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 wd(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 wd(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Tv(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:gq;for(;++r<e.children.length;){const s=e.children[r];let l;if(t.passKeys){const u=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(u){const f=i.get(u)||0;l=u+"-"+f,i.set(u,f+1)}}const c=bR(t,s,l);c!==void 0&&n.push(c)}return n}function Dq(t,e,n){const r=iq(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?K7(n):aq(n)),r.property==="style"){let i=typeof n=="object"?n:Rq(t,String(n));return t.stylePropertyNameCase==="css"&&(i=Nq(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?tq[r.property]||r.property:r.attribute,n]}}function Rq(t,e){try{return pq(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=yR+"#cannot-parse-style-attribute",i}}function vR(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=GA(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=GA(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return Cv.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);wd(t)}function wd(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=yR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Nq(t){const e={};let n;for(n in t)Cv.call(t,n)&&(e[zq(n)]=t[n]);return e}function zq(t){let e=t.replace(yq,Lq);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function Lq(t){return"-"+t.toLowerCase()}const ib={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"]},Iq={};function jq(t,e){const n=Iq,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return SR(t,r,i)}function SR(t,e,n){if(Bq(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 sM(t.children,e,n)}return Array.isArray(t)?sM(t,e,n):""}function sM(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=SR(t[i],e,n);return r.join("")}function Bq(t){return!!(t&&typeof t=="object")}const oM=document.createElement("i");function Av(t){const e="&"+t+";";oM.innerHTML=e;const n=oM.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Ii(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 Kr(t,e){return t.length>0?(Ii(t,t.length,0,e),t):e}const lM={}.hasOwnProperty;function Uq(t){const e={};let n=-1;for(;++n<t.length;)Hq(e,t[n]);return e}function Hq(t,e){let n;for(n in e){const i=(lM.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let l;if(s)for(l in s){lM.call(i,l)||(i[l]=[]);const c=s[l];$q(i[l],Array.isArray(c)?c:c?[c]:[])}}}function $q(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Ii(t,0,0,r)}function wR(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ba(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ti=Co(/[A-Za-z]/),Ar=Co(/[\dA-Za-z]/),Vq=Co(/[#-'*+\--9=?A-Z^-~]/);function Ix(t){return t!==null&&(t<32||t===127)}const jx=Co(/\d/),Pq=Co(/[\dA-Fa-f]/),Fq=Co(/[!-/:-@[-`{-~]/);function Ie(t){return t!==null&&t<-2}function ur(t){return t!==null&&(t<0||t===32)}function mt(t){return t===-2||t===-1||t===32}const qq=Co(new RegExp("\\p{P}|\\p{S}","u")),Kq=Co(/\s/);function Co(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function hc(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let l="";if(s===37&&Ar(t.charCodeAt(n+1))&&Ar(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 Et(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return l;function l(u){return mt(u)?(t.enter(n),c(u)):e(u)}function c(u){return mt(u)&&s++<i?(t.consume(u),c):(t.exit(n),e(u))}}const Yq={tokenize:Wq};function Wq(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"),Et(t,e,"linePrefix")}function i(c){return t.enter("paragraph"),s(c)}function s(c){const u=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,l(c)}function l(c){if(c===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(c);return}return Ie(c)?(t.consume(c),t.exit("chunkText"),s):(t.consume(c),l)}}const Gq={tokenize:Zq},aM={tokenize:Jq};function Zq(t){const e=this,n=[];let r=0,i,s,l;return c;function c(L){if(r<n.length){const J=n[r];return e.containerState=J[1],t.attempt(J[0].continuation,u,f)(L)}return f(L)}function u(L){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&j();const J=e.events.length;let U=J,M;for(;U--;)if(e.events[U][0]==="exit"&&e.events[U][1].type==="chunkFlow"){M=e.events[U][1].end;break}E(r);let N=J;for(;N<e.events.length;)e.events[N][1].end={...M},N++;return Ii(e.events,U+1,0,e.events.slice(J)),e.events.length=N,f(L)}return c(L)}function f(L){if(r===n.length){if(!i)return g(L);if(i.currentConstruct&&i.currentConstruct.concrete)return v(L);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(aM,h,m)(L)}function h(L){return i&&j(),E(r),g(L)}function m(L){return e.parser.lazy[e.now().line]=r!==n.length,l=e.now().offset,v(L)}function g(L){return e.containerState={},t.attempt(aM,y,v)(L)}function y(L){return r++,n.push([e.currentConstruct,e.containerState]),g(L)}function v(L){if(L===null){i&&j(),E(0),t.consume(L);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),S(L)}function S(L){if(L===null){k(t.exit("chunkFlow"),!0),E(0),t.consume(L);return}return Ie(L)?(t.consume(L),k(t.exit("chunkFlow")),r=0,e.interrupt=void 0,c):(t.consume(L),S)}function k(L,J){const U=e.sliceStream(L);if(J&&U.push(null),L.previous=s,s&&(s.next=L),s=L,i.defineSkip(L.start),i.write(U),e.parser.lazy[L.start.line]){let M=i.events.length;for(;M--;)if(i.events[M][1].start.offset<l&&(!i.events[M][1].end||i.events[M][1].end.offset>l))return;const N=e.events.length;let G=N,K,ce;for(;G--;)if(e.events[G][0]==="exit"&&e.events[G][1].type==="chunkFlow"){if(K){ce=e.events[G][1].end;break}K=!0}for(E(r),M=N;M<e.events.length;)e.events[M][1].end={...ce},M++;Ii(e.events,G+1,0,e.events.slice(N)),e.events.length=M}}function E(L){let J=n.length;for(;J-- >L;){const U=n[J];e.containerState=U[1],U[0].exit.call(e,t)}n.length=L}function j(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function Jq(t,e,n){return Et(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function cM(t){if(t===null||ur(t)||Kq(t))return 1;if(qq(t))return 2}function Mv(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 Bx={name:"attention",resolveAll:Xq,tokenize:Qq};function Xq(t,e){let n=-1,r,i,s,l,c,u,f,h;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;u=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};uM(m,-u),uM(g,u),l={type:u>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},c={type:u>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},s={type:u>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},t[r][1].end={...l.start},t[n][1].start={...c.end},f=[],t[r][1].end.offset-t[r][1].start.offset&&(f=Kr(f,[["enter",t[r][1],e],["exit",t[r][1],e]])),f=Kr(f,[["enter",i,e],["enter",l,e],["exit",l,e],["enter",s,e]]),f=Kr(f,Mv(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),f=Kr(f,[["exit",s,e],["enter",c,e],["exit",c,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(h=2,f=Kr(f,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,Ii(t,r-1,n-r+3,f),n=r+f.length-h-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function Qq(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=cM(r);let s;return l;function l(u){return s=u,t.enter("attentionSequence"),c(u)}function c(u){if(u===s)return t.consume(u),c;const f=t.exit("attentionSequence"),h=cM(u),m=!h||h===2&&i||n.includes(u),g=!i||i===2&&h||n.includes(r);return f._open=!!(s===42?m:m&&(i||!g)),f._close=!!(s===42?g:g&&(h||!m)),e(u)}}function uM(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const eK={name:"autolink",tokenize:tK};function tK(t,e,n){let r=0;return i;function i(y){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(y),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(y){return Ti(y)?(t.consume(y),l):y===64?n(y):f(y)}function l(y){return y===43||y===45||y===46||Ar(y)?(r=1,c(y)):f(y)}function c(y){return y===58?(t.consume(y),r=0,u):(y===43||y===45||y===46||Ar(y))&&r++<32?(t.consume(y),c):(r=0,f(y))}function u(y){return y===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(y),t.exit("autolinkMarker"),t.exit("autolink"),e):y===null||y===32||y===60||Ix(y)?n(y):(t.consume(y),u)}function f(y){return y===64?(t.consume(y),h):Vq(y)?(t.consume(y),f):n(y)}function h(y){return Ar(y)?m(y):n(y)}function m(y){return y===46?(t.consume(y),r=0,h):y===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(y),t.exit("autolinkMarker"),t.exit("autolink"),e):g(y)}function g(y){if((y===45||Ar(y))&&r++<63){const v=y===45?g:m;return t.consume(y),v}return n(y)}}const Vm={partial:!0,tokenize:nK};function nK(t,e,n){return r;function r(s){return mt(s)?Et(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Ie(s)?e(s):n(s)}}const kR={continuation:{tokenize:iK},exit:sK,name:"blockQuote",tokenize:rK};function rK(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 mt(l)?(t.enter("blockQuotePrefixWhitespace"),t.consume(l),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(l))}}function iK(t,e,n){const r=this;return i;function i(l){return mt(l)?Et(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):s(l)}function s(l){return t.attempt(kR,e,n)(l)}}function sK(t){t.exit("blockQuote")}const CR={name:"characterEscape",tokenize:oK};function oK(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 Fq(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const ER={name:"characterReference",tokenize:lK};function lK(t,e,n){const r=this;let i=0,s,l;return c;function c(m){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),u}function u(m){return m===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(m),t.exit("characterReferenceMarkerNumeric"),f):(t.enter("characterReferenceValue"),s=31,l=Ar,h(m))}function f(m){return m===88||m===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(m),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,l=Pq,h):(t.enter("characterReferenceValue"),s=7,l=jx,h(m))}function h(m){if(m===59&&i){const g=t.exit("characterReferenceValue");return l===Ar&&!Av(r.sliceSerialize(g))?n(m):(t.enter("characterReferenceMarker"),t.consume(m),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return l(m)&&i++<s?(t.consume(m),h):n(m)}}const dM={partial:!0,tokenize:cK},fM={concrete:!0,name:"codeFenced",tokenize:aK};function aK(t,e,n){const r=this,i={partial:!0,tokenize:U};let s=0,l=0,c;return u;function u(M){return f(M)}function f(M){const N=r.events[r.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,c=M,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),h(M)}function h(M){return M===c?(l++,t.consume(M),h):l<3?n(M):(t.exit("codeFencedFenceSequence"),mt(M)?Et(t,m,"whitespace")(M):m(M))}function m(M){return M===null||Ie(M)?(t.exit("codeFencedFence"),r.interrupt?e(M):t.check(dM,S,J)(M)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(M))}function g(M){return M===null||Ie(M)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),m(M)):mt(M)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Et(t,y,"whitespace")(M)):M===96&&M===c?n(M):(t.consume(M),g)}function y(M){return M===null||Ie(M)?m(M):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),v(M))}function v(M){return M===null||Ie(M)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),m(M)):M===96&&M===c?n(M):(t.consume(M),v)}function S(M){return t.attempt(i,J,k)(M)}function k(M){return t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),E}function E(M){return s>0&&mt(M)?Et(t,j,"linePrefix",s+1)(M):j(M)}function j(M){return M===null||Ie(M)?t.check(dM,S,J)(M):(t.enter("codeFlowValue"),L(M))}function L(M){return M===null||Ie(M)?(t.exit("codeFlowValue"),j(M)):(t.consume(M),L)}function J(M){return t.exit("codeFenced"),e(M)}function U(M,N,G){let K=0;return ce;function ce(H){return M.enter("lineEnding"),M.consume(H),M.exit("lineEnding"),ie}function ie(H){return M.enter("codeFencedFence"),mt(H)?Et(M,se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):se(H)}function se(H){return H===c?(M.enter("codeFencedFenceSequence"),xe(H)):G(H)}function xe(H){return H===c?(K++,M.consume(H),xe):K>=l?(M.exit("codeFencedFenceSequence"),mt(H)?Et(M,pe,"whitespace")(H):pe(H)):G(H)}function pe(H){return H===null||Ie(H)?(M.exit("codeFencedFence"),N(H)):G(H)}}}function cK(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 sb={name:"codeIndented",tokenize:dK},uK={partial:!0,tokenize:fK};function dK(t,e,n){const r=this;return i;function i(f){return t.enter("codeIndented"),Et(t,s,"linePrefix",5)(f)}function s(f){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?l(f):n(f)}function l(f){return f===null?u(f):Ie(f)?t.attempt(uK,l,u)(f):(t.enter("codeFlowValue"),c(f))}function c(f){return f===null||Ie(f)?(t.exit("codeFlowValue"),l(f)):(t.consume(f),c)}function u(f){return t.exit("codeIndented"),e(f)}}function fK(t,e,n){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?n(l):Ie(l)?(t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),i):Et(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):Ie(l)?i(l):n(l)}}const hK={name:"codeText",previous:mK,resolve:pK,tokenize:gK};function pK(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 mK(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function gK(t,e,n){let r=0,i,s;return l;function l(m){return t.enter("codeText"),t.enter("codeTextSequence"),c(m)}function c(m){return m===96?(t.consume(m),r++,c):(t.exit("codeTextSequence"),u(m))}function u(m){return m===null?n(m):m===32?(t.enter("space"),t.consume(m),t.exit("space"),u):m===96?(s=t.enter("codeTextSequence"),i=0,h(m)):Ie(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),u):(t.enter("codeTextData"),f(m))}function f(m){return m===null||m===32||m===96||Ie(m)?(t.exit("codeTextData"),u(m)):(t.consume(m),f)}function h(m){return m===96?(t.consume(m),i++,h):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(m)):(s.type="codeTextData",f(m))}}class yK{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&&hu(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),hu(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),hu(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);hu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);hu(this.left,n.reverse())}}}function hu(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 TR(t){const e={};let n=-1,r,i,s,l,c,u,f;const h=new yK(t);for(;++n<h.length;){for(;n in e;)n=e[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,s=0,s<u.length&&u[s][1].type==="lineEndingBlank"&&(s+=2),s<u.length&&u[s][1].type==="content"))for(;++s<u.length&&u[s][1].type!=="content";)u[s][1].type==="chunkText"&&(u[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,bK(h,n)),n=e[n],f=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(l=h.get(s),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=s);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...h.get(i)[1].start},c=h.slice(i,n),c.unshift(r),h.splice(i,n-i+1,c))}}return Ii(t,0,Number.POSITIVE_INFINITY,h.slice(0)),!f}function bK(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,u=[],f={};let h,m,g=-1,y=n,v=0,S=0;const k=[S];for(;y;){for(;t.get(++i)[1]!==y;);s.push(i),y._tokenizer||(h=r.sliceStream(y),y.next||h.push(null),m&&l.defineSkip(y.start),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(h),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),m=y,y=y.next}for(y=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&&(S=g+1,k.push(S),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(l.events=[],y?(y._tokenizer=void 0,y.previous=void 0):k.pop(),g=k.length;g--;){const E=c.slice(k[g],k[g+1]),j=s.pop();u.push([j,j+E.length-1]),t.splice(j,2,E)}for(u.reverse(),g=-1;++g<u.length;)f[v+u[g][0]]=v+u[g][1],v+=u[g][1]-u[g][0]-1;return f}const xK={resolve:SK,tokenize:wK},vK={partial:!0,tokenize:kK};function SK(t){return TR(t),t}function wK(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):Ie(c)?t.check(vK,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 kK(t,e,n){const r=this;return i;function i(l){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(l),t.exit("lineEnding"),Et(t,s,"linePrefix")}function s(l){if(l===null||Ie(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 AR(t,e,n,r,i,s,l,c,u){const f=u||Number.POSITIVE_INFINITY;let h=0;return m;function m(E){return E===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(E),t.exit(s),g):E===null||E===32||E===41||Ix(E)?n(E):(t.enter(r),t.enter(l),t.enter(c),t.enter("chunkString",{contentType:"string"}),S(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"}),y(E))}function y(E){return E===62?(t.exit("chunkString"),t.exit(c),g(E)):E===null||E===60||Ie(E)?n(E):(t.consume(E),E===92?v:y)}function v(E){return E===60||E===62||E===92?(t.consume(E),y):y(E)}function S(E){return!h&&(E===null||E===41||ur(E))?(t.exit("chunkString"),t.exit(c),t.exit(l),t.exit(r),e(E)):h<f&&E===40?(t.consume(E),h++,S):E===41?(t.consume(E),h--,S):E===null||E===32||E===40||Ix(E)?n(E):(t.consume(E),E===92?k:S)}function k(E){return E===40||E===41||E===92?(t.consume(E),S):S(E)}}function MR(t,e,n,r,i,s){const l=this;let c=0,u;return f;function f(y){return t.enter(r),t.enter(i),t.consume(y),t.exit(i),t.enter(s),h}function h(y){return c>999||y===null||y===91||y===93&&!u||y===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(y):y===93?(t.exit(s),t.enter(i),t.consume(y),t.exit(i),t.exit(r),e):Ie(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===null||y===91||y===93||Ie(y)||c++>999?(t.exit("chunkString"),h(y)):(t.consume(y),u||(u=!mt(y)),y===92?g:m)}function g(y){return y===91||y===92||y===93?(t.consume(y),c++,m):m(y)}}function OR(t,e,n,r,i,s){let l;return c;function c(g){return g===34||g===39||g===40?(t.enter(r),t.enter(i),t.consume(g),t.exit(i),l=g===40?41:g,u):n(g)}function u(g){return g===l?(t.enter(i),t.consume(g),t.exit(i),t.exit(r),e):(t.enter(s),f(g))}function f(g){return g===l?(t.exit(s),u(l)):g===null?n(g):Ie(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Et(t,f,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===l||g===null||Ie(g)?(t.exit("chunkString"),f(g)):(t.consume(g),g===92?m:h)}function m(g){return g===l||g===92?(t.consume(g),h):h(g)}}function Uu(t,e){let n;return r;function r(i){return Ie(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):mt(i)?Et(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const CK={name:"definition",tokenize:TK},EK={partial:!0,tokenize:AK};function TK(t,e,n){const r=this;let i;return s;function s(y){return t.enter("definition"),l(y)}function l(y){return MR.call(r,t,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function c(y){return i=Ba(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),u):n(y)}function u(y){return ur(y)?Uu(t,f)(y):f(y)}function f(y){return AR(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function h(y){return t.attempt(EK,m,m)(y)}function m(y){return mt(y)?Et(t,g,"whitespace")(y):g(y)}function g(y){return y===null||Ie(y)?(t.exit("definition"),r.parser.defined.push(i),e(y)):n(y)}}function AK(t,e,n){return r;function r(c){return ur(c)?Uu(t,i)(c):n(c)}function i(c){return OR(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return mt(c)?Et(t,l,"whitespace")(c):l(c)}function l(c){return c===null||Ie(c)?e(c):n(c)}}const MK={name:"hardBreakEscape",tokenize:OK};function OK(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Ie(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const _K={name:"headingAtx",resolve:DK,tokenize:RK};function DK(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"},Ii(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function RK(t,e,n){let r=0;return i;function i(h){return t.enter("atxHeading"),s(h)}function s(h){return t.enter("atxHeadingSequence"),l(h)}function l(h){return h===35&&r++<6?(t.consume(h),l):h===null||ur(h)?(t.exit("atxHeadingSequence"),c(h)):n(h)}function c(h){return h===35?(t.enter("atxHeadingSequence"),u(h)):h===null||Ie(h)?(t.exit("atxHeading"),e(h)):mt(h)?Et(t,c,"whitespace")(h):(t.enter("atxHeadingText"),f(h))}function u(h){return h===35?(t.consume(h),u):(t.exit("atxHeadingSequence"),c(h))}function f(h){return h===null||h===35||ur(h)?(t.exit("atxHeadingText"),c(h)):(t.consume(h),f)}}const NK=["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"],hM=["pre","script","style","textarea"],zK={concrete:!0,name:"htmlFlow",resolveTo:jK,tokenize:BK},LK={partial:!0,tokenize:HK},IK={partial:!0,tokenize:UK};function jK(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 BK(t,e,n){const r=this;let i,s,l,c,u;return f;function f(T){return h(T)}function h(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,S):T===63?(t.consume(T),i=3,r.interrupt?e:O):Ti(T)?(t.consume(T),l=String.fromCharCode(T),k):n(T)}function g(T){return T===45?(t.consume(T),i=2,y):T===91?(t.consume(T),i=5,c=0,v):Ti(T)?(t.consume(T),i=4,r.interrupt?e:O):n(T)}function y(T){return T===45?(t.consume(T),r.interrupt?e:O):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 S(T){return Ti(T)?(t.consume(T),l=String.fromCharCode(T),k):n(T)}function k(T){if(T===null||T===47||T===62||ur(T)){const F=T===47,ue=l.toLowerCase();return!F&&!s&&hM.includes(ue)?(i=1,r.interrupt?e(T):se(T)):NK.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?j(T):L(T))}return T===45||Ar(T)?(t.consume(T),l+=String.fromCharCode(T),k):n(T)}function E(T){return T===62?(t.consume(T),r.interrupt?e:se):n(T)}function j(T){return mt(T)?(t.consume(T),j):ce(T)}function L(T){return T===47?(t.consume(T),ce):T===58||T===95||Ti(T)?(t.consume(T),J):mt(T)?(t.consume(T),L):ce(T)}function J(T){return T===45||T===46||T===58||T===95||Ar(T)?(t.consume(T),J):U(T)}function U(T){return T===61?(t.consume(T),M):mt(T)?(t.consume(T),U):L(T)}function M(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(t.consume(T),u=T,N):mt(T)?(t.consume(T),M):G(T)}function N(T){return T===u?(t.consume(T),u=null,K):T===null||Ie(T)?n(T):(t.consume(T),N)}function G(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||ur(T)?U(T):(t.consume(T),G)}function K(T){return T===47||T===62||mt(T)?L(T):n(T)}function ce(T){return T===62?(t.consume(T),ie):n(T)}function ie(T){return T===null||Ie(T)?se(T):mt(T)?(t.consume(T),ie):n(T)}function se(T){return T===45&&i===2?(t.consume(T),I):T===60&&i===1?(t.consume(T),Z):T===62&&i===4?(t.consume(T),D):T===63&&i===3?(t.consume(T),O):T===93&&i===5?(t.consume(T),Me):Ie(T)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(LK,$,xe)(T)):T===null||Ie(T)?(t.exit("htmlFlowData"),xe(T)):(t.consume(T),se)}function xe(T){return t.check(IK,pe,$)(T)}function pe(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),H}function H(T){return T===null||Ie(T)?xe(T):(t.enter("htmlFlowData"),se(T))}function I(T){return T===45?(t.consume(T),O):se(T)}function Z(T){return T===47?(t.consume(T),l="",me):se(T)}function me(T){if(T===62){const F=l.toLowerCase();return hM.includes(F)?(t.consume(T),D):se(T)}return Ti(T)&&l.length<8?(t.consume(T),l+=String.fromCharCode(T),me):se(T)}function Me(T){return T===93?(t.consume(T),O):se(T)}function O(T){return T===62?(t.consume(T),D):T===45&&i===2?(t.consume(T),O):se(T)}function D(T){return T===null||Ie(T)?(t.exit("htmlFlowData"),$(T)):(t.consume(T),D)}function $(T){return t.exit("htmlFlow"),e(T)}}function UK(t,e,n){const r=this;return i;function i(l){return Ie(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 HK(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Vm,e,n)}}const $K={name:"htmlText",tokenize:VK};function VK(t,e,n){const r=this;let i,s,l;return c;function c(O){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(O),u}function u(O){return O===33?(t.consume(O),f):O===47?(t.consume(O),U):O===63?(t.consume(O),L):Ti(O)?(t.consume(O),G):n(O)}function f(O){return O===45?(t.consume(O),h):O===91?(t.consume(O),s=0,v):Ti(O)?(t.consume(O),j):n(O)}function h(O){return O===45?(t.consume(O),y):n(O)}function m(O){return O===null?n(O):O===45?(t.consume(O),g):Ie(O)?(l=m,Z(O)):(t.consume(O),m)}function g(O){return O===45?(t.consume(O),y):m(O)}function y(O){return O===62?I(O):O===45?g(O):m(O)}function v(O){const D="CDATA[";return O===D.charCodeAt(s++)?(t.consume(O),s===D.length?S:v):n(O)}function S(O){return O===null?n(O):O===93?(t.consume(O),k):Ie(O)?(l=S,Z(O)):(t.consume(O),S)}function k(O){return O===93?(t.consume(O),E):S(O)}function E(O){return O===62?I(O):O===93?(t.consume(O),E):S(O)}function j(O){return O===null||O===62?I(O):Ie(O)?(l=j,Z(O)):(t.consume(O),j)}function L(O){return O===null?n(O):O===63?(t.consume(O),J):Ie(O)?(l=L,Z(O)):(t.consume(O),L)}function J(O){return O===62?I(O):L(O)}function U(O){return Ti(O)?(t.consume(O),M):n(O)}function M(O){return O===45||Ar(O)?(t.consume(O),M):N(O)}function N(O){return Ie(O)?(l=N,Z(O)):mt(O)?(t.consume(O),N):I(O)}function G(O){return O===45||Ar(O)?(t.consume(O),G):O===47||O===62||ur(O)?K(O):n(O)}function K(O){return O===47?(t.consume(O),I):O===58||O===95||Ti(O)?(t.consume(O),ce):Ie(O)?(l=K,Z(O)):mt(O)?(t.consume(O),K):I(O)}function ce(O){return O===45||O===46||O===58||O===95||Ar(O)?(t.consume(O),ce):ie(O)}function ie(O){return O===61?(t.consume(O),se):Ie(O)?(l=ie,Z(O)):mt(O)?(t.consume(O),ie):K(O)}function se(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(t.consume(O),i=O,xe):Ie(O)?(l=se,Z(O)):mt(O)?(t.consume(O),se):(t.consume(O),pe)}function xe(O){return O===i?(t.consume(O),i=void 0,H):O===null?n(O):Ie(O)?(l=xe,Z(O)):(t.consume(O),xe)}function pe(O){return O===null||O===34||O===39||O===60||O===61||O===96?n(O):O===47||O===62||ur(O)?K(O):(t.consume(O),pe)}function H(O){return O===47||O===62||ur(O)?K(O):n(O)}function I(O){return O===62?(t.consume(O),t.exit("htmlTextData"),t.exit("htmlText"),e):n(O)}function Z(O){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),me}function me(O){return mt(O)?Et(t,Me,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):Me(O)}function Me(O){return t.enter("htmlTextData"),l(O)}}const Ov={name:"labelEnd",resolveAll:KK,resolveTo:YK,tokenize:WK},PK={tokenize:GK},FK={tokenize:ZK},qK={tokenize:JK};function KK(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&&Ii(t,0,t.length,n),t}function YK(t,e){let n=t.length,r=0,i,s,l,c;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=n);const u={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},f={type:"label",start:{...t[s][1].start},end:{...t[l][1].end}},h={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[l-2][1].start}};return c=[["enter",u,e],["enter",f,e]],c=Kr(c,t.slice(s+1,s+r+3)),c=Kr(c,[["enter",h,e]]),c=Kr(c,Mv(e.parser.constructs.insideSpan.null,t.slice(s+r+4,l-3),e)),c=Kr(c,[["exit",h,e],t[l-2],t[l-1],["exit",f,e]]),c=Kr(c,t.slice(l+1)),c=Kr(c,[["exit",u,e]]),Ii(t,s,t.length,c),t}function WK(t,e,n){const r=this;let i=r.events.length,s,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return c;function c(g){return s?s._inactive?m(g):(l=r.parser.defined.includes(Ba(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),u):n(g)}function u(g){return g===40?t.attempt(PK,h,l?h:m)(g):g===91?t.attempt(FK,h,l?f:m)(g):l?h(g):m(g)}function f(g){return t.attempt(qK,h,m)(g)}function h(g){return e(g)}function m(g){return s._balanced=!0,n(g)}}function GK(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 ur(m)?Uu(t,s)(m):s(m)}function s(m){return m===41?h(m):AR(t,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function l(m){return ur(m)?Uu(t,u)(m):h(m)}function c(m){return n(m)}function u(m){return m===34||m===39||m===40?OR(t,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):h(m)}function f(m){return ur(m)?Uu(t,h)(m):h(m)}function h(m){return m===41?(t.enter("resourceMarker"),t.consume(m),t.exit("resourceMarker"),t.exit("resource"),e):n(m)}}function ZK(t,e,n){const r=this;return i;function i(c){return MR.call(r,t,s,l,"reference","referenceMarker","referenceString")(c)}function s(c){return r.parser.defined.includes(Ba(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(c):n(c)}function l(c){return n(c)}}function JK(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 XK={name:"labelStartImage",resolveAll:Ov.resolveAll,tokenize:QK};function QK(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 eY={name:"labelStartLink",resolveAll:Ov.resolveAll,tokenize:tY};function tY(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 ob={name:"lineEnding",tokenize:nY};function nY(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Et(t,e,"linePrefix")}}const Ph={name:"thematicBreak",tokenize:rY};function rY(t,e,n){let r=0,i;return s;function s(f){return t.enter("thematicBreak"),l(f)}function l(f){return i=f,c(f)}function c(f){return f===i?(t.enter("thematicBreakSequence"),u(f)):r>=3&&(f===null||Ie(f))?(t.exit("thematicBreak"),e(f)):n(f)}function u(f){return f===i?(t.consume(f),r++,u):(t.exit("thematicBreakSequence"),mt(f)?Et(t,c,"whitespace")(f):c(f))}}const or={continuation:{tokenize:lY},exit:cY,name:"list",tokenize:oY},iY={partial:!0,tokenize:uY},sY={partial:!0,tokenize:aY};function oY(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(y){const v=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:jx(y)){if(r.containerState.type||(r.containerState.type=v,t.enter(v,{_container:!0})),v==="listUnordered")return t.enter("listItemPrefix"),y===42||y===45?t.check(Ph,n,f)(y):f(y);if(!r.interrupt||y===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),u(y)}return n(y)}function u(y){return jx(y)&&++l<10?(t.consume(y),u):(!r.interrupt||l<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(t.exit("listItemValue"),f(y)):n(y)}function f(y){return t.enter("listItemMarker"),t.consume(y),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,t.check(Vm,r.interrupt?n:h,t.attempt(iY,g,m))}function h(y){return r.containerState.initialBlankLine=!0,s++,g(y)}function m(y){return mt(y)?(t.enter("listItemPrefixWhitespace"),t.consume(y),t.exit("listItemPrefixWhitespace"),g):n(y)}function g(y){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(y)}}function lY(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Vm,i,s);function i(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Et(t,e,"listItemIndent",r.containerState.size+1)(c)}function s(c){return r.containerState.furtherBlankLines||!mt(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(sY,e,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Et(t,t.attempt(or,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function aY(t,e,n){const r=this;return Et(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 cY(t){t.exit(this.containerState.type)}function uY(t,e,n){const r=this;return Et(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!mt(s)&&l&&l[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const pM={name:"setextUnderline",resolveTo:dY,tokenize:fY};function dY(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 fY(t,e,n){const r=this;let i;return s;function s(f){let h=r.events.length,m;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){m=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),i=f,l(f)):n(f)}function l(f){return t.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===i?(t.consume(f),c):(t.exit("setextHeadingLineSequence"),mt(f)?Et(t,u,"lineSuffix")(f):u(f))}function u(f){return f===null||Ie(f)?(t.exit("setextHeadingLine"),e(f)):n(f)}}const hY={tokenize:pY};function pY(t){const e=this,n=t.attempt(Vm,r,t.attempt(this.parser.constructs.flowInitial,i,Et(t,t.attempt(this.parser.constructs.flow,i,t.attempt(xK,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 mY={resolveAll:DR()},gY=_R("string"),yY=_R("text");function _R(t){return{resolveAll:DR(t==="text"?bY:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,l,c);return l;function l(h){return f(h)?s(h):c(h)}function c(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),u}function u(h){return f(h)?(n.exit("data"),s(h)):(n.consume(h),u)}function f(h){if(h===null)return!0;const m=i[h];let g=-1;if(m)for(;++g<m.length;){const y=m[g];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function DR(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 bY(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,l=-1,c=0,u;for(;s--;){const f=i[s];if(typeof f=="string"){for(l=f.length;f.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(f===-2)u=!0,c++;else if(f!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(c=0),c){const f={type:n===t.length||u||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?l:r.start._bufferIndex+l,_index:r.start._index+s,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(t.splice(n,0,["enter",f,e],["exit",f,e]),n+=2)}n++}return t}const xY={42:or,43:or,45:or,48:or,49:or,50:or,51:or,52:or,53:or,54:or,55:or,56:or,57:or,62:kR},vY={91:CK},SY={[-2]:sb,[-1]:sb,32:sb},wY={35:_K,42:Ph,45:[pM,Ph],60:zK,61:pM,95:Ph,96:fM,126:fM},kY={38:ER,92:CR},CY={[-5]:ob,[-4]:ob,[-3]:ob,33:XK,38:ER,42:Bx,60:[eK,$K],91:eY,92:[MK,CR],93:Ov,95:Bx,96:hK},EY={null:[Bx,mY]},TY={null:[42,95]},AY={null:[]},MY=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:TY,contentInitial:vY,disable:AY,document:xY,flow:wY,flowInitial:SY,insideSpan:EY,string:kY,text:CY},Symbol.toStringTag,{value:"Module"}));function OY(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let l=[],c=[];const u={attempt:N(U),check:N(M),consume:j,enter:L,exit:J,interrupt:N(M,{interrupt:!0})},f={code:null,containerState:{},defineSkip:S,events:[],now:v,parser:t,previous:null,sliceSerialize:g,sliceStream:y,write:m};let h=e.tokenize.call(f,u);return e.resolveAll&&s.push(e),f;function m(ie){return l=Kr(l,ie),k(),l[l.length-1]!==null?[]:(G(e,0),f.events=Mv(s,f.events,f),f.events)}function g(ie,se){return DY(y(ie),se)}function y(ie){return _Y(l,ie)}function v(){const{_bufferIndex:ie,_index:se,line:xe,column:pe,offset:H}=r;return{_bufferIndex:ie,_index:se,line:xe,column:pe,offset:H}}function S(ie){i[ie.line]=ie.column,ce()}function k(){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){h=h(ie)}function j(ie){Ie(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 L(ie,se){const xe=se||{};return xe.type=ie,xe.start=v(),f.events.push(["enter",xe,f]),c.push(xe),xe}function J(ie){const se=c.pop();return se.end=v(),f.events.push(["exit",se,f]),se}function U(ie,se){G(ie,se.from)}function M(ie,se){se.restore()}function N(ie,se){return xe;function xe(pe,H,I){let Z,me,Me,O;return Array.isArray(pe)?$(pe):"tokenize"in pe?$([pe]):D(pe);function D(le){return Ne;function Ne(Be){const je=Be!==null&&le[Be],Xe=Be!==null&&le.null,Oe=[...Array.isArray(je)?je:je?[je]:[],...Array.isArray(Xe)?Xe:Xe?[Xe]:[]];return $(Oe)(Be)}}function $(le){return Z=le,me=0,le.length===0?I:T(le[me])}function T(le){return Ne;function Ne(Be){return O=K(),Me=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,u,F,ue)(Be)}}function F(le){return ie(Me,O),H}function ue(le){return O.restore(),++me<Z.length?T(Z[me]):I}}}function G(ie,se){ie.resolveAll&&!s.includes(ie)&&s.push(ie),ie.resolve&&Ii(f.events,se,f.events.length-se,ie.resolve(f.events.slice(se),f)),ie.resolveTo&&(f.events=ie.resolveTo(f.events,f))}function K(){const ie=v(),se=f.previous,xe=f.currentConstruct,pe=f.events.length,H=Array.from(c);return{from:pe,restore:I};function I(){r=ie,f.previous=se,f.currentConstruct=xe,f.events.length=pe,c=H,ce()}}function ce(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function _Y(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 DY(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=`
|
|
300
|
+
`;break}case-3:{l=`\r
|
|
301
|
+
`;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 RY(t){const r={constructs:Uq([MY,...(t||{}).extensions||[]]),content:i(Yq),defined:[],document:i(Gq),flow:i(hY),lazy:{},string:i(gY),text:i(yY)};return r;function i(s){return l;function l(c){return OY(r,s,c)}}}function NY(t){for(;!TR(t););return t}const mM=/[\0\t\n\r]/g;function zY(){let t=1,e="",n=!0,r;return i;function i(s,l,c){const u=[];let f,h,m,g,y;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(mM.lastIndex=m,f=mM.exec(s),g=f&&f.index!==void 0?f.index:s.length,y=s.charCodeAt(g),!f){e=s.slice(m);break}if(y===10&&m===g&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),m<g&&(u.push(s.slice(m,g)),t+=g-m),y){case 0:{u.push(65533),t++;break}case 9:{for(h=Math.ceil(t/4)*4,u.push(-2);t++<h;)u.push(-1);break}case 10:{u.push(-4),t=1;break}default:r=!0,t=1}m=g+1}return c&&(r&&u.push(-5),e&&u.push(e),u.push(null)),u}}const LY=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function IY(t){return t.replace(LY,jY)}function jY(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return wR(n.slice(s?2:1),s?16:10)}return Av(n)||t}const RR={}.hasOwnProperty;function BY(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),UY(n)(NY(RY(n).document().write(zY()(t,e,!0))))}function UY(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ft),autolinkProtocol:K,autolinkEmail:K,atxHeading:s(Zt),blockQuote:s(Xe),characterEscape:K,characterReference:K,codeFenced:s(Oe),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(Oe,l),codeText:s(Ke,l),codeTextData:K,data:K,codeFlowValue:K,definition:s(Mt),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s(Ot),hardBreakEscape:s($n),hardBreakTrailing:s($n),htmlFlow:s(hr,l),htmlFlowData:K,htmlText:s(hr,l),htmlTextData:K,image:s(Vn),label:l,link:s(Ft),listItem:s(ni),listItemValue:g,listOrdered:s(pr,m),listUnordered:s(pr),paragraph:s(Hi),reference:T,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(Zt),strong:s(_r),thematicBreak:s($i)},exit:{atxHeading:u(),atxHeadingSequence:U,autolink:u(),autolinkEmail:je,autolinkProtocol:Be,blockQuote:u(),characterEscapeValue:ce,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:le,characterReference:Ne,codeFenced:u(k),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:v,codeFlowValue:ce,codeIndented:u(E),codeText:u(H),codeTextData:ce,data:ce,definition:u(),definitionDestinationString:J,definitionLabelString:j,definitionTitleString:L,emphasis:u(),hardBreakEscape:u(se),hardBreakTrailing:u(se),htmlFlow:u(xe),htmlFlowData:ce,htmlText:u(pe),htmlTextData:ce,image:u(Z),label:Me,labelText:me,lineEnding:ie,link:u(I),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:F,resourceDestinationString:O,resourceTitleString:D,resource:$,setextHeading:u(G),setextHeadingLineSequence:N,setextHeadingText:M,strong:u(),thematicBreak:u()}};NR(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(X){let de={type:"root",children:[]};const Te={stack:[de],tokenStack:[],config:e,enter:c,exit:f,buffer:l,resume:h,data:n},Y=[];let ge=-1;for(;++ge<X.length;)if(X[ge][1].type==="listOrdered"||X[ge][1].type==="listUnordered")if(X[ge][0]==="enter")Y.push(ge);else{const Re=Y.pop();ge=i(X,Re,ge)}for(ge=-1;++ge<X.length;){const Re=e[X[ge][0]];RR.call(Re,X[ge][1].type)&&Re[X[ge][1].type].call(Object.assign({sliceSerialize:X[ge][2].sliceSerialize},Te),X[ge][1])}if(Te.tokenStack.length>0){const Re=Te.tokenStack[Te.tokenStack.length-1];(Re[1]||gM).call(Te,void 0,Re[0])}for(de.position={start:Ws(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:Ws(X.length>0?X[X.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(X,de,Te){let Y=de-1,ge=-1,Re=!1,tt,re,Le,nt;for(;++Y<=Te;){const Ge=X[Y];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=Y),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 It=Y;for(re=void 0;It--;){const he=X[It];if(he[1].type==="lineEnding"||he[1].type==="lineEndingBlank"){if(he[0]==="exit")continue;re&&(X[re][1].type="lineEndingBlank",Re=!0),he[1].type="lineEnding",re=It}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?X[re][1].start:Ge[1].end),X.splice(re||Y,0,["exit",tt,Ge[2]]),Y++,Te++}if(Ge[1].type==="listItemPrefix"){const It={type:"listItem",_spread:!1,start:Object.assign({},Ge[1].start),end:void 0};tt=It,X.splice(Y,0,["enter",It,Ge[2]]),Y++,Te++,Le=void 0,nt=!0}}}return X[de][1]._spread=Re,Te}function s(X,de){return Te;function Te(Y){c.call(this,X(Y),Y),de&&de.call(this,Y)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(X,de,Te){this.stack[this.stack.length-1].children.push(X),this.stack.push(X),this.tokenStack.push([de,Te||void 0]),X.position={start:Ws(de.start),end:void 0}}function u(X){return de;function de(Te){X&&X.call(this,Te),f.call(this,Te)}}function f(X,de){const Te=this.stack.pop(),Y=this.tokenStack.pop();if(Y)Y[0].type!==X.type&&(de?de.call(this,X,Y[0]):(Y[1]||gM).call(this,X,Y[0]));else throw new Error("Cannot close `"+X.type+"` ("+Bu({start:X.start,end:X.end})+"): it’s not open");Te.position.end=Ws(X.end)}function h(){return jq(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function g(X){if(this.data.expectingFirstListItemValue){const de=this.stack[this.stack.length-2];de.start=Number.parseInt(this.sliceSerialize(X),10),this.data.expectingFirstListItemValue=void 0}}function y(){const X=this.resume(),de=this.stack[this.stack.length-1];de.lang=X}function v(){const X=this.resume(),de=this.stack[this.stack.length-1];de.meta=X}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const X=this.resume(),de=this.stack[this.stack.length-1];de.value=X.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const X=this.resume(),de=this.stack[this.stack.length-1];de.value=X.replace(/(\r?\n|\r)$/g,"")}function j(X){const de=this.resume(),Te=this.stack[this.stack.length-1];Te.label=de,Te.identifier=Ba(this.sliceSerialize(X)).toLowerCase()}function L(){const X=this.resume(),de=this.stack[this.stack.length-1];de.title=X}function J(){const X=this.resume(),de=this.stack[this.stack.length-1];de.url=X}function U(X){const de=this.stack[this.stack.length-1];if(!de.depth){const Te=this.sliceSerialize(X).length;de.depth=Te}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function N(X){const de=this.stack[this.stack.length-1];de.depth=this.sliceSerialize(X).codePointAt(0)===61?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}function K(X){const Te=this.stack[this.stack.length-1].children;let Y=Te[Te.length-1];(!Y||Y.type!=="text")&&(Y=qt(),Y.position={start:Ws(X.start),end:void 0},Te.push(Y)),this.stack.push(Y)}function ce(X){const de=this.stack.pop();de.value+=this.sliceSerialize(X),de.position.end=Ws(X.end)}function ie(X){const de=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=de.children[de.children.length-1];Te.position.end=Ws(X.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(de.type)&&(K.call(this,X),ce.call(this,X))}function se(){this.data.atHardBreak=!0}function xe(){const X=this.resume(),de=this.stack[this.stack.length-1];de.value=X}function pe(){const X=this.resume(),de=this.stack[this.stack.length-1];de.value=X}function H(){const X=this.resume(),de=this.stack[this.stack.length-1];de.value=X}function I(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=de,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function Z(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const de=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=de,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function me(X){const de=this.sliceSerialize(X),Te=this.stack[this.stack.length-2];Te.label=IY(de),Te.identifier=Ba(de).toLowerCase()}function Me(){const X=this.stack[this.stack.length-1],de=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const Y=X.children;Te.children=Y}else Te.alt=de}function O(){const X=this.resume(),de=this.stack[this.stack.length-1];de.url=X}function D(){const X=this.resume(),de=this.stack[this.stack.length-1];de.title=X}function $(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function F(X){const de=this.resume(),Te=this.stack[this.stack.length-1];Te.label=de,Te.identifier=Ba(this.sliceSerialize(X)).toLowerCase(),this.data.referenceType="full"}function ue(X){this.data.characterReferenceType=X.type}function le(X){const de=this.sliceSerialize(X),Te=this.data.characterReferenceType;let Y;Te?(Y=wR(de,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Y=Av(de);const ge=this.stack[this.stack.length-1];ge.value+=Y}function Ne(X){const de=this.stack.pop();de.position.end=Ws(X.end)}function Be(X){ce.call(this,X);const de=this.stack[this.stack.length-1];de.url=this.sliceSerialize(X)}function je(X){ce.call(this,X);const de=this.stack[this.stack.length-1];de.url="mailto:"+this.sliceSerialize(X)}function Xe(){return{type:"blockquote",children:[]}}function Oe(){return{type:"code",lang:null,meta:null,value:""}}function Ke(){return{type:"inlineCode",value:""}}function Mt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ot(){return{type:"emphasis",children:[]}}function Zt(){return{type:"heading",depth:0,children:[]}}function $n(){return{type:"break"}}function hr(){return{type:"html",value:""}}function Vn(){return{type:"image",title:null,url:"",alt:null}}function Ft(){return{type:"link",title:null,url:"",children:[]}}function pr(X){return{type:"list",ordered:X.type==="listOrdered",start:null,spread:X._spread,children:[]}}function ni(X){return{type:"listItem",spread:X._spread,checked:null,children:[]}}function Hi(){return{type:"paragraph",children:[]}}function _r(){return{type:"strong",children:[]}}function qt(){return{type:"text",value:""}}function $i(){return{type:"thematicBreak"}}}function Ws(t){return{line:t.line,column:t.column,offset:t.offset}}function NR(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?NR(t,r):HY(t,r)}}function HY(t,e){let n;for(n in e)if(RR.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 gM(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+Bu({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+Bu({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+Bu({start:e.start,end:e.end})+") is still open")}function $Y(t){const e=this;e.parser=n;function n(r){return BY(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function VY(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 PY(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
|
|
302
|
+
`}]}function FY(t,e){const n=e.value?e.value+`
|
|
303
|
+
`:"",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 qY(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function KY(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function YY(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=hc(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let l,c=t.footnoteCounts.get(r);c===void 0?(c=0,t.footnoteOrder.push(r),l=t.footnoteOrder.length):l=s+1,c+=1,t.footnoteCounts.set(r,c);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};t.patch(e,u);const f={type:"element",tagName:"sup",properties:{},children:[u]};return t.patch(e,f),t.applyData(e,f)}function WY(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 GY(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function zR(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 ZY(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return zR(t,e);const i={src:hc(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 JY(t,e){const n={src:hc(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 XY(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 QY(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return zR(t,e);const i={href:hc(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 eW(t,e){const n={href:hc(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 tW(t,e,n){const r=t.all(e),i=n?nW(n):LR(e),s={},l=[];if(typeof e.checked=="boolean"){const h=r[0];let m;h&&h.type==="element"&&h.tagName==="p"?m=h:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const h=r[c];(i||c!==0||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
|
|
304
|
+
`}),h.type==="element"&&h.tagName==="p"&&!i?l.push(...h.children):l.push(h)}const u=r[r.length-1];u&&(i||u.type!=="element"||u.tagName!=="p")&&l.push({type:"text",value:`
|
|
305
|
+
`});const f={type:"element",tagName:"li",properties:s,children:l};return t.patch(e,f),t.applyData(e,f)}function nW(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=LR(n[r])}return e}function LR(t){const e=t.spread;return e??t.children.length>1}function rW(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 iW(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function sW(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function oW(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function lW(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=kv(e.children[1]),u=mR(e.children[e.children.length-1]);c&&u&&(l.position={start:c,end:u}),i.push(l)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function aW(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,c=l?l.length:e.children.length;let u=-1;const f=[];for(;++u<c;){const m=e.children[u],g={},y=l?l[u]:void 0;y&&(g.align=y);let v={type:"element",tagName:s,properties:g,children:[]};m&&(v.children=t.all(m),t.patch(m,v),v=t.applyData(m,v)),f.push(v)}const h={type:"element",tagName:"tr",properties:{},children:t.wrap(f,!0)};return t.patch(e,h),t.applyData(e,h)}function cW(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const yM=9,bM=32;function uW(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(xM(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(xM(e.slice(i),i>0,!1)),s.join("")}function xM(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===yM||s===bM;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===yM||s===bM;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function dW(t,e){const n={type:"text",value:uW(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function fW(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const hW={blockquote:VY,break:PY,code:FY,delete:qY,emphasis:KY,footnoteReference:YY,heading:WY,html:GY,imageReference:ZY,image:JY,inlineCode:XY,linkReference:QY,link:eW,listItem:tW,list:rW,paragraph:iW,root:sW,strong:oW,table:lW,tableCell:cW,tableRow:aW,text:dW,thematicBreak:fW,toml:vh,yaml:vh,definition:vh,footnoteDefinition:vh};function vh(){}const IR=-1,Pm=0,Hu=1,lm=2,_v=3,Dv=4,Rv=5,Nv=6,jR=7,BR=8,vM=typeof self=="object"?self:globalThis,pW=(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 Pm:case IR:return n(l,i);case Hu:{const c=n([],i);for(const u of l)c.push(r(u));return c}case lm:{const c=n({},i);for(const[u,f]of l)c[r(u)]=r(f);return c}case _v:return n(new Date(l),i);case Dv:{const{source:c,flags:u}=l;return n(new RegExp(c,u),i)}case Rv:{const c=n(new Map,i);for(const[u,f]of l)c.set(r(u),r(f));return c}case Nv:{const c=n(new Set,i);for(const u of l)c.add(r(u));return c}case jR:{const{name:c,message:u}=l;return n(new vM[c](u),i)}case BR: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 vM[s](l),i)};return r},SM=t=>pW(new Map,t)(0),ya="",{toString:mW}={},{keys:gW}=Object,pu=t=>{const e=typeof t;if(e!=="object"||!t)return[Pm,e];const n=mW.call(t).slice(8,-1);switch(n){case"Array":return[Hu,ya];case"Object":return[lm,ya];case"Date":return[_v,ya];case"RegExp":return[Dv,ya];case"Map":return[Rv,ya];case"Set":return[Nv,ya];case"DataView":return[Hu,n]}return n.includes("Array")?[Hu,n]:n.includes("Error")?[jR,n]:[lm,n]},Sh=([t,e])=>t===Pm&&(e==="function"||e==="symbol"),yW=(t,e,n,r)=>{const i=(l,c)=>{const u=r.push(l)-1;return n.set(c,u),u},s=l=>{if(n.has(l))return n.get(l);let[c,u]=pu(l);switch(c){case Pm:{let h=l;switch(u){case"bigint":c=BR,h=l.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+u);h=null;break;case"undefined":return i([IR],l)}return i([c,h],l)}case Hu:{if(u){let g=l;return u==="DataView"?g=new Uint8Array(l.buffer):u==="ArrayBuffer"&&(g=new Uint8Array(l)),i([u,[...g]],l)}const h=[],m=i([c,h],l);for(const g of l)h.push(s(g));return m}case lm:{if(u)switch(u){case"BigInt":return i([u,l.toString()],l);case"Boolean":case"Number":case"String":return i([u,l.valueOf()],l)}if(e&&"toJSON"in l)return s(l.toJSON());const h=[],m=i([c,h],l);for(const g of gW(l))(t||!Sh(pu(l[g])))&&h.push([s(g),s(l[g])]);return m}case _v:return i([c,l.toISOString()],l);case Dv:{const{source:h,flags:m}=l;return i([c,{source:h,flags:m}],l)}case Rv:{const h=[],m=i([c,h],l);for(const[g,y]of l)(t||!(Sh(pu(g))||Sh(pu(y))))&&h.push([s(g),s(y)]);return m}case Nv:{const h=[],m=i([c,h],l);for(const g of l)(t||!Sh(pu(g)))&&h.push(s(g));return m}}const{message:f}=l;return i([c,{name:u,message:f}],l)};return s},wM=(t,{json:e,lossy:n}={})=>{const r=[];return yW(!(e||n),!!e,new Map,r)(t),r},am=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?SM(wM(t,e)):structuredClone(t):(t,e)=>SM(wM(t,e));function bW(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 xW(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function vW(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||bW,r=t.options.footnoteBackLabel||xW,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",l=t.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let u=-1;for(;++u<t.footnoteOrder.length;){const f=t.footnoteById.get(t.footnoteOrder[u]);if(!f)continue;const h=t.all(f),m=String(f.identifier).toUpperCase(),g=hc(m.toLowerCase());let y=0;const v=[],S=t.footnoteCounts.get(m);for(;S!==void 0&&++y<=S;){v.length>0&&v.push({type:"text",value:" "});let j=typeof n=="string"?n:n(u,y);typeof j=="string"&&(j={type:"text",value:j}),v.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,y),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const k=h[h.length-1];if(k&&k.type==="element"&&k.tagName==="p"){const j=k.children[k.children.length-1];j&&j.type==="text"?j.value+=" ":k.children.push({type:"text",value:" "}),k.children.push(...v)}else h.push(...v);const E={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(h,!0)};t.patch(f,E),c.push(E)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...am(l),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
306
|
+
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(c,!0)},{type:"text",value:`
|
|
307
|
+
`}]}}const UR=(function(t){if(t==null)return CW;if(typeof t=="function")return Fm(t);if(typeof t=="object")return Array.isArray(t)?SW(t):wW(t);if(typeof t=="string")return kW(t);throw new Error("Expected function, string, or object as test")});function SW(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=UR(t[n]);return Fm(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function wW(t){const e=t;return Fm(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function kW(t){return Fm(e);function e(n){return n&&n.type===t}}function Fm(t){return e;function e(n,r,i){return!!(EW(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function CW(){return!0}function EW(t){return t!==null&&typeof t=="object"&&"type"in t}const HR=[],TW=!0,kM=!1,AW="skip";function MW(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=UR(i),l=r?-1:1;c(t,void 0,[])();function c(u,f,h){const m=u&&typeof u=="object"?u:{};if(typeof m.type=="string"){const y=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(u.type+(y?"<"+y+">":""))+")"})}return g;function g(){let y=HR,v,S,k;if((!e||s(u,f,h[h.length-1]||void 0))&&(y=OW(n(u,h)),y[0]===kM))return y;if("children"in u&&u.children){const E=u;if(E.children&&y[0]!==AW)for(S=(r?E.children.length:-1)+l,k=h.concat(E);S>-1&&S<E.children.length;){const j=E.children[S];if(v=c(j,S,k)(),v[0]===kM)return v;S=typeof v[1]=="number"?v[1]:S+l}}return y}}}function OW(t){return Array.isArray(t)?t:typeof t=="number"?[TW,t]:t==null?HR:[t]}function $R(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),MW(t,s,c,i);function c(u,f){const h=f[f.length-1],m=h?h.children.indexOf(u):void 0;return l(u,m,h)}}const Ux={}.hasOwnProperty,_W={};function DW(t,e){const n=e||_W,r=new Map,i=new Map,s=new Map,l={...hW,...n.handlers},c={all:f,applyData:NW,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:l,one:u,options:n,patch:RW,wrap:LW};return $R(t,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const m=h.type==="definition"?r:i,g=String(h.identifier).toUpperCase();m.has(g)||m.set(g,h)}}),c;function u(h,m){const g=h.type,y=c.handlers[g];if(Ux.call(c.handlers,g)&&y)return y(c,h,m);if(c.options.passThrough&&c.options.passThrough.includes(g)){if("children"in h){const{children:S,...k}=h,E=am(k);return E.children=c.all(h),E}return am(h)}return(c.options.unknownHandler||zW)(c,h,m)}function f(h){const m=[];if("children"in h){const g=h.children;let y=-1;for(;++y<g.length;){const v=c.one(g[y],h);if(v){if(y&&g[y-1].type==="break"&&(!Array.isArray(v)&&v.type==="text"&&(v.value=CM(v.value)),!Array.isArray(v)&&v.type==="element")){const S=v.children[0];S&&S.type==="text"&&(S.value=CM(S.value))}Array.isArray(v)?m.push(...v):m.push(v)}}}return m}}function RW(t,e){t.position&&(e.position=mq(t))}function NW(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,am(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function zW(t,e){const n=e.data||{},r="value"in e&&!(Ux.call(n,"hProperties")||Ux.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 LW(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
|
|
308
|
+
`});++r<t.length;)r&&n.push({type:"text",value:`
|
|
309
|
+
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
|
|
310
|
+
`}),n}function CM(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function EM(t,e){const n=DW(t,e),r=n.one(t,void 0),i=vW(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
311
|
+
`},i),s}function IW(t,e){return t&&"run"in t?async function(n,r){const i=EM(n,{file:r,...e});await t.run(i,r)}:function(n,r){return EM(n,{file:r,...t||e})}}function TM(t){if(t)throw t}var lb,AM;function jW(){if(AM)return lb;AM=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(f){return typeof Array.isArray=="function"?Array.isArray(f):e.call(f)==="[object Array]"},s=function(f){if(!f||e.call(f)!=="[object Object]")return!1;var h=t.call(f,"constructor"),m=f.constructor&&f.constructor.prototype&&t.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!h&&!m)return!1;var g;for(g in f);return typeof g>"u"||t.call(f,g)},l=function(f,h){n&&h.name==="__proto__"?n(f,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):f[h.name]=h.newValue},c=function(f,h){if(h==="__proto__")if(t.call(f,h)){if(r)return r(f,h).value}else return;return f[h]};return lb=function u(){var f,h,m,g,y,v,S=arguments[0],k=1,E=arguments.length,j=!1;for(typeof S=="boolean"&&(j=S,S=arguments[1]||{},k=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});k<E;++k)if(f=arguments[k],f!=null)for(h in f)m=c(S,h),g=c(f,h),S!==g&&(j&&g&&(s(g)||(y=i(g)))?(y?(y=!1,v=m&&i(m)?m:[]):v=m&&s(m)?m:{},l(S,{name:h,newValue:u(j,v,g)})):typeof g<"u"&&l(S,{name:h,newValue:g}));return S},lb}var BW=jW();const ab=um(BW);function Hx(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 UW(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...i);function c(u,...f){const h=t[++s];let m=-1;if(u){l(u);return}for(;++m<i.length;)(f[m]===null||f[m]===void 0)&&(f[m]=i[m]);i=f,h?HW(h,c)(...f):l(null,...f)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function HW(t,e){let n;return r;function r(...l){const c=t.length>l.length;let u;c&&l.push(i);try{u=t.apply(this,l)}catch(f){const h=f;if(c&&n)throw h;return i(h)}c||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(l,...c){n||(n=!0,e(l,...c))}function s(l){i(null,l)}}const Ei={basename:$W,dirname:VW,extname:PW,join:FW,sep:"/"};function $W(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');zd(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 VW(t){if(zd(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 PW(t){zd(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 FW(...t){let e=-1,n;for(;++e<t.length;)zd(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":qW(n)}function qW(t){zd(t);const e=t.codePointAt(0)===47;let n=KW(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function KW(t,e){let n="",r=0,i=-1,s=0,l=-1,c,u;for(;++l<=t.length;){if(l<t.length)c=t.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(i===l-1||s===1))if(i!==l-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=l,s=0;continue}}else if(n.length>0){n="",r=0,i=l,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,l):n=t.slice(i+1,l),r=l-i-1;i=l,s=0}else c===46&&s>-1?s++:s=-1}return n}function zd(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const YW={cwd:WW};function WW(){return"/"}function $x(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function GW(t){if(typeof t=="string")t=new URL(t);else if(!$x(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 ZW(t)}function ZW(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 cb=["history","path","basename","stem","extname","dirname"];class VR{constructor(e){let n;e?$x(e)?n={path:e}:typeof e=="string"||JW(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":YW.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<cb.length;){const s=cb[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)cb.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Ei.basename(this.path):void 0}set basename(e){db(e,"basename"),ub(e,"basename"),this.path=Ei.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Ei.dirname(this.path):void 0}set dirname(e){MM(this.basename,"dirname"),this.path=Ei.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Ei.extname(this.path):void 0}set extname(e){if(ub(e,"extname"),MM(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=Ei.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){$x(e)&&(e=GW(e)),db(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Ei.basename(this.path,this.extname):void 0}set stem(e){db(e,"stem"),ub(e,"stem"),this.path=Ei.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 ub(t,e){if(t&&t.includes(Ei.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Ei.sep+"`")}function db(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function MM(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function JW(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const XW=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),QW={}.hasOwnProperty;class zv extends XW{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=UW()}copy(){const e=new zv;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(ab(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(pb("data",this.frozen),this.namespace[e]=n,this):QW.call(this.namespace,e)&&this.namespace[e]||void 0:e?(pb("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=wh(e),r=this.parser||this.Parser;return fb("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),fb("process",this.parser||this.Parser),hb("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,l){const c=wh(e),u=r.parse(c);r.run(u,c,function(h,m,g){if(h||!m||!g)return f(h);const y=m,v=r.stringify(y,g);nG(v)?g.value=v:g.result=v,f(h,g)});function f(h,m){h||!m?l(h):s?s(m):n(void 0,m)}}}processSync(e){let n=!1,r;return this.freeze(),fb("processSync",this.parser||this.Parser),hb("processSync",this.compiler||this.Compiler),this.process(e,i),_M("processSync","process",n),r;function i(s,l){n=!0,TM(s),r=l}}run(e,n,r){OM(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(l,c){const u=wh(n);i.run(e,u,f);function f(h,m,g){const y=m||e;h?c(h):l?l(y):r(void 0,y,g)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),_M("runSync","run",r),i;function s(l,c){TM(l),i=c,r=!0}}stringify(e,n){this.freeze();const r=wh(n),i=this.compiler||this.Compiler;return hb("stringify",i),OM(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(pb("use",this.frozen),e!=null)if(typeof e=="function")u(e,n);else if(typeof e=="object")Array.isArray(e)?c(e):l(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(f){if(typeof f=="function")u(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[h,...m]=f;u(h,m)}else l(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function l(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(f.plugins),f.settings&&(i.settings=ab(!0,i.settings,f.settings))}function c(f){let h=-1;if(f!=null)if(Array.isArray(f))for(;++h<f.length;){const m=f[h];s(m)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function u(f,h){let m=-1,g=-1;for(;++m<r.length;)if(r[m][0]===f){g=m;break}if(g===-1)r.push([f,...h]);else if(h.length>0){let[y,...v]=h;const S=r[g][1];Hx(S)&&Hx(y)&&(y=ab(!0,S,y)),r[g]=[f,y,...v]}}}}const eG=new zv().freeze();function fb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function hb(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function pb(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 OM(t){if(!Hx(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function _M(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function wh(t){return tG(t)?t:new VR(t)}function tG(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function nG(t){return typeof t=="string"||rG(t)}function rG(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const iG="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",DM=[],RM={allowDangerousHtml:!0},sG=/^(https?|ircs?|mailto|xmpp)$/i,oG=[{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 lG(t){const e=aG(t),n=cG(t);return uG(e.runSync(e.parse(n),n),t)}function aG(t){const e=t.rehypePlugins||DM,n=t.remarkPlugins||DM,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...RM}:RM;return eG().use($Y).use(n).use(IW,r).use(e)}function cG(t){const e=t.children||"",n=new VR;return typeof e=="string"&&(n.value=e),n}function uG(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,l=e.skipHtml,c=e.unwrapDisallowed,u=e.urlTransform||dG;for(const h of oG)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+iG+h.id,void 0);return $R(t,f),vq(t,{Fragment:C.Fragment,components:i,ignoreInvalidStyle:!0,jsx:C.jsx,jsxs:C.jsxs,passKeys:!0,passNode:!0});function f(h,m,g){if(h.type==="raw"&&g&&typeof m=="number")return l?g.children.splice(m,1):g.children[m]={type:"text",value:h.value},m;if(h.type==="element"){let y;for(y in ib)if(Object.hasOwn(ib,y)&&Object.hasOwn(h.properties,y)){const v=h.properties[y],S=ib[y];(S===null||S.includes(h.tagName))&&(h.properties[y]=u(String(v||""),y,h))}}if(h.type==="element"){let y=n?!n.includes(h.tagName):s?s.includes(h.tagName):!1;if(!y&&r&&typeof m=="number"&&(y=!r(h,m,g)),y&&g&&typeof m=="number")return c&&h.children?g.children.splice(m,1,...h.children):g.children.splice(m,1),m}}}function dG(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||sG.test(t.slice(0,e))?t:""}const fG=[0,.2,.4];function mb({ctrlYdoc:t,editor:e,activeDocId:n,openDocs:r,claudeActive:i,claudeStatus:s,visible:l,capturedAnchor:c,onCapturedAnchorChange:u,inputRef:f,reduceMotion:h}){const m=h?"auto":"smooth",[g,y]=_.useState([]),[v,S]=_.useState(""),k=_.useRef(null),E=_.useRef(null);_.useEffect(()=>{f&&(f.current=E.current)},[f]),_.useEffect(()=>{if(!t)return;const K=t.getMap(VC),ce=()=>{const ie=[];K.forEach(se=>{ie.push(se)}),ie.sort((se,xe)=>se.timestamp-xe.timestamp||se.id.localeCompare(xe.id)),y(ie)};return K.observe(ce),ce(),()=>K.unobserve(ce)},[t]);const j=_.useRef(!1);_.useEffect(()=>{var K;if(!i&&j.current){j.current=!1;return}j.current=!!i,(K=k.current)==null||K.scrollIntoView({behavior:m})},[g,i,m]),_.useEffect(()=>{var K;l&&((K=k.current)==null||K.scrollIntoView({behavior:m}))},[l,m]);const L=_.useCallback(()=>{if(!t||!v.trim())return;const K=t.getMap(VC),ce={id:F9(),author:"user",text:v.trim(),timestamp:Date.now(),...n?{documentId:n}:{},...c?{anchor:c}:{},read:!1};K.set(ce.id,ce),S(""),u(null)},[t,v,n,c,u]),J=_.useCallback(K=>{K.key==="Enter"&&!K.shiftKey&&(K.preventDefault(),L())},[L]),U=_.useCallback((K,ce)=>{if(!(!e||ce&&ce!==n))try{const ie=Sl(e.state.doc,K.from),se=Sl(e.state.doc,K.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]),M=K=>{if(!K)return null;const ce=r.find(ie=>ie.id===K);return(ce==null?void 0:ce.fileName)??null},N=g.filter(K=>K.author==="claude"&&!K.read).length,G=_.useCallback(async()=>{try{await fetch(`http://localhost:${nc}/api/chat`,{method:"DELETE"})}catch(K){console.warn("[ChatPanel] Failed to clear chat:",K)}},[]);return C.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",background:"var(--tandem-surface-muted)",flex:1,minHeight:0},children:[C.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",C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[N>0&&C.jsx("span",{style:{background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",borderRadius:"10px",padding:"2px 8px",fontSize:"11px"},children:N}),g.length>0&&C.jsx("button",{onClick:G,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"})]})]}),C.jsxs("div",{style:{flex:1,overflow:"auto",padding:"12px",minHeight:0},children:[g.length===0&&C.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(K=>C.jsxs("div",{style:{marginBottom:"12px",padding:"8px 12px",borderRadius:"8px",background:K.author==="user"?"var(--tandem-accent-bg)":"var(--tandem-surface)",border:`1px solid ${K.author==="user"?"var(--tandem-accent-border)":"var(--tandem-border)"}`,fontSize:"13px",color:"var(--tandem-fg)"},children:[C.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",marginBottom:"4px"},children:[C.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:K.author==="claude"?"var(--tandem-accent)":"var(--tandem-fg-muted)",textTransform:"uppercase"},children:K.author}),K.documentId&&C.jsx("span",{style:{fontSize:"10px",color:"var(--tandem-fg-muted)",background:"var(--tandem-surface-muted)",padding:"1px 6px",borderRadius:"4px"},children:M(K.documentId)??K.documentId}),C.jsx("span",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginLeft:"auto"},children:new Date(K.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),K.anchor&&C.jsx("div",{onClick:()=>U(K.anchor,K.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:K.anchor.textSnapshot}),K.author==="claude"?C.jsx("div",{className:"chat-markdown",children:C.jsx(lG,{children:K.text})}):C.jsx("div",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word"},children:K.text})]},K.id)),i&&C.jsxs("div",{style:{padding:"8px 12px",marginBottom:"8px",fontSize:"12px",color:"var(--tandem-author-claude)",display:"flex",alignItems:"center",gap:"8px"},children:[C.jsx("span",{style:{display:"inline-flex",gap:"3px"},children:fG.map(K=>C.jsx("span",{style:{width:"5px",height:"5px",borderRadius:"50%",background:"var(--tandem-author-claude)",animation:`tandem-typing-bounce 1.2s ease-in-out ${K}s infinite`}},K))}),C.jsx("span",{children:s??"Claude is thinking..."})]}),C.jsx("div",{ref:k})]}),c&&C.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:[C.jsxs("span",{children:["with selection: “",c.textSnapshot.slice(0,40),c.textSnapshot.length>40?"...":"","”"]}),C.jsx("button",{onClick:()=>u(null),style:{background:"none",border:"none",cursor:"pointer",color:"var(--tandem-fg-muted)",fontSize:"14px"},children:"x"})]}),C.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid var(--tandem-border)",display:"flex",gap:"8px"},children:[C.jsx("textarea",{ref:E,value:v,onChange:K=>S(K.target.value),onKeyDown:J,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)"}}),C.jsx("button",{onClick:L,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"})]}),C.jsx("style",{children:`
|
|
312
|
+
@keyframes tandem-typing-bounce {
|
|
313
|
+
0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
|
|
314
|
+
30% { transform: translateY(-4px); opacity: 1; }
|
|
315
|
+
}
|
|
316
|
+
`})]})}function hG({accepted:t,dismissed:e,total:n,onDismiss:r}){const i=n>0?Math.round(t/n*100):0;return C.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:C.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:[C.jsx("div",{style:{fontSize:"48px",marginBottom:"8px"},children:i>=80?"✅":i>=50?"📋":"🔍"}),C.jsx("h2",{style:{margin:"0 0 8px",fontSize:"20px",fontWeight:600,color:"var(--tandem-fg)"},children:"Review Complete"}),C.jsx("p",{style:{margin:"0 0 20px",color:"var(--tandem-fg-muted)",fontSize:"14px"},children:"All annotations have been resolved."}),C.jsxs("div",{style:{display:"flex",justifyContent:"center",gap:"24px",marginBottom:"20px"},children:[C.jsxs("div",{children:[C.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"var(--tandem-success)"},children:t}),C.jsx("div",{style:{fontSize:"12px",color:"var(--tandem-fg-muted)"},children:"Accepted"})]}),C.jsx("div",{style:{width:"1px",background:"var(--tandem-border)"}}),C.jsxs("div",{children:[C.jsx("div",{style:{fontSize:"28px",fontWeight:700,color:"var(--tandem-error)"},children:e}),C.jsx("div",{style:{fontSize:"12px",color:"var(--tandem-fg-muted)"},children:"Dismissed"})]}),C.jsx("div",{style:{width:"1px",background:"var(--tandem-border)"}}),C.jsxs("div",{children:[C.jsxs("div",{style:{fontSize:"28px",fontWeight:700,color:"var(--tandem-accent)"},children:[i,"%"]}),C.jsx("div",{style:{fontSize:"12px",color:"var(--tandem-fg-muted)"},children:"Accept rate"})]})]}),C.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 pG({annotations:t,activeDocFormat:e,documentId:n}){const[r,i]=_.useState(!1);if(e!=="docx")return null;const s=t.filter(f=>f.status==="accepted"),l=t.filter(f=>f.status==="pending"),c=s.length===0||r;async function u(){if(c||!n)return;let f=`Apply ${s.length} change(s) as tracked revisions?
|
|
317
|
+
|
|
318
|
+
The changes will appear as tracked revisions in Word — you can Accept or Reject each one individually.
|
|
319
|
+
|
|
320
|
+
Your original file will be backed up.`;if(l.length>0&&(f+=`
|
|
321
|
+
|
|
322
|
+
⚠ ${l.length} annotation(s) are still pending review and will not be applied.`),!!confirm(f)){i(!0);try{const h=await fetch(`${qu}/apply-changes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:n})}),m=await h.json().catch(y=>(console.error("[ApplyChanges] Failed to parse response JSON:",y),null));if(!h.ok){alert((m==null?void 0:m.message)??`Apply failed (HTTP ${h.status}).`);return}const g=m==null?void 0:m.data;if(g){const y=[`Applied ${g.applied??0} tracked change(s).`];g.rejected>0&&y.push(`${g.rejected} could not be applied.`),g.backupPath&&y.push(`
|
|
323
|
+
Backup saved to:
|
|
324
|
+
${g.backupPath}`),alert(y.join(" "))}else alert("Changes applied successfully.")}catch(h){console.error("[ApplyChanges] Request failed:",h),alert(h instanceof TypeError?"Could not reach the server.":`Apply failed: ${h instanceof Error?h.message:String(h)}`)}finally{i(!1)}}}return C.jsx("button",{type:"button","data-testid":"apply-changes-btn",onClick:u,disabled:c,title:s.length===0?"No accepted suggestions to apply":void 0,style:{width:"100%",padding:"6px 12px",fontSize:"12px",fontWeight:500,border:`1px solid ${c?"var(--tandem-border)":"var(--tandem-info-border)"}`,borderRadius:"4px",background:c?"var(--tandem-surface-muted)":"var(--tandem-info)",color:c?"var(--tandem-fg-subtle)":"var(--tandem-info-fg)",cursor:c?"default":"pointer",opacity:r?.6:1,whiteSpace:"nowrap"},children:r?"Applying…":`Apply as Tracked Changes (${s.length})`})}function mG(t,e){_.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 gb={background:"var(--tandem-warning-bg)",border:"var(--tandem-warning-border)",color:"var(--tandem-warning-fg-strong)"};function gG(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 yG({replies:t}){return t.length===0?null:C.jsx("div",{"data-testid":"comment-thread",style:{marginTop:"6px",paddingLeft:"8px",borderLeft:"2px solid var(--tandem-border)"},children:t.map(e=>C.jsxs("div",{"data-testid":`reply-${e.id}`,style:{padding:"4px 0",fontSize:"12px",lineHeight:"1.4"},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"2px"},children:[C.jsx("span",{style:{fontWeight:600,fontSize:"11px",color:e.author==="claude"?"var(--tandem-accent)":"var(--tandem-fg-muted)"},children:e.author==="claude"?"Claude":"You"}),C.jsxs("span",{style:{fontSize:"10px",color:"var(--tandem-fg-subtle)"},children:[e.editedAt&&C.jsx("span",{style:{fontStyle:"italic",marginRight:"4px"},children:"(edited)"}),gG(e.timestamp)]})]}),C.jsx("p",{style:{margin:0,color:"var(--tandem-fg)"},children:e.text})]},e.id))})}function bG(t){return t.color?$u[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 NM=pn.memo(function({annotation:e,replies:n=[],isReviewTarget:r,onAccept:i,onDismiss:s,onUndo:l,onEdit:c,onReply:u,undoable:f,onClick:h}){const m=bG(e),g=e.status==="pending",[y,v]=_.useState(!1),[S,k]=_.useState(""),[E,j]=_.useState(""),[L,J]=_.useState(""),[U,M]=_.useState(!1),[N,G]=_.useState(""),[K,ce]=_.useState(!1),ie=e.suggestedText!==void 0;function se(){ie?(j(e.suggestedText??""),J(e.content)):k(e.content),v(!0)}function xe(){const T=ie?JSON.stringify({suggestedText:E,content:L}):S;c==null||c(e.id,T),v(!1)}function pe(){v(!1)}function H(T){T.key==="Escape"&&(T.stopPropagation(),pe())}function I(T){T.key==="Escape"&&(T.stopPropagation(),M(!1),G(""))}async function Z(){const T=N.trim();if(!(!T||K)){ce(!0);try{await(u==null?void 0:u(e.id,T))!==!1&&(G(""),M(!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)"},Me={padding:"1px 4px",fontSize:"11px",border:"none",background:"none",color:"var(--tandem-fg-subtle)",cursor:"pointer",lineHeight:1},O=e.content?e.content.length>60?e.content.slice(0,57)+"...":e.content:"",D=ie?"replacement":e.directedAt==="claude"?"question":e.type,$=`${D} annotation${O?": "+O:""}, ${e.status}`;return C.jsxs("div",{onClick:h,"data-testid":`annotation-card-${e.id}`,role:"listitem","aria-label":$,"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:h?"pointer":"default",outline:r?"2px solid var(--tandem-accent)":"none",transition:"background 0.15s, outline 0.15s"},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[C.jsxs("span",{style:{fontWeight:500,textTransform:"capitalize",display:"flex",alignItems:"center",gap:"4px"},children:[D,!g&&C.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&&!y&&C.jsx("button",{"data-testid":`edit-btn-${e.id}`,onClick:T=>{T.stopPropagation(),se()},style:Me,title:"Edit this annotation's content",children:"✎ Edit"})]}),C.jsxs("span",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",display:"flex",alignItems:"center",gap:"4px"},children:[e.editedAt&&C.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&&C.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}),y?C.jsxs("div",{style:{marginTop:"4px"},onClick:T=>T.stopPropagation(),children:[ie?C.jsxs(C.Fragment,{children:[C.jsx("label",{style:{fontSize:"11px",color:"var(--tandem-fg-muted)",display:"block",marginBottom:"2px"},children:"Replacement text"}),C.jsx("textarea",{"data-testid":`edit-newtext-${e.id}`,value:E,onChange:T=>j(T.target.value),onKeyDown:H,style:me,autoFocus:!0}),C.jsx("label",{style:{fontSize:"11px",color:"var(--tandem-fg-muted)",display:"block",marginTop:"4px",marginBottom:"2px"},children:"Reason"}),C.jsx("textarea",{"data-testid":`edit-reason-${e.id}`,value:L,onChange:T=>J(T.target.value),onKeyDown:H,style:me})]}):C.jsx("textarea",{"data-testid":`edit-text-${e.id}`,value:S,onChange:T=>k(T.target.value),onKeyDown:H,style:me,autoFocus:!0}),C.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[C.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"}),C.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"})]})]}):C.jsx("div",{style:{margin:0,color:"var(--tandem-fg)",lineHeight:"1.4"},children:ie?C.jsxs(C.Fragment,{children:[C.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&&C.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&&" → ",C.jsx("span",{style:{color:"var(--tandem-success-fg-strong)",backgroundColor:"var(--tandem-success-bg)",padding:"0 2px",borderRadius:"2px"},children:e.suggestedText})]}),e.content&&C.jsx("p",{style:{margin:0,fontSize:"12px",color:"var(--tandem-fg-muted)"},children:e.content})]}):C.jsx("p",{style:{margin:0},children:e.content||"(no note)"})}),g&&!y&&(i||s)&&C.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"6px"},children:[i&&C.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&&C.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&&C.jsxs("div",{style:{marginTop:"4px",position:"relative"},children:[C.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"}),C.jsx("div",{"data-testid":"undo-countdown",style:{height:"2px",marginTop:"2px",borderRadius:"1px",backgroundColor:"var(--tandem-accent)",animation:"undo-countdown-shrink 10s linear forwards"}}),C.jsx("style",{children:`@keyframes undo-countdown-shrink {
|
|
325
|
+
from { width: 100%; }
|
|
326
|
+
to { width: 0%; }
|
|
327
|
+
}`})]}),C.jsx(yG,{replies:n}),g&&u&&!y&&C.jsx("div",{style:{marginTop:"6px"},onClick:T=>T.stopPropagation(),children:U?C.jsxs("div",{children:[C.jsx("textarea",{"data-testid":`reply-input-${e.id}`,value:N,onChange:T=>G(T.target.value),onKeyDown:I,placeholder:"Write a reply...",style:me,autoFocus:!0}),C.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[C.jsx("button",{"data-testid":`reply-send-btn-${e.id}`,onClick:Z,disabled:!N.trim()||K,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"}),C.jsx("button",{"data-testid":`reply-cancel-btn-${e.id}`,onClick:()=>{M(!1),G("")},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"})]})]}):C.jsxs("button",{"data-testid":`reply-btn-${e.id}`,onClick:()=>M(!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&&!u&&C.jsxs("div",{style:{marginTop:"4px",fontSize:"11px",color:"var(--tandem-fg-subtle)"},children:[n.length," ",n.length===1?"reply":"replies"]})]})});function yb({value:t,onChange:e,options:n,testId:r}){return C.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=>C.jsx("option",{value:i.value,children:i.label},i.value))})}const kh={padding:"2px 8px",fontSize:"11px",border:"1px solid var(--tandem-border-strong)",borderRadius:"3px",cursor:"pointer"};function xG(t,e,n){if(t.suggestedText===void 0)return!1;const r=t.suggestedText,i=rm(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 bb({annotations:t,editor:e,ydoc:n,heldCount:r=0,tandemMode:i,onModeChange:s,activeDocFormat:l,documentId:c,reviewMode:u,onToggleReviewMode:f,onExitReviewMode:h,activeAnnotationId:m,onActiveAnnotationChange:g,reduceMotion:y}){const v=y?"auto":"smooth",[S,k]=_.useState("all"),[E,j]=_.useState("all"),[L,J]=_.useState("all"),[U,M]=_.useState(0),N=_.useRef(0),[G,K]=_.useState(null),ce=_.useRef(G);ce.current=G;const ie=_.useRef(null),[se,xe]=_.useState(new Set),pe=_.useRef(null),H=_.useRef(new Map);_.useEffect(()=>{const Y=H.current;return()=>{for(const ge of Y.values())clearTimeout(ge)}},[]);const I=_.useRef(n),Z=_.useRef(e);I.current=n,Z.current=e;const[me,Me]=_.useState(new Map);_.useEffect(()=>{if(!n){Me(new Map);return}const Y=n.getMap(TL);function ge(){const tt=new Map;Y.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);Me(tt)}ge();const Re=()=>ge();return Y.observe(Re),()=>Y.unobserve(Re)},[n]);const{filtered:O,pending:D,resolved:$,allPending:T}=_.useMemo(()=>{const Y=[],ge=[];for(const re of t){re.status==="pending"&&ge.push(re);let Le;S==="all"?Le=!0:S==="with-replacement"?Le=re.suggestedText!==void 0:S==="for-claude"?Le=re.directedAt==="claude":Le=re.type===S;const nt=E==="all"||re.author===E,Ge=L==="all"||re.status===L;Le&&nt&&Ge&&Y.push(re)}const Re=Y.filter(re=>re.status==="pending"),tt=Y.filter(re=>re.status!=="pending");return{filtered:Y,pending:Re,resolved:tt,allPending:ge}},[t,S,E,L]),F=T,ue=_.useRef(F);ue.current=F;function le(Y,ge){const Re=I.current;if(!Re)return;const tt=Re.getMap(Ta),re=tt.get(Y);if(!re)return;const Le=Nu(re);if(tt.set(Y,{...Le,status:ge}),ge==="accepted"&&Le.suggestedText!==void 0&&Z.current&&!xG(Le,Z.current,I.current)){tt.set(Y,{...Le,status:"pending"});return}pe.current=Y,xe(It=>new Set(It).add(Y));const nt=H.current.get(Y);nt&&clearTimeout(nt);const Ge=setTimeout(()=>{H.current.delete(Y),xe(It=>{const he=new Set(It);return he.delete(Y),he}),pe.current===Y&&(pe.current=null)},1e4);H.current.set(Y,Ge)}function Ne(Y){const ge=I.current;if(!ge)return;const Re=ge.getMap(Ta),tt=Re.get(Y);if(!tt||tt.status==="pending")return;const re=Nu(tt);if(re.status==="accepted"&&re.suggestedText!==void 0&&Z.current)try{const nt=re.suggestedText,Ge=re.textSnapshot;if(typeof nt=="string"&&typeof Ge=="string"){const It=rm(re,Z.current.state.doc,ge);if(!It){console.warn(`[undo] Cannot resolve range for annotation ${Y}, skipping`);return}if(Z.current.state.doc.textBetween(It.from,It.to)!==nt){console.warn(`[undo] Text changed since accept for annotation ${Y}, skipping`);return}Z.current.chain().focus().deleteRange({from:It.from,to:It.to}).insertContentAt(It.from,Ge).run()}}catch(nt){console.warn(`[undo] Failed to revert text for annotation ${Y}:`,nt);return}Re.set(Y,{...re,status:"pending"});const Le=H.current.get(Y);Le&&(clearTimeout(Le),H.current.delete(Y)),xe(nt=>{const Ge=new Set(nt);return Ge.delete(Y),Ge}),pe.current===Y&&(pe.current=null)}function Be(Y){le(Y,"accepted")}function je(Y){le(Y,"dismissed")}function Xe(Y){Ne(Y)}function Oe(Y,ge){const Re=I.current;if(!Re)return;const tt=Re.getMap(Ta),re=tt.get(Y);if(!re)return;const Le=Nu(re);if(Le.suggestedText!==void 0){try{const nt=JSON.parse(ge);tt.set(Y,{...Le,suggestedText:nt.suggestedText,content:nt.content,editedAt:Date.now()})}catch{console.warn(`[SidePanel] Failed to parse edit payload for annotation ${Y}`)}return}tt.set(Y,{...Le,content:ge,editedAt:Date.now()})}async function Ke(Y,ge){try{const Re=await fetch(`http://localhost:${nc}/api/annotation-reply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({annotationId:Y,text:ge,documentId:c})});if(!Re.ok){const tt=await Re.json().catch(()=>({}));return console.warn(`[SidePanel] Reply failed (${Re.status}): ${tt.message??"unknown error"}`),!1}return!0}catch(Re){return console.error("[SidePanel] Reply request failed:",Re),!1}}function Mt(){for(const Y of D)le(Y.id,"accepted");K(null)}function Ot(){for(const Y of D)le(Y.id,"dismissed");K(null)}const Zt=_.useCallback(Y=>{const ge=Z.current;if(!ge)return;const Re=rm(Y,ge.state.doc,I.current);if(!Re)return;ge.chain().focus().setTextSelection({from:Re.from,to:Re.to}).run();const tt=ge.view.domAtPos(Re.from),re=tt.node instanceof HTMLElement?tt.node:tt.node.parentElement;re==null||re.scrollIntoView({behavior:v,block:"center"})},[v]),$n=_.useCallback(Y=>{const ge=ue.current;if(ge.length===0)return;let Re=N.current;Re=Y==="next"?(Re+1)%ge.length:(Re-1+ge.length)%ge.length,N.current=Re,M(Re),Zt(ge[Re])},[Zt]),hr=_.useCallback(()=>{const Y=ue.current;if(Y.length===0)return;const ge=Y[N.current];ge&&le(ge.id,"accepted")},[]),Vn=_.useCallback(()=>{const Y=ue.current;if(Y.length===0)return;const ge=Y[N.current];ge&&le(ge.id,"dismissed")},[]),Ft=_.useRef(!1);_.useEffect(()=>{u&&!Ft.current&&F.length>0&&(N.current=0,M(0),Zt(F[0])),Ft.current=u},[u,F,Zt]),_.useEffect(()=>{var Y;u&&F.length>0?g(((Y=F[U])==null?void 0:Y.id)??null):g(null)},[u,U,F,g]);const pr=_.useCallback(()=>{const ge=ue.current[N.current];ge&&Zt(ge),h()},[Zt,h]),ni=_.useCallback(()=>{const Y=pe.current;Y&&Ne(Y)},[]),Hi=_.useCallback(()=>{ce.current?K(null):h()},[h]),_r=_.useMemo(()=>({onToggleReviewMode:f,onExitReviewMode:h,navigateReview:$n,acceptCurrent:hr,dismissCurrent:Vn,scrollToCurrentAndExit:pr,cancelBulkOrExit:Hi,undoLast:ni}),[f,h,$n,hr,Vn,pr,Hi,ni]);mG(u,_r),_.useEffect(()=>{var Y;G&&((Y=ie.current)==null||Y.focus())},[G]),_.useEffect(()=>{K(null)},[S,E,L]);const qt=_.useRef(null),$i=_.useRef(!1),X=_.useRef(m);X.current=m,_.useEffect(()=>{var ge;if(!$i.current){$i.current=!0;return}const Y=X.current;if(Y){const Re=document.querySelector(`[data-testid="annotation-card-${Y}"]`);if(Re){Re.scrollIntoView({block:"center"});return}console.warn(`[tandem] SidePanel: active annotation ${Y} not found on filter change; scrolling to top`)}(ge=qt.current)==null||ge.scrollTo({top:0})},[S,E,L]),_.useEffect(()=>{if(u&&N.current>=F.length){const Y=Math.max(0,F.length-1);N.current=Y,M(Y)}},[u,F.length]),_.useEffect(()=>{u&&F.length===0&&h()},[u,F.length,h]),_.useEffect(()=>{if(!m)return;const Y=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 Re=()=>ge.classList.remove("tandem-annotation-flash");ge.addEventListener("animationend",Re,{once:!0})}else console.warn(`[tandem] SidePanel: active annotation ${m} not found after 50ms delay; scroll-to-card skipped`)},50);return()=>clearTimeout(Y)},[m,v]);const de=S!=="all"||E!=="all"||L!=="all",Te=u&&F.length>0?F[U]:null;return C.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&&C.jsxs("div",{style:{padding:"6px 16px",background:gb.background,borderBottom:`1px solid ${gb.border}`,fontSize:"12px",color:gb.color,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[C.jsxs("span",{"data-testid":"held-banner",children:[r," annotation",r!==1?"s":""," held"]}),C.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"})]}),C.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--tandem-border)"},children:C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[C.jsxs("h3",{style:{fontSize:"14px",fontWeight:600,margin:0},children:["Annotations",T.length>0&&C.jsx("span",{style:{marginLeft:"8px",padding:"1px 6px",fontSize:"11px",background:"var(--tandem-accent)",color:"var(--tandem-accent-fg)",borderRadius:"10px"},children:T.length})]}),C.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&&C.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end"},children:[C.jsx("button",{"data-testid":"review-mode-btn",onClick:f,title:"Keyboard review mode (Ctrl+Shift+R)","aria-pressed":u,style:{padding:"2px 8px",fontSize:"11px",border:`1px solid ${u?"var(--tandem-accent)":"var(--tandem-border-strong)"}`,borderRadius:"3px",background:u?"var(--tandem-accent-bg)":"var(--tandem-surface)",color:u?"var(--tandem-accent)":"var(--tandem-fg-muted)",cursor:"pointer",fontWeight:u?600:400},children:u?"Exit Review":"Review"}),C.jsx("div",{"data-testid":"review-shortcut-hints",style:{fontSize:"10px",color:"var(--tandem-fg-subtle)",marginTop:"2px"},children:"Y / N / ↑↓ / Z"})]})]})}),u&&F.length>0&&C.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:[C.jsxs("div",{"aria-live":"polite",style:{fontWeight:600,marginBottom:"2px"},children:["Reviewing ",U+1," / ",F.length]}),C.jsx("div",{style:{color:"var(--tandem-accent)"},children:"Tab: next · Shift+Tab: prev · Y: accept · N: dismiss · Z: undo · E: examine · Esc: exit"})]}),C.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid var(--tandem-border)",display:"flex",gap:"4px",flexWrap:"wrap",alignItems:"center"},children:[C.jsx(yb,{testId:"filter-type",value:S,onChange:Y=>k(Y),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"}]}),C.jsx(yb,{testId:"filter-author",value:E,onChange:Y=>j(Y),options:[{value:"all",label:"Anyone"},{value:"claude",label:"Claude"},{value:"user",label:"You"},{value:"import",label:"Imported"}]}),C.jsx(yb,{testId:"filter-status",value:L,onChange:Y=>J(Y),options:[{value:"all",label:"Any status"},{value:"pending",label:"Pending"},{value:"accepted",label:"Accepted"},{value:"dismissed",label:"Dismissed"}]}),de&&C.jsx("button",{"data-testid":"clear-filters-btn",onClick:()=>{k("all"),j("all"),J("all")},style:{background:"none",border:"none",color:"var(--tandem-accent)",fontSize:"11px",cursor:"pointer",padding:"2px 4px"},children:"Clear"})]}),C.jsx("div",{style:{padding:"4px 16px 0"},children:C.jsx(pG,{annotations:t,activeDocFormat:l,documentId:c})}),D.length>1&&C.jsx("div",{style:{padding:"6px 16px",borderBottom:"1px solid var(--tandem-border)",display:"flex",gap:"6px",alignItems:"center"},children:G?(()=>{const Y=G==="accept";return C.jsxs(C.Fragment,{children:[C.jsxs("span",{style:{fontSize:"11px",color:"var(--tandem-fg)"},children:[Y?"Accept":"Reject"," ",D.length===T.length?`${D.length} annotations?`:`${D.length} of ${T.length} pending?`]}),C.jsx("button",{ref:ie,"data-testid":"bulk-confirm-btn",onClick:Y?Mt:Ot,style:{...kh,background:Y?"var(--tandem-success-bg)":"var(--tandem-error-bg)",color:Y?"var(--tandem-success-fg-strong)":"var(--tandem-error-fg-strong)",fontWeight:600},children:"Confirm"}),C.jsx("button",{"data-testid":"bulk-cancel-btn",onClick:()=>K(null),style:{...kh,background:"var(--tandem-surface)",color:"var(--tandem-fg-muted)"},children:"Cancel"})]})})():C.jsxs(C.Fragment,{children:[C.jsxs("button",{"data-testid":"bulk-accept-btn",onClick:()=>K("accept"),style:{...kh,background:"var(--tandem-success-bg)",color:"var(--tandem-success-fg-strong)"},children:["Accept All (",D.length,")"]}),C.jsx("button",{"data-testid":"bulk-dismiss-btn",onClick:()=>K("dismiss"),style:{...kh,background:"var(--tandem-error-bg)",color:"var(--tandem-error-fg-strong)"},children:"Reject All"})]})}),C.jsx("div",{style:{padding:"8px 16px",flex:1},role:"list","aria-label":"Annotations",children:O.length===0?C.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."}):C.jsxs(C.Fragment,{children:[D.map(Y=>{const ge=(Te==null?void 0:Te.id)===Y.id;return C.jsx(NM,{annotation:Y,replies:me.get(Y.id)??[],isReviewTarget:ge,onAccept:Be,onDismiss:je,onEdit:Oe,onReply:Ke,onClick:()=>Zt(Y)},Y.id)}),$.length>0&&C.jsxs("details",{style:{marginTop:"12px"},children:[C.jsxs("summary",{style:{fontSize:"12px",color:"var(--tandem-fg-subtle)",cursor:"pointer"},children:[$.length," resolved"]}),C.jsx("div",{role:"list","aria-label":"Resolved annotations",children:$.map(Y=>C.jsx(NM,{annotation:Y,replies:me.get(Y.id)??[],onUndo:Xe,undoable:se.has(Y.id),onClick:()=>Zt(Y)},Y.id))})]})]})}),C.jsx("style",{children:`
|
|
328
|
+
@keyframes tandem-annotation-flash {
|
|
329
|
+
0% { background-color: var(--tandem-accent-bg); }
|
|
330
|
+
100% { background-color: transparent; }
|
|
331
|
+
}
|
|
332
|
+
.tandem-annotation-flash {
|
|
333
|
+
animation: tandem-annotation-flash 0.8s ease-out;
|
|
334
|
+
}
|
|
335
|
+
@media (prefers-reduced-motion: reduce) {
|
|
336
|
+
.tandem-annotation-flash { animation: none; }
|
|
337
|
+
}
|
|
338
|
+
body.tandem-reduce-motion .tandem-annotation-flash { animation: none; }
|
|
339
|
+
`})]})}const vG=2e3;function SG({connected:t,connectionStatus:e,reconnectAttempts:n,disconnectedSince:r,claudeStatus:i,claudeActive:s,readOnly:l,documentCount:c=0,saving:u=!1}){const{userName:f,setUserName:h}=GM(),[m,g]=_.useState(f),y=_.useRef(null),v=()=>{h(m)};_.useEffect(()=>{m!==f&&document.activeElement!==y.current&&g(f)},[f,m]);const[S,k]=_.useState(!1),[E,j]=_.useState(0),L=_.useRef(t);_.useEffect(()=>{const N=L.current;if(L.current=t,t&&!N){k(!0);const G=setTimeout(()=>k(!1),vG);return()=>clearTimeout(G)}},[t]),_.useEffect(()=>{if(r==null){j(0);return}j(Math.floor((Date.now()-r)/1e3));const N=setInterval(()=>{j(Math.floor((Date.now()-r)/1e3))},1e3);return()=>clearInterval(N)},[r]);const J=e==="connecting",U=t?"var(--tandem-success)":J?"var(--tandem-warning)":"var(--tandem-error)";let M;if(S)M="Reconnected";else if(e==="connected")M="Connected";else if(e==="connecting"){const N=["Reconnecting…"];if(n>0||E>0){const G=[];n>0&&G.push(`attempt ${n}`),E>0&&G.push(`${E}s`),N.push(`(${G.join(", ")})`)}M=N.join(" ")}else M="Disconnected — check that the server is running";return C.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:[C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[C.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:U,display:"inline-block",animation:J?"tandem-reconnect-pulse 1.2s ease-in-out infinite":"none"}}),C.jsx("span",{children:M}),c>0&&C.jsxs("span",{style:{color:"var(--tandem-fg-subtle)"},children:[c," doc",c!==1?"s":""," open"]}),u&&C.jsx("span",{"data-testid":"save-indicator",style:{color:"var(--tandem-accent)",fontStyle:"italic"},children:"Saving..."})]}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"11px",color:"var(--tandem-fg-subtle)"},children:[C.jsx("span",{children:"You:"}),C.jsx("input",{ref:y,"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:VM,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&&C.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"}),C.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[C.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"}}),C.jsx("span",{style:{transition:"color 0.3s ease",color:s?"var(--tandem-fg)":"var(--tandem-fg-subtle)"},children:i?`Claude -- ${i}`:"Claude -- idle"})]}),C.jsx("style",{children:`
|
|
340
|
+
@keyframes tandem-status-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
|
|
341
|
+
@keyframes tandem-reconnect-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
|
|
342
|
+
`})]})}function PR(t,e,n=AL){const r=t.filter(i=>i!==e);return[e,...r].slice(0,n)}function FR(){try{const t=localStorage.getItem(Fx);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 qR(t){try{localStorage.setItem(Fx,JSON.stringify(t))}catch(e){console.warn("[tandem] failed to save recent files:",e)}}function wG(){try{localStorage.removeItem(Fx)}catch(t){console.warn("[tandem] failed to clear recent files:",t)}}function kG({onClose:t}){const[e,n]=_.useState("path"),[r,i]=_.useState(""),[s,l]=_.useState(null),[c,u]=_.useState(!1),[f,h]=_.useState(!1),m=_.useRef(null),[g,y]=_.useState(FR),v=_.useCallback(U=>{y(M=>{const N=PR(M,U);return qR(N),N})},[]),S=_.useCallback(()=>{wG(),y([])},[]),k=_.useCallback(async U=>{if(!c){l(null),u(!0);try{const M=await fetch(`${qu}/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filePath:U})}),N=await M.json();if(!M.ok){l(N.message??"Failed to open file");return}v(U),t()}catch(M){console.error("FileOpenDialog: path open failed",M),M instanceof SyntaxError?l("Server returned an unexpected response"):M instanceof TypeError?l("Unexpected response format"):l("Cannot reach server. Is it running?")}finally{u(!1)}}},[c,t,v]),E=_.useCallback(()=>{r.trim()&&k(r.trim())},[r,k]),j=_.useCallback(async U=>{if(!c){l(null),u(!0);try{const M=await YM(U),N=await fetch(`${qu}/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fileName:U.name,content:M})}),G=await N.json();if(!N.ok){l(G.message??"Failed to upload file");return}t()}catch(M){console.error("FileOpenDialog: upload failed",M),M instanceof SyntaxError?l("Server returned an unexpected response"):M instanceof TypeError?l("Unexpected response format"):l("Cannot reach server. Is it running?")}finally{u(!1)}}},[c,t]),L=_.useCallback(U=>{U.preventDefault(),h(!1);const M=U.dataTransfer.files[0];M&&j(M)},[j]),J=_.useCallback(U=>{var N;const M=(N=U.target.files)==null?void 0:N[0];M&&j(M)},[j]);return C.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:U=>{U.target===U.currentTarget&&t()},onKeyDown:U=>{U.key==="Escape"&&t()},children:C.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:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"16px"},children:[C.jsx("h3",{style:{margin:0,fontSize:"15px",fontWeight:600,color:"var(--tandem-fg)"},children:"Open File"}),C.jsx("button",{onClick:t,style:{background:"none",border:"none",cursor:"pointer",fontSize:"16px",color:"var(--tandem-fg-subtle)"},children:"×"})]}),C.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"16px"},children:[C.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"}),C.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"?C.jsxs("div",{children:[C.jsx("input",{autoFocus:!0,type:"text",placeholder:"Paste absolute file path...",value:r,onChange:U=>i(U.target.value),onKeyDown:U=>{U.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"}),C.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&&C.jsxs("div",{"data-testid":"recent-files-list",style:{marginTop:"14px"},children:[C.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[C.jsx("span",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Recent"}),C.jsx("button",{"data-testid":"clear-recent-files",onClick:S,type:"button",style:{background:"none",border:"none",color:"var(--tandem-fg-subtle)",fontSize:"11px",cursor:"pointer",padding:0,textDecoration:"underline"},children:"Clear all"})]}),C.jsx("div",{style:{maxHeight:"150px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"2px"},children:g.map((U,M)=>{const N=U.split(/[/\\]/),G=N.pop()??U,K=N.join("/")||"/";return C.jsxs("button",{type:"button","data-testid":`recent-file-${M}`,onClick:()=>{i(U),k(U)},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:[C.jsx("span",{style:{fontSize:"13px",color:"var(--tandem-fg)"},children:G}),C.jsx("span",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"380px"},children:K})]},U)})})]})]}):C.jsxs("div",{onDragOver:U=>{U.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:L,onClick:()=>{var U;return(U=m.current)==null?void 0:U.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:[C.jsx("input",{ref:m,type:"file",accept:".md,.txt,.html,.htm,.docx",onChange:J,style:{display:"none"}}),C.jsx("div",{style:{fontSize:"13px",color:"var(--tandem-fg-muted)"},children:c?"Uploading...":"Drop a file here or click to browse"}),C.jsx("div",{style:{fontSize:"11px",color:"var(--tandem-fg-subtle)",marginTop:"6px"},children:".md, .txt, .html, .docx"})]}),s&&C.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 CG(t){const[e,n]=_.useState(!1),r=_.useRef(0),i=_.useRef(null);return _.useEffect(()=>{if(t.readOnly){n(!1);return}const{ydoc:s}=t,l=s.getXmlFragment("default"),c=s.getMap(Eh);let u=!1;const f=setTimeout(()=>{u=!0,i.current=c.get(PC)??0,r.current=0,n(!1)},500),h=()=>{u&&(r.current++,n(!0))};l.observeDeep(h);const m=()=>{if(!u)return;const g=c.get(PC);g!==void 0&&g!==i.current&&(i.current=g,r.current=0,n(!1))};return c.observe(m),()=>{clearTimeout(f),l.unobserveDeep(h),c.unobserve(m)}},[t.ydoc,t.readOnly]),e}const EG={md:"M",txt:"T",html:"H",docx:"W"};function TG({tab:t,isActive:e,onSwitch:n,onClose:r,draggable:i,onDragStart:s,onDragOver:l,onDrop:c,onDragEnd:u,onDragLeave:f,dropIndicator:h,onKeyDown:m}){const g=CG(t);return C.jsxs("div",{"data-testid":`tab-${t.id}`,"data-active":e,onClick:()=>n(t.id),draggable:i,tabIndex:0,onDragStart:y=>s(y,t.id),onDragOver:y=>l(y,t.id),onDrop:y=>c(y,t.id),onDragEnd:u,onDragLeave:f,onKeyDown:y=>m(y,t.id),style:{display:"flex",alignItems:"center",gap:"6px",padding:"4px 12px",fontSize:"13px",cursor:"pointer",background:e?"var(--tandem-surface)":"transparent",color:e?"var(--tandem-fg)":"var(--tandem-fg-muted)",borderTop:e?"2px solid var(--tandem-accent)":"2px solid transparent",borderBottom:e?"1px solid var(--tandem-surface)":"1px solid transparent",borderLeft:h==="left"?"2px solid var(--tandem-accent)":"2px solid transparent",borderRight:h==="right"?"2px solid var(--tandem-accent)":"2px solid transparent",marginBottom:"-1px",userSelect:"none",whiteSpace:"nowrap",transition:"background 0.15s, color 0.15s",flexShrink:0},children:[g&&C.jsx("span",{"data-testid":`unsaved-indicator-${t.id}`,style:{color:"var(--tandem-warning)",fontSize:"10px"},children:"●"}),C.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:e?"var(--tandem-accent)":"var(--tandem-fg-subtle)",width:"14px",textAlign:"center"},children:EG[t.format]||"?"}),C.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&&C.jsx("span",{style:{fontSize:"9px",color:"var(--tandem-warning-fg-strong)",background:"var(--tandem-warning-bg)",padding:"0 3px",borderRadius:"2px"},children:"RO"}),C.jsx("button",{onClick:y=>{y.stopPropagation(),r(t.id)},onDragOver:y=>{y.stopPropagation(),y.preventDefault()},onDrop:y=>{y.stopPropagation(),y.preventDefault()},style:{background:"none",border:"none",cursor:"pointer",fontSize:"14px",lineHeight:1,color:"var(--tandem-fg-subtle)",padding:"0 2px",borderRadius:"2px"},onMouseEnter:y=>y.currentTarget.style.color="var(--tandem-error)",onMouseLeave:y=>y.currentTarget.style.color="var(--tandem-fg-subtle)",title:"Close document",children:"×"})]})}const Vx="tandem-tab-scroll-hide";function AG(){return C.jsx("style",{children:`
|
|
343
|
+
.${Vx} {
|
|
344
|
+
scrollbar-width: none;
|
|
345
|
+
-ms-overflow-style: none;
|
|
346
|
+
}
|
|
347
|
+
.${Vx}::-webkit-scrollbar {
|
|
348
|
+
display: none;
|
|
349
|
+
}
|
|
350
|
+
`})}const KR={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},MG={...KR,background:"linear-gradient(to left, var(--tandem-surface-muted) 70%, transparent)"};function OG({tabs:t,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:i,reduceMotion:s}){const l=s?"auto":"smooth",[c,u]=_.useState(!1),f=_.useRef(new Set);_.useEffect(()=>{const H=new Set(t.map(I=>I.id));for(const I of f.current)H.has(I)||f.current.delete(I)},[t]);const h=_.useCallback(H=>{f.current.has(H)||(f.current.add(H),r(H))},[r]),m=_.useRef(null),[g,y]=_.useState(!1),[v,S]=_.useState(!1),[k,E]=_.useState(null),[j,L]=_.useState(null);function J(){E(null),L(null)}const U=_.useCallback(()=>{const H=m.current;H&&(y(H.scrollLeft>0),S(H.scrollLeft+H.clientWidth<H.scrollWidth-1))},[]);_.useEffect(()=>{const H=m.current;if(!H)return;U(),H.addEventListener("scroll",U,{passive:!0});const I=new ResizeObserver(U);return I.observe(H),()=>{H.removeEventListener("scroll",U),I.disconnect()}},[U]),_.useEffect(()=>{U()},[t.length,U]),_.useEffect(()=>{if(!e||!m.current)return;const H=m.current.querySelector(`[data-testid="tab-${e}"]`);H&&H.scrollIntoView({inline:"nearest",block:"nearest",behavior:l})},[e,l]),_.useEffect(()=>{J()},[t.length]);const M=_.useCallback((H,I)=>{E(I),H.dataTransfer.setData("text/plain",I),H.dataTransfer.effectAllowed="move"},[]),N=_.useCallback((H,I)=>{if(H.preventDefault(),!k||k===I){L(null);return}const Z=H.currentTarget.getBoundingClientRect(),me=Z.left+Z.width/2,Me=H.clientX<me?"left":"right";L({id:I,side:Me})},[k]),G=_.useCallback((H,I)=>{H.preventDefault();const Z=H.dataTransfer.getData("text/plain");if(Z&&Z!==I&&i){const me=H.currentTarget.getBoundingClientRect(),Me=me.left+me.width/2,O=H.clientX<Me?"left":"right";i(Z,I,O)}J()},[i]),K=_.useCallback(()=>{J()},[]),ce=_.useCallback(()=>{L(null)},[]),ie=_.useCallback((H,I)=>{if(!H.altKey||!i||H.key!=="ArrowLeft"&&H.key!=="ArrowRight")return;H.preventDefault();const Z=t.findIndex(me=>me.id===I);Z!==-1&&(H.key==="ArrowLeft"&&Z>0?i(I,t[Z-1].id):H.key==="ArrowRight"&&Z<t.length-1&&i(t[Z+1].id,I))},[t,i]),se=_.useCallback(()=>{var H;(H=m.current)==null||H.scrollBy({left:-150,behavior:l})},[l]),xe=_.useCallback(()=>{var H;(H=m.current)==null||H.scrollBy({left:150,behavior:l})},[l]),pe=t.length<=1;return C.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",background:"var(--tandem-surface-muted)",borderBottom:"1px solid var(--tandem-border)",minHeight:"32px"},children:[C.jsx(AG,{}),g&&C.jsx("button",{"data-testid":"tab-scroll-left",onClick:se,style:{...KR,background:"linear-gradient(to right, var(--tandem-surface-muted) 70%, transparent)",color:"var(--tandem-fg-muted)"},title:"Scroll tabs left",children:"◀"}),C.jsx("div",{ref:m,"data-testid":"tab-scroll-container",className:Vx,style:{display:"flex",alignItems:"center",gap:"1px",flex:1,overflowX:"auto",overflowY:"hidden",padding:"0 4px"},children:t.map(H=>C.jsx(TG,{tab:H,isActive:H.id===e,onSwitch:n,onClose:h,draggable:!pe,onDragStart:M,onDragOver:N,onDrop:G,onDragEnd:K,onDragLeave:ce,dropIndicator:(j==null?void 0:j.id)===H.id?j.side:null,onKeyDown:ie},H.id))}),v&&C.jsx("button",{"data-testid":"tab-scroll-right",onClick:xe,style:{...MG,background:"linear-gradient(to left, var(--tandem-surface-muted) 70%, transparent)",color:"var(--tandem-fg-muted)"},title:"Scroll tabs right",children:"▶"}),C.jsx("button",{onClick:()=>u(!0),"data-testid":"open-file-btn",title:"Open file",style:{background:"none",border:"1px solid var(--tandem-border-strong)",borderRadius:"4px",cursor:"pointer",fontSize:"16px",lineHeight:1,color:"var(--tandem-fg-muted)",padding:"2px 8px",marginLeft:"4px",marginRight:"8px",flexShrink:0},onMouseEnter:H=>{H.currentTarget.style.color="var(--tandem-accent)",H.currentTarget.style.borderColor="var(--tandem-accent)"},onMouseLeave:H=>{H.currentTarget.style.color="var(--tandem-fg-muted)",H.currentTarget.style.borderColor="var(--tandem-border-strong)"},children:"+"}),c&&C.jsx(kG,{onClose:()=>u(!1)})]})}function zM({connected:t,claudeActive:e}){const[n,r]=_.useState(!1);return _.useEffect(()=>{if(t){r(!1);return}const i=setTimeout(()=>r(!0),xL);return()=>clearTimeout(i)},[t]),C.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--tandem-fg-subtle)",gap:"8px"},children:n?C.jsx("span",{children:"Cannot reach the Tandem server. Is it running?"}):C.jsxs(C.Fragment,{children:[C.jsx("span",{children:"No document open. Click + in the tab bar or drop a file here."}),t&&!e&&C.jsx("span",{style:{fontSize:"0.85em",color:"var(--tandem-fg-subtle)"},children:"Tip: open Claude Code in this directory to start collaborating"})]})})}function _G({onDismiss:t}){return C.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:[C.jsx("span",{children:"Connection to the Tandem server has been lost. Ensure the server is running."}),C.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 YR=200,WR=600,GR=300;function Ch(t){const e=jM[t];try{const n=localStorage.getItem(e);if(n){const r=parseInt(n,10);if(Number.isFinite(r))return Math.max(YR,Math.min(WR,r));console.warn(`[tandem] ignoring non-numeric panel width for ${e}: ${n}`)}}catch(n){console.warn(`[tandem] localStorage unavailable reading ${e}:`,n)}return GR}function DG(){RF();const{tabs:t,activeTabId:e,setActiveTabId:n,handleTabClose:r,connected:i,connectionStatus:s,reconnectAttempts:l,disconnectedSince:c,annotations:u,claudeStatus:f,claudeActive:h,readOnly:m,bootstrapYdoc:g,ready:y,serverRestarted:v}=q7(),{orderedTabs:S,reorder:k}=xF(t);yF(S,e,n),_.useEffect(()=>{if(t.length!==0)try{const he=FR();let Nt=he;for(const Kt of t)DL(Kt.filePath)||(Nt=PR(Nt,Kt.filePath));(Nt.length!==he.length||Nt.some((Kt,Xn)=>Kt!==he[Xn]))&&qR(Nt)}catch(he){console.warn("[tandem] failed to sync recent files:",he)}},[t.length]);const[E,j]=_.useState(()=>{try{const he=localStorage.getItem(Gf);return i3.safeParse(he).success?he:$C}catch(he){return console.warn(`[tandem] localStorage unavailable reading ${Gf}:`,he),$C}});_.useEffect(()=>{try{localStorage.setItem(Gf,E)}catch(he){console.warn(`[tandem] failed to persist ${Gf}:`,he)}},[E]),_.useEffect(()=>{if(!g)return;g.getMap(vb).set(CL,E)},[E,g]);const[L,J]=_.useState(!1),[U,M]=_.useState(!1);_.useEffect(()=>{if(c==null){J(!1),M(!1);return}const he=Date.now()-c,Nt=vL-he;if(Nt<=0){J(!0);return}const Kt=setTimeout(()=>J(!0),Nt);return()=>clearTimeout(Kt)},[c]);const{visibleAnnotations:N,heldCount:G}=uF(u,E),K=_.useMemo(()=>t.map(he=>({id:he.id,fileName:he.fileName})),[t]),{saving:ce}=hF(e),{toasts:ie,dismiss:se}=dF(),{fileDragOver:xe,handleEditorDragOver:pe,handleEditorDragLeave:H,handleEditorDrop:I}=aF(),{showReviewSummary:Z,reviewSummaryData:me,dismissReviewSummary:Me}=fF(u),{settings:O,updateSettings:D}=kF(),[$,T]=_.useState(!1),F=_.useRef(null),ue=_.useCallback(()=>{T(!0)},[]),le=_.useRef($);le.current=$;const Ne=_.useCallback(()=>{if(le.current){T(!1);return}ue()},[ue]);mF(Ne),_.useEffect(()=>{if(!g)return;g.getMap(vb).set(EL,O.selectionDwellMs)},[O.selectionDwellMs,g]),_.useEffect(()=>{const he=Ft.current;if(!he)return;const Nt=he.state.tr.setMeta(wa,{type:"toggle",visible:O.showAuthorship});he.view.dispatch(Nt)},[O.showAuthorship]),_.useEffect(()=>(document.body.classList.toggle("tandem-reduce-motion",O.reduceMotion),()=>document.body.classList.remove("tandem-reduce-motion")),[O.reduceMotion]),TF(O.theme),_.useEffect(()=>{const he=vF[O.textSize];return document.documentElement.style.setProperty("--tandem-editor-font-size",`${he}px`),()=>{document.documentElement.style.removeProperty("--tandem-editor-font-size")}},[O.textSize]);const[Be,je]=_.useState(!1),[Xe,Oe]=_.useState(()=>O.primaryTab==="chat"),Ke=_.useMemo(()=>Xe?N.filter(he=>he.status==="pending").length:0,[N,Xe]),[Mt,Ot]=_.useState(null),[Zt,$n]=_.useState(!1),[hr,Vn]=_.useState(null),Ft=_.useRef(null),pr=_.useRef(null),ni=_.useCallback(he=>{Ft.current=he},[]),Hi=_.useCallback(he=>{Oe(!1),Ot(he)},[]),[_r,qt]=_.useState(()=>O.layout==="three-panel"?{kind:"three-panel",left:Ch("left"),right:Ch("right")}:{kind:"tabbed",right:Ch("right")});_.useEffect(()=>{qt(he=>O.layout==="three-panel"?he.kind==="three-panel"?he:{kind:"three-panel",left:Ch("left"),right:he.right}:he.kind==="tabbed"?he:{kind:"tabbed",right:he.right})},[O.layout]);const $i=O.editorWidthPercent<100?`${O.editorWidthPercent}%`:void 0,X=O.editorWidthPercent<100?"0 auto":void 0,de=_.useRef(_r);de.current=_r;const Te=_.useRef(null);_.useEffect(()=>()=>{Te.current&&(document.removeEventListener("mousemove",Te.current.move),document.removeEventListener("mouseup",Te.current.up),document.body.style.userSelect="",document.body.style.cursor="")},[]);const Y=_.useCallback((he,Nt)=>{he.preventDefault();const Kt=he.clientX,Xn=de.current,Dr=Nt==="left"?Xn.kind==="three-panel"?Xn.left:GR:Xn.right,mi=jM[Nt];let gi=Dr;document.body.style.userSelect="none",document.body.style.cursor="col-resize";const Vi=Al=>{const Ml=Al.clientX-Kt,Eo=Nt==="left"?Dr+Ml:Dr-Ml;gi=Math.max(YR,Math.min(WR,Eo)),qt(To=>Nt==="right"?To.kind==="three-panel"?{...To,right:gi}:{kind:"tabbed",right:gi}:To.kind!=="three-panel"?To:{...To,left:gi})},pc=()=>{document.removeEventListener("mousemove",Vi),document.removeEventListener("mouseup",pc),Te.current=null,document.body.style.userSelect="",document.body.style.cursor="";try{localStorage.setItem(mi,String(gi))}catch(Al){console.warn(`[tandem] failed to persist ${mi}:`,Al)}};Te.current={move:Vi,up:pc},document.addEventListener("mousemove",Vi),document.addEventListener("mouseup",pc)},[]),ge=_.useCallback(()=>{je(he=>!he)},[]),Re=_.useCallback(()=>{je(!1)},[]),tt=_.useCallback(()=>{if(Xe)return;const he=Ft.current;if(!he)return;const{from:Nt,to:Kt}=he.state.selection;if(Nt===Kt)return;const Xn=K2(he.state.doc,{from:Zr(Nt),to:Zr(Kt)}),Dr=he.state.doc.textBetween(Nt,Kt,`
|
|
351
|
+
`);Vn({...Xn,textSnapshot:Dr.length>200?Dr.slice(0,197)+"...":Dr})},[Xe]);_.useEffect(()=>{const he=Nt=>{if(Nt.key!=="?")return;const Kt=Nt.target;Kt.tagName==="INPUT"||Kt.tagName==="TEXTAREA"||Kt.isContentEditable||$n(Xn=>!Xn)};return window.addEventListener("keydown",he),()=>window.removeEventListener("keydown",he)},[]);const re=t.find(he=>he.id===e),{tutorialActive:Le,currentStep:nt,dismissTutorial:Ge,nextStep:It}=MF(u,Ft,re==null?void 0:re.fileName);return y?C.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh"},children:[v&&C.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"}),L&&!U&&C.jsx(_G,{onDismiss:()=>M(!0)}),C.jsx(lF,{editor:Ft.current,ydoc:(re==null?void 0:re.ydoc)??null,onSettingsOpen:Ne,settingsBtnRef:F,tandemMode:E,onModeChange:j,heldCount:G}),C.jsx(OG,{tabs:S,activeTabId:e,onTabSwitch:n,onTabClose:r,reorder:k,reduceMotion:O.reduceMotion}),_r.kind==="three-panel"?C.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[C.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${_r.left}px`,borderRight:"1px solid var(--tandem-border)"},children:[C.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:O.panelOrder==="chat-editor-annotations"?"Chat":"Annotations"}),C.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:O.panelOrder==="chat-editor-annotations"?C.jsx(mb,{ctrlYdoc:g,editor:Ft.current,activeDocId:e,openDocs:K,claudeActive:h,claudeStatus:f,visible:!0,capturedAnchor:hr,onCapturedAnchorChange:Vn,inputRef:pr,reduceMotion:O.reduceMotion}):C.jsx(bb,{annotations:N,editor:Ft.current,ydoc:(re==null?void 0:re.ydoc)??null,heldCount:G,tandemMode:E,onModeChange:j,activeDocFormat:re==null?void 0:re.format,documentId:re==null?void 0:re.id,reviewMode:Be,onToggleReviewMode:ge,onExitReviewMode:Re,activeAnnotationId:Mt,onActiveAnnotationChange:Ot,reduceMotion:O.reduceMotion})})]}),C.jsx("div",{"data-testid":"left-panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize left panel",tabIndex:0,onMouseDown:he=>Y(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"}}),C.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:H,onDrop:I,children:[C.jsx(fE,{visible:(re==null?void 0:re.readOnly)===!0&&(re==null?void 0:re.format)==="docx",documentId:re==null?void 0:re.id}),C.jsx("div",{style:{maxWidth:$i,margin:X},children:re?C.jsx(IA,{ydoc:re.ydoc,provider:re.provider,readOnly:m,reviewMode:Be,activeAnnotationId:Mt,onEditorReady:ni,onAnnotationClick:Hi},re.id):C.jsx(zM,{connected:i,claudeActive:h})})]}),C.jsx("div",{"data-testid":"right-panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize right panel",tabIndex:0,onMouseDown:he=>Y(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"}}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${_r.right}px`,borderLeft:"1px solid var(--tandem-border)"},children:[C.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:O.panelOrder==="chat-editor-annotations"?"Annotations":"Chat"}),C.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:O.panelOrder==="chat-editor-annotations"?C.jsx(bb,{annotations:N,editor:Ft.current,ydoc:(re==null?void 0:re.ydoc)??null,heldCount:G,tandemMode:E,onModeChange:j,activeDocFormat:re==null?void 0:re.format,documentId:re==null?void 0:re.id,reviewMode:Be,onToggleReviewMode:ge,onExitReviewMode:Re,activeAnnotationId:Mt,onActiveAnnotationChange:Ot,reduceMotion:O.reduceMotion}):C.jsx(mb,{ctrlYdoc:g,editor:Ft.current,activeDocId:e,openDocs:K,claudeActive:h,claudeStatus:f,visible:!0,capturedAnchor:hr,onCapturedAnchorChange:Vn,inputRef:pr,reduceMotion:O.reduceMotion})})]})]}):C.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[C.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:H,onDrop:I,children:[C.jsx(fE,{visible:(re==null?void 0:re.readOnly)===!0&&(re==null?void 0:re.format)==="docx",documentId:re==null?void 0:re.id}),C.jsx("div",{style:{maxWidth:$i,margin:X},children:re?C.jsx(IA,{ydoc:re.ydoc,provider:re.provider,readOnly:m,reviewMode:Be,activeAnnotationId:Mt,onEditorReady:ni,onAnnotationClick:Hi},re.id):C.jsx(zM,{connected:i,claudeActive:h})})]}),C.jsx("div",{"data-testid":"panel-resize-handle",role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",tabIndex:0,onMouseDown:he=>Y(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"}}),C.jsxs("div",{style:{display:"flex",flexDirection:"column",width:`${_r.right}px`,borderLeft:"1px solid var(--tandem-border)"},children:[C.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--tandem-border)",background:"var(--tandem-surface-muted)"},children:[C.jsxs("button",{"data-testid":"annotations-tab",onClick:()=>Oe(!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&&Ke>0&&C.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:Ke>9?"9+":Ke})]}),C.jsx("button",{"data-testid":"chat-tab",onMouseDown:tt,onClick:()=>Oe(!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"})]}),C.jsx("div",{style:{display:Xe?"flex":"none",flexDirection:"column",flex:1,minHeight:0},children:C.jsx(mb,{ctrlYdoc:g,editor:Ft.current,activeDocId:e,openDocs:K,claudeActive:h,claudeStatus:f,visible:Xe,capturedAnchor:hr,onCapturedAnchorChange:Vn,inputRef:pr,reduceMotion:O.reduceMotion})}),C.jsx("div",{style:{display:Xe?"none":"flex",flexDirection:"column",flex:1,minHeight:0},children:C.jsx(bb,{annotations:N,editor:Ft.current,ydoc:(re==null?void 0:re.ydoc)??null,heldCount:G,tandemMode:E,onModeChange:j,activeDocFormat:re==null?void 0:re.format,documentId:re==null?void 0:re.id,reviewMode:Be,onToggleReviewMode:ge,onExitReviewMode:Re,activeAnnotationId:Mt,onActiveAnnotationChange:Ot,reduceMotion:O.reduceMotion})})]})]}),C.jsx(SG,{connected:i,connectionStatus:s,reconnectAttempts:l,disconnectedSince:c,claudeStatus:f,claudeActive:h,readOnly:m,documentCount:t.length,saving:ce}),Z&&me&&C.jsx(hG,{accepted:me.accepted,dismissed:me.dismissed,total:me.total,onDismiss:Me}),C.jsx(p3,{open:$,onClose:()=>T(!1),settings:O,onUpdate:D,returnFocusRef:F,anchorRef:F}),C.jsx(o3,{open:Zt,onClose:()=>$n(!1)}),C.jsx(b3,{toasts:ie,onDismiss:se}),Le&&C.jsx(a3,{currentStep:nt,onNext:It,onDismiss:Ge})]}):C.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100vh",color:"var(--tandem-fg-subtle)"},children:"Connecting..."})}class RG extends pn.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?C.jsxs("div",{style:{padding:"2rem",fontFamily:"system-ui, sans-serif",color:"var(--tandem-fg)"},children:[C.jsx("h2",{children:"Something went wrong"}),C.jsx("p",{style:{color:"var(--tandem-fg-muted)"},children:"The editor encountered an unexpected error. Reload the page to continue."}),C.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}),C.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 NG=yL.createRoot(document.getElementById("root"));NG.render(C.jsx(pn.StrictMode,{children:C.jsx(RG,{children:C.jsx(DG,{})})}));
|