@maplab/hyperdoc 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,549 +0,0 @@
1
- var b_=Object.defineProperty;var xw=t=>{throw TypeError(t)};var S_=(t,e,n)=>e in t?b_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var qe=(t,e,n)=>S_(t,typeof e!="symbol"?e+"":e,n),Lp=(t,e,n)=>e.has(t)||xw("Cannot "+n);var R=(t,e,n)=>(Lp(t,e,"read from private field"),n?n.call(t):e.get(t)),de=(t,e,n)=>e.has(t)?xw("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),J=(t,e,n,r)=>(Lp(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Ae=(t,e,n)=>(Lp(t,e,"access private method"),n);var _c=(t,e,n,r)=>({set _(s){J(t,e,s,n)},get _(){return R(t,e,r)}});function C_(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function QS(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ZS={exports:{}},Mh={},YS={exports:{}},Oe={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its 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 fc=Symbol.for("react.element"),E_=Symbol.for("react.portal"),T_=Symbol.for("react.fragment"),R_=Symbol.for("react.strict_mode"),M_=Symbol.for("react.profiler"),N_=Symbol.for("react.provider"),O_=Symbol.for("react.context"),A_=Symbol.for("react.forward_ref"),__=Symbol.for("react.suspense"),P_=Symbol.for("react.memo"),I_=Symbol.for("react.lazy"),ww=Symbol.iterator;function D_(t){return t===null||typeof t!="object"?null:(t=ww&&t[ww]||t["@@iterator"],typeof t=="function"?t:null)}var XS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},eC=Object.assign,tC={};function pa(t,e,n){this.props=t,this.context=e,this.refs=tC,this.updater=n||XS}pa.prototype.isReactComponent={};pa.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};pa.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function nC(){}nC.prototype=pa.prototype;function Sv(t,e,n){this.props=t,this.context=e,this.refs=tC,this.updater=n||XS}var Cv=Sv.prototype=new nC;Cv.constructor=Sv;eC(Cv,pa.prototype);Cv.isPureReactComponent=!0;var kw=Array.isArray,rC=Object.prototype.hasOwnProperty,Ev={current:null},sC={key:!0,ref:!0,__self:!0,__source:!0};function iC(t,e,n){var r,s={},i=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)rC.call(e,r)&&!sC.hasOwnProperty(r)&&(s[r]=e[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var a=Array(l),u=0;u<l;u++)a[u]=arguments[u+2];s.children=a}if(t&&t.defaultProps)for(r in l=t.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:fc,type:t,key:i,ref:o,props:s,_owner:Ev.current}}function L_(t,e){return{$$typeof:fc,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Tv(t){return typeof t=="object"&&t!==null&&t.$$typeof===fc}function j_(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var bw=/\/+/g;function jp(t,e){return typeof t=="object"&&t!==null&&t.key!=null?j_(""+t.key):e.toString(36)}function Ed(t,e,n,r,s){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case fc:case E_:o=!0}}if(o)return o=t,s=s(o),t=r===""?"."+jp(o,0):r,kw(s)?(n="",t!=null&&(n=t.replace(bw,"$&/")+"/"),Ed(s,e,n,"",function(u){return u})):s!=null&&(Tv(s)&&(s=L_(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(bw,"$&/")+"/")+t)),e.push(s)),1;if(o=0,r=r===""?".":r+":",kw(t))for(var l=0;l<t.length;l++){i=t[l];var a=r+jp(i,l);o+=Ed(i,e,n,a,s)}else if(a=D_(t),typeof a=="function")for(t=a.call(t),l=0;!(i=t.next()).done;)i=i.value,a=r+jp(i,l++),o+=Ed(i,e,n,a,s);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function Pc(t,e,n){if(t==null)return t;var r=[],s=0;return Ed(t,r,"","",function(i){return e.call(n,i,s++)}),r}function $_(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var cn={current:null},Td={transition:null},z_={ReactCurrentDispatcher:cn,ReactCurrentBatchConfig:Td,ReactCurrentOwner:Ev};function oC(){throw Error("act(...) is not supported in production builds of React.")}Oe.Children={map:Pc,forEach:function(t,e,n){Pc(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return Pc(t,function(){e++}),e},toArray:function(t){return Pc(t,function(e){return e})||[]},only:function(t){if(!Tv(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Oe.Component=pa;Oe.Fragment=T_;Oe.Profiler=M_;Oe.PureComponent=Sv;Oe.StrictMode=R_;Oe.Suspense=__;Oe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=z_;Oe.act=oC;Oe.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=eC({},t.props),s=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=Ev.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(a in e)rC.call(e,a)&&!sC.hasOwnProperty(a)&&(r[a]=e[a]===void 0&&l!==void 0?l[a]:e[a])}var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){l=Array(a);for(var u=0;u<a;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:fc,type:t.type,key:s,ref:i,props:r,_owner:o}};Oe.createContext=function(t){return t={$$typeof:O_,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:N_,_context:t},t.Consumer=t};Oe.createElement=iC;Oe.createFactory=function(t){var e=iC.bind(null,t);return e.type=t,e};Oe.createRef=function(){return{current:null}};Oe.forwardRef=function(t){return{$$typeof:A_,render:t}};Oe.isValidElement=Tv;Oe.lazy=function(t){return{$$typeof:I_,_payload:{_status:-1,_result:t},_init:$_}};Oe.memo=function(t,e){return{$$typeof:P_,type:t,compare:e===void 0?null:e}};Oe.startTransition=function(t){var e=Td.transition;Td.transition={};try{t()}finally{Td.transition=e}};Oe.unstable_act=oC;Oe.useCallback=function(t,e){return cn.current.useCallback(t,e)};Oe.useContext=function(t){return cn.current.useContext(t)};Oe.useDebugValue=function(){};Oe.useDeferredValue=function(t){return cn.current.useDeferredValue(t)};Oe.useEffect=function(t,e){return cn.current.useEffect(t,e)};Oe.useId=function(){return cn.current.useId()};Oe.useImperativeHandle=function(t,e,n){return cn.current.useImperativeHandle(t,e,n)};Oe.useInsertionEffect=function(t,e){return cn.current.useInsertionEffect(t,e)};Oe.useLayoutEffect=function(t,e){return cn.current.useLayoutEffect(t,e)};Oe.useMemo=function(t,e){return cn.current.useMemo(t,e)};Oe.useReducer=function(t,e,n){return cn.current.useReducer(t,e,n)};Oe.useRef=function(t){return cn.current.useRef(t)};Oe.useState=function(t){return cn.current.useState(t)};Oe.useSyncExternalStore=function(t,e,n){return cn.current.useSyncExternalStore(t,e,n)};Oe.useTransition=function(){return cn.current.useTransition()};Oe.version="18.3.1";YS.exports=Oe;var v=YS.exports;const Yn=QS(v),Nh=C_({__proto__:null,default:Yn},[v]);/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its 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 F_=v,B_=Symbol.for("react.element"),V_=Symbol.for("react.fragment"),H_=Object.prototype.hasOwnProperty,U_=F_.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,W_={key:!0,ref:!0,__self:!0,__source:!0};function lC(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)H_.call(e,r)&&!W_.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:B_,type:t,key:i,ref:o,props:s,_owner:U_.current}}Mh.Fragment=V_;Mh.jsx=lC;Mh.jsxs=lC;ZS.exports=Mh;var w=ZS.exports,aC={exports:{}},In={},uC={exports:{}},cC={};/**
18
- * @license React
19
- * scheduler.production.min.js
20
- *
21
- * Copyright (c) Facebook, Inc. and its 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
- */(function(t){function e(M,V){var ie=M.length;M.push(V);e:for(;0<ie;){var Ee=ie-1>>>1,P=M[Ee];if(0<s(P,V))M[Ee]=V,M[ie]=P,ie=Ee;else break e}}function n(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var V=M[0],ie=M.pop();if(ie!==V){M[0]=ie;e:for(var Ee=0,P=M.length,q=P>>>1;Ee<q;){var G=2*(Ee+1)-1,K=M[G],j=G+1,F=M[j];if(0>s(K,ie))j<P&&0>s(F,K)?(M[Ee]=F,M[j]=ie,Ee=j):(M[Ee]=K,M[G]=ie,Ee=G);else if(j<P&&0>s(F,ie))M[Ee]=F,M[j]=ie,Ee=j;else break e}}return V}function s(M,V){var ie=M.sortIndex-V.sortIndex;return ie!==0?ie:M.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var a=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(M){for(var V=n(u);V!==null;){if(V.callback===null)r(u);else if(V.startTime<=M)r(u),V.sortIndex=V.expirationTime,e(a,V);else break;V=n(u)}}function b(M){if(m=!1,k(M),!p)if(n(a)!==null)p=!0,se(S);else{var V=n(u);V!==null&&ye(b,V.startTime-M)}}function S(M,V){p=!1,m&&(m=!1,g(T),T=-1),h=!0;var ie=f;try{for(k(V),d=n(a);d!==null&&(!(d.expirationTime>V)||M&&!H());){var Ee=d.callback;if(typeof Ee=="function"){d.callback=null,f=d.priorityLevel;var P=Ee(d.expirationTime<=V);V=t.unstable_now(),typeof P=="function"?d.callback=P:d===n(a)&&r(a),k(V)}else r(a);d=n(a)}if(d!==null)var q=!0;else{var G=n(u);G!==null&&ye(b,G.startTime-V),q=!1}return q}finally{d=null,f=ie,h=!1}}var C=!1,E=null,T=-1,N=5,O=-1;function H(){return!(t.unstable_now()-O<N)}function ne(){if(E!==null){var M=t.unstable_now();O=M;var V=!0;try{V=E(!0,M)}finally{V?ae():(C=!1,E=null)}}else C=!1}var ae;if(typeof x=="function")ae=function(){x(ne)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,le=Q.port2;Q.port1.onmessage=ne,ae=function(){le.postMessage(null)}}else ae=function(){y(ne,0)};function se(M){E=M,C||(C=!0,ae())}function ye(M,V){T=y(function(){M(t.unstable_now())},V)}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(M){M.callback=null},t.unstable_continueExecution=function(){p||h||(p=!0,se(S))},t.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<M?Math.floor(1e3/M):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(a)},t.unstable_next=function(M){switch(f){case 1:case 2:case 3:var V=3;break;default:V=f}var ie=f;f=V;try{return M()}finally{f=ie}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(M,V){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var ie=f;f=M;try{return V()}finally{f=ie}},t.unstable_scheduleCallback=function(M,V,ie){var Ee=t.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?Ee+ie:Ee):ie=Ee,M){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=ie+P,M={id:c++,callback:V,priorityLevel:M,startTime:ie,expirationTime:P,sortIndex:-1},ie>Ee?(M.sortIndex=ie,e(u,M),n(a)===null&&M===n(u)&&(m?(g(T),T=-1):m=!0,ye(b,ie-Ee))):(M.sortIndex=P,e(a,M),p||h||(p=!0,se(S))),M},t.unstable_shouldYield=H,t.unstable_wrapCallback=function(M){var V=f;return function(){var ie=f;f=V;try{return M.apply(this,arguments)}finally{f=ie}}}})(cC);uC.exports=cC;var q_=uC.exports;/**
26
- * @license React
27
- * react-dom.production.min.js
28
- *
29
- * Copyright (c) Facebook, Inc. and its 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 G_=v,_n=q_;function z(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var dC=new Set,Cu={};function Lo(t,e){Wl(t,e),Wl(t+"Capture",e)}function Wl(t,e){for(Cu[t]=e,t=0;t<e.length;t++)dC.add(e[t])}var Ss=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),lg=Object.prototype.hasOwnProperty,K_=/^[: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]*$/,Sw={},Cw={};function J_(t){return lg.call(Cw,t)?!0:lg.call(Sw,t)?!1:K_.test(t)?Cw[t]=!0:(Sw[t]=!0,!1)}function Q_(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Z_(t,e,n,r){if(e===null||typeof e>"u"||Q_(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function dn(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var Ft={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ft[t]=new dn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ft[e]=new dn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ft[t]=new dn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ft[t]=new dn(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Ft[t]=new dn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ft[t]=new dn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ft[t]=new dn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ft[t]=new dn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ft[t]=new dn(t,5,!1,t.toLowerCase(),null,!1,!1)});var Rv=/[\-:]([a-z])/g;function Mv(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Rv,Mv);Ft[e]=new dn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Rv,Mv);Ft[e]=new dn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Rv,Mv);Ft[e]=new dn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ft[t]=new dn(t,1,!1,t.toLowerCase(),null,!1,!1)});Ft.xlinkHref=new dn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ft[t]=new dn(t,1,!1,t.toLowerCase(),null,!0,!0)});function Nv(t,e,n,r){var s=Ft.hasOwnProperty(e)?Ft[e]:null;(s!==null?s.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(Z_(e,n,s,r)&&(n=null),r||s===null?J_(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):s.mustUseProperty?t[s.propertyName]=n===null?s.type===3?!1:"":n:(e=s.attributeName,r=s.attributeNamespace,n===null?t.removeAttribute(e):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var Ms=G_.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ic=Symbol.for("react.element"),cl=Symbol.for("react.portal"),dl=Symbol.for("react.fragment"),Ov=Symbol.for("react.strict_mode"),ag=Symbol.for("react.profiler"),fC=Symbol.for("react.provider"),hC=Symbol.for("react.context"),Av=Symbol.for("react.forward_ref"),ug=Symbol.for("react.suspense"),cg=Symbol.for("react.suspense_list"),_v=Symbol.for("react.memo"),zs=Symbol.for("react.lazy"),pC=Symbol.for("react.offscreen"),Ew=Symbol.iterator;function Ta(t){return t===null||typeof t!="object"?null:(t=Ew&&t[Ew]||t["@@iterator"],typeof t=="function"?t:null)}var at=Object.assign,$p;function Va(t){if($p===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);$p=e&&e[1]||""}return`
34
- `+$p+t}var zp=!1;function Fp(t,e){if(!t||zp)return"";zp=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var r=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){r=u}t.call(e.prototype)}else{try{throw Error()}catch(u){r=u}t()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
35
- `),i=r.stack.split(`
36
- `),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var a=`
37
- `+s[o].replace(" at new "," at ");return t.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",t.displayName)),a}while(1<=o&&0<=l);break}}}finally{zp=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Va(t):""}function Y_(t){switch(t.tag){case 5:return Va(t.type);case 16:return Va("Lazy");case 13:return Va("Suspense");case 19:return Va("SuspenseList");case 0:case 2:case 15:return t=Fp(t.type,!1),t;case 11:return t=Fp(t.type.render,!1),t;case 1:return t=Fp(t.type,!0),t;default:return""}}function dg(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case dl:return"Fragment";case cl:return"Portal";case ag:return"Profiler";case Ov:return"StrictMode";case ug:return"Suspense";case cg:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case hC:return(t.displayName||"Context")+".Consumer";case fC:return(t._context.displayName||"Context")+".Provider";case Av:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case _v:return e=t.displayName||null,e!==null?e:dg(t.type)||"Memo";case zs:e=t._payload,t=t._init;try{return dg(t(e))}catch{}}return null}function X_(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return dg(e);case 8:return e===Ov?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Ei(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function mC(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function eP(t){var e=mC(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Dc(t){t._valueTracker||(t._valueTracker=eP(t))}function gC(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=mC(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Jd(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function fg(t,e){var n=e.checked;return at({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Tw(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Ei(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function yC(t,e){e=e.checked,e!=null&&Nv(t,"checked",e,!1)}function hg(t,e){yC(t,e);var n=Ei(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?pg(t,e.type,n):e.hasOwnProperty("defaultValue")&&pg(t,e.type,Ei(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Rw(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function pg(t,e,n){(e!=="number"||Jd(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Ha=Array.isArray;function Sl(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s<n.length;s++)e["$"+n[s]]=!0;for(n=0;n<t.length;n++)s=e.hasOwnProperty("$"+t[n].value),t[n].selected!==s&&(t[n].selected=s),s&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Ei(n),e=null,s=0;s<t.length;s++){if(t[s].value===n){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function mg(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(z(91));return at({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Mw(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(z(92));if(Ha(n)){if(1<n.length)throw Error(z(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Ei(n)}}function vC(t,e){var n=Ei(e.value),r=Ei(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function Nw(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function xC(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function gg(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?xC(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Lc,wC=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(Lc=Lc||document.createElement("div"),Lc.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Lc.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Eu(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var ru={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tP=["Webkit","ms","Moz","O"];Object.keys(ru).forEach(function(t){tP.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ru[e]=ru[t]})});function kC(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||ru.hasOwnProperty(t)&&ru[t]?(""+e).trim():e+"px"}function bC(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=kC(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var nP=at({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function yg(t,e){if(e){if(nP[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(z(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(z(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(z(61))}if(e.style!=null&&typeof e.style!="object")throw Error(z(62))}}function vg(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 xg=null;function Pv(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var wg=null,Cl=null,El=null;function Ow(t){if(t=mc(t)){if(typeof wg!="function")throw Error(z(280));var e=t.stateNode;e&&(e=Ih(e),wg(t.stateNode,t.type,e))}}function SC(t){Cl?El?El.push(t):El=[t]:Cl=t}function CC(){if(Cl){var t=Cl,e=El;if(El=Cl=null,Ow(t),e)for(t=0;t<e.length;t++)Ow(e[t])}}function EC(t,e){return t(e)}function TC(){}var Bp=!1;function RC(t,e,n){if(Bp)return t(e,n);Bp=!0;try{return EC(t,e,n)}finally{Bp=!1,(Cl!==null||El!==null)&&(TC(),CC())}}function Tu(t,e){var n=t.stateNode;if(n===null)return null;var r=Ih(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(z(231,e,typeof n));return n}var kg=!1;if(Ss)try{var Ra={};Object.defineProperty(Ra,"passive",{get:function(){kg=!0}}),window.addEventListener("test",Ra,Ra),window.removeEventListener("test",Ra,Ra)}catch{kg=!1}function rP(t,e,n,r,s,i,o,l,a){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(c){this.onError(c)}}var su=!1,Qd=null,Zd=!1,bg=null,sP={onError:function(t){su=!0,Qd=t}};function iP(t,e,n,r,s,i,o,l,a){su=!1,Qd=null,rP.apply(sP,arguments)}function oP(t,e,n,r,s,i,o,l,a){if(iP.apply(this,arguments),su){if(su){var u=Qd;su=!1,Qd=null}else throw Error(z(198));Zd||(Zd=!0,bg=u)}}function jo(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function MC(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Aw(t){if(jo(t)!==t)throw Error(z(188))}function lP(t){var e=t.alternate;if(!e){if(e=jo(t),e===null)throw Error(z(188));return e!==t?null:t}for(var n=t,r=e;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return Aw(s),t;if(i===r)return Aw(s),e;i=i.sibling}throw Error(z(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(z(189))}}if(n.alternate!==r)throw Error(z(190))}if(n.tag!==3)throw Error(z(188));return n.stateNode.current===n?t:e}function NC(t){return t=lP(t),t!==null?OC(t):null}function OC(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=OC(t);if(e!==null)return e;t=t.sibling}return null}var AC=_n.unstable_scheduleCallback,_w=_n.unstable_cancelCallback,aP=_n.unstable_shouldYield,uP=_n.unstable_requestPaint,ht=_n.unstable_now,cP=_n.unstable_getCurrentPriorityLevel,Iv=_n.unstable_ImmediatePriority,_C=_n.unstable_UserBlockingPriority,Yd=_n.unstable_NormalPriority,dP=_n.unstable_LowPriority,PC=_n.unstable_IdlePriority,Oh=null,$r=null;function fP(t){if($r&&typeof $r.onCommitFiberRoot=="function")try{$r.onCommitFiberRoot(Oh,t,void 0,(t.current.flags&128)===128)}catch{}}var yr=Math.clz32?Math.clz32:mP,hP=Math.log,pP=Math.LN2;function mP(t){return t>>>=0,t===0?32:31-(hP(t)/pP|0)|0}var jc=64,$c=4194304;function Ua(t){switch(t&-t){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: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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Xd(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=Ua(l):(i&=o,i!==0&&(r=Ua(i)))}else o=n&~s,o!==0?r=Ua(o):i!==0&&(r=Ua(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-yr(e),s=1<<n,r|=t[n],e&=~s;return r}function gP(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64: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 e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function yP(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-yr(i),l=1<<o,a=s[o];a===-1?(!(l&n)||l&r)&&(s[o]=gP(l,e)):a<=e&&(t.expiredLanes|=l),i&=~l}}function Sg(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function IC(){var t=jc;return jc<<=1,!(jc&4194240)&&(jc=64),t}function Vp(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function hc(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-yr(e),t[e]=n}function vP(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var s=31-yr(n),i=1<<s;e[s]=0,r[s]=-1,t[s]=-1,n&=~i}}function Dv(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-yr(n),s=1<<r;s&e|t[r]&e&&(t[r]|=e),n&=~s}}var Ue=0;function DC(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var LC,Lv,jC,$C,zC,Cg=!1,zc=[],ci=null,di=null,fi=null,Ru=new Map,Mu=new Map,Ws=[],xP="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 submit".split(" ");function Pw(t,e){switch(t){case"focusin":case"focusout":ci=null;break;case"dragenter":case"dragleave":di=null;break;case"mouseover":case"mouseout":fi=null;break;case"pointerover":case"pointerout":Ru.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Mu.delete(e.pointerId)}}function Ma(t,e,n,r,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},e!==null&&(e=mc(e),e!==null&&Lv(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function wP(t,e,n,r,s){switch(e){case"focusin":return ci=Ma(ci,t,e,n,r,s),!0;case"dragenter":return di=Ma(di,t,e,n,r,s),!0;case"mouseover":return fi=Ma(fi,t,e,n,r,s),!0;case"pointerover":var i=s.pointerId;return Ru.set(i,Ma(Ru.get(i)||null,t,e,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Mu.set(i,Ma(Mu.get(i)||null,t,e,n,r,s)),!0}return!1}function FC(t){var e=Qi(t.target);if(e!==null){var n=jo(e);if(n!==null){if(e=n.tag,e===13){if(e=MC(n),e!==null){t.blockedOn=e,zC(t.priority,function(){jC(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Rd(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Eg(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);xg=r,n.target.dispatchEvent(r),xg=null}else return e=mc(n),e!==null&&Lv(e),t.blockedOn=n,!1;e.shift()}return!0}function Iw(t,e,n){Rd(t)&&n.delete(e)}function kP(){Cg=!1,ci!==null&&Rd(ci)&&(ci=null),di!==null&&Rd(di)&&(di=null),fi!==null&&Rd(fi)&&(fi=null),Ru.forEach(Iw),Mu.forEach(Iw)}function Na(t,e){t.blockedOn===e&&(t.blockedOn=null,Cg||(Cg=!0,_n.unstable_scheduleCallback(_n.unstable_NormalPriority,kP)))}function Nu(t){function e(s){return Na(s,t)}if(0<zc.length){Na(zc[0],t);for(var n=1;n<zc.length;n++){var r=zc[n];r.blockedOn===t&&(r.blockedOn=null)}}for(ci!==null&&Na(ci,t),di!==null&&Na(di,t),fi!==null&&Na(fi,t),Ru.forEach(e),Mu.forEach(e),n=0;n<Ws.length;n++)r=Ws[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Ws.length&&(n=Ws[0],n.blockedOn===null);)FC(n),n.blockedOn===null&&Ws.shift()}var Tl=Ms.ReactCurrentBatchConfig,ef=!0;function bP(t,e,n,r){var s=Ue,i=Tl.transition;Tl.transition=null;try{Ue=1,jv(t,e,n,r)}finally{Ue=s,Tl.transition=i}}function SP(t,e,n,r){var s=Ue,i=Tl.transition;Tl.transition=null;try{Ue=4,jv(t,e,n,r)}finally{Ue=s,Tl.transition=i}}function jv(t,e,n,r){if(ef){var s=Eg(t,e,n,r);if(s===null)Yp(t,e,r,tf,n),Pw(t,r);else if(wP(s,t,e,n,r))r.stopPropagation();else if(Pw(t,r),e&4&&-1<xP.indexOf(t)){for(;s!==null;){var i=mc(s);if(i!==null&&LC(i),i=Eg(t,e,n,r),i===null&&Yp(t,e,r,tf,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Yp(t,e,r,null,n)}}var tf=null;function Eg(t,e,n,r){if(tf=null,t=Pv(r),t=Qi(t),t!==null)if(e=jo(t),e===null)t=null;else if(n=e.tag,n===13){if(t=MC(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return tf=t,null}function BC(t){switch(t){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(cP()){case Iv:return 1;case _C:return 4;case Yd:case dP:return 16;case PC:return 536870912;default:return 16}default:return 16}}var ri=null,$v=null,Md=null;function VC(){if(Md)return Md;var t,e=$v,n=e.length,r,s="value"in ri?ri.value:ri.textContent,i=s.length;for(t=0;t<n&&e[t]===s[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===s[i-r];r++);return Md=s.slice(t,1<r?1-r:void 0)}function Nd(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Fc(){return!0}function Dw(){return!1}function Dn(t){function e(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(n=t[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Fc:Dw,this.isPropagationStopped=Dw,this}return at(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Fc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Fc)},persist:function(){},isPersistent:Fc}),e}var ma={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zv=Dn(ma),pc=at({},ma,{view:0,detail:0}),CP=Dn(pc),Hp,Up,Oa,Ah=at({},pc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fv,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Oa&&(Oa&&t.type==="mousemove"?(Hp=t.screenX-Oa.screenX,Up=t.screenY-Oa.screenY):Up=Hp=0,Oa=t),Hp)},movementY:function(t){return"movementY"in t?t.movementY:Up}}),Lw=Dn(Ah),EP=at({},Ah,{dataTransfer:0}),TP=Dn(EP),RP=at({},pc,{relatedTarget:0}),Wp=Dn(RP),MP=at({},ma,{animationName:0,elapsedTime:0,pseudoElement:0}),NP=Dn(MP),OP=at({},ma,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),AP=Dn(OP),_P=at({},ma,{data:0}),jw=Dn(_P),PP={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},IP={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"},DP={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function LP(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=DP[t])?!!e[t]:!1}function Fv(){return LP}var jP=at({},pc,{key:function(t){if(t.key){var e=PP[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Nd(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?IP[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fv,charCode:function(t){return t.type==="keypress"?Nd(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Nd(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),$P=Dn(jP),zP=at({},Ah,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$w=Dn(zP),FP=at({},pc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fv}),BP=Dn(FP),VP=at({},ma,{propertyName:0,elapsedTime:0,pseudoElement:0}),HP=Dn(VP),UP=at({},Ah,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),WP=Dn(UP),qP=[9,13,27,32],Bv=Ss&&"CompositionEvent"in window,iu=null;Ss&&"documentMode"in document&&(iu=document.documentMode);var GP=Ss&&"TextEvent"in window&&!iu,HC=Ss&&(!Bv||iu&&8<iu&&11>=iu),zw=" ",Fw=!1;function UC(t,e){switch(t){case"keyup":return qP.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function WC(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var fl=!1;function KP(t,e){switch(t){case"compositionend":return WC(e);case"keypress":return e.which!==32?null:(Fw=!0,zw);case"textInput":return t=e.data,t===zw&&Fw?null:t;default:return null}}function JP(t,e){if(fl)return t==="compositionend"||!Bv&&UC(t,e)?(t=VC(),Md=$v=ri=null,fl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return HC&&e.locale!=="ko"?null:e.data;default:return null}}var QP={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 Bw(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!QP[t.type]:e==="textarea"}function qC(t,e,n,r){SC(r),e=nf(e,"onChange"),0<e.length&&(n=new zv("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var ou=null,Ou=null;function ZP(t){rE(t,0)}function _h(t){var e=ml(t);if(gC(e))return t}function YP(t,e){if(t==="change")return e}var GC=!1;if(Ss){var qp;if(Ss){var Gp="oninput"in document;if(!Gp){var Vw=document.createElement("div");Vw.setAttribute("oninput","return;"),Gp=typeof Vw.oninput=="function"}qp=Gp}else qp=!1;GC=qp&&(!document.documentMode||9<document.documentMode)}function Hw(){ou&&(ou.detachEvent("onpropertychange",KC),Ou=ou=null)}function KC(t){if(t.propertyName==="value"&&_h(Ou)){var e=[];qC(e,Ou,t,Pv(t)),RC(ZP,e)}}function XP(t,e,n){t==="focusin"?(Hw(),ou=e,Ou=n,ou.attachEvent("onpropertychange",KC)):t==="focusout"&&Hw()}function eI(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return _h(Ou)}function tI(t,e){if(t==="click")return _h(e)}function nI(t,e){if(t==="input"||t==="change")return _h(e)}function rI(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var kr=typeof Object.is=="function"?Object.is:rI;function Au(t,e){if(kr(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!lg.call(e,s)||!kr(t[s],e[s]))return!1}return!0}function Uw(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Ww(t,e){var n=Uw(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Uw(n)}}function JC(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?JC(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function QC(){for(var t=window,e=Jd();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Jd(t.document)}return e}function Vv(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function sI(t){var e=QC(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&JC(n.ownerDocument.documentElement,n)){if(r!==null&&Vv(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=Ww(n,i);var o=Ww(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var iI=Ss&&"documentMode"in document&&11>=document.documentMode,hl=null,Tg=null,lu=null,Rg=!1;function qw(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Rg||hl==null||hl!==Jd(r)||(r=hl,"selectionStart"in r&&Vv(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),lu&&Au(lu,r)||(lu=r,r=nf(Tg,"onSelect"),0<r.length&&(e=new zv("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=hl)))}function Bc(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var pl={animationend:Bc("Animation","AnimationEnd"),animationiteration:Bc("Animation","AnimationIteration"),animationstart:Bc("Animation","AnimationStart"),transitionend:Bc("Transition","TransitionEnd")},Kp={},ZC={};Ss&&(ZC=document.createElement("div").style,"AnimationEvent"in window||(delete pl.animationend.animation,delete pl.animationiteration.animation,delete pl.animationstart.animation),"TransitionEvent"in window||delete pl.transitionend.transition);function Ph(t){if(Kp[t])return Kp[t];if(!pl[t])return t;var e=pl[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in ZC)return Kp[t]=e[n];return t}var YC=Ph("animationend"),XC=Ph("animationiteration"),eE=Ph("animationstart"),tE=Ph("transitionend"),nE=new Map,Gw="abort auxClick 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(" ");function Ii(t,e){nE.set(t,e),Lo(e,[t])}for(var Jp=0;Jp<Gw.length;Jp++){var Qp=Gw[Jp],oI=Qp.toLowerCase(),lI=Qp[0].toUpperCase()+Qp.slice(1);Ii(oI,"on"+lI)}Ii(YC,"onAnimationEnd");Ii(XC,"onAnimationIteration");Ii(eE,"onAnimationStart");Ii("dblclick","onDoubleClick");Ii("focusin","onFocus");Ii("focusout","onBlur");Ii(tE,"onTransitionEnd");Wl("onMouseEnter",["mouseout","mouseover"]);Wl("onMouseLeave",["mouseout","mouseover"]);Wl("onPointerEnter",["pointerout","pointerover"]);Wl("onPointerLeave",["pointerout","pointerover"]);Lo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Lo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Lo("onBeforeInput",["compositionend","keypress","textInput","paste"]);Lo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Lo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Lo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Wa="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(" "),aI=new Set("cancel close invalid load scroll toggle".split(" ").concat(Wa));function Kw(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,oP(r,e,void 0,t),t.currentTarget=null}function rE(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],s=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var o=r.length-1;0<=o;o--){var l=r[o],a=l.instance,u=l.currentTarget;if(l=l.listener,a!==i&&s.isPropagationStopped())break e;Kw(s,l,u),i=a}else for(o=0;o<r.length;o++){if(l=r[o],a=l.instance,u=l.currentTarget,l=l.listener,a!==i&&s.isPropagationStopped())break e;Kw(s,l,u),i=a}}}if(Zd)throw t=bg,Zd=!1,bg=null,t}function Ye(t,e){var n=e[_g];n===void 0&&(n=e[_g]=new Set);var r=t+"__bubble";n.has(r)||(sE(e,t,2,!1),n.add(r))}function Zp(t,e,n){var r=0;e&&(r|=4),sE(n,t,r,e)}var Vc="_reactListening"+Math.random().toString(36).slice(2);function _u(t){if(!t[Vc]){t[Vc]=!0,dC.forEach(function(n){n!=="selectionchange"&&(aI.has(n)||Zp(n,!1,t),Zp(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Vc]||(e[Vc]=!0,Zp("selectionchange",!1,e))}}function sE(t,e,n,r){switch(BC(e)){case 1:var s=bP;break;case 4:s=SP;break;default:s=jv}n=s.bind(null,e,n,t),s=void 0,!kg||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,n,{capture:!0,passive:s}):t.addEventListener(e,n,!0):s!==void 0?t.addEventListener(e,n,{passive:s}):t.addEventListener(e,n,!1)}function Yp(t,e,n,r,s){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var a=o.tag;if((a===3||a===4)&&(a=o.stateNode.containerInfo,a===s||a.nodeType===8&&a.parentNode===s))return;o=o.return}for(;l!==null;){if(o=Qi(l),o===null)return;if(a=o.tag,a===5||a===6){r=i=o;continue e}l=l.parentNode}}r=r.return}RC(function(){var u=i,c=Pv(n),d=[];e:{var f=nE.get(t);if(f!==void 0){var h=zv,p=t;switch(t){case"keypress":if(Nd(n)===0)break e;case"keydown":case"keyup":h=$P;break;case"focusin":p="focus",h=Wp;break;case"focusout":p="blur",h=Wp;break;case"beforeblur":case"afterblur":h=Wp;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=Lw;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=TP;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=BP;break;case YC:case XC:case eE:h=NP;break;case tE:h=HP;break;case"scroll":h=CP;break;case"wheel":h=WP;break;case"copy":case"cut":case"paste":h=AP;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=$w}var m=(e&4)!==0,y=!m&&t==="scroll",g=m?f!==null?f+"Capture":null:f;m=[];for(var x=u,k;x!==null;){k=x;var b=k.stateNode;if(k.tag===5&&b!==null&&(k=b,g!==null&&(b=Tu(x,g),b!=null&&m.push(Pu(x,b,k)))),y)break;x=x.return}0<m.length&&(f=new h(f,p,null,n,c),d.push({event:f,listeners:m}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",h=t==="mouseout"||t==="pointerout",f&&n!==xg&&(p=n.relatedTarget||n.fromElement)&&(Qi(p)||p[Cs]))break e;if((h||f)&&(f=c.window===c?c:(f=c.ownerDocument)?f.defaultView||f.parentWindow:window,h?(p=n.relatedTarget||n.toElement,h=u,p=p?Qi(p):null,p!==null&&(y=jo(p),p!==y||p.tag!==5&&p.tag!==6)&&(p=null)):(h=null,p=u),h!==p)){if(m=Lw,b="onMouseLeave",g="onMouseEnter",x="mouse",(t==="pointerout"||t==="pointerover")&&(m=$w,b="onPointerLeave",g="onPointerEnter",x="pointer"),y=h==null?f:ml(h),k=p==null?f:ml(p),f=new m(b,x+"leave",h,n,c),f.target=y,f.relatedTarget=k,b=null,Qi(c)===u&&(m=new m(g,x+"enter",p,n,c),m.target=k,m.relatedTarget=y,b=m),y=b,h&&p)t:{for(m=h,g=p,x=0,k=m;k;k=Jo(k))x++;for(k=0,b=g;b;b=Jo(b))k++;for(;0<x-k;)m=Jo(m),x--;for(;0<k-x;)g=Jo(g),k--;for(;x--;){if(m===g||g!==null&&m===g.alternate)break t;m=Jo(m),g=Jo(g)}m=null}else m=null;h!==null&&Jw(d,f,h,m,!1),p!==null&&y!==null&&Jw(d,y,p,m,!0)}}e:{if(f=u?ml(u):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var S=YP;else if(Bw(f))if(GC)S=nI;else{S=eI;var C=XP}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(S=tI);if(S&&(S=S(t,u))){qC(d,S,n,c);break e}C&&C(t,f,u),t==="focusout"&&(C=f._wrapperState)&&C.controlled&&f.type==="number"&&pg(f,"number",f.value)}switch(C=u?ml(u):window,t){case"focusin":(Bw(C)||C.contentEditable==="true")&&(hl=C,Tg=u,lu=null);break;case"focusout":lu=Tg=hl=null;break;case"mousedown":Rg=!0;break;case"contextmenu":case"mouseup":case"dragend":Rg=!1,qw(d,n,c);break;case"selectionchange":if(iI)break;case"keydown":case"keyup":qw(d,n,c)}var E;if(Bv)e:{switch(t){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else fl?UC(t,n)&&(T="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(HC&&n.locale!=="ko"&&(fl||T!=="onCompositionStart"?T==="onCompositionEnd"&&fl&&(E=VC()):(ri=c,$v="value"in ri?ri.value:ri.textContent,fl=!0)),C=nf(u,T),0<C.length&&(T=new jw(T,t,null,n,c),d.push({event:T,listeners:C}),E?T.data=E:(E=WC(n),E!==null&&(T.data=E)))),(E=GP?KP(t,n):JP(t,n))&&(u=nf(u,"onBeforeInput"),0<u.length&&(c=new jw("onBeforeInput","beforeinput",null,n,c),d.push({event:c,listeners:u}),c.data=E))}rE(d,e)})}function Pu(t,e,n){return{instance:t,listener:e,currentTarget:n}}function nf(t,e){for(var n=e+"Capture",r=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Tu(t,n),i!=null&&r.unshift(Pu(t,i,s)),i=Tu(t,e),i!=null&&r.push(Pu(t,i,s))),t=t.return}return r}function Jo(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Jw(t,e,n,r,s){for(var i=e._reactName,o=[];n!==null&&n!==r;){var l=n,a=l.alternate,u=l.stateNode;if(a!==null&&a===r)break;l.tag===5&&u!==null&&(l=u,s?(a=Tu(n,i),a!=null&&o.unshift(Pu(n,a,l))):s||(a=Tu(n,i),a!=null&&o.push(Pu(n,a,l)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var uI=/\r\n?/g,cI=/\u0000|\uFFFD/g;function Qw(t){return(typeof t=="string"?t:""+t).replace(uI,`
38
- `).replace(cI,"")}function Hc(t,e,n){if(e=Qw(e),Qw(t)!==e&&n)throw Error(z(425))}function rf(){}var Mg=null,Ng=null;function Og(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Ag=typeof setTimeout=="function"?setTimeout:void 0,dI=typeof clearTimeout=="function"?clearTimeout:void 0,Zw=typeof Promise=="function"?Promise:void 0,fI=typeof queueMicrotask=="function"?queueMicrotask:typeof Zw<"u"?function(t){return Zw.resolve(null).then(t).catch(hI)}:Ag;function hI(t){setTimeout(function(){throw t})}function Xp(t,e){var n=e,r=0;do{var s=n.nextSibling;if(t.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){t.removeChild(s),Nu(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Nu(e)}function hi(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function Yw(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var ga=Math.random().toString(36).slice(2),Dr="__reactFiber$"+ga,Iu="__reactProps$"+ga,Cs="__reactContainer$"+ga,_g="__reactEvents$"+ga,pI="__reactListeners$"+ga,mI="__reactHandles$"+ga;function Qi(t){var e=t[Dr];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Cs]||n[Dr]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Yw(t);t!==null;){if(n=t[Dr])return n;t=Yw(t)}return e}t=n,n=t.parentNode}return null}function mc(t){return t=t[Dr]||t[Cs],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function ml(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(z(33))}function Ih(t){return t[Iu]||null}var Pg=[],gl=-1;function Di(t){return{current:t}}function et(t){0>gl||(t.current=Pg[gl],Pg[gl]=null,gl--)}function Qe(t,e){gl++,Pg[gl]=t.current,t.current=e}var Ti={},Qt=Di(Ti),yn=Di(!1),ko=Ti;function ql(t,e){var n=t.type.contextTypes;if(!n)return Ti;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function vn(t){return t=t.childContextTypes,t!=null}function sf(){et(yn),et(Qt)}function Xw(t,e,n){if(Qt.current!==Ti)throw Error(z(168));Qe(Qt,e),Qe(yn,n)}function iE(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(z(108,X_(t)||"Unknown",s));return at({},n,r)}function of(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ti,ko=Qt.current,Qe(Qt,t),Qe(yn,yn.current),!0}function ek(t,e,n){var r=t.stateNode;if(!r)throw Error(z(169));n?(t=iE(t,e,ko),r.__reactInternalMemoizedMergedChildContext=t,et(yn),et(Qt),Qe(Qt,t)):et(yn),Qe(yn,n)}var us=null,Dh=!1,em=!1;function oE(t){us===null?us=[t]:us.push(t)}function gI(t){Dh=!0,oE(t)}function Li(){if(!em&&us!==null){em=!0;var t=0,e=Ue;try{var n=us;for(Ue=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}us=null,Dh=!1}catch(s){throw us!==null&&(us=us.slice(t+1)),AC(Iv,Li),s}finally{Ue=e,em=!1}}return null}var yl=[],vl=0,lf=null,af=0,Un=[],Wn=0,bo=null,hs=1,ps="";function Gi(t,e){yl[vl++]=af,yl[vl++]=lf,lf=t,af=e}function lE(t,e,n){Un[Wn++]=hs,Un[Wn++]=ps,Un[Wn++]=bo,bo=t;var r=hs;t=ps;var s=32-yr(r)-1;r&=~(1<<s),n+=1;var i=32-yr(e)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,hs=1<<32-yr(e)+s|n<<s|r,ps=i+t}else hs=1<<i|n<<s|r,ps=t}function Hv(t){t.return!==null&&(Gi(t,1),lE(t,1,0))}function Uv(t){for(;t===lf;)lf=yl[--vl],yl[vl]=null,af=yl[--vl],yl[vl]=null;for(;t===bo;)bo=Un[--Wn],Un[Wn]=null,ps=Un[--Wn],Un[Wn]=null,hs=Un[--Wn],Un[Wn]=null}var Nn=null,Mn=null,nt=!1,fr=null;function aE(t,e){var n=Kn(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function tk(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Nn=t,Mn=hi(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Nn=t,Mn=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=bo!==null?{id:hs,overflow:ps}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Kn(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Nn=t,Mn=null,!0):!1;default:return!1}}function Ig(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Dg(t){if(nt){var e=Mn;if(e){var n=e;if(!tk(t,e)){if(Ig(t))throw Error(z(418));e=hi(n.nextSibling);var r=Nn;e&&tk(t,e)?aE(r,n):(t.flags=t.flags&-4097|2,nt=!1,Nn=t)}}else{if(Ig(t))throw Error(z(418));t.flags=t.flags&-4097|2,nt=!1,Nn=t}}}function nk(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Nn=t}function Uc(t){if(t!==Nn)return!1;if(!nt)return nk(t),nt=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Og(t.type,t.memoizedProps)),e&&(e=Mn)){if(Ig(t))throw uE(),Error(z(418));for(;e;)aE(t,e),e=hi(e.nextSibling)}if(nk(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(z(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Mn=hi(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Mn=null}}else Mn=Nn?hi(t.stateNode.nextSibling):null;return!0}function uE(){for(var t=Mn;t;)t=hi(t.nextSibling)}function Gl(){Mn=Nn=null,nt=!1}function Wv(t){fr===null?fr=[t]:fr.push(t)}var yI=Ms.ReactCurrentBatchConfig;function Aa(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(z(309));var r=n.stateNode}if(!r)throw Error(z(147,t));var s=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(z(284));if(!n._owner)throw Error(z(290,t))}return t}function Wc(t,e){throw t=Object.prototype.toString.call(e),Error(z(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function rk(t){var e=t._init;return e(t._payload)}function cE(t){function e(g,x){if(t){var k=g.deletions;k===null?(g.deletions=[x],g.flags|=16):k.push(x)}}function n(g,x){if(!t)return null;for(;x!==null;)e(g,x),x=x.sibling;return null}function r(g,x){for(g=new Map;x!==null;)x.key!==null?g.set(x.key,x):g.set(x.index,x),x=x.sibling;return g}function s(g,x){return g=yi(g,x),g.index=0,g.sibling=null,g}function i(g,x,k){return g.index=k,t?(k=g.alternate,k!==null?(k=k.index,k<x?(g.flags|=2,x):k):(g.flags|=2,x)):(g.flags|=1048576,x)}function o(g){return t&&g.alternate===null&&(g.flags|=2),g}function l(g,x,k,b){return x===null||x.tag!==6?(x=lm(k,g.mode,b),x.return=g,x):(x=s(x,k),x.return=g,x)}function a(g,x,k,b){var S=k.type;return S===dl?c(g,x,k.props.children,b,k.key):x!==null&&(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===zs&&rk(S)===x.type)?(b=s(x,k.props),b.ref=Aa(g,x,k),b.return=g,b):(b=Ld(k.type,k.key,k.props,null,g.mode,b),b.ref=Aa(g,x,k),b.return=g,b)}function u(g,x,k,b){return x===null||x.tag!==4||x.stateNode.containerInfo!==k.containerInfo||x.stateNode.implementation!==k.implementation?(x=am(k,g.mode,b),x.return=g,x):(x=s(x,k.children||[]),x.return=g,x)}function c(g,x,k,b,S){return x===null||x.tag!==7?(x=po(k,g.mode,b,S),x.return=g,x):(x=s(x,k),x.return=g,x)}function d(g,x,k){if(typeof x=="string"&&x!==""||typeof x=="number")return x=lm(""+x,g.mode,k),x.return=g,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Ic:return k=Ld(x.type,x.key,x.props,null,g.mode,k),k.ref=Aa(g,null,x),k.return=g,k;case cl:return x=am(x,g.mode,k),x.return=g,x;case zs:var b=x._init;return d(g,b(x._payload),k)}if(Ha(x)||Ta(x))return x=po(x,g.mode,k,null),x.return=g,x;Wc(g,x)}return null}function f(g,x,k,b){var S=x!==null?x.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return S!==null?null:l(g,x,""+k,b);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Ic:return k.key===S?a(g,x,k,b):null;case cl:return k.key===S?u(g,x,k,b):null;case zs:return S=k._init,f(g,x,S(k._payload),b)}if(Ha(k)||Ta(k))return S!==null?null:c(g,x,k,b,null);Wc(g,k)}return null}function h(g,x,k,b,S){if(typeof b=="string"&&b!==""||typeof b=="number")return g=g.get(k)||null,l(x,g,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ic:return g=g.get(b.key===null?k:b.key)||null,a(x,g,b,S);case cl:return g=g.get(b.key===null?k:b.key)||null,u(x,g,b,S);case zs:var C=b._init;return h(g,x,k,C(b._payload),S)}if(Ha(b)||Ta(b))return g=g.get(k)||null,c(x,g,b,S,null);Wc(x,b)}return null}function p(g,x,k,b){for(var S=null,C=null,E=x,T=x=0,N=null;E!==null&&T<k.length;T++){E.index>T?(N=E,E=null):N=E.sibling;var O=f(g,E,k[T],b);if(O===null){E===null&&(E=N);break}t&&E&&O.alternate===null&&e(g,E),x=i(O,x,T),C===null?S=O:C.sibling=O,C=O,E=N}if(T===k.length)return n(g,E),nt&&Gi(g,T),S;if(E===null){for(;T<k.length;T++)E=d(g,k[T],b),E!==null&&(x=i(E,x,T),C===null?S=E:C.sibling=E,C=E);return nt&&Gi(g,T),S}for(E=r(g,E);T<k.length;T++)N=h(E,g,T,k[T],b),N!==null&&(t&&N.alternate!==null&&E.delete(N.key===null?T:N.key),x=i(N,x,T),C===null?S=N:C.sibling=N,C=N);return t&&E.forEach(function(H){return e(g,H)}),nt&&Gi(g,T),S}function m(g,x,k,b){var S=Ta(k);if(typeof S!="function")throw Error(z(150));if(k=S.call(k),k==null)throw Error(z(151));for(var C=S=null,E=x,T=x=0,N=null,O=k.next();E!==null&&!O.done;T++,O=k.next()){E.index>T?(N=E,E=null):N=E.sibling;var H=f(g,E,O.value,b);if(H===null){E===null&&(E=N);break}t&&E&&H.alternate===null&&e(g,E),x=i(H,x,T),C===null?S=H:C.sibling=H,C=H,E=N}if(O.done)return n(g,E),nt&&Gi(g,T),S;if(E===null){for(;!O.done;T++,O=k.next())O=d(g,O.value,b),O!==null&&(x=i(O,x,T),C===null?S=O:C.sibling=O,C=O);return nt&&Gi(g,T),S}for(E=r(g,E);!O.done;T++,O=k.next())O=h(E,g,T,O.value,b),O!==null&&(t&&O.alternate!==null&&E.delete(O.key===null?T:O.key),x=i(O,x,T),C===null?S=O:C.sibling=O,C=O);return t&&E.forEach(function(ne){return e(g,ne)}),nt&&Gi(g,T),S}function y(g,x,k,b){if(typeof k=="object"&&k!==null&&k.type===dl&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Ic:e:{for(var S=k.key,C=x;C!==null;){if(C.key===S){if(S=k.type,S===dl){if(C.tag===7){n(g,C.sibling),x=s(C,k.props.children),x.return=g,g=x;break e}}else if(C.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===zs&&rk(S)===C.type){n(g,C.sibling),x=s(C,k.props),x.ref=Aa(g,C,k),x.return=g,g=x;break e}n(g,C);break}else e(g,C);C=C.sibling}k.type===dl?(x=po(k.props.children,g.mode,b,k.key),x.return=g,g=x):(b=Ld(k.type,k.key,k.props,null,g.mode,b),b.ref=Aa(g,x,k),b.return=g,g=b)}return o(g);case cl:e:{for(C=k.key;x!==null;){if(x.key===C)if(x.tag===4&&x.stateNode.containerInfo===k.containerInfo&&x.stateNode.implementation===k.implementation){n(g,x.sibling),x=s(x,k.children||[]),x.return=g,g=x;break e}else{n(g,x);break}else e(g,x);x=x.sibling}x=am(k,g.mode,b),x.return=g,g=x}return o(g);case zs:return C=k._init,y(g,x,C(k._payload),b)}if(Ha(k))return p(g,x,k,b);if(Ta(k))return m(g,x,k,b);Wc(g,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,x!==null&&x.tag===6?(n(g,x.sibling),x=s(x,k),x.return=g,g=x):(n(g,x),x=lm(k,g.mode,b),x.return=g,g=x),o(g)):n(g,x)}return y}var Kl=cE(!0),dE=cE(!1),uf=Di(null),cf=null,xl=null,qv=null;function Gv(){qv=xl=cf=null}function Kv(t){var e=uf.current;et(uf),t._currentValue=e}function Lg(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Rl(t,e){cf=t,qv=xl=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(gn=!0),t.firstContext=null)}function Xn(t){var e=t._currentValue;if(qv!==t)if(t={context:t,memoizedValue:e,next:null},xl===null){if(cf===null)throw Error(z(308));xl=t,cf.dependencies={lanes:0,firstContext:t}}else xl=xl.next=t;return e}var Zi=null;function Jv(t){Zi===null?Zi=[t]:Zi.push(t)}function fE(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,Jv(e)):(n.next=s.next,s.next=n),e.interleaved=n,Es(t,r)}function Es(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Fs=!1;function Qv(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function hE(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function vs(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function pi(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Le&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,Es(t,n)}return s=r.interleaved,s===null?(e.next=e,Jv(r)):(e.next=s.next,s.next=e),r.interleaved=e,Es(t,n)}function Od(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Dv(t,n)}}function sk(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function df(t,e,n,r){var s=t.updateQueue;Fs=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var a=l,u=a.next;a.next=null,o===null?i=u:o.next=u,o=a;var c=t.alternate;c!==null&&(c=c.updateQueue,l=c.lastBaseUpdate,l!==o&&(l===null?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=a))}if(i!==null){var d=s.baseState;o=0,c=u=a=null,l=i;do{var f=l.lane,h=l.eventTime;if((r&f)===f){c!==null&&(c=c.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var p=t,m=l;switch(f=e,h=n,m.tag){case 1:if(p=m.payload,typeof p=="function"){d=p.call(h,d,f);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,f=typeof p=="function"?p.call(h,d,f):p,f==null)break e;d=at({},d,f);break e;case 2:Fs=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else h={eventTime:h,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},c===null?(u=c=h,a=d):c=c.next=h,o|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(c===null&&(a=d),s.baseState=a,s.firstBaseUpdate=u,s.lastBaseUpdate=c,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);Co|=o,t.lanes=o,t.memoizedState=d}}function ik(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(z(191,s));s.call(r)}}}var gc={},zr=Di(gc),Du=Di(gc),Lu=Di(gc);function Yi(t){if(t===gc)throw Error(z(174));return t}function Zv(t,e){switch(Qe(Lu,e),Qe(Du,t),Qe(zr,gc),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:gg(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=gg(e,t)}et(zr),Qe(zr,e)}function Jl(){et(zr),et(Du),et(Lu)}function pE(t){Yi(Lu.current);var e=Yi(zr.current),n=gg(e,t.type);e!==n&&(Qe(Du,t),Qe(zr,n))}function Yv(t){Du.current===t&&(et(zr),et(Du))}var it=Di(0);function ff(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var tm=[];function Xv(){for(var t=0;t<tm.length;t++)tm[t]._workInProgressVersionPrimary=null;tm.length=0}var Ad=Ms.ReactCurrentDispatcher,nm=Ms.ReactCurrentBatchConfig,So=0,lt=null,bt=null,Rt=null,hf=!1,au=!1,ju=0,vI=0;function Ut(){throw Error(z(321))}function e0(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!kr(t[n],e[n]))return!1;return!0}function t0(t,e,n,r,s,i){if(So=i,lt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Ad.current=t===null||t.memoizedState===null?bI:SI,t=n(r,s),au){i=0;do{if(au=!1,ju=0,25<=i)throw Error(z(301));i+=1,Rt=bt=null,e.updateQueue=null,Ad.current=CI,t=n(r,s)}while(au)}if(Ad.current=pf,e=bt!==null&&bt.next!==null,So=0,Rt=bt=lt=null,hf=!1,e)throw Error(z(300));return t}function n0(){var t=ju!==0;return ju=0,t}function Mr(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?lt.memoizedState=Rt=t:Rt=Rt.next=t,Rt}function er(){if(bt===null){var t=lt.alternate;t=t!==null?t.memoizedState:null}else t=bt.next;var e=Rt===null?lt.memoizedState:Rt.next;if(e!==null)Rt=e,bt=t;else{if(t===null)throw Error(z(310));bt=t,t={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Rt===null?lt.memoizedState=Rt=t:Rt=Rt.next=t}return Rt}function $u(t,e){return typeof e=="function"?e(t):e}function rm(t){var e=er(),n=e.queue;if(n===null)throw Error(z(311));n.lastRenderedReducer=t;var r=bt,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,a=null,u=i;do{var c=u.lane;if((So&c)===c)a!==null&&(a=a.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:t(r,u.action);else{var d={lane:c,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};a===null?(l=a=d,o=r):a=a.next=d,lt.lanes|=c,Co|=c}u=u.next}while(u!==null&&u!==i);a===null?o=r:a.next=l,kr(r,e.memoizedState)||(gn=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=a,n.lastRenderedState=r}if(t=n.interleaved,t!==null){s=t;do i=s.lane,lt.lanes|=i,Co|=i,s=s.next;while(s!==t)}else s===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function sm(t){var e=er(),n=e.queue;if(n===null)throw Error(z(311));n.lastRenderedReducer=t;var r=n.dispatch,s=n.pending,i=e.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);kr(i,e.memoizedState)||(gn=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function mE(){}function gE(t,e){var n=lt,r=er(),s=e(),i=!kr(r.memoizedState,s);if(i&&(r.memoizedState=s,gn=!0),r=r.queue,r0(xE.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||Rt!==null&&Rt.memoizedState.tag&1){if(n.flags|=2048,zu(9,vE.bind(null,n,r,s,e),void 0,null),At===null)throw Error(z(349));So&30||yE(n,e,s)}return s}function yE(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=lt.updateQueue,e===null?(e={lastEffect:null,stores:null},lt.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function vE(t,e,n,r){e.value=n,e.getSnapshot=r,wE(e)&&kE(t)}function xE(t,e,n){return n(function(){wE(e)&&kE(t)})}function wE(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!kr(t,n)}catch{return!0}}function kE(t){var e=Es(t,1);e!==null&&vr(e,t,1,-1)}function ok(t){var e=Mr();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:$u,lastRenderedState:t},e.queue=t,t=t.dispatch=kI.bind(null,lt,t),[e.memoizedState,t]}function zu(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=lt.updateQueue,e===null?(e={lastEffect:null,stores:null},lt.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function bE(){return er().memoizedState}function _d(t,e,n,r){var s=Mr();lt.flags|=t,s.memoizedState=zu(1|e,n,void 0,r===void 0?null:r)}function Lh(t,e,n,r){var s=er();r=r===void 0?null:r;var i=void 0;if(bt!==null){var o=bt.memoizedState;if(i=o.destroy,r!==null&&e0(r,o.deps)){s.memoizedState=zu(e,n,i,r);return}}lt.flags|=t,s.memoizedState=zu(1|e,n,i,r)}function lk(t,e){return _d(8390656,8,t,e)}function r0(t,e){return Lh(2048,8,t,e)}function SE(t,e){return Lh(4,2,t,e)}function CE(t,e){return Lh(4,4,t,e)}function EE(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function TE(t,e,n){return n=n!=null?n.concat([t]):null,Lh(4,4,EE.bind(null,e,t),n)}function s0(){}function RE(t,e){var n=er();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&e0(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function ME(t,e){var n=er();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&e0(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function NE(t,e,n){return So&21?(kr(n,e)||(n=IC(),lt.lanes|=n,Co|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,gn=!0),t.memoizedState=n)}function xI(t,e){var n=Ue;Ue=n!==0&&4>n?n:4,t(!0);var r=nm.transition;nm.transition={};try{t(!1),e()}finally{Ue=n,nm.transition=r}}function OE(){return er().memoizedState}function wI(t,e,n){var r=gi(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},AE(t))_E(e,n);else if(n=fE(t,e,n,r),n!==null){var s=on();vr(n,t,r,s),PE(n,e,r)}}function kI(t,e,n){var r=gi(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(AE(t))_E(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,kr(l,o)){var a=e.interleaved;a===null?(s.next=s,Jv(e)):(s.next=a.next,a.next=s),e.interleaved=s;return}}catch{}finally{}n=fE(t,e,s,r),n!==null&&(s=on(),vr(n,t,r,s),PE(n,e,r))}}function AE(t){var e=t.alternate;return t===lt||e!==null&&e===lt}function _E(t,e){au=hf=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function PE(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Dv(t,n)}}var pf={readContext:Xn,useCallback:Ut,useContext:Ut,useEffect:Ut,useImperativeHandle:Ut,useInsertionEffect:Ut,useLayoutEffect:Ut,useMemo:Ut,useReducer:Ut,useRef:Ut,useState:Ut,useDebugValue:Ut,useDeferredValue:Ut,useTransition:Ut,useMutableSource:Ut,useSyncExternalStore:Ut,useId:Ut,unstable_isNewReconciler:!1},bI={readContext:Xn,useCallback:function(t,e){return Mr().memoizedState=[t,e===void 0?null:e],t},useContext:Xn,useEffect:lk,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,_d(4194308,4,EE.bind(null,e,t),n)},useLayoutEffect:function(t,e){return _d(4194308,4,t,e)},useInsertionEffect:function(t,e){return _d(4,2,t,e)},useMemo:function(t,e){var n=Mr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Mr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=wI.bind(null,lt,t),[r.memoizedState,t]},useRef:function(t){var e=Mr();return t={current:t},e.memoizedState=t},useState:ok,useDebugValue:s0,useDeferredValue:function(t){return Mr().memoizedState=t},useTransition:function(){var t=ok(!1),e=t[0];return t=xI.bind(null,t[1]),Mr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=lt,s=Mr();if(nt){if(n===void 0)throw Error(z(407));n=n()}else{if(n=e(),At===null)throw Error(z(349));So&30||yE(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,lk(xE.bind(null,r,i,t),[t]),r.flags|=2048,zu(9,vE.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Mr(),e=At.identifierPrefix;if(nt){var n=ps,r=hs;n=(r&~(1<<32-yr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=ju++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=vI++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},SI={readContext:Xn,useCallback:RE,useContext:Xn,useEffect:r0,useImperativeHandle:TE,useInsertionEffect:SE,useLayoutEffect:CE,useMemo:ME,useReducer:rm,useRef:bE,useState:function(){return rm($u)},useDebugValue:s0,useDeferredValue:function(t){var e=er();return NE(e,bt.memoizedState,t)},useTransition:function(){var t=rm($u)[0],e=er().memoizedState;return[t,e]},useMutableSource:mE,useSyncExternalStore:gE,useId:OE,unstable_isNewReconciler:!1},CI={readContext:Xn,useCallback:RE,useContext:Xn,useEffect:r0,useImperativeHandle:TE,useInsertionEffect:SE,useLayoutEffect:CE,useMemo:ME,useReducer:sm,useRef:bE,useState:function(){return sm($u)},useDebugValue:s0,useDeferredValue:function(t){var e=er();return bt===null?e.memoizedState=t:NE(e,bt.memoizedState,t)},useTransition:function(){var t=sm($u)[0],e=er().memoizedState;return[t,e]},useMutableSource:mE,useSyncExternalStore:gE,useId:OE,unstable_isNewReconciler:!1};function ar(t,e){if(t&&t.defaultProps){e=at({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function jg(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:at({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var jh={isMounted:function(t){return(t=t._reactInternals)?jo(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=on(),s=gi(t),i=vs(r,s);i.payload=e,n!=null&&(i.callback=n),e=pi(t,i,s),e!==null&&(vr(e,t,s,r),Od(e,t,s))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=on(),s=gi(t),i=vs(r,s);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=pi(t,i,s),e!==null&&(vr(e,t,s,r),Od(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=on(),r=gi(t),s=vs(n,r);s.tag=2,e!=null&&(s.callback=e),e=pi(t,s,r),e!==null&&(vr(e,t,r,n),Od(e,t,r))}};function ak(t,e,n,r,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,o):e.prototype&&e.prototype.isPureReactComponent?!Au(n,r)||!Au(s,i):!0}function IE(t,e,n){var r=!1,s=Ti,i=e.contextType;return typeof i=="object"&&i!==null?i=Xn(i):(s=vn(e)?ko:Qt.current,r=e.contextTypes,i=(r=r!=null)?ql(t,s):Ti),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=jh,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function uk(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&jh.enqueueReplaceState(e,e.state,null)}function $g(t,e,n,r){var s=t.stateNode;s.props=n,s.state=t.memoizedState,s.refs={},Qv(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=Xn(i):(i=vn(e)?ko:Qt.current,s.context=ql(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(jg(t,e,i,n),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&jh.enqueueReplaceState(s,s.state,null),df(t,n,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function Ql(t,e){try{var n="",r=e;do n+=Y_(r),r=r.return;while(r);var s=n}catch(i){s=`
39
- Error generating stack: `+i.message+`
40
- `+i.stack}return{value:t,source:e,stack:s,digest:null}}function im(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function zg(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var EI=typeof WeakMap=="function"?WeakMap:Map;function DE(t,e,n){n=vs(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){gf||(gf=!0,Jg=r),zg(t,e)},n}function LE(t,e,n){n=vs(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;n.payload=function(){return r(s)},n.callback=function(){zg(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){zg(t,e),typeof r!="function"&&(mi===null?mi=new Set([this]):mi.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function ck(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new EI;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(n)||(s.add(n),t=zI.bind(null,t,e,n),e.then(t,t))}function dk(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function fk(t,e,n,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=vs(-1,1),e.tag=2,pi(n,e,1))),n.lanes|=1),t)}var TI=Ms.ReactCurrentOwner,gn=!1;function en(t,e,n,r){e.child=t===null?dE(e,null,n,r):Kl(e,t.child,n,r)}function hk(t,e,n,r,s){n=n.render;var i=e.ref;return Rl(e,s),r=t0(t,e,n,r,i,s),n=n0(),t!==null&&!gn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Ts(t,e,s)):(nt&&n&&Hv(e),e.flags|=1,en(t,e,r,s),e.child)}function pk(t,e,n,r,s){if(t===null){var i=n.type;return typeof i=="function"&&!f0(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,jE(t,e,i,r,s)):(t=Ld(n.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Au,n(o,r)&&t.ref===e.ref)return Ts(t,e,s)}return e.flags|=1,t=yi(i,r),t.ref=e.ref,t.return=e,e.child=t}function jE(t,e,n,r,s){if(t!==null){var i=t.memoizedProps;if(Au(i,r)&&t.ref===e.ref)if(gn=!1,e.pendingProps=r=i,(t.lanes&s)!==0)t.flags&131072&&(gn=!0);else return e.lanes=t.lanes,Ts(t,e,s)}return Fg(t,e,n,r,s)}function $E(t,e,n){var r=e.pendingProps,s=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Qe(kl,Tn),Tn|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Qe(kl,Tn),Tn|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Qe(kl,Tn),Tn|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,Qe(kl,Tn),Tn|=r;return en(t,e,s,n),e.child}function zE(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Fg(t,e,n,r,s){var i=vn(n)?ko:Qt.current;return i=ql(e,i),Rl(e,s),n=t0(t,e,n,r,i,s),r=n0(),t!==null&&!gn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Ts(t,e,s)):(nt&&r&&Hv(e),e.flags|=1,en(t,e,n,s),e.child)}function mk(t,e,n,r,s){if(vn(n)){var i=!0;of(e)}else i=!1;if(Rl(e,s),e.stateNode===null)Pd(t,e),IE(e,n,r),$g(e,n,r,s),r=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var a=o.context,u=n.contextType;typeof u=="object"&&u!==null?u=Xn(u):(u=vn(n)?ko:Qt.current,u=ql(e,u));var c=n.getDerivedStateFromProps,d=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||a!==u)&&uk(e,o,r,u),Fs=!1;var f=e.memoizedState;o.state=f,df(e,r,o,s),a=e.memoizedState,l!==r||f!==a||yn.current||Fs?(typeof c=="function"&&(jg(e,n,c,r),a=e.memoizedState),(l=Fs||ak(e,n,l,r,f,a,u))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=a),o.props=r,o.state=a,o.context=u,r=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,hE(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:ar(e.type,l),o.props=u,d=e.pendingProps,f=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=Xn(a):(a=vn(n)?ko:Qt.current,a=ql(e,a));var h=n.getDerivedStateFromProps;(c=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==d||f!==a)&&uk(e,o,r,a),Fs=!1,f=e.memoizedState,o.state=f,df(e,r,o,s);var p=e.memoizedState;l!==d||f!==p||yn.current||Fs?(typeof h=="function"&&(jg(e,n,h,r),p=e.memoizedState),(u=Fs||ak(e,n,u,r,f,p,a)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,a)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),o.props=r,o.state=p,o.context=a,r=u):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return Bg(t,e,n,r,i,s)}function Bg(t,e,n,r,s,i){zE(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&ek(e,n,!1),Ts(t,e,i);r=e.stateNode,TI.current=e;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=Kl(e,t.child,null,i),e.child=Kl(e,null,l,i)):en(t,e,l,i),e.memoizedState=r.state,s&&ek(e,n,!0),e.child}function FE(t){var e=t.stateNode;e.pendingContext?Xw(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Xw(t,e.context,!1),Zv(t,e.containerInfo)}function gk(t,e,n,r,s){return Gl(),Wv(s),e.flags|=256,en(t,e,n,r),e.child}var Vg={dehydrated:null,treeContext:null,retryLane:0};function Hg(t){return{baseLanes:t,cachePool:null,transitions:null}}function BE(t,e,n){var r=e.pendingProps,s=it.current,i=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(s&2)!==0),l?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),Qe(it,s&1),t===null)return Dg(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,i?(r=e.mode,i=e.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Fh(o,r,0,null),t=po(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=Hg(n),e.memoizedState=Vg,t):i0(e,o));if(s=t.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return RI(t,e,o,r,l,s,n);if(i){i=r.fallback,o=e.mode,s=t.child,l=s.sibling;var a={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=a,e.deletions=null):(r=yi(s,a),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=yi(l,i):(i=po(i,o,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,o=t.child.memoizedState,o=o===null?Hg(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=Vg,r}return i=t.child,t=i.sibling,r=yi(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function i0(t,e){return e=Fh({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function qc(t,e,n,r){return r!==null&&Wv(r),Kl(e,t.child,null,n),t=i0(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function RI(t,e,n,r,s,i,o){if(n)return e.flags&256?(e.flags&=-257,r=im(Error(z(422))),qc(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,s=e.mode,r=Fh({mode:"visible",children:r.children},s,0,null),i=po(i,s,o,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&Kl(e,t.child,null,o),e.child.memoizedState=Hg(o),e.memoizedState=Vg,i);if(!(e.mode&1))return qc(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(z(419)),r=im(i,r,void 0),qc(t,e,o,r)}if(l=(o&t.childLanes)!==0,gn||l){if(r=At,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Es(t,s),vr(r,t,s,-1))}return d0(),r=im(Error(z(421))),qc(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=FI.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,Mn=hi(s.nextSibling),Nn=e,nt=!0,fr=null,t!==null&&(Un[Wn++]=hs,Un[Wn++]=ps,Un[Wn++]=bo,hs=t.id,ps=t.overflow,bo=e),e=i0(e,r.children),e.flags|=4096,e)}function yk(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Lg(t.return,e,n)}function om(t,e,n,r,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function VE(t,e,n){var r=e.pendingProps,s=r.revealOrder,i=r.tail;if(en(t,e,r.children,n),r=it.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&yk(t,n,e);else if(t.tag===19)yk(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(Qe(it,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(n=e.child,s=null;n!==null;)t=n.alternate,t!==null&&ff(t)===null&&(s=n),n=n.sibling;n=s,n===null?(s=e.child,e.child=null):(s=n.sibling,n.sibling=null),om(e,!1,s,n,i);break;case"backwards":for(n=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&ff(t)===null){e.child=s;break}t=s.sibling,s.sibling=n,n=s,s=t}om(e,!0,n,null,i);break;case"together":om(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Pd(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Ts(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Co|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(z(153));if(e.child!==null){for(t=e.child,n=yi(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=yi(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function MI(t,e,n){switch(e.tag){case 3:FE(e),Gl();break;case 5:pE(e);break;case 1:vn(e.type)&&of(e);break;case 4:Zv(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;Qe(uf,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Qe(it,it.current&1),e.flags|=128,null):n&e.child.childLanes?BE(t,e,n):(Qe(it,it.current&1),t=Ts(t,e,n),t!==null?t.sibling:null);Qe(it,it.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return VE(t,e,n);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Qe(it,it.current),r)break;return null;case 22:case 23:return e.lanes=0,$E(t,e,n)}return Ts(t,e,n)}var HE,Ug,UE,WE;HE=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Ug=function(){};UE=function(t,e,n,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,Yi(zr.current);var i=null;switch(n){case"input":s=fg(t,s),r=fg(t,r),i=[];break;case"select":s=at({},s,{value:void 0}),r=at({},r,{value:void 0}),i=[];break;case"textarea":s=mg(t,s),r=mg(t,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=rf)}yg(n,r);var o;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Cu.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var a=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&a!==l&&(a!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in a)a.hasOwnProperty(o)&&l[o]!==a[o]&&(n||(n={}),n[o]=a[o])}else n||(i||(i=[]),i.push(u,n)),n=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(i=i||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(i=i||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Cu.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&Ye("scroll",t),i||l===a||(i=[])):(i=i||[]).push(u,a))}n&&(i=i||[]).push("style",n);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};WE=function(t,e,n,r){n!==r&&(e.flags|=4)};function _a(t,e){if(!nt)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Wt(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function NI(t,e,n){var r=e.pendingProps;switch(Uv(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wt(e),null;case 1:return vn(e.type)&&sf(),Wt(e),null;case 3:return r=e.stateNode,Jl(),et(yn),et(Qt),Xv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Uc(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,fr!==null&&(Yg(fr),fr=null))),Ug(t,e),Wt(e),null;case 5:Yv(e);var s=Yi(Lu.current);if(n=e.type,t!==null&&e.stateNode!=null)UE(t,e,n,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(z(166));return Wt(e),null}if(t=Yi(zr.current),Uc(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[Dr]=e,r[Iu]=i,t=(e.mode&1)!==0,n){case"dialog":Ye("cancel",r),Ye("close",r);break;case"iframe":case"object":case"embed":Ye("load",r);break;case"video":case"audio":for(s=0;s<Wa.length;s++)Ye(Wa[s],r);break;case"source":Ye("error",r);break;case"img":case"image":case"link":Ye("error",r),Ye("load",r);break;case"details":Ye("toggle",r);break;case"input":Tw(r,i),Ye("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Ye("invalid",r);break;case"textarea":Mw(r,i),Ye("invalid",r)}yg(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Hc(r.textContent,l,t),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Hc(r.textContent,l,t),s=["children",""+l]):Cu.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Ye("scroll",r)}switch(n){case"input":Dc(r),Rw(r,i,!0);break;case"textarea":Dc(r),Nw(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=rf)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=xC(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Dr]=e,t[Iu]=r,HE(t,e,!1,!1),e.stateNode=t;e:{switch(o=vg(n,r),n){case"dialog":Ye("cancel",t),Ye("close",t),s=r;break;case"iframe":case"object":case"embed":Ye("load",t),s=r;break;case"video":case"audio":for(s=0;s<Wa.length;s++)Ye(Wa[s],t);s=r;break;case"source":Ye("error",t),s=r;break;case"img":case"image":case"link":Ye("error",t),Ye("load",t),s=r;break;case"details":Ye("toggle",t),s=r;break;case"input":Tw(t,r),s=fg(t,r),Ye("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=at({},r,{value:void 0}),Ye("invalid",t);break;case"textarea":Mw(t,r),s=mg(t,r),Ye("invalid",t);break;default:s=r}yg(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var a=l[i];i==="style"?bC(t,a):i==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&wC(t,a)):i==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&Eu(t,a):typeof a=="number"&&Eu(t,""+a):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Cu.hasOwnProperty(i)?a!=null&&i==="onScroll"&&Ye("scroll",t):a!=null&&Nv(t,i,a,o))}switch(n){case"input":Dc(t),Rw(t,r,!1);break;case"textarea":Dc(t),Nw(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Ei(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?Sl(t,!!r.multiple,i,!1):r.defaultValue!=null&&Sl(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=rf)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Wt(e),null;case 6:if(t&&e.stateNode!=null)WE(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(z(166));if(n=Yi(Lu.current),Yi(zr.current),Uc(e)){if(r=e.stateNode,n=e.memoizedProps,r[Dr]=e,(i=r.nodeValue!==n)&&(t=Nn,t!==null))switch(t.tag){case 3:Hc(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Hc(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Dr]=e,e.stateNode=r}return Wt(e),null;case 13:if(et(it),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(nt&&Mn!==null&&e.mode&1&&!(e.flags&128))uE(),Gl(),e.flags|=98560,i=!1;else if(i=Uc(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(z(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(z(317));i[Dr]=e}else Gl(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Wt(e),i=!1}else fr!==null&&(Yg(fr),fr=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||it.current&1?St===0&&(St=3):d0())),e.updateQueue!==null&&(e.flags|=4),Wt(e),null);case 4:return Jl(),Ug(t,e),t===null&&_u(e.stateNode.containerInfo),Wt(e),null;case 10:return Kv(e.type._context),Wt(e),null;case 17:return vn(e.type)&&sf(),Wt(e),null;case 19:if(et(it),i=e.memoizedState,i===null)return Wt(e),null;if(r=(e.flags&128)!==0,o=i.rendering,o===null)if(r)_a(i,!1);else{if(St!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=ff(t),o!==null){for(e.flags|=128,_a(i,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Qe(it,it.current&1|2),e.child}t=t.sibling}i.tail!==null&&ht()>Zl&&(e.flags|=128,r=!0,_a(i,!1),e.lanes=4194304)}else{if(!r)if(t=ff(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),_a(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!nt)return Wt(e),null}else 2*ht()-i.renderingStartTime>Zl&&n!==1073741824&&(e.flags|=128,r=!0,_a(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=ht(),e.sibling=null,n=it.current,Qe(it,r?n&1|2:n&1),e):(Wt(e),null);case 22:case 23:return c0(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Tn&1073741824&&(Wt(e),e.subtreeFlags&6&&(e.flags|=8192)):Wt(e),null;case 24:return null;case 25:return null}throw Error(z(156,e.tag))}function OI(t,e){switch(Uv(e),e.tag){case 1:return vn(e.type)&&sf(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Jl(),et(yn),et(Qt),Xv(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Yv(e),null;case 13:if(et(it),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(z(340));Gl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return et(it),null;case 4:return Jl(),null;case 10:return Kv(e.type._context),null;case 22:case 23:return c0(),null;case 24:return null;default:return null}}var Gc=!1,Jt=!1,AI=typeof WeakSet=="function"?WeakSet:Set,Z=null;function wl(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){dt(t,e,r)}else n.current=null}function Wg(t,e,n){try{n()}catch(r){dt(t,e,r)}}var vk=!1;function _I(t,e){if(Mg=ef,t=QC(),Vv(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,a=-1,u=0,c=0,d=t,f=null;t:for(;;){for(var h;d!==n||s!==0&&d.nodeType!==3||(l=o+s),d!==i||r!==0&&d.nodeType!==3||(a=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===t)break t;if(f===n&&++u===s&&(l=o),f===i&&++c===r&&(a=o),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ng={focusedElem:t,selectionRange:n},ef=!1,Z=e;Z!==null;)if(e=Z,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Z=t;else for(;Z!==null;){e=Z;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,y=p.memoizedState,g=e.stateNode,x=g.getSnapshotBeforeUpdate(e.elementType===e.type?m:ar(e.type,m),y);g.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var k=e.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(z(163))}}catch(b){dt(e,e.return,b)}if(t=e.sibling,t!==null){t.return=e.return,Z=t;break}Z=e.return}return p=vk,vk=!1,p}function uu(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&Wg(e,n,i)}s=s.next}while(s!==r)}}function $h(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function qg(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function qE(t){var e=t.alternate;e!==null&&(t.alternate=null,qE(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Dr],delete e[Iu],delete e[_g],delete e[pI],delete e[mI])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function GE(t){return t.tag===5||t.tag===3||t.tag===4}function xk(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||GE(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Gg(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=rf));else if(r!==4&&(t=t.child,t!==null))for(Gg(t,e,n),t=t.sibling;t!==null;)Gg(t,e,n),t=t.sibling}function Kg(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Kg(t,e,n),t=t.sibling;t!==null;)Kg(t,e,n),t=t.sibling}var It=null,dr=!1;function Ps(t,e,n){for(n=n.child;n!==null;)KE(t,e,n),n=n.sibling}function KE(t,e,n){if($r&&typeof $r.onCommitFiberUnmount=="function")try{$r.onCommitFiberUnmount(Oh,n)}catch{}switch(n.tag){case 5:Jt||wl(n,e);case 6:var r=It,s=dr;It=null,Ps(t,e,n),It=r,dr=s,It!==null&&(dr?(t=It,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):It.removeChild(n.stateNode));break;case 18:It!==null&&(dr?(t=It,n=n.stateNode,t.nodeType===8?Xp(t.parentNode,n):t.nodeType===1&&Xp(t,n),Nu(t)):Xp(It,n.stateNode));break;case 4:r=It,s=dr,It=n.stateNode.containerInfo,dr=!0,Ps(t,e,n),It=r,dr=s;break;case 0:case 11:case 14:case 15:if(!Jt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Wg(n,e,o),s=s.next}while(s!==r)}Ps(t,e,n);break;case 1:if(!Jt&&(wl(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){dt(n,e,l)}Ps(t,e,n);break;case 21:Ps(t,e,n);break;case 22:n.mode&1?(Jt=(r=Jt)||n.memoizedState!==null,Ps(t,e,n),Jt=r):Ps(t,e,n);break;default:Ps(t,e,n)}}function wk(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new AI),e.forEach(function(r){var s=BI.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function ir(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=t,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:It=l.stateNode,dr=!1;break e;case 3:It=l.stateNode.containerInfo,dr=!0;break e;case 4:It=l.stateNode.containerInfo,dr=!0;break e}l=l.return}if(It===null)throw Error(z(160));KE(i,o,s),It=null,dr=!1;var a=s.alternate;a!==null&&(a.return=null),s.return=null}catch(u){dt(s,e,u)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)JE(e,t),e=e.sibling}function JE(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(ir(e,t),Rr(t),r&4){try{uu(3,t,t.return),$h(3,t)}catch(m){dt(t,t.return,m)}try{uu(5,t,t.return)}catch(m){dt(t,t.return,m)}}break;case 1:ir(e,t),Rr(t),r&512&&n!==null&&wl(n,n.return);break;case 5:if(ir(e,t),Rr(t),r&512&&n!==null&&wl(n,n.return),t.flags&32){var s=t.stateNode;try{Eu(s,"")}catch(m){dt(t,t.return,m)}}if(r&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=n!==null?n.memoizedProps:i,l=t.type,a=t.updateQueue;if(t.updateQueue=null,a!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&yC(s,i),vg(l,o);var u=vg(l,i);for(o=0;o<a.length;o+=2){var c=a[o],d=a[o+1];c==="style"?bC(s,d):c==="dangerouslySetInnerHTML"?wC(s,d):c==="children"?Eu(s,d):Nv(s,c,d,u)}switch(l){case"input":hg(s,i);break;case"textarea":vC(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?Sl(s,!!i.multiple,h,!1):f!==!!i.multiple&&(i.defaultValue!=null?Sl(s,!!i.multiple,i.defaultValue,!0):Sl(s,!!i.multiple,i.multiple?[]:"",!1))}s[Iu]=i}catch(m){dt(t,t.return,m)}}break;case 6:if(ir(e,t),Rr(t),r&4){if(t.stateNode===null)throw Error(z(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(m){dt(t,t.return,m)}}break;case 3:if(ir(e,t),Rr(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Nu(e.containerInfo)}catch(m){dt(t,t.return,m)}break;case 4:ir(e,t),Rr(t);break;case 13:ir(e,t),Rr(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(a0=ht())),r&4&&wk(t);break;case 22:if(c=n!==null&&n.memoizedState!==null,t.mode&1?(Jt=(u=Jt)||c,ir(e,t),Jt=u):ir(e,t),Rr(t),r&8192){if(u=t.memoizedState!==null,(t.stateNode.isHidden=u)&&!c&&t.mode&1)for(Z=t,c=t.child;c!==null;){for(d=Z=c;Z!==null;){switch(f=Z,h=f.child,f.tag){case 0:case 11:case 14:case 15:uu(4,f,f.return);break;case 1:wl(f,f.return);var p=f.stateNode;if(typeof p.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(m){dt(r,n,m)}}break;case 5:wl(f,f.return);break;case 22:if(f.memoizedState!==null){bk(d);continue}}h!==null?(h.return=f,Z=h):bk(d)}c=c.sibling}e:for(c=null,d=t;;){if(d.tag===5){if(c===null){c=d;try{s=d.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=d.stateNode,a=d.memoizedProps.style,o=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=kC("display",o))}catch(m){dt(t,t.return,m)}}}else if(d.tag===6){if(c===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(m){dt(t,t.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;c===d&&(c=null),d=d.return}c===d&&(c=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:ir(e,t),Rr(t),r&4&&wk(t);break;case 21:break;default:ir(e,t),Rr(t)}}function Rr(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(GE(n)){var r=n;break e}n=n.return}throw Error(z(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Eu(s,""),r.flags&=-33);var i=xk(t);Kg(t,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=xk(t);Gg(t,l,o);break;default:throw Error(z(161))}}catch(a){dt(t,t.return,a)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function PI(t,e,n){Z=t,QE(t)}function QE(t,e,n){for(var r=(t.mode&1)!==0;Z!==null;){var s=Z,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Gc;if(!o){var l=s.alternate,a=l!==null&&l.memoizedState!==null||Jt;l=Gc;var u=Jt;if(Gc=o,(Jt=a)&&!u)for(Z=s;Z!==null;)o=Z,a=o.child,o.tag===22&&o.memoizedState!==null?Sk(s):a!==null?(a.return=o,Z=a):Sk(s);for(;i!==null;)Z=i,QE(i),i=i.sibling;Z=s,Gc=l,Jt=u}kk(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Z=i):kk(t)}}function kk(t){for(;Z!==null;){var e=Z;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:Jt||$h(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!Jt)if(n===null)r.componentDidMount();else{var s=e.elementType===e.type?n.memoizedProps:ar(e.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&ik(e,i,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}ik(e,o,n)}break;case 5:var l=e.stateNode;if(n===null&&e.flags&4){n=l;var a=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break;case"img":a.src&&(n.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var u=e.alternate;if(u!==null){var c=u.memoizedState;if(c!==null){var d=c.dehydrated;d!==null&&Nu(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(z(163))}Jt||e.flags&512&&qg(e)}catch(f){dt(e,e.return,f)}}if(e===t){Z=null;break}if(n=e.sibling,n!==null){n.return=e.return,Z=n;break}Z=e.return}}function bk(t){for(;Z!==null;){var e=Z;if(e===t){Z=null;break}var n=e.sibling;if(n!==null){n.return=e.return,Z=n;break}Z=e.return}}function Sk(t){for(;Z!==null;){var e=Z;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{$h(4,e)}catch(a){dt(e,n,a)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(a){dt(e,s,a)}}var i=e.return;try{qg(e)}catch(a){dt(e,i,a)}break;case 5:var o=e.return;try{qg(e)}catch(a){dt(e,o,a)}}}catch(a){dt(e,e.return,a)}if(e===t){Z=null;break}var l=e.sibling;if(l!==null){l.return=e.return,Z=l;break}Z=e.return}}var II=Math.ceil,mf=Ms.ReactCurrentDispatcher,o0=Ms.ReactCurrentOwner,Jn=Ms.ReactCurrentBatchConfig,Le=0,At=null,gt=null,zt=0,Tn=0,kl=Di(0),St=0,Fu=null,Co=0,zh=0,l0=0,cu=null,pn=null,a0=0,Zl=1/0,is=null,gf=!1,Jg=null,mi=null,Kc=!1,si=null,yf=0,du=0,Qg=null,Id=-1,Dd=0;function on(){return Le&6?ht():Id!==-1?Id:Id=ht()}function gi(t){return t.mode&1?Le&2&&zt!==0?zt&-zt:yI.transition!==null?(Dd===0&&(Dd=IC()),Dd):(t=Ue,t!==0||(t=window.event,t=t===void 0?16:BC(t.type)),t):1}function vr(t,e,n,r){if(50<du)throw du=0,Qg=null,Error(z(185));hc(t,n,r),(!(Le&2)||t!==At)&&(t===At&&(!(Le&2)&&(zh|=n),St===4&&qs(t,zt)),xn(t,r),n===1&&Le===0&&!(e.mode&1)&&(Zl=ht()+500,Dh&&Li()))}function xn(t,e){var n=t.callbackNode;yP(t,e);var r=Xd(t,t===At?zt:0);if(r===0)n!==null&&_w(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&_w(n),e===1)t.tag===0?gI(Ck.bind(null,t)):oE(Ck.bind(null,t)),fI(function(){!(Le&6)&&Li()}),n=null;else{switch(DC(r)){case 1:n=Iv;break;case 4:n=_C;break;case 16:n=Yd;break;case 536870912:n=PC;break;default:n=Yd}n=sT(n,ZE.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function ZE(t,e){if(Id=-1,Dd=0,Le&6)throw Error(z(327));var n=t.callbackNode;if(Ml()&&t.callbackNode!==n)return null;var r=Xd(t,t===At?zt:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=vf(t,r);else{e=r;var s=Le;Le|=2;var i=XE();(At!==t||zt!==e)&&(is=null,Zl=ht()+500,ho(t,e));do try{jI();break}catch(l){YE(t,l)}while(!0);Gv(),mf.current=i,Le=s,gt!==null?e=0:(At=null,zt=0,e=St)}if(e!==0){if(e===2&&(s=Sg(t),s!==0&&(r=s,e=Zg(t,s))),e===1)throw n=Fu,ho(t,0),qs(t,r),xn(t,ht()),n;if(e===6)qs(t,r);else{if(s=t.current.alternate,!(r&30)&&!DI(s)&&(e=vf(t,r),e===2&&(i=Sg(t),i!==0&&(r=i,e=Zg(t,i))),e===1))throw n=Fu,ho(t,0),qs(t,r),xn(t,ht()),n;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(z(345));case 2:Ki(t,pn,is);break;case 3:if(qs(t,r),(r&130023424)===r&&(e=a0+500-ht(),10<e)){if(Xd(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){on(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=Ag(Ki.bind(null,t,pn,is),e);break}Ki(t,pn,is);break;case 4:if(qs(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-yr(r);i=1<<o,o=e[o],o>s&&(s=o),r&=~i}if(r=s,r=ht()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*II(r/1960))-r,10<r){t.timeoutHandle=Ag(Ki.bind(null,t,pn,is),r);break}Ki(t,pn,is);break;case 5:Ki(t,pn,is);break;default:throw Error(z(329))}}}return xn(t,ht()),t.callbackNode===n?ZE.bind(null,t):null}function Zg(t,e){var n=cu;return t.current.memoizedState.isDehydrated&&(ho(t,e).flags|=256),t=vf(t,e),t!==2&&(e=pn,pn=n,e!==null&&Yg(e)),t}function Yg(t){pn===null?pn=t:pn.push.apply(pn,t)}function DI(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!kr(i(),s))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function qs(t,e){for(e&=~l0,e&=~zh,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-yr(e),r=1<<n;t[n]=-1,e&=~r}}function Ck(t){if(Le&6)throw Error(z(327));Ml();var e=Xd(t,0);if(!(e&1))return xn(t,ht()),null;var n=vf(t,e);if(t.tag!==0&&n===2){var r=Sg(t);r!==0&&(e=r,n=Zg(t,r))}if(n===1)throw n=Fu,ho(t,0),qs(t,e),xn(t,ht()),n;if(n===6)throw Error(z(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Ki(t,pn,is),xn(t,ht()),null}function u0(t,e){var n=Le;Le|=1;try{return t(e)}finally{Le=n,Le===0&&(Zl=ht()+500,Dh&&Li())}}function Eo(t){si!==null&&si.tag===0&&!(Le&6)&&Ml();var e=Le;Le|=1;var n=Jn.transition,r=Ue;try{if(Jn.transition=null,Ue=1,t)return t()}finally{Ue=r,Jn.transition=n,Le=e,!(Le&6)&&Li()}}function c0(){Tn=kl.current,et(kl)}function ho(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,dI(n)),gt!==null)for(n=gt.return;n!==null;){var r=n;switch(Uv(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&sf();break;case 3:Jl(),et(yn),et(Qt),Xv();break;case 5:Yv(r);break;case 4:Jl();break;case 13:et(it);break;case 19:et(it);break;case 10:Kv(r.type._context);break;case 22:case 23:c0()}n=n.return}if(At=t,gt=t=yi(t.current,null),zt=Tn=e,St=0,Fu=null,l0=zh=Co=0,pn=cu=null,Zi!==null){for(e=0;e<Zi.length;e++)if(n=Zi[e],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}Zi=null}return t}function YE(t,e){do{var n=gt;try{if(Gv(),Ad.current=pf,hf){for(var r=lt.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}hf=!1}if(So=0,Rt=bt=lt=null,au=!1,ju=0,o0.current=null,n===null||n.return===null){St=1,Fu=e,gt=null;break}e:{var i=t,o=n.return,l=n,a=e;if(e=zt,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var u=a,c=l,d=c.tag;if(!(c.mode&1)&&(d===0||d===11||d===15)){var f=c.alternate;f?(c.updateQueue=f.updateQueue,c.memoizedState=f.memoizedState,c.lanes=f.lanes):(c.updateQueue=null,c.memoizedState=null)}var h=dk(o);if(h!==null){h.flags&=-257,fk(h,o,l,i,e),h.mode&1&&ck(i,u,e),e=h,a=u;var p=e.updateQueue;if(p===null){var m=new Set;m.add(a),e.updateQueue=m}else p.add(a);break e}else{if(!(e&1)){ck(i,u,e),d0();break e}a=Error(z(426))}}else if(nt&&l.mode&1){var y=dk(o);if(y!==null){!(y.flags&65536)&&(y.flags|=256),fk(y,o,l,i,e),Wv(Ql(a,l));break e}}i=a=Ql(a,l),St!==4&&(St=2),cu===null?cu=[i]:cu.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var g=DE(i,a,e);sk(i,g);break e;case 1:l=a;var x=i.type,k=i.stateNode;if(!(i.flags&128)&&(typeof x.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(mi===null||!mi.has(k)))){i.flags|=65536,e&=-e,i.lanes|=e;var b=LE(i,l,e);sk(i,b);break e}}i=i.return}while(i!==null)}tT(n)}catch(S){e=S,gt===n&&n!==null&&(gt=n=n.return);continue}break}while(!0)}function XE(){var t=mf.current;return mf.current=pf,t===null?pf:t}function d0(){(St===0||St===3||St===2)&&(St=4),At===null||!(Co&268435455)&&!(zh&268435455)||qs(At,zt)}function vf(t,e){var n=Le;Le|=2;var r=XE();(At!==t||zt!==e)&&(is=null,ho(t,e));do try{LI();break}catch(s){YE(t,s)}while(!0);if(Gv(),Le=n,mf.current=r,gt!==null)throw Error(z(261));return At=null,zt=0,St}function LI(){for(;gt!==null;)eT(gt)}function jI(){for(;gt!==null&&!aP();)eT(gt)}function eT(t){var e=rT(t.alternate,t,Tn);t.memoizedProps=t.pendingProps,e===null?tT(t):gt=e,o0.current=null}function tT(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=OI(n,e),n!==null){n.flags&=32767,gt=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{St=6,gt=null;return}}else if(n=NI(n,e,Tn),n!==null){gt=n;return}if(e=e.sibling,e!==null){gt=e;return}gt=e=t}while(e!==null);St===0&&(St=5)}function Ki(t,e,n){var r=Ue,s=Jn.transition;try{Jn.transition=null,Ue=1,$I(t,e,n,r)}finally{Jn.transition=s,Ue=r}return null}function $I(t,e,n,r){do Ml();while(si!==null);if(Le&6)throw Error(z(327));n=t.finishedWork;var s=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(z(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(vP(t,i),t===At&&(gt=At=null,zt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Kc||(Kc=!0,sT(Yd,function(){return Ml(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Jn.transition,Jn.transition=null;var o=Ue;Ue=1;var l=Le;Le|=4,o0.current=null,_I(t,n),JE(n,t),sI(Ng),ef=!!Mg,Ng=Mg=null,t.current=n,PI(n),uP(),Le=l,Ue=o,Jn.transition=i}else t.current=n;if(Kc&&(Kc=!1,si=t,yf=s),i=t.pendingLanes,i===0&&(mi=null),fP(n.stateNode),xn(t,ht()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)s=e[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(gf)throw gf=!1,t=Jg,Jg=null,t;return yf&1&&t.tag!==0&&Ml(),i=t.pendingLanes,i&1?t===Qg?du++:(du=0,Qg=t):du=0,Li(),null}function Ml(){if(si!==null){var t=DC(yf),e=Jn.transition,n=Ue;try{if(Jn.transition=null,Ue=16>t?16:t,si===null)var r=!1;else{if(t=si,si=null,yf=0,Le&6)throw Error(z(331));var s=Le;for(Le|=4,Z=t.current;Z!==null;){var i=Z,o=i.child;if(Z.flags&16){var l=i.deletions;if(l!==null){for(var a=0;a<l.length;a++){var u=l[a];for(Z=u;Z!==null;){var c=Z;switch(c.tag){case 0:case 11:case 15:uu(8,c,i)}var d=c.child;if(d!==null)d.return=c,Z=d;else for(;Z!==null;){c=Z;var f=c.sibling,h=c.return;if(qE(c),c===u){Z=null;break}if(f!==null){f.return=h,Z=f;break}Z=h}}}var p=i.alternate;if(p!==null){var m=p.child;if(m!==null){p.child=null;do{var y=m.sibling;m.sibling=null,m=y}while(m!==null)}}Z=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,Z=o;else e:for(;Z!==null;){if(i=Z,i.flags&2048)switch(i.tag){case 0:case 11:case 15:uu(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,Z=g;break e}Z=i.return}}var x=t.current;for(Z=x;Z!==null;){o=Z;var k=o.child;if(o.subtreeFlags&2064&&k!==null)k.return=o,Z=k;else e:for(o=x;Z!==null;){if(l=Z,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:$h(9,l)}}catch(S){dt(l,l.return,S)}if(l===o){Z=null;break e}var b=l.sibling;if(b!==null){b.return=l.return,Z=b;break e}Z=l.return}}if(Le=s,Li(),$r&&typeof $r.onPostCommitFiberRoot=="function")try{$r.onPostCommitFiberRoot(Oh,t)}catch{}r=!0}return r}finally{Ue=n,Jn.transition=e}}return!1}function Ek(t,e,n){e=Ql(n,e),e=DE(t,e,1),t=pi(t,e,1),e=on(),t!==null&&(hc(t,1,e),xn(t,e))}function dt(t,e,n){if(t.tag===3)Ek(t,t,n);else for(;e!==null;){if(e.tag===3){Ek(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(mi===null||!mi.has(r))){t=Ql(n,t),t=LE(e,t,1),e=pi(e,t,1),t=on(),e!==null&&(hc(e,1,t),xn(e,t));break}}e=e.return}}function zI(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=on(),t.pingedLanes|=t.suspendedLanes&n,At===t&&(zt&n)===n&&(St===4||St===3&&(zt&130023424)===zt&&500>ht()-a0?ho(t,0):l0|=n),xn(t,e)}function nT(t,e){e===0&&(t.mode&1?(e=$c,$c<<=1,!($c&130023424)&&($c=4194304)):e=1);var n=on();t=Es(t,e),t!==null&&(hc(t,e,n),xn(t,n))}function FI(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),nT(t,n)}function BI(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(z(314))}r!==null&&r.delete(e),nT(t,n)}var rT;rT=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||yn.current)gn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return gn=!1,MI(t,e,n);gn=!!(t.flags&131072)}else gn=!1,nt&&e.flags&1048576&&lE(e,af,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Pd(t,e),t=e.pendingProps;var s=ql(e,Qt.current);Rl(e,n),s=t0(null,e,r,t,s,n);var i=n0();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,vn(r)?(i=!0,of(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Qv(e),s.updater=jh,e.stateNode=s,s._reactInternals=e,$g(e,r,t,n),e=Bg(null,e,r,!0,i,n)):(e.tag=0,nt&&i&&Hv(e),en(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Pd(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=HI(r),t=ar(r,t),s){case 0:e=Fg(null,e,r,t,n);break e;case 1:e=mk(null,e,r,t,n);break e;case 11:e=hk(null,e,r,t,n);break e;case 14:e=pk(null,e,r,ar(r.type,t),n);break e}throw Error(z(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:ar(r,s),Fg(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:ar(r,s),mk(t,e,r,s,n);case 3:e:{if(FE(e),t===null)throw Error(z(387));r=e.pendingProps,i=e.memoizedState,s=i.element,hE(t,e),df(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=Ql(Error(z(423)),e),e=gk(t,e,r,n,s);break e}else if(r!==s){s=Ql(Error(z(424)),e),e=gk(t,e,r,n,s);break e}else for(Mn=hi(e.stateNode.containerInfo.firstChild),Nn=e,nt=!0,fr=null,n=dE(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Gl(),r===s){e=Ts(t,e,n);break e}en(t,e,r,n)}e=e.child}return e;case 5:return pE(e),t===null&&Dg(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,Og(r,s)?o=null:i!==null&&Og(r,i)&&(e.flags|=32),zE(t,e),en(t,e,o,n),e.child;case 6:return t===null&&Dg(e),null;case 13:return BE(t,e,n);case 4:return Zv(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Kl(e,null,r,n):en(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:ar(r,s),hk(t,e,r,s,n);case 7:return en(t,e,e.pendingProps,n),e.child;case 8:return en(t,e,e.pendingProps.children,n),e.child;case 12:return en(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,Qe(uf,r._currentValue),r._currentValue=o,i!==null)if(kr(i.value,o)){if(i.children===s.children&&!yn.current){e=Ts(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=vs(-1,n&-n),a.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Lg(i.return,n,e),l.lanes|=n;break}a=a.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(z(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Lg(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}en(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Rl(e,n),s=Xn(s),r=r(s),e.flags|=1,en(t,e,r,n),e.child;case 14:return r=e.type,s=ar(r,e.pendingProps),s=ar(r.type,s),pk(t,e,r,s,n);case 15:return jE(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:ar(r,s),Pd(t,e),e.tag=1,vn(r)?(t=!0,of(e)):t=!1,Rl(e,n),IE(e,r,s),$g(e,r,s,n),Bg(null,e,r,!0,t,n);case 19:return VE(t,e,n);case 22:return $E(t,e,n)}throw Error(z(156,e.tag))};function sT(t,e){return AC(t,e)}function VI(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kn(t,e,n,r){return new VI(t,e,n,r)}function f0(t){return t=t.prototype,!(!t||!t.isReactComponent)}function HI(t){if(typeof t=="function")return f0(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Av)return 11;if(t===_v)return 14}return 2}function yi(t,e){var n=t.alternate;return n===null?(n=Kn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Ld(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")f0(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case dl:return po(n.children,s,i,e);case Ov:o=8,s|=8;break;case ag:return t=Kn(12,n,e,s|2),t.elementType=ag,t.lanes=i,t;case ug:return t=Kn(13,n,e,s),t.elementType=ug,t.lanes=i,t;case cg:return t=Kn(19,n,e,s),t.elementType=cg,t.lanes=i,t;case pC:return Fh(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case fC:o=10;break e;case hC:o=9;break e;case Av:o=11;break e;case _v:o=14;break e;case zs:o=16,r=null;break e}throw Error(z(130,t==null?t:typeof t,""))}return e=Kn(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function po(t,e,n,r){return t=Kn(7,t,r,e),t.lanes=n,t}function Fh(t,e,n,r){return t=Kn(22,t,r,e),t.elementType=pC,t.lanes=n,t.stateNode={isHidden:!1},t}function lm(t,e,n){return t=Kn(6,t,null,e),t.lanes=n,t}function am(t,e,n){return e=Kn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function UI(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vp(0),this.expirationTimes=Vp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vp(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function h0(t,e,n,r,s,i,o,l,a){return t=new UI(t,e,n,l,a),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Kn(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Qv(i),t}function WI(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:cl,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function iT(t){if(!t)return Ti;t=t._reactInternals;e:{if(jo(t)!==t||t.tag!==1)throw Error(z(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(vn(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(z(171))}if(t.tag===1){var n=t.type;if(vn(n))return iE(t,n,e)}return e}function oT(t,e,n,r,s,i,o,l,a){return t=h0(n,r,!0,t,s,i,o,l,a),t.context=iT(null),n=t.current,r=on(),s=gi(n),i=vs(r,s),i.callback=e??null,pi(n,i,s),t.current.lanes=s,hc(t,s,r),xn(t,r),t}function Bh(t,e,n,r){var s=e.current,i=on(),o=gi(s);return n=iT(n),e.context===null?e.context=n:e.pendingContext=n,e=vs(i,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=pi(s,e,o),t!==null&&(vr(t,s,o,i),Od(t,s,o)),o}function xf(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Tk(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function p0(t,e){Tk(t,e),(t=t.alternate)&&Tk(t,e)}function qI(){return null}var lT=typeof reportError=="function"?reportError:function(t){console.error(t)};function m0(t){this._internalRoot=t}Vh.prototype.render=m0.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(z(409));Bh(t,e,null,null)};Vh.prototype.unmount=m0.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Eo(function(){Bh(null,t,null,null)}),e[Cs]=null}};function Vh(t){this._internalRoot=t}Vh.prototype.unstable_scheduleHydration=function(t){if(t){var e=$C();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Ws.length&&e!==0&&e<Ws[n].priority;n++);Ws.splice(n,0,t),n===0&&FC(t)}};function g0(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Hh(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Rk(){}function GI(t,e,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=xf(o);i.call(u)}}var o=oT(e,r,t,0,null,!1,!1,"",Rk);return t._reactRootContainer=o,t[Cs]=o.current,_u(t.nodeType===8?t.parentNode:t),Eo(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=xf(a);l.call(u)}}var a=h0(t,0,!1,null,null,!1,!1,"",Rk);return t._reactRootContainer=a,t[Cs]=a.current,_u(t.nodeType===8?t.parentNode:t),Eo(function(){Bh(e,a,n,r)}),a}function Uh(t,e,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var a=xf(o);l.call(a)}}Bh(e,o,t,s)}else o=GI(n,e,t,s,r);return xf(o)}LC=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Ua(e.pendingLanes);n!==0&&(Dv(e,n|1),xn(e,ht()),!(Le&6)&&(Zl=ht()+500,Li()))}break;case 13:Eo(function(){var r=Es(t,1);if(r!==null){var s=on();vr(r,t,1,s)}}),p0(t,1)}};Lv=function(t){if(t.tag===13){var e=Es(t,134217728);if(e!==null){var n=on();vr(e,t,134217728,n)}p0(t,134217728)}};jC=function(t){if(t.tag===13){var e=gi(t),n=Es(t,e);if(n!==null){var r=on();vr(n,t,e,r)}p0(t,e)}};$C=function(){return Ue};zC=function(t,e){var n=Ue;try{return Ue=t,e()}finally{Ue=n}};wg=function(t,e,n){switch(e){case"input":if(hg(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var s=Ih(r);if(!s)throw Error(z(90));gC(r),hg(r,s)}}}break;case"textarea":vC(t,n);break;case"select":e=n.value,e!=null&&Sl(t,!!n.multiple,e,!1)}};EC=u0;TC=Eo;var KI={usingClientEntryPoint:!1,Events:[mc,ml,Ih,SC,CC,u0]},Pa={findFiberByHostInstance:Qi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},JI={bundleType:Pa.bundleType,version:Pa.version,rendererPackageName:Pa.rendererPackageName,rendererConfig:Pa.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ms.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=NC(t),t===null?null:t.stateNode},findFiberByHostInstance:Pa.findFiberByHostInstance||qI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Jc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jc.isDisabled&&Jc.supportsFiber)try{Oh=Jc.inject(JI),$r=Jc}catch{}}In.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=KI;In.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g0(e))throw Error(z(200));return WI(t,e,null,n)};In.createRoot=function(t,e){if(!g0(t))throw Error(z(299));var n=!1,r="",s=lT;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=h0(t,1,!1,null,null,n,!1,r,s),t[Cs]=e.current,_u(t.nodeType===8?t.parentNode:t),new m0(e)};In.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(z(188)):(t=Object.keys(t).join(","),Error(z(268,t)));return t=NC(e),t=t===null?null:t.stateNode,t};In.flushSync=function(t){return Eo(t)};In.hydrate=function(t,e,n){if(!Hh(e))throw Error(z(200));return Uh(null,t,e,!0,n)};In.hydrateRoot=function(t,e,n){if(!g0(t))throw Error(z(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=lT;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=oT(e,null,t,1,n??null,s,!1,i,o),t[Cs]=e.current,_u(t),r)for(t=0;t<r.length;t++)n=r[t],s=n._getVersion,s=s(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,s]:e.mutableSourceEagerHydrationData.push(n,s);return new Vh(e)};In.render=function(t,e,n){if(!Hh(e))throw Error(z(200));return Uh(null,t,e,!1,n)};In.unmountComponentAtNode=function(t){if(!Hh(t))throw Error(z(40));return t._reactRootContainer?(Eo(function(){Uh(null,null,t,!1,function(){t._reactRootContainer=null,t[Cs]=null})}),!0):!1};In.unstable_batchedUpdates=u0;In.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Hh(n))throw Error(z(200));if(t==null||t._reactInternals===void 0)throw Error(z(38));return Uh(t,e,n,!1,r)};In.version="18.3.1-next-f1338f8080-20240426";function aT(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(aT)}catch(t){console.error(t)}}aT(),aC.exports=In;var $o=aC.exports;const uT=QS($o);var cT,Mk=$o;cT=Mk.createRoot,Mk.hydrateRoot;/**
41
- * @remix-run/router v1.23.2
42
- *
43
- * Copyright (c) Remix Software Inc.
44
- *
45
- * This source code is licensed under the MIT license found in the
46
- * LICENSE.md file in the root directory of this source tree.
47
- *
48
- * @license MIT
49
- */function Bu(){return Bu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Bu.apply(this,arguments)}var ii;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(ii||(ii={}));const Nk="popstate";function QI(t){t===void 0&&(t={});function e(r,s){let{pathname:i,search:o,hash:l}=r.location;return Xg("",{pathname:i,search:o,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:dT(s)}return YI(e,n,null,t)}function Ct(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function y0(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function ZI(){return Math.random().toString(36).substr(2,8)}function Ok(t,e){return{usr:t.state,key:t.key,idx:e}}function Xg(t,e,n,r){return n===void 0&&(n=null),Bu({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?ya(e):e,{state:n,key:e&&e.key||r||ZI()})}function dT(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function ya(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function YI(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l=ii.Pop,a=null,u=c();u==null&&(u=0,o.replaceState(Bu({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function d(){l=ii.Pop;let y=c(),g=y==null?null:y-u;u=y,a&&a({action:l,location:m.location,delta:g})}function f(y,g){l=ii.Push;let x=Xg(m.location,y,g);u=c()+1;let k=Ok(x,u),b=m.createHref(x);try{o.pushState(k,"",b)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;s.location.assign(b)}i&&a&&a({action:l,location:m.location,delta:1})}function h(y,g){l=ii.Replace;let x=Xg(m.location,y,g);u=c();let k=Ok(x,u),b=m.createHref(x);o.replaceState(k,"",b),i&&a&&a({action:l,location:m.location,delta:0})}function p(y){let g=s.location.origin!=="null"?s.location.origin:s.location.href,x=typeof y=="string"?y:dT(y);return x=x.replace(/ $/,"%20"),Ct(g,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,g)}let m={get action(){return l},get location(){return t(s,o)},listen(y){if(a)throw new Error("A history only accepts one active listener");return s.addEventListener(Nk,d),a=y,()=>{s.removeEventListener(Nk,d),a=null}},createHref(y){return e(s,y)},createURL:p,encodeLocation(y){let g=p(y);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:f,replace:h,go(y){return o.go(y)}};return m}var Ak;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Ak||(Ak={}));function XI(t,e,n){return n===void 0&&(n="/"),eD(t,e,n)}function eD(t,e,n,r){let s=typeof e=="string"?ya(e):e,i=pT(s.pathname||"/",n);if(i==null)return null;let o=fT(t);tD(o);let l=null;for(let a=0;l==null&&a<o.length;++a){let u=hD(i);l=cD(o[a],u)}return l}function fT(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(i,o,l)=>{let a={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};a.relativePath.startsWith("/")&&(Ct(a.relativePath.startsWith(r),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(r.length));let u=mo([r,a.relativePath]),c=n.concat(a);i.children&&i.children.length>0&&(Ct(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),fT(i.children,e,c,u)),!(i.path==null&&!i.index)&&e.push({path:u,score:aD(u,i.index),routesMeta:c})};return t.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,o);else for(let a of hT(i.path))s(i,o,a)}),e}function hT(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=hT(r.join("/")),l=[];return l.push(...o.map(a=>a===""?i:[i,a].join("/"))),s&&l.push(...o),l.map(a=>t.startsWith("/")&&a===""?"/":a)}function tD(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:uD(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const nD=/^:[\w-]+$/,rD=3,sD=2,iD=1,oD=10,lD=-2,_k=t=>t==="*";function aD(t,e){let n=t.split("/"),r=n.length;return n.some(_k)&&(r+=lD),e&&(r+=sD),n.filter(s=>!_k(s)).reduce((s,i)=>s+(nD.test(i)?rD:i===""?iD:oD),r)}function uD(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function cD(t,e,n){let{routesMeta:r}=t,s={},i="/",o=[];for(let l=0;l<r.length;++l){let a=r[l],u=l===r.length-1,c=i==="/"?e:e.slice(i.length)||"/",d=dD({path:a.relativePath,caseSensitive:a.caseSensitive,end:u},c),f=a.route;if(!d)return null;Object.assign(s,d.params),o.push({params:s,pathname:mo([i,d.pathname]),pathnameBase:wD(mo([i,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(i=mo([i,d.pathnameBase]))}return o}function dD(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=fD(t.path,t.caseSensitive,t.end),s=e.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((u,c,d)=>{let{paramName:f,isOptional:h}=c;if(f==="*"){let m=l[d]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const p=l[d];return h&&!p?u[f]=void 0:u[f]=(p||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:t}}function fD(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),y0(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,a)=>(r.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function hD(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return y0(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function pT(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}const pD=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mD=t=>pD.test(t);function gD(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?ya(t):t,i;if(n)if(mD(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),y0(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=Pk(n.substring(1),"/"):i=Pk(n,e)}else i=e;return{pathname:i,search:kD(r),hash:bD(s)}}function Pk(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function um(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function yD(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function vD(t,e){let n=yD(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function xD(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=ya(t):(s=Bu({},t),Ct(!s.pathname||!s.pathname.includes("?"),um("?","pathname","search",s)),Ct(!s.pathname||!s.pathname.includes("#"),um("#","pathname","hash",s)),Ct(!s.search||!s.search.includes("#"),um("#","search","hash",s)));let i=t===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let d=e.length-1;if(!r&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),d-=1;s.pathname=f.join("/")}l=d>=0?e[d]:"/"}let a=gD(s,l),u=o&&o!=="/"&&o.endsWith("/"),c=(i||o===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const mo=t=>t.join("/").replace(/\/\/+/g,"/"),wD=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),kD=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,bD=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function SD(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const mT=["post","put","patch","delete"];new Set(mT);const CD=["get",...mT];new Set(CD);/**
50
- * React Router v6.30.3
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */function Vu(){return Vu=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Vu.apply(this,arguments)}const v0=v.createContext(null),ED=v.createContext(null),Wh=v.createContext(null),qh=v.createContext(null),va=v.createContext({outlet:null,matches:[],isDataRoute:!1}),gT=v.createContext(null);function Gh(){return v.useContext(qh)!=null}function x0(){return Gh()||Ct(!1),v.useContext(qh).location}function yT(t){v.useContext(Wh).static||v.useLayoutEffect(t)}function vT(){let{isDataRoute:t}=v.useContext(va);return t?$D():TD()}function TD(){Gh()||Ct(!1);let t=v.useContext(v0),{basename:e,future:n,navigator:r}=v.useContext(Wh),{matches:s}=v.useContext(va),{pathname:i}=x0(),o=JSON.stringify(vD(s,n.v7_relativeSplatPath)),l=v.useRef(!1);return yT(()=>{l.current=!0}),v.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let d=xD(u,JSON.parse(o),i,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:mo([e,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[e,r,o,i,t])}function RD(t,e){return MD(t,e)}function MD(t,e,n,r){Gh()||Ct(!1);let{navigator:s}=v.useContext(Wh),{matches:i}=v.useContext(va),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let u=x0(),c;if(e){var d;let y=typeof e=="string"?ya(e):e;a==="/"||(d=y.pathname)!=null&&d.startsWith(a)||Ct(!1),c=y}else c=u;let f=c.pathname||"/",h=f;if(a!=="/"){let y=a.replace(/^\//,"").split("/");h="/"+f.replace(/^\//,"").split("/").slice(y.length).join("/")}let p=XI(t,{pathname:h}),m=PD(p&&p.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:mo([a,s.encodeLocation?s.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?a:mo([a,s.encodeLocation?s.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,n,r);return e&&m?v.createElement(qh.Provider,{value:{location:Vu({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:ii.Pop}},m):m}function ND(){let t=jD(),e=SD(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},e),n?v.createElement("pre",{style:s},n):null,null)}const OD=v.createElement(ND,null);class AD extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?v.createElement(va.Provider,{value:this.props.routeContext},v.createElement(gT.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function _D(t){let{routeContext:e,match:n,children:r}=t,s=v.useContext(v0);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(va.Provider,{value:e},r)}function PD(t,e,n,r){var s;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,l=(s=n)==null?void 0:s.errors;if(l!=null){let c=o.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id])!==void 0);c>=0||Ct(!1),o=o.slice(0,Math.min(o.length,c+1))}let a=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let c=0;c<o.length;c++){let d=o[c];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(u=c),d.route.id){let{loaderData:f,errors:h}=n,p=d.route.loader&&f[d.route.id]===void 0&&(!h||h[d.route.id]===void 0);if(d.route.lazy||p){a=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,d,f)=>{let h,p=!1,m=null,y=null;n&&(h=l&&d.route.id?l[d.route.id]:void 0,m=d.route.errorElement||OD,a&&(u<0&&f===0?(zD("route-fallback"),p=!0,y=null):u===f&&(p=!0,y=d.route.hydrateFallbackElement||null)));let g=e.concat(o.slice(0,f+1)),x=()=>{let k;return h?k=m:p?k=y:d.route.Component?k=v.createElement(d.route.Component,null):d.route.element?k=d.route.element:k=c,v.createElement(_D,{match:d,routeContext:{outlet:c,matches:g,isDataRoute:n!=null},children:k})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?v.createElement(AD,{location:n.location,revalidation:n.revalidation,component:m,error:h,children:x(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):x()},null)}var xT=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(xT||{}),wT=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(wT||{});function ID(t){let e=v.useContext(v0);return e||Ct(!1),e}function DD(t){let e=v.useContext(ED);return e||Ct(!1),e}function LD(t){let e=v.useContext(va);return e||Ct(!1),e}function kT(t){let e=LD(),n=e.matches[e.matches.length-1];return n.route.id||Ct(!1),n.route.id}function jD(){var t;let e=v.useContext(gT),n=DD(),r=kT();return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function $D(){let{router:t}=ID(xT.UseNavigateStable),e=kT(wT.UseNavigateStable),n=v.useRef(!1);return yT(()=>{n.current=!0}),v.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,Vu({fromRouteId:e},i)))},[t,e])}const Ik={};function zD(t,e,n){Ik[t]||(Ik[t]=!0)}function FD(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function bT(t){Ct(!1)}function BD(t){let{basename:e="/",children:n=null,location:r,navigationType:s=ii.Pop,navigator:i,static:o=!1,future:l}=t;Gh()&&Ct(!1);let a=e.replace(/^\/*/,"/"),u=v.useMemo(()=>({basename:a,navigator:i,static:o,future:Vu({v7_relativeSplatPath:!1},l)}),[a,l,i,o]);typeof r=="string"&&(r=ya(r));let{pathname:c="/",search:d="",hash:f="",state:h=null,key:p="default"}=r,m=v.useMemo(()=>{let y=pT(c,a);return y==null?null:{location:{pathname:y,search:d,hash:f,state:h,key:p},navigationType:s}},[a,c,d,f,h,p,s]);return m==null?null:v.createElement(Wh.Provider,{value:u},v.createElement(qh.Provider,{children:n,value:m}))}function VD(t){let{children:e,location:n}=t;return RD(ey(e),n)}new Promise(()=>{});function ey(t,e){e===void 0&&(e=[]);let n=[];return v.Children.forEach(t,(r,s)=>{if(!v.isValidElement(r))return;let i=[...e,s];if(r.type===v.Fragment){n.push.apply(n,ey(r.props.children,i));return}r.type!==bT&&Ct(!1),!r.props.index||!r.props.children||Ct(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=ey(r.props.children,i)),n.push(o)}),n}/**
59
- * React Router DOM v6.30.3
60
- *
61
- * Copyright (c) Remix Software Inc.
62
- *
63
- * This source code is licensed under the MIT license found in the
64
- * LICENSE.md file in the root directory of this source tree.
65
- *
66
- * @license MIT
67
- */const HD="6";try{window.__reactRouterVersion=HD}catch{}const UD="startTransition",Dk=Nh[UD];function WD(t){let{basename:e,children:n,future:r,window:s}=t,i=v.useRef();i.current==null&&(i.current=QI({window:s,v5Compat:!0}));let o=i.current,[l,a]=v.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},c=v.useCallback(d=>{u&&Dk?Dk(()=>a(d)):a(d)},[a,u]);return v.useLayoutEffect(()=>o.listen(c),[o,c]),v.useEffect(()=>FD(r),[r]),v.createElement(BD,{basename:e,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}var Lk;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(Lk||(Lk={}));var jk;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(jk||(jk={}));var yc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},qD={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Js,bv,FS,GD=(FS=class{constructor(){de(this,Js,qD);de(this,bv,!1)}setTimeoutProvider(t){J(this,Js,t)}setTimeout(t,e){return R(this,Js).setTimeout(t,e)}clearTimeout(t){R(this,Js).clearTimeout(t)}setInterval(t,e){return R(this,Js).setInterval(t,e)}clearInterval(t){R(this,Js).clearInterval(t)}},Js=new WeakMap,bv=new WeakMap,FS),Xi=new GD;function KD(t){setTimeout(t,0)}var To=typeof window>"u"||"Deno"in globalThis;function hn(){}function JD(t,e){return typeof t=="function"?t(e):t}function ty(t){return typeof t=="number"&&t>=0&&t!==1/0}function ST(t,e){return Math.max(t+(e||0)-Date.now(),0)}function vi(t,e){return typeof t=="function"?t(e):t}function Vn(t,e){return typeof t=="function"?t(e):t}function $k(t,e){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:l}=t;if(o){if(r){if(e.queryHash!==w0(o,e.options))return!1}else if(!Uu(e.queryKey,o))return!1}if(n!=="all"){const a=e.isActive();if(n==="active"&&!a||n==="inactive"&&a)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||i&&!i(e))}function zk(t,e){const{exact:n,status:r,predicate:s,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(n){if(Hu(e.options.mutationKey)!==Hu(i))return!1}else if(!Uu(e.options.mutationKey,i))return!1}return!(r&&e.state.status!==r||s&&!s(e))}function w0(t,e){return((e==null?void 0:e.queryKeyHashFn)||Hu)(t)}function Hu(t){return JSON.stringify(t,(e,n)=>ry(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Uu(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Uu(t[n],e[n])):!1}var QD=Object.prototype.hasOwnProperty;function CT(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=Fk(t)&&Fk(e);if(!r&&!(ry(t)&&ry(e)))return e;const i=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),l=o.length,a=r?new Array(l):{};let u=0;for(let c=0;c<l;c++){const d=r?c:o[c],f=t[d],h=e[d];if(f===h){a[d]=f,(r?c<i:QD.call(t,d))&&u++;continue}if(f===null||h===null||typeof f!="object"||typeof h!="object"){a[d]=h;continue}const p=CT(f,h,n+1);a[d]=p,p===f&&u++}return i===l&&u===i?t:a}function ny(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function Fk(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function ry(t){if(!Bk(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!Bk(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Bk(t){return Object.prototype.toString.call(t)==="[object Object]"}function ZD(t){return new Promise(e=>{Xi.setTimeout(e,t)})}function sy(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?CT(t,e):e}function YD(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function XD(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var k0=Symbol();function ET(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===k0?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function TT(t,e){return typeof t=="function"?t(...e):!!t}function e2(t,e,n){let r=!1,s;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(s??(s=e()),r||(r=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),t}var ro,Qs,Pl,BS,t2=(BS=class extends yc{constructor(){super();de(this,ro);de(this,Qs);de(this,Pl);J(this,Pl,e=>{if(!To&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){R(this,Qs)||this.setEventListener(R(this,Pl))}onUnsubscribe(){var e;this.hasListeners()||((e=R(this,Qs))==null||e.call(this),J(this,Qs,void 0))}setEventListener(e){var n;J(this,Pl,e),(n=R(this,Qs))==null||n.call(this),J(this,Qs,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){R(this,ro)!==e&&(J(this,ro,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof R(this,ro)=="boolean"?R(this,ro):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ro=new WeakMap,Qs=new WeakMap,Pl=new WeakMap,BS),b0=new t2;function iy(){let t,e;const n=new Promise((s,i)=>{t=s,e=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),t(s)},n.reject=s=>{r({status:"rejected",reason:s}),e(s)},n}var n2=KD;function r2(){let t=[],e=0,n=l=>{l()},r=l=>{l()},s=n2;const i=l=>{e?t.push(l):s(()=>{n(l)})},o=()=>{const l=t;t=[],l.length&&s(()=>{r(()=>{l.forEach(a=>{n(a)})})})};return{batch:l=>{let a;e++;try{a=l()}finally{e--,e||o()}return a},batchCalls:l=>(...a)=>{i(()=>{l(...a)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var Lt=r2(),Il,Zs,Dl,VS,s2=(VS=class extends yc{constructor(){super();de(this,Il,!0);de(this,Zs);de(this,Dl);J(this,Dl,e=>{if(!To&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){R(this,Zs)||this.setEventListener(R(this,Dl))}onUnsubscribe(){var e;this.hasListeners()||((e=R(this,Zs))==null||e.call(this),J(this,Zs,void 0))}setEventListener(e){var n;J(this,Dl,e),(n=R(this,Zs))==null||n.call(this),J(this,Zs,e(this.setOnline.bind(this)))}setOnline(e){R(this,Il)!==e&&(J(this,Il,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return R(this,Il)}},Il=new WeakMap,Zs=new WeakMap,Dl=new WeakMap,VS),wf=new s2;function i2(t){return Math.min(1e3*2**t,3e4)}function RT(t){return(t??"online")==="online"?wf.isOnline():!0}var oy=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function MT(t){let e=!1,n=0,r;const s=iy(),i=()=>s.status!=="pending",o=m=>{var y;if(!i()){const g=new oy(m);f(g),(y=t.onCancel)==null||y.call(t,g)}},l=()=>{e=!0},a=()=>{e=!1},u=()=>b0.isFocused()&&(t.networkMode==="always"||wf.isOnline())&&t.canRun(),c=()=>RT(t.networkMode)&&t.canRun(),d=m=>{i()||(r==null||r(),s.resolve(m))},f=m=>{i()||(r==null||r(),s.reject(m))},h=()=>new Promise(m=>{var y;r=g=>{(i()||u())&&m(g)},(y=t.onPause)==null||y.call(t)}).then(()=>{var m;r=void 0,i()||(m=t.onContinue)==null||m.call(t)}),p=()=>{if(i())return;let m;const y=n===0?t.initialPromise:void 0;try{m=y??t.fn()}catch(g){m=Promise.reject(g)}Promise.resolve(m).then(d).catch(g=>{var C;if(i())return;const x=t.retry??(To?0:3),k=t.retryDelay??i2,b=typeof k=="function"?k(n,g):k,S=x===!0||typeof x=="number"&&n<x||typeof x=="function"&&x(n,g);if(e||!S){f(g);return}n++,(C=t.onFail)==null||C.call(t,n,g),ZD(b).then(()=>u()?void 0:h()).then(()=>{e?f(g):p()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:l,continueRetry:a,canStart:c,start:()=>(c()?p():h().then(p),s)}}var so,HS,NT=(HS=class{constructor(){de(this,so)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ty(this.gcTime)&&J(this,so,Xi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(To?1/0:5*60*1e3))}clearGcTimeout(){R(this,so)&&(Xi.clearTimeout(R(this,so)),J(this,so,void 0))}},so=new WeakMap,HS),io,Ll,Bn,oo,Tt,lc,lo,ur,ts,US,o2=(US=class extends NT{constructor(e){super();de(this,ur);de(this,io);de(this,Ll);de(this,Bn);de(this,oo);de(this,Tt);de(this,lc);de(this,lo);J(this,lo,!1),J(this,lc,e.defaultOptions),this.setOptions(e.options),this.observers=[],J(this,oo,e.client),J(this,Bn,R(this,oo).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,J(this,io,Hk(this.options)),this.state=e.state??R(this,io),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=R(this,Tt))==null?void 0:e.promise}setOptions(e){if(this.options={...R(this,lc),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Hk(this.options);n.data!==void 0&&(this.setState(Vk(n.data,n.dataUpdatedAt)),J(this,io,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&R(this,Bn).remove(this)}setData(e,n){const r=sy(this.state.data,e,this.options);return Ae(this,ur,ts).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Ae(this,ur,ts).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,s;const n=(r=R(this,Tt))==null?void 0:r.promise;return(s=R(this,Tt))==null||s.cancel(e),n?n.then(hn).catch(hn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(R(this,io))}isActive(){return this.observers.some(e=>Vn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===k0||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>vi(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!ST(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=R(this,Tt))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=R(this,Tt))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),R(this,Bn).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(R(this,Tt)&&(R(this,lo)?R(this,Tt).cancel({revert:!0}):R(this,Tt).cancelRetry()),this.scheduleGc()),R(this,Bn).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ae(this,ur,ts).call(this,{type:"invalidate"})}async fetch(e,n){var a,u,c,d,f,h,p,m,y,g,x,k;if(this.state.fetchStatus!=="idle"&&((a=R(this,Tt))==null?void 0:a.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(R(this,Tt))return R(this,Tt).continueRetry(),R(this,Tt).promise}if(e&&this.setOptions(e),!this.options.queryFn){const b=this.observers.find(S=>S.options.queryFn);b&&this.setOptions(b.options)}const r=new AbortController,s=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(J(this,lo,!0),r.signal)})},i=()=>{const b=ET(this.options,n),C=(()=>{const E={client:R(this,oo),queryKey:this.queryKey,meta:this.meta};return s(E),E})();return J(this,lo,!1),this.options.persister?this.options.persister(b,C,this):b(C)},l=(()=>{const b={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:R(this,oo),state:this.state,fetchFn:i};return s(b),b})();(u=this.options.behavior)==null||u.onFetch(l,this),J(this,Ll,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=l.fetchOptions)==null?void 0:c.meta))&&Ae(this,ur,ts).call(this,{type:"fetch",meta:(d=l.fetchOptions)==null?void 0:d.meta}),J(this,Tt,MT({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,onCancel:b=>{b instanceof oy&&b.revert&&this.setState({...R(this,Ll),fetchStatus:"idle"}),r.abort()},onFail:(b,S)=>{Ae(this,ur,ts).call(this,{type:"failed",failureCount:b,error:S})},onPause:()=>{Ae(this,ur,ts).call(this,{type:"pause"})},onContinue:()=>{Ae(this,ur,ts).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const b=await R(this,Tt).start();if(b===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(b),(h=(f=R(this,Bn).config).onSuccess)==null||h.call(f,b,this),(m=(p=R(this,Bn).config).onSettled)==null||m.call(p,b,this.state.error,this),b}catch(b){if(b instanceof oy){if(b.silent)return R(this,Tt).promise;if(b.revert){if(this.state.data===void 0)throw b;return this.state.data}}throw Ae(this,ur,ts).call(this,{type:"error",error:b}),(g=(y=R(this,Bn).config).onError)==null||g.call(y,b,this),(k=(x=R(this,Bn).config).onSettled)==null||k.call(x,this.state.data,b,this),b}finally{this.scheduleGc()}}},io=new WeakMap,Ll=new WeakMap,Bn=new WeakMap,oo=new WeakMap,Tt=new WeakMap,lc=new WeakMap,lo=new WeakMap,ur=new WeakSet,ts=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...OT(r.data,this.options),fetchMeta:e.meta??null};case"success":const s={...r,...Vk(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return J(this,Ll,e.manual?s:void 0),s;case"error":const i=e.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Lt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),R(this,Bn).notify({query:this,type:"updated",action:e})})},US);function OT(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:RT(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Vk(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Hk(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var fn,_e,ac,Xt,ao,jl,ds,Ys,uc,$l,zl,uo,co,Xs,Fl,Be,qa,ly,ay,uy,cy,dy,fy,hy,AT,WS,l2=(WS=class extends yc{constructor(e,n){super();de(this,Be);de(this,fn);de(this,_e);de(this,ac);de(this,Xt);de(this,ao);de(this,jl);de(this,ds);de(this,Ys);de(this,uc);de(this,$l);de(this,zl);de(this,uo);de(this,co);de(this,Xs);de(this,Fl,new Set);this.options=n,J(this,fn,e),J(this,Ys,null),J(this,ds,iy()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(R(this,_e).addObserver(this),Uk(R(this,_e),this.options)?Ae(this,Be,qa).call(this):this.updateResult(),Ae(this,Be,cy).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return py(R(this,_e),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return py(R(this,_e),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ae(this,Be,dy).call(this),Ae(this,Be,fy).call(this),R(this,_e).removeObserver(this)}setOptions(e){const n=this.options,r=R(this,_e);if(this.options=R(this,fn).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Vn(this.options.enabled,R(this,_e))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ae(this,Be,hy).call(this),R(this,_e).setOptions(this.options),n._defaulted&&!ny(this.options,n)&&R(this,fn).getQueryCache().notify({type:"observerOptionsUpdated",query:R(this,_e),observer:this});const s=this.hasListeners();s&&Wk(R(this,_e),r,this.options,n)&&Ae(this,Be,qa).call(this),this.updateResult(),s&&(R(this,_e)!==r||Vn(this.options.enabled,R(this,_e))!==Vn(n.enabled,R(this,_e))||vi(this.options.staleTime,R(this,_e))!==vi(n.staleTime,R(this,_e)))&&Ae(this,Be,ly).call(this);const i=Ae(this,Be,ay).call(this);s&&(R(this,_e)!==r||Vn(this.options.enabled,R(this,_e))!==Vn(n.enabled,R(this,_e))||i!==R(this,Xs))&&Ae(this,Be,uy).call(this,i)}getOptimisticResult(e){const n=R(this,fn).getQueryCache().build(R(this,fn),e),r=this.createResult(n,e);return u2(this,r)&&(J(this,Xt,r),J(this,jl,this.options),J(this,ao,R(this,_e).state)),r}getCurrentResult(){return R(this,Xt)}trackResult(e,n){return new Proxy(e,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&R(this,ds).status==="pending"&&R(this,ds).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(e){R(this,Fl).add(e)}getCurrentQuery(){return R(this,_e)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=R(this,fn).defaultQueryOptions(e),r=R(this,fn).getQueryCache().build(R(this,fn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return Ae(this,Be,qa).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),R(this,Xt)))}createResult(e,n){var N;const r=R(this,_e),s=this.options,i=R(this,Xt),o=R(this,ao),l=R(this,jl),u=e!==r?e.state:R(this,ac),{state:c}=e;let d={...c},f=!1,h;if(n._optimisticResults){const O=this.hasListeners(),H=!O&&Uk(e,n),ne=O&&Wk(e,r,n,s);(H||ne)&&(d={...d,...OT(c.data,e.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:y}=d;h=d.data;let g=!1;if(n.placeholderData!==void 0&&h===void 0&&y==="pending"){let O;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(O=i.data,g=!0):O=typeof n.placeholderData=="function"?n.placeholderData((N=R(this,zl))==null?void 0:N.state.data,R(this,zl)):n.placeholderData,O!==void 0&&(y="success",h=sy(i==null?void 0:i.data,O,n),f=!0)}if(n.select&&h!==void 0&&!g)if(i&&h===(o==null?void 0:o.data)&&n.select===R(this,uc))h=R(this,$l);else try{J(this,uc,n.select),h=n.select(h),h=sy(i==null?void 0:i.data,h,n),J(this,$l,h),J(this,Ys,null)}catch(O){J(this,Ys,O)}R(this,Ys)&&(p=R(this,Ys),h=R(this,$l),m=Date.now(),y="error");const x=d.fetchStatus==="fetching",k=y==="pending",b=y==="error",S=k&&x,C=h!==void 0,T={status:y,fetchStatus:d.fetchStatus,isPending:k,isSuccess:y==="success",isError:b,isInitialLoading:S,isLoading:S,data:h,dataUpdatedAt:d.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:x,isRefetching:x&&!k,isLoadingError:b&&!C,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:b&&C,isStale:S0(e,n),refetch:this.refetch,promise:R(this,ds),isEnabled:Vn(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const O=T.data!==void 0,H=T.status==="error"&&!O,ne=le=>{H?le.reject(T.error):O&&le.resolve(T.data)},ae=()=>{const le=J(this,ds,T.promise=iy());ne(le)},Q=R(this,ds);switch(Q.status){case"pending":e.queryHash===r.queryHash&&ne(Q);break;case"fulfilled":(H||T.data!==Q.value)&&ae();break;case"rejected":(!H||T.error!==Q.reason)&&ae();break}}return T}updateResult(){const e=R(this,Xt),n=this.createResult(R(this,_e),this.options);if(J(this,ao,R(this,_e).state),J(this,jl,this.options),R(this,ao).data!==void 0&&J(this,zl,R(this,_e)),ny(n,e))return;J(this,Xt,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!R(this,Fl).size)return!0;const o=new Set(i??R(this,Fl));return this.options.throwOnError&&o.add("error"),Object.keys(R(this,Xt)).some(l=>{const a=l;return R(this,Xt)[a]!==e[a]&&o.has(a)})};Ae(this,Be,AT).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ae(this,Be,cy).call(this)}},fn=new WeakMap,_e=new WeakMap,ac=new WeakMap,Xt=new WeakMap,ao=new WeakMap,jl=new WeakMap,ds=new WeakMap,Ys=new WeakMap,uc=new WeakMap,$l=new WeakMap,zl=new WeakMap,uo=new WeakMap,co=new WeakMap,Xs=new WeakMap,Fl=new WeakMap,Be=new WeakSet,qa=function(e){Ae(this,Be,hy).call(this);let n=R(this,_e).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(hn)),n},ly=function(){Ae(this,Be,dy).call(this);const e=vi(this.options.staleTime,R(this,_e));if(To||R(this,Xt).isStale||!ty(e))return;const r=ST(R(this,Xt).dataUpdatedAt,e)+1;J(this,uo,Xi.setTimeout(()=>{R(this,Xt).isStale||this.updateResult()},r))},ay=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(R(this,_e)):this.options.refetchInterval)??!1},uy=function(e){Ae(this,Be,fy).call(this),J(this,Xs,e),!(To||Vn(this.options.enabled,R(this,_e))===!1||!ty(R(this,Xs))||R(this,Xs)===0)&&J(this,co,Xi.setInterval(()=>{(this.options.refetchIntervalInBackground||b0.isFocused())&&Ae(this,Be,qa).call(this)},R(this,Xs)))},cy=function(){Ae(this,Be,ly).call(this),Ae(this,Be,uy).call(this,Ae(this,Be,ay).call(this))},dy=function(){R(this,uo)&&(Xi.clearTimeout(R(this,uo)),J(this,uo,void 0))},fy=function(){R(this,co)&&(Xi.clearInterval(R(this,co)),J(this,co,void 0))},hy=function(){const e=R(this,fn).getQueryCache().build(R(this,fn),this.options);if(e===R(this,_e))return;const n=R(this,_e);J(this,_e,e),J(this,ac,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},AT=function(e){Lt.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(R(this,Xt))}),R(this,fn).getQueryCache().notify({query:R(this,_e),type:"observerResultsUpdated"})})},WS);function a2(t,e){return Vn(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Uk(t,e){return a2(t,e)||t.state.data!==void 0&&py(t,e,e.refetchOnMount)}function py(t,e,n){if(Vn(e.enabled,t)!==!1&&vi(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&S0(t,e)}return!1}function Wk(t,e,n,r){return(t!==e||Vn(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&S0(t,n)}function S0(t,e){return Vn(e.enabled,t)!==!1&&t.isStaleByTime(vi(e.staleTime,t))}function u2(t,e){return!ny(t.getCurrentResult(),e)}function qk(t){return{onFetch:(e,n)=>{var c,d,f,h,p;const r=e.options,s=(f=(d=(c=e.fetchOptions)==null?void 0:c.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,i=((h=e.state.data)==null?void 0:h.pages)||[],o=((p=e.state.data)==null?void 0:p.pageParams)||[];let l={pages:[],pageParams:[]},a=0;const u=async()=>{let m=!1;const y=k=>{e2(k,()=>e.signal,()=>m=!0)},g=ET(e.options,e.fetchOptions),x=async(k,b,S)=>{if(m)return Promise.reject();if(b==null&&k.pages.length)return Promise.resolve(k);const E=(()=>{const H={client:e.client,queryKey:e.queryKey,pageParam:b,direction:S?"backward":"forward",meta:e.options.meta};return y(H),H})(),T=await g(E),{maxPages:N}=e.options,O=S?XD:YD;return{pages:O(k.pages,T,N),pageParams:O(k.pageParams,b,N)}};if(s&&i.length){const k=s==="backward",b=k?c2:Gk,S={pages:i,pageParams:o},C=b(r,S);l=await x(S,C,k)}else{const k=t??i.length;do{const b=a===0?o[0]??r.initialPageParam:Gk(r,l);if(a>0&&b==null)break;l=await x(l,b),a++}while(a<k)}return l};e.options.persister?e.fetchFn=()=>{var m,y;return(y=(m=e.options).persister)==null?void 0:y.call(m,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function Gk(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function c2(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var cc,_r,Gt,fo,Pr,Ls,qS,d2=(qS=class extends NT{constructor(e){super();de(this,Pr);de(this,cc);de(this,_r);de(this,Gt);de(this,fo);J(this,cc,e.client),this.mutationId=e.mutationId,J(this,Gt,e.mutationCache),J(this,_r,[]),this.state=e.state||f2(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){R(this,_r).includes(e)||(R(this,_r).push(e),this.clearGcTimeout(),R(this,Gt).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){J(this,_r,R(this,_r).filter(n=>n!==e)),this.scheduleGc(),R(this,Gt).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){R(this,_r).length||(this.state.status==="pending"?this.scheduleGc():R(this,Gt).remove(this))}continue(){var e;return((e=R(this,fo))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,l,a,u,c,d,f,h,p,m,y,g,x,k,b,S,C,E;const n=()=>{Ae(this,Pr,Ls).call(this,{type:"continue"})},r={client:R(this,cc),meta:this.options.meta,mutationKey:this.options.mutationKey};J(this,fo,MT({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(T,N)=>{Ae(this,Pr,Ls).call(this,{type:"failed",failureCount:T,error:N})},onPause:()=>{Ae(this,Pr,Ls).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>R(this,Gt).canRun(this)}));const s=this.state.status==="pending",i=!R(this,fo).canStart();try{if(s)n();else{Ae(this,Pr,Ls).call(this,{type:"pending",variables:e,isPaused:i}),R(this,Gt).config.onMutate&&await R(this,Gt).config.onMutate(e,this,r);const N=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,e,r));N!==this.state.context&&Ae(this,Pr,Ls).call(this,{type:"pending",context:N,variables:e,isPaused:i})}const T=await R(this,fo).start();return await((u=(a=R(this,Gt).config).onSuccess)==null?void 0:u.call(a,T,e,this.state.context,this,r)),await((d=(c=this.options).onSuccess)==null?void 0:d.call(c,T,e,this.state.context,r)),await((h=(f=R(this,Gt).config).onSettled)==null?void 0:h.call(f,T,null,this.state.variables,this.state.context,this,r)),await((m=(p=this.options).onSettled)==null?void 0:m.call(p,T,null,e,this.state.context,r)),Ae(this,Pr,Ls).call(this,{type:"success",data:T}),T}catch(T){try{await((g=(y=R(this,Gt).config).onError)==null?void 0:g.call(y,T,e,this.state.context,this,r))}catch(N){Promise.reject(N)}try{await((k=(x=this.options).onError)==null?void 0:k.call(x,T,e,this.state.context,r))}catch(N){Promise.reject(N)}try{await((S=(b=R(this,Gt).config).onSettled)==null?void 0:S.call(b,void 0,T,this.state.variables,this.state.context,this,r))}catch(N){Promise.reject(N)}try{await((E=(C=this.options).onSettled)==null?void 0:E.call(C,void 0,T,e,this.state.context,r))}catch(N){Promise.reject(N)}throw Ae(this,Pr,Ls).call(this,{type:"error",error:T}),T}finally{R(this,Gt).runNext(this)}}},cc=new WeakMap,_r=new WeakMap,Gt=new WeakMap,fo=new WeakMap,Pr=new WeakSet,Ls=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Lt.batch(()=>{R(this,_r).forEach(r=>{r.onMutationUpdate(e)}),R(this,Gt).notify({mutation:this,type:"updated",action:e})})},qS);function f2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var fs,cr,dc,GS,h2=(GS=class extends yc{constructor(e={}){super();de(this,fs);de(this,cr);de(this,dc);this.config=e,J(this,fs,new Set),J(this,cr,new Map),J(this,dc,0)}build(e,n,r){const s=new d2({client:e,mutationCache:this,mutationId:++_c(this,dc)._,options:e.defaultMutationOptions(n),state:r});return this.add(s),s}add(e){R(this,fs).add(e);const n=Qc(e);if(typeof n=="string"){const r=R(this,cr).get(n);r?r.push(e):R(this,cr).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(R(this,fs).delete(e)){const n=Qc(e);if(typeof n=="string"){const r=R(this,cr).get(n);if(r)if(r.length>1){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}else r[0]===e&&R(this,cr).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Qc(e);if(typeof n=="string"){const r=R(this,cr).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var r;const n=Qc(e);if(typeof n=="string"){const s=(r=R(this,cr).get(n))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Lt.batch(()=>{R(this,fs).forEach(e=>{this.notify({type:"removed",mutation:e})}),R(this,fs).clear(),R(this,cr).clear()})}getAll(){return Array.from(R(this,fs))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>zk(n,r))}findAll(e={}){return this.getAll().filter(n=>zk(e,n))}notify(e){Lt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Lt.batch(()=>Promise.all(e.map(n=>n.continue().catch(hn))))}},fs=new WeakMap,cr=new WeakMap,dc=new WeakMap,GS);function Qc(t){var e;return(e=t.options.scope)==null?void 0:e.id}var Ir,KS,p2=(KS=class extends yc{constructor(e={}){super();de(this,Ir);this.config=e,J(this,Ir,new Map)}build(e,n,r){const s=n.queryKey,i=n.queryHash??w0(s,n);let o=this.get(i);return o||(o=new o2({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){R(this,Ir).has(e.queryHash)||(R(this,Ir).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=R(this,Ir).get(e.queryHash);n&&(e.destroy(),n===e&&R(this,Ir).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Lt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return R(this,Ir).get(e)}getAll(){return[...R(this,Ir).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>$k(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>$k(e,r)):n}notify(e){Lt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Lt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Lt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ir=new WeakMap,KS),ct,ei,ti,Bl,Vl,ni,Hl,Ul,JS,m2=(JS=class{constructor(t={}){de(this,ct);de(this,ei);de(this,ti);de(this,Bl);de(this,Vl);de(this,ni);de(this,Hl);de(this,Ul);J(this,ct,t.queryCache||new p2),J(this,ei,t.mutationCache||new h2),J(this,ti,t.defaultOptions||{}),J(this,Bl,new Map),J(this,Vl,new Map),J(this,ni,0)}mount(){_c(this,ni)._++,R(this,ni)===1&&(J(this,Hl,b0.subscribe(async t=>{t&&(await this.resumePausedMutations(),R(this,ct).onFocus())})),J(this,Ul,wf.subscribe(async t=>{t&&(await this.resumePausedMutations(),R(this,ct).onOnline())})))}unmount(){var t,e;_c(this,ni)._--,R(this,ni)===0&&((t=R(this,Hl))==null||t.call(this),J(this,Hl,void 0),(e=R(this,Ul))==null||e.call(this),J(this,Ul,void 0))}isFetching(t){return R(this,ct).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return R(this,ei).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=R(this,ct).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=R(this,ct).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(vi(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return R(this,ct).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),s=R(this,ct).get(r.queryHash),i=s==null?void 0:s.state.data,o=JD(e,i);if(o!==void 0)return R(this,ct).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Lt.batch(()=>R(this,ct).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=R(this,ct).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=R(this,ct);Lt.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=R(this,ct);return Lt.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Lt.batch(()=>R(this,ct).findAll(t).map(s=>s.cancel(n)));return Promise.all(r).then(hn).catch(hn)}invalidateQueries(t,e={}){return Lt.batch(()=>(R(this,ct).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Lt.batch(()=>R(this,ct).findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(hn)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(hn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=R(this,ct).build(this,e);return n.isStaleByTime(vi(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(hn).catch(hn)}fetchInfiniteQuery(t){return t.behavior=qk(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(hn).catch(hn)}ensureInfiniteQueryData(t){return t.behavior=qk(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return wf.isOnline()?R(this,ei).resumePausedMutations():Promise.resolve()}getQueryCache(){return R(this,ct)}getMutationCache(){return R(this,ei)}getDefaultOptions(){return R(this,ti)}setDefaultOptions(t){J(this,ti,t)}setQueryDefaults(t,e){R(this,Bl).set(Hu(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...R(this,Bl).values()],n={};return e.forEach(r=>{Uu(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){R(this,Vl).set(Hu(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...R(this,Vl).values()],n={};return e.forEach(r=>{Uu(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...R(this,ti).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=w0(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===k0&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...R(this,ti).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){R(this,ct).clear(),R(this,ei).clear()}},ct=new WeakMap,ei=new WeakMap,ti=new WeakMap,Bl=new WeakMap,Vl=new WeakMap,ni=new WeakMap,Hl=new WeakMap,Ul=new WeakMap,JS),_T=v.createContext(void 0),Kh=t=>{const e=v.useContext(_T);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},g2=({client:t,children:e})=>(v.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),w.jsx(_T.Provider,{value:t,children:e})),PT=v.createContext(!1),y2=()=>v.useContext(PT);PT.Provider;function v2(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var x2=v.createContext(v2()),w2=()=>v.useContext(x2),k2=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?TT(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},b2=t=>{v.useEffect(()=>{t.clearReset()},[t])},S2=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(s&&t.data===void 0||TT(n,[t.error,r])),C2=t=>{if(t.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},E2=(t,e)=>t.isLoading&&t.isFetching&&!e,T2=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Kk=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function R2(t,e,n){var f,h,p,m;const r=y2(),s=w2(),i=Kh(),o=i.defaultQueryOptions(t);(h=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||h.call(f,o);const l=i.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",C2(o),k2(o,s,l),b2(s);const a=!i.getQueryCache().get(o.queryHash),[u]=v.useState(()=>new e(i,o)),c=u.getOptimisticResult(o),d=!r&&t.subscribed!==!1;if(v.useSyncExternalStore(v.useCallback(y=>{const g=d?u.subscribe(Lt.batchCalls(y)):hn;return u.updateResult(),g},[u,d]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),v.useEffect(()=>{u.setOptions(o)},[o,u]),T2(o,c))throw Kk(o,u,s);if(S2({result:c,errorResetBoundary:s,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw c.error;if((m=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||m.call(p,o,c),o.experimental_prefetchInRender&&!To&&E2(c,r)){const y=a?Kk(o,u,s):l==null?void 0:l.promise;y==null||y.catch(hn).finally(()=>{u.updateResult()})}return o.notifyOnChangeProps?c:u.trackResult(c)}function C0(t,e){return R2(t,l2)}const IT=[{type:"markdown",extension:".md"},{type:"json",extension:".json"},{type:"app",extension:".app.json"}],M2=IT.reduce((t,e)=>(t[e.type]=e,t),{}),DT=[...IT].sort((t,e)=>e.extension.length-t.extension.length),N2=t=>M2[t].extension,O2=(t,e)=>{const n=t.trim();if(!n)return"";const r=N2(e),s=n.toLowerCase();for(const i of DT)if(s.endsWith(i.extension.toLowerCase()))return n.slice(0,n.length-i.extension.length)+r;return`${n}${r}`},A2=t=>{const e=t.toLowerCase();for(const n of DT)if(e.endsWith(n.extension.toLowerCase()))return t.slice(0,t.length-n.extension.length);return t};function LT(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=LT(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function jT(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=LT(t))&&(r&&(r+=" "),r+=e);return r}const Jk=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Qk=jT,_2=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return Qk(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=e,o=Object.keys(s).map(u=>{const c=n==null?void 0:n[u],d=i==null?void 0:i[u];if(c===null)return null;const f=Jk(c)||Jk(d);return s[u][f]}),l=n&&Object.entries(n).reduce((u,c)=>{let[d,f]=c;return f===void 0||(u[d]=f),u},{}),a=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,c)=>{let{class:d,className:f,...h}=c;return Object.entries(h).every(p=>{let[m,y]=p;return Array.isArray(y)?y.includes({...i,...l}[m]):{...i,...l}[m]===y})?[...u,d,f]:u},[]);return Qk(t,o,a,n==null?void 0:n.class,n==null?void 0:n.className)},P2=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},I2=(t,e)=>({classGroupId:t,validator:e}),$T=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),kf="-",Zk=[],D2="arbitrary..",L2=t=>{const e=$2(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return j2(o);const l=o.split(kf),a=l[0]===""&&l.length>1?1:0;return zT(l,a,e)},getConflictingClassGroupIds:(o,l)=>{if(l){const a=r[o],u=n[o];return a?u?P2(u,a):a:u||Zk}return n[o]||Zk}}},zT=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const u=zT(t,e+1,i);if(u)return u}const o=n.validators;if(o===null)return;const l=e===0?t.join(kf):t.slice(e).join(kf),a=o.length;for(let u=0;u<a;u++){const c=o[u];if(c.validator(l))return c.classGroupId}},j2=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?D2+r:void 0})(),$2=t=>{const{theme:e,classGroups:n}=t;return z2(n,e)},z2=(t,e)=>{const n=$T();for(const r in t){const s=t[r];E0(s,n,r,e)}return n},E0=(t,e,n,r)=>{const s=t.length;for(let i=0;i<s;i++){const o=t[i];F2(o,e,n,r)}},F2=(t,e,n,r)=>{if(typeof t=="string"){B2(t,e,n);return}if(typeof t=="function"){V2(t,e,n,r);return}H2(t,e,n,r)},B2=(t,e,n)=>{const r=t===""?e:FT(e,t);r.classGroupId=n},V2=(t,e,n,r)=>{if(U2(t)){E0(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(I2(n,t))},H2=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let o=0;o<i;o++){const[l,a]=s[o];E0(a,FT(e,l),n,r)}},FT=(t,e)=>{let n=t;const r=e.split(kf),s=r.length;for(let i=0;i<s;i++){const o=r[i];let l=n.nextPart.get(o);l||(l=$T(),n.nextPart.set(o,l)),n=l}return n},U2=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,W2=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,o)=>{n[i]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let o=n[i];if(o!==void 0)return o;if((o=r[i])!==void 0)return s(i,o),o},set(i,o){i in n?n[i]=o:s(i,o)}}},my="!",Yk=":",q2=[],Xk=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),G2=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let o=0,l=0,a=0,u;const c=s.length;for(let m=0;m<c;m++){const y=s[m];if(o===0&&l===0){if(y===Yk){i.push(s.slice(a,m)),a=m+1;continue}if(y==="/"){u=m;continue}}y==="["?o++:y==="]"?o--:y==="("?l++:y===")"&&l--}const d=i.length===0?s:s.slice(a);let f=d,h=!1;d.endsWith(my)?(f=d.slice(0,-1),h=!0):d.startsWith(my)&&(f=d.slice(1),h=!0);const p=u&&u>a?u-a:void 0;return Xk(i,h,f,p)};if(e){const s=e+Yk,i=r;r=o=>o.startsWith(s)?i(o.slice(s.length)):Xk(q2,!1,o,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},K2=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i<n.length;i++){const o=n[i],l=o[0]==="[",a=e.has(o);l||a?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(o)):s.push(o)}return s.length>0&&(s.sort(),r.push(...s)),r}},J2=t=>({cache:W2(t.cacheSize),parseClassName:G2(t),sortModifiers:K2(t),...L2(t)}),Q2=/\s+/,Z2=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,o=[],l=t.trim().split(Q2);let a="";for(let u=l.length-1;u>=0;u-=1){const c=l[u],{isExternal:d,modifiers:f,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}=n(c);if(d){a=c+(a.length>0?" "+a:a);continue}let y=!!m,g=r(y?p.substring(0,m):p);if(!g){if(!y){a=c+(a.length>0?" "+a:a);continue}if(g=r(p),!g){a=c+(a.length>0?" "+a:a);continue}y=!1}const x=f.length===0?"":f.length===1?f[0]:i(f).join(":"),k=h?x+my:x,b=k+g;if(o.indexOf(b)>-1)continue;o.push(b);const S=s(g,y);for(let C=0;C<S.length;++C){const E=S[C];o.push(k+E)}a=c+(a.length>0?" "+a:a)}return a},Y2=(...t)=>{let e=0,n,r,s="";for(;e<t.length;)(n=t[e++])&&(r=BT(n))&&(s&&(s+=" "),s+=r);return s},BT=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=BT(t[r]))&&(n&&(n+=" "),n+=e);return n},X2=(t,...e)=>{let n,r,s,i;const o=a=>{const u=e.reduce((c,d)=>d(c),t());return n=J2(u),r=n.cache.get,s=n.cache.set,i=l,l(a)},l=a=>{const u=r(a);if(u)return u;const c=Z2(a,n);return s(a,c),c};return i=o,(...a)=>i(Y2(...a))},eL=[],kt=t=>{const e=n=>n[t]||eL;return e.isThemeGetter=!0,e},VT=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,HT=/^\((?:(\w[\w-]*):)?(.+)\)$/i,tL=/^\d+\/\d+$/,nL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rL=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,sL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,iL=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,oL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qo=t=>tL.test(t),Ne=t=>!!t&&!Number.isNaN(Number(t)),Is=t=>!!t&&Number.isInteger(Number(t)),cm=t=>t.endsWith("%")&&Ne(t.slice(0,-1)),Zr=t=>nL.test(t),lL=()=>!0,aL=t=>rL.test(t)&&!sL.test(t),UT=()=>!1,uL=t=>iL.test(t),cL=t=>oL.test(t),dL=t=>!X(t)&&!ee(t),fL=t=>xa(t,GT,UT),X=t=>VT.test(t),Wi=t=>xa(t,KT,aL),dm=t=>xa(t,yL,Ne),eb=t=>xa(t,WT,UT),hL=t=>xa(t,qT,cL),Zc=t=>xa(t,JT,uL),ee=t=>HT.test(t),Ia=t=>wa(t,KT),pL=t=>wa(t,vL),tb=t=>wa(t,WT),mL=t=>wa(t,GT),gL=t=>wa(t,qT),Yc=t=>wa(t,JT,!0),xa=(t,e,n)=>{const r=VT.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},wa=(t,e,n=!1)=>{const r=HT.exec(t);return r?r[1]?e(r[1]):n:!1},WT=t=>t==="position"||t==="percentage",qT=t=>t==="image"||t==="url",GT=t=>t==="length"||t==="size"||t==="bg-size",KT=t=>t==="length",yL=t=>t==="number",vL=t=>t==="family-name",JT=t=>t==="shadow",xL=()=>{const t=kt("color"),e=kt("font"),n=kt("text"),r=kt("font-weight"),s=kt("tracking"),i=kt("leading"),o=kt("breakpoint"),l=kt("container"),a=kt("spacing"),u=kt("radius"),c=kt("shadow"),d=kt("inset-shadow"),f=kt("text-shadow"),h=kt("drop-shadow"),p=kt("blur"),m=kt("perspective"),y=kt("aspect"),g=kt("ease"),x=kt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...b(),ee,X],C=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],T=()=>[ee,X,a],N=()=>[Qo,"full","auto",...T()],O=()=>[Is,"none","subgrid",ee,X],H=()=>["auto",{span:["full",Is,ee,X]},Is,ee,X],ne=()=>[Is,"auto",ee,X],ae=()=>["auto","min","max","fr",ee,X],Q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],le=()=>["start","end","center","stretch","center-safe","end-safe"],se=()=>["auto",...T()],ye=()=>[Qo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],M=()=>[t,ee,X],V=()=>[...b(),tb,eb,{position:[ee,X]}],ie=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ee=()=>["auto","cover","contain",mL,fL,{size:[ee,X]}],P=()=>[cm,Ia,Wi],q=()=>["","none","full",u,ee,X],G=()=>["",Ne,Ia,Wi],K=()=>["solid","dashed","dotted","double"],j=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>[Ne,cm,tb,eb],xe=()=>["","none",p,ee,X],Y=()=>["none",Ne,ee,X],Se=()=>["none",Ne,ee,X],we=()=>[Ne,ee,X],Ie=()=>[Qo,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Zr],breakpoint:[Zr],color:[lL],container:[Zr],"drop-shadow":[Zr],ease:["in","out","in-out"],font:[dL],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Zr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Zr],shadow:[Zr],spacing:["px",Ne],text:[Zr],"text-shadow":[Zr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Qo,X,ee,y]}],container:["container"],columns:[{columns:[Ne,X,ee,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[Is,"auto",ee,X]}],basis:[{basis:[Qo,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,Qo,"auto","initial","none",X]}],grow:[{grow:["",Ne,ee,X]}],shrink:[{shrink:["",Ne,ee,X]}],order:[{order:[Is,"first","last","none",ee,X]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...Q(),"normal"]}],"justify-items":[{"justify-items":[...le(),"normal"]}],"justify-self":[{"justify-self":["auto",...le()]}],"align-content":[{content:["normal",...Q()]}],"align-items":[{items:[...le(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...le(),{baseline:["","last"]}]}],"place-content":[{"place-content":Q()}],"place-items":[{"place-items":[...le(),"baseline"]}],"place-self":[{"place-self":["auto",...le()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:se()}],mx:[{mx:se()}],my:[{my:se()}],ms:[{ms:se()}],me:[{me:se()}],mt:[{mt:se()}],mr:[{mr:se()}],mb:[{mb:se()}],ml:[{ml:se()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:ye()}],w:[{w:[l,"screen",...ye()]}],"min-w":[{"min-w":[l,"screen","none",...ye()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...ye()]}],h:[{h:["screen","lh",...ye()]}],"min-h":[{"min-h":["screen","lh","none",...ye()]}],"max-h":[{"max-h":["screen","lh",...ye()]}],"font-size":[{text:["base",n,Ia,Wi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ee,dm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",cm,X]}],"font-family":[{font:[pL,X,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,ee,X]}],"line-clamp":[{"line-clamp":[Ne,"none",ee,dm]}],leading:[{leading:[i,...T()]}],"list-image":[{"list-image":["none",ee,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ee,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",ee,Wi]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Ne,"auto",ee,X]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ee,X]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ee,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:V()}],"bg-repeat":[{bg:ie()}],"bg-size":[{bg:Ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Is,ee,X],radial:["",ee,X],conic:[Is,ee,X]},gL,hL]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:q()}],"rounded-s":[{"rounded-s":q()}],"rounded-e":[{"rounded-e":q()}],"rounded-t":[{"rounded-t":q()}],"rounded-r":[{"rounded-r":q()}],"rounded-b":[{"rounded-b":q()}],"rounded-l":[{"rounded-l":q()}],"rounded-ss":[{"rounded-ss":q()}],"rounded-se":[{"rounded-se":q()}],"rounded-ee":[{"rounded-ee":q()}],"rounded-es":[{"rounded-es":q()}],"rounded-tl":[{"rounded-tl":q()}],"rounded-tr":[{"rounded-tr":q()}],"rounded-br":[{"rounded-br":q()}],"rounded-bl":[{"rounded-bl":q()}],"border-w":[{border:G()}],"border-w-x":[{"border-x":G()}],"border-w-y":[{"border-y":G()}],"border-w-s":[{"border-s":G()}],"border-w-e":[{"border-e":G()}],"border-w-t":[{"border-t":G()}],"border-w-r":[{"border-r":G()}],"border-w-b":[{"border-b":G()}],"border-w-l":[{"border-l":G()}],"divide-x":[{"divide-x":G()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":G()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...K(),"hidden","none"]}],"divide-style":[{divide:[...K(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...K(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,ee,X]}],"outline-w":[{outline:["",Ne,Ia,Wi]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",c,Yc,Zc]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",d,Yc,Zc]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Ne,Wi]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":G()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",f,Yc,Zc]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Ne,ee,X]}],"mix-blend":[{"mix-blend":[...j(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":j()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":F()}],"mask-image-linear-to-pos":[{"mask-linear-to":F()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":F()}],"mask-image-t-to-pos":[{"mask-t-to":F()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":F()}],"mask-image-r-to-pos":[{"mask-r-to":F()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":F()}],"mask-image-b-to-pos":[{"mask-b-to":F()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":F()}],"mask-image-l-to-pos":[{"mask-l-to":F()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":F()}],"mask-image-x-to-pos":[{"mask-x-to":F()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":F()}],"mask-image-y-to-pos":[{"mask-y-to":F()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[ee,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":F()}],"mask-image-radial-to-pos":[{"mask-radial-to":F()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":F()}],"mask-image-conic-to-pos":[{"mask-conic-to":F()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:V()}],"mask-repeat":[{mask:ie()}],"mask-size":[{mask:Ee()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ee,X]}],filter:[{filter:["","none",ee,X]}],blur:[{blur:xe()}],brightness:[{brightness:[Ne,ee,X]}],contrast:[{contrast:[Ne,ee,X]}],"drop-shadow":[{"drop-shadow":["","none",h,Yc,Zc]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Ne,ee,X]}],"hue-rotate":[{"hue-rotate":[Ne,ee,X]}],invert:[{invert:["",Ne,ee,X]}],saturate:[{saturate:[Ne,ee,X]}],sepia:[{sepia:["",Ne,ee,X]}],"backdrop-filter":[{"backdrop-filter":["","none",ee,X]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,ee,X]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,ee,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,ee,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,ee,X]}],"backdrop-invert":[{"backdrop-invert":["",Ne,ee,X]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,ee,X]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,ee,X]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,ee,X]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ee,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",ee,X]}],ease:[{ease:["linear","initial",g,ee,X]}],delay:[{delay:[Ne,ee,X]}],animate:[{animate:["none",x,ee,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ee,X]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:Y()}],"rotate-x":[{"rotate-x":Y()}],"rotate-y":[{"rotate-y":Y()}],"rotate-z":[{"rotate-z":Y()}],scale:[{scale:Se()}],"scale-x":[{"scale-x":Se()}],"scale-y":[{"scale-y":Se()}],"scale-z":[{"scale-z":Se()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[ee,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ie()}],"translate-x":[{"translate-x":Ie()}],"translate-y":[{"translate-y":Ie()}],"translate-z":[{"translate-z":Ie()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ee,X]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ee,X]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Ne,Ia,Wi,dm]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},wL=X2(xL);function Mt(...t){return wL(jT(t))}const kL=_2("inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-colors focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"border border-primary bg-primary text-primary-foreground hover:bg-primary/90",secondary:"border border-secondary bg-secondary text-secondary-foreground hover:bg-secondary/85",outline:"border border-primary bg-background text-primary hover:bg-accent hover:text-accent-foreground",ghost:"bg-transparent text-foreground hover:text-foreground"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-xs",xs:"h-6 px-2 text-xs",icon:"h-8 w-8"}},defaultVariants:{variant:"default",size:"default"}}),ze=v.forwardRef(({className:t,variant:e,size:n,...r},s)=>w.jsx("button",{className:Mt(kL({variant:e,size:n,className:t})),ref:s,...r}));ze.displayName="Button";function bL({bundleUrl:t,mountId:e,bundleType:n="classic",docName:r}){const s=v.useRef(null),[i,o]=v.useState("idle"),[l,a]=v.useState("");return v.useEffect(()=>{if(!t||!e)return;const u=s.current;if(!u)return;u.innerHTML="";const c=document.createElement("div");c.id=e,c.setAttribute("data-hyperdoc-app-mount",r??""),u.appendChild(c);const d=document.createElement("script");d.async=!0,d.src=t,d.setAttribute("data-hyperdoc-app-script",r??""),n==="module"&&(d.type="module");const f=()=>{o("ready"),a("")},h=()=>{o("error"),a(`Failed to load bundle: ${t}`)};return d.addEventListener("load",f),d.addEventListener("error",h),o("loading"),a(""),u.appendChild(d),()=>{d.removeEventListener("load",f),d.removeEventListener("error",h),d.remove(),c.remove()}},[n,t,r,e]),w.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-2",children:[i==="loading"?w.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading bundle..."}):null,i==="error"?w.jsx("div",{className:"text-xs text-destructive",children:l}):null,w.jsx("div",{ref:s,className:"min-h-0 flex-1 rounded-md border border-border bg-background"})]})}function SL(t){const{appView:e,appConfig:n,appConfigError:r,content:s,onViewChange:i,onContentChange:o,docName:l}=t;return w.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[w.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[w.jsx(ze,{type:"button",size:"sm",variant:e==="app"?"default":"outline",onClick:()=>i("app"),children:"App"}),w.jsx(ze,{type:"button",size:"sm",variant:e==="json"?"default":"outline",onClick:()=>i("json"),children:"Config (JSON)"}),w.jsxs("span",{className:"ml-auto flex flex-wrap items-center gap-2 font-mono text-[11px] text-muted-foreground",children:[w.jsxs("span",{children:["Bundle: ",n!=null&&n.bundleUrl?n.bundleUrl:"—"]}),w.jsxs("span",{children:["Mount: ",(n==null?void 0:n.mountId)??"—"]})]})]}),e==="app"?n&&!r?w.jsx(bL,{bundleUrl:n.bundleUrl,mountId:n.mountId,bundleType:n.bundleType,docName:l}):w.jsx("div",{className:"rounded-md border border-dashed border-border bg-card p-4 text-sm text-muted-foreground",children:r||"Add a bundleUrl and mountId to render."}):w.jsx("textarea",{className:"min-h-0 w-full flex-1 border border-input bg-background px-3 py-2 font-mono text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:s,onChange:a=>o(a.target.value),placeholder:"Paste your app config JSON"}),r?w.jsx("div",{className:"text-sm text-destructive",children:r}):null]})}/**
68
- * @license lucide-react v0.563.0 - ISC
69
- *
70
- * This source code is licensed under the ISC license.
71
- * See the LICENSE file in the root directory of this source tree.
72
- */const QT=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/**
73
- * @license lucide-react v0.563.0 - ISC
74
- *
75
- * This source code is licensed under the ISC license.
76
- * See the LICENSE file in the root directory of this source tree.
77
- */const CL=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
78
- * @license lucide-react v0.563.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- */const EL=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
83
- * @license lucide-react v0.563.0 - ISC
84
- *
85
- * This source code is licensed under the ISC license.
86
- * See the LICENSE file in the root directory of this source tree.
87
- */const nb=t=>{const e=EL(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
88
- * @license lucide-react v0.563.0 - ISC
89
- *
90
- * This source code is licensed under the ISC license.
91
- * See the LICENSE file in the root directory of this source tree.
92
- */var TL={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
93
- * @license lucide-react v0.563.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */const RL=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/**
98
- * @license lucide-react v0.563.0 - ISC
99
- *
100
- * This source code is licensed under the ISC license.
101
- * See the LICENSE file in the root directory of this source tree.
102
- */const ML=v.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},a)=>v.createElement("svg",{ref:a,...TL,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:QT("lucide",s),...!i&&!RL(l)&&{"aria-hidden":"true"},...l},[...o.map(([u,c])=>v.createElement(u,c)),...Array.isArray(i)?i:[i]]));/**
103
- * @license lucide-react v0.563.0 - ISC
104
- *
105
- * This source code is licensed under the ISC license.
106
- * See the LICENSE file in the root directory of this source tree.
107
- */const Fe=(t,e)=>{const n=v.forwardRef(({className:r,...s},i)=>v.createElement(ML,{ref:i,iconNode:e,className:QT(`lucide-${CL(nb(t))}`,`lucide-${t}`,r),...s}));return n.displayName=nb(t),n};/**
108
- * @license lucide-react v0.563.0 - ISC
109
- *
110
- * This source code is licensed under the ISC license.
111
- * See the LICENSE file in the root directory of this source tree.
112
- */const NL=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],OL=Fe("archive",NL);/**
113
- * @license lucide-react v0.563.0 - ISC
114
- *
115
- * This source code is licensed under the ISC license.
116
- * See the LICENSE file in the root directory of this source tree.
117
- */const AL=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]],gy=Fe("arrow-down-wide-narrow",AL);/**
118
- * @license lucide-react v0.563.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- */const _L=[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]],bf=Fe("arrow-up-narrow-wide",_L);/**
123
- * @license lucide-react v0.563.0 - ISC
124
- *
125
- * This source code is licensed under the ISC license.
126
- * See the LICENSE file in the root directory of this source tree.
127
- */const PL=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],IL=Fe("bold",PL);/**
128
- * @license lucide-react v0.563.0 - ISC
129
- *
130
- * This source code is licensed under the ISC license.
131
- * See the LICENSE file in the root directory of this source tree.
132
- */const DL=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],LL=Fe("check",DL);/**
133
- * @license lucide-react v0.563.0 - ISC
134
- *
135
- * This source code is licensed under the ISC license.
136
- * See the LICENSE file in the root directory of this source tree.
137
- */const jL=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],jd=Fe("chevron-down",jL);/**
138
- * @license lucide-react v0.563.0 - ISC
139
- *
140
- * This source code is licensed under the ISC license.
141
- * See the LICENSE file in the root directory of this source tree.
142
- */const $L=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],rb=Fe("chevron-right",$L);/**
143
- * @license lucide-react v0.563.0 - ISC
144
- *
145
- * This source code is licensed under the ISC license.
146
- * See the LICENSE file in the root directory of this source tree.
147
- */const zL=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],FL=Fe("chevron-up",zL);/**
148
- * @license lucide-react v0.563.0 - ISC
149
- *
150
- * This source code is licensed under the ISC license.
151
- * See the LICENSE file in the root directory of this source tree.
152
- */const BL=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],VL=Fe("circle-alert",BL);/**
153
- * @license lucide-react v0.563.0 - ISC
154
- *
155
- * This source code is licensed under the ISC license.
156
- * See the LICENSE file in the root directory of this source tree.
157
- */const HL=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],UL=Fe("code-xml",HL);/**
158
- * @license lucide-react v0.563.0 - ISC
159
- *
160
- * This source code is licensed under the ISC license.
161
- * See the LICENSE file in the root directory of this source tree.
162
- */const WL=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],qL=Fe("ellipsis-vertical",WL);/**
163
- * @license lucide-react v0.563.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */const GL=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],KL=Fe("file-text",GL);/**
168
- * @license lucide-react v0.563.0 - ISC
169
- *
170
- * This source code is licensed under the ISC license.
171
- * See the LICENSE file in the root directory of this source tree.
172
- */const JL=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],QL=Fe("funnel",JL);/**
173
- * @license lucide-react v0.563.0 - ISC
174
- *
175
- * This source code is licensed under the ISC license.
176
- * See the LICENSE file in the root directory of this source tree.
177
- */const ZL=[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]],YL=Fe("group",ZL);/**
178
- * @license lucide-react v0.563.0 - ISC
179
- *
180
- * This source code is licensed under the ISC license.
181
- * See the LICENSE file in the root directory of this source tree.
182
- */const XL=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],ej=Fe("hash",XL);/**
183
- * @license lucide-react v0.563.0 - ISC
184
- *
185
- * This source code is licensed under the ISC license.
186
- * See the LICENSE file in the root directory of this source tree.
187
- */const tj=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],nj=Fe("heading-2",tj);/**
188
- * @license lucide-react v0.563.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */const rj=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],sj=Fe("heading-3",rj);/**
193
- * @license lucide-react v0.563.0 - ISC
194
- *
195
- * This source code is licensed under the ISC license.
196
- * See the LICENSE file in the root directory of this source tree.
197
- */const ij=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ZT=Fe("info",ij);/**
198
- * @license lucide-react v0.563.0 - ISC
199
- *
200
- * This source code is licensed under the ISC license.
201
- * See the LICENSE file in the root directory of this source tree.
202
- */const oj=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],lj=Fe("italic",oj);/**
203
- * @license lucide-react v0.563.0 - ISC
204
- *
205
- * This source code is licensed under the ISC license.
206
- * See the LICENSE file in the root directory of this source tree.
207
- */const aj=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],uj=Fe("link-2",aj);/**
208
- * @license lucide-react v0.563.0 - ISC
209
- *
210
- * This source code is licensed under the ISC license.
211
- * See the LICENSE file in the root directory of this source tree.
212
- */const cj=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],dj=Fe("list-ordered",cj);/**
213
- * @license lucide-react v0.563.0 - ISC
214
- *
215
- * This source code is licensed under the ISC license.
216
- * See the LICENSE file in the root directory of this source tree.
217
- */const fj=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],hj=Fe("list",fj);/**
218
- * @license lucide-react v0.563.0 - ISC
219
- *
220
- * This source code is licensed under the ISC license.
221
- * See the LICENSE file in the root directory of this source tree.
222
- */const pj=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],mj=Fe("loader-circle",pj);/**
223
- * @license lucide-react v0.563.0 - ISC
224
- *
225
- * This source code is licensed under the ISC license.
226
- * See the LICENSE file in the root directory of this source tree.
227
- */const gj=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],YT=Fe("pin",gj);/**
228
- * @license lucide-react v0.563.0 - ISC
229
- *
230
- * This source code is licensed under the ISC license.
231
- * See the LICENSE file in the root directory of this source tree.
232
- */const yj=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ga=Fe("plus",yj);/**
233
- * @license lucide-react v0.563.0 - ISC
234
- *
235
- * This source code is licensed under the ISC license.
236
- * See the LICENSE file in the root directory of this source tree.
237
- */const vj=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],xj=Fe("quote",vj);/**
238
- * @license lucide-react v0.563.0 - ISC
239
- *
240
- * This source code is licensed under the ISC license.
241
- * See the LICENSE file in the root directory of this source tree.
242
- */const wj=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],XT=Fe("search",wj);/**
243
- * @license lucide-react v0.563.0 - ISC
244
- *
245
- * This source code is licensed under the ISC license.
246
- * See the LICENSE file in the root directory of this source tree.
247
- */const kj=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],bj=Fe("strikethrough",kj);/**
248
- * @license lucide-react v0.563.0 - ISC
249
- *
250
- * This source code is licensed under the ISC license.
251
- * See the LICENSE file in the root directory of this source tree.
252
- */const Sj=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Cj=Fe("trash-2",Sj);/**
253
- * @license lucide-react v0.563.0 - ISC
254
- *
255
- * This source code is licensed under the ISC license.
256
- * See the LICENSE file in the root directory of this source tree.
257
- */const Ej=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],Tj=Fe("unlink",Ej);/**
258
- * @license lucide-react v0.563.0 - ISC
259
- *
260
- * This source code is licensed under the ISC license.
261
- * See the LICENSE file in the root directory of this source tree.
262
- */const Rj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],eR=Fe("x",Rj),Mj="/api",Nj=async()=>{const t=await fetch(`${Mj}/docs`);if(!t.ok)throw new Error(t.statusText);return await t.json()},tR=()=>{const t=Kh(),e=C0({queryKey:["docs"],queryFn:Nj,refetchInterval:5e3,refetchOnWindowFocus:!1}),n=v.useMemo(()=>e.data??[],[e.data]),r=v.useCallback(o=>{t.setQueryData(["docs"],l=>o(l??[]))},[t]),s=v.useCallback(()=>{t.invalidateQueries({queryKey:["docs"]}).catch(()=>{})},[t]),i=v.useMemo(()=>e.error?String(e.error):"",[e.error]);return{docs:n,docsQuery:e,updateDocsCache:r,invalidateDocs:s,errorMessage:i}},nR=v.createContext(null),Oj=nR.Provider,Aj=()=>{const t=v.useContext(nR);if(!t)throw new Error("useCommandPaletteContext must be used within CommandPaletteProvider.");return t};var sb=1,_j=.9,Pj=.8,Ij=.17,fm=.1,hm=.999,Dj=.9999,Lj=.99,jj=/[\\\/_+.#"@\[\(\{&]/,$j=/[\\\/_+.#"@\[\(\{&]/g,zj=/[\s-]/,rR=/[\s-]/g;function yy(t,e,n,r,s,i,o){if(i===e.length)return s===t.length?sb:Lj;var l=`${s},${i}`;if(o[l]!==void 0)return o[l];for(var a=r.charAt(i),u=n.indexOf(a,s),c=0,d,f,h,p;u>=0;)d=yy(t,e,n,r,u+1,i+1,o),d>c&&(u===s?d*=sb:jj.test(t.charAt(u-1))?(d*=Pj,h=t.slice(s,u-1).match($j),h&&s>0&&(d*=Math.pow(hm,h.length))):zj.test(t.charAt(u-1))?(d*=_j,p=t.slice(s,u-1).match(rR),p&&s>0&&(d*=Math.pow(hm,p.length))):(d*=Ij,s>0&&(d*=Math.pow(hm,u-s))),t.charAt(u)!==e.charAt(i)&&(d*=Dj)),(d<fm&&n.charAt(u-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(u-1)!==r.charAt(i))&&(f=yy(t,e,n,r,u+1,i+2,o),f*fm>d&&(d=f*fm)),d>c&&(c=d),u=n.indexOf(a,u+1);return o[l]=c,c}function ib(t){return t.toLowerCase().replace(rR," ")}function Fj(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,yy(t,e,ib(t),ib(e),0,0,{})}function xi(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t==null||t(s),n===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function ob(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ri(...t){return e=>{let n=!1;const r=t.map(s=>{const i=ob(s,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():ob(t[s],null)}}}}function zo(...t){return v.useCallback(Ri(...t),t)}function Bj(t,e){const n=v.createContext(e),r=i=>{const{children:o,...l}=i,a=v.useMemo(()=>l,Object.values(l));return w.jsx(n.Provider,{value:a,children:o})};r.displayName=t+"Provider";function s(i){const o=v.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[r,s]}function Vj(t,e=[]){let n=[];function r(i,o){const l=v.createContext(o),a=n.length;n=[...n,o];const u=d=>{var g;const{scope:f,children:h,...p}=d,m=((g=f==null?void 0:f[t])==null?void 0:g[a])||l,y=v.useMemo(()=>p,Object.values(p));return w.jsx(m.Provider,{value:y,children:h})};u.displayName=i+"Provider";function c(d,f){var m;const h=((m=f==null?void 0:f[t])==null?void 0:m[a])||l,p=v.useContext(h);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[u,c]}const s=()=>{const i=n.map(o=>v.createContext(o));return function(l){const a=(l==null?void 0:l[t])||i;return v.useMemo(()=>({[`__scope${t}`]:{...l,[t]:a}}),[l,a])}};return s.scopeName=t,[r,Hj(s,...e)]}function Hj(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:a,scopeName:u})=>{const d=a(i)[`__scope${u}`];return{...l,...d}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var Wu=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},Uj=Nh[" useId ".trim().toString()]||(()=>{}),Wj=0;function xs(t){const[e,n]=v.useState(Uj());return Wu(()=>{n(r=>r??String(Wj++))},[t]),e?`radix-${e}`:""}var qj=Nh[" useInsertionEffect ".trim().toString()]||Wu;function Gj({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[s,i,o]=Kj({defaultProp:e,onChange:n}),l=t!==void 0,a=l?t:s;{const c=v.useRef(t!==void 0);v.useEffect(()=>{const d=c.current;d!==l&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),c.current=l},[l,r])}const u=v.useCallback(c=>{var d;if(l){const f=Jj(c)?c(t):c;f!==t&&((d=o.current)==null||d.call(o,f))}else i(c)},[l,t,i,o]);return[a,u]}function Kj({defaultProp:t,onChange:e}){const[n,r]=v.useState(t),s=v.useRef(n),i=v.useRef(e);return qj(()=>{i.current=e},[e]),v.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function Jj(t){return typeof t=="function"}function sR(t){const e=Qj(t),n=v.forwardRef((r,s)=>{const{children:i,...o}=r,l=v.Children.toArray(i),a=l.find(Yj);if(a){const u=a.props.children,c=l.map(d=>d===a?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:d);return w.jsx(e,{...o,ref:s,children:v.isValidElement(u)?v.cloneElement(u,void 0,c):null})}return w.jsx(e,{...o,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function Qj(t){const e=v.forwardRef((n,r)=>{const{children:s,...i}=n;if(v.isValidElement(s)){const o=e$(s),l=Xj(i,s.props);return s.type!==v.Fragment&&(l.ref=r?Ri(r,o):o),v.cloneElement(s,l)}return v.Children.count(s)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Zj=Symbol("radix.slottable");function Yj(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Zj}function Xj(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const a=i(...l);return s(...l),a}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function e$(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var t$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ns=t$.reduce((t,e)=>{const n=sR(`Primitive.${e}`),r=v.forwardRef((s,i)=>{const{asChild:o,...l}=s,a=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function n$(t,e){t&&$o.flushSync(()=>t.dispatchEvent(e))}function qu(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function r$(t,e=globalThis==null?void 0:globalThis.document){const n=qu(t);v.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var s$="DismissableLayer",vy="dismissableLayer.update",i$="dismissableLayer.pointerDownOutside",o$="dismissableLayer.focusOutside",lb,iR=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),oR=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...a}=t,u=v.useContext(iR),[c,d]=v.useState(null),f=(c==null?void 0:c.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=v.useState({}),p=zo(e,E=>d(E)),m=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(y),x=c?m.indexOf(c):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,b=x>=g,S=u$(E=>{const T=E.target,N=[...u.branches].some(O=>O.contains(T));!b||N||(s==null||s(E),o==null||o(E),E.defaultPrevented||l==null||l())},f),C=c$(E=>{const T=E.target;[...u.branches].some(O=>O.contains(T))||(i==null||i(E),o==null||o(E),E.defaultPrevented||l==null||l())},f);return r$(E=>{x===u.layers.size-1&&(r==null||r(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},f),v.useEffect(()=>{if(c)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(lb=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(c)),u.layers.add(c),ab(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=lb)}},[c,f,n,u]),v.useEffect(()=>()=>{c&&(u.layers.delete(c),u.layersWithOutsidePointerEventsDisabled.delete(c),ab())},[c,u]),v.useEffect(()=>{const E=()=>h({});return document.addEventListener(vy,E),()=>document.removeEventListener(vy,E)},[]),w.jsx(Ns.div,{...a,ref:p,style:{pointerEvents:k?b?"auto":"none":void 0,...t.style},onFocusCapture:xi(t.onFocusCapture,C.onFocusCapture),onBlurCapture:xi(t.onBlurCapture,C.onBlurCapture),onPointerDownCapture:xi(t.onPointerDownCapture,S.onPointerDownCapture)})});oR.displayName=s$;var l$="DismissableLayerBranch",a$=v.forwardRef((t,e)=>{const n=v.useContext(iR),r=v.useRef(null),s=zo(e,r);return v.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),w.jsx(Ns.div,{...t,ref:s})});a$.displayName=l$;function u$(t,e=globalThis==null?void 0:globalThis.document){const n=qu(t),r=v.useRef(!1),s=v.useRef(()=>{});return v.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let a=function(){lR(i$,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=a,e.addEventListener("click",s.current,{once:!0})):a()}else e.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function c$(t,e=globalThis==null?void 0:globalThis.document){const n=qu(t),r=v.useRef(!1);return v.useEffect(()=>{const s=i=>{i.target&&!r.current&&lR(o$,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ab(){const t=new CustomEvent(vy);document.dispatchEvent(t)}function lR(t,e,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?n$(s,i):s.dispatchEvent(i)}var pm="focusScope.autoFocusOnMount",mm="focusScope.autoFocusOnUnmount",ub={bubbles:!1,cancelable:!0},d$="FocusScope",aR=v.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=t,[l,a]=v.useState(null),u=qu(s),c=qu(i),d=v.useRef(null),f=zo(e,m=>a(m)),h=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(k){if(h.paused||!l)return;const b=k.target;l.contains(b)?d.current=b:js(d.current,{select:!0})},y=function(k){if(h.paused||!l)return;const b=k.relatedTarget;b!==null&&(l.contains(b)||js(d.current,{select:!0}))},g=function(k){if(document.activeElement===document.body)for(const S of k)S.removedNodes.length>0&&js(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const x=new MutationObserver(g);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),x.disconnect()}}},[r,l,h.paused]),v.useEffect(()=>{if(l){db.add(h);const m=document.activeElement;if(!l.contains(m)){const g=new CustomEvent(pm,ub);l.addEventListener(pm,u),l.dispatchEvent(g),g.defaultPrevented||(f$(y$(uR(l)),{select:!0}),document.activeElement===m&&js(l))}return()=>{l.removeEventListener(pm,u),setTimeout(()=>{const g=new CustomEvent(mm,ub);l.addEventListener(mm,c),l.dispatchEvent(g),g.defaultPrevented||js(m??document.body,{select:!0}),l.removeEventListener(mm,c),db.remove(h)},0)}}},[l,u,c,h]);const p=v.useCallback(m=>{if(!n&&!r||h.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(y&&g){const x=m.currentTarget,[k,b]=h$(x);k&&b?!m.shiftKey&&g===b?(m.preventDefault(),n&&js(k,{select:!0})):m.shiftKey&&g===k&&(m.preventDefault(),n&&js(b,{select:!0})):g===x&&m.preventDefault()}},[n,r,h.paused]);return w.jsx(Ns.div,{tabIndex:-1,...o,ref:f,onKeyDown:p})});aR.displayName=d$;function f$(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(js(r,{select:e}),document.activeElement!==n)return}function h$(t){const e=uR(t),n=cb(e,t),r=cb(e.reverse(),t);return[n,r]}function uR(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function cb(t,e){for(const n of t)if(!p$(n,{upTo:e}))return n}function p$(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function m$(t){return t instanceof HTMLInputElement&&"select"in t}function js(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&m$(t)&&e&&t.select()}}var db=g$();function g$(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=fb(t,e),t.unshift(e)},remove(e){var n;t=fb(t,e),(n=t[0])==null||n.resume()}}}function fb(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function y$(t){return t.filter(e=>e.tagName!=="A")}var v$="Portal",cR=v.forwardRef((t,e)=>{var l;const{container:n,...r}=t,[s,i]=v.useState(!1);Wu(()=>i(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?uT.createPortal(w.jsx(Ns.div,{...r,ref:e}),o):null});cR.displayName=v$;function x$(t,e){return v.useReducer((n,r)=>e[n][r]??n,t)}var Jh=t=>{const{present:e,children:n}=t,r=w$(e),s=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),i=zo(r.ref,k$(s));return typeof n=="function"||r.isPresent?v.cloneElement(s,{ref:i}):null};Jh.displayName="Presence";function w$(t){const[e,n]=v.useState(),r=v.useRef(null),s=v.useRef(t),i=v.useRef("none"),o=t?"mounted":"unmounted",[l,a]=x$(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=Xc(r.current);i.current=l==="mounted"?u:"none"},[l]),Wu(()=>{const u=r.current,c=s.current;if(c!==t){const f=i.current,h=Xc(u);t?a("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?a("UNMOUNT"):a(c&&f!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,a]),Wu(()=>{if(e){let u;const c=e.ownerDocument.defaultView??window,d=h=>{const m=Xc(r.current).includes(CSS.escape(h.animationName));if(h.target===e&&m&&(a("ANIMATION_END"),!s.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",u=c.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},f=h=>{h.target===e&&(i.current=Xc(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{c.clearTimeout(u),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else a("ANIMATION_END")},[e,a]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Xc(t){return(t==null?void 0:t.animationName)||"none"}function k$(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var gm=0;function b$(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??hb()),document.body.insertAdjacentElement("beforeend",t[1]??hb()),gm++,()=>{gm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),gm--}},[])}function hb(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Lr=function(){return Lr=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Lr.apply(this,arguments)};function dR(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function S$(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var $d="right-scroll-bar-position",zd="width-before-scroll-bar",C$="with-scroll-bars-hidden",E$="--removed-body-scroll-bar-size";function ym(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function T$(t,e){var n=v.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=e,n.facade}var R$=typeof window<"u"?v.useLayoutEffect:v.useEffect,pb=new WeakMap;function M$(t,e){var n=T$(null,function(r){return t.forEach(function(s){return ym(s,r)})});return R$(function(){var r=pb.get(n);if(r){var s=new Set(r),i=new Set(t),o=n.current;s.forEach(function(l){i.has(l)||ym(l,null)}),i.forEach(function(l){s.has(l)||ym(l,o)})}pb.set(n,t)},[t]),n}function N$(t){return t}function O$(t,e){e===void 0&&(e=N$);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var o=e(i,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var a=function(){var c=o;o=[],c.forEach(i)},u=function(){return Promise.resolve().then(a)};u(),n={push:function(c){o.push(c),u()},filter:function(c){return o=o.filter(c),n}}}};return s}function A$(t){t===void 0&&(t={});var e=O$(null);return e.options=Lr({async:!0,ssr:!1},t),e}var fR=function(t){var e=t.sideCar,n=dR(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,Lr({},n))};fR.isSideCarExport=!0;function _$(t,e){return t.useMedium(e),fR}var hR=A$(),vm=function(){},Qh=v.forwardRef(function(t,e){var n=v.useRef(null),r=v.useState({onScrollCapture:vm,onWheelCapture:vm,onTouchMoveCapture:vm}),s=r[0],i=r[1],o=t.forwardProps,l=t.children,a=t.className,u=t.removeScrollBar,c=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,m=t.inert,y=t.allowPinchZoom,g=t.as,x=g===void 0?"div":g,k=t.gapMode,b=dR(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=M$([n,e]),E=Lr(Lr({},b),s);return v.createElement(v.Fragment,null,c&&v.createElement(S,{sideCar:hR,removeScrollBar:u,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:k}),o?v.cloneElement(v.Children.only(l),Lr(Lr({},E),{ref:C})):v.createElement(x,Lr({},E,{className:a,ref:C}),l))});Qh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Qh.classNames={fullWidth:zd,zeroRight:$d};var P$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function I$(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=P$();return e&&t.setAttribute("nonce",e),t}function D$(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function L$(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var j$=function(){var t=0,e=null;return{add:function(n){t==0&&(e=I$())&&(D$(e,n),L$(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},$$=function(){var t=j$();return function(e,n){v.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},pR=function(){var t=$$(),e=function(n){var r=n.styles,s=n.dynamic;return t(r,s),null};return e},z$={left:0,top:0,right:0,gap:0},xm=function(t){return parseInt(t||"",10)||0},F$=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[xm(n),xm(r),xm(s)]},B$=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return z$;var e=F$(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},V$=pR(),Nl="data-scroll-locked",H$=function(t,e,n,r){var s=t.left,i=t.top,o=t.right,l=t.gap;return n===void 0&&(n="margin"),`
263
- .`.concat(C$,` {
264
- overflow: hidden `).concat(r,`;
265
- padding-right: `).concat(l,"px ").concat(r,`;
266
- }
267
- body[`).concat(Nl,`] {
268
- overflow: hidden `).concat(r,`;
269
- overscroll-behavior: contain;
270
- `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
271
- padding-left: `.concat(s,`px;
272
- padding-top: `).concat(i,`px;
273
- padding-right: `).concat(o,`px;
274
- margin-left:0;
275
- margin-top:0;
276
- margin-right: `).concat(l,"px ").concat(r,`;
277
- `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
278
- }
279
-
280
- .`).concat($d,` {
281
- right: `).concat(l,"px ").concat(r,`;
282
- }
283
-
284
- .`).concat(zd,` {
285
- margin-right: `).concat(l,"px ").concat(r,`;
286
- }
287
-
288
- .`).concat($d," .").concat($d,` {
289
- right: 0 `).concat(r,`;
290
- }
291
-
292
- .`).concat(zd," .").concat(zd,` {
293
- margin-right: 0 `).concat(r,`;
294
- }
295
-
296
- body[`).concat(Nl,`] {
297
- `).concat(E$,": ").concat(l,`px;
298
- }
299
- `)},mb=function(){var t=parseInt(document.body.getAttribute(Nl)||"0",10);return isFinite(t)?t:0},U$=function(){v.useEffect(function(){return document.body.setAttribute(Nl,(mb()+1).toString()),function(){var t=mb()-1;t<=0?document.body.removeAttribute(Nl):document.body.setAttribute(Nl,t.toString())}},[])},W$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;U$();var i=v.useMemo(function(){return B$(s)},[s]);return v.createElement(V$,{styles:H$(i,!e,s,n?"":"!important")})},xy=!1;if(typeof window<"u")try{var ed=Object.defineProperty({},"passive",{get:function(){return xy=!0,!0}});window.addEventListener("test",ed,ed),window.removeEventListener("test",ed,ed)}catch{xy=!1}var Zo=xy?{passive:!1}:!1,q$=function(t){return t.tagName==="TEXTAREA"},mR=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!q$(t)&&n[e]==="visible")},G$=function(t){return mR(t,"overflowY")},K$=function(t){return mR(t,"overflowX")},gb=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=gR(t,r);if(s){var i=yR(t,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},J$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Q$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},gR=function(t,e){return t==="v"?G$(e):K$(e)},yR=function(t,e){return t==="v"?J$(e):Q$(e)},Z$=function(t,e){return t==="h"&&e==="rtl"?-1:1},Y$=function(t,e,n,r,s){var i=Z$(t,window.getComputedStyle(e).direction),o=i*r,l=n.target,a=e.contains(l),u=!1,c=o>0,d=0,f=0;do{if(!l)break;var h=yR(t,l),p=h[0],m=h[1],y=h[2],g=m-y-i*p;(p||g)&&gR(t,l)&&(d+=g,f+=p);var x=l.parentNode;l=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!a&&l!==document.body||a&&(e.contains(l)||e===l));return(c&&Math.abs(d)<1||!c&&Math.abs(f)<1)&&(u=!0),u},td=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},yb=function(t){return[t.deltaX,t.deltaY]},vb=function(t){return t&&"current"in t?t.current:t},X$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},ez=function(t){return`
300
- .block-interactivity-`.concat(t,` {pointer-events: none;}
301
- .allow-interactivity-`).concat(t,` {pointer-events: all;}
302
- `)},tz=0,Yo=[];function nz(t){var e=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),s=v.useState(tz++)[0],i=v.useState(pR)[0],o=v.useRef(t);v.useEffect(function(){o.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var m=S$([t.lockRef.current],(t.shards||[]).map(vb),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=v.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var g=td(m),x=n.current,k="deltaX"in m?m.deltaX:x[0]-g[0],b="deltaY"in m?m.deltaY:x[1]-g[1],S,C=m.target,E=Math.abs(k)>Math.abs(b)?"h":"v";if("touches"in m&&E==="h"&&C.type==="range")return!1;var T=window.getSelection(),N=T&&T.anchorNode,O=N?N===C||N.contains(C):!1;if(O)return!1;var H=gb(E,C);if(!H)return!0;if(H?S=E:(S=E==="v"?"h":"v",H=gb(E,C)),!H)return!1;if(!r.current&&"changedTouches"in m&&(k||b)&&(r.current=S),!S)return!0;var ne=r.current||S;return Y$(ne,y,m,ne==="h"?k:b)},[]),a=v.useCallback(function(m){var y=m;if(!(!Yo.length||Yo[Yo.length-1]!==i)){var g="deltaY"in y?yb(y):td(y),x=e.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&X$(S.delta,g)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var k=(o.current.shards||[]).map(vb).filter(Boolean).filter(function(S){return S.contains(y.target)}),b=k.length>0?l(y,k[0]):!o.current.noIsolation;b&&y.cancelable&&y.preventDefault()}}},[]),u=v.useCallback(function(m,y,g,x){var k={name:m,delta:y,target:g,should:x,shadowParent:rz(g)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(b){return b!==k})},1)},[]),c=v.useCallback(function(m){n.current=td(m),r.current=void 0},[]),d=v.useCallback(function(m){u(m.type,yb(m),m.target,l(m,t.lockRef.current))},[]),f=v.useCallback(function(m){u(m.type,td(m),m.target,l(m,t.lockRef.current))},[]);v.useEffect(function(){return Yo.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,Zo),document.addEventListener("touchmove",a,Zo),document.addEventListener("touchstart",c,Zo),function(){Yo=Yo.filter(function(m){return m!==i}),document.removeEventListener("wheel",a,Zo),document.removeEventListener("touchmove",a,Zo),document.removeEventListener("touchstart",c,Zo)}},[]);var h=t.removeScrollBar,p=t.inert;return v.createElement(v.Fragment,null,p?v.createElement(i,{styles:ez(s)}):null,h?v.createElement(W$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function rz(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const sz=_$(hR,nz);var vR=v.forwardRef(function(t,e){return v.createElement(Qh,Lr({},t,{ref:e,sideCar:sz}))});vR.classNames=Qh.classNames;var iz=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Xo=new WeakMap,nd=new WeakMap,rd={},wm=0,xR=function(t){return t&&(t.host||xR(t.parentNode))},oz=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=xR(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},lz=function(t,e,n,r){var s=oz(e,Array.isArray(t)?t:[t]);rd[n]||(rd[n]=new WeakMap);var i=rd[n],o=[],l=new Set,a=new Set(s),u=function(d){!d||l.has(d)||(l.add(d),u(d.parentNode))};s.forEach(u);var c=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(l.has(f))c(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=(Xo.get(f)||0)+1,y=(i.get(f)||0)+1;Xo.set(f,m),i.set(f,y),o.push(f),m===1&&p&&nd.set(f,!0),y===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return c(e),l.clear(),wm++,function(){o.forEach(function(d){var f=Xo.get(d)-1,h=i.get(d)-1;Xo.set(d,f),i.set(d,h),f||(nd.has(d)||d.removeAttribute(r),nd.delete(d)),h||d.removeAttribute(n)}),wm--,wm||(Xo=new WeakMap,Xo=new WeakMap,nd=new WeakMap,rd={})}},az=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=iz(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),lz(r,s,n,"aria-hidden")):function(){return null}},Zh="Dialog",[wR]=Vj(Zh),[uz,Cr]=wR(Zh),kR=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=t,l=v.useRef(null),a=v.useRef(null),[u,c]=Gj({prop:r,defaultProp:s??!1,onChange:i,caller:Zh});return w.jsx(uz,{scope:e,triggerRef:l,contentRef:a,contentId:xs(),titleId:xs(),descriptionId:xs(),open:u,onOpenChange:c,onOpenToggle:v.useCallback(()=>c(d=>!d),[c]),modal:o,children:n})};kR.displayName=Zh;var bR="DialogTrigger",cz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Cr(bR,n),i=zo(e,s.triggerRef);return w.jsx(Ns.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":M0(s.open),...r,ref:i,onClick:xi(t.onClick,s.onOpenToggle)})});cz.displayName=bR;var T0="DialogPortal",[dz,SR]=wR(T0,{forceMount:void 0}),CR=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,i=Cr(T0,e);return w.jsx(dz,{scope:e,forceMount:n,children:v.Children.map(r,o=>w.jsx(Jh,{present:n||i.open,children:w.jsx(cR,{asChild:!0,container:s,children:o})}))})};CR.displayName=T0;var Sf="DialogOverlay",ER=v.forwardRef((t,e)=>{const n=SR(Sf,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,i=Cr(Sf,t.__scopeDialog);return i.modal?w.jsx(Jh,{present:r||i.open,children:w.jsx(hz,{...s,ref:e})}):null});ER.displayName=Sf;var fz=sR("DialogOverlay.RemoveScroll"),hz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Cr(Sf,n);return w.jsx(vR,{as:fz,allowPinchZoom:!0,shards:[s.contentRef],children:w.jsx(Ns.div,{"data-state":M0(s.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Ro="DialogContent",TR=v.forwardRef((t,e)=>{const n=SR(Ro,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,i=Cr(Ro,t.__scopeDialog);return w.jsx(Jh,{present:r||i.open,children:i.modal?w.jsx(pz,{...s,ref:e}):w.jsx(mz,{...s,ref:e})})});TR.displayName=Ro;var pz=v.forwardRef((t,e)=>{const n=Cr(Ro,t.__scopeDialog),r=v.useRef(null),s=zo(e,n.contentRef,r);return v.useEffect(()=>{const i=r.current;if(i)return az(i)},[]),w.jsx(RR,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xi(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:xi(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:xi(t.onFocusOutside,i=>i.preventDefault())})}),mz=v.forwardRef((t,e)=>{const n=Cr(Ro,t.__scopeDialog),r=v.useRef(!1),s=v.useRef(!1);return w.jsx(RR,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var a,u;(a=t.onInteractOutside)==null||a.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),RR=v.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=t,l=Cr(Ro,n),a=v.useRef(null),u=zo(e,a);return b$(),w.jsxs(w.Fragment,{children:[w.jsx(aR,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:w.jsx(oR,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":M0(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),w.jsxs(w.Fragment,{children:[w.jsx(gz,{titleId:l.titleId}),w.jsx(vz,{contentRef:a,descriptionId:l.descriptionId})]})]})}),R0="DialogTitle",MR=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Cr(R0,n);return w.jsx(Ns.h2,{id:s.titleId,...r,ref:e})});MR.displayName=R0;var NR="DialogDescription",OR=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Cr(NR,n);return w.jsx(Ns.p,{id:s.descriptionId,...r,ref:e})});OR.displayName=NR;var AR="DialogClose",_R=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Cr(AR,n);return w.jsx(Ns.button,{type:"button",...r,ref:e,onClick:xi(t.onClick,()=>s.onOpenChange(!1))})});_R.displayName=AR;function M0(t){return t?"open":"closed"}var PR="DialogTitleWarning",[kq,IR]=Bj(PR,{contentName:Ro,titleName:R0,docsSlug:"dialog"}),gz=({titleId:t})=>{const e=IR(PR),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
303
-
304
- If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
305
-
306
- For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return v.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},yz="DialogDescriptionWarning",vz=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${IR(yz).contentName}}.`;return v.useEffect(()=>{var i;const s=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},DR=kR,LR=CR,N0=ER,O0=TR,jR=MR,$R=OR,xz=_R,wz=Symbol.for("react.lazy"),Cf=Nh[" use ".trim().toString()];function kz(t){return typeof t=="object"&&t!==null&&"then"in t}function zR(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===wz&&"_payload"in t&&kz(t._payload)}function bz(t){const e=Sz(t),n=v.forwardRef((r,s)=>{let{children:i,...o}=r;zR(i)&&typeof Cf=="function"&&(i=Cf(i._payload));const l=v.Children.toArray(i),a=l.find(Ez);if(a){const u=a.props.children,c=l.map(d=>d===a?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:d);return w.jsx(e,{...o,ref:s,children:v.isValidElement(u)?v.cloneElement(u,void 0,c):null})}return w.jsx(e,{...o,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function Sz(t){const e=v.forwardRef((n,r)=>{let{children:s,...i}=n;if(zR(s)&&typeof Cf=="function"&&(s=Cf(s._payload)),v.isValidElement(s)){const o=Rz(s),l=Tz(i,s.props);return s.type!==v.Fragment&&(l.ref=r?Ri(r,o):o),v.cloneElement(s,l)}return v.Children.count(s)>1?v.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Cz=Symbol("radix.slottable");function Ez(t){return v.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Cz}function Tz(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const a=i(...l);return s(...l),a}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Rz(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Mz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ji=Mz.reduce((t,e)=>{const n=bz(`Primitive.${e}`),r=v.forwardRef((s,i)=>{const{asChild:o,...l}=s,a=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(a,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Da='[cmdk-group=""]',km='[cmdk-group-items=""]',Nz='[cmdk-group-heading=""]',FR='[cmdk-item=""]',xb=`${FR}:not([aria-disabled="true"])`,wy="cmdk-item-select",sl="data-value",Oz=(t,e,n)=>Fj(t,e,n),BR=v.createContext(void 0),vc=()=>v.useContext(BR),VR=v.createContext(void 0),A0=()=>v.useContext(VR),HR=v.createContext(void 0),UR=v.forwardRef((t,e)=>{let n=il(()=>{var P,q;return{search:"",value:(q=(P=t.value)!=null?P:t.defaultValue)!=null?q:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=il(()=>new Set),s=il(()=>new Map),i=il(()=>new Map),o=il(()=>new Set),l=WR(t),{label:a,children:u,value:c,onValueChange:d,filter:f,shouldFilter:h,loop:p,disablePointerSelection:m=!1,vimBindings:y=!0,...g}=t,x=xs(),k=xs(),b=xs(),S=v.useRef(null),C=Bz();Mo(()=>{if(c!==void 0){let P=c.trim();n.current.value=P,E.emit()}},[c]),Mo(()=>{C(6,ae)},[]);let E=v.useMemo(()=>({subscribe:P=>(o.current.add(P),()=>o.current.delete(P)),snapshot:()=>n.current,setState:(P,q,G)=>{var K,j,F,xe;if(!Object.is(n.current[P],q)){if(n.current[P]=q,P==="search")ne(),O(),C(1,H);else if(P==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Y=document.getElementById(b);Y?Y.focus():(K=document.getElementById(x))==null||K.focus()}if(C(7,()=>{var Y;n.current.selectedItemId=(Y=Q())==null?void 0:Y.id,E.emit()}),G||C(5,ae),((j=l.current)==null?void 0:j.value)!==void 0){let Y=q??"";(xe=(F=l.current).onValueChange)==null||xe.call(F,Y);return}}E.emit()}},emit:()=>{o.current.forEach(P=>P())}}),[]),T=v.useMemo(()=>({value:(P,q,G)=>{var K;q!==((K=i.current.get(P))==null?void 0:K.value)&&(i.current.set(P,{value:q,keywords:G}),n.current.filtered.items.set(P,N(q,G)),C(2,()=>{O(),E.emit()}))},item:(P,q)=>(r.current.add(P),q&&(s.current.has(q)?s.current.get(q).add(P):s.current.set(q,new Set([P]))),C(3,()=>{ne(),O(),n.current.value||H(),E.emit()}),()=>{i.current.delete(P),r.current.delete(P),n.current.filtered.items.delete(P);let G=Q();C(4,()=>{ne(),(G==null?void 0:G.getAttribute("id"))===P&&H(),E.emit()})}),group:P=>(s.current.has(P)||s.current.set(P,new Set),()=>{i.current.delete(P),s.current.delete(P)}),filter:()=>l.current.shouldFilter,label:a||t["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:x,inputId:b,labelId:k,listInnerRef:S}),[]);function N(P,q){var G,K;let j=(K=(G=l.current)==null?void 0:G.filter)!=null?K:Oz;return P?j(P,n.current.search,q):0}function O(){if(!n.current.search||l.current.shouldFilter===!1)return;let P=n.current.filtered.items,q=[];n.current.filtered.groups.forEach(K=>{let j=s.current.get(K),F=0;j.forEach(xe=>{let Y=P.get(xe);F=Math.max(Y,F)}),q.push([K,F])});let G=S.current;le().sort((K,j)=>{var F,xe;let Y=K.getAttribute("id"),Se=j.getAttribute("id");return((F=P.get(Se))!=null?F:0)-((xe=P.get(Y))!=null?xe:0)}).forEach(K=>{let j=K.closest(km);j?j.appendChild(K.parentElement===j?K:K.closest(`${km} > *`)):G.appendChild(K.parentElement===G?K:K.closest(`${km} > *`))}),q.sort((K,j)=>j[1]-K[1]).forEach(K=>{var j;let F=(j=S.current)==null?void 0:j.querySelector(`${Da}[${sl}="${encodeURIComponent(K[0])}"]`);F==null||F.parentElement.appendChild(F)})}function H(){let P=le().find(G=>G.getAttribute("aria-disabled")!=="true"),q=P==null?void 0:P.getAttribute(sl);E.setState("value",q||void 0)}function ne(){var P,q,G,K;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let j=0;for(let F of r.current){let xe=(q=(P=i.current.get(F))==null?void 0:P.value)!=null?q:"",Y=(K=(G=i.current.get(F))==null?void 0:G.keywords)!=null?K:[],Se=N(xe,Y);n.current.filtered.items.set(F,Se),Se>0&&j++}for(let[F,xe]of s.current)for(let Y of xe)if(n.current.filtered.items.get(Y)>0){n.current.filtered.groups.add(F);break}n.current.filtered.count=j}function ae(){var P,q,G;let K=Q();K&&(((P=K.parentElement)==null?void 0:P.firstChild)===K&&((G=(q=K.closest(Da))==null?void 0:q.querySelector(Nz))==null||G.scrollIntoView({block:"nearest"})),K.scrollIntoView({block:"nearest"}))}function Q(){var P;return(P=S.current)==null?void 0:P.querySelector(`${FR}[aria-selected="true"]`)}function le(){var P;return Array.from(((P=S.current)==null?void 0:P.querySelectorAll(xb))||[])}function se(P){let q=le()[P];q&&E.setState("value",q.getAttribute(sl))}function ye(P){var q;let G=Q(),K=le(),j=K.findIndex(xe=>xe===G),F=K[j+P];(q=l.current)!=null&&q.loop&&(F=j+P<0?K[K.length-1]:j+P===K.length?K[0]:K[j+P]),F&&E.setState("value",F.getAttribute(sl))}function M(P){let q=Q(),G=q==null?void 0:q.closest(Da),K;for(;G&&!K;)G=P>0?zz(G,Da):Fz(G,Da),K=G==null?void 0:G.querySelector(xb);K?E.setState("value",K.getAttribute(sl)):ye(P)}let V=()=>se(le().length-1),ie=P=>{P.preventDefault(),P.metaKey?V():P.altKey?M(1):ye(1)},Ee=P=>{P.preventDefault(),P.metaKey?se(0):P.altKey?M(-1):ye(-1)};return v.createElement(ji.div,{ref:e,tabIndex:-1,...g,"cmdk-root":"",onKeyDown:P=>{var q;(q=g.onKeyDown)==null||q.call(g,P);let G=P.nativeEvent.isComposing||P.keyCode===229;if(!(P.defaultPrevented||G))switch(P.key){case"n":case"j":{y&&P.ctrlKey&&ie(P);break}case"ArrowDown":{ie(P);break}case"p":case"k":{y&&P.ctrlKey&&Ee(P);break}case"ArrowUp":{Ee(P);break}case"Home":{P.preventDefault(),se(0);break}case"End":{P.preventDefault(),V();break}case"Enter":{P.preventDefault();let K=Q();if(K){let j=new Event(wy);K.dispatchEvent(j)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Hz},a),Yh(t,P=>v.createElement(VR.Provider,{value:E},v.createElement(BR.Provider,{value:T},P))))}),Az=v.forwardRef((t,e)=>{var n,r;let s=xs(),i=v.useRef(null),o=v.useContext(HR),l=vc(),a=WR(t),u=(r=(n=a.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Mo(()=>{if(!u)return l.item(s,o==null?void 0:o.id)},[u]);let c=qR(s,i,[t.value,t.children,i],t.keywords),d=A0(),f=Mi(C=>C.value&&C.value===c.current),h=Mi(C=>u||l.filter()===!1?!0:C.search?C.filtered.items.get(s)>0:!0);v.useEffect(()=>{let C=i.current;if(!(!C||t.disabled))return C.addEventListener(wy,p),()=>C.removeEventListener(wy,p)},[h,t.onSelect,t.disabled]);function p(){var C,E;m(),(E=(C=a.current).onSelect)==null||E.call(C,c.current)}function m(){d.setState("value",c.current,!0)}if(!h)return null;let{disabled:y,value:g,onSelect:x,forceMount:k,keywords:b,...S}=t;return v.createElement(ji.div,{ref:Ri(i,e),...S,id:s,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!f,"data-disabled":!!y,"data-selected":!!f,onPointerMove:y||l.getDisablePointerSelection()?void 0:m,onClick:y?void 0:p},t.children)}),_z=v.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,o=xs(),l=v.useRef(null),a=v.useRef(null),u=xs(),c=vc(),d=Mi(h=>s||c.filter()===!1?!0:h.search?h.filtered.groups.has(o):!0);Mo(()=>c.group(o),[]),qR(o,l,[t.value,t.heading,a]);let f=v.useMemo(()=>({id:o,forceMount:s}),[s]);return v.createElement(ji.div,{ref:Ri(l,e),...i,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},n&&v.createElement("div",{ref:a,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),Yh(t,h=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},v.createElement(HR.Provider,{value:f},h))))}),Pz=v.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=v.useRef(null),i=Mi(o=>!o.search);return!n&&!i?null:v.createElement(ji.div,{ref:Ri(s,e),...r,"cmdk-separator":"",role:"separator"})}),Iz=v.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=A0(),o=Mi(u=>u.search),l=Mi(u=>u.selectedItemId),a=vc();return v.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),v.createElement(ji.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":a.listId,"aria-labelledby":a.labelId,"aria-activedescendant":l,id:a.inputId,type:"text",value:s?t.value:o,onChange:u=>{s||i.setState("search",u.target.value),n==null||n(u.target.value)}})}),Dz=v.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=v.useRef(null),o=v.useRef(null),l=Mi(u=>u.selectedItemId),a=vc();return v.useEffect(()=>{if(o.current&&i.current){let u=o.current,c=i.current,d,f=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let h=u.offsetHeight;c.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return f.observe(u),()=>{cancelAnimationFrame(d),f.unobserve(u)}}},[]),v.createElement(ji.div,{ref:Ri(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:a.listId},Yh(t,u=>v.createElement("div",{ref:Ri(o,a.listInnerRef),"cmdk-list-sizer":""},u)))}),Lz=v.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:o,...l}=t;return v.createElement(DR,{open:n,onOpenChange:r},v.createElement(LR,{container:o},v.createElement(N0,{"cmdk-overlay":"",className:s}),v.createElement(O0,{"aria-label":t.label,"cmdk-dialog":"",className:i},v.createElement(UR,{ref:e,...l}))))}),jz=v.forwardRef((t,e)=>Mi(n=>n.filtered.count===0)?v.createElement(ji.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),$z=v.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return v.createElement(ji.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Yh(t,o=>v.createElement("div",{"aria-hidden":!0},o)))}),kn=Object.assign(UR,{List:Dz,Item:Az,Input:Iz,Group:_z,Separator:Pz,Dialog:Lz,Empty:jz,Loading:$z});function zz(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Fz(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function WR(t){let e=v.useRef(t);return Mo(()=>{e.current=t}),e}var Mo=typeof window>"u"?v.useEffect:v.useLayoutEffect;function il(t){let e=v.useRef();return e.current===void 0&&(e.current=t()),e}function Mi(t){let e=A0(),n=()=>t(e.snapshot());return v.useSyncExternalStore(e.subscribe,n,n)}function qR(t,e,n,r=[]){let s=v.useRef(),i=vc();return Mo(()=>{var o;let l=(()=>{var u;for(let c of n){if(typeof c=="string")return c.trim();if(typeof c=="object"&&"current"in c)return c.current?(u=c.current.textContent)==null?void 0:u.trim():s.current}})(),a=r.map(u=>u.trim());i.value(t,l,a),(o=e.current)==null||o.setAttribute(sl,l),s.current=l}),s}var Bz=()=>{let[t,e]=v.useState(),n=il(()=>new Map);return Mo(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function Vz(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Yh({asChild:t,children:e},n){return t&&v.isValidElement(e)?v.cloneElement(Vz(e),{ref:e.ref},n(e.props.children)):n(e)}var Hz={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const _0=DR,Uz=LR,GR=v.forwardRef(({className:t,...e},n)=>w.jsx(N0,{ref:n,className:Mt("fixed inset-0 z-40 bg-black/40 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));GR.displayName=N0.displayName;const Xh=v.forwardRef(({className:t,children:e,...n},r)=>w.jsxs(Uz,{children:[w.jsx(GR,{}),w.jsxs(O0,{ref:r,className:Mt("fixed left-[50%] top-[50%] z-50 w-full max-w-lg translate-x-[-50%] translate-y-[-50%] rounded-lg border border-border bg-card p-4 shadow-xl outline-none",t),...n,children:[e,w.jsxs(xz,{className:"absolute right-3 top-3 rounded-sm text-muted-foreground transition-opacity hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[w.jsx(eR,{className:"h-4 w-4"}),w.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Xh.displayName=O0.displayName;const P0=({className:t,...e})=>w.jsx("div",{className:Mt("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});P0.displayName="DialogHeader";const I0=v.forwardRef(({className:t,...e},n)=>w.jsx(jR,{ref:n,className:Mt("text-lg font-semibold leading-none tracking-tight",t),...e}));I0.displayName=jR.displayName;const KR=v.forwardRef(({className:t,...e},n)=>w.jsx($R,{ref:n,className:Mt("text-sm text-muted-foreground",t),...e}));KR.displayName=$R.displayName;const JR=v.forwardRef(({className:t,...e},n)=>w.jsx(kn,{ref:n,className:Mt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));JR.displayName=kn.displayName;const Wz=({children:t,...e})=>w.jsx(_0,{...e,children:w.jsx(Xh,{className:"overflow-hidden p-0 shadow-2xl",children:w.jsx(JR,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]]:border-b [&_[cmdk-input-wrapper]]:border-border [&_[cmdk-input]]:h-11 [&_[cmdk-input]]:px-2 [&_[cmdk-input]]:text-sm [&_[cmdk-input]]:outline-none [&_[cmdk-item]]:flex [&_[cmdk-item]]:cursor-default [&_[cmdk-item]]:select-none [&_[cmdk-item]]:items-center [&_[cmdk-item]]:justify-between [&_[cmdk-item]]:rounded-md [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-2 [&_[cmdk-item]]:text-sm [&_[cmdk-item]]:outline-none [&_[cmdk-item][data-disabled=true]]:opacity-50 [&_[cmdk-item][data-selected=true]]:bg-accent [&_[cmdk-item][data-selected=true]]:text-accent-foreground",children:t})})}),QR=v.forwardRef(({className:t,...e},n)=>w.jsxs("div",{className:"flex items-center gap-2 px-3","cmdk-input-wrapper":"",children:[w.jsx(XT,{className:"h-4 w-4 text-muted-foreground"}),w.jsx(kn.Input,{ref:n,className:Mt("flex h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",t),...e})]}));QR.displayName=kn.Input.displayName;const ZR=v.forwardRef(({className:t,...e},n)=>w.jsx(kn.List,{ref:n,className:Mt("max-h-[360px] overflow-y-auto overflow-x-hidden",t),...e}));ZR.displayName=kn.List.displayName;const YR=v.forwardRef((t,e)=>w.jsx(kn.Empty,{ref:e,className:"py-6 text-center text-sm text-muted-foreground",...t}));YR.displayName=kn.Empty.displayName;const Fd=v.forwardRef(({className:t,...e},n)=>w.jsx(kn.Group,{ref:n,className:Mt("overflow-hidden p-1 text-foreground",t),...e}));Fd.displayName=kn.Group.displayName;const XR=v.forwardRef(({className:t,...e},n)=>w.jsx(kn.Separator,{ref:n,className:Mt("-mx-1 h-px bg-border",t),...e}));XR.displayName=kn.Separator.displayName;const Bd=v.forwardRef(({className:t,...e},n)=>w.jsx(kn.Item,{ref:n,className:Mt("relative flex cursor-default select-none items-center",t),...e}));Bd.displayName=kn.Item.displayName;const wb=t=>t.displayName??t.name,qz=()=>{const{docs:t}=tR(),{open:e,onOpenChange:n,activeDoc:r,commands:s,onSelectDoc:i,onRunCommand:o}=Aj(),l=s.filter(u=>u.scope==="doc"),a=s.filter(u=>u.scope==="global");return w.jsxs(Wz,{open:e,onOpenChange:n,children:[w.jsx(QR,{placeholder:"Search docs or run a command..."}),w.jsxs(ZR,{children:[w.jsx(YR,{children:"No matches found."}),t.length>0?w.jsx(Fd,{heading:"Docs",children:t.map(u=>w.jsx(Bd,{value:`${wb(u)} ${u.name}`,onSelect:()=>i(u),children:w.jsxs("span",{className:"flex items-center gap-2",children:[w.jsx(KL,{className:"h-4 w-4 text-muted-foreground"}),w.jsxs("span",{className:"flex flex-col",children:[w.jsx("span",{children:wb(u)}),w.jsx("span",{className:"text-xs text-muted-foreground",children:u.name})]})]})},u.name))}):null,t.length>0&&(l.length>0||a.length>0)?w.jsx(XR,{}):null,l.length>0?w.jsx(Fd,{heading:"Document commands",children:l.map(u=>w.jsxs(Bd,{value:`${u.label} ${(u.keywords??[]).join(" ")}`,onSelect:()=>o(u),disabled:!r,children:[w.jsxs("span",{className:"flex items-center gap-2",children:[w.jsx(ZT,{className:"h-4 w-4 text-muted-foreground"}),w.jsx("span",{children:u.label})]}),r?null:w.jsx("span",{className:"text-xs text-muted-foreground",children:"Select a document first"})]},u.id))}):null,a.length>0?w.jsx(Fd,{heading:"Global commands",children:a.map(u=>w.jsx(Bd,{value:`${u.label} ${(u.keywords??[]).join(" ")}`,onSelect:()=>o(u),children:w.jsxs("span",{className:"flex items-center gap-2",children:[w.jsx(ej,{className:"h-4 w-4 text-muted-foreground"}),w.jsx("span",{children:u.label})]})},u.id))}):null]})]})};function Gz(t){const{open:e,newDocType:n,newDocTitle:r,derivedFileName:s,availableCreateTags:i,draftTags:o,tagInput:l,tagStatus:a,createStatus:u,onClose:c,onTitleChange:d,onToggleDraftTag:f,onTagInputChange:h,onAddDraftTag:p,onCreate:m}=t;return e?w.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-black/40 p-4",children:w.jsxs("div",{className:"w-full max-w-md rounded-lg border border-border bg-card p-5 shadow-xl",children:[w.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[w.jsx("h3",{className:"text-base font-semibold",children:n==="json"?"New Data Table":n==="app"?"New React App":"New Markdown Document"}),w.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground",onClick:c,children:"Close"})]}),w.jsxs("div",{className:"space-y-3",children:[w.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[w.jsx("span",{className:"text-muted-foreground",children:"Name"}),w.jsx("input",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:r,onChange:y=>d(y.target.value),placeholder:"Quarterly plan"})]}),w.jsxs("div",{className:"text-sm text-muted-foreground",children:["Type:"," ",w.jsx("span",{className:"font-medium text-foreground",children:n==="json"?"Data table":n==="app"?"React app":"Markdown document"})]}),w.jsxs("div",{className:"text-xs text-muted-foreground",children:["File name:"," ",w.jsx("span",{className:"font-mono text-foreground",children:s||"—"})]}),w.jsxs("div",{className:"flex flex-col gap-2 text-sm",children:[w.jsx("span",{className:"text-muted-foreground",children:"Tags"}),n==="markdown"?w.jsxs(w.Fragment,{children:[i.length>0?w.jsx("div",{className:"flex flex-wrap gap-2",children:i.map(y=>w.jsxs("label",{className:`flex items-center gap-1 rounded-full border px-2 py-1 text-xs ${o.includes(y)?"border-primary bg-primary/10 text-primary":"border-border bg-muted text-muted-foreground"}`,children:[w.jsx("input",{type:"checkbox",className:"hidden",checked:o.includes(y),onChange:()=>f(y)}),w.jsx("span",{children:y})]},y))}):w.jsx("div",{className:"text-xs text-muted-foreground",children:"No tags yet."}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("input",{className:"h-8 w-full rounded-md border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:l,onChange:y=>h(y.target.value),placeholder:"Add a tag"}),w.jsx(ze,{type:"button",size:"sm",variant:"outline",onClick:p,disabled:!l.trim(),children:"Add"})]})]}):w.jsx("div",{className:"text-xs text-muted-foreground",children:"Tags are only available for Markdown docs."}),a?w.jsx("div",{className:"text-xs text-destructive",children:a}):null]}),u?w.jsx("div",{className:"text-sm text-destructive",children:u}):null]}),w.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[w.jsx(ze,{type:"button",variant:"ghost",onClick:c,children:"Cancel"}),w.jsx(ze,{type:"button",onClick:m,children:"Create"})]})]})}):null}function Kz({status:t,onManualSave:e,errorMessage:n}){return n?w.jsxs("span",{className:"group relative inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive","aria-live":"polite",title:"Save error",children:[w.jsx(VL,{className:"h-4 w-4"}),w.jsx("span",{className:"text-[11px] font-medium",children:"Save error"}),w.jsx("span",{className:"pointer-events-none absolute left-full ml-2 w-64 rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100",children:n})]}):t==="saving"?w.jsxs("span",{className:"group relative inline-flex items-center text-muted-foreground/70","aria-live":"polite",title:"Saving",children:[w.jsx(mj,{className:"h-4 w-4 animate-spin text-emerald-400/80"}),w.jsx("span",{className:"pointer-events-none absolute left-full ml-2 rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100",children:"Saving"})]}):w.jsxs("span",{className:"group relative inline-flex items-center text-muted-foreground/70","aria-live":"polite",title:t==="idle"?"No changes":"Saved",children:[w.jsx(LL,{className:"h-4 w-4 text-emerald-400/80"}),w.jsx("span",{className:"pointer-events-none absolute left-full ml-2 rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground opacity-0 shadow-sm transition-opacity group-hover:opacity-100",children:t==="idle"?"No changes":"Saved"})]})}function Jz({value:t,onChange:e,onConfirm:n,onCancel:r,showActions:s,inputRef:i,disabled:o}){return w.jsx("div",{className:"flex min-w-[220px] flex-1 flex-col gap-2",children:w.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[w.jsx("input",{ref:i,className:"min-w-[160px] flex-1 border-b border-dashed border-muted-foreground/60 bg-transparent text-lg font-semibold text-foreground outline-none transition-colors focus:border-foreground",value:t,onChange:l=>e(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),n==null||n()),l.key==="Escape"&&(l.preventDefault(),r==null||r())},placeholder:"Untitled","aria-label":"Document name",disabled:o}),s?w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(ze,{type:"button",size:"xs",onClick:n,children:"Confirm"}),w.jsx(ze,{type:"button",size:"xs",variant:"ghost",onClick:r,children:"Cancel"})]}):null]})})}const eM=v.createContext(null),Qz=eM.Provider,Zz=()=>{const t=v.useContext(eM);if(!t)throw new Error("useDocHeaderContext must be used within DocHeaderProvider.");return t};function Yz(){const{docType:t,title:e,titleInputRef:n,onTitleChange:r,deriveFileName:s,onManualSave:i,saveStatus:o,errorStatus:l,conflict:a,showMetadataButton:u,onShowMetadata:c,fileName:d,isPinned:f,onTogglePinned:h,onArchive:p,onDelete:m,availableTags:y=[],selectedTags:g=[],onToggleTag:x,tagInput:k,onTagInputChange:b,onTagAdd:S,tagStatus:C}=Zz(),[E,T]=v.useState(e),[N,O]=v.useState(!1),H=v.useMemo(()=>y.filter(V=>!g.includes(V)),[y,g]),ne=H.length>0,ae=E!==e,Q=v.useMemo(()=>s==null?void 0:s(E),[s,E]),se=!!(ae&&Q&&Q!==d)?Q:void 0;v.useEffect(()=>{T(e)},[e]),v.useEffect(()=>{t||O(!1)},[t]);const ye=()=>{ae&&r(E)},M=()=>{T(e)};return w.jsx("section",{className:"border border-border bg-card",children:w.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-stretch md:gap-0",children:[w.jsxs("div",{className:"flex flex-col gap-2 px-4 py-3 md:flex-1 md:pr-4 md:border-r md:border-border",children:[w.jsx(Jz,{value:E,onChange:T,onConfirm:ye,onCancel:M,showActions:ae,inputRef:n,disabled:!t}),w.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[w.jsxs("div",{className:"flex",children:[h?w.jsx(ze,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-md bg-transparent",onClick:h,"aria-label":f?"Unpin document":"Pin document",title:f?"Unpin":"Pin",children:w.jsx(YT,{className:`h-4 w-4 ${f?"text-foreground":"text-muted-foreground"}`})}):null,p?w.jsx(ze,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-md bg-transparent",onClick:p,"aria-label":"Archive document",title:"Archive",children:w.jsx(OL,{className:"h-4 w-4 text-muted-foreground"})}):null,m?w.jsx(ze,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-md bg-transparent",onClick:m,"aria-label":"Delete document",title:"Delete",children:w.jsx(Cj,{className:"h-4 w-4 text-muted-foreground"})}):null,u?w.jsx(ze,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-md bg-transparent opacity-60 hover:bg-transparent hover:opacity-100",onClick:c,"aria-label":"Show document info",title:"Show document info",children:w.jsx(ZT,{className:"h-4 w-4"})}):null]}),w.jsx("span",{className:"h-5 w-px bg-border/70","aria-hidden":"true"}),w.jsx(Kz,{status:o,onManualSave:i,errorMessage:l}),w.jsx("span",{className:"h-5 w-px bg-border/70","aria-hidden":"true"}),w.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[w.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Current"}),d?w.jsx("span",{className:"rounded bg-muted px-2 py-1 font-mono text-xs text-foreground",children:d}):w.jsx("span",{children:"No file name yet"}),se?w.jsxs(w.Fragment,{children:[w.jsx("span",{className:"h-4 w-px bg-border/70","aria-hidden":"true"}),w.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Next"}),w.jsx("span",{className:"rounded bg-muted px-2 py-1 font-mono text-xs text-foreground",children:se})]}):null]})]}),a?w.jsx("span",{className:"text-xs text-destructive",children:"File changed on disk. Reload or save to override."}):null]}),t?w.jsxs("div",{className:"flex flex-col gap-2 px-4 py-3 text-sm md:w-[320px] md:pl-4",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Tags"}),w.jsx(ze,{type:"button",size:"xs",variant:"ghost",onClick:()=>O(!0),children:"Edit"})]}),g.length?w.jsx("div",{className:"flex flex-wrap gap-2",children:g.map(V=>w.jsx("span",{className:"rounded-full border border-border bg-muted px-2.5 py-1 text-[11px] text-muted-foreground",children:V},V))}):w.jsx("span",{className:"text-xs text-muted-foreground",children:"No tags yet."}),w.jsx(_0,{open:N,onOpenChange:O,children:w.jsxs(Xh,{className:"max-w-xl",children:[w.jsxs(P0,{className:"text-left",children:[w.jsx(I0,{children:"Edit tags"}),w.jsx(KR,{children:"Add new tags or pick from existing ones."})]}),w.jsxs("div",{className:"mt-4 space-y-4",children:[w.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[w.jsx("input",{className:"h-8 w-full min-w-[160px] flex-1 rounded-md border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:k??"",onChange:V=>b==null?void 0:b(V.target.value),placeholder:"Add a tag"}),w.jsx(ze,{type:"button",size:"sm",variant:"outline",onClick:S,disabled:!(k!=null&&k.trim()),children:"Add"}),C?w.jsx("span",{className:"text-xs text-destructive",children:C}):null]}),w.jsxs("div",{className:"space-y-2",children:[w.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Selected"}),g.length?w.jsx("div",{className:"flex flex-wrap gap-2",children:g.map(V=>w.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-full border border-border bg-muted px-2.5 py-1 text-[11px] text-muted-foreground transition-colors hover:border-destructive/50 hover:text-destructive",onClick:()=>x==null?void 0:x(V),"aria-label":`Remove tag ${V}`,children:[w.jsx("span",{children:V}),w.jsx(eR,{className:"h-3 w-3"})]},V))}):w.jsx("span",{className:"text-xs text-muted-foreground",children:"No tags yet."})]}),w.jsxs("div",{className:"space-y-2",children:[w.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Suggestions"}),ne?w.jsx("div",{className:"flex flex-wrap gap-2",children:H.map(V=>w.jsx("button",{type:"button",className:"rounded-full border border-border bg-muted px-2.5 py-1 text-[11px] text-muted-foreground transition-colors hover:border-primary/40 hover:bg-primary/10 hover:text-primary",onClick:()=>x==null?void 0:x(V),children:V},V))}):w.jsx("span",{className:"text-xs text-muted-foreground",children:"No suggestions yet."})]})]})]})})]}):null]})})}function Xz(t){var i,o;const{open:e,active:n,infoInspector:r,onClose:s}=t;return!e||!n?null:w.jsx("div",{className:"fixed inset-0 z-40 flex items-center justify-center bg-black/40 p-4",onClick:s,children:w.jsxs("div",{className:"w-full max-w-lg rounded-lg border border-border bg-card p-5 shadow-xl",role:"dialog","aria-modal":"true","aria-label":"Document info",onClick:l=>l.stopPropagation(),children:[w.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[w.jsx("h3",{className:"text-base font-semibold",children:"Document info"}),w.jsx("button",{type:"button",className:"text-sm text-muted-foreground hover:text-foreground",onClick:s,children:"Close"})]}),r?w.jsx("div",{className:"space-y-4",children:r.type==="markdown"?w.jsxs(w.Fragment,{children:[w.jsxs("div",{children:[w.jsx("div",{className:"text-xs text-muted-foreground",children:"Metadata (JSON)"}),w.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-border bg-muted p-3 text-xs text-foreground",children:(i=r.metadata)!=null&&i.json?JSON.stringify(r.metadata.json,null,2):r.metadata?"—":"No metadata header found."}),(o=r.metadata)!=null&&o.error?w.jsx("div",{className:"mt-2 text-xs text-destructive",children:r.metadata.error}):null]}),w.jsxs("div",{children:[w.jsx("div",{className:"text-xs text-muted-foreground",children:"Markdown"}),w.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-border bg-muted p-3 text-xs text-foreground",children:r.rawMarkdown||"—"})]})]}):w.jsxs("div",{children:[w.jsx("div",{className:"text-xs text-muted-foreground",children:"JSON"}),w.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-border bg-muted p-3 text-xs text-foreground",children:r.prettyJson??r.rawJson??"—"}),r.error?w.jsx("div",{className:"mt-2 text-xs text-destructive",children:r.error}):null]})}):null]})})}function eF(t){const{docs:e,activeDocName:n,tagFilters:r,tags:s,systemTagStatus:i,showTagsSection:o,onToggleTagFilter:l,onClearTagFilters:a,onOpenCommandPalette:u,onSelectDoc:c,createMenuOpen:d,onToggleCreateMenu:f,onCreateMarkdown:h,onCreateJson:p,onCreateApp:m,docMenuOpen:y,onToggleDocMenu:g,onRunDocMenuAction:x,createMenuRef:k,docMenuRef:b,commandShortcut:S}=t;return w.jsx("aside",{className:"flex h-screen w-64 flex-col border-r border-border p-4",children:w.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6",children:[w.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 text-sm text-muted-foreground transition-colors hover:bg-accent/40",onClick:u,"aria-label":"Open command palette",children:[w.jsxs("span",{className:"flex items-center gap-2",children:[w.jsx(XT,{className:"h-4 w-4"}),w.jsx("span",{children:"Search"})]}),w.jsx("span",{className:"rounded-md border border-border px-1.5 py-0.5 font-mono text-[10px] uppercase",children:S})]}),o?w.jsxs("section",{className:"flex min-h-0 flex-[0_1_auto] flex-col",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Tags"}),r.length>0?w.jsx(ze,{type:"button",variant:"ghost",className:"h-auto px-0 py-0 text-xs font-medium text-muted-foreground hover:text-foreground",onClick:a,children:"Clear"}):null]}),w.jsx("div",{className:"mt-2 min-h-0 flex-1 overflow-y-auto pr-1",children:s.length>0?w.jsx("ul",{className:"flex flex-wrap gap-2",children:s.map(C=>w.jsx("li",{className:`rounded-full border px-2 py-1 text-xs ${r.includes(C)?"border-primary bg-primary/10 text-primary":"border-border bg-muted text-muted-foreground"}`,children:w.jsx("button",{type:"button",className:"text-left",onClick:()=>l(C),children:C})},C))}):i?w.jsx("div",{className:"text-xs text-muted-foreground",children:i}):null})]}):null,w.jsxs("section",{className:"flex min-h-0 flex-[1_1_auto] flex-col",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Docs"}),w.jsxs("div",{className:"relative",ref:k,children:[w.jsxs("div",{className:"flex",children:[w.jsx(ze,{type:"button",size:"icon",variant:"ghost",onClick:h,children:w.jsx(Ga,{className:"h-4 w-4"})}),w.jsx(ze,{type:"button",size:"icon",variant:"ghost",onClick:f,"aria-expanded":d,"aria-haspopup":"menu",children:w.jsx(jd,{className:"h-4 w-4"})})]}),d?w.jsxs("div",{className:"absolute right-0 z-20 mt-2 w-44 rounded-md border border-border bg-popover p-1 text-sm shadow-lg",children:[w.jsx("button",{type:"button",className:"flex w-full items-center justify-between rounded px-2 py-1 text-left hover:bg-accent",onClick:h,children:"New Markdown"}),w.jsx("button",{type:"button",className:"flex w-full items-center justify-between rounded px-2 py-1 text-left hover:bg-accent",onClick:p,children:"New Data Table"}),w.jsx("button",{type:"button",className:"flex w-full items-center justify-between rounded px-2 py-1 text-left hover:bg-accent",onClick:m,children:"New React App"})]}):null]})]}),w.jsx("div",{className:"mt-3 min-h-0 flex-1 overflow-y-auto pr-1",children:w.jsx("ul",{className:"space-y-1",children:e.map(C=>w.jsxs("li",{className:`flex items-center rounded-md px-2 py-2 ${n===C.name?"glassy-highlight":"hover:bg-accent/40"} ${y===C.name?"bg-accent/40":""}`,children:[w.jsx(ze,{onClick:()=>c(C),variant:"ghost",className:"flex-1 justify-start rounded-md bg-transparent px-0 hover:bg-transparent",children:w.jsxs("span",{className:"flex items-center gap-2",children:[C.pinned?w.jsx(YT,{className:"h-3 w-3 text-muted-foreground"}):null,w.jsxs("span",{className:"flex flex-col items-start gap-0.5 leading-tight",children:[w.jsx("span",{className:"flex items-center gap-1",children:C.displayName??C.name}),w.jsx("span",{className:"text-[10px] text-muted-foreground",children:C.name})]})]})}),w.jsxs("div",{className:"relative",ref:y===C.name?b:null,children:[w.jsx(ze,{type:"button",size:"icon",variant:"ghost",className:"rounded-md bg-transparent hover:bg-transparent",onClick:()=>g(C.name),"aria-expanded":y===C.name,"aria-haspopup":"menu",children:w.jsx(qL,{className:"h-4 w-4"})}),y===C.name?w.jsxs("div",{className:"absolute right-0 z-20 mt-2 w-40 rounded-md border border-border bg-card p-1 text-sm shadow-lg",children:[w.jsx("button",{type:"button",className:"flex w-full items-center justify-between rounded px-2 py-1 text-left hover:bg-accent",onClick:()=>x(C,"pin"),children:C.pinned?"Unpin":"Pin"}),w.jsx("button",{type:"button",className:"flex w-full items-center justify-between rounded px-2 py-1 text-left hover:bg-accent",onClick:()=>x(C,"archive"),children:"Archive"}),w.jsx("button",{type:"button",className:"flex w-full items-center justify-between rounded px-2 py-1 text-left hover:bg-accent",onClick:()=>x(C,"delete"),children:"Delete"})]}):null]})]},C.name))})})]})]})})}/**
307
- * table-core
308
- *
309
- * Copyright (c) TanStack
310
- *
311
- * This source code is licensed under the MIT license found in the
312
- * LICENSE.md file in the root directory of this source tree.
313
- *
314
- * @license MIT
315
- */function oi(t,e){return typeof t=="function"?t(e):t}function Pn(t,e){return n=>{e.setState(r=>({...r,[t]:oi(n,r[t])}))}}function ep(t){return t instanceof Function}function tF(t){return Array.isArray(t)&&t.every(e=>typeof e=="number")}function tM(t,e){const n=[],r=s=>{s.forEach(i=>{n.push(i);const o=e(i);o!=null&&o.length&&r(o)})};return r(t),n}function fe(t,e,n){let r=[],s;return i=>{let o;n.key&&n.debug&&(o=Date.now());const l=t(i);if(!(l.length!==r.length||l.some((c,d)=>r[d]!==c)))return s;r=l;let u;if(n.key&&n.debug&&(u=Date.now()),s=e(...l),n==null||n.onChange==null||n.onChange(s),n.key&&n.debug&&n!=null&&n.debug()){const c=Math.round((Date.now()-o)*100)/100,d=Math.round((Date.now()-u)*100)/100,f=d/16,h=(p,m)=>{for(p=String(p);p.length<m;)p=" "+p;return p};console.info(`%c⏱ ${h(d,5)} /${h(c,5)} ms`,`
316
- font-size: .6rem;
317
- font-weight: bold;
318
- color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,n==null?void 0:n.key)}return s}}function he(t,e,n,r){return{debug:()=>{var s;return(s=t==null?void 0:t.debugAll)!=null?s:t[e]},key:!1,onChange:r}}function nF(t,e,n,r){const s=()=>{var o;return(o=i.getValue())!=null?o:t.options.renderFallbackValue},i={id:`${e.id}_${n.id}`,row:e,column:n,getValue:()=>e.getValue(r),renderValue:s,getContext:fe(()=>[t,n,e,i],(o,l,a,u)=>({table:o,column:l,row:a,cell:u,getValue:u.getValue,renderValue:u.renderValue}),he(t.options,"debugCells"))};return t._features.forEach(o=>{o.createCell==null||o.createCell(i,n,e,t)},{}),i}function rF(t,e,n,r){var s,i;const l={...t._getDefaultColumnDef(),...e},a=l.accessorKey;let u=(s=(i=l.id)!=null?i:a?typeof String.prototype.replaceAll=="function"?a.replaceAll(".","_"):a.replace(/\./g,"_"):void 0)!=null?s:typeof l.header=="string"?l.header:void 0,c;if(l.accessorFn?c=l.accessorFn:a&&(a.includes(".")?c=f=>{let h=f;for(const m of a.split(".")){var p;h=(p=h)==null?void 0:p[m]}return h}:c=f=>f[l.accessorKey]),!u)throw new Error;let d={id:`${String(u)}`,accessorFn:c,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:fe(()=>[!0],()=>{var f;return[d,...(f=d.columns)==null?void 0:f.flatMap(h=>h.getFlatColumns())]},he(t.options,"debugColumns")),getLeafColumns:fe(()=>[t._getOrderColumnsFn()],f=>{var h;if((h=d.columns)!=null&&h.length){let p=d.columns.flatMap(m=>m.getLeafColumns());return f(p)}return[d]},he(t.options,"debugColumns"))};for(const f of t._features)f.createColumn==null||f.createColumn(d,t);return d}const qt="debugHeaders";function kb(t,e,n){var r;let i={id:(r=n.id)!=null?r:e.id,column:e,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const o=[],l=a=>{a.subHeaders&&a.subHeaders.length&&a.subHeaders.map(l),o.push(a)};return l(i),o},getContext:()=>({table:t,header:i,column:e})};return t._features.forEach(o=>{o.createHeader==null||o.createHeader(i,t)}),i}const sF={createTable:t=>{t.getHeaderGroups=fe(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,s)=>{var i,o;const l=(i=r==null?void 0:r.map(d=>n.find(f=>f.id===d)).filter(Boolean))!=null?i:[],a=(o=s==null?void 0:s.map(d=>n.find(f=>f.id===d)).filter(Boolean))!=null?o:[],u=n.filter(d=>!(r!=null&&r.includes(d.id))&&!(s!=null&&s.includes(d.id)));return sd(e,[...l,...u,...a],t)},he(t.options,qt)),t.getCenterHeaderGroups=fe(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r,s)=>(n=n.filter(i=>!(r!=null&&r.includes(i.id))&&!(s!=null&&s.includes(i.id))),sd(e,n,t,"center")),he(t.options,qt)),t.getLeftHeaderGroups=fe(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left],(e,n,r)=>{var s;const i=(s=r==null?void 0:r.map(o=>n.find(l=>l.id===o)).filter(Boolean))!=null?s:[];return sd(e,i,t,"left")},he(t.options,qt)),t.getRightHeaderGroups=fe(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.right],(e,n,r)=>{var s;const i=(s=r==null?void 0:r.map(o=>n.find(l=>l.id===o)).filter(Boolean))!=null?s:[];return sd(e,i,t,"right")},he(t.options,qt)),t.getFooterGroups=fe(()=>[t.getHeaderGroups()],e=>[...e].reverse(),he(t.options,qt)),t.getLeftFooterGroups=fe(()=>[t.getLeftHeaderGroups()],e=>[...e].reverse(),he(t.options,qt)),t.getCenterFooterGroups=fe(()=>[t.getCenterHeaderGroups()],e=>[...e].reverse(),he(t.options,qt)),t.getRightFooterGroups=fe(()=>[t.getRightHeaderGroups()],e=>[...e].reverse(),he(t.options,qt)),t.getFlatHeaders=fe(()=>[t.getHeaderGroups()],e=>e.map(n=>n.headers).flat(),he(t.options,qt)),t.getLeftFlatHeaders=fe(()=>[t.getLeftHeaderGroups()],e=>e.map(n=>n.headers).flat(),he(t.options,qt)),t.getCenterFlatHeaders=fe(()=>[t.getCenterHeaderGroups()],e=>e.map(n=>n.headers).flat(),he(t.options,qt)),t.getRightFlatHeaders=fe(()=>[t.getRightHeaderGroups()],e=>e.map(n=>n.headers).flat(),he(t.options,qt)),t.getCenterLeafHeaders=fe(()=>[t.getCenterFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),he(t.options,qt)),t.getLeftLeafHeaders=fe(()=>[t.getLeftFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),he(t.options,qt)),t.getRightLeafHeaders=fe(()=>[t.getRightFlatHeaders()],e=>e.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),he(t.options,qt)),t.getLeafHeaders=fe(()=>[t.getLeftHeaderGroups(),t.getCenterHeaderGroups(),t.getRightHeaderGroups()],(e,n,r)=>{var s,i,o,l,a,u;return[...(s=(i=e[0])==null?void 0:i.headers)!=null?s:[],...(o=(l=n[0])==null?void 0:l.headers)!=null?o:[],...(a=(u=r[0])==null?void 0:u.headers)!=null?a:[]].map(c=>c.getLeafHeaders()).flat()},he(t.options,qt))}};function sd(t,e,n,r){var s,i;let o=0;const l=function(f,h){h===void 0&&(h=1),o=Math.max(o,h),f.filter(p=>p.getIsVisible()).forEach(p=>{var m;(m=p.columns)!=null&&m.length&&l(p.columns,h+1)},0)};l(t);let a=[];const u=(f,h)=>{const p={depth:h,id:[r,`${h}`].filter(Boolean).join("_"),headers:[]},m=[];f.forEach(y=>{const g=[...m].reverse()[0],x=y.column.depth===p.depth;let k,b=!1;if(x&&y.column.parent?k=y.column.parent:(k=y.column,b=!0),g&&(g==null?void 0:g.column)===k)g.subHeaders.push(y);else{const S=kb(n,k,{id:[r,h,k.id,y==null?void 0:y.id].filter(Boolean).join("_"),isPlaceholder:b,placeholderId:b?`${m.filter(C=>C.column===k).length}`:void 0,depth:h,index:m.length});S.subHeaders.push(y),m.push(S)}p.headers.push(y),y.headerGroup=p}),a.push(p),h>0&&u(m,h-1)},c=e.map((f,h)=>kb(n,f,{depth:o,index:h}));u(c,o-1),a.reverse();const d=f=>f.filter(p=>p.column.getIsVisible()).map(p=>{let m=0,y=0,g=[0];p.subHeaders&&p.subHeaders.length?(g=[],d(p.subHeaders).forEach(k=>{let{colSpan:b,rowSpan:S}=k;m+=b,g.push(S)})):m=1;const x=Math.min(...g);return y=y+x,p.colSpan=m,p.rowSpan=y,{colSpan:m,rowSpan:y}});return d((s=(i=a[0])==null?void 0:i.headers)!=null?s:[]),a}const tp=(t,e,n,r,s,i,o)=>{let l={id:e,index:r,original:n,depth:s,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:a=>{if(l._valuesCache.hasOwnProperty(a))return l._valuesCache[a];const u=t.getColumn(a);if(u!=null&&u.accessorFn)return l._valuesCache[a]=u.accessorFn(l.original,r),l._valuesCache[a]},getUniqueValues:a=>{if(l._uniqueValuesCache.hasOwnProperty(a))return l._uniqueValuesCache[a];const u=t.getColumn(a);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(l._uniqueValuesCache[a]=u.columnDef.getUniqueValues(l.original,r),l._uniqueValuesCache[a]):(l._uniqueValuesCache[a]=[l.getValue(a)],l._uniqueValuesCache[a])},renderValue:a=>{var u;return(u=l.getValue(a))!=null?u:t.options.renderFallbackValue},subRows:i??[],getLeafRows:()=>tM(l.subRows,a=>a.subRows),getParentRow:()=>l.parentId?t.getRow(l.parentId,!0):void 0,getParentRows:()=>{let a=[],u=l;for(;;){const c=u.getParentRow();if(!c)break;a.push(c),u=c}return a.reverse()},getAllCells:fe(()=>[t.getAllLeafColumns()],a=>a.map(u=>nF(t,l,u,u.id)),he(t.options,"debugRows")),_getAllCellsByColumnId:fe(()=>[l.getAllCells()],a=>a.reduce((u,c)=>(u[c.column.id]=c,u),{}),he(t.options,"debugRows"))};for(let a=0;a<t._features.length;a++){const u=t._features[a];u==null||u.createRow==null||u.createRow(l,t)}return l},iF={createColumn:(t,e)=>{t._getFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,t.id),t.getFacetedRowModel=()=>t._getFacetedRowModel?t._getFacetedRowModel():e.getPreFilteredRowModel(),t._getFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,t.id),t.getFacetedUniqueValues=()=>t._getFacetedUniqueValues?t._getFacetedUniqueValues():new Map,t._getFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,t.id),t.getFacetedMinMaxValues=()=>{if(t._getFacetedMinMaxValues)return t._getFacetedMinMaxValues()}}},nM=(t,e,n)=>{var r,s;const i=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((s=t.getValue(e))==null||(s=s.toString())==null||(s=s.toLowerCase())==null)&&s.includes(i))};nM.autoRemove=t=>xr(t);const rM=(t,e,n)=>{var r;return!!(!((r=t.getValue(e))==null||(r=r.toString())==null)&&r.includes(n))};rM.autoRemove=t=>xr(t);const sM=(t,e,n)=>{var r;return((r=t.getValue(e))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};sM.autoRemove=t=>xr(t);const iM=(t,e,n)=>{var r;return(r=t.getValue(e))==null?void 0:r.includes(n)};iM.autoRemove=t=>xr(t);const oM=(t,e,n)=>!n.some(r=>{var s;return!((s=t.getValue(e))!=null&&s.includes(r))});oM.autoRemove=t=>xr(t)||!(t!=null&&t.length);const lM=(t,e,n)=>n.some(r=>{var s;return(s=t.getValue(e))==null?void 0:s.includes(r)});lM.autoRemove=t=>xr(t)||!(t!=null&&t.length);const aM=(t,e,n)=>t.getValue(e)===n;aM.autoRemove=t=>xr(t);const uM=(t,e,n)=>t.getValue(e)==n;uM.autoRemove=t=>xr(t);const D0=(t,e,n)=>{let[r,s]=n;const i=t.getValue(e);return i>=r&&i<=s};D0.resolveFilterValue=t=>{let[e,n]=t,r=typeof e!="number"?parseFloat(e):e,s=typeof n!="number"?parseFloat(n):n,i=e===null||Number.isNaN(r)?-1/0:r,o=n===null||Number.isNaN(s)?1/0:s;if(i>o){const l=i;i=o,o=l}return[i,o]};D0.autoRemove=t=>xr(t)||xr(t[0])&&xr(t[1]);const ls={includesString:nM,includesStringSensitive:rM,equalsString:sM,arrIncludes:iM,arrIncludesAll:oM,arrIncludesSome:lM,equals:aM,weakEquals:uM,inNumberRange:D0};function xr(t){return t==null||t===""}const oF={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:t=>({columnFilters:[],...t}),getDefaultOptions:t=>({onColumnFiltersChange:Pn("columnFilters",t),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(t,e)=>{t.getAutoFilterFn=()=>{const n=e.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(t.id);return typeof r=="string"?ls.includesString:typeof r=="number"?ls.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?ls.equals:Array.isArray(r)?ls.arrIncludes:ls.weakEquals},t.getFilterFn=()=>{var n,r;return ep(t.columnDef.filterFn)?t.columnDef.filterFn:t.columnDef.filterFn==="auto"?t.getAutoFilterFn():(n=(r=e.options.filterFns)==null?void 0:r[t.columnDef.filterFn])!=null?n:ls[t.columnDef.filterFn]},t.getCanFilter=()=>{var n,r,s;return((n=t.columnDef.enableColumnFilter)!=null?n:!0)&&((r=e.options.enableColumnFilters)!=null?r:!0)&&((s=e.options.enableFilters)!=null?s:!0)&&!!t.accessorFn},t.getIsFiltered=()=>t.getFilterIndex()>-1,t.getFilterValue=()=>{var n;return(n=e.getState().columnFilters)==null||(n=n.find(r=>r.id===t.id))==null?void 0:n.value},t.getFilterIndex=()=>{var n,r;return(n=(r=e.getState().columnFilters)==null?void 0:r.findIndex(s=>s.id===t.id))!=null?n:-1},t.setFilterValue=n=>{e.setColumnFilters(r=>{const s=t.getFilterFn(),i=r==null?void 0:r.find(c=>c.id===t.id),o=oi(n,i?i.value:void 0);if(bb(s,o,t)){var l;return(l=r==null?void 0:r.filter(c=>c.id!==t.id))!=null?l:[]}const a={id:t.id,value:o};if(i){var u;return(u=r==null?void 0:r.map(c=>c.id===t.id?a:c))!=null?u:[]}return r!=null&&r.length?[...r,a]:[a]})}},createRow:(t,e)=>{t.columnFilters={},t.columnFiltersMeta={}},createTable:t=>{t.setColumnFilters=e=>{const n=t.getAllLeafColumns(),r=s=>{var i;return(i=oi(e,s))==null?void 0:i.filter(o=>{const l=n.find(a=>a.id===o.id);if(l){const a=l.getFilterFn();if(bb(a,o.value,l))return!1}return!0})};t.options.onColumnFiltersChange==null||t.options.onColumnFiltersChange(r)},t.resetColumnFilters=e=>{var n,r;t.setColumnFilters(e?[]:(n=(r=t.initialState)==null?void 0:r.columnFilters)!=null?n:[])},t.getPreFilteredRowModel=()=>t.getCoreRowModel(),t.getFilteredRowModel=()=>(!t._getFilteredRowModel&&t.options.getFilteredRowModel&&(t._getFilteredRowModel=t.options.getFilteredRowModel(t)),t.options.manualFiltering||!t._getFilteredRowModel?t.getPreFilteredRowModel():t._getFilteredRowModel())}};function bb(t,e,n){return(t&&t.autoRemove?t.autoRemove(e,n):!1)||typeof e>"u"||typeof e=="string"&&!e}const lF=(t,e,n)=>n.reduce((r,s)=>{const i=s.getValue(t);return r+(typeof i=="number"?i:0)},0),aF=(t,e,n)=>{let r;return n.forEach(s=>{const i=s.getValue(t);i!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}),r},uF=(t,e,n)=>{let r;return n.forEach(s=>{const i=s.getValue(t);i!=null&&(r<i||r===void 0&&i>=i)&&(r=i)}),r},cF=(t,e,n)=>{let r,s;return n.forEach(i=>{const o=i.getValue(t);o!=null&&(r===void 0?o>=o&&(r=s=o):(r>o&&(r=o),s<o&&(s=o)))}),[r,s]},dF=(t,e)=>{let n=0,r=0;if(e.forEach(s=>{let i=s.getValue(t);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},fF=(t,e)=>{if(!e.length)return;const n=e.map(i=>i.getValue(t));if(!tF(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),s=n.sort((i,o)=>i-o);return n.length%2!==0?s[r]:(s[r-1]+s[r])/2},hF=(t,e)=>Array.from(new Set(e.map(n=>n.getValue(t))).values()),pF=(t,e)=>new Set(e.map(n=>n.getValue(t))).size,mF=(t,e)=>e.length,bm={sum:lF,min:aF,max:uF,extent:cF,mean:dF,median:fF,unique:hF,uniqueCount:pF,count:mF},gF={getDefaultColumnDef:()=>({aggregatedCell:t=>{var e,n;return(e=(n=t.getValue())==null||n.toString==null?void 0:n.toString())!=null?e:null},aggregationFn:"auto"}),getInitialState:t=>({grouping:[],...t}),getDefaultOptions:t=>({onGroupingChange:Pn("grouping",t),groupedColumnMode:"reorder"}),createColumn:(t,e)=>{t.toggleGrouping=()=>{e.setGrouping(n=>n!=null&&n.includes(t.id)?n.filter(r=>r!==t.id):[...n??[],t.id])},t.getCanGroup=()=>{var n,r;return((n=t.columnDef.enableGrouping)!=null?n:!0)&&((r=e.options.enableGrouping)!=null?r:!0)&&(!!t.accessorFn||!!t.columnDef.getGroupingValue)},t.getIsGrouped=()=>{var n;return(n=e.getState().grouping)==null?void 0:n.includes(t.id)},t.getGroupedIndex=()=>{var n;return(n=e.getState().grouping)==null?void 0:n.indexOf(t.id)},t.getToggleGroupingHandler=()=>{const n=t.getCanGroup();return()=>{n&&t.toggleGrouping()}},t.getAutoAggregationFn=()=>{const n=e.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(t.id);if(typeof r=="number")return bm.sum;if(Object.prototype.toString.call(r)==="[object Date]")return bm.extent},t.getAggregationFn=()=>{var n,r;if(!t)throw new Error;return ep(t.columnDef.aggregationFn)?t.columnDef.aggregationFn:t.columnDef.aggregationFn==="auto"?t.getAutoAggregationFn():(n=(r=e.options.aggregationFns)==null?void 0:r[t.columnDef.aggregationFn])!=null?n:bm[t.columnDef.aggregationFn]}},createTable:t=>{t.setGrouping=e=>t.options.onGroupingChange==null?void 0:t.options.onGroupingChange(e),t.resetGrouping=e=>{var n,r;t.setGrouping(e?[]:(n=(r=t.initialState)==null?void 0:r.grouping)!=null?n:[])},t.getPreGroupedRowModel=()=>t.getFilteredRowModel(),t.getGroupedRowModel=()=>(!t._getGroupedRowModel&&t.options.getGroupedRowModel&&(t._getGroupedRowModel=t.options.getGroupedRowModel(t)),t.options.manualGrouping||!t._getGroupedRowModel?t.getPreGroupedRowModel():t._getGroupedRowModel())},createRow:(t,e)=>{t.getIsGrouped=()=>!!t.groupingColumnId,t.getGroupingValue=n=>{if(t._groupingValuesCache.hasOwnProperty(n))return t._groupingValuesCache[n];const r=e.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(t._groupingValuesCache[n]=r.columnDef.getGroupingValue(t.original),t._groupingValuesCache[n]):t.getValue(n)},t._groupingValuesCache={}},createCell:(t,e,n,r)=>{t.getIsGrouped=()=>e.getIsGrouped()&&e.id===n.groupingColumnId,t.getIsPlaceholder=()=>!t.getIsGrouped()&&e.getIsGrouped(),t.getIsAggregated=()=>{var s;return!t.getIsGrouped()&&!t.getIsPlaceholder()&&!!((s=n.subRows)!=null&&s.length)}}};function yF(t,e,n){if(!(e!=null&&e.length)||!n)return t;const r=t.filter(i=>!e.includes(i.id));return n==="remove"?r:[...e.map(i=>t.find(o=>o.id===i)).filter(Boolean),...r]}const vF={getInitialState:t=>({columnOrder:[],...t}),getDefaultOptions:t=>({onColumnOrderChange:Pn("columnOrder",t)}),createColumn:(t,e)=>{t.getIndex=fe(n=>[fu(e,n)],n=>n.findIndex(r=>r.id===t.id),he(e.options,"debugColumns")),t.getIsFirstColumn=n=>{var r;return((r=fu(e,n)[0])==null?void 0:r.id)===t.id},t.getIsLastColumn=n=>{var r;const s=fu(e,n);return((r=s[s.length-1])==null?void 0:r.id)===t.id}},createTable:t=>{t.setColumnOrder=e=>t.options.onColumnOrderChange==null?void 0:t.options.onColumnOrderChange(e),t.resetColumnOrder=e=>{var n;t.setColumnOrder(e?[]:(n=t.initialState.columnOrder)!=null?n:[])},t._getOrderColumnsFn=fe(()=>[t.getState().columnOrder,t.getState().grouping,t.options.groupedColumnMode],(e,n,r)=>s=>{let i=[];if(!(e!=null&&e.length))i=s;else{const o=[...e],l=[...s];for(;l.length&&o.length;){const a=o.shift(),u=l.findIndex(c=>c.id===a);u>-1&&i.push(l.splice(u,1)[0])}i=[...i,...l]}return yF(i,n,r)},he(t.options,"debugTable"))}},Sm=()=>({left:[],right:[]}),xF={getInitialState:t=>({columnPinning:Sm(),...t}),getDefaultOptions:t=>({onColumnPinningChange:Pn("columnPinning",t)}),createColumn:(t,e)=>{t.pin=n=>{const r=t.getLeafColumns().map(s=>s.id).filter(Boolean);e.setColumnPinning(s=>{var i,o;if(n==="right"){var l,a;return{left:((l=s==null?void 0:s.left)!=null?l:[]).filter(d=>!(r!=null&&r.includes(d))),right:[...((a=s==null?void 0:s.right)!=null?a:[]).filter(d=>!(r!=null&&r.includes(d))),...r]}}if(n==="left"){var u,c;return{left:[...((u=s==null?void 0:s.left)!=null?u:[]).filter(d=>!(r!=null&&r.includes(d))),...r],right:((c=s==null?void 0:s.right)!=null?c:[]).filter(d=>!(r!=null&&r.includes(d)))}}return{left:((i=s==null?void 0:s.left)!=null?i:[]).filter(d=>!(r!=null&&r.includes(d))),right:((o=s==null?void 0:s.right)!=null?o:[]).filter(d=>!(r!=null&&r.includes(d)))}})},t.getCanPin=()=>t.getLeafColumns().some(r=>{var s,i,o;return((s=r.columnDef.enablePinning)!=null?s:!0)&&((i=(o=e.options.enableColumnPinning)!=null?o:e.options.enablePinning)!=null?i:!0)}),t.getIsPinned=()=>{const n=t.getLeafColumns().map(l=>l.id),{left:r,right:s}=e.getState().columnPinning,i=n.some(l=>r==null?void 0:r.includes(l)),o=n.some(l=>s==null?void 0:s.includes(l));return i?"left":o?"right":!1},t.getPinnedIndex=()=>{var n,r;const s=t.getIsPinned();return s?(n=(r=e.getState().columnPinning)==null||(r=r[s])==null?void 0:r.indexOf(t.id))!=null?n:-1:0}},createRow:(t,e)=>{t.getCenterVisibleCells=fe(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,r,s)=>{const i=[...r??[],...s??[]];return n.filter(o=>!i.includes(o.column.id))},he(e.options,"debugRows")),t.getLeftVisibleCells=fe(()=>[t._getAllVisibleCells(),e.getState().columnPinning.left],(n,r)=>(r??[]).map(i=>n.find(o=>o.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),he(e.options,"debugRows")),t.getRightVisibleCells=fe(()=>[t._getAllVisibleCells(),e.getState().columnPinning.right],(n,r)=>(r??[]).map(i=>n.find(o=>o.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),he(e.options,"debugRows"))},createTable:t=>{t.setColumnPinning=e=>t.options.onColumnPinningChange==null?void 0:t.options.onColumnPinningChange(e),t.resetColumnPinning=e=>{var n,r;return t.setColumnPinning(e?Sm():(n=(r=t.initialState)==null?void 0:r.columnPinning)!=null?n:Sm())},t.getIsSomeColumnsPinned=e=>{var n;const r=t.getState().columnPinning;if(!e){var s,i;return!!((s=r.left)!=null&&s.length||(i=r.right)!=null&&i.length)}return!!((n=r[e])!=null&&n.length)},t.getLeftLeafColumns=fe(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left],(e,n)=>(n??[]).map(r=>e.find(s=>s.id===r)).filter(Boolean),he(t.options,"debugColumns")),t.getRightLeafColumns=fe(()=>[t.getAllLeafColumns(),t.getState().columnPinning.right],(e,n)=>(n??[]).map(r=>e.find(s=>s.id===r)).filter(Boolean),he(t.options,"debugColumns")),t.getCenterLeafColumns=fe(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,n,r)=>{const s=[...n??[],...r??[]];return e.filter(i=>!s.includes(i.id))},he(t.options,"debugColumns"))}};function wF(t){return t||(typeof document<"u"?document:null)}const id={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Cm=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),kF={getDefaultColumnDef:()=>id,getInitialState:t=>({columnSizing:{},columnSizingInfo:Cm(),...t}),getDefaultOptions:t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Pn("columnSizing",t),onColumnSizingInfoChange:Pn("columnSizingInfo",t)}),createColumn:(t,e)=>{t.getSize=()=>{var n,r,s;const i=e.getState().columnSizing[t.id];return Math.min(Math.max((n=t.columnDef.minSize)!=null?n:id.minSize,(r=i??t.columnDef.size)!=null?r:id.size),(s=t.columnDef.maxSize)!=null?s:id.maxSize)},t.getStart=fe(n=>[n,fu(e,n),e.getState().columnSizing],(n,r)=>r.slice(0,t.getIndex(n)).reduce((s,i)=>s+i.getSize(),0),he(e.options,"debugColumns")),t.getAfter=fe(n=>[n,fu(e,n),e.getState().columnSizing],(n,r)=>r.slice(t.getIndex(n)+1).reduce((s,i)=>s+i.getSize(),0),he(e.options,"debugColumns")),t.resetSize=()=>{e.setColumnSizing(n=>{let{[t.id]:r,...s}=n;return s})},t.getCanResize=()=>{var n,r;return((n=t.columnDef.enableResizing)!=null?n:!0)&&((r=e.options.enableColumnResizing)!=null?r:!0)},t.getIsResizing=()=>e.getState().columnSizingInfo.isResizingColumn===t.id},createHeader:(t,e)=>{t.getSize=()=>{let n=0;const r=s=>{if(s.subHeaders.length)s.subHeaders.forEach(r);else{var i;n+=(i=s.column.getSize())!=null?i:0}};return r(t),n},t.getStart=()=>{if(t.index>0){const n=t.headerGroup.headers[t.index-1];return n.getStart()+n.getSize()}return 0},t.getResizeHandler=n=>{const r=e.getColumn(t.column.id),s=r==null?void 0:r.getCanResize();return i=>{if(!r||!s||(i.persist==null||i.persist(),Em(i)&&i.touches&&i.touches.length>1))return;const o=t.getSize(),l=t?t.getLeafHeaders().map(g=>[g.column.id,g.column.getSize()]):[[r.id,r.getSize()]],a=Em(i)?Math.round(i.touches[0].clientX):i.clientX,u={},c=(g,x)=>{typeof x=="number"&&(e.setColumnSizingInfo(k=>{var b,S;const C=e.options.columnResizeDirection==="rtl"?-1:1,E=(x-((b=k==null?void 0:k.startOffset)!=null?b:0))*C,T=Math.max(E/((S=k==null?void 0:k.startSize)!=null?S:0),-.999999);return k.columnSizingStart.forEach(N=>{let[O,H]=N;u[O]=Math.round(Math.max(H+H*T,0)*100)/100}),{...k,deltaOffset:E,deltaPercentage:T}}),(e.options.columnResizeMode==="onChange"||g==="end")&&e.setColumnSizing(k=>({...k,...u})))},d=g=>c("move",g),f=g=>{c("end",g),e.setColumnSizingInfo(x=>({...x,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},h=wF(n),p={moveHandler:g=>d(g.clientX),upHandler:g=>{h==null||h.removeEventListener("mousemove",p.moveHandler),h==null||h.removeEventListener("mouseup",p.upHandler),f(g.clientX)}},m={moveHandler:g=>(g.cancelable&&(g.preventDefault(),g.stopPropagation()),d(g.touches[0].clientX),!1),upHandler:g=>{var x;h==null||h.removeEventListener("touchmove",m.moveHandler),h==null||h.removeEventListener("touchend",m.upHandler),g.cancelable&&(g.preventDefault(),g.stopPropagation()),f((x=g.touches[0])==null?void 0:x.clientX)}},y=bF()?{passive:!1}:!1;Em(i)?(h==null||h.addEventListener("touchmove",m.moveHandler,y),h==null||h.addEventListener("touchend",m.upHandler,y)):(h==null||h.addEventListener("mousemove",p.moveHandler,y),h==null||h.addEventListener("mouseup",p.upHandler,y)),e.setColumnSizingInfo(g=>({...g,startOffset:a,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:r.id}))}}},createTable:t=>{t.setColumnSizing=e=>t.options.onColumnSizingChange==null?void 0:t.options.onColumnSizingChange(e),t.setColumnSizingInfo=e=>t.options.onColumnSizingInfoChange==null?void 0:t.options.onColumnSizingInfoChange(e),t.resetColumnSizing=e=>{var n;t.setColumnSizing(e?{}:(n=t.initialState.columnSizing)!=null?n:{})},t.resetHeaderSizeInfo=e=>{var n;t.setColumnSizingInfo(e?Cm():(n=t.initialState.columnSizingInfo)!=null?n:Cm())},t.getTotalSize=()=>{var e,n;return(e=(n=t.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?e:0},t.getLeftTotalSize=()=>{var e,n;return(e=(n=t.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?e:0},t.getCenterTotalSize=()=>{var e,n;return(e=(n=t.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?e:0},t.getRightTotalSize=()=>{var e,n;return(e=(n=t.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,s)=>r+s.getSize(),0))!=null?e:0}}};let od=null;function bF(){if(typeof od=="boolean")return od;let t=!1;try{const e={get passive(){return t=!0,!1}},n=()=>{};window.addEventListener("test",n,e),window.removeEventListener("test",n)}catch{t=!1}return od=t,od}function Em(t){return t.type==="touchstart"}const SF={getInitialState:t=>({columnVisibility:{},...t}),getDefaultOptions:t=>({onColumnVisibilityChange:Pn("columnVisibility",t)}),createColumn:(t,e)=>{t.toggleVisibility=n=>{t.getCanHide()&&e.setColumnVisibility(r=>({...r,[t.id]:n??!t.getIsVisible()}))},t.getIsVisible=()=>{var n,r;const s=t.columns;return(n=s.length?s.some(i=>i.getIsVisible()):(r=e.getState().columnVisibility)==null?void 0:r[t.id])!=null?n:!0},t.getCanHide=()=>{var n,r;return((n=t.columnDef.enableHiding)!=null?n:!0)&&((r=e.options.enableHiding)!=null?r:!0)},t.getToggleVisibilityHandler=()=>n=>{t.toggleVisibility==null||t.toggleVisibility(n.target.checked)}},createRow:(t,e)=>{t._getAllVisibleCells=fe(()=>[t.getAllCells(),e.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),he(e.options,"debugRows")),t.getVisibleCells=fe(()=>[t.getLeftVisibleCells(),t.getCenterVisibleCells(),t.getRightVisibleCells()],(n,r,s)=>[...n,...r,...s],he(e.options,"debugRows"))},createTable:t=>{const e=(n,r)=>fe(()=>[r(),r().filter(s=>s.getIsVisible()).map(s=>s.id).join("_")],s=>s.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),he(t.options,"debugColumns"));t.getVisibleFlatColumns=e("getVisibleFlatColumns",()=>t.getAllFlatColumns()),t.getVisibleLeafColumns=e("getVisibleLeafColumns",()=>t.getAllLeafColumns()),t.getLeftVisibleLeafColumns=e("getLeftVisibleLeafColumns",()=>t.getLeftLeafColumns()),t.getRightVisibleLeafColumns=e("getRightVisibleLeafColumns",()=>t.getRightLeafColumns()),t.getCenterVisibleLeafColumns=e("getCenterVisibleLeafColumns",()=>t.getCenterLeafColumns()),t.setColumnVisibility=n=>t.options.onColumnVisibilityChange==null?void 0:t.options.onColumnVisibilityChange(n),t.resetColumnVisibility=n=>{var r;t.setColumnVisibility(n?{}:(r=t.initialState.columnVisibility)!=null?r:{})},t.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!t.getIsAllColumnsVisible(),t.setColumnVisibility(t.getAllLeafColumns().reduce((s,i)=>({...s,[i.id]:n||!(i.getCanHide!=null&&i.getCanHide())}),{}))},t.getIsAllColumnsVisible=()=>!t.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),t.getIsSomeColumnsVisible=()=>t.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),t.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;t.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function fu(t,e){return e?e==="center"?t.getCenterVisibleLeafColumns():e==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns()}const CF={createTable:t=>{t._getGlobalFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,"__global__"),t.getGlobalFacetedRowModel=()=>t.options.manualFiltering||!t._getGlobalFacetedRowModel?t.getPreFilteredRowModel():t._getGlobalFacetedRowModel(),t._getGlobalFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,"__global__"),t.getGlobalFacetedUniqueValues=()=>t._getGlobalFacetedUniqueValues?t._getGlobalFacetedUniqueValues():new Map,t._getGlobalFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,"__global__"),t.getGlobalFacetedMinMaxValues=()=>{if(t._getGlobalFacetedMinMaxValues)return t._getGlobalFacetedMinMaxValues()}}},EF={getInitialState:t=>({globalFilter:void 0,...t}),getDefaultOptions:t=>({onGlobalFilterChange:Pn("globalFilter",t),globalFilterFn:"auto",getColumnCanGlobalFilter:e=>{var n;const r=(n=t.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[e.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(t,e)=>{t.getCanGlobalFilter=()=>{var n,r,s,i;return((n=t.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=e.options.enableGlobalFilter)!=null?r:!0)&&((s=e.options.enableFilters)!=null?s:!0)&&((i=e.options.getColumnCanGlobalFilter==null?void 0:e.options.getColumnCanGlobalFilter(t))!=null?i:!0)&&!!t.accessorFn}},createTable:t=>{t.getGlobalAutoFilterFn=()=>ls.includesString,t.getGlobalFilterFn=()=>{var e,n;const{globalFilterFn:r}=t.options;return ep(r)?r:r==="auto"?t.getGlobalAutoFilterFn():(e=(n=t.options.filterFns)==null?void 0:n[r])!=null?e:ls[r]},t.setGlobalFilter=e=>{t.options.onGlobalFilterChange==null||t.options.onGlobalFilterChange(e)},t.resetGlobalFilter=e=>{t.setGlobalFilter(e?void 0:t.initialState.globalFilter)}}},TF={getInitialState:t=>({expanded:{},...t}),getDefaultOptions:t=>({onExpandedChange:Pn("expanded",t),paginateExpandedRows:!0}),createTable:t=>{let e=!1,n=!1;t._autoResetExpanded=()=>{var r,s;if(!e){t._queue(()=>{e=!0});return}if((r=(s=t.options.autoResetAll)!=null?s:t.options.autoResetExpanded)!=null?r:!t.options.manualExpanding){if(n)return;n=!0,t._queue(()=>{t.resetExpanded(),n=!1})}},t.setExpanded=r=>t.options.onExpandedChange==null?void 0:t.options.onExpandedChange(r),t.toggleAllRowsExpanded=r=>{r??!t.getIsAllRowsExpanded()?t.setExpanded(!0):t.setExpanded({})},t.resetExpanded=r=>{var s,i;t.setExpanded(r?{}:(s=(i=t.initialState)==null?void 0:i.expanded)!=null?s:{})},t.getCanSomeRowsExpand=()=>t.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),t.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),t.toggleAllRowsExpanded()},t.getIsSomeRowsExpanded=()=>{const r=t.getState().expanded;return r===!0||Object.values(r).some(Boolean)},t.getIsAllRowsExpanded=()=>{const r=t.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||t.getRowModel().flatRows.some(s=>!s.getIsExpanded()))},t.getExpandedDepth=()=>{let r=0;return(t.getState().expanded===!0?Object.keys(t.getRowModel().rowsById):Object.keys(t.getState().expanded)).forEach(i=>{const o=i.split(".");r=Math.max(r,o.length)}),r},t.getPreExpandedRowModel=()=>t.getSortedRowModel(),t.getExpandedRowModel=()=>(!t._getExpandedRowModel&&t.options.getExpandedRowModel&&(t._getExpandedRowModel=t.options.getExpandedRowModel(t)),t.options.manualExpanding||!t._getExpandedRowModel?t.getPreExpandedRowModel():t._getExpandedRowModel())},createRow:(t,e)=>{t.toggleExpanded=n=>{e.setExpanded(r=>{var s;const i=r===!0?!0:!!(r!=null&&r[t.id]);let o={};if(r===!0?Object.keys(e.getRowModel().rowsById).forEach(l=>{o[l]=!0}):o=r,n=(s=n)!=null?s:!i,!i&&n)return{...o,[t.id]:!0};if(i&&!n){const{[t.id]:l,...a}=o;return a}return r})},t.getIsExpanded=()=>{var n;const r=e.getState().expanded;return!!((n=e.options.getIsRowExpanded==null?void 0:e.options.getIsRowExpanded(t))!=null?n:r===!0||r!=null&&r[t.id])},t.getCanExpand=()=>{var n,r,s;return(n=e.options.getRowCanExpand==null?void 0:e.options.getRowCanExpand(t))!=null?n:((r=e.options.enableExpanding)!=null?r:!0)&&!!((s=t.subRows)!=null&&s.length)},t.getIsAllParentsExpanded=()=>{let n=!0,r=t;for(;n&&r.parentId;)r=e.getRow(r.parentId,!0),n=r.getIsExpanded();return n},t.getToggleExpandedHandler=()=>{const n=t.getCanExpand();return()=>{n&&t.toggleExpanded()}}}},ky=0,by=10,Tm=()=>({pageIndex:ky,pageSize:by}),RF={getInitialState:t=>({...t,pagination:{...Tm(),...t==null?void 0:t.pagination}}),getDefaultOptions:t=>({onPaginationChange:Pn("pagination",t)}),createTable:t=>{let e=!1,n=!1;t._autoResetPageIndex=()=>{var r,s;if(!e){t._queue(()=>{e=!0});return}if((r=(s=t.options.autoResetAll)!=null?s:t.options.autoResetPageIndex)!=null?r:!t.options.manualPagination){if(n)return;n=!0,t._queue(()=>{t.resetPageIndex(),n=!1})}},t.setPagination=r=>{const s=i=>oi(r,i);return t.options.onPaginationChange==null?void 0:t.options.onPaginationChange(s)},t.resetPagination=r=>{var s;t.setPagination(r?Tm():(s=t.initialState.pagination)!=null?s:Tm())},t.setPageIndex=r=>{t.setPagination(s=>{let i=oi(r,s.pageIndex);const o=typeof t.options.pageCount>"u"||t.options.pageCount===-1?Number.MAX_SAFE_INTEGER:t.options.pageCount-1;return i=Math.max(0,Math.min(i,o)),{...s,pageIndex:i}})},t.resetPageIndex=r=>{var s,i;t.setPageIndex(r?ky:(s=(i=t.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?s:ky)},t.resetPageSize=r=>{var s,i;t.setPageSize(r?by:(s=(i=t.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?s:by)},t.setPageSize=r=>{t.setPagination(s=>{const i=Math.max(1,oi(r,s.pageSize)),o=s.pageSize*s.pageIndex,l=Math.floor(o/i);return{...s,pageIndex:l,pageSize:i}})},t.setPageCount=r=>t.setPagination(s=>{var i;let o=oi(r,(i=t.options.pageCount)!=null?i:-1);return typeof o=="number"&&(o=Math.max(-1,o)),{...s,pageCount:o}}),t.getPageOptions=fe(()=>[t.getPageCount()],r=>{let s=[];return r&&r>0&&(s=[...new Array(r)].fill(null).map((i,o)=>o)),s},he(t.options,"debugTable")),t.getCanPreviousPage=()=>t.getState().pagination.pageIndex>0,t.getCanNextPage=()=>{const{pageIndex:r}=t.getState().pagination,s=t.getPageCount();return s===-1?!0:s===0?!1:r<s-1},t.previousPage=()=>t.setPageIndex(r=>r-1),t.nextPage=()=>t.setPageIndex(r=>r+1),t.firstPage=()=>t.setPageIndex(0),t.lastPage=()=>t.setPageIndex(t.getPageCount()-1),t.getPrePaginationRowModel=()=>t.getExpandedRowModel(),t.getPaginationRowModel=()=>(!t._getPaginationRowModel&&t.options.getPaginationRowModel&&(t._getPaginationRowModel=t.options.getPaginationRowModel(t)),t.options.manualPagination||!t._getPaginationRowModel?t.getPrePaginationRowModel():t._getPaginationRowModel()),t.getPageCount=()=>{var r;return(r=t.options.pageCount)!=null?r:Math.ceil(t.getRowCount()/t.getState().pagination.pageSize)},t.getRowCount=()=>{var r;return(r=t.options.rowCount)!=null?r:t.getPrePaginationRowModel().rows.length}}},Rm=()=>({top:[],bottom:[]}),MF={getInitialState:t=>({rowPinning:Rm(),...t}),getDefaultOptions:t=>({onRowPinningChange:Pn("rowPinning",t)}),createRow:(t,e)=>{t.pin=(n,r,s)=>{const i=r?t.getLeafRows().map(a=>{let{id:u}=a;return u}):[],o=s?t.getParentRows().map(a=>{let{id:u}=a;return u}):[],l=new Set([...o,t.id,...i]);e.setRowPinning(a=>{var u,c;if(n==="bottom"){var d,f;return{top:((d=a==null?void 0:a.top)!=null?d:[]).filter(m=>!(l!=null&&l.has(m))),bottom:[...((f=a==null?void 0:a.bottom)!=null?f:[]).filter(m=>!(l!=null&&l.has(m))),...Array.from(l)]}}if(n==="top"){var h,p;return{top:[...((h=a==null?void 0:a.top)!=null?h:[]).filter(m=>!(l!=null&&l.has(m))),...Array.from(l)],bottom:((p=a==null?void 0:a.bottom)!=null?p:[]).filter(m=>!(l!=null&&l.has(m)))}}return{top:((u=a==null?void 0:a.top)!=null?u:[]).filter(m=>!(l!=null&&l.has(m))),bottom:((c=a==null?void 0:a.bottom)!=null?c:[]).filter(m=>!(l!=null&&l.has(m)))}})},t.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:s}=e.options;return typeof r=="function"?r(t):(n=r??s)!=null?n:!0},t.getIsPinned=()=>{const n=[t.id],{top:r,bottom:s}=e.getState().rowPinning,i=n.some(l=>r==null?void 0:r.includes(l)),o=n.some(l=>s==null?void 0:s.includes(l));return i?"top":o?"bottom":!1},t.getPinnedIndex=()=>{var n,r;const s=t.getIsPinned();if(!s)return-1;const i=(n=s==="top"?e.getTopRows():e.getBottomRows())==null?void 0:n.map(o=>{let{id:l}=o;return l});return(r=i==null?void 0:i.indexOf(t.id))!=null?r:-1}},createTable:t=>{t.setRowPinning=e=>t.options.onRowPinningChange==null?void 0:t.options.onRowPinningChange(e),t.resetRowPinning=e=>{var n,r;return t.setRowPinning(e?Rm():(n=(r=t.initialState)==null?void 0:r.rowPinning)!=null?n:Rm())},t.getIsSomeRowsPinned=e=>{var n;const r=t.getState().rowPinning;if(!e){var s,i;return!!((s=r.top)!=null&&s.length||(i=r.bottom)!=null&&i.length)}return!!((n=r[e])!=null&&n.length)},t._getPinnedRows=(e,n,r)=>{var s;return((s=t.options.keepPinnedRows)==null||s?(n??[]).map(o=>{const l=t.getRow(o,!0);return l.getIsAllParentsExpanded()?l:null}):(n??[]).map(o=>e.find(l=>l.id===o))).filter(Boolean).map(o=>({...o,position:r}))},t.getTopRows=fe(()=>[t.getRowModel().rows,t.getState().rowPinning.top],(e,n)=>t._getPinnedRows(e,n,"top"),he(t.options,"debugRows")),t.getBottomRows=fe(()=>[t.getRowModel().rows,t.getState().rowPinning.bottom],(e,n)=>t._getPinnedRows(e,n,"bottom"),he(t.options,"debugRows")),t.getCenterRows=fe(()=>[t.getRowModel().rows,t.getState().rowPinning.top,t.getState().rowPinning.bottom],(e,n,r)=>{const s=new Set([...n??[],...r??[]]);return e.filter(i=>!s.has(i.id))},he(t.options,"debugRows"))}},NF={getInitialState:t=>({rowSelection:{},...t}),getDefaultOptions:t=>({onRowSelectionChange:Pn("rowSelection",t),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:t=>{t.setRowSelection=e=>t.options.onRowSelectionChange==null?void 0:t.options.onRowSelectionChange(e),t.resetRowSelection=e=>{var n;return t.setRowSelection(e?{}:(n=t.initialState.rowSelection)!=null?n:{})},t.toggleAllRowsSelected=e=>{t.setRowSelection(n=>{e=typeof e<"u"?e:!t.getIsAllRowsSelected();const r={...n},s=t.getPreGroupedRowModel().flatRows;return e?s.forEach(i=>{i.getCanSelect()&&(r[i.id]=!0)}):s.forEach(i=>{delete r[i.id]}),r})},t.toggleAllPageRowsSelected=e=>t.setRowSelection(n=>{const r=typeof e<"u"?e:!t.getIsAllPageRowsSelected(),s={...n};return t.getRowModel().rows.forEach(i=>{Sy(s,i.id,r,!0,t)}),s}),t.getPreSelectedRowModel=()=>t.getCoreRowModel(),t.getSelectedRowModel=fe(()=>[t.getState().rowSelection,t.getCoreRowModel()],(e,n)=>Object.keys(e).length?Mm(t,n):{rows:[],flatRows:[],rowsById:{}},he(t.options,"debugTable")),t.getFilteredSelectedRowModel=fe(()=>[t.getState().rowSelection,t.getFilteredRowModel()],(e,n)=>Object.keys(e).length?Mm(t,n):{rows:[],flatRows:[],rowsById:{}},he(t.options,"debugTable")),t.getGroupedSelectedRowModel=fe(()=>[t.getState().rowSelection,t.getSortedRowModel()],(e,n)=>Object.keys(e).length?Mm(t,n):{rows:[],flatRows:[],rowsById:{}},he(t.options,"debugTable")),t.getIsAllRowsSelected=()=>{const e=t.getFilteredRowModel().flatRows,{rowSelection:n}=t.getState();let r=!!(e.length&&Object.keys(n).length);return r&&e.some(s=>s.getCanSelect()&&!n[s.id])&&(r=!1),r},t.getIsAllPageRowsSelected=()=>{const e=t.getPaginationRowModel().flatRows.filter(s=>s.getCanSelect()),{rowSelection:n}=t.getState();let r=!!e.length;return r&&e.some(s=>!n[s.id])&&(r=!1),r},t.getIsSomeRowsSelected=()=>{var e;const n=Object.keys((e=t.getState().rowSelection)!=null?e:{}).length;return n>0&&n<t.getFilteredRowModel().flatRows.length},t.getIsSomePageRowsSelected=()=>{const e=t.getPaginationRowModel().flatRows;return t.getIsAllPageRowsSelected()?!1:e.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},t.getToggleAllRowsSelectedHandler=()=>e=>{t.toggleAllRowsSelected(e.target.checked)},t.getToggleAllPageRowsSelectedHandler=()=>e=>{t.toggleAllPageRowsSelected(e.target.checked)}},createRow:(t,e)=>{t.toggleSelected=(n,r)=>{const s=t.getIsSelected();e.setRowSelection(i=>{var o;if(n=typeof n<"u"?n:!s,t.getCanSelect()&&s===n)return i;const l={...i};return Sy(l,t.id,n,(o=r==null?void 0:r.selectChildren)!=null?o:!0,e),l})},t.getIsSelected=()=>{const{rowSelection:n}=e.getState();return L0(t,n)},t.getIsSomeSelected=()=>{const{rowSelection:n}=e.getState();return Cy(t,n)==="some"},t.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=e.getState();return Cy(t,n)==="all"},t.getCanSelect=()=>{var n;return typeof e.options.enableRowSelection=="function"?e.options.enableRowSelection(t):(n=e.options.enableRowSelection)!=null?n:!0},t.getCanSelectSubRows=()=>{var n;return typeof e.options.enableSubRowSelection=="function"?e.options.enableSubRowSelection(t):(n=e.options.enableSubRowSelection)!=null?n:!0},t.getCanMultiSelect=()=>{var n;return typeof e.options.enableMultiRowSelection=="function"?e.options.enableMultiRowSelection(t):(n=e.options.enableMultiRowSelection)!=null?n:!0},t.getToggleSelectedHandler=()=>{const n=t.getCanSelect();return r=>{var s;n&&t.toggleSelected((s=r.target)==null?void 0:s.checked)}}}},Sy=(t,e,n,r,s)=>{var i;const o=s.getRow(e,!0);n?(o.getCanMultiSelect()||Object.keys(t).forEach(l=>delete t[l]),o.getCanSelect()&&(t[e]=!0)):delete t[e],r&&(i=o.subRows)!=null&&i.length&&o.getCanSelectSubRows()&&o.subRows.forEach(l=>Sy(t,l.id,n,r,s))};function Mm(t,e){const n=t.getState().rowSelection,r=[],s={},i=function(o,l){return o.map(a=>{var u;const c=L0(a,n);if(c&&(r.push(a),s[a.id]=a),(u=a.subRows)!=null&&u.length&&(a={...a,subRows:i(a.subRows)}),c)return a}).filter(Boolean)};return{rows:i(e.rows),flatRows:r,rowsById:s}}function L0(t,e){var n;return(n=e[t.id])!=null?n:!1}function Cy(t,e,n){var r;if(!((r=t.subRows)!=null&&r.length))return!1;let s=!0,i=!1;return t.subRows.forEach(o=>{if(!(i&&!s)&&(o.getCanSelect()&&(L0(o,e)?i=!0:s=!1),o.subRows&&o.subRows.length)){const l=Cy(o,e);l==="all"?i=!0:(l==="some"&&(i=!0),s=!1)}}),s?"all":i?"some":!1}const Ey=/([0-9]+)/gm,OF=(t,e,n)=>cM(Ni(t.getValue(n)).toLowerCase(),Ni(e.getValue(n)).toLowerCase()),AF=(t,e,n)=>cM(Ni(t.getValue(n)),Ni(e.getValue(n))),_F=(t,e,n)=>j0(Ni(t.getValue(n)).toLowerCase(),Ni(e.getValue(n)).toLowerCase()),PF=(t,e,n)=>j0(Ni(t.getValue(n)),Ni(e.getValue(n))),IF=(t,e,n)=>{const r=t.getValue(n),s=e.getValue(n);return r>s?1:r<s?-1:0},DF=(t,e,n)=>j0(t.getValue(n),e.getValue(n));function j0(t,e){return t===e?0:t>e?1:-1}function Ni(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}function cM(t,e){const n=t.split(Ey).filter(Boolean),r=e.split(Ey).filter(Boolean);for(;n.length&&r.length;){const s=n.shift(),i=r.shift(),o=parseInt(s,10),l=parseInt(i,10),a=[o,l].sort();if(isNaN(a[0])){if(s>i)return 1;if(i>s)return-1;continue}if(isNaN(a[1]))return isNaN(o)?-1:1;if(o>l)return 1;if(l>o)return-1}return n.length-r.length}const La={alphanumeric:OF,alphanumericCaseSensitive:AF,text:_F,textCaseSensitive:PF,datetime:IF,basic:DF},LF={getInitialState:t=>({sorting:[],...t}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:t=>({onSortingChange:Pn("sorting",t),isMultiSortEvent:e=>e.shiftKey}),createColumn:(t,e)=>{t.getAutoSortingFn=()=>{const n=e.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const s of n){const i=s==null?void 0:s.getValue(t.id);if(Object.prototype.toString.call(i)==="[object Date]")return La.datetime;if(typeof i=="string"&&(r=!0,i.split(Ey).length>1))return La.alphanumeric}return r?La.text:La.basic},t.getAutoSortDir=()=>{const n=e.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(t.id))=="string"?"asc":"desc"},t.getSortingFn=()=>{var n,r;if(!t)throw new Error;return ep(t.columnDef.sortingFn)?t.columnDef.sortingFn:t.columnDef.sortingFn==="auto"?t.getAutoSortingFn():(n=(r=e.options.sortingFns)==null?void 0:r[t.columnDef.sortingFn])!=null?n:La[t.columnDef.sortingFn]},t.toggleSorting=(n,r)=>{const s=t.getNextSortingOrder(),i=typeof n<"u"&&n!==null;e.setSorting(o=>{const l=o==null?void 0:o.find(h=>h.id===t.id),a=o==null?void 0:o.findIndex(h=>h.id===t.id);let u=[],c,d=i?n:s==="desc";if(o!=null&&o.length&&t.getCanMultiSort()&&r?l?c="toggle":c="add":o!=null&&o.length&&a!==o.length-1?c="replace":l?c="toggle":c="replace",c==="toggle"&&(i||s||(c="remove")),c==="add"){var f;u=[...o,{id:t.id,desc:d}],u.splice(0,u.length-((f=e.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else c==="toggle"?u=o.map(h=>h.id===t.id?{...h,desc:d}:h):c==="remove"?u=o.filter(h=>h.id!==t.id):u=[{id:t.id,desc:d}];return u})},t.getFirstSortDir=()=>{var n,r;return((n=(r=t.columnDef.sortDescFirst)!=null?r:e.options.sortDescFirst)!=null?n:t.getAutoSortDir()==="desc")?"desc":"asc"},t.getNextSortingOrder=n=>{var r,s;const i=t.getFirstSortDir(),o=t.getIsSorted();return o?o!==i&&((r=e.options.enableSortingRemoval)==null||r)&&(!(n&&(s=e.options.enableMultiRemove)!=null)||s)?!1:o==="desc"?"asc":"desc":i},t.getCanSort=()=>{var n,r;return((n=t.columnDef.enableSorting)!=null?n:!0)&&((r=e.options.enableSorting)!=null?r:!0)&&!!t.accessorFn},t.getCanMultiSort=()=>{var n,r;return(n=(r=t.columnDef.enableMultiSort)!=null?r:e.options.enableMultiSort)!=null?n:!!t.accessorFn},t.getIsSorted=()=>{var n;const r=(n=e.getState().sorting)==null?void 0:n.find(s=>s.id===t.id);return r?r.desc?"desc":"asc":!1},t.getSortIndex=()=>{var n,r;return(n=(r=e.getState().sorting)==null?void 0:r.findIndex(s=>s.id===t.id))!=null?n:-1},t.clearSorting=()=>{e.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==t.id):[])},t.getToggleSortingHandler=()=>{const n=t.getCanSort();return r=>{n&&(r.persist==null||r.persist(),t.toggleSorting==null||t.toggleSorting(void 0,t.getCanMultiSort()?e.options.isMultiSortEvent==null?void 0:e.options.isMultiSortEvent(r):!1))}}},createTable:t=>{t.setSorting=e=>t.options.onSortingChange==null?void 0:t.options.onSortingChange(e),t.resetSorting=e=>{var n,r;t.setSorting(e?[]:(n=(r=t.initialState)==null?void 0:r.sorting)!=null?n:[])},t.getPreSortedRowModel=()=>t.getGroupedRowModel(),t.getSortedRowModel=()=>(!t._getSortedRowModel&&t.options.getSortedRowModel&&(t._getSortedRowModel=t.options.getSortedRowModel(t)),t.options.manualSorting||!t._getSortedRowModel?t.getPreSortedRowModel():t._getSortedRowModel())}},jF=[sF,SF,vF,xF,iF,oF,CF,EF,LF,gF,TF,RF,MF,NF,kF];function $F(t){var e,n;const r=[...jF,...(e=t._features)!=null?e:[]];let s={_features:r};const i=s._features.reduce((f,h)=>Object.assign(f,h.getDefaultOptions==null?void 0:h.getDefaultOptions(s)),{}),o=f=>s.options.mergeOptions?s.options.mergeOptions(i,f):{...i,...f};let a={...{},...(n=t.initialState)!=null?n:{}};s._features.forEach(f=>{var h;a=(h=f.getInitialState==null?void 0:f.getInitialState(a))!=null?h:a});const u=[];let c=!1;const d={_features:r,options:{...i,...t},initialState:a,_queue:f=>{u.push(f),c||(c=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();c=!1}).catch(h=>setTimeout(()=>{throw h})))},reset:()=>{s.setState(s.initialState)},setOptions:f=>{const h=oi(f,s.options);s.options=o(h)},getState:()=>s.options.state,setState:f=>{s.options.onStateChange==null||s.options.onStateChange(f)},_getRowId:(f,h,p)=>{var m;return(m=s.options.getRowId==null?void 0:s.options.getRowId(f,h,p))!=null?m:`${p?[p.id,h].join("."):h}`},getCoreRowModel:()=>(s._getCoreRowModel||(s._getCoreRowModel=s.options.getCoreRowModel(s)),s._getCoreRowModel()),getRowModel:()=>s.getPaginationRowModel(),getRow:(f,h)=>{let p=(h?s.getPrePaginationRowModel():s.getRowModel()).rowsById[f];if(!p&&(p=s.getCoreRowModel().rowsById[f],!p))throw new Error;return p},_getDefaultColumnDef:fe(()=>[s.options.defaultColumn],f=>{var h;return f=(h=f)!=null?h:{},{header:p=>{const m=p.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:p=>{var m,y;return(m=(y=p.renderValue())==null||y.toString==null?void 0:y.toString())!=null?m:null},...s._features.reduce((p,m)=>Object.assign(p,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...f}},he(t,"debugColumns")),_getColumnDefs:()=>s.options.columns,getAllColumns:fe(()=>[s._getColumnDefs()],f=>{const h=function(p,m,y){return y===void 0&&(y=0),p.map(g=>{const x=rF(s,g,y,m),k=g;return x.columns=k.columns?h(k.columns,x,y+1):[],x})};return h(f)},he(t,"debugColumns")),getAllFlatColumns:fe(()=>[s.getAllColumns()],f=>f.flatMap(h=>h.getFlatColumns()),he(t,"debugColumns")),_getAllFlatColumnsById:fe(()=>[s.getAllFlatColumns()],f=>f.reduce((h,p)=>(h[p.id]=p,h),{}),he(t,"debugColumns")),getAllLeafColumns:fe(()=>[s.getAllColumns(),s._getOrderColumnsFn()],(f,h)=>{let p=f.flatMap(m=>m.getLeafColumns());return h(p)},he(t,"debugColumns")),getColumn:f=>s._getAllFlatColumnsById()[f]};Object.assign(s,d);for(let f=0;f<s._features.length;f++){const h=s._features[f];h==null||h.createTable==null||h.createTable(s)}return s}function zF(){return t=>fe(()=>[t.options.data],e=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(s,i,o){i===void 0&&(i=0);const l=[];for(let u=0;u<s.length;u++){const c=tp(t,t._getRowId(s[u],u,o),s[u],u,i,void 0,o==null?void 0:o.id);if(n.flatRows.push(c),n.rowsById[c.id]=c,l.push(c),t.options.getSubRows){var a;c.originalSubRows=t.options.getSubRows(s[u],u),(a=c.originalSubRows)!=null&&a.length&&(c.subRows=r(c.originalSubRows,i+1,c))}}return l};return n.rows=r(e),n},he(t.options,"debugTable","getRowModel",()=>t._autoResetPageIndex()))}function FF(){return t=>fe(()=>[t.getState().expanded,t.getPreExpandedRowModel(),t.options.paginateExpandedRows],(e,n,r)=>!n.rows.length||e!==!0&&!Object.keys(e??{}).length||!r?n:BF(n),he(t.options,"debugTable"))}function BF(t){const e=[],n=r=>{var s;e.push(r),(s=r.subRows)!=null&&s.length&&r.getIsExpanded()&&r.subRows.forEach(n)};return t.rows.forEach(n),{rows:e,flatRows:t.flatRows,rowsById:t.rowsById}}function VF(t,e,n){return n.options.filterFromLeafRows?HF(t,e,n):UF(t,e,n)}function HF(t,e,n){var r;const s=[],i={},o=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,l=function(a,u){u===void 0&&(u=0);const c=[];for(let f=0;f<a.length;f++){var d;let h=a[f];const p=tp(n,h.id,h.original,h.index,h.depth,void 0,h.parentId);if(p.columnFilters=h.columnFilters,(d=h.subRows)!=null&&d.length&&u<o){if(p.subRows=l(h.subRows,u+1),h=p,e(h)&&!p.subRows.length){c.push(h),i[h.id]=h,s.push(h);continue}if(e(h)||p.subRows.length){c.push(h),i[h.id]=h,s.push(h);continue}}else h=p,e(h)&&(c.push(h),i[h.id]=h,s.push(h))}return c};return{rows:l(t),flatRows:s,rowsById:i}}function UF(t,e,n){var r;const s=[],i={},o=(r=n.options.maxLeafRowFilterDepth)!=null?r:100,l=function(a,u){u===void 0&&(u=0);const c=[];for(let f=0;f<a.length;f++){let h=a[f];if(e(h)){var d;if((d=h.subRows)!=null&&d.length&&u<o){const m=tp(n,h.id,h.original,h.index,h.depth,void 0,h.parentId);m.subRows=l(h.subRows,u+1),h=m}c.push(h),s.push(h),i[h.id]=h}}return c};return{rows:l(t),flatRows:s,rowsById:i}}function WF(){return t=>fe(()=>[t.getPreFilteredRowModel(),t.getState().columnFilters,t.getState().globalFilter],(e,n,r)=>{if(!e.rows.length||!(n!=null&&n.length)&&!r){for(let f=0;f<e.flatRows.length;f++)e.flatRows[f].columnFilters={},e.flatRows[f].columnFiltersMeta={};return e}const s=[],i=[];(n??[]).forEach(f=>{var h;const p=t.getColumn(f.id);if(!p)return;const m=p.getFilterFn();m&&s.push({id:f.id,filterFn:m,resolvedValue:(h=m.resolveFilterValue==null?void 0:m.resolveFilterValue(f.value))!=null?h:f.value})});const o=(n??[]).map(f=>f.id),l=t.getGlobalFilterFn(),a=t.getAllLeafColumns().filter(f=>f.getCanGlobalFilter());r&&l&&a.length&&(o.push("__global__"),a.forEach(f=>{var h;i.push({id:f.id,filterFn:l,resolvedValue:(h=l.resolveFilterValue==null?void 0:l.resolveFilterValue(r))!=null?h:r})}));let u,c;for(let f=0;f<e.flatRows.length;f++){const h=e.flatRows[f];if(h.columnFilters={},s.length)for(let p=0;p<s.length;p++){u=s[p];const m=u.id;h.columnFilters[m]=u.filterFn(h,m,u.resolvedValue,y=>{h.columnFiltersMeta[m]=y})}if(i.length){for(let p=0;p<i.length;p++){c=i[p];const m=c.id;if(c.filterFn(h,m,c.resolvedValue,y=>{h.columnFiltersMeta[m]=y})){h.columnFilters.__global__=!0;break}}h.columnFilters.__global__!==!0&&(h.columnFilters.__global__=!1)}}const d=f=>{for(let h=0;h<o.length;h++)if(f.columnFilters[o[h]]===!1)return!1;return!0};return VF(e.rows,d,t)},he(t.options,"debugTable","getFilteredRowModel",()=>t._autoResetPageIndex()))}function qF(){return t=>fe(()=>[t.getState().grouping,t.getPreGroupedRowModel()],(e,n)=>{if(!n.rows.length||!e.length)return n.rows.forEach(a=>{a.depth=0,a.parentId=void 0}),n;const r=e.filter(a=>t.getColumn(a)),s=[],i={},o=function(a,u,c){if(u===void 0&&(u=0),u>=r.length)return a.map(p=>(p.depth=u,s.push(p),i[p.id]=p,p.subRows&&(p.subRows=o(p.subRows,u+1,p.id)),p));const d=r[u],f=GF(a,d);return Array.from(f.entries()).map((p,m)=>{let[y,g]=p,x=`${d}:${y}`;x=c?`${c}>${x}`:x;const k=o(g,u+1,x);k.forEach(C=>{C.parentId=x});const b=u?tM(g,C=>C.subRows):g,S=tp(t,x,b[0].original,m,u,void 0,c);return Object.assign(S,{groupingColumnId:d,groupingValue:y,subRows:k,leafRows:b,getValue:C=>{if(r.includes(C)){if(S._valuesCache.hasOwnProperty(C))return S._valuesCache[C];if(g[0]){var E;S._valuesCache[C]=(E=g[0].getValue(C))!=null?E:void 0}return S._valuesCache[C]}if(S._groupingValuesCache.hasOwnProperty(C))return S._groupingValuesCache[C];const T=t.getColumn(C),N=T==null?void 0:T.getAggregationFn();if(N)return S._groupingValuesCache[C]=N(C,b,g),S._groupingValuesCache[C]}}),k.forEach(C=>{s.push(C),i[C.id]=C}),S})},l=o(n.rows,0);return l.forEach(a=>{s.push(a),i[a.id]=a}),{rows:l,flatRows:s,rowsById:i}},he(t.options,"debugTable","getGroupedRowModel",()=>{t._queue(()=>{t._autoResetExpanded(),t._autoResetPageIndex()})}))}function GF(t,e){const n=new Map;return t.reduce((r,s)=>{const i=`${s.getGroupingValue(e)}`,o=r.get(i);return o?o.push(s):r.set(i,[s]),r},n)}function KF(){return t=>fe(()=>[t.getState().sorting,t.getPreSortedRowModel()],(e,n)=>{if(!n.rows.length||!(e!=null&&e.length))return n;const r=t.getState().sorting,s=[],i=r.filter(a=>{var u;return(u=t.getColumn(a.id))==null?void 0:u.getCanSort()}),o={};i.forEach(a=>{const u=t.getColumn(a.id);u&&(o[a.id]={sortUndefined:u.columnDef.sortUndefined,invertSorting:u.columnDef.invertSorting,sortingFn:u.getSortingFn()})});const l=a=>{const u=a.map(c=>({...c}));return u.sort((c,d)=>{for(let h=0;h<i.length;h+=1){var f;const p=i[h],m=o[p.id],y=m.sortUndefined,g=(f=p==null?void 0:p.desc)!=null?f:!1;let x=0;if(y){const k=c.getValue(p.id),b=d.getValue(p.id),S=k===void 0,C=b===void 0;if(S||C){if(y==="first")return S?-1:1;if(y==="last")return S?1:-1;x=S&&C?0:S?y:-y}}if(x===0&&(x=m.sortingFn(c,d,p.id)),x!==0)return g&&(x*=-1),m.invertSorting&&(x*=-1),x}return c.index-d.index}),u.forEach(c=>{var d;s.push(c),(d=c.subRows)!=null&&d.length&&(c.subRows=l(c.subRows))}),u};return{rows:l(n.rows),flatRows:s,rowsById:n.rowsById}},he(t.options,"debugTable","getSortedRowModel",()=>t._autoResetPageIndex()))}/**
319
- * react-table
320
- *
321
- * Copyright (c) TanStack
322
- *
323
- * This source code is licensed under the MIT license found in the
324
- * LICENSE.md file in the root directory of this source tree.
325
- *
326
- * @license MIT
327
- */function el(t,e){return t?JF(t)?v.createElement(t,e):t:null}function JF(t){return QF(t)||typeof t=="function"||ZF(t)}function QF(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function ZF(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function YF(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=v.useState(()=>({current:$F(e)})),[r,s]=v.useState(()=>n.current.initialState);return n.current.setOptions(i=>({...i,...t,state:{...r,...t.state},onStateChange:o=>{s(o),t.onStateChange==null||t.onStateChange(o)}})),n.current}function XF({globalFilter:t,onGlobalFilterChange:e,sorting:n,grouping:r,onSortingChange:s,onGroupingChange:i,sortableColumns:o,groupableColumns:l,onClear:a,onColumnsOpen:u,rowCount:c,disableSearch:d=!1,disableSorting:f=!1,disableGrouping:h=!1}){const p=n[0],m=(p==null?void 0:p.id)??"",y=(p==null?void 0:p.desc)??!1,g=r[0]??"";return w.jsxs("div",{className:"flex flex-wrap items-center gap-2 border border-border bg-card p-2",children:[d?null:w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[w.jsx(QL,{className:"h-4 w-4"}),w.jsx("span",{children:"Filter"})]}),w.jsx("input",{value:t,onChange:x=>e(x.target.value),placeholder:"Search",className:"h-8 w-48 border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2"})]}),f?null:w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[w.jsx(bf,{className:"h-4 w-4"}),w.jsx("span",{children:"Sort"})]}),w.jsxs("select",{value:m,onChange:x=>{const k=x.target.value;if(!k){s([]);return}s([{id:k,desc:y}])},className:"h-8 border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",children:[w.jsx("option",{value:"",children:"No sort"}),o.map(x=>w.jsx("option",{value:x.id,children:x.id},x.id))]}),w.jsx(ze,{type:"button",variant:"ghost",size:"icon",onClick:()=>{m&&s([{id:m,desc:!y}])},children:y?w.jsx(gy,{className:"h-4 w-4"}):w.jsx(bf,{className:"h-4 w-4"})})]}),h?null:w.jsxs(w.Fragment,{children:[w.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[w.jsx(YL,{className:"h-4 w-4"}),w.jsx("span",{children:"Group"})]}),w.jsxs("select",{value:g,onChange:x=>{const k=x.target.value;i(k?[k]:[])},className:"h-8 border border-input bg-background px-2 text-xs focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",children:[w.jsx("option",{value:"",children:"No group"}),l.map(x=>w.jsx("option",{value:x.id,children:x.id},x.id))]})]}),w.jsx(ze,{type:"button",variant:"ghost",size:"sm",onClick:a,children:"Clear"}),w.jsx(ze,{type:"button",variant:"ghost",size:"sm",onClick:u,children:"Columns"}),w.jsxs("div",{className:"ml-auto text-xs text-muted-foreground",children:[c," rows"]})]})}var je;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of i)o[l]=s[l];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(je||(je={}));var Sb;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Sb||(Sb={}));const te=je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Bs=t=>{switch(typeof t){case"undefined":return te.undefined;case"string":return te.string;case"number":return Number.isNaN(t)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(t)?te.array:t===null?te.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?te.promise:typeof Map<"u"&&t instanceof Map?te.map:typeof Set<"u"&&t instanceof Set?te.set:typeof Date<"u"&&t instanceof Date?te.date:te.object;default:return te.unknown}},B=je.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 Rs 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(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,a=0;for(;a<o.path.length;){const u=o.path[a];a===o.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(n(o))):l[u]=l[u]||{_errors:[]},l=l[u],a++}}};return s(this),r}static assert(e){if(!(e instanceof Rs))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,je.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Rs.create=t=>new Rs(t);const Ty=(t,e)=>{let n;switch(t.code){case B.invalid_type:t.received===te.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case B.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,je.jsonStringifyReplacer)}`;break;case B.unrecognized_keys:n=`Unrecognized key(s) in object: ${je.joinValues(t.keys,", ")}`;break;case B.invalid_union:n="Invalid input";break;case B.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${je.joinValues(t.options)}`;break;case B.invalid_enum_value:n=`Invalid enum value. Expected ${je.joinValues(t.options)}, received '${t.received}'`;break;case B.invalid_arguments:n="Invalid function arguments";break;case B.invalid_return_type:n="Invalid function return type";break;case B.invalid_date:n="Invalid date";break;case B.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}"`:je.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case B.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 B.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 B.custom:n="Invalid input";break;case B.invalid_intersection_types:n="Intersection results could not be merged";break;case B.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case B.not_finite:n="Number must be finite";break;default:n=e.defaultError,je.assertNever(t)}return{message:n}};let e3=Ty;function t3(){return e3}const n3=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let l="";const a=r.filter(u=>!!u).slice().reverse();for(const u of a)l=u(o,{data:e,defaultError:l}).message;return{...s,path:i,message:l}};function W(t,e){const n=t3(),r=n3({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Ty?void 0:Ty].filter(s=>!!s)});t.common.issues.push(r)}class ln{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 s of n){if(s.status==="aborted")return ke;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return ln.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return ke;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const ke=Object.freeze({status:"aborted"}),Ka=t=>({status:"dirty",value:t}),nr=t=>({status:"valid",value:t}),Cb=t=>t.status==="aborted",Eb=t=>t.status==="dirty",Yl=t=>t.status==="valid",Ef=t=>typeof Promise<"u"&&t instanceof Promise;var oe;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(oe||(oe={}));class Hr{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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 Tb=(t,e)=>{if(Yl(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 Rs(t.common.issues);return this._error=n,this._error}}};function Me(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=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:s}:{errorMap:(o,l)=>{const{message:a}=t;return o.code==="invalid_enum_value"?{message:a??l.defaultError}:typeof l.data>"u"?{message:a??r??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:a??n??l.defaultError}},description:s}}class Pe{get description(){return this._def.description}_getType(e){return Bs(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Bs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ln,ctx:{common:e.parent.common,data:e.data,parsedType:Bs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Ef(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:Bs(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Tb(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Bs(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return Yl(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>Yl(i)?{value:i.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:Bs(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Ef(s)?s:Promise.resolve(s));return Tb(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),l=()=>i.addIssue({code:B.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(a=>a?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new ta({schema:this,typeName:ve.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return wi.create(this,this._def)}nullable(){return na.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Fr.create(this)}promise(){return Of.create(this,this._def)}or(e){return Rf.create([this,e],this._def)}and(e){return Mf.create(this,e,this._def)}transform(e){return new ta({...Me(this._def),schema:this,typeName:ve.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Ay({...Me(this._def),innerType:this,defaultValue:n,typeName:ve.ZodDefault})}brand(){return new E3({typeName:ve.ZodBranded,type:this,...Me(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new _y({...Me(this._def),innerType:this,catchValue:n,typeName:ve.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return $0.create(this,e)}readonly(){return Py.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const r3=/^c[^\s-]{8,}$/i,s3=/^[0-9a-z]+$/,i3=/^[0-9A-HJKMNP-TV-Z]{26}$/i,o3=/^[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,l3=/^[a-z0-9_-]{21}$/i,a3=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,u3=/^[-+]?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)?)??$/,c3=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,d3="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Nm;const f3=/^(?:(?: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])$/,h3=/^(?:(?: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])$/,p3=/^(([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]))$/,m3=/^(([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])$/,g3=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,y3=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dM="((\\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])))",v3=new RegExp(`^${dM}$`);function fM(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 x3(t){return new RegExp(`^${fM(t)}$`)}function w3(t){let e=`${dM}T${fM(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 k3(t,e){return!!((e==="v4"||!e)&&f3.test(t)||(e==="v6"||!e)&&p3.test(t))}function b3(t,e){if(!a3.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,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function S3(t,e){return!!((e==="v4"||!e)&&h3.test(t)||(e==="v6"||!e)&&m3.test(t))}class ms extends Pe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==te.string){const i=this._getOrReturnCtx(e);return W(i,{code:B.invalid_type,expected:te.string,received:i.parsedType}),ke}const r=new ln;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),W(s,{code:B.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),W(s,{code:B.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,l=e.data.length<i.value;(o||l)&&(s=this._getOrReturnCtx(e,s),o?W(s,{code:B.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&W(s,{code:B.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")c3.test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"email",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Nm||(Nm=new RegExp(d3,"u")),Nm.test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"emoji",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")o3.test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"uuid",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")l3.test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"nanoid",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")r3.test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"cuid",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")s3.test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"cuid2",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")i3.test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"ulid",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),W(s,{validation:"url",code:B.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"regex",code:B.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),W(s,{code:B.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),W(s,{code:B.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),W(s,{code:B.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?w3(i).test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{code:B.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?v3.test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{code:B.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?x3(i).test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{code:B.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?u3.test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"duration",code:B.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?k3(e.data,i.version)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"ip",code:B.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?b3(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"jwt",code:B.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?S3(e.data,i.version)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"cidr",code:B.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?g3.test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"base64",code:B.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?y3.test(e.data)||(s=this._getOrReturnCtx(e,s),W(s,{validation:"base64url",code:B.invalid_string,message:i.message}),r.dirty()):je.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:B.invalid_string,...oe.errToObj(r)})}_addCheck(e){return new ms({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...oe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...oe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...oe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...oe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...oe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...oe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...oe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...oe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...oe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...oe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...oe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...oe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...oe.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,...oe.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,...oe.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...oe.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...oe.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...oe.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...oe.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...oe.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...oe.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...oe.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...oe.errToObj(n)})}nonempty(e){return this.min(1,oe.errToObj(e))}trim(){return new ms({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ms({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ms({...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}}ms.create=t=>new ms({checks:[],typeName:ve.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Me(t)});function C3(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}class Xl extends Pe{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)!==te.number){const i=this._getOrReturnCtx(e);return W(i,{code:B.invalid_type,expected:te.number,received:i.parsedType}),ke}let r;const s=new ln;for(const i of this._def.checks)i.kind==="int"?je.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),W(r,{code:B.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),W(r,{code:B.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),W(r,{code:B.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?C3(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),W(r,{code:B.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),W(r,{code:B.not_finite,message:i.message}),s.dirty()):je.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,oe.toString(n))}gt(e,n){return this.setLimit("min",e,!1,oe.toString(n))}lte(e,n){return this.setLimit("max",e,!0,oe.toString(n))}lt(e,n){return this.setLimit("max",e,!1,oe.toString(n))}setLimit(e,n,r,s){return new Xl({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:oe.toString(s)}]})}_addCheck(e){return new Xl({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:oe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:oe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:oe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:oe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:oe.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:oe.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:oe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:oe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:oe.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"&&je.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)}}Xl.create=t=>new Xl({checks:[],typeName:ve.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Me(t)});class Gu extends Pe{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)!==te.bigint)return this._getInvalidInput(e);let r;const s=new ln;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),W(r,{code:B.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),W(r,{code:B.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),W(r,{code:B.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):je.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return W(n,{code:B.invalid_type,expected:te.bigint,received:n.parsedType}),ke}gte(e,n){return this.setLimit("min",e,!0,oe.toString(n))}gt(e,n){return this.setLimit("min",e,!1,oe.toString(n))}lte(e,n){return this.setLimit("max",e,!0,oe.toString(n))}lt(e,n){return this.setLimit("max",e,!1,oe.toString(n))}setLimit(e,n,r,s){return new Gu({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:oe.toString(s)}]})}_addCheck(e){return new Gu({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:oe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:oe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:oe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:oe.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:oe.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Gu.create=t=>new Gu({checks:[],typeName:ve.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Me(t)});class Ry extends Pe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==te.boolean){const r=this._getOrReturnCtx(e);return W(r,{code:B.invalid_type,expected:te.boolean,received:r.parsedType}),ke}return nr(e.data)}}Ry.create=t=>new Ry({typeName:ve.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Me(t)});class Tf extends Pe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==te.date){const i=this._getOrReturnCtx(e);return W(i,{code:B.invalid_type,expected:te.date,received:i.parsedType}),ke}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return W(i,{code:B.invalid_date}),ke}const r=new ln;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),W(s,{code:B.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),W(s,{code:B.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):je.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Tf({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:oe.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:oe.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}}Tf.create=t=>new Tf({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:ve.ZodDate,...Me(t)});class Rb extends Pe{_parse(e){if(this._getType(e)!==te.symbol){const r=this._getOrReturnCtx(e);return W(r,{code:B.invalid_type,expected:te.symbol,received:r.parsedType}),ke}return nr(e.data)}}Rb.create=t=>new Rb({typeName:ve.ZodSymbol,...Me(t)});class Mb extends Pe{_parse(e){if(this._getType(e)!==te.undefined){const r=this._getOrReturnCtx(e);return W(r,{code:B.invalid_type,expected:te.undefined,received:r.parsedType}),ke}return nr(e.data)}}Mb.create=t=>new Mb({typeName:ve.ZodUndefined,...Me(t)});class Nb extends Pe{_parse(e){if(this._getType(e)!==te.null){const r=this._getOrReturnCtx(e);return W(r,{code:B.invalid_type,expected:te.null,received:r.parsedType}),ke}return nr(e.data)}}Nb.create=t=>new Nb({typeName:ve.ZodNull,...Me(t)});class Ob extends Pe{constructor(){super(...arguments),this._any=!0}_parse(e){return nr(e.data)}}Ob.create=t=>new Ob({typeName:ve.ZodAny,...Me(t)});class My extends Pe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return nr(e.data)}}My.create=t=>new My({typeName:ve.ZodUnknown,...Me(t)});class Oi extends Pe{_parse(e){const n=this._getOrReturnCtx(e);return W(n,{code:B.invalid_type,expected:te.never,received:n.parsedType}),ke}}Oi.create=t=>new Oi({typeName:ve.ZodNever,...Me(t)});class Ab extends Pe{_parse(e){if(this._getType(e)!==te.undefined){const r=this._getOrReturnCtx(e);return W(r,{code:B.invalid_type,expected:te.void,received:r.parsedType}),ke}return nr(e.data)}}Ab.create=t=>new Ab({typeName:ve.ZodVoid,...Me(t)});class Fr extends Pe{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==te.array)return W(n,{code:B.invalid_type,expected:te.array,received:n.parsedType}),ke;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.length<s.exactLength.value;(o||l)&&(W(n,{code:o?B.too_big:B.too_small,minimum:l?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(W(n,{code:B.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(W(n,{code:B.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>s.type._parseAsync(new Hr(n,o,n.path,l)))).then(o=>ln.mergeArray(r,o));const i=[...n.data].map((o,l)=>s.type._parseSync(new Hr(n,o,n.path,l)));return ln.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Fr({...this._def,minLength:{value:e,message:oe.toString(n)}})}max(e,n){return new Fr({...this._def,maxLength:{value:e,message:oe.toString(n)}})}length(e,n){return new Fr({...this._def,exactLength:{value:e,message:oe.toString(n)}})}nonempty(e){return this.min(1,e)}}Fr.create=(t,e)=>new Fr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ve.ZodArray,...Me(e)});function ol(t){if(t instanceof mt){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=wi.create(ol(r))}return new mt({...t._def,shape:()=>e})}else return t instanceof Fr?new Fr({...t._def,type:ol(t.element)}):t instanceof wi?wi.create(ol(t.unwrap())):t instanceof na?na.create(ol(t.unwrap())):t instanceof No?No.create(t.items.map(e=>ol(e))):t}class mt extends Pe{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=je.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==te.object){const u=this._getOrReturnCtx(e);return W(u,{code:B.invalid_type,expected:te.object,received:u.parsedType}),ke}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Oi&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||l.push(u);const a=[];for(const u of o){const c=i[u],d=s.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new Hr(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Oi){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of l)a.push({key:{status:"valid",value:c},value:{status:"valid",value:s.data[c]}});else if(u==="strict")l.length>0&&(W(s,{code:B.unrecognized_keys,keys:l}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of l){const d=s.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new Hr(s,d,s.path,c)),alwaysSet:c in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of a){const d=await c.key,f=await c.value;u.push({key:d,value:f,alwaysSet:c.alwaysSet})}return u}).then(u=>ln.mergeObjectSync(r,u)):ln.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return oe.errToObj,new mt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:oe.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new mt({...this._def,unknownKeys:"strip"})}passthrough(){return new mt({...this._def,unknownKeys:"passthrough"})}extend(e){return new mt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new mt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ve.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new mt({...this._def,catchall:e})}pick(e){const n={};for(const r of je.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new mt({...this._def,shape:()=>n})}omit(e){const n={};for(const r of je.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new mt({...this._def,shape:()=>n})}deepPartial(){return ol(this)}partial(e){const n={};for(const r of je.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new mt({...this._def,shape:()=>n})}required(e){const n={};for(const r of je.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof wi;)i=i._def.innerType;n[r]=i}return new mt({...this._def,shape:()=>n})}keyof(){return hM(je.objectKeys(this.shape))}}mt.create=(t,e)=>new mt({shape:()=>t,unknownKeys:"strip",catchall:Oi.create(),typeName:ve.ZodObject,...Me(e)});mt.strictCreate=(t,e)=>new mt({shape:()=>t,unknownKeys:"strict",catchall:Oi.create(),typeName:ve.ZodObject,...Me(e)});mt.lazycreate=(t,e)=>new mt({shape:t,unknownKeys:"strip",catchall:Oi.create(),typeName:ve.ZodObject,...Me(e)});class Rf extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=i.map(l=>new Rs(l.ctx.common.issues));return W(n,{code:B.invalid_union,unionErrors:o}),ke}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const a of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=a._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!i&&(i={result:c,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(a=>new Rs(a));return W(n,{code:B.invalid_union,unionErrors:l}),ke}}get options(){return this._def.options}}Rf.create=(t,e)=>new Rf({options:t,typeName:ve.ZodUnion,...Me(e)});function Ny(t,e){const n=Bs(t),r=Bs(e);if(t===e)return{valid:!0,data:t};if(n===te.object&&r===te.object){const s=je.objectKeys(e),i=je.objectKeys(t).filter(l=>s.indexOf(l)!==-1),o={...t,...e};for(const l of i){const a=Ny(t[l],e[l]);if(!a.valid)return{valid:!1};o[l]=a.data}return{valid:!0,data:o}}else if(n===te.array&&r===te.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],l=e[i],a=Ny(o,l);if(!a.valid)return{valid:!1};s.push(a.data)}return{valid:!0,data:s}}else return n===te.date&&r===te.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Mf extends Pe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Cb(i)||Cb(o))return ke;const l=Ny(i.value,o.value);return l.valid?((Eb(i)||Eb(o))&&n.dirty(),{status:n.value,value:l.data}):(W(r,{code:B.invalid_intersection_types}),ke)};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(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Mf.create=(t,e,n)=>new Mf({left:t,right:e,typeName:ve.ZodIntersection,...Me(n)});class No extends Pe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==te.array)return W(r,{code:B.invalid_type,expected:te.array,received:r.parsedType}),ke;if(r.data.length<this._def.items.length)return W(r,{code:B.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ke;!this._def.rest&&r.data.length>this._def.items.length&&(W(r,{code:B.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,l)=>{const a=this._def.items[l]||this._def.rest;return a?a._parse(new Hr(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>ln.mergeArray(n,o)):ln.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new No({...this._def,rest:e})}}No.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new No({items:t,typeName:ve.ZodTuple,rest:null,...Me(e)})};class Nf extends Pe{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!==te.object)return W(r,{code:B.invalid_type,expected:te.object,received:r.parsedType}),ke;const s=[],i=this._def.keyType,o=this._def.valueType;for(const l in r.data)s.push({key:i._parse(new Hr(r,l,r.path,l)),value:o._parse(new Hr(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?ln.mergeObjectAsync(n,s):ln.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Pe?new Nf({keyType:e,valueType:n,typeName:ve.ZodRecord,...Me(r)}):new Nf({keyType:ms.create(),valueType:e,typeName:ve.ZodRecord,...Me(n)})}}class _b extends Pe{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!==te.map)return W(r,{code:B.invalid_type,expected:te.map,received:r.parsedType}),ke;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([l,a],u)=>({key:s._parse(new Hr(r,l,r.path,[u,"key"])),value:i._parse(new Hr(r,a,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const a of o){const u=await a.key,c=await a.value;if(u.status==="aborted"||c.status==="aborted")return ke;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),l.set(u.value,c.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const a of o){const u=a.key,c=a.value;if(u.status==="aborted"||c.status==="aborted")return ke;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),l.set(u.value,c.value)}return{status:n.value,value:l}}}}_b.create=(t,e,n)=>new _b({valueType:e,keyType:t,typeName:ve.ZodMap,...Me(n)});class Ku extends Pe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==te.set)return W(r,{code:B.invalid_type,expected:te.set,received:r.parsedType}),ke;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(W(r,{code:B.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(W(r,{code:B.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(a){const u=new Set;for(const c of a){if(c.status==="aborted")return ke;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((a,u)=>i._parse(new Hr(r,a,r.path,u)));return r.common.async?Promise.all(l).then(a=>o(a)):o(l)}min(e,n){return new Ku({...this._def,minSize:{value:e,message:oe.toString(n)}})}max(e,n){return new Ku({...this._def,maxSize:{value:e,message:oe.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Ku.create=(t,e)=>new Ku({valueType:t,minSize:null,maxSize:null,typeName:ve.ZodSet,...Me(e)});class Pb extends Pe{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})}}Pb.create=(t,e)=>new Pb({getter:t,typeName:ve.ZodLazy,...Me(e)});class Oy extends Pe{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return W(n,{received:n.data,code:B.invalid_literal,expected:this._def.value}),ke}return{status:"valid",value:e.data}}get value(){return this._def.value}}Oy.create=(t,e)=>new Oy({value:t,typeName:ve.ZodLiteral,...Me(e)});function hM(t,e){return new ea({values:t,typeName:ve.ZodEnum,...Me(e)})}class ea extends Pe{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return W(n,{expected:je.joinValues(r),received:n.parsedType,code:B.invalid_type}),ke}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 W(n,{received:n.data,code:B.invalid_enum_value,options:r}),ke}return nr(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 ea.create(e,{...this._def,...n})}exclude(e,n=this._def){return ea.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}ea.create=hM;class Ib extends Pe{_parse(e){const n=je.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==te.string&&r.parsedType!==te.number){const s=je.objectValues(n);return W(r,{expected:je.joinValues(s),received:r.parsedType,code:B.invalid_type}),ke}if(this._cache||(this._cache=new Set(je.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=je.objectValues(n);return W(r,{received:r.data,code:B.invalid_enum_value,options:s}),ke}return nr(e.data)}get enum(){return this._def.values}}Ib.create=(t,e)=>new Ib({values:t,typeName:ve.ZodNativeEnum,...Me(e)});class Of extends Pe{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==te.promise&&n.common.async===!1)return W(n,{code:B.invalid_type,expected:te.promise,received:n.parsedType}),ke;const r=n.parsedType===te.promise?n.data:Promise.resolve(n.data);return nr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Of.create=(t,e)=>new Of({type:t,typeName:ve.ZodPromise,...Me(e)});class ta extends Pe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ve.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{W(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return ke;const a=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return a.status==="aborted"?ke:a.status==="dirty"||n.value==="dirty"?Ka(a.value):a});{if(n.value==="aborted")return ke;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?ke:l.status==="dirty"||n.value==="dirty"?Ka(l.value):l}}if(s.type==="refinement"){const o=l=>{const a=s.refinement(l,i);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?ke:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?ke:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Yl(o))return ke;const l=s.transform(o.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Yl(o)?Promise.resolve(s.transform(o.value,i)).then(l=>({status:n.value,value:l})):ke);je.assertNever(s)}}ta.create=(t,e,n)=>new ta({schema:t,typeName:ve.ZodEffects,effect:e,...Me(n)});ta.createWithPreprocess=(t,e,n)=>new ta({schema:e,effect:{type:"preprocess",transform:t},typeName:ve.ZodEffects,...Me(n)});class wi extends Pe{_parse(e){return this._getType(e)===te.undefined?nr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}wi.create=(t,e)=>new wi({innerType:t,typeName:ve.ZodOptional,...Me(e)});class na extends Pe{_parse(e){return this._getType(e)===te.null?nr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}na.create=(t,e)=>new na({innerType:t,typeName:ve.ZodNullable,...Me(e)});class Ay extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===te.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ay.create=(t,e)=>new Ay({innerType:t,typeName:ve.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Me(e)});class _y extends Pe{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ef(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Rs(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Rs(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}_y.create=(t,e)=>new _y({innerType:t,typeName:ve.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Me(e)});class Db extends Pe{_parse(e){if(this._getType(e)!==te.nan){const r=this._getOrReturnCtx(e);return W(r,{code:B.invalid_type,expected:te.nan,received:r.parsedType}),ke}return{status:"valid",value:e.data}}}Db.create=t=>new Db({typeName:ve.ZodNaN,...Me(t)});class E3 extends Pe{_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 $0 extends Pe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ke:i.status==="dirty"?(n.dirty(),Ka(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ke:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new $0({in:e,out:n,typeName:ve.ZodPipeline})}}class Py extends Pe{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Yl(s)&&(s.value=Object.freeze(s.value)),s);return Ef(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Py.create=(t,e)=>new Py({innerType:t,typeName:ve.ZodReadonly,...Me(e)});var ve;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ve||(ve={}));const nn=ms.create,T3=Xl.create,Vd=Ry.create,Iy=My.create;Oi.create;const ra=Fr.create,qn=mt.create,R3=Rf.create;Mf.create;No.create;const Af=Nf.create,Lb=Oy.create,pM=ea.create;Of.create;wi.create;na.create;const jb=R3([qn({type:Lb("pageLink"),details:qn({label:nn().optional(),pageName:nn()})}),qn({type:Lb("command"),details:qn({id:nn(),args:Af(Iy()).optional()})}),qn({type:nn(),details:Af(Iy()).optional()})]),M3=pM(["text","select","object"]),N3=qn({id:nn().min(1),name:nn().min(1),type:M3.optional().default("text"),options:ra(nn()).optional(),width:T3().int().positive().optional()}),mM=qn({columns:ra(N3).default([])}),gM=qn({sortBy:qn({id:nn(),desc:Vd().optional()}).nullable().optional(),groupBy:nn().nullable().optional(),columnOrder:ra(nn()).nullable().optional(),columnVisibility:Af(Vd()).nullable().optional(),tags:ra(nn()).nullable().optional(),pinned:Vd().nullable().optional()}).partial().passthrough(),O3=qn({data:ra(Af(Iy())).optional(),metadata:gM.optional(),schema:mM.optional()}).passthrough(),$b=t=>t.type!=="pageLink"||!t.details||typeof t.details!="object"?!1:"pageName"in t.details,zb=t=>t.type!=="command"||!t.details||typeof t.details!="object"?!1:"id"in t.details;function A3({rows:t,schema:e,view:n,onViewChange:r,onRowsChange:s,getRowId:i,onAddRow:o,onAddColumn:l,emptyStateRowCount:a=5,addRowLabel:u="New row",addColumnLabel:c="Add property",showNewRow:d=!0,renderTextValue:f,renderObjectValue:h,editingDisabled:p=!1,uncontrolledEditing:m=!1,disableSearch:y=!1,disableSorting:g=!1,disableGrouping:x=!1}){const[k,b]=v.useState([]),[S,C]=v.useState(!0),[E,T]=v.useState(""),[N,O]=v.useState(!1),H=v.useCallback((_,I)=>_.length!==I.length?!1:_.every((pe,Ce)=>pe===I[Ce]),[]),ne=v.useCallback((_,I)=>{const pe=Object.keys(_).sort(),Ce=Object.keys(I).sort();return H(pe,Ce)?pe.every(be=>_[be]===I[be]):!1},[H]),ae=v.useCallback((_,I)=>_.length!==I.length?!1:_.every((pe,Ce)=>{const be=I[Ce];return pe.id===be.id&&!!pe.desc==!!be.desc}),[]),Q=v.useCallback((_,I)=>_.length!==I.length?!1:_.every((pe,Ce)=>pe===I[Ce]),[]),le=v.useRef(t);v.useEffect(()=>{le.current=t},[t]);const se=v.useMemo(()=>e.columns.map(_=>_.id).filter(Boolean),[e.columns]),ye=v.useCallback((_,I)=>{const pe=_.filter(be=>I.includes(be)),Ce=I.filter(be=>!pe.includes(be));return[...pe,...Ce]},[]),M=v.useRef([]),V=v.useMemo(()=>{const _=ye(n.columnOrder??[],se);return H(_,M.current)?M.current:(M.current=_,_)},[H,se,ye,n.columnOrder]),ie=v.useCallback(_=>f?f(_):_,[f]),Ee=v.useCallback(_=>h?h(_):$b(_)?_.details.label??_.details.pageName:zb(_)?`Command: ${_.details.id}`:_.type,[h]),P=v.useMemo(()=>new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),[]),q=v.useCallback((_,I)=>{if(I==null)return"";if(_.type==="object"){const pe=jb.safeParse(I);if(pe.success){const Ce=pe.data;return $b(Ce)?Ce.details.label??Ce.details.pageName:zb(Ce)?`Command: ${Ce.details.id}`:Ce.type}return String(I)}return typeof I=="string"?I:String(I)},[]),G=v.useCallback((_,I)=>{if(_.type==="object"){const Ce=jb.safeParse(I);return Ce.success?Ee(Ce.data):I==null?"":String(I)}if(I==null)return"";const pe=typeof I=="string"?I:String(I);return ie(pe)},[Ee,ie]),K=v.useRef(s);v.useEffect(()=>{K.current=s},[s]);const j=v.useRef(G);v.useEffect(()=>{j.current=G},[G]);const F=v.useCallback((_,I,pe)=>{const be=(le.current??[]).map((pt,Yt)=>Yt===_?{...pt,[I]:pe}:pt);K.current(be)},[]),xe=v.useMemo(()=>JSON.stringify(e.columns),[e.columns]),Y=v.useRef(null);(!Y.current||Y.current.signature!==xe)&&(Y.current={signature:xe,columns:e.columns.map(_=>({id:_.id,accessorKey:_.id,header:_.name,sortingFn:(I,pe,Ce)=>{const be=q(_,I.getValue(Ce)),pt=q(_,pe.getValue(Ce));return!be&&!pt?0:be?pt?P.compare(be,pt):-1:1},cell:({getValue:I,row:pe,cell:Ce})=>{if(Ce.getIsGrouped())return j.current(_,I());if(_.type==="object"){const pt=I();return w.jsx("div",{className:"text-sm",children:pt?j.current(_,pt):w.jsx("span",{className:"text-xs text-muted-foreground",children:"Add object"})})}if(_.type==="select"){const pt=typeof I()=="string"?I():"";return m?w.jsxs("select",{defaultValue:pt,className:"w-full bg-transparent text-sm focus-visible:outline-none",children:[w.jsx("option",{value:"",children:"—"}),(_.options??[]).map(Yt=>w.jsx("option",{value:Yt,children:Yt},Yt))]}):w.jsxs("select",{value:pt,onChange:p?void 0:Yt=>F(pe.index,_.id,Yt.target.value),disabled:p,className:"w-full bg-transparent text-sm focus-visible:outline-none",children:[w.jsx("option",{value:"",children:"—"}),(_.options??[]).map(Yt=>w.jsx("option",{value:Yt,children:Yt},Yt))]})}const be=typeof I()=="string"?I():I()===null||I()===void 0?"":String(I());return m?w.jsx("input",{defaultValue:be,className:"w-full bg-transparent text-sm text-foreground focus-visible:outline-none"}):w.jsx("input",{value:be,onChange:p?void 0:pt=>F(pe.index,_.id,pt.target.value),readOnly:p,className:"w-full bg-transparent text-sm text-foreground focus-visible:outline-none"})},aggregatedCell:({getValue:I})=>j.current(_,I())}))});const Se=Y.current.columns,we=v.useCallback(_=>{const I={sorting:_.sorting??n.sorting,grouping:_.grouping??n.grouping,columnOrder:_.columnOrder??n.columnOrder,columnVisibility:_.columnVisibility??n.columnVisibility};ae(I.sorting,n.sorting)&&Q(I.grouping,n.grouping)&&H(I.columnOrder,n.columnOrder)&&ne(I.columnVisibility,n.columnVisibility)||r(I)},[H,Q,ae,ne,r,n]),Ie=YF({data:t,columns:Se,state:{sorting:n.sorting,columnFilters:k,grouping:n.grouping,columnOrder:V,columnVisibility:n.columnVisibility,expanded:S,globalFilter:E},onSortingChange:_=>{if(g)return;const I=typeof _=="function"?_(n.sorting):_;we({sorting:I})},onColumnFiltersChange:b,onGroupingChange:_=>{if(x)return;const I=typeof _=="function"?_(n.grouping):_;we({grouping:I})},onColumnOrderChange:_=>{const I=typeof _=="function"?_(V):_;we({columnOrder:I})},onColumnVisibilityChange:_=>{const I=typeof _=="function"?_(n.columnVisibility):_;we({columnVisibility:I})},onExpandedChange:C,onGlobalFilterChange:T,getRowId:i,getCoreRowModel:zF(),getFilteredRowModel:WF(),getSortedRowModel:KF(),getGroupedRowModel:qF(),getExpandedRowModel:FF(),enableGrouping:!x,enableSorting:!g,groupedColumnMode:"remove",autoResetExpanded:!1,initialState:{expanded:!0}}),Vt=Ie.getAllColumns(),Et=Vt.filter(_=>_.getCanSort()),bn=Vt.filter(_=>_.getCanGroup()),jn=Ie.getVisibleLeafColumns(),Kr=t.length===0,Ke=!!l,Sa=!!o,Ec=d&&Sa,rr=Kr&&jn.length===1?"min-w-[240px] max-w-[320px] w-[260px]":"min-w-[200px]",wt=n.sorting[0],Jr=(wt==null?void 0:wt.id)??"",Er=n.grouping[0]??"",Uo=v.useMemo(()=>{if(!Jr||Et.some(pe=>pe.id===Jr))return Et;const I=Vt.find(pe=>pe.id===Jr);return I?[...Et,I]:Et},[Jr,Vt,Et]),Ca=v.useMemo(()=>{if(!Er||bn.some(pe=>pe.id===Er))return bn;const I=Vt.find(pe=>pe.id===Er);return I?[...bn,I]:bn},[Er,Vt,bn]),Bi=()=>{we({sorting:[],grouping:[]}),b([]),C(!0),y||T("")},Sn=(_,I)=>{const pe=[...V],Ce=pe.indexOf(_);if(Ce===-1)return;const be=I==="up"?Ce-1:Ce+1;if(be<0||be>=pe.length)return;const[pt]=pe.splice(Ce,1);pe.splice(be,0,pt),we({columnOrder:pe})},Tc=_=>{we({columnVisibility:{...n.columnVisibility,[_]:!(n.columnVisibility[_]??!0)}})};return w.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:[w.jsx(XF,{globalFilter:E,onGlobalFilterChange:T,sorting:n.sorting,grouping:n.grouping,onSortingChange:_=>we({sorting:_}),onGroupingChange:_=>{we({grouping:_}),C(!0)},sortableColumns:Uo,groupableColumns:Ca,onClear:Bi,onColumnsOpen:()=>O(!0),rowCount:Ie.getFilteredRowModel().rows.length,disableSearch:y,disableSorting:g,disableGrouping:x}),N?w.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:w.jsxs("div",{className:"w-full max-w-lg border border-border bg-background",children:[w.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[w.jsx("h4",{className:"text-sm font-semibold",children:"Columns"}),w.jsx(ze,{type:"button",size:"sm",variant:"ghost",onClick:()=>O(!1),children:"Close"})]}),w.jsx("div",{className:"max-h-[60vh] overflow-auto px-4 py-3",children:w.jsx("div",{className:"flex flex-col gap-2",children:jn.length===0?w.jsx("div",{className:"border border-border px-3 py-6 text-center text-sm text-muted-foreground",children:"No columns to display."}):V.map(_=>jn.find(I=>I.id===_)).filter(_=>!!_).map((_,I)=>{const pe=_.getIsVisible(),Ce=I===0,be=I===V.length-1;return w.jsxs("div",{className:"flex items-center gap-2 border border-border px-3 py-2 text-xs",children:[w.jsx("input",{type:"checkbox",checked:pe,onChange:()=>Tc(_.id)}),w.jsx("span",{className:"flex-1 truncate",children:_.id}),w.jsxs("div",{className:"flex items-center gap-1",children:[w.jsx(ze,{type:"button",size:"icon",variant:"ghost",disabled:Ce,onClick:()=>Sn(_.id,"up"),children:w.jsx(FL,{className:"h-4 w-4"})}),w.jsx(ze,{type:"button",size:"icon",variant:"ghost",disabled:be,onClick:()=>Sn(_.id,"down"),children:w.jsx(jd,{className:"h-4 w-4"})})]})]},_.id)})})}),w.jsxs("div",{className:"flex justify-between border-t border-border px-4 py-3",children:[w.jsx(ze,{type:"button",size:"sm",variant:"ghost",onClick:()=>{we({columnOrder:se,columnVisibility:{}})},children:"Reset columns"}),w.jsx(ze,{type:"button",size:"sm",onClick:()=>O(!1),children:"Done"})]})]})}):null,w.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:Er?w.jsx("div",{className:"flex min-h-0 flex-col gap-3",children:Ie.getGroupedRowModel().rows.length===0?w.jsx("div",{className:"border border-border px-3 py-10 text-center text-sm text-muted-foreground",children:"No rows to display."}):Ie.getGroupedRowModel().rows.map(_=>{const I=_.groupingValue===void 0||_.groupingValue===null?"(empty)":String(_.groupingValue),pe=_.getLeafRows();return w.jsxs("div",{className:"border border-border",children:[w.jsxs("button",{type:"button",onClick:_.getToggleExpandedHandler(),className:"flex w-full items-center gap-2 border-b border-border bg-muted px-3 py-2 text-left text-xs font-medium text-foreground",children:[_.getIsExpanded()?w.jsx(jd,{className:"h-4 w-4"}):w.jsx(rb,{className:"h-4 w-4"}),w.jsx("span",{children:I}),w.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",pe.length,")"]})]}),_.getIsExpanded()&&w.jsxs("table",{className:"w-full border-collapse text-sm",children:[w.jsx("thead",{className:"sticky top-0 bg-muted",children:Ie.getHeaderGroups().map(Ce=>w.jsxs("tr",{children:[Ce.headers.map(be=>w.jsx("th",{className:Mt("border-b border-border px-3 py-2 text-left font-medium text-foreground",be.column.getCanSort()&&"cursor-pointer select-none",rr),onClick:!g&&be.column.getCanSort()?be.column.getToggleSortingHandler():void 0,children:w.jsxs("div",{className:"flex items-center gap-1",children:[be.isPlaceholder?null:el(be.column.columnDef.header,be.getContext()),g?null:{asc:w.jsx(bf,{className:"h-3 w-3"}),desc:w.jsx(gy,{className:"h-3 w-3"})}[be.column.getIsSorted()]??null]})},be.id)),Ke?w.jsx("th",{className:"border-b border-border px-3 py-2 text-left text-xs text-muted-foreground",children:w.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-muted-foreground hover:text-foreground",onClick:()=>l==null?void 0:l(),children:[w.jsx(Ga,{className:"h-3 w-3"}),c]})}):null]},Ce.id))}),w.jsx("tbody",{children:pe.length===0?w.jsx("tr",{children:w.jsx("td",{colSpan:Ie.getVisibleLeafColumns().length,className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No rows to display."})}):pe.map(Ce=>w.jsxs("tr",{className:"border-b border-border last:border-0",children:[Ce.getVisibleCells().map(be=>w.jsx("td",{className:Mt("h-10 px-3 py-2 align-top",rr),children:el(be.column.columnDef.cell,be.getContext())},be.id)),Ke?w.jsx("td",{className:"h-10 px-3 py-2"}):null]},Ce.id))})]})]},_.id)})}):w.jsx("div",{className:"min-h-0 border border-border",children:w.jsxs("table",{className:"w-full border-collapse text-sm",children:[w.jsx("thead",{className:"sticky top-0 bg-muted",children:Ie.getHeaderGroups().map(_=>w.jsxs("tr",{children:[_.headers.map(I=>w.jsx("th",{className:Mt("border-b border-border px-3 py-2 text-left font-medium text-foreground",I.column.getCanSort()&&"cursor-pointer select-none",rr),onClick:!g&&I.column.getCanSort()?I.column.getToggleSortingHandler():void 0,children:w.jsxs("div",{className:"flex items-center gap-1",children:[I.isPlaceholder?null:el(I.column.columnDef.header,I.getContext()),g?null:{asc:w.jsx(bf,{className:"h-3 w-3"}),desc:w.jsx(gy,{className:"h-3 w-3"})}[I.column.getIsSorted()]??null]})},I.id)),Ke?w.jsx("th",{className:"border-b border-border px-3 py-2 text-left text-xs text-muted-foreground",children:w.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-muted-foreground hover:text-foreground",onClick:()=>l==null?void 0:l(),children:[w.jsx(Ga,{className:"h-3 w-3"}),c]})}):null]},_.id))}),w.jsx("tbody",{children:Kr?Array.from({length:a},(_,I)=>{const pe=I===0;return w.jsxs("tr",{className:"border-b border-border last:border-0",children:[jn.map((Ce,be)=>w.jsx("td",{className:Mt("h-10 px-3 py-2 align-top text-xs text-muted-foreground",rr),children:pe&&be===0&&Sa?w.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-muted-foreground hover:text-foreground",onClick:()=>o==null?void 0:o(),children:[w.jsx(Ga,{className:"h-3 w-3"}),u]}):null},`${Ce.id}-${be}`)),Ke?w.jsx("td",{className:"h-10 px-3 py-2"}):null]},`empty-${I}`)}):Ie.getRowModel().rows.length===0?w.jsx("tr",{children:w.jsx("td",{colSpan:jn.length+(Ke?1:0),className:"px-3 py-10 text-center text-sm text-muted-foreground",children:"No rows to display."})}):w.jsxs(w.Fragment,{children:[Ie.getRowModel().rows.map(_=>w.jsxs("tr",{className:"border-b border-border last:border-0",children:[_.getVisibleCells().map(I=>w.jsx("td",{className:Mt("h-10 px-3 py-2 align-top",rr),children:I.getIsGrouped()?w.jsxs("button",{type:"button",onClick:_.getToggleExpandedHandler(),className:"flex items-center gap-1 text-left text-xs font-medium text-muted-foreground",children:[_.getIsExpanded()?w.jsx(jd,{className:"h-4 w-4"}):w.jsx(rb,{className:"h-4 w-4"}),el(I.column.columnDef.cell,I.getContext()),w.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",_.subRows.length,")"]})]}):I.getIsAggregated()?el(I.column.columnDef.aggregatedCell??I.column.columnDef.cell,I.getContext()):I.getIsPlaceholder()?null:el(I.column.columnDef.cell,I.getContext())},I.id)),Ke?w.jsx("td",{className:"h-10 px-3 py-2"}):null]},_.id)),Ec?w.jsxs("tr",{className:"border-b border-border last:border-0",children:[jn.map((_,I)=>w.jsx("td",{className:Mt("h-10 px-3 py-2 align-top text-xs text-muted-foreground",rr),children:I===0?w.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 text-muted-foreground hover:text-foreground",onClick:()=>o==null?void 0:o(),children:[w.jsx(Ga,{className:"h-3 w-3"}),u]}):null},`${_.id}-new-${I}`)),Ke?w.jsx("td",{className:"h-10 px-3 py-2"}):null]}):null]})})]})})})]})}function _3(t){const{jsonView:e,jsonError:n,jsonData:r,tableView:s,effectiveSchema:i,showSaveViewBanner:o,onViewChange:l,onPersistView:a,onResetView:u,onRowsChange:c,onAddRow:d,onAddColumn:f,addColumnOpen:h,onAddColumnOpenChange:p,newColumnName:m,newColumnType:y,newColumnOptions:g,addColumnError:x,onNewColumnNameChange:k,onNewColumnTypeChange:b,onNewColumnOptionsChange:S,onAddColumnConfirm:C,content:E,onContentChange:T}=t;return w.jsxs(w.Fragment,{children:[o?w.jsxs("div",{className:"flex flex-wrap items-center gap-3 border border-border bg-card px-3 py-2 text-sm",children:[w.jsx("span",{className:"text-muted-foreground",children:"View changes are temporary. Save to make them the default."}),w.jsx(ze,{type:"button",size:"sm",onClick:()=>a(s),children:"Save as default"}),w.jsx(ze,{type:"button",size:"sm",variant:"ghost",onClick:u,children:"Reset view"})]}):null,e==="table"?w.jsx("div",{className:"min-h-0 flex-1",children:s?w.jsx(A3,{rows:r??[],schema:i,view:s,onViewChange:l,onRowsChange:c,onAddRow:d,onAddColumn:f,addRowLabel:"New row",addColumnLabel:"Add property"}):w.jsx("div",{className:"rounded-md border border-border bg-card px-3 py-6 text-sm text-muted-foreground",children:"Loading table…"})}):null,e==="table"?w.jsx(_0,{open:h,onOpenChange:N=>{p(N)},children:w.jsxs(Xh,{children:[w.jsx(P0,{children:w.jsx(I0,{children:"Add property"})}),w.jsxs("div",{className:"mt-4 space-y-4 text-sm",children:[w.jsxs("label",{className:"flex flex-col gap-1",children:[w.jsx("span",{className:"text-xs text-muted-foreground",children:"Name"}),w.jsx("input",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:m,onChange:N=>k(N.target.value),placeholder:"Status"})]}),w.jsxs("label",{className:"flex flex-col gap-1",children:[w.jsx("span",{className:"text-xs text-muted-foreground",children:"Type"}),w.jsxs("select",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:y,onChange:N=>b(N.target.value),children:[w.jsx("option",{value:"text",children:"Text"}),w.jsx("option",{value:"select",children:"Select"})]})]}),y==="select"?w.jsxs("label",{className:"flex flex-col gap-1",children:[w.jsx("span",{className:"text-xs text-muted-foreground",children:"Options (comma-separated)"}),w.jsx("input",{className:"h-9 rounded-md border border-input bg-background px-3 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:g,onChange:N=>S(N.target.value),placeholder:"Todo, In progress, Done"})]}):null,x?w.jsx("div",{className:"text-xs text-destructive",children:x}):null,w.jsxs("div",{className:"flex justify-end gap-2",children:[w.jsx(ze,{type:"button",variant:"ghost",onClick:()=>p(!1),children:"Cancel"}),w.jsx(ze,{type:"button",onClick:C,children:"Add"})]})]})]})}):null,n?w.jsx("div",{className:"text-sm text-destructive",children:n}):null,e==="json"?w.jsx("textarea",{className:"min-h-0 w-full flex-1 border border-input bg-background px-3 py-2 font-mono text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",value:E,onChange:N=>T(N.target.value),placeholder:"Select a file to edit"}):null]})}var yM={exports:{}},vM={};/**
328
- * @license React
329
- * use-sync-external-store-shim.production.js
330
- *
331
- * Copyright (c) Meta Platforms, Inc. and affiliates.
332
- *
333
- * This source code is licensed under the MIT license found in the
334
- * LICENSE file in the root directory of this source tree.
335
- */var sa=v;function P3(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var I3=typeof Object.is=="function"?Object.is:P3,D3=sa.useState,L3=sa.useEffect,j3=sa.useLayoutEffect,$3=sa.useDebugValue;function z3(t,e){var n=e(),r=D3({inst:{value:n,getSnapshot:e}}),s=r[0].inst,i=r[1];return j3(function(){s.value=n,s.getSnapshot=e,Om(s)&&i({inst:s})},[t,n,e]),L3(function(){return Om(s)&&i({inst:s}),t(function(){Om(s)&&i({inst:s})})},[t]),$3(n),n}function Om(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!I3(t,n)}catch{return!0}}function F3(t,e){return e()}var B3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?F3:z3;vM.useSyncExternalStore=sa.useSyncExternalStore!==void 0?sa.useSyncExternalStore:B3;yM.exports=vM;var z0=yM.exports;function Dt(t){this.content=t}Dt.prototype={constructor:Dt,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,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new Dt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Dt(n)},addToStart:function(t,e){return new Dt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Dt(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new Dt(s)},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=Dt.from(t),t.size?new Dt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Dt.from(t),t.size?new Dt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Dt.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}};Dt.from=function(t){if(t instanceof Dt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Dt(e)};function xM(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=xM(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function wM(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){n-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:n,b:r};if(o.isText&&o.text!=l.text){let u=0,c=Math.min(o.text.length,l.text.length);for(;u<c&&o.text[o.text.length-u-1]==l.text[l.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(o.content.size||l.content.size){let u=wM(o.content,l.content,n-1,r-1);if(u)return u}n-=a,r-=a}}class D{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,s=0,i){for(let o=0,l=0;l<n;o++){let a=this.content[o],u=l+a.nodeSize;if(u>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let c=l+1;a.nodesBetween(Math.max(0,e-c),Math.min(a.content.size,n-c),r,s+c)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new D(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,n-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,n-o-1))),r.push(l),s+=l.nodeSize),o=a}return new D(r,s)}cutByIndex(e,n){return e==n?D.empty:e==0&&n==this.content.length?this:new D(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new D(s,i)}addToStart(e){return new D([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new D(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 s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return xM(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return wM(this,e,n,r)}findIndex(e){if(e==0)return ld(0,e);if(e==this.size)return ld(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 s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?ld(n+1,i):ld(n,r);r=i}}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 D.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new D(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return D.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new D(n||e,r)}static from(e){if(!e)return D.empty;if(e instanceof D)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new D([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}D.empty=new D([],0);const Am={index:0,offset:0};function ld(t,e){return Am.index=t,Am.offset=e,Am}function _f(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(!_f(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!_f(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Ge=class Dy{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}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&&_f(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 s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}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 Dy.none;if(e instanceof Dy)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};Ge.none=[];class Pf extends Error{}class U{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=bM(this.content,e+this.openStart,n);return r&&new U(r,this.openStart,this.openEnd)}removeBetween(e,n){return new U(kM(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 U.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new U(D.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new U(e,r,s)}}U.empty=new U(D.empty,0,0);function kM(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:l}=t.findIndex(n);if(s==e||i.isText){if(l!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(kM(i.content,e-s-1,n-s-1)))}function bM(t,e,n,r){let{index:s,offset:i}=t.findIndex(e),o=t.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=bM(o.content,e-i-1,n,o);return l&&t.replaceChild(s,o.copy(l))}function V3(t,e,n){if(n.openStart>t.depth)throw new Pf("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Pf("Inconsistent open depths");return SM(t,e,n,0)}function SM(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=SM(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,l=o.content;return yo(o,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=H3(n,t);return yo(i,EM(t,o,l,e,r))}else return yo(i,If(t,e,r))}function CM(t,e){if(!e.type.compatibleContent(t.type))throw new Pf("Cannot join "+e.type.name+" onto "+t.type.name)}function Ly(t,e,n){let r=t.node(n);return CM(r,e.node(n)),r}function go(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function hu(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(go(t.nodeAfter,r),i++));for(let l=i;l<o;l++)go(s.child(l),r);e&&e.depth==n&&e.textOffset&&go(e.nodeBefore,r)}function yo(t,e){return t.type.checkContent(e),t.copy(e)}function EM(t,e,n,r,s){let i=t.depth>s&&Ly(t,e,s+1),o=r.depth>s&&Ly(n,r,s+1),l=[];return hu(null,t,s,l),i&&o&&e.index(s)==n.index(s)?(CM(i,o),go(yo(i,EM(t,e,n,r,s+1)),l)):(i&&go(yo(i,If(t,e,s+1)),l),hu(e,n,s,l),o&&go(yo(o,If(n,r,s+1)),l)),hu(r,null,s,l),new D(l)}function If(t,e,n){let r=[];if(hu(null,t,n,r),t.depth>n){let s=Ly(t,e,n+1);go(yo(s,If(t,e,n+1)),r)}return hu(e,null,n,r),new D(r)}function H3(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(D.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class Ju{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],s=e.child(n);return r?e.child(n).cut(r):s}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],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Ge.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].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 Df(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=[],s=0,i=n;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),u=i-a;if(r.push(o,l,s+a),!u||(o=o.child(l),o.isText))break;i=u-1,s+=a+1}return new Ju(n,r,i)}static resolveCached(e,n){let r=Fb.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else Fb.set(e,r=new U3);let s=r.elts[r.i]=Ju.resolve(e,n);return r.i=(r.i+1)%W3,s}}class U3{constructor(){this.elts=[],this.i=0}}const W3=12,Fb=new WeakMap;class Df{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 q3=Object.create(null);let ki=class jy{constructor(e,n,r,s=Ge.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||D.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,s=0){this.content.nodesBetween(e,n,r,s,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,s){return this.content.textBetween(e,n,r,s)}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&&_f(this.attrs,n||e.defaultAttrs||q3)&&Ge.sameSet(this.marks,r||Ge.none)}copy(e=null){return e==this.content?this:new jy(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new jy(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 U.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),l=s.start(o),u=s.node(o).content.cut(s.pos-l,i.pos-l);return new U(u,s.depth-o,i.depth-o)}replace(e,n,r){return V3(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+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 s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return Ju.resolveCached(this,e)}resolveNoCache(e){return Ju.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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()+")"),TM(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=D.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ge.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(!Ge.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 s=D.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};ki.prototype.text=void 0;class Lf extends ki{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):TM(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 Lf(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Lf(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 TM(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Oo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new G3(e,n);if(r.next==null)return Oo.empty;let s=RM(r);r.next&&r.err("Unexpected trailing text");let i=eB(X3(s));return tB(i,r),i}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 s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}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 s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!n||a.validEnd))return D.from(l.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:c,next:d}=o.next[u];if(!(c.isText||c.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(c));if(f)return f}}return null}return i(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 s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),n[l.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 s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
336
- `)}}Oo.empty=new Oo(!0);class G3{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 RM(t){let e=[];do e.push(K3(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function K3(t){let e=[];do e.push(J3(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function J3(t){let e=Y3(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=Q3(t,e);else break;return e}function Bb(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Q3(t,e){let n=Bb(t),r=n;return t.eat(",")&&(t.next!="}"?r=Bb(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Z3(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function Y3(t){if(t.eat("(")){let e=RM(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=Z3(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 X3(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,l,a){let u={term:a,to:l};return e[o].push(u),u}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,u)=>a.concat(i(u,l)),[]);if(o.type=="seq")for(let a=0;;a++){let u=i(o.exprs[a],l);if(a==o.exprs.length-1)return u;s(u,l=n())}else if(o.type=="star"){let a=n();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=n();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let u=0;u<o.min;u++){let c=n();s(i(o.expr,a),c),a=c}if(o.max==-1)s(i(o.expr,a),a);else for(let u=o.min;u<o.max;u++){let c=n();r(a,c),s(i(o.expr,a),c),a=c}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function MM(t,e){return e-t}function Vb(t,e){let n=[];return r(e),n.sort(MM);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&n.indexOf(a)==-1&&r(a)}}}function eB(t){let e=Object.create(null);return n(Vb(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let c=0;c<s.length;c++)s[c][0]==l&&(u=s[c][1]);Vb(t,a).forEach(c=>{u||s.push([l,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let i=e[r.join(",")]=new Oo(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(MM);i.next.push({type:s[o][0],next:e[l.join(",")]||n(l)})}return i}}function tB(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:u}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(u)==-1&&r.push(u)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function NM(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 OM(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function AM(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in t){let i=t[s];i.validate&&i.validate(e[s])}}function _M(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new rB(t,r,e[r]);return n}let Hb=class PM{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=_M(e,r.attrs),this.defaultAttrs=NM(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==Oo.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:OM(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ki(this,this.computeAttrs(e),D.from(n),Ge.setFrom(r))}createChecked(e=null,n,r){return n=D.from(n),this.checkContent(n),new ki(this,this.computeAttrs(e),n,Ge.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=D.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(D.empty,!0);return i?new ki(this,e,n.append(i),Ge.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){AM(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:Ge.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new PM(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function nB(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class rB{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?nB(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class np{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=_M(e,s.attrs),this.excluded=null;let i=NM(this.attrs);this.instance=i?new Ge(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ge(this,OM(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new np(i,s++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){AM(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class IM{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=Dt.from(e.nodes),n.marks=Dt.from(e.marks||{}),this.nodes=Hb.compile(this.spec.nodes,this),this.marks=np.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Oo.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Ub(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:Ub(this,o.split(" "))}this.nodeFromJSON=s=>ki.fromJSON(this,s),this.markFromJSON=s=>Ge.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Hb){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,s)}text(e,n){let r=this.nodes.text;return new Lf(r,r.defaultAttrs,e,Ge.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 Ub(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function sB(t){return t.tag!=null}function iB(t){return t.style!=null}class ws{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(sB(s))this.tags.push(s);else if(iB(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new qb(this,n,!1);return r.addAll(e,Ge.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new qb(this,n,!0);return r.addAll(e,Ge.none,n.from,n.to),U.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(aB(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(o.getAttrs){let a=o.getAttrs(n);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let l=n[o];if((l.priority==null?50:l.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Gb(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Gb(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ws(e,ws.schemaRules(e)))}}const DM={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},oB={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},LM={ol:!0,ul:!0},Qu=1,$y=2,pu=4;function Wb(t,e,n){return e!=null?(e?Qu:0)|(e==="full"?$y:0):t&&t.whitespace=="pre"?Qu|$y:n&~pu}class ad{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=Ge.none,this.match=i||(o&pu?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(D.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Qu)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=D.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(D.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&&!DM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class qb{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=Wb(null,n.preserveWhitespace,0)|(r?pu:0);s?i=new ad(s.type,s.attrs,Ge.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new ad(null,null,Ge.none,!0,null,o):i=new ad(e.schema.topNodeType,null,Ge.none,!0,null,o),this.nodes=[i],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,s=this.top,i=s.options&$y?"full":this.localPreserveWS||(s.options&Qu)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
337
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(o.text(l[a]),n,!/\S/.test(l[a]));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 l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;LM.hasOwnProperty(o)&&this.parser.normalizeLists&&lB(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:oB.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let u,c=this.needsBlock;if(DM.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),u&&this.sync(i),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
338
- `),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 s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(u=>!a.clearMark(u)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],u=a.findWrapping(e);if(u&&(!s||s.length>u.length+l)&&(s=u,i=a,!u.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=Ge.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Kb(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Wb(e,i,o.options);o.options&pu&&o.content.length==0&&(l|=pu);let a=Ge.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):Kb(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new ad(e,n,a,s,null,l)),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|=Qu)}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 s=r.length-1;s>=0;s--)e+=r[s].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 s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].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,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let u=n[l];if(u==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let c=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;a--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function lB(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&LM.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function aB(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Gb(t){let e={};for(let n in t)e[n]=t[n];return e}function Kb(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:c}=l.edge(a);if(u==e||i.indexOf(c)<0&&o(c))return!0}};if(o(s.contentMatch))return!0}}class Fo{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=_m(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let u=o.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(i[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let u=o.marks[a++],c=this.serializeMark(u,o.isInline,n);c&&(i.push([u,s]),s.appendChild(c.dom),s=c.contentDOM||c.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:s}=Hd(_m(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&Hd(_m(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return Hd(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Fo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Jb(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Jb(e.marks)}}function Jb(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function _m(t){return t.document||window.document}const Qb=new WeakMap;function uB(t){let e=Qb.get(t);return e===void 0&&Qb.set(t,e=cB(t)),e}function cB(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 s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function Hd(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 s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=uB(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let l,a=n?t.createElementNS(n,s):t.createElement(s),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),u[d]):d=="style"&&a.style?a.style.cssText=u[d]:a.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Hd(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const jM=65535,$M=Math.pow(2,16);function dB(t,e){return t+e*$M}function Zb(t){return t&jM}function fB(t){return(t-(t&jM))/$M}const zM=1,FM=2,Ud=4,BM=8;class zy{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&BM)>0}get deletedBefore(){return(this.delInfo&(zM|Ud))>0}get deletedAfter(){return(this.delInfo&(FM|Ud))>0}get deletedAcross(){return(this.delInfo&Ud)>0}}class Rn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Rn.empty)return Rn.empty}recover(e){let n=0,r=Zb(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+fB(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 s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let u=this.ranges[l+i],c=this.ranges[l+o],d=a+u;if(e<=d){let f=u?e==a?-1:e==d?1:n:n,h=a+s+(f<0?0:c);if(r)return h;let p=e==(n<0?a:d)?null:dB(l/3,e-a),m=e==a?FM:e==d?zM:Ud;return(n<0?e!=a:e!=d)&&(m|=BM),new zy(h,m,p)}s+=c-u}return r?e+s:new zy(e+s,0,null)}touches(e,n){let r=0,s=Zb(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[l+i],c=a+u;if(e<=c&&l==s*3)return!0;r+=this.ranges[l+o]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),u=this.ranges[s+n],c=this.ranges[s+r];e(l,l+u,a,a+c),i+=c-u}}invert(){return new Rn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Rn.empty:new Rn(e<0?[0,-e,0]:[0,0,e])}}Rn.empty=new Rn([]);class Zu{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Zu(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 s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s: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 s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Zu;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 s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new zy(e,s,null)}}const Pm=Object.create(null);class Zt{getMap(){return Rn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Pm[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 Pm)throw new RangeError("Duplicate use of step JSON ID "+e);return Pm[e]=n,n.prototype.jsonID=e,n}}class yt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new yt(e,null)}static fail(e){return new yt(null,e)}static fromReplace(e,n,r,s){try{return yt.ok(e.replace(n,r,s))}catch(i){if(i instanceof Pf)return yt.fail(i.message);throw i}}}function F0(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(F0(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return D.fromArray(r)}class li extends Zt{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),s=r.node(r.sharedDepth(this.to)),i=new U(F0(n.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return yt.fromReplace(e,this.from,this.to,i)}invert(){return new gr(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 li(n.pos,r.pos,this.mark)}merge(e){return e instanceof li&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new li(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 li(n.from,n.to,e.markFromJSON(n.mark))}}Zt.jsonID("addMark",li);class gr extends Zt{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 U(F0(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return yt.fromReplace(e,this.from,this.to,r)}invert(){return new li(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 gr(n.pos,r.pos,this.mark)}merge(e){return e instanceof gr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new gr(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 gr(n.from,n.to,e.markFromJSON(n.mark))}}Zt.jsonID("removeMark",gr);class ai extends Zt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return yt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return yt.fromReplace(e,this.pos,this.pos+1,new U(D.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 s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new ai(this.pos,n.marks[s]);return new ai(this.pos,this.mark)}}return new Ao(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ai(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 ai(n.pos,e.markFromJSON(n.mark))}}Zt.jsonID("addNodeMark",ai);class Ao extends Zt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return yt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return yt.fromReplace(e,this.pos,this.pos+1,new U(D.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new ai(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ao(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 Ao(n.pos,e.markFromJSON(n.mark))}}Zt.jsonID("removeNodeMark",Ao);class Nt extends Zt{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Fy(e,this.from,this.to)?yt.fail("Structure replace would overwrite content"):yt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Rn([this.from,this.to-this.from,this.slice.size])}invert(e){return new Nt(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 Nt(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Nt)||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?U.empty:new U(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Nt(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?U.empty:new U(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Nt(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 Nt(n.from,n.to,U.fromJSON(e,n.slice),!!n.structure)}}Zt.jsonID("replace",Nt);class _t extends Zt{constructor(e,n,r,s,i,o,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&(Fy(e,this.from,this.gapFrom)||Fy(e,this.gapTo,this.to)))return yt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return yt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?yt.fromReplace(e,this.from,this.to,r):yt.fail("Content does not fit in gap")}getMap(){return new Rn([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 _t(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),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new _t(n.pos,r.pos,s,i,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 _t(n.from,n.to,n.gapFrom,n.gapTo,U.fromJSON(e,n.slice),n.insert,!!n.structure)}}Zt.jsonID("replaceAround",_t);function Fy(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function hB(t,e,n,r){let s=[],i=[],o,l;t.doc.nodesBetween(e,n,(a,u,c)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let f=Math.max(u,e),h=Math.min(u+a.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[m])?o.to=h:s.push(o=new gr(f,h,d[m])));l&&l.to==f?l.to=h:i.push(l=new li(f,h,r))}}),s.forEach(a=>t.step(a)),i.forEach(a=>t.step(a))}function pB(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof np){let u=o.marks,c;for(;c=r.isInSet(u);)(a||(a=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let u=Math.min(l+o.nodeSize,n);for(let c=0;c<a.length;c++){let d=a[c],f;for(let h=0;h<s.length;h++){let p=s[h];p.step==i-1&&d.eq(s[h].style)&&(f=p)}f?(f.to=u,f.step=i):s.push({style:d,from:Math.max(l,e),to:u,step:i})}}}),s.forEach(o=>t.step(new gr(o.from,o.to,o.style)))}function B0(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let u=i.child(a),c=l+u.nodeSize,d=r.matchType(u.type);if(!d)o.push(new Nt(l,c,U.empty));else{r=d;for(let f=0;f<u.marks.length;f++)n.allowsMarkType(u.marks[f].type)||t.step(new gr(l,c,u.marks[f]));if(s&&u.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(u.text);)p||(p=new U(D.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),o.push(new Nt(l+f.index,l+f.index+f[0].length,p))}}l=c}if(!r.validEnd){let a=r.fillBefore(D.empty,!0);t.replace(l,l,new U(a,0,0))}for(let a=o.length-1;a>=0;a--)t.step(o[a])}function mB(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ka(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),l=t.$from.index(r)+s,a=t.$to.indexAfter(r)-i;if(r<t.depth&&o.canReplace(l,a,n))return r;if(r==0||o.type.spec.isolating||!mB(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function gB(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,u=l,c=D.empty,d=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,c=D.from(r.node(p).copy(c)),d++):a--;let f=D.empty,h=0;for(let p=i,m=!1;p>n;p--)m||s.after(p+1)<s.end(p)?(m=!0,f=D.from(s.node(p).copy(f)),h++):u++;t.step(new _t(a,u,o,l,new U(c.append(f),d,h),c.size-d,!0))}function V0(t,e,n=null,r=t){let s=yB(t,e),i=s&&vB(r,e);return i?s.map(Yb).concat({type:e,attrs:n}).concat(i.map(Yb)):null}function Yb(t){return{type:t,attrs:null}}function yB(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function vB(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;a&&u<s;u++)a=a.matchType(n.child(u).type);return!a||!a.validEnd?null:o}function xB(t,e,n){let r=D.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let l=n[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=D.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new _t(s,i,s,i,new U(r,0,0),n.length,!0))}function wB(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&kB(t.doc,t.mapping.slice(i).map(l),r)){let u=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?u=!1:!h&&p&&(u=!0)}u===!1&&HM(t,o,l,i),B0(t,t.mapping.slice(i).map(l,1),r,void 0,u===null);let c=t.mapping.slice(i),d=c.map(l,1),f=c.map(l+o.nodeSize,1);return t.step(new _t(d,f,d+1,f-1,new U(D.from(r.create(a,null,o.marks)),0,0),1,!0)),u===!0&&VM(t,o,l,i),!1}})}function VM(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function HM(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
339
- `))}})}function kB(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function bB(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new _t(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new U(D.from(o),0,0),1,!0))}function ks(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let u=s.depth-1,c=n-2;u>i;u--,c--){let d=s.node(u),f=s.index(u);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[c+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[c]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=s.indexAfter(i),a=r&&r[0];return s.node(i).canReplaceWith(l,l,a?a.type:s.node(i+1).type)}function SB(t,e,n=1,r){let s=t.doc.resolve(e),i=D.empty,o=D.empty;for(let l=s.depth,a=s.depth-n,u=n-1;l>a;l--,u--){i=D.from(s.node(l).copy(i));let c=r&&r[u];o=D.from(c?c.type.create(c.attrs,o):s.node(l).copy(o))}t.step(new Nt(e,e,new U(i.append(o),n,n),!0))}function $i(t,e){let n=t.resolve(e),r=n.index();return UM(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function CB(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function UM(t,e){return!!(t&&e&&!t.isLeaf&&CB(t,e))}function rp(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;s--){let i,o,l=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),l++,o=r.node(s).maybeChild(l)):(i=r.node(s).maybeChild(l-1),o=r.node(s+1)),i&&!i.isTextblock&&UM(i,o)&&r.node(s).canReplace(l,l+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function EB(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let c=o.whitespace=="pre",d=!!o.contentMatch.matchType(s);c&&!d?r=!1:!c&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);HM(t,c.node(),c.before(),l)}o.inlineContent&&B0(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let a=t.mapping.slice(l),u=a.map(e-n);if(t.step(new Nt(u,a.map(e+n,-1),U.empty,!0)),r===!0){let c=t.doc.resolve(u);VM(t,c.node(),c.before(),t.steps.length)}return t}function TB(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 s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function WM(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),u=r.node(o),c=!1;if(i==1)c=u.canReplace(a,a,s);else{let d=u.contentMatchAt(a).findWrapping(s.firstChild.type);c=d&&u.canReplaceWith(a,a,d[0])}if(c)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function sp(t,e,n=e,r=U.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return qM(s,i,r)?new Nt(e,n,r):new RB(s,i,r).fit()}function qM(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class RB{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=D.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=D.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,l=s.depth;for(;o&&l&&i.childCount==1;)i=i.firstChild.content,o--,l--;let a=new U(i,o,l);return e>-1?new _t(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new Nt(r.pos,s.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=Im(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],c,d=null;if(n==1&&(o?u.matchType(o.type)||(d=u.fillBefore(D.from(o),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:c};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Im(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new U(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=Im(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new U(Ja(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new U(Ja(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,u=0,c=[],{match:d,type:f}=this.frontier[n];if(s){for(let m=0;m<s.childCount;m++)c.push(s.child(m));d=d.matchFragment(s)}let h=l.size+e-(o.content.size-o.openEnd);for(;u<l.childCount;){let m=l.child(u),y=d.matchType(m.type);if(!y)break;u++,(u>1||a==0||m.content.size)&&(d=y,c.push(GM(m.mark(f.allowedMarks(m.marks)),u==1?a:0,u==l.childCount?h:-1)))}let p=u==l.childCount;p||(h=-1),this.placed=Qa(this.placed,n,D.from(c)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=l;m<h;m++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=p?e==0?U.empty:new U(Ja(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new U(Ja(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Dm(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,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Dm(e,n,s,r,i);if(o){for(let l=n-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],c=Dm(e,l,u,a,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:i?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=Qa(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=Qa(this.placed,this.depth,D.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(D.empty,!0);n.childCount&&(this.placed=Qa(this.placed,this.frontier.length,n))}}function Ja(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ja(t.firstChild.content,e-1,n)))}function Qa(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Qa(t.lastChild.content,e-1,n)))}function Im(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function GM(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,GM(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(D.empty,!0)))),t.copy(r)}function Dm(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,o);return l&&!MB(n,i.content,o)?l:null}function MB(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function NB(t){return t.spec.defining||t.spec.definingForContent}function OB(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(qM(s,i,r))return t.step(new Nt(e,n,r));let o=JM(s,i);o[o.length-1]==0&&o.pop();let l=-(s.depth+1);o.unshift(l);for(let f=s.depth,h=s.pos-1;f>0;f--,h--){let p=s.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?l=f:s.before(f)==h&&o.splice(1,0,-f)}let a=o.indexOf(l),u=[],c=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(u.push(p),h==r.openStart)break;f=p.content}for(let f=c-1;f>=0;f--){let h=u[f],p=NB(h.type);if(p&&!h.sameMarkup(s.node(Math.abs(l)-1)))c=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+c+1)%(r.openStart+1),p=u[h];if(p)for(let m=0;m<o.length;m++){let y=o[(m+a)%o.length],g=!0;y<0&&(g=!1,y=-y);let x=s.node(y-1),k=s.index(y-1);if(x.canReplaceWith(k,k,p.type,p.marks))return t.replace(s.before(y),g?i.after(y):n,new U(KM(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=o[f];h<0||(e=s.before(h),n=i.after(h))}}function KM(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(KM(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(D.empty,!0))}return t}function AB(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=TB(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new U(D.from(r),0,0))}function _B(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n),i=JM(r,s);for(let o=0;o<i.length;o++){let l=i[o],a=o==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),s.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),s.indexAfter(l-1))))return t.delete(r.before(l),s.after(l))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function JM(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class Ol extends Zt{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 yt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return yt.fromReplace(e,this.pos,this.pos+1,new U(D.from(s),0,n.isLeaf?0:1))}getMap(){return Rn.empty}invert(e){return new Ol(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 Ol(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 Ol(n.pos,n.attr,n.value)}}Zt.jsonID("attr",Ol);class Yu extends Zt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return yt.ok(r)}getMap(){return Rn.empty}invert(e){return new Yu(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 Yu(n.attr,n.value)}}Zt.jsonID("docAttr",Yu);let ia=class extends Error{};ia=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ia.prototype=Object.create(Error.prototype);ia.prototype.constructor=ia;ia.prototype.name="TransformError";class QM{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Zu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ia(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 s=this.mapping.maps[r];r&&(e=s.map(e,1),n=s.map(n,-1)),s.forEach((i,o,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}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=U.empty){let s=sp(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new U(D.from(r),0,0))}delete(e,n){return this.replace(e,n,U.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return OB(this,e,n,r),this}replaceRangeWith(e,n,r){return AB(this,e,n,r),this}deleteRange(e,n){return _B(this,e,n),this}lift(e,n){return gB(this,e,n),this}join(e,n=1){return EB(this,e,n),this}wrap(e,n){return xB(this,e,n),this}setBlockType(e,n=e,r,s=null){return wB(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return bB(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new Ol(e,n,r)),this}setDocAttribute(e,n){return this.step(new Yu(e,n)),this}addNodeMark(e,n){return this.step(new ai(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 Ge)n.isInSet(r.marks)&&this.step(new Ao(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new Ao(e,i)),s=i.removeFromSet(s);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,n=1,r){return SB(this,e,n,r),this}addMark(e,n,r){return hB(this,e,n,r),this}removeMark(e,n,r){return pB(this,e,n,r),this}clearIncompatible(e,n,r){return B0(this,e,n,r),this}}const Lm=Object.create(null);class me{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new ZM(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=U.empty){let r=n.content.lastChild,s=null;for(let l=0;l<n.openEnd;l++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:u}=o[l],c=e.mapping.slice(i);e.replaceRange(c.map(a.pos),c.map(u.pos),l?U.empty:n),l==0&&t1(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:l}=s[i],a=e.mapping.slice(r),u=a.map(o.pos),c=a.map(l.pos);i?e.deleteRange(u,c):(e.replaceRangeWith(u,c,n),t1(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new ge(e):ll(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?ll(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):ll(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new On(e.node(0))}static atStart(e){return ll(e,e,0,0,1)||new On(e)}static atEnd(e){return ll(e,e,e.content.size,e.childCount,-1)||new On(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Lm[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 Lm)throw new RangeError("Duplicate use of selection JSON ID "+e);return Lm[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ge.between(this.$anchor,this.$head).getBookmark()}}me.prototype.visible=!0;class ZM{constructor(e,n){this.$from=e,this.$to=n}}let Xb=!1;function e1(t){!Xb&&!t.parent.inlineContent&&(Xb=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ge extends me{constructor(e,n=e){e1(e),e1(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 me.near(r);let s=e.resolve(n.map(this.anchor));return new ge(s.parent.inlineContent?s:r,r)}replace(e,n=U.empty){if(super.replace(e,n),n==U.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ge&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ip(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 ge(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=me.findFrom(n,r,!0)||me.findFrom(n,-r,!0);if(i)n=i.$head;else return me.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(me.findFrom(e,-r,!0)||me.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new ge(e,n)}}me.jsonID("text",ge);class ip{constructor(e,n){this.anchor=e,this.head=n}map(e){return new ip(e.map(this.anchor),e.map(this.head))}resolve(e){return ge.between(e.resolve(this.anchor),e.resolve(this.head))}}class ue extends me{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:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?me.near(i):new ue(i)}content(){return new U(D.from(this.node),0,0)}eq(e){return e instanceof ue&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new H0(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ue(e.resolve(n.anchor))}static create(e,n){return new ue(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ue.prototype.visible=!1;me.jsonID("node",ue);class H0{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new ip(r,r):new H0(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&ue.isSelectable(r)?new ue(n):me.near(n)}}class On extends me{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=U.empty){if(n==U.empty){e.delete(0,e.doc.content.size);let r=me.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new On(e)}map(e){return new On(e)}eq(e){return e instanceof On}getBookmark(){return PB}}me.jsonID("all",On);const PB={map(){return this},resolve(t){return new On(t)}};function ll(t,e,n,r,s,i=!1){if(e.inlineContent)return ge.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let l=e.child(o);if(l.isAtom){if(!i&&ue.isSelectable(l))return ue.create(t,n-(s<0?l.nodeSize:0))}else{let a=ll(t,l,n+s,s<0?l.childCount:0,s,i);if(a)return a}n+=l.nodeSize*s}return null}function t1(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof Nt||s instanceof _t))return;let i=t.mapping.maps[r],o;i.forEach((l,a,u,c)=>{o==null&&(o=c)}),t.setSelection(me.near(t.doc.resolve(o),n))}const n1=1,ud=2,r1=4;class IB extends QM{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|n1)&~ud,this.storedMarks=null,this}get selectionSet(){return(this.updated&n1)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ud,this}ensureMarks(e){return Ge.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&ud)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~ud,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)||Ge.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(me.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|=r1,this}get scrolledIntoView(){return(this.updated&r1)>0}}function s1(t,e){return!e||!t?t:t.bind(e)}class Za{constructor(e,n,r){this.name=e,this.init=s1(n.init,r),this.apply=s1(n.apply,r)}}const DB=[new Za("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Za("selection",{init(t,e){return t.selection||me.atStart(e.doc)},apply(t){return t.selection}}),new Za("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Za("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class jm{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=DB.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 Za(r.key,r.spec.state,r))})}}class bl{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 s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=s?s[o].n:0,u=s?s[o].state:this,c=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,u,r);if(c&&r.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!s){s=[];for(let d=0;d<this.config.plugins.length;d++)s.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new bl(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new IB(this)}static create(e){let n=new jm(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new bl(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new jm(this.schema,e.plugins),r=n.fields,s=new bl(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}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 s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.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 s=new jm(e.schema,e.plugins),i=new bl(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=ki.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=me.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],u=a.spec.state;if(a.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[o.name]=u.fromJSON.call(a,e,n[l],i);return}}i[o.name]=o.init(e,i)}}),i}}function YM(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=YM(s,e,{})),n[r]=s}return n}class tt{constructor(e){this.spec=e,this.props={},e.props&&YM(e.props,this,this.props),this.key=e.key?e.key.key:XM("plugin")}getState(e){return e[this.key]}}const $m=Object.create(null);function XM(t){return t in $m?t+"$"+ ++$m[t]:($m[t]=0,t+"$")}class rt{constructor(e="key"){this.key=XM(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const U0=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function eN(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const tN=(t,e,n)=>{let r=eN(t,n);if(!r)return!1;let s=W0(r);if(!s){let o=r.blockRange(),l=o&&ka(o);return l==null?!1:(e&&e(t.tr.lift(o,l).scrollIntoView()),!0)}let i=s.nodeBefore;if(cN(t,s,e,-1))return!0;if(r.parent.content.size==0&&(oa(i,"end")||ue.isSelectable(i)))for(let o=r.depth;;o--){let l=sp(t.doc,r.before(o),r.after(o),U.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(oa(i,"end")?me.findFrom(a.doc.resolve(a.mapping.map(s.pos,-1)),-1):ue.create(a.doc,s.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},LB=(t,e,n)=>{let r=eN(t,n);if(!r)return!1;let s=W0(r);return s?nN(t,s,e):!1},jB=(t,e,n)=>{let r=sN(t,n);if(!r)return!1;let s=q0(r);return s?nN(t,s,e):!1};function nN(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let c=s.lastChild;if(!c)return!1;s=c}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let c=l.firstChild;if(!c)return!1;l=c}let u=sp(t.doc,i,a,U.empty);if(!u||u.from!=i||u instanceof Nt&&u.slice.size>=a-i)return!1;if(n){let c=t.tr.step(u);c.setSelection(ge.create(c.doc,i)),n(c.scrollIntoView())}return!0}function oa(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 rN=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=W0(r)}let o=i&&i.nodeBefore;return!o||!ue.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ue.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function W0(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 sN(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const iN=(t,e,n)=>{let r=sN(t,n);if(!r)return!1;let s=q0(r);if(!s)return!1;let i=s.nodeAfter;if(cN(t,s,e,1))return!0;if(r.parent.content.size==0&&(oa(i,"start")||ue.isSelectable(i))){let o=sp(t.doc,r.before(),r.after(),U.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=t.tr.step(o);l.setSelection(oa(i,"start")?me.findFrom(l.doc.resolve(l.mapping.map(s.pos)),1):ue.create(l.doc,l.mapping.map(s.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},oN=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=q0(r)}let o=i&&i.nodeAfter;return!o||!ue.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ue.create(t.doc,i.pos)).scrollIntoView()),!0)};function q0(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 $B=(t,e)=>{let n=t.selection,r=n instanceof ue,s;if(r){if(n.node.isTextblock||!$i(t.doc,n.from))return!1;s=n.from}else if(s=rp(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(ue.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},zB=(t,e)=>{let n=t.selection,r;if(n instanceof ue){if(n.node.isTextblock||!$i(t.doc,n.to))return!1;r=n.to}else if(r=rp(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},FB=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&ka(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},lN=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
340
- `).scrollIntoView()),!0)};function G0(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 BB=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=G0(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,o.createAndFill());a.setSelection(me.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},aN=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof On||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=G0(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,l=t.tr.insert(o,i.createAndFill());l.setSelection(ge.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},uN=(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 i=n.before();if(ks(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&ka(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function VB(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof ue&&e.selection.node.isBlock)return!r.parentOffset||!ks(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,l,a=!1,u=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),u=r.start(h)==r.pos-(r.depth-h),l=G0(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),i.unshift(a&&l?{type:l}:null),o=h;break}else{if(h==1)return!1;i.unshift(null)}let c=e.tr;(e.selection instanceof ge||e.selection instanceof On)&&c.deleteSelection();let d=c.mapping.map(r.pos),f=ks(c.doc,d,i.length,i);if(f||(i[0]=l?{type:l}:null,f=ks(c.doc,d,i.length,i)),!f)return!1;if(c.split(d,i.length,i),!a&&u&&r.node(o).type!=l){let h=c.mapping.map(r.before(o)),p=c.doc.resolve(h);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&c.setNodeMarkup(c.mapping.map(r.before(o)),l)}return n&&n(c.scrollIntoView()),!0}}const HB=VB(),UB=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(ue.create(t.doc,s))),!0)};function WB(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||$i(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function cN(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,l,a=s.type.spec.isolating||i.type.spec.isolating;if(!a&&WB(t,e,n))return!0;let u=!a&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(l=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&l.matchType(o[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,p=D.empty;for(let g=o.length-1;g>=0;g--)p=D.from(o[g].create(null,p));p=D.from(s.copy(p));let m=t.tr.step(new _t(e.pos-1,h,e.pos,h,new U(p,1,0),o.length,!0)),y=m.doc.resolve(h+2*o.length);y.nodeAfter&&y.nodeAfter.type==s.type&&$i(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let c=i.type.spec.isolating||r>0&&a?null:me.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),f=d&&ka(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(u&&oa(i,"start",!0)&&oa(s,"end")){let h=s,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=i,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let g=D.empty;for(let k=p.length-1;k>=0;k--)g=D.from(p[k].copy(g));let x=t.tr.step(new _t(e.pos-p.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new U(g,p.length,0),0,!0));n(x.scrollIntoView())}return!0}}return!1}function dN(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(ge.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const qB=dN(-1),GB=dN(1);function KB(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),l=o&&V0(o,t,e);return l?(r&&r(n.tr.wrap(o,l).scrollIntoView()),!0):!1}}function i1(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(o,l,(a,u)=>{if(s)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)s=!0;else{let c=n.doc.resolve(u),d=c.index();s=c.parent.canReplaceWith(d,d+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[o];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}function K0(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}K0(U0,tN,rN);K0(U0,iN,oN);K0(lN,aN,uN,HB);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function JB(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let l=r?n.tr:null;return QB(l,o,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function QB(t,e,n,r=null){let s=!1,i=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);i=new Df(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Df(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let l=V0(i,n,r,e);return l?(t&&ZB(t,e,l,s,n),!0):!1}function ZB(t,e,n,r,s){let i=D.empty;for(let c=n.length-1;c>=0;c--)i=D.from(n[c].type.create(n[c].attrs,i));t.step(new _t(e.start-(r?2:0),e.end,e.start,e.end,new U(i,0,0),n.length,!0));let o=0;for(let c=0;c<n.length;c++)n[c].type==s&&(o=c+1);let l=n.length-o,a=e.start+n.length-(r?2:0),u=e.parent;for(let c=e.startIndex,d=e.endIndex,f=!0;c<d;c++,f=!1)!f&&ks(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=u.child(c).nodeSize;return t}function YB(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?XB(e,n,t,i):e4(e,n,i):!0:!1}}function XB(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new _t(i-1,o,i,o,new U(D.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Df(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const l=ka(r);if(l==null)return!1;s.lift(r,l);let a=s.doc.resolve(s.mapping.map(i,-1)-1);return $i(s.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&s.join(a.pos),e(s.scrollIntoView()),!0}function e4(t,e,n){let r=t.tr,s=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=s.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==s.childCount,u=i.node(-1),c=i.index(-1);if(!u.canReplace(c+(l?0:1),c+1,o.content.append(a?D.empty:D.from(s))))return!1;let d=i.pos,f=d+o.nodeSize;return r.step(new _t(d-(l?1:0),f+(a?1:0),d+1,f-1,new U((l?D.empty:D.from(s.copy(D.empty))).append(a?D.empty:D.from(s.copy(D.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function t4(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,u=>u.childCount>0&&u.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let l=i.parent,a=l.child(o-1);if(a.type!=t)return!1;if(n){let u=a.lastChild&&a.lastChild.type==l.type,c=D.from(u?t.create():null),d=new U(D.from(t.create(null,D.from(l.type.create(null,c)))),u?3:1,0),f=i.start,h=i.end;n(e.tr.step(new _t(f-(u?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const jt=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},la=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let By=null;const as=function(t,e,n){let r=By||(By=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},n4=function(){By=null},_o=function(t,e,n,r){return n&&(o1(t,e,n,r,-1)||o1(t,e,n,r,1))},r4=/^(img|br|input|textarea|hr)$/i;function o1(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:Gn(t))){let o=t.parentNode;if(!o||o.nodeType!=1||xc(t)||r4.test(t.nodeName)||t.contentEditable=="false")return!1;e=jt(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?Gn(t):0}else return!1}}function Gn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function s4(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=Gn(t)}else if(t.parentNode&&!xc(t))e=jt(t),t=t.parentNode;else return null}}function i4(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&&!xc(t))e=jt(t)+1,t=t.parentNode;else return null}}function o4(t,e,n){for(let r=e==0,s=e==Gn(t);r||s;){if(t==n)return!0;let i=jt(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==Gn(t)}}function xc(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 op=function(t){return t.focusNode&&_o(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Ji(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function l4(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function a4(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Gn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Gn(r.startContainer),r.startOffset)}}}const Ur=typeof navigator<"u"?navigator:null,l1=typeof document<"u"?document:null,zi=Ur&&Ur.userAgent||"",Vy=/Edge\/(\d+)/.exec(zi),fN=/MSIE \d/.exec(zi),Hy=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(zi),wn=!!(fN||Hy||Vy),bi=fN?document.documentMode:Hy?+Hy[1]:Vy?+Vy[1]:0,Qn=!wn&&/gecko\/(\d+)/i.test(zi);Qn&&+(/Firefox\/(\d+)/.exec(zi)||[0,0])[1];const Uy=!wn&&/Chrome\/(\d+)/.exec(zi),Ot=!!Uy,hN=Uy?+Uy[1]:0,Bt=!wn&&!!Ur&&/Apple Computer/.test(Ur.vendor),aa=Bt&&(/Mobile\/\w+/.test(zi)||!!Ur&&Ur.maxTouchPoints>2),Hn=aa||(Ur?/Mac/.test(Ur.platform):!1),pN=Ur?/Win/.test(Ur.platform):!1,gs=/Android \d/.test(zi),wc=!!l1&&"webkitFontSmoothing"in l1.documentElement.style,u4=wc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function c4(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 Yr(t,e){return typeof t=="number"?t:t[e]}function d4(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 a1(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=la(o);continue}let l=o,a=l==i.body,u=a?c4(i):d4(l),c=0,d=0;if(e.top<u.top+Yr(r,"top")?d=-(u.top-e.top+Yr(s,"top")):e.bottom>u.bottom-Yr(r,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+Yr(s,"top")-u.top:e.bottom-u.bottom+Yr(s,"bottom")),e.left<u.left+Yr(r,"left")?c=-(u.left-e.left+Yr(s,"left")):e.right>u.right-Yr(r,"right")&&(c=e.right-u.right+Yr(s,"right")),c||d)if(a)i.defaultView.scrollBy(c,d);else{let h=l.scrollLeft,p=l.scrollTop;d&&(l.scrollTop+=d),c&&(l.scrollLeft+=c);let m=l.scrollLeft-h,y=l.scrollTop-p;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:la(o)}}function f4(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=t.root.elementFromPoint(i,o);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,s=a.top;break}}return{refDOM:r,refTop:s,stack:mN(t.dom)}}function mN(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=la(r));return e}function h4({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;gN(n,r==0?0:r-e)}function gN(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let tl=null;function p4(t){if(t.setActive)return t.setActive();if(tl)return t.focus(tl);let e=mN(t);t.focus(tl==null?{get preventScroll(){return tl={preventScroll:!0},!0}}:void 0),tl||(tl=!1,gN(e,0))}function yN(t,e){let n,r=2e8,s,i=0,o=e.top,l=e.top,a,u;for(let c=t.firstChild,d=0;c;c=c.nextSibling,d++){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=as(c).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=c,r=m,s=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,c.nodeType==1&&m&&(i=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=c,u={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(i=d+1)}}return!n&&a&&(n=a,s=u,r=0),n&&n.nodeType==3?m4(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:yN(n,s)}function m4(t,e){let n=t.nodeValue.length,r=document.createRange(),s;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let o=$s(r,1);if(o.top!=o.bottom&&J0(e,o)){s={node:t,offset:i+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),s||{node:t,offset:0}}function J0(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function g4(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function y4(t,e,n){let{node:r,offset:s}=yN(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function v4(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?s=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(s=l.posAfter),o=!0),!l.contentDOM&&s<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function vN(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(J0(e,u))return vN(o,e,u)}}if((i=(i+1)%r)==s)break}return t}function x4(t,e){let n=t.dom.ownerDocument,r,s=0,i=a4(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=t.dom.getBoundingClientRect();if(!J0(e,u)||(o=vN(t.dom,e,u),!o))return null}if(Bt)for(let u=o;r&&u;u=la(u))u.draggable&&(r=void 0);if(o=g4(o,e),r){if(Qn&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let c=r.childNodes[s],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&s++}let u;wc&&s&&r.nodeType==1&&(u=r.childNodes[s-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(l=v4(t,r,s,e))}l==null&&(l=y4(t,o,e));let a=t.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function u1(t){return t.top<t.bottom||t.left<t.right}function $s(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(u1(r))return r}return Array.prototype.find.call(n,u1)||t.getBoundingClientRect()}const w4=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function xN(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=wc||Qn;if(r.nodeType==3)if(o&&(w4.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let a=$s(as(r,s,s),n);if(Qn&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let u=$s(as(r,s-1,s-1),-1);if(u.top==a.top){let c=$s(as(r,s,s+1),-1);if(c.top!=a.top)return ja(c,c.left<u.left)}}return a}else{let a=s,u=s,c=n<0?1:-1;return n<0&&!s?(u++,c=-1):n>=0&&s==r.nodeValue.length?(a--,c=1):n<0?a--:u++,ja($s(as(r,a,u),c),c<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==Gn(r))){let a=r.childNodes[s-1];if(a.nodeType==1)return zm(a.getBoundingClientRect(),!1)}if(i==null&&s<Gn(r)){let a=r.childNodes[s];if(a.nodeType==1)return zm(a.getBoundingClientRect(),!0)}return zm(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==Gn(r))){let a=r.childNodes[s-1],u=a.nodeType==3?as(a,Gn(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return ja($s(u,1),!1)}if(i==null&&s<Gn(r)){let a=r.childNodes[s];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?a.nodeType==3?as(a,0,o?0:1):a.nodeType==1?a:null:null;if(u)return ja($s(u,-1),!0)}return ja($s(r.nodeType==3?as(r):r,-n),n>=0)}function ja(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 zm(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 wN(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function k4(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return wN(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let o=xN(t,s.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=as(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let c=a[u];if(c.bottom>c.top+1&&(n=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const b4=/[\u0590-\u08ac]/;function S4(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,l=t.domSelection();return l?!b4.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:o:wN(t,e,()=>{let{focusNode:a,focusOffset:u,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),y=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&u==m;try{l.collapse(c,d),a&&(a!=c||u!=d)&&l.extend&&l.extend(a,u)}catch{}return f!=null&&(l.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let c1=null,d1=null,f1=!1;function C4(t,e,n){return c1==e&&d1==n?f1:(c1=e,d1=n,f1=n=="up"||n=="down"?k4(t,e,n):S4(t,e,n))}const Zn=0,h1=1,eo=2,Wr=3;class kc{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Zn,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 s=this.children[n];if(s==e)return r;r+=s.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 i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>jt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}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 s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let l=s.children[o];if(l.size){s=l;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],l=i+o.size;if(l>e||o instanceof bN){s=e-i;break}i=l}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof kN&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?jt(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?jt(i.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 s=-1,i=-1;for(let o=r,l=0;;l++){let a=this.children[l],u=o+a.size;if(s==-1&&e<=u){let c=o+a.border;if(e>=c&&n<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,c);e=o;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){s=jt(f.dom)+1;break}e-=f.size}s==-1&&(s=0)}if(s>-1&&(u>n||l==this.children.length-1)){n=u;for(let c=l+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=jt(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}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,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],y=p+m.size;if(i>p&&o<y)return m.setSelection(e-p-m.border,n-p-m.border,r,s);p=y}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((Qn||Bt)&&e==n){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
341
- `),d&&p==h.nodeValue.length)for(let m=h,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:jt(y)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Qn&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(s=!0)}if(!(s||d&&Bt)&&_o(l.node,l.offset,c.anchorNode,c.anchorOffset)&&_o(a.node,a.offset,c.focusNode,c.focusOffset))return;let f=!1;if((u.extend||e==n)&&!(d&&Qn)){u.collapse(l.node,l.offset);try{e!=n&&u.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(h)}}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,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let l=r+i.border,a=o-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==o?eo:h1,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Wr:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?eo:Wr}r=o}this.dirty=eo}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?eo:h1;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class kN extends kc{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Zn&&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 E4 extends kc{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}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 Po extends kc{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=Fo.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Po(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Wr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Wr&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Zn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Zn}}slice(e,n,r){let s=Po.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=qy(i,n,o,r)),e>0&&(i=qy(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Si extends kc{constructor(e,n,r,s,i,o,l,a,u){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=l}static create(e,n,r,s,i,o){let l=i.nodeViews[n.type.name],a,u=l&&l(n,i,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,s),c=u&&u.dom,d=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=Fo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let f=c;return c=EN(c,r,n),u?a=new T4(e,n,r,s,c,d||null,f,u,i,o+1):n.isText?new lp(e,n,r,s,c,f,i):new Si(e,n,r,s,c,d||null,f,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>D.empty)}return e}matchesNode(e,n,r){return this.dirty==Zn&&e.eq(this.node)&&jf(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,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new M4(this,o&&o.node,e);A4(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?a.syncToMarks(u.spec.marks,r,e,c):u.type.side>=0&&!d&&a.syncToMarks(c==this.node.childCount?Ge.none:this.node.child(c).marks,r,e,c),a.placeWidget(u,e,s)},(u,c,d,f)=>{a.syncToMarks(u.marks,r,e,f);let h;a.findNodeMatch(u,c,d,f)||l&&e.state.selection.from>s&&e.state.selection.to<s+u.nodeSize&&(h=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(u,c,d,h,e)||a.updateNextNode(u,c,d,e,f,s)||a.addNode(u,c,d,e,s),s+=u.nodeSize}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==eo)&&(o&&this.protectLocalComposition(e,o),SN(this.contentDOM,this.children,e),aa&&_4(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof ge)||r<n||s>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,l=P4(this.node.content,o,r-n,s-n);return l<0?null:{node:i,pos:l,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new E4(this,i,n,s);e.input.compositionNodes.push(o),this.children=qy(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==Wr||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Zn}updateOuterDeco(e){if(jf(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=CN(this.dom,this.nodeDOM,Wy(this.outerDeco,this.node,n),Wy(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 p1(t,e,n,r,s){EN(r,e,t);let i=new Si(void 0,t,e,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class lp extends Si{constructor(e,n,r,s,i,o,l){super(e,n,r,s,i,null,o,l,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,s){return this.dirty==Wr||this.dirty!=Zn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Zn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Zn,!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 s=this.node.cut(e,n),i=document.createTextNode(s.text);return new lp(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Wr)}get domAtom(){return!1}isText(e){return this.node.text==e}}class bN extends kc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Zn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class T4 extends Si{constructor(e,n,r,s,i,o,l,a,u,c){super(e,n,r,s,i,o,l,u,c),this.spec=a}update(e,n,r,s){if(this.dirty==Wr)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}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 SN(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],l=o.dom;if(l.parentNode==t){for(;l!=r;)r=m1(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(l,r);if(o instanceof Po){let a=r?r.previousSibling:t.lastChild;SN(o.contentDOM,o.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=m1(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const mu=function(t){t&&(this.nodeName=t)};mu.prototype=Object.create(null);const to=[new mu];function Wy(t,e,n){if(t.length==0)return to;let r=n?to[0]:new mu,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new mu(o.nodeName));for(let l in o){let a=o[l];a!=null&&(n&&s.length==1&&s.push(r=new mu(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return s}function CN(t,e,n,r){if(n==to&&r==to)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],l=n[i];if(i){let a;l&&l.nodeName==o.nodeName&&s!=t&&(a=s.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(s),l=to[0]),s=a}R4(s,l||to[0],o)}return s}function R4(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):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function EN(t,e,n){return CN(t,t,to,Wy(e,n,t.nodeType!=1))}function jf(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 m1(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class M4{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=N4(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,s){let i=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;i<l&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Zn,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let a=-1,u=this.top.children.length;s<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let c=this.index;c<u;c++){let d=this.top.children[c];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){a=c;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let c=Po.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let u=this.top.children[l];if(u.matchesNode(e,n,r)&&!this.preMatch.matched.has(u)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i){let o=this.top.children[s];return o.dirty==Wr&&o.dom==o.contentDOM&&(o.dirty=eo),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),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 s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Si){let u=this.preMatch.matched.get(a);if(u!=null&&u!=i)return!1;let c=a.dom,d,f=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Wr&&jf(n,a.outerDeco));if(!f&&a.update(e,n,r,s))return this.destroyBetween(this.index,l),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,s,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=eo,d.updateChildren(s,o+1),d.dirty=Zn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!jf(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let l=Si.create(this.top,n,r,s,i,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,s,i){let o=Si.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new kN(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Po;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof lp)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Bt||Ot)&&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 s=new bN(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function N4(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let l;for(;;)if(r){let u=n.children[r-1];if(u instanceof Po)n=u,r=u.children.length;else{l=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(s-1))break;--s,i.set(l,s),o.push(l)}}return{index:s,matched:i,matches:o.reverse()}}function O4(t,e){return t.type.side-e.type.side}function A4(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let u=0;u<t.childCount;u++){let c=t.child(u);r(c,s,e.forChild(i,c),u),i+=c.nodeSize}return}let o=0,l=[],a=null;for(let u=0;;){let c,d;for(;o<s.length&&s[o].to==i;){let y=s[o++];y.widget&&(c?(d||(d=[c])).push(y):c=y)}if(c)if(d){d.sort(O4);for(let y=0;y<d.length;y++)n(d[y],u,!!a)}else n(c,u,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(u<t.childCount)h=u,f=t.child(u++);else break;for(let y=0;y<l.length;y++)l[y].to<=i&&l.splice(y--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)l.push(s[o++]);let p=i+f.nodeSize;if(f.isText){let y=p;o<s.length&&s[o].from<y&&(y=s[o].from);for(let g=0;g<l.length;g++)l[g].to<y&&(y=l[g].to);y<p&&(a=f.cut(y-i),f=f.cut(0,y-i),p=y,h=-1)}else for(;o<s.length&&s[o].to<p;)o++;let m=f.isInline&&!f.isLeaf?l.filter(y=>!y.inline):l.slice();r(f,m,e.forChild(i,f),h),i=p}}function _4(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 P4(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),l=i;if(i+=o.nodeSize,!o.isText)continue;let a=o.text;for(;s<t.childCount;){let u=t.child(s++);if(i+=u.nodeSize,!u.isText)break;a+=u.text}if(i>=n){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let u=l<r?a.lastIndexOf(e,r-l-1):-1;if(u>=0&&u+e.length+l>=n)return l+u;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function qy(t,e,n,r,s){let i=[];for(let o=0,l=0;o<t.length;o++){let a=t[o],u=l,c=l+=a.size;u>=n||c<=e?i.push(a):(u<e&&i.push(a.slice(0,e-u,r)),s&&(i.push(s),s=void 0),c>n&&i.push(a.slice(n-u,a.size,r)))}return i}function Q0(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,u;if(op(n)){for(a=o;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&ue.isSelectable(d)&&s.parent&&!(d.isInline&&o4(n.focusNode,n.focusOffset,s.dom))){let f=s.posBefore;u=new ue(o==f?l:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[a,o]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(o)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let c=r.resolve(a);if(!u){let d=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;u=Z0(t,c,l,d)}return u}function TN(t){return t.editable?t.hasFocus():MN(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function bs(t,e=!1){let n=t.state.selection;if(RN(t,n),!!TN(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ot){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&_o(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)D4(t);else{let{anchor:r,head:s}=n,i,o;g1&&!(n instanceof ge)&&(n.$from.parent.inlineContent||(i=y1(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=y1(t,n.to))),t.docView.setSelection(r,s,t,e),g1&&(i&&v1(i),o&&v1(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&I4(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const g1=Bt||Ot&&hN<63;function y1(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Bt&&s&&s.contentEditable=="false")return Fm(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Fm(s);if(i)return Fm(i)}}function Fm(t){return t.contentEditable="true",Bt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function v1(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function I4(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!TN(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function D4(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,jt(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&wn&&bi<=11&&(n.disabled=!0,n.disabled=!1)}function RN(t,e){if(e instanceof ue){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(x1(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else x1(t)}function x1(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Z0(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||ge.between(e,n,r)}function w1(t){return t.editable&&!t.hasFocus()?!1:MN(t)}function MN(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 L4(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return _o(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Gy(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&me.findFrom(i,e)}function Vs(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function k1(t,e,n){let r=t.state.selection;if(r instanceof ge)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Vs(t,new ge(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=Gy(t.state,e);return s&&s instanceof ue?Vs(t,s):!1}else if(!(Hn&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let l=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(l))&&!o.contentDOM?ue.isSelectable(i)?Vs(t,new ue(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):wc?Vs(t,new ge(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ue&&r.node.isInline)return Vs(t,new ge(e>0?r.$to:r.$from));{let s=Gy(t.state,e);return s?Vs(t,s):!1}}}function $f(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function gu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function nl(t,e){return e<0?j4(t):$4(t)}function j4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(Qn&&n.nodeType==1&&r<$f(n)&&gu(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(gu(l,-1))s=n,i=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(NN(n))break;{let l=n.previousSibling;for(;l&&gu(l,-1);)s=n.parentNode,i=jt(l),l=l.previousSibling;if(l)n=l,r=$f(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Ky(t,n,r):s&&Ky(t,s,i)}function $4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=$f(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let l=n.childNodes[r];if(gu(l,1))i=n,o=++r;else break}else{if(NN(n))break;{let l=n.nextSibling;for(;l&&gu(l,1);)i=l.parentNode,o=jt(l)+1,l=l.nextSibling;if(l)n=l,r=0,s=$f(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&Ky(t,i,o)}function NN(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function z4(t,e){for(;t&&e==t.childNodes.length&&!xc(t);)e=jt(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 F4(t,e){for(;t&&!e&&!xc(t);)e=jt(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 Ky(t,e,n){if(e.nodeType!=3){let i,o;(o=z4(e,n))?(e=o,n=0):(i=F4(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(op(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&bs(t)},50)}function b1(t,e){let n=t.state.doc.resolve(e);if(!(Ot||pN)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function S1(t,e,n){let r=t.state.selection;if(r instanceof ge&&!r.empty||n.indexOf("s")>-1||Hn&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Gy(t.state,e);if(o&&o instanceof ue)return Vs(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,l=r instanceof On?me.near(o,e):me.findFrom(o,e);return l?Vs(t,l):!1}return!1}function C1(t,e){if(!(t.state.selection instanceof ge))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function E1(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function B4(t){if(!Bt||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;E1(t,r,"true"),setTimeout(()=>E1(t,r,"false"),20)}return!1}function V4(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function H4(t,e){let n=e.keyCode,r=V4(e);if(n==8||Hn&&n==72&&r=="c")return C1(t,-1)||nl(t,-1);if(n==46&&!e.shiftKey||Hn&&n==68&&r=="c")return C1(t,1)||nl(t,1);if(n==13||n==27)return!0;if(n==37||Hn&&n==66&&r=="c"){let s=n==37?b1(t,t.state.selection.from)=="ltr"?-1:1:-1;return k1(t,s,r)||nl(t,s)}else if(n==39||Hn&&n==70&&r=="c"){let s=n==39?b1(t,t.state.selection.from)=="ltr"?1:-1:1;return k1(t,s,r)||nl(t,s)}else{if(n==38||Hn&&n==80&&r=="c")return S1(t,-1,r)||nl(t,-1);if(n==40||Hn&&n==78&&r=="c")return B4(t)||S1(t,1,r)||nl(t,1);if(r==(Hn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Y0(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||Fo.fromSchema(t.state.schema),l=DN(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let u=a.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=IN[u.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let p=l.createElement(c[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${s} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
342
-
343
- `);return{dom:a,text:f,slice:e}}function ON(t,e,n,r,s){let i=s.parent.type.spec.code,o,l;if(!n&&!e)return null;let a=!!e&&(r||i||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return l=new U(D.from(t.state.schema.text(e.replace(/\r\n?/g,`
344
- `))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,s,r,t));if(d)l=d;else{let f=s.marks(),{schema:h}=t.state,p=Fo.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=o.appendChild(document.createElement("p"));m&&y.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=G4(n),wc&&K4(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||ws.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||c),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!U4.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)l=J4(T1(l,+c[1],+c[2]),c[4]);else if(l=U.maxOpen(W4(l.content,s),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=T1(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}const U4=/^(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 W4(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(l=>{if(!o)return;let a=s.findWrapping(l.type),u;if(!a)return o=null;if(u=o.length&&i.length&&_N(a,i,l,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=PN(o[o.length-1],i.length));let c=AN(l,a);o.push(c),s=s.matchType(c.type),i=a}}),o)return D.from(o)}return t}function AN(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,D.from(t));return t}function _N(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=_N(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(D.from(AN(n,t,s+1))))}}function PN(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,PN(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(D.empty,!0);return t.copy(n.append(r))}function Jy(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,l=o.content;return t.childCount>1&&(i=0),s<r-1&&(l=Jy(l,e,n,r,s+1,i)),s>=n&&(l=e<0?o.contentMatchAt(0).fillBefore(l,i<=s).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(D.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(l))}function T1(t,e,n){return e<t.openStart&&(t=new U(Jy(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new U(Jy(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const IN={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 R1=null;function DN(){return R1||(R1=document.implementation.createHTMLDocument("title"))}let Bm=null;function q4(t){let e=window.trustedTypes;return e?(Bm||(Bm=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Bm.createHTML(t)):t}function G4(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=DN().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&IN[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=q4(t),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function K4(t){let e=t.querySelectorAll(Ot?"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 J4(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:s,openStart:i,openEnd:o}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=D.from(a.create(r[l+1],s)),i++,o++}return new U(s,i,o)}const an={},un={},Q4={touchstart:!0,touchmove:!0};class Z4{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 Y4(t){for(let e in an){let n=an[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{eV(t,r)&&!X0(t,r)&&(t.editable||!(r.type in un))&&n(t,r)},Q4[e]?{passive:!0}:void 0)}Bt&&t.dom.addEventListener("input",()=>null),Qy(t)}function ui(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function X4(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 Qy(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>X0(t,r))})}function X0(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function eV(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 tV(t,e){!X0(t,e)&&an[e.type]&&(t.editable||!(e.type in un))&&an[e.type](t,e)}un.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!jN(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(gs&&Ot&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),aa&&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",s=>s(t,Ji(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||H4(t,n)?n.preventDefault():ui(t,"key")};un.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};un.keypress=(t,e)=>{let n=e;if(jN(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Hn&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ge)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function ap(t){return{left:t.clientX,top:t.clientY}}function nV(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function ex(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,l=>o>i.depth?l(t,n,i.nodeAfter,i.before(o),s,!0):l(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function Al(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 rV(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ue.isSelectable(r)?(Al(t,new ue(n)),!0):!1}function sV(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof ue&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o);if(ue.isSelectable(l)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(Al(t,ue.create(t.state.doc,s)),!0):!1}function iV(t,e,n,r,s){return ex(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?sV(t,n):rV(t,n))}function oV(t,e,n,r){return ex(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function lV(t,e,n,r){return ex(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||aV(t,n,r)}function aV(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Al(t,ge.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),l=s.before(i);if(o.inlineContent)Al(t,ge.create(r,l+1,l+1+o.content.size));else if(ue.isSelectable(o))Al(t,ue.create(r,l));else continue;return!0}}function tx(t){return zf(t)}const LN=Hn?"metaKey":"ctrlKey";an.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=tx(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&nV(n,t.input.lastClick)&&!n[LN]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(ap(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new uV(t,o,n,!!r)):(i=="doubleClick"?oV:lV)(t,o.pos,o.inside,n)?n.preventDefault():ui(t,"pointer"))};class uV{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[LN],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let c=e.state.doc.resolve(n.pos);i=c.parent,o=c.depth?c.before():0}const l=s?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:u}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof ue&&u.from<=o&&u.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Qn&&!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)),ui(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(()=>bs(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(ap(e))),this.updateAllowDefault(e),this.allowDefault||!n?ui(this.view,"pointer"):iV(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Bt&&this.mightDrag&&!this.mightDrag.node.isAtom||Ot&&!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)?(Al(this.view,me.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):ui(this.view,"pointer")}move(e){this.updateAllowDefault(e),ui(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)}}an.touchstart=t=>{t.input.lastTouch=Date.now(),tx(t),ui(t,"pointer")};an.touchmove=t=>{t.input.lastTouch=Date.now(),ui(t,"pointer")};an.contextmenu=t=>tx(t);function jN(t,e){return t.composing?!0:Bt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const cV=gs?5e3:-1;un.compositionstart=un.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ge&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Ot&&pN&&dV(t)))t.markCursor=t.state.storedMarks||n.marks(),zf(t,!0),t.markCursor=null;else if(zf(t,!e.selection.empty),Qn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let l=t.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}$N(t,cV)};function dV(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"}un.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++,$N(t,20))};function $N(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>zf(t),e))}function zN(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=hV());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function fV(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=s4(e.focusNode,e.focusOffset),r=i4(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function hV(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function zf(t,e=!1){if(!(gs&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),zN(t),e||t.docView&&t.docView.dirty){let n=Q0(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 pV(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(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Xu=wn&&bi<15||aa&&u4<604;an.copy=un.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=Xu?null:n.clipboardData,o=r.content(),{dom:l,text:a}=Y0(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):pV(t,l),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function mV(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function gV(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 s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ec(t,r.value,null,s,e):ec(t,r.textContent,r.innerHTML,s,e)},50)}function ec(t,e,n,r,s){let i=ON(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,s,i||U.empty)))return!0;if(!i)return!1;let o=mV(i),l=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function FN(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," "):""}un.paste=(t,e)=>{let n=e;if(t.composing&&!gs)return;let r=Xu?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ec(t,FN(r),r.getData("text/html"),s,n)?n.preventDefault():gV(t,n)};class BN{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const yV=Hn?"altKey":"ctrlKey";function VN(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[yV]}an.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(ap(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof ue?s.to-1:s.to))){if(r&&r.mightDrag)o=ue.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=ue.create(t.state.doc,d.posBefore))}}let l=(o||t.state.selection).content(),{dom:a,text:u,slice:c}=Y0(t,l);(!n.dataTransfer.files.length||!Ot||hN>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Xu?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Xu||n.dataTransfer.setData("text/plain",u),t.dragging=new BN(c,VN(t,n),o)};an.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};un.dragover=un.dragenter=(t,e)=>e.preventDefault();un.drop=(t,e)=>{try{vV(t,e,t.dragging)}finally{t.dragging=null}};function vV(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(ap(e));if(!r)return;let s=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=ON(t,FN(e.dataTransfer),Xu?null:e.dataTransfer.getData("text/html"),!1,s);let o=!!(n&&VN(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||U.empty,o))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?WM(t.state.doc,s.pos,i):s.pos;l==null&&(l=s.pos);let a=t.state.tr;if(o){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let u=a.mapping.map(l),c=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(c?a.replaceRangeWith(u,u,i.content.firstChild):a.replaceRange(u,u,i),a.doc.eq(d))return;let f=a.doc.resolve(u);if(c&&ue.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new ue(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,y,g)=>h=g),a.setSelection(Z0(t,f,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}an.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())&&bs(t)},20))};an.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)};an.beforeinput=(t,e)=>{if(Ot&&gs&&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",i=>i(t,Ji(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in un)an[t]=un[t];function tc(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 Ff{constructor(e,n){this.toDOM=e,this.spec=n||vo,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new rn(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ff&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&tc(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ci{constructor(e,n){this.attrs=e,this.spec=n||vo}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new rn(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Ci&&tc(this.attrs,e.attrs)&&tc(this.spec,e.spec)}static is(e){return e.type instanceof Ci}destroy(){}}class nx{constructor(e,n){this.attrs=e,this.spec=n||vo}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new rn(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof nx&&tc(this.attrs,e.attrs)&&tc(this.spec,e.spec)}destroy(){}}class rn{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new rn(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 rn(e,e,new Ff(n,r))}static inline(e,n,r,s){return new rn(e,n,new Ci(r,s))}static node(e,n,r,s){return new rn(e,n,new nx(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ci}get widget(){return this.type instanceof Ff}}const al=[],vo={};class ot{constructor(e,n){this.local=e.length?e:al,this.children=n.length?n:al}static create(e,n){return n.length?Bf(n,e,0,vo):Kt}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,n-l,r,s+l,i)}}map(e,n,r){return this==Kt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||vo)}mapInner(e,n,r,s,i){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,s);a&&a.type.valid(n,a)?(o||(o=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?xV(this.children,o||[],e,n,r,s,i):o?new ot(o.sort(xo),al):Kt}add(e,n){return n.length?this==Kt?ot.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((l,a)=>{let u=a+r,c;if(c=UN(n,l,u)){for(s||(s=this.children.slice());i<s.length&&s[i]<a;)i+=3;s[i]==a?s[i+2]=s[i+2].addInner(l,c,u+1):s.splice(i,0,a,a+l.nodeSize,Bf(c,l,u+1,vo)),i+=3}});let o=HN(i?WN(n):n,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new ot(o.length?this.local.concat(o).sort(xo):this.local,s||this.children)}remove(e){return e.length==0||this==Kt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,l=r[i]+n,a=r[i+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>l&&d.to<a&&(e[c]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[i+2].removeInner(o,l+1);u!=Kt?r[i+2]=u:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let l=0;l<s.length;l++)s[l].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new ot(s,r):Kt}forChild(e,n){if(this==Kt)return this;if(n.isLeaf)return ot.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,o=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>i&&a.type instanceof Ci){let u=Math.max(i,a.from)-i,c=Math.min(o,a.to)-i;u<c&&(s||(s=[])).push(a.copy(u,c))}}if(s){let l=new ot(s.sort(xo),al);return r?new Gs([l,r]):l}return r||Kt}eq(e){if(this==e)return!0;if(!(e instanceof ot)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return rx(this.localsInner(e))}localsInner(e){if(this==Kt)return al;if(e.inlineContent||!this.local.some(Ci.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ci||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ot.empty=new ot([],[]);ot.removeOverlap=rx;const Kt=ot.empty;class Gs{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,vo));return Gs.from(r)}forChild(e,n){if(n.isLeaf)return ot.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=Kt&&(i instanceof Gs?r=r.concat(i.members):r.push(i))}return Gs.from(r)}eq(e){if(!(e instanceof Gs)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?rx(r?n:n.sort(xo)):al}static from(e){switch(e.length){case 0:return Kt;case 1:return e[0];default:return new Gs(e.every(n=>n instanceof ot)?e:e.reduce((n,r)=>n.concat(r instanceof ot?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function xV(t,e,n,r,s,i,o){let l=t.slice();for(let u=0,c=i;u<n.maps.length;u++){let d=0;n.maps[u].forEach((f,h,p,m)=>{let y=m-p-(h-f);for(let g=0;g<l.length;g+=3){let x=l[g+1];if(x<0||f>x+c-d)continue;let k=l[g]+c-d;h>=k?l[g+1]=f<=k?-2:-1:f>=c&&y&&(l[g]+=y,l[g+1]+=y)}d+=y}),c=n.maps[u].map(c,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let c=n.map(t[u]+i),d=c-s;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[u+1]+i,-1),h=f-s,{index:p,offset:m}=r.content.findIndex(d),y=r.maybeChild(p);if(y&&m==d&&m+y.nodeSize==h){let g=l[u+2].mapInner(n,y,c+1,t[u]+i+1,o);g!=Kt?(l[u]=d,l[u+1]=h,l[u+2]=g):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=wV(l,t,e,n,s,i,o),c=Bf(u,r,0,o);e=c.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<c.children.length;d+=3){let h=c.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,c.children[d],c.children[d+1],c.children[d+2])}}return new ot(e.sort(xo),l)}function HN(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new rn(s.from+e,s.to+e,s.type))}return n}function wV(t,e,n,r,s,i,o){function l(a,u){for(let c=0;c<a.local.length;c++){let d=a.local[c].map(r,s,u);d?n.push(d):o.onRemove&&o.onRemove(a.local[c].spec)}for(let c=0;c<a.children.length;c+=3)l(a.children[c+2],a.children[c]+u+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function UN(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function WN(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Bf(t,e,n,r){let s=[],i=!1;e.forEach((l,a)=>{let u=UN(t,l,a+n);if(u){i=!0;let c=Bf(u,l,n+a+1,r);c!=Kt&&s.push(a,a+l.nodeSize,c)}});let o=HN(i?WN(t):t,-n).sort(xo);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||s.length?new ot(o,s):Kt}function xo(t,e){return t.from-e.from||t.to-e.to}function rx(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),M1(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),M1(e,s,r.copy(i.from,r.to)));break}}}return e}function M1(t,e,n){for(;e<t.length&&xo(n,t[e])>0;)e++;t.splice(e,0,n)}function Vm(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Kt&&e.push(r)}),t.cursorWrapper&&e.push(ot.create(t.state.doc,[t.cursorWrapper.deco])),Gs.from(e)}const kV={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bV=wn&&bi<=11;class SV{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 CV{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new SV,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);wn&&bi<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Bt&&e.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),bV&&(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,kV)),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(w1(this.view)){if(this.suppressingSelectionUpdates)return bs(this.view);if(wn&&bi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&_o(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 i=e.focusNode;i;i=la(i))n.add(i);for(let i=e.anchorNode;i;i=la(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.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(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&w1(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,l=!1,a=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],a);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(l=!0))}if(Qn&&a.length){let c=a.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||RV(e,d)!=h)&&f.remove()}}}else if((Ot||Bt)&&a.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of a)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;d&&d.nodeType==1&&d.contentEditable=="false"&&c.parentNode.removeChild(c)}}let u=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&op(r)&&(u=Q0(e))&&u.eq(me.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,bs(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),EV(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,MV(e,a)),this.handleDOMChange(i,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||bs(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 c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,i=e.nextSibling;if(wn&&bi<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:f}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let o=s&&s.parentNode==e.target?jt(s)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=i&&i.parentNode==e.target?jt(i):e.target.childNodes.length,u=r.localPosFromDOM(e.target,a,1);return{from:l,to:u}}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 N1=new WeakMap,O1=!1;function EV(t){if(!N1.has(t)&&(N1.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Qn,O1)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."),O1=!0}}function A1(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return _o(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function TV(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return A1(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?A1(t,n):null}function RV(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 MV(t,e){var n;let{focusNode:r,focusOffset:s}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=i.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let l=o;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&t.domSelection().collapse(i,s)}else i.parentNode.removeChild(i)}}function NV(t,e,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:l}=t.docView.parseRange(e,n),a=t.domSelectionRange(),u,c=a.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(u=[{node:c,offset:a.anchorOffset}],op(a)||u.push({node:a.focusNode,offset:a.focusOffset})),Ot&&t.input.lastKeyCode===8)for(let y=i;y>s;y--){let g=r.childNodes[y-1],x=g.pmViewDesc;if(g.nodeName=="BR"&&!x){i=y;break}if(!x||x.size)break}let d=t.state.doc,f=t.someProp("domParser")||ws.fromSchema(t.state.schema),h=d.resolve(o),p=null,m=f.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:s,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:OV,context:h});if(u&&u[0].pos!=null){let y=u[0].pos,g=u[1]&&u[1].pos;g==null&&(g=y),p={anchor:y+o,head:g+o}}return{doc:m,sel:p,from:o,to:l}}function OV(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Bt&&/^(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||Bt&&/^(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 AV=/^(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 _V(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let E=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,T=Q0(t,E);if(T&&!t.state.selection.eq(T)){if(Ot&&gs&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",O=>O(t,Ji(13,"Enter"))))return;let N=t.state.tr.setSelection(T);E=="pointer"?N.setMeta("pointer",!0):E=="key"&&N.scrollIntoView(),i&&N.setMeta("composition",i),t.dispatch(N)}return}let o=t.state.doc.resolve(e),l=o.sharedDepth(n);e=o.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,u=NV(t,e,n),c=t.state.doc,d=c.slice(u.from,u.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=DV(d.content,u.doc.content,u.from,f,h);if(p&&t.input.domChangeCount++,(aa&&t.input.lastIOSEnter>Date.now()-225||gs)&&s.some(E=>E.nodeType==1&&!AV.test(E.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",E=>E(t,Ji(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof ge&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(u.sel){let E=_1(t,t.state.doc,u.sel);if(E&&!E.eq(t.state.selection)){let T=t.state.tr.setSelection(E);i&&T.setMeta("composition",i),t.dispatch(T)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof ge&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),wn&&bi<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>u.from&&u.doc.textBetween(p.start-u.from-1,p.start-u.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=u.doc.resolveNoCache(p.start-u.from),y=u.doc.resolveNoCache(p.endB-u.from),g=c.resolve(p.start),x=m.sameParent(y)&&m.parent.inlineContent&&g.end()>=p.endA;if((aa&&t.input.lastIOSEnter>Date.now()-225&&(!x||s.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!x&&m.pos<u.doc.content.size&&(!m.sameParent(y)||!m.parent.inlineContent)&&m.pos<y.pos&&!/\S/.test(u.doc.textBetween(m.pos,y.pos,"","")))&&t.someProp("handleKeyDown",E=>E(t,Ji(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&IV(c,p.start,p.endA,m,y)&&t.someProp("handleKeyDown",E=>E(t,Ji(8,"Backspace")))){gs&&Ot&&t.domObserver.suppressSelectionUpdates();return}Ot&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),gs&&!x&&m.start()!=y.start()&&y.parentOffset==0&&m.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==p.endA&&(p.endB-=2,y=u.doc.resolveNoCache(p.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(E){return E(t,Ji(13,"Enter"))})},20));let k=p.start,b=p.endA,S=E=>{let T=E||t.state.tr.replace(k,b,u.doc.slice(p.start-u.from,p.endB-u.from));if(u.sel){let N=_1(t,T.doc,u.sel);N&&!(Ot&&t.composing&&N.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(N.head==k||N.head==T.mapping.map(b)-1)||wn&&N.empty&&N.head==k)&&T.setSelection(N)}return i&&T.setMeta("composition",i),T.scrollIntoView()},C;if(x)if(m.pos==y.pos){wn&&bi<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>bs(t),20));let E=S(t.state.tr.delete(k,b)),T=c.resolve(p.start).marksAcross(c.resolve(p.endA));T&&E.ensureMarks(T),t.dispatch(E)}else if(p.endA==p.endB&&(C=PV(m.parent.content.cut(m.parentOffset,y.parentOffset),g.parent.content.cut(g.parentOffset,p.endA-g.start())))){let E=S(t.state.tr);C.type=="add"?E.addMark(k,b,C.mark):E.removeMark(k,b,C.mark),t.dispatch(E)}else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let E=m.parent.textBetween(m.parentOffset,y.parentOffset),T=()=>S(t.state.tr.insertText(E,k,b));t.someProp("handleTextInput",N=>N(t,k,b,E,T))||t.dispatch(T())}else t.dispatch(S());else t.dispatch(S())}function _1(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Z0(t,e.resolve(n.anchor),e.resolve(n.head))}function PV(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,l,a;for(let c=0;c<r.length;c++)s=r[c].removeFromSet(s);for(let c=0;c<n.length;c++)i=n[c].removeFromSet(i);if(s.length==1&&i.length==0)l=s[0],o="add",a=c=>c.mark(l.addToSet(c.marks));else if(s.length==0&&i.length==1)l=i[0],o="remove",a=c=>c.mark(l.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(a(e.child(c)));if(D.from(u).eq(t))return{mark:l,type:o}}function IV(t,e,n,r,s){if(n-e<=s.pos-r.pos||Hm(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(Hm(i,!0,!0));return!o.parent.isTextblock||o.pos>n||Hm(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Hm(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function DV(t,e,n,r,s){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let a=Math.max(0,i-Math.min(o,l));r-=o+a-i}if(o<i&&t.size<e.size){let a=r<=i&&r>=o?i-r:0;i-=a,i&&i<e.size&&P1(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-o),o=i}else if(l<i){let a=r<=i&&r>=l?i-r:0;i-=a,i&&i<t.size&&P1(t.textBetween(i-1,i+1))&&(i+=a?1:-1),o=i+(o-l),l=i}return{start:i,endA:o,endB:l}}function P1(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 qN{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 Z4,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach($1),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=L1(this),D1(this),this.nodeViews=j1(this),this.docView=p1(this.state.doc,I1(this),Vm(this),this.dom,this),this.domObserver=new CV(this,(r,s,i,o)=>_V(this,r,s,i,o)),this.domObserver.start(),Y4(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&&Qy(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach($1),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 s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(zN(this),o=!0),this.state=e;let l=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=j1(this);jV(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Qy(this),this.editable=L1(this),D1(this);let a=Vm(this),u=I1(this),c=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,u,a);(d||!e.selection.eq(s.selection))&&(o=!0);let f=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&f4(this);if(o){this.domObserver.stop();let h=d&&(wn||Ot)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&LV(s.selection,e.selection);if(d){let p=Ot?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=fV(this)),(i||!this.docView.update(e.doc,u,a,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=p1(e.doc,u,a,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&L4(this))?bs(this,h):(RN(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&h4(f)}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 ue){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&a1(this,n.getBoundingClientRect(),e)}else a1(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,s=-1;if(this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new BN(e.slice,e.move,s<0?void 0:ue.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(s=n?n(l):l))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let l=i[o].props[e];if(l!=null&&(s=n?n(l):l))return s}}hasFocus(){if(wn){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&&p4(this.dom),bs(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 x4(this,e)}coordsAtPos(e,n=1){return xN(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 s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return C4(this,n||this.state,e)}pasteHTML(e,n){return ec(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ec(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Y0(this,e)}destroy(){this.docView&&(X4(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Vm(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,n4())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return tV(this,e)}domSelectionRange(){let e=this.domSelection();return e?Bt&&this.root.nodeType===11&&l4(this.dom.ownerDocument)==this.dom&&TV(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}qN.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function I1(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"),[rn.node(0,t.state.doc.content.size,e)]}function D1(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:rn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function L1(t){return!t.someProp("editable",e=>e(t.state)===!1)}function LV(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 j1(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function jV(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function $1(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 Ai={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:"'"},Vf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},$V=typeof navigator<"u"&&/Mac/.test(navigator.platform),zV=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var $t=0;$t<10;$t++)Ai[48+$t]=Ai[96+$t]=String($t);for(var $t=1;$t<=24;$t++)Ai[$t+111]="F"+$t;for(var $t=65;$t<=90;$t++)Ai[$t]=String.fromCharCode($t+32),Vf[$t]=String.fromCharCode($t);for(var Um in Ai)Vf.hasOwnProperty(Um)||(Vf[Um]=Ai[Um]);function FV(t){var e=$V&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||zV&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Vf:Ai)[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 BV=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),VV=typeof navigator<"u"&&/Win/.test(navigator.platform);function HV(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))BV?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function UV(t){let e=Object.create(null);for(let n in t)e[HV(n)]=t[n];return e}function Wm(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 WV(t){return new tt({props:{handleKeyDown:sx(t)}})}function sx(t){let e=UV(t);return function(n,r){let s=FV(r),i,o=e[Wm(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=e[Wm(s,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(VV&&r.ctrlKey&&r.altKey)&&(i=Ai[r.keyCode])&&i!=s){let l=e[Wm(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var qV=Object.defineProperty,ix=(t,e)=>{for(var n in e)qV(t,n,{get:e[n],enumerable:!0})};function up(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=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 i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var cp=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,l])=>[o,(...u)=>{const c=l(...u)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],l=!!t,a=t||s.tr,u=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),o.every(d=>d===!0)),c={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...p)=>{const m=this.buildProps(a,e),y=f(...p)(m);return o.push(y),c}])),run:u};return c}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>a(...u)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:up({state:s,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...u)=>a(...u)(o)]))}};return o}},lr={};ix(lr,{blur:()=>GV,clearContent:()=>KV,clearNodes:()=>JV,command:()=>QV,createParagraphNear:()=>ZV,cut:()=>YV,deleteCurrentNode:()=>XV,deleteNode:()=>eH,deleteRange:()=>tH,deleteSelection:()=>nH,enter:()=>rH,exitCode:()=>sH,extendMarkRange:()=>iH,first:()=>oH,focus:()=>aH,forEach:()=>uH,insertContent:()=>cH,insertContentAt:()=>hH,joinBackward:()=>gH,joinDown:()=>mH,joinForward:()=>yH,joinItemBackward:()=>vH,joinItemForward:()=>xH,joinTextblockBackward:()=>wH,joinTextblockForward:()=>kH,joinUp:()=>pH,keyboardShortcut:()=>SH,lift:()=>CH,liftEmptyBlock:()=>EH,liftListItem:()=>TH,newlineInCode:()=>RH,resetAttributes:()=>MH,scrollIntoView:()=>NH,selectAll:()=>OH,selectNodeBackward:()=>AH,selectNodeForward:()=>_H,selectParentNode:()=>PH,selectTextblockEnd:()=>IH,selectTextblockStart:()=>DH,setContent:()=>LH,setMark:()=>nU,setMeta:()=>rU,setNode:()=>sU,setNodeSelection:()=>iU,setTextDirection:()=>oU,setTextSelection:()=>lU,sinkListItem:()=>aU,splitBlock:()=>uU,splitListItem:()=>cU,toggleList:()=>dU,toggleMark:()=>fU,toggleNode:()=>hU,toggleWrap:()=>pU,undoInputRule:()=>mU,unsetAllMarks:()=>gU,unsetMark:()=>yU,unsetTextDirection:()=>vU,updateAttributes:()=>xU,wrapIn:()=>wU,wrapInList:()=>kU});var GV=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),KV=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),JV=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(a)),f=u.resolve(c.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=ka(h);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},QV=t=>e=>t(e),ZV=()=>({state:t,dispatch:e})=>aN(t,e),YV=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new ge(r.doc.resolve(Math.max(o-1,0)))),!0},XV=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const l=s.before(i),a=s.after(i);t.delete(l,a).scrollIntoView()}return!0}return!1};function vt(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}var eH=t=>({tr:e,state:n,dispatch:r})=>{const s=vt(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const a=i.before(o),u=i.after(o);e.delete(a,u).scrollIntoView()}return!0}return!1},tH=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},nH=()=>({state:t,dispatch:e})=>U0(t,e),rH=()=>({commands:t})=>t.keyboardShortcut("Enter"),sH=()=>({state:t,dispatch:e})=>BB(t,e);function ox(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Hf(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:ox(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function GN(t,e,n={}){return t.find(r=>r.type===e&&Hf(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function z1(t,e,n={}){return!!GN(t,e,n)}function lx(t,e,n){var r;if(!t||!e)return;let s=t.parent.childAfter(t.parentOffset);if((!s.node||!s.node.marks.some(c=>c.type===e))&&(s=t.parent.childBefore(t.parentOffset)),!s.node||!s.node.marks.some(c=>c.type===e)||(n=n||((r=s.node.marks[0])==null?void 0:r.attrs),!GN([...s.node.marks],e,n)))return;let o=s.index,l=t.start()+s.offset,a=o+1,u=l+s.node.nodeSize;for(;o>0&&z1([...t.parent.child(o-1).marks],e,n);)o-=1,l-=t.parent.child(o).nodeSize;for(;a<t.parent.childCount&&z1([...t.parent.child(a).marks],e,n);)u+=t.parent.child(a).nodeSize,a+=1;return{from:l,to:u}}function Os(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}var iH=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const i=Os(t,r.schema),{doc:o,selection:l}=n,{$from:a,from:u,to:c}=l;if(s){const d=lx(a,i,e);if(d&&d.from<=u&&d.to>=c){const f=ge.create(o,d.from,d.to);n.setSelection(f)}}return!0},oH=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 ax(t){return t instanceof ge}function ys(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function KN(t,e=null){if(!e)return null;const n=me.atStart(t),r=me.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?ge.create(t,ys(0,s,i),ys(t.content.size,s,i)):ge.create(t,ys(e,s,i),ys(e,s,i))}function F1(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Uf(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function lH(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var aH=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Uf()||F1())&&r.dom.focus(),lH()&&!Uf()&&!F1()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(i&&t===null&&!ax(n.state.selection))return o(),!0;const l=KN(s.doc,t)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||s.setSelection(l),a&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},uH=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),cH=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),JN=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&&JN(r)}return t};function Ya(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return JN(n)}function nc(t,e,n){if(t instanceof ki||t instanceof D)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return D.fromArray(t.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),nc("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,l="";const a=new IM({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:u=>(o=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?ws.fromSchema(a).parseSlice(Ya(t),n.parseOptions):ws.fromSchema(a).parse(Ya(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=ws.fromSchema(e);return n.slice?i.parseSlice(Ya(t),n.parseOptions).content:i.parse(Ya(t),n.parseOptions)}return nc("",e,n)}function dH(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof Nt||s instanceof _t))return;const i=t.mapping.maps[r];let o=0;i.forEach((l,a,u,c)=>{o===0&&(o=c)}),t.setSelection(me.near(t.doc.resolve(o),n))}var fH=t=>!("type"in t),hH=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{nc(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=nc(e,i.schema,{parseOptions:u,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(y){return a(y),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;if((fH(l)?l:[l]).forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),c===d&&h){const{parent:y}=r.doc.resolve(c);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(c-=1,d+=1)}let m;if(f){if(Array.isArray(e))m=e.map(y=>y.text||"").join("");else if(e instanceof D){let y="";e.forEach(g=>{g.text&&(y+=g.text)}),m=y}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,c,d)}else{m=l;const y=r.doc.resolve(c),g=y.node(),x=y.parentOffset===0,k=g.isText||g.isTextblock,b=g.content.size>0;x&&k&&b&&(c=Math.max(0,c-1)),r.replaceWith(c,d,m)}n.updateSelection&&dH(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:m})}return!0},pH=()=>({state:t,dispatch:e})=>$B(t,e),mH=()=>({state:t,dispatch:e})=>zB(t,e),gH=()=>({state:t,dispatch:e})=>tN(t,e),yH=()=>({state:t,dispatch:e})=>iN(t,e),vH=()=>({state:t,dispatch:e,tr:n})=>{try{const r=rp(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},xH=()=>({state:t,dispatch:e,tr:n})=>{try{const r=rp(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},wH=()=>({state:t,dispatch:e})=>LB(t,e),kH=()=>({state:t,dispatch:e})=>jB(t,e);function QN(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function bH(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Uf()||QN()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var SH=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=bH(t).split(/-(?!$)/),o=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,l))});return a==null||a.steps.forEach(u=>{const c=u.map(r.mapping);c&&s&&r.maybeStep(c)}),!0};function _i(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?vt(e,t.schema):null,l=[];t.doc.nodesBetween(r,s,(d,f)=>{if(d.isText)return;const h=Math.max(r,f),p=Math.min(s,f+d.nodeSize);l.push({node:d,from:h,to:p})});const a=s-r,u=l.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Hf(d.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=a}var CH=(t,e={})=>({state:n,dispatch:r})=>{const s=vt(t,n.schema);return _i(n,s,e)?FB(n,r):!1},EH=()=>({state:t,dispatch:e})=>uN(t,e),TH=t=>({state:e,dispatch:n})=>{const r=vt(t,e.schema);return YB(r)(e,n)},RH=()=>({state:t,dispatch:e})=>lN(t,e);function dp(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function B1(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var MH=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=dp(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=vt(t,r.schema)),l==="mark"&&(o=Os(t,r.schema));let a=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,d)=>{i&&i===c.type&&(a=!0,s&&n.setNodeMarkup(d,void 0,B1(c.attrs,e))),o&&c.marks.length&&c.marks.forEach(f=>{o===f.type&&(a=!0,s&&n.addMark(d,d+c.nodeSize,o.create(B1(f.attrs,e))))})})}),a},NH=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),OH=()=>({tr:t,dispatch:e})=>{if(e){const n=new On(t.doc);t.setSelection(n)}return!0},AH=()=>({state:t,dispatch:e})=>rN(t,e),_H=()=>({state:t,dispatch:e})=>oN(t,e),PH=()=>({state:t,dispatch:e})=>UB(t,e),IH=()=>({state:t,dispatch:e})=>GB(t,e),DH=()=>({state:t,dispatch:e})=>qB(t,e);function Zy(t,e,n={},r={}){return nc(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var LH=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:l})=>{const{doc:a}=i;if(r.preserveWhitespace!=="full"){const u=Zy(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function ZN(t,e){const n=Os(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function YN(t,e){const n=new QM(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function jH(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 $H(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function zH(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 fp(t){return e=>zH(e.$from,t)}function re(t,e,n){return t.config[e]===void 0&&t.parent?re(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?re(t.parent,e,n):null}):t.config[e]}function hp(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=re(e,"addExtensions",n);return r?[e,...hp(r())]:e}).flat(10)}function ux(t,e){const n=Fo.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function XN(t){return typeof t=="function"}function Ve(t,e=void 0,...n){return XN(t)?e?t.bind(e)(...n):t(...n):t}function FH(t={}){return Object.keys(t).length===0&&t.constructor===Object}function ua(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function eO(t){const e=[],{nodeExtensions:n,markExtensions:r}=ua(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage,extensions:s},a=re(o,"addGlobalAttributes",l);if(!a)return;a().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([f,h])=>{e.push({type:d,name:f,attribute:{...i,...h}})})})})}),s.forEach(o=>{const l={name:o.name,options:o.options,storage:o.storage},a=re(o,"addAttributes",l);if(!a)return;const u=a();Object.entries(u).forEach(([c,d])=>{const f={...i,...d};typeof(f==null?void 0:f.default)=="function"&&(f.default=f.default()),f!=null&&f.isRequired&&(f==null?void 0:f.default)===void 0&&delete f.default,e.push({type:o.name,name:c,attribute:f})})}),e}function xt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const l=i?String(i).split(" "):[],a=r[s]?r[s].split(" "):[],u=l.filter(c=>!a.includes(c));r[s]=[...a,...u].join(" ")}else if(s==="style"){const l=i?i.split(";").map(c=>c.trim()).filter(Boolean):[],a=r[s]?r[s].split(";").map(c=>c.trim()).filter(Boolean):[],u=new Map;a.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),l.forEach(c=>{const[d,f]=c.split(":").map(h=>h.trim());u.set(d,f)}),r[s]=Array.from(u.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[s]=i}),r},{})}function rc(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)=>xt(n,r),{})}function BH(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function V1(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 s=e.reduce((i,o)=>{const l=o.attribute.parseHTML?o.attribute.parseHTML(n):BH(n.getAttribute(o.name));return l==null?i:{...i,[o.name]:l}},{});return{...r,...s}}}}function H1(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&FH(n)?!1:n!=null))}function U1(t){var e,n;const r={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&"default"in((t==null?void 0:t.attribute)||{})&&(r.default=t.attribute.default),((n=t==null?void 0:t.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function tO(t,e){var n;const r=eO(t),{nodeExtensions:s,markExtensions:i}=ua(t),o=(n=s.find(u=>re(u,"topNode")))==null?void 0:n.name,l=Object.fromEntries(s.map(u=>{const c=r.filter(g=>g.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((g,x)=>{const k=re(x,"extendNodeSchema",d);return{...g,...k?k(u):{}}},{}),h=H1({...f,content:Ve(re(u,"content",d)),marks:Ve(re(u,"marks",d)),group:Ve(re(u,"group",d)),inline:Ve(re(u,"inline",d)),atom:Ve(re(u,"atom",d)),selectable:Ve(re(u,"selectable",d)),draggable:Ve(re(u,"draggable",d)),code:Ve(re(u,"code",d)),whitespace:Ve(re(u,"whitespace",d)),linebreakReplacement:Ve(re(u,"linebreakReplacement",d)),defining:Ve(re(u,"defining",d)),isolating:Ve(re(u,"isolating",d)),attrs:Object.fromEntries(c.map(U1))}),p=Ve(re(u,"parseHTML",d));p&&(h.parseDOM=p.map(g=>V1(g,c)));const m=re(u,"renderHTML",d);m&&(h.toDOM=g=>m({node:g,HTMLAttributes:rc(g,c)}));const y=re(u,"renderText",d);return y&&(h.toText=y),[u.name,h]})),a=Object.fromEntries(i.map(u=>{const c=r.filter(y=>y.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=t.reduce((y,g)=>{const x=re(g,"extendMarkSchema",d);return{...y,...x?x(u):{}}},{}),h=H1({...f,inclusive:Ve(re(u,"inclusive",d)),excludes:Ve(re(u,"excludes",d)),group:Ve(re(u,"group",d)),spanning:Ve(re(u,"spanning",d)),code:Ve(re(u,"code",d)),attrs:Object.fromEntries(c.map(U1))}),p=Ve(re(u,"parseHTML",d));p&&(h.parseDOM=p.map(y=>V1(y,c)));const m=re(u,"renderHTML",d);return m&&(h.toDOM=y=>m({mark:y,HTMLAttributes:rc(y,c)})),[u.name,h]}));return new IM({topNode:o,nodes:l,marks:a})}function VH(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Wf(t){return t.sort((n,r)=>{const s=re(n,"priority")||100,i=re(r,"priority")||100;return s>i?-1:s<i?1:0})}function cx(t){const e=Wf(hp(t)),n=VH(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function HH(t,e){const n=cx(t);return tO(n,e)}function UH(t,e){const n=HH(e),r=Ya(t);return ws.fromSchema(n).parse(r).toJSON()}function nO(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
345
-
346
- `,textSerializers:o={}}=n||{};let l="";return t.nodesBetween(r,s,(a,u,c,d)=>{var f;a.isBlock&&u>r&&(l+=i);const h=o==null?void 0:o[a.type.name];if(h)return c&&(l+=h({node:a,pos:u,parent:c,index:d,range:e})),!1;a.isText&&(l+=(f=a==null?void 0:a.text)==null?void 0:f.slice(Math.max(r,u)-u,s-u))}),l}function rO(t,e){const n={from:0,to:t.content.size};return nO(t,n,e)}function dx(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function WH(t,e){const n=vt(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,l=>{i.push(l)});const o=i.reverse().find(l=>l.type.name===n.name);return o?{...o.attrs}:{}}function sO(t,e){const n=dp(typeof e=="string"?e:e.name,t.schema);return n==="node"?WH(t,e):n==="mark"?ZN(t,e):{}}function qH(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function GH(t){const e=qH(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function iO(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const u=e.slice(i).map(l,-1),c=e.slice(i).map(a),d=e.invert().map(u,-1),f=e.invert().map(c);r.push({oldRange:{from:d,to:f},newRange:{from:u,to:c}})})}),GH(r)}function fx(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=n.resolve(t),o=lx(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var KH=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const l=s.node(i);(l==null?void 0:l.type.name)===e?o=l:i-=1}return[o,i]};function cd(t,e){return e.nodes[t]||e.marks[t]||null}function Wd(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var JH=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,l)=>{var a,u;const c=((u=(a=s.type.spec).toText)==null?void 0:u.call(a,{node:s,pos:i,parent:o,index:l}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?c:c.slice(0,Math.max(0,r-i))}),n};function Yy(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?Os(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Hf(d.attrs,n,{strict:!1}));let o=0;const l=[];if(s.forEach(({$from:d,$to:f})=>{const h=d.pos,p=f.pos;t.doc.nodesBetween(h,p,(m,y)=>{if(!m.isText&&!m.marks.length)return;const g=Math.max(h,y),x=Math.min(p,y+m.nodeSize),k=x-g;o+=k,l.push(...m.marks.map(b=>({mark:b,from:g,to:x})))})}),o===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Hf(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+u:a)>=o}function QH(t,e,n={}){if(!e)return _i(t,null,n)||Yy(t,null,n);const r=dp(e,t.schema);return r==="node"?_i(t,e,n):r==="mark"?Yy(t,e,n):!1}var ZH=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const i=fp(l=>l.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},YH=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function W1(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function q1(t,e){const{nodeExtensions:n}=ua(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=Ve(re(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function pp(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:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(i=>{s!==!1&&(pp(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function oO(t){return t instanceof ue}var lO=class aO{constructor(e){this.position=e}static fromJSON(e){return new aO(e.position)}toJSON(){return{position:this.position}}};function XH(t,e){const n=e.mapping.mapResult(t.position);return{position:new lO(n.pos),mapResult:n}}function eU(t){return new lO(t)}function uO(t,e,n){const s=t.state.doc.content.size,i=ys(e,0,s),o=ys(n,0,s),l=t.coordsAtPos(i),a=t.coordsAtPos(o,-1),u=Math.min(l.top,a.top),c=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),f=Math.max(l.right,a.right),h=f-d,p=c-u,g={top:u,bottom:c,left:d,right:f,width:h,height:p,x:d,y:u};return{...g,toJSON:()=>g}}function tU(t,e,n){var r;const{selection:s}=e;let i=null;if(ax(s)&&(i=s.$cursor),i){const l=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(u=>u.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:l,$to:a})=>{let u=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(c,d,f)=>{if(u)return!1;if(c.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));u=h&&p}return!u}),u})}var nU=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:l}=i,a=Os(t,r.schema);if(s)if(o){const u=ZN(r,a);n.addStoredMark(a.create({...u,...e}))}else l.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(f,h)=>{const p=Math.max(h,c),m=Math.min(h+f.nodeSize,d);f.marks.find(g=>g.type===a)?f.marks.forEach(g=>{a===g.type&&n.addMark(p,m,a.create({...g.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return tU(r,n,a)},rU=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),sU=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=vt(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:l})=>i1(i,{...o,...e})(n)?!0:l.clearNodes()).command(({state:l})=>i1(i,{...o,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},iU=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=ys(t,0,r.content.size),i=ue.create(r,s);e.setSelection(i)}return!0},oU=(t,e)=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=r;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=i.from,l=i.to),s&&n.doc.nodesBetween(o,l,(a,u)=>{a.isText||n.setNodeMarkup(u,void 0,{...a.attrs,dir:t})}),!0},lU=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=ge.atStart(r).from,l=ge.atEnd(r).to,a=ys(s,o,l),u=ys(i,o,l),c=ge.create(r,a,u);e.setSelection(c)}return!0},aU=t=>({state:e,dispatch:n})=>{const r=vt(t,e.schema);return t4(r)(e,n)};function G1(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var uU=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:l,$to:a}=i,u=s.extensionManager.attributes,c=Wd(u,l.node().type.name,l.node().attrs);if(i instanceof ue&&i.node.isBlock)return!l.parentOffset||!ks(o,l.pos)?!1:(r&&(t&&G1(n,s.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:jH(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=d&&f?[{type:f,attrs:c}]:void 0,p=ks(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&ks(e.doc,e.mapping.map(l.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:c}]:void 0),r){if(p&&(i instanceof ge&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f)){const m=e.mapping.map(l.before()),y=e.doc.resolve(m);l.node(-1).canReplaceWith(y.index(),y.index()+1,f)&&e.setNodeMarkup(e.mapping.map(l.before()),f)}t&&G1(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return p},cU=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const l=vt(t,r.schema),{$from:a,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||a.depth<2||!a.sameParent(u))return!1;const d=a.node(-1);if(d.type!==l)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(s){let g=D.empty;const x=a.index(-1)?1:a.index(-2)?2:3;for(let T=a.depth-x;T>=a.depth-3;T-=1)g=D.from(a.node(T).copy(g));const k=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,b={...Wd(f,a.node().type.name,a.node().attrs),...e},S=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(b))||void 0;g=g.append(D.from(l.createAndFill(null,S)||void 0));const C=a.before(a.depth-(x-1));n.replace(C,a.after(-k),new U(g,4-x,0));let E=-1;n.doc.nodesBetween(C,n.doc.content.size,(T,N)=>{if(E>-1)return!1;T.isTextblock&&T.content.size===0&&(E=N+1)}),E>-1&&n.setSelection(ge.near(n.doc.resolve(E))),n.scrollIntoView()}return!0}const h=u.pos===a.end()?d.contentMatchAt(0).defaultType:null,p={...Wd(f,d.type.name,d.attrs),...e},m={...Wd(f,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,u.pos);const y=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!ks(n.doc,a.pos,2))return!1;if(s){const{selection:g,storedMarks:x}=r,{splittableMarks:k}=i.extensionManager,b=x||g.$to.parentOffset&&g.$from.marks();if(n.split(a.pos,2,y).scrollIntoView(),!b||!s)return!0;const S=b.filter(C=>k.includes(C.type.name));n.ensureMarks(S)}return!0},qm=(t,e)=>{const n=fp(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&$i(t.doc,n.pos)&&t.join(n.pos),!0},Gm=(t,e)=>{const n=fp(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&$i(t.doc,r)&&t.join(r),!0},dU=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:l,chain:a,commands:u,can:c})=>{const{extensions:d,splittableMarks:f}=s.extensionManager,h=vt(t,o.schema),p=vt(e,o.schema),{selection:m,storedMarks:y}=o,{$from:g,$to:x}=m,k=g.blockRange(x),b=y||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const S=fp(C=>q1(C.type.name,d))(m);if(k.depth>=1&&S&&k.depth-S.depth<=1){if(S.node.type===h)return u.liftListItem(p);if(q1(S.node.type.name,d)&&h.validContent(S.node.content)&&l)return a().command(()=>(i.setNodeMarkup(S.pos,h),!0)).command(()=>qm(i,h)).command(()=>Gm(i,h)).run()}return!n||!b||!l?a().command(()=>c().wrapInList(h,r)?!0:u.clearNodes()).wrapInList(h,r).command(()=>qm(i,h)).command(()=>Gm(i,h)).run():a().command(()=>{const C=c().wrapInList(h,r),E=b.filter(T=>f.includes(T.type.name));return i.ensureMarks(E),C?!0:u.clearNodes()}).wrapInList(h,r).command(()=>qm(i,h)).command(()=>Gm(i,h)).run()},fU=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=Os(t,r.schema);return Yy(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},hU=(t,e,n={})=>({state:r,commands:s})=>{const i=vt(t,r.schema),o=vt(e,r.schema),l=_i(r,i,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?s.setNode(o,a):s.setNode(i,{...a,...n})},pU=(t,e={})=>({state:n,commands:r})=>{const s=vt(t,n.schema);return _i(n,s,e)?r.lift(s):r.wrapIn(s,e)},mU=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,a))}else o.delete(i.from,i.to)}return!0}}return!1},gU=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:s}=n;return r||e&&s.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},yU=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=n,a=Os(t,r.schema),{$from:u,empty:c,ranges:d}=l;if(!s)return!0;if(c&&o){let{from:f,to:h}=l;const p=(i=u.marks().find(y=>y.type===a))==null?void 0:i.attrs,m=lx(u,a,p);m&&(f=m.from,h=m.to),n.removeMark(f,h,a)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},vU=t=>({tr:e,state:n,dispatch:r})=>{const{selection:s}=n;let i,o;return typeof t=="number"?(i=t,o=t):t&&"from"in t&&"to"in t?(i=t.from,o=t.to):(i=s.from,o=s.to),r&&e.doc.nodesBetween(i,o,(l,a)=>{if(l.isText)return;const u={...l.attrs};delete u.dir,e.setNodeMarkup(a,void 0,u)}),!0},xU=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const l=dp(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=vt(t,r.schema)),l==="mark"&&(o=Os(t,r.schema));let a=!1;return n.selection.ranges.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;let f,h,p,m;n.selection.empty?r.doc.nodesBetween(c,d,(y,g)=>{i&&i===y.type&&(a=!0,p=Math.max(g,c),m=Math.min(g+y.nodeSize,d),f=g,h=y)}):r.doc.nodesBetween(c,d,(y,g)=>{g<c&&i&&i===y.type&&(a=!0,p=Math.max(g,c),m=Math.min(g+y.nodeSize,d),f=g,h=y),g>=c&&g<=d&&(i&&i===y.type&&(a=!0,s&&n.setNodeMarkup(g,void 0,{...y.attrs,...e})),o&&y.marks.length&&y.marks.forEach(x=>{if(o===x.type&&(a=!0,s)){const k=Math.max(g,c),b=Math.min(g+y.nodeSize,d);n.addMark(k,b,o.create({...x.attrs,...e}))}}))}),h&&(f!==void 0&&s&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(y=>{o===y.type&&s&&n.addMark(p,m,o.create({...y.attrs,...e}))}))}),a},wU=(t,e={})=>({state:n,dispatch:r})=>{const s=vt(t,n.schema);return KB(s,e)(n,r)},kU=(t,e={})=>({state:n,dispatch:r})=>{const s=vt(t,n.schema);return JB(s,e)(n,r)},bU=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},mp=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},SU=(t,e)=>{if(ox(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 dd(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:l}=t,{view:a}=n;if(a.composing)return!1;const u=a.state.doc.resolve(r);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=JH(u)+i;return o.forEach(f=>{if(c)return;const h=SU(d,f.find);if(!h)return;const p=a.state.tr,m=up({state:a.state,transaction:p}),y={from:r-(h[0].length-i.length),to:s},{commands:g,chain:x,can:k}=new cp({editor:n,state:m});f.handler({state:m,range:y,match:h,commands:g,chain:x,can:k})===null||!p.steps.length||(f.undoable&&p.setMeta(l,{transform:p,from:r,to:s,text:i}),a.dispatch(p),c=!0)}),c}function CU(t){const{editor:e,rules:n}=t,r=new tt({state:{init(){return null},apply(s,i,o){const l=s.getMeta(r);if(l)return l;const a=s.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=ux(D.from(c),o.schema);const{from:d}=a,f=d+c.length;dd({editor:e,from:d,to:f,text:c,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,l){return dd({editor:e,from:i,to:o,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&dd({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?dd({editor:e,from:o.pos,to:o.pos,text:`
347
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function EU(t){return Object.prototype.toString.call(t).slice(8,-1)}function fd(t){return EU(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function cO(t,e){const n={...t};return fd(t)&&fd(e)&&Object.keys(e).forEach(r=>{fd(e[r])&&fd(t[r])?n[r]=cO(t[r],e[r]):n[r]=e[r]}),n}var hx=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Ve(re(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Ve(re(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>cO(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Bo=class dO extends hx{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new dO(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(u=>(u==null?void 0:u.type.name)===n.name))return!1;const a=o.find(u=>(u==null?void 0:u.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function TU(t){return typeof t=="number"}var RU=class{constructor(t){this.find=t.find,this.handler=t.handler}},MU=(t,e,n)=>{if(ox(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function NU(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:l}=t,{commands:a,chain:u,can:c}=new cp({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,s,(h,p)=>{var m,y,g,x,k;if((y=(m=h.type)==null?void 0:m.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const b=(k=(x=(g=h.content)==null?void 0:g.size)!=null?x:h.nodeSize)!=null?k:0,S=Math.max(r,p),C=Math.min(s,p+b);if(S>=C)return;const E=h.isText?h.text||"":h.textBetween(S-p,C-p,void 0,"");MU(E,i.find,o).forEach(N=>{if(N.index===void 0)return;const O=S+N.index+1,H=O+N[0].length,ne={from:n.tr.mapping.map(O),to:n.tr.mapping.map(H)},ae=i.handler({state:n,range:ne,match:N,commands:a,chain:u,can:c,pasteEvent:o,dropEvent:l});d.push(ae)})}),d.every(h=>h!==null)}var hd=null,OU=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function AU(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:c,from:d,to:f,rule:h,pasteEvt:p})=>{const m=c.tr,y=up({state:c,transaction:m});if(!(!NU({editor:e,state:y,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(c=>new tt({view(d){const f=p=>{var m;r=(m=d.dom.parentElement)!=null&&m.contains(p.target)?d.dom.parentElement:null,r&&(hd=e)},h=()=>{hd&&(hd=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,l=f,!i){const h=hd;h!=null&&h.isEditable&&setTimeout(()=>{const p=h.state.selection;p&&h.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,f)=>{var h;const p=(h=f.clipboardData)==null?void 0:h.getData("text/html");return o=f,s=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!s,y=p.getMeta("uiEvent")==="drop"&&!i,g=p.getMeta("applyPasteRules"),x=!!g;if(!m&&!y&&!x)return;if(x){let{text:S}=g;typeof S=="string"?S=S:S=ux(D.from(S),h.schema);const{from:C}=g,E=C+S.length,T=OU(S);return a({rule:c,state:h,from:C,to:{b:E},pasteEvt:T})}const k=f.doc.content.findDiffStart(h.doc.content),b=f.doc.content.findDiffEnd(h.doc.content);if(!(!TU(k)||!b||k===b.b))return a({rule:c,state:h,from:k,to:b,pasteEvt:o})}}))}var gp=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=cx(t),this.schema=tO(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:cd(e.name,this.schema)},r=re(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return Wf([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:cd(r.name,this.schema)},i=[],o=re(r,"addKeyboardShortcuts",s);let l={};if(r.type==="mark"&&re(r,"exitable",s)&&(l.ArrowRight=()=>Bo.handleExit({editor:t,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}const a=WV(l);i.push(a);const u=re(r,"addInputRules",s);if(W1(r,t.options.enableInputRules)&&u){const f=u();if(f&&f.length){const h=CU({editor:t,rules:f}),p=Array.isArray(h)?h:[h];i.push(...p)}}const c=re(r,"addPasteRules",s);if(W1(r,t.options.enablePasteRules)&&c){const f=c();if(f&&f.length){const h=AU({editor:t,rules:f});i.push(...h)}}const d=re(r,"addProseMirrorPlugins",s);if(d){const f=d();i.push(...f)}return i})}get attributes(){return eO(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=ua(this.extensions);return Object.fromEntries(e.filter(n=>!!re(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:vt(n.name,this.schema)},i=re(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const l=(a,u,c,d,f)=>{const h=rc(a,r);return o({node:a,view:u,getPos:c,decorations:d,innerDecorations:f,editor:t,extension:n,HTMLAttributes:h})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return Wf([...this.extensions].reverse()).reduceRight((r,s)=>{const i={name:s.name,options:s.options,storage:this.editor.extensionStorage[s.name],editor:e,type:cd(s.name,this.schema)},o=re(s,"dispatchTransaction",i);return o?l=>{o.call(i,{transaction:l,next:r})}:r},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=ua(this.extensions);return Object.fromEntries(e.filter(n=>!!re(n,"addMarkView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Os(n.name,this.schema)},i=re(n,"addMarkView",s);if(!i)return[];const o=(l,a,u)=>{const c=rc(l,r);return i()({mark:l,view:a,inline:u,editor:t,extension:n,HTMLAttributes:c,updateAttributes:d=>{WU(l,t,d)}})};return[n.name,o]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:cd(e.name,this.schema)};e.type==="mark"&&((n=Ve(re(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const s=re(e,"onBeforeCreate",r),i=re(e,"onCreate",r),o=re(e,"onUpdate",r),l=re(e,"onSelectionUpdate",r),a=re(e,"onTransaction",r),u=re(e,"onFocus",r),c=re(e,"onBlur",r),d=re(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),i&&this.editor.on("create",i),o&&this.editor.on("update",o),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),u&&this.editor.on("focus",u),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}};gp.resolve=cx;gp.sort=Wf;gp.flatten=hp;var _U={};ix(_U,{ClipboardTextSerializer:()=>hO,Commands:()=>pO,Delete:()=>mO,Drop:()=>gO,Editable:()=>yO,FocusEvents:()=>xO,Keymap:()=>wO,Paste:()=>kO,Tabindex:()=>bO,TextDirection:()=>SO,focusEventsPluginKey:()=>vO});var st=class fO extends hx{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new fO(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},hO=st.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new tt({key:new rt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,{ranges:i}=s,o=Math.min(...i.map(c=>c.$from.pos)),l=Math.max(...i.map(c=>c.$to.pos)),a=dx(n);return nO(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),pO=st.create({name:"commands",addCommands(){return{...lr}}}),mO=st.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const i=()=>{var o,l,a,u;if((u=(a=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,t))!=null?u:t.getMeta("y-sync$"))return;const c=YN(t.before,[t,...e]);iO(c).forEach(h=>{c.mapping.mapResult(h.oldRange.from).deletedAfter&&c.mapping.mapResult(h.oldRange.to).deletedBefore&&c.before.nodesBetween(h.oldRange.from,h.oldRange.to,(p,m)=>{const y=m+p.nodeSize-2,g=h.oldRange.from<=m&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:y,newFrom:c.mapping.map(m),newTo:c.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!g,editor:this.editor,transaction:t,combinedTransform:c})})});const f=c.mapping;c.steps.forEach((h,p)=>{var m,y;if(h instanceof gr){const g=f.slice(p).map(h.from,-1),x=f.slice(p).map(h.to),k=f.invert().map(g,-1),b=f.invert().map(x),S=(m=c.doc.nodeAt(g-1))==null?void 0:m.marks.some(E=>E.eq(h.mark)),C=(y=c.doc.nodeAt(x))==null?void 0:y.marks.some(E=>E.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:k,to:b},newRange:{from:g,to:x},partial:!!(C||S),editor:this.editor,transaction:t,combinedTransform:c})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),gO=st.create({name:"drop",addProseMirrorPlugins(){return[new tt({key:new rt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),yO=st.create({name:"editable",addProseMirrorPlugins(){return[new tt({key:new rt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),vO=new rt("focusEvents"),xO=st.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new tt({key:vO,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}}}})]}}),wO=st.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:u}=l,{empty:c,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,y=d.pos-d.parentOffset,g=m&&p.parent.childCount===1?y===d.pos:me.atStart(u).from===f;return!c||!h.type.isTextblock||h.textContent.length||!g||g&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...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 Uf()||QN()?i:s},addProseMirrorPlugins(){return[new tt({key:new rt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),s=t.some(m=>m.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:l}=e.selection,a=me.atStart(e.doc).from,u=me.atEnd(e.doc).to;if(i||!(o===a&&l===u)||!pp(n.doc))return;const f=n.tr,h=up({state:n,transaction:f}),{commands:p}=new cp({editor:this.editor,state:h});if(p.clearNodes(),!!f.steps.length)return f}})]}}),kO=st.create({name:"paste",addProseMirrorPlugins(){return[new tt({key:new rt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),bO=st.create({name:"tabindex",addProseMirrorPlugins(){return[new tt({key:new rt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),SO=st.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=ua(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new tt({key:new rt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),PU=class Xa{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}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: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 Xa(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 Xa(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 Xa(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=n.isInline,l=this.pos+r+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!s&&!o&&a.depth<=this.depth)return;const u=new Xa(a,this.editor,s,s||o?n:null);s&&(u.actualDepth=this.depth+1),e.push(u)}),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,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let l=0;l<o.length;l+=1){const a=o[l];if(i[a]!==n[a])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(a=>n[a]===o.node.attrs[a])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},IU=`.ProseMirror {
348
- position: relative;
349
- }
350
-
351
- .ProseMirror {
352
- word-wrap: break-word;
353
- white-space: pre-wrap;
354
- white-space: break-spaces;
355
- -webkit-font-variant-ligatures: none;
356
- font-variant-ligatures: none;
357
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
358
- }
359
-
360
- .ProseMirror [contenteditable="false"] {
361
- white-space: normal;
362
- }
363
-
364
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
365
- white-space: pre-wrap;
366
- }
367
-
368
- .ProseMirror pre {
369
- white-space: pre-wrap;
370
- }
371
-
372
- img.ProseMirror-separator {
373
- display: inline !important;
374
- border: none !important;
375
- margin: 0 !important;
376
- width: 0 !important;
377
- height: 0 !important;
378
- }
379
-
380
- .ProseMirror-gapcursor {
381
- display: none;
382
- pointer-events: none;
383
- position: absolute;
384
- margin: 0;
385
- }
386
-
387
- .ProseMirror-gapcursor:after {
388
- content: "";
389
- display: block;
390
- position: absolute;
391
- top: -2px;
392
- width: 20px;
393
- border-top: 1px solid black;
394
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
395
- }
396
-
397
- @keyframes ProseMirror-cursor-blink {
398
- to {
399
- visibility: hidden;
400
- }
401
- }
402
-
403
- .ProseMirror-hideselection *::selection {
404
- background: transparent;
405
- }
406
-
407
- .ProseMirror-hideselection *::-moz-selection {
408
- background: transparent;
409
- }
410
-
411
- .ProseMirror-hideselection * {
412
- caret-color: transparent;
413
- }
414
-
415
- .ProseMirror-focused .ProseMirror-gapcursor {
416
- display: block;
417
- }`;function DU(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var LU=class extends bU{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:XH,createMappablePosition:eU},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),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:r,slice:s,moved:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=KN(e,this.options.autofocus);this.editorState=bl.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t!=null&&t.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}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&&typeof document<"u"&&(this.css=DU(IU,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=XN(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[yO,hO.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),pO,xO,wO,bO,gO,kO,mO,SO.configure({direction:this.options.textDirection})].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 gp(r,this)}createCommandManager(){this.commandManager=new cp({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Zy(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=Zy(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),s=n?this.extensionManager.dispatchTransaction(r):r;this.editorView=new qN(t,{...e,attributes:{role:"textbox",...e==null?void 0:e.attributes},dispatchTransaction:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.prependClass(),this.injectCSS();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(u=>{var c;return(c=this.capturedTransaction)==null?void 0:c.step(u)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),l=o==null?void 0:o.getMeta("focus"),a=o==null?void 0:o.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:o}),a&&this.emit("blur",{editor:this,event:a.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(u=>u.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return sO(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return QH(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ux(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
418
-
419
- `,textSerializers:n={}}=t||{};return rO(this.state.doc,{blockSeparator:e,textSerializers:{...dx(this.schema),...n}})}get isEmpty(){return pp(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new PU(e,this)}get $doc(){return this.$pos(0)}};function ca(t){return new mp({find:t.find,handler:({state:e,range:n,match:r})=>{const s=Ve(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),u=n.from+l.indexOf(o),c=u+o.length;if(fx(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===t.type&&m!==h.mark.type)).filter(h=>h.to>u).length)return null;c<n.to&&i.delete(c,n.to),u>n.from&&i.delete(n.from+a,u);const f=n.from+a+o.length;i.addMark(n.from+a,f,t.type.create(s||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function jU(t){return new mp({find:t.find,handler:({state:e,range:n,match:r})=>{const s=Ve(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let l=n.to;const a=t.type.create(s);if(r[1]){const u=r[0].lastIndexOf(r[1]);let c=o+u;c>l?c=l:l=c+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,o+r[0].length-1),i.replaceWith(c,l,a)}else if(r[0]){const u=t.type.isInline?o:o-1;i.insert(u,t.type.create(s)).delete(i.mapping.map(o),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function Xy(t){return new mp({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),i=Ve(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function da(t){return new mp({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const i=Ve(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),a=o.doc.resolve(n.from).blockRange(),u=a&&V0(a,t.type,i);if(!u)return null;if(o.wrap(a,u),t.keepMarks&&t.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=t.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(y=>h.includes(y.type.name));o.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,i).run()}const c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&$i(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&o.join(n.from-1)},undoable:t.undoable})}function $U(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof ue){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}var zU={};ix(zU,{createAtomBlockMarkdownSpec:()=>FU,createBlockMarkdownSpec:()=>BU,createInlineMarkdownSpec:()=>UU,parseAttributes:()=>px,parseIndentedBlocks:()=>ev,renderNestedMarkdownContent:()=>gx,serializeAttributes:()=>mx});function px(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,u=>(n.push(u),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const u=s.map(c=>c.trim().slice(1));e.class=u.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,u,c])=>{var d;const f=parseInt(((d=c.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),h=n[f];h&&(e[u]=h.slice(1,-1))});const a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(c=>{c.match(/^[a-zA-Z][\w-]*$/)&&(e[c]=!0)}),e}function mx(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function FU(t){const{nodeName:e,name:n,parseAttributes:r=px,serializeAttributes:s=mx,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:l}=t,a=n||e,u=c=>{if(!l)return c;const d={};return l.forEach(f=>{f in c&&(d[f]=c[f])}),d};return{parseMarkdown:(c,d)=>{const f={...i,...c.attributes};return d.createNode(e,f,[])},markdownTokenizer:{name:e,level:"block",start(c){var d;const f=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(d=c.match(f))==null?void 0:d.index;return h!==void 0?h:-1},tokenize(c,d,f){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=c.match(h);if(!p)return;const m=p[1]||"",y=r(m);if(!o.find(x=>!(x in y)))return{type:e,raw:p[0],attributes:y}}},renderMarkdown:c=>{const d=u(c.attrs||{}),f=s(d),h=f?` {${f}}`:"";return`:::${a}${h} :::`}}}function BU(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=px,serializeAttributes:i=mx,defaultAttributes:o={},content:l="block",allowedAttributes:a}=t,u=n||e,c=d=>{if(!a)return d;const f={};return a.forEach(h=>{h in d&&(f[h]=d[h])}),f};return{parseMarkdown:(d,f)=>{let h;if(r){const m=r(d);h=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?h=f.parseChildren(d.tokens||[]):h=f.parseInline(d.tokens||[]);const p={...o,...d.attributes};return f.createNode(e,p,h)},markdownTokenizer:{name:e,level:"block",start(d){var f;const h=new RegExp(`^:::${u}`,"m"),p=(f=d.match(h))==null?void 0:f.index;return p!==void 0?p:-1},tokenize(d,f,h){var p;const m=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=d.match(m);if(!y)return;const[g,x=""]=y,k=s(x);let b=1;const S=g.length;let C="";const E=/^:::([\w-]*)(\s.*)?/gm,T=d.slice(S);for(E.lastIndex=0;;){const N=E.exec(T);if(N===null)break;const O=N.index,H=N[1];if(!((p=N[2])!=null&&p.endsWith(":::"))){if(H)b+=1;else if(b-=1,b===0){const ne=T.slice(0,O);C=ne.trim();const ae=d.slice(0,S+O+N[0].length);let Q=[];if(C)if(l==="block")for(Q=h.blockTokens(ne),Q.forEach(le=>{le.text&&(!le.tokens||le.tokens.length===0)&&(le.tokens=h.inlineTokens(le.text))});Q.length>0;){const le=Q[Q.length-1];if(le.type==="paragraph"&&(!le.text||le.text.trim()===""))Q.pop();else break}else Q=h.inlineTokens(C);return{type:e,raw:ae,attributes:k,content:C,tokens:Q}}}}}},renderMarkdown:(d,f)=>{const h=c(d.attrs||{}),p=i(h),m=p?` {${p}}`:"",y=f.renderChildren(d.content||[],`
420
-
421
- `);return`:::${u}${m}
422
-
423
- ${y}
424
-
425
- :::`}}}function VU(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=n.exec(t)}return e}function HU(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function UU(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=VU,serializeAttributes:i=HU,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:a}=t,u=n||e,c=f=>{if(!a)return f;const h={};return a.forEach(p=>{const m=typeof p=="string"?p:p.name,y=typeof p=="string"?void 0:p.skipIfDefault;if(m in f){const g=f[m];if(y!==void 0&&g===y)return;h[m]=g}}),h},d=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,h)=>{const p={...o,...f.attributes};if(l)return h.createNode(e,p);const m=r?r(f):f.content||"";return m?h.createNode(e,p,[h.createTextNode(m)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){const h=l?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),p=f.match(h),m=p==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,h,p){const m=l?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),y=f.match(m);if(!y)return;let g="",x="";if(l){const[,b]=y;x=b}else{const[,b,S]=y;x=b,g=S||""}const k=s(x.trim());return{type:e,raw:y[0],content:g.trim(),attributes:k}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(g=>g.type==="text").map(g=>g.text).join(""));const p=c(f.attrs||{}),m=i(p),y=m?` ${m}`:"";return l?`[${u}${y}]`:`[${u}${y}]${h}[/${u}]`}}}function ev(t,e,n){var r,s,i,o;const l=t.split(`
426
- `),a=[];let u="",c=0;const d=e.baseIndentSize||2;for(;c<l.length;){const f=l[c],h=f.match(e.itemPattern);if(!h){if(a.length>0)break;if(f.trim()===""){c+=1,u=`${u}${f}
427
- `;continue}else return}const p=e.extractItemData(h),{indentLevel:m,mainContent:y}=p;u=`${u}${f}
428
- `;const g=[y];for(c+=1;c<l.length;){const S=l[c];if(S.trim()===""){const E=l.slice(c+1).findIndex(O=>O.trim()!=="");if(E===-1)break;if((((s=(r=l[c+1+E].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>m){g.push(S),u=`${u}${S}
429
- `,c+=1;continue}else break}if((((o=(i=S.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>m)g.push(S),u=`${u}${S}
430
- `,c+=1;else break}let x;const k=g.slice(1);if(k.length>0){const S=k.map(C=>C.slice(m+d)).join(`
431
- `);S.trim()&&(e.customNestedParser?x=e.customNestedParser(S):x=n.blockTokens(S))}const b=e.createToken(p,x);a.push(b)}if(a.length!==0)return{items:a,raw:u}}function gx(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=t.content,l=e.renderChildren([i]),a=[`${s}${l}`];return o&&o.length>0&&o.forEach(u=>{const c=e.renderChildren([u]);if(c){const d=c.split(`
432
- `).map(f=>f?e.indent(f):"").join(`
433
- `);a.push(d)}}),a.join(`
434
- `)}function WU(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((l,a)=>{const u=i.mapping.map(a),c=i.mapping.map(a)+l.nodeSize;let d=null;if(l.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});i.removeMark(u,c,t.type),i.addMark(u,c,h)}}),i.docChanged&&e.view.dispatch(i)}var Ln=class CO extends hx{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new CO(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Io(t){return new RU({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=Ve(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,l=r[r.length-1],a=r[0];let u=n.to;if(l){const c=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if(fx(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===t.type&&y!==p.mark.type)).filter(p=>p.to>d).length)return null;f<n.to&&o.delete(f,n.to),d>n.from&&o.delete(n.from+c,d),u=n.from+c+l.length,o.addMark(n.from+c,u,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:qU,getOwnPropertySymbols:GU}=Object,{hasOwnProperty:KU}=Object.prototype;function Km(t,e){return function(r,s,i){return t(r,s,i)&&e(r,s,i)}}function pd(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);const{cache:i}=s,o=i.get(n),l=i.get(r);if(o&&l)return o===r&&l===n;i.set(n,r),i.set(r,n);const a=t(n,r,s);return i.delete(n),i.delete(r),a}}function JU(t){return t!=null?t[Symbol.toStringTag]:void 0}function K1(t){return qU(t).concat(GU(t))}const QU=Object.hasOwn||((t,e)=>KU.call(t,e));function Vo(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const ZU="__v",YU="__o",XU="_owner",{getOwnPropertyDescriptor:J1,keys:Q1}=Object;function e5(t,e){return t.byteLength===e.byteLength&&qf(new Uint8Array(t),new Uint8Array(e))}function t5(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function n5(t,e){return t.byteLength===e.byteLength&&qf(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function r5(t,e){return Vo(t.getTime(),e.getTime())}function s5(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function i5(t,e){return t===e}function Z1(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.entries();let o,l,a=0;for(;(o=i.next())&&!o.done;){const u=e.entries();let c=!1,d=0;for(;(l=u.next())&&!l.done;){if(s[d]){d++;continue}const f=o.value,h=l.value;if(n.equals(f[0],h[0],a,d,t,e,n)&&n.equals(f[1],h[1],f[0],h[0],t,e,n)){c=s[d]=!0;break}d++}if(!c)return!1;a++}return!0}const o5=Vo;function l5(t,e,n){const r=Q1(t);let s=r.length;if(Q1(e).length!==s)return!1;for(;s-- >0;)if(!EO(t,e,n,r[s]))return!1;return!0}function $a(t,e,n){const r=K1(t);let s=r.length;if(K1(e).length!==s)return!1;let i,o,l;for(;s-- >0;)if(i=r[s],!EO(t,e,n,i)||(o=J1(t,i),l=J1(e,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function a5(t,e){return Vo(t.valueOf(),e.valueOf())}function u5(t,e){return t.source===e.source&&t.flags===e.flags}function Y1(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const s=new Array(r),i=t.values();let o,l;for(;(o=i.next())&&!o.done;){const a=e.values();let u=!1,c=0;for(;(l=a.next())&&!l.done;){if(!s[c]&&n.equals(o.value,l.value,o.value,l.value,t,e,n)){u=s[c]=!0;break}c++}if(!u)return!1}return!0}function qf(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function c5(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function EO(t,e,n,r){return(r===XU||r===YU||r===ZU)&&(t.$$typeof||e.$$typeof)?!0:QU(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const d5="[object ArrayBuffer]",f5="[object Arguments]",h5="[object Boolean]",p5="[object DataView]",m5="[object Date]",g5="[object Error]",y5="[object Map]",v5="[object Number]",x5="[object Object]",w5="[object RegExp]",k5="[object Set]",b5="[object String]",S5={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},C5="[object URL]",E5=Object.prototype.toString;function T5({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:s,areFunctionsEqual:i,areMapsEqual:o,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:u,areRegExpsEqual:c,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:h,unknownTagComparators:p}){return function(y,g,x){if(y===g)return!0;if(y==null||g==null)return!1;const k=typeof y;if(k!==typeof g)return!1;if(k!=="object")return k==="number"?l(y,g,x):k==="function"?i(y,g,x):!1;const b=y.constructor;if(b!==g.constructor)return!1;if(b===Object)return a(y,g,x);if(Array.isArray(y))return e(y,g,x);if(b===Date)return r(y,g,x);if(b===RegExp)return c(y,g,x);if(b===Map)return o(y,g,x);if(b===Set)return d(y,g,x);const S=E5.call(y);if(S===m5)return r(y,g,x);if(S===w5)return c(y,g,x);if(S===y5)return o(y,g,x);if(S===k5)return d(y,g,x);if(S===x5)return typeof y.then!="function"&&typeof g.then!="function"&&a(y,g,x);if(S===C5)return h(y,g,x);if(S===g5)return s(y,g,x);if(S===f5)return a(y,g,x);if(S5[S])return f(y,g,x);if(S===d5)return t(y,g,x);if(S===p5)return n(y,g,x);if(S===h5||S===v5||S===b5)return u(y,g,x);if(p){let C=p[S];if(!C){const E=JU(y);E&&(C=p[E])}if(C)return C(y,g,x)}return!1}}function R5({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:e5,areArraysEqual:n?$a:t5,areDataViewsEqual:n5,areDatesEqual:r5,areErrorsEqual:s5,areFunctionsEqual:i5,areMapsEqual:n?Km(Z1,$a):Z1,areNumbersEqual:o5,areObjectsEqual:n?$a:l5,arePrimitiveWrappersEqual:a5,areRegExpsEqual:u5,areSetsEqual:n?Km(Y1,$a):Y1,areTypedArraysEqual:n?Km(qf,$a):qf,areUrlsEqual:c5,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const s=pd(r.areArraysEqual),i=pd(r.areMapsEqual),o=pd(r.areObjectsEqual),l=pd(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:s,areMapsEqual:i,areObjectsEqual:o,areSetsEqual:l})}return r}function M5(t){return function(e,n,r,s,i,o,l){return t(e,n,l)}}function N5({circular:t,comparator:e,createState:n,equals:r,strict:s}){if(n)return function(l,a){const{cache:u=t?new WeakMap:void 0,meta:c}=n();return e(l,a,{cache:u,equals:r,meta:c,strict:s})};if(t)return function(l,a){return e(l,a,{cache:new WeakMap,equals:r,meta:void 0,strict:s})};const i={cache:void 0,equals:r,meta:void 0,strict:s};return function(l,a){return e(l,a,i)}}const O5=Fi();Fi({strict:!0});Fi({circular:!0});Fi({circular:!0,strict:!0});Fi({createInternalComparator:()=>Vo});Fi({strict:!0,createInternalComparator:()=>Vo});Fi({circular:!0,createInternalComparator:()=>Vo});Fi({circular:!0,createInternalComparator:()=>Vo,strict:!0});function Fi(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:s=!1}=t,i=R5(t),o=T5(i),l=n?n(o):M5(o);return N5({circular:e,comparator:o,createState:r,equals:l,strict:s})}var TO={exports:{}},RO={};/**
435
- * @license React
436
- * use-sync-external-store-shim/with-selector.production.js
437
- *
438
- * Copyright (c) Meta Platforms, Inc. and affiliates.
439
- *
440
- * This source code is licensed under the MIT license found in the
441
- * LICENSE file in the root directory of this source tree.
442
- */var yp=v,A5=z0;function _5(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var P5=typeof Object.is=="function"?Object.is:_5,I5=A5.useSyncExternalStore,D5=yp.useRef,L5=yp.useEffect,j5=yp.useMemo,$5=yp.useDebugValue;RO.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var i=D5(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=j5(function(){function a(h){if(!u){if(u=!0,c=h,h=r(h),s!==void 0&&o.hasValue){var p=o.value;if(s(p,h))return d=p}return d=h}if(p=d,P5(c,h))return p;var m=r(h);return s!==void 0&&s(p,m)?(c=h,p):(c=h,d=m)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return a(e())},f===null?void 0:function(){return a(f())}]},[e,n,r,s]);var l=I5(t,i[0],i[1]);return L5(function(){o.hasValue=!0,o.value=l},[l]),$5(l),l};TO.exports=RO;var z5=TO.exports;const MO=["top","right","bottom","left"],X1=["start","end"],eS=MO.reduce((t,e)=>t.concat(e,e+"-"+X1[0],e+"-"+X1[1]),[]),qr=Math.min,tn=Math.max,Gf=Math.round,Br=t=>({x:t,y:t}),F5={left:"right",right:"left",bottom:"top",top:"bottom"},B5={start:"end",end:"start"};function tv(t,e,n){return tn(t,qr(e,n))}function As(t,e){return typeof t=="function"?t(e):t}function tr(t){return t.split("-")[0]}function wr(t){return t.split("-")[1]}function NO(t){return t==="x"?"y":"x"}function yx(t){return t==="y"?"height":"width"}const V5=new Set(["top","bottom"]);function jr(t){return V5.has(tr(t))?"y":"x"}function vx(t){return NO(jr(t))}function OO(t,e,n){n===void 0&&(n=!1);const r=wr(t),s=vx(t),i=yx(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=Jf(o)),[o,Jf(o)]}function H5(t){const e=Jf(t);return[Kf(t),e,Kf(e)]}function Kf(t){return t.replace(/start|end/g,e=>B5[e])}const tS=["left","right"],nS=["right","left"],U5=["top","bottom"],W5=["bottom","top"];function q5(t,e,n){switch(t){case"top":case"bottom":return n?e?nS:tS:e?tS:nS;case"left":case"right":return e?U5:W5;default:return[]}}function G5(t,e,n,r){const s=wr(t);let i=q5(tr(t),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(Kf)))),i}function Jf(t){return t.replace(/left|right|bottom|top/g,e=>F5[e])}function K5(t){return{top:0,right:0,bottom:0,left:0,...t}}function xx(t){return typeof t!="number"?K5(t):{top:t,right:t,bottom:t,left:t}}function fa(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function rS(t,e,n){let{reference:r,floating:s}=t;const i=jr(e),o=vx(e),l=yx(o),a=tr(e),u=i==="y",c=r.x+r.width/2-s.width/2,d=r.y+r.height/2-s.height/2,f=r[l]/2-s[l]/2;let h;switch(a){case"top":h={x:c,y:r.y-s.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-s.width,y:d};break;default:h={x:r.x,y:r.y}}switch(wr(e)){case"start":h[o]-=f*(n&&u?-1:1);break;case"end":h[o]+=f*(n&&u?-1:1);break}return h}async function J5(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:l,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=As(e,t),p=xx(h),y=l[f?d==="floating"?"reference":"floating":d],g=fa(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:c,strategy:a})),x=d==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),b=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},S=fa(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:k,strategy:a}):x);return{top:(g.top-S.top+p.top)/b.y,bottom:(S.bottom-g.bottom+p.bottom)/b.y,left:(g.left-S.left+p.left)/b.x,right:(S.right-g.right+p.right)/b.x}}const Q5=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=i.filter(Boolean),a=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:c,y:d}=rS(u,r,a),f=r,h={},p=0;for(let y=0;y<l.length;y++){var m;const{name:g,fn:x}=l[y],{x:k,y:b,data:S,reset:C}=await x({x:c,y:d,initialPlacement:r,placement:f,strategy:s,middlewareData:h,rects:u,platform:{...o,detectOverflow:(m=o.detectOverflow)!=null?m:J5},elements:{reference:t,floating:e}});c=k??c,d=b??d,h={...h,[g]:{...h[g],...S}},C&&p<=50&&(p++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(u=C.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):C.rects),{x:c,y:d}=rS(u,f,a)),y=-1)}return{x:c,y:d,placement:f,strategy:s,middlewareData:h}},Z5=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:a}=e,{element:u,padding:c=0}=As(t,e)||{};if(u==null)return{};const d=xx(c),f={x:n,y:r},h=vx(s),p=yx(h),m=await o.getDimensions(u),y=h==="y",g=y?"top":"left",x=y?"bottom":"right",k=y?"clientHeight":"clientWidth",b=i.reference[p]+i.reference[h]-f[h]-i.floating[p],S=f[h]-i.reference[h],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let E=C?C[k]:0;(!E||!await(o.isElement==null?void 0:o.isElement(C)))&&(E=l.floating[k]||i.floating[p]);const T=b/2-S/2,N=E/2-m[p]/2-1,O=qr(d[g],N),H=qr(d[x],N),ne=O,ae=E-m[p]-H,Q=E/2-m[p]/2+T,le=tv(ne,Q,ae),se=!a.arrow&&wr(s)!=null&&Q!==le&&i.reference[p]/2-(Q<ne?O:H)-m[p]/2<0,ye=se?Q<ne?Q-ne:Q-ae:0;return{[h]:f[h]+ye,data:{[h]:le,centerOffset:Q-le-ye,...se&&{alignmentOffset:ye}},reset:se}}});function Y5(t,e,n){return(t?[...n.filter(s=>wr(s)===t),...n.filter(s=>wr(s)!==t)]:n.filter(s=>tr(s)===s)).filter(s=>t?wr(s)===t||(e?Kf(s)!==s:!1):!0)}const X5=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var n,r,s;const{rects:i,middlewareData:o,placement:l,platform:a,elements:u}=e,{crossAxis:c=!1,alignment:d,allowedPlacements:f=eS,autoAlignment:h=!0,...p}=As(t,e),m=d!==void 0||f===eS?Y5(d||null,h,f):f,y=await a.detectOverflow(e,p),g=((n=o.autoPlacement)==null?void 0:n.index)||0,x=m[g];if(x==null)return{};const k=OO(x,i,await(a.isRTL==null?void 0:a.isRTL(u.floating)));if(l!==x)return{reset:{placement:m[0]}};const b=[y[tr(x)],y[k[0]],y[k[1]]],S=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:x,overflows:b}],C=m[g+1];if(C)return{data:{index:g+1,overflows:S},reset:{placement:C}};const E=S.map(O=>{const H=wr(O.placement);return[O.placement,H&&c?O.overflows.slice(0,2).reduce((ne,ae)=>ne+ae,0):O.overflows[0],O.overflows]}).sort((O,H)=>O[1]-H[1]),N=((s=E.filter(O=>O[2].slice(0,wr(O[0])?2:3).every(H=>H<=0))[0])==null?void 0:s[0])||E[0][0];return N!==l?{data:{index:g+1,overflows:S},reset:{placement:N}}:{}}}},e6=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:a,elements:u}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=As(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=tr(s),x=jr(l),k=tr(l)===l,b=await(a.isRTL==null?void 0:a.isRTL(u.floating)),S=f||(k||!m?[Jf(l)]:H5(l)),C=p!=="none";!f&&C&&S.push(...G5(l,m,p,b));const E=[l,...S],T=await a.detectOverflow(e,y),N=[];let O=((r=i.flip)==null?void 0:r.overflows)||[];if(c&&N.push(T[g]),d){const Q=OO(s,o,b);N.push(T[Q[0]],T[Q[1]])}if(O=[...O,{placement:s,overflows:N}],!N.every(Q=>Q<=0)){var H,ne;const Q=(((H=i.flip)==null?void 0:H.index)||0)+1,le=E[Q];if(le&&(!(d==="alignment"?x!==jr(le):!1)||O.every(M=>jr(M.placement)===x?M.overflows[0]>0:!0)))return{data:{index:Q,overflows:O},reset:{placement:le}};let se=(ne=O.filter(ye=>ye.overflows[0]<=0).sort((ye,M)=>ye.overflows[1]-M.overflows[1])[0])==null?void 0:ne.placement;if(!se)switch(h){case"bestFit":{var ae;const ye=(ae=O.filter(M=>{if(C){const V=jr(M.placement);return V===x||V==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(V=>V>0).reduce((V,ie)=>V+ie,0)]).sort((M,V)=>M[1]-V[1])[0])==null?void 0:ae[0];ye&&(se=ye);break}case"initialPlacement":se=l;break}if(s!==se)return{reset:{placement:se}}}return{}}}};function sS(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function iS(t){return MO.some(e=>t[e]>=0)}const t6=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...i}=As(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),l=sS(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:iS(l)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),l=sS(o,n.floating);return{data:{escapedOffsets:l,escaped:iS(l)}}}default:return{}}}}};function AO(t){const e=qr(...t.map(i=>i.left)),n=qr(...t.map(i=>i.top)),r=tn(...t.map(i=>i.right)),s=tn(...t.map(i=>i.bottom));return{x:e,y:n,width:r-e,height:s-n}}function n6(t){const e=t.slice().sort((s,i)=>s.y-i.y),n=[];let r=null;for(let s=0;s<e.length;s++){const i=e[s];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(s=>fa(AO(s)))}const r6=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(e){const{placement:n,elements:r,rects:s,platform:i,strategy:o}=e,{padding:l=2,x:a,y:u}=As(t,e),c=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(r.reference))||[]),d=n6(c),f=fa(AO(c)),h=xx(l);function p(){if(d.length===2&&d[0].left>d[1].right&&a!=null&&u!=null)return d.find(y=>a>y.left-h.left&&a<y.right+h.right&&u>y.top-h.top&&u<y.bottom+h.bottom)||f;if(d.length>=2){if(jr(n)==="y"){const O=d[0],H=d[d.length-1],ne=tr(n)==="top",ae=O.top,Q=H.bottom,le=ne?O.left:H.left,se=ne?O.right:H.right,ye=se-le,M=Q-ae;return{top:ae,bottom:Q,left:le,right:se,width:ye,height:M,x:le,y:ae}}const y=tr(n)==="left",g=tn(...d.map(O=>O.right)),x=qr(...d.map(O=>O.left)),k=d.filter(O=>y?O.left===x:O.right===g),b=k[0].top,S=k[k.length-1].bottom,C=x,E=g,T=E-C,N=S-b;return{top:b,bottom:S,left:C,right:E,width:T,height:N,x:C,y:b}}return f}const m=await i.getElementRects({reference:{getBoundingClientRect:p},floating:r.floating,strategy:o});return s.reference.x!==m.reference.x||s.reference.y!==m.reference.y||s.reference.width!==m.reference.width||s.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},s6=new Set(["left","top"]);async function i6(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=tr(n),l=wr(n),a=jr(n)==="y",u=s6.has(o)?-1:1,c=i&&a?-1:1,d=As(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*c,y:f*u}:{x:f*u,y:h*c}}const o6=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=e,a=await i6(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+a.x,y:i+a.y,data:{...a,placement:o}}}}},l6=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:i}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:a={fn:g=>{let{x,y:k}=g;return{x,y:k}}},...u}=As(t,e),c={x:n,y:r},d=await i.detectOverflow(e,u),f=jr(tr(s)),h=NO(f);let p=c[h],m=c[f];if(o){const g=h==="y"?"top":"left",x=h==="y"?"bottom":"right",k=p+d[g],b=p-d[x];p=tv(k,p,b)}if(l){const g=f==="y"?"top":"left",x=f==="y"?"bottom":"right",k=m+d[g],b=m-d[x];m=tv(k,m,b)}const y=a.fn({...e,[h]:p,[f]:m});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:o,[f]:l}}}}}},a6=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:i,platform:o,elements:l}=e,{apply:a=()=>{},...u}=As(t,e),c=await o.detectOverflow(e,u),d=tr(s),f=wr(s),h=jr(s)==="y",{width:p,height:m}=i.floating;let y,g;d==="top"||d==="bottom"?(y=d,g=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(g=d,y=f==="end"?"top":"bottom");const x=m-c.top-c.bottom,k=p-c.left-c.right,b=qr(m-c[y],x),S=qr(p-c[g],k),C=!e.middlewareData.shift;let E=b,T=S;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(T=k),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(E=x),C&&!f){const O=tn(c.left,0),H=tn(c.right,0),ne=tn(c.top,0),ae=tn(c.bottom,0);h?T=p-2*(O!==0||H!==0?O+H:tn(c.left,c.right)):E=m-2*(ne!==0||ae!==0?ne+ae:tn(c.top,c.bottom))}await a({...e,availableWidth:T,availableHeight:E});const N=await o.getDimensions(l.floating);return p!==N.width||m!==N.height?{reset:{rects:!0}}:{}}}};function vp(){return typeof window<"u"}function ba(t){return _O(t)?(t.nodeName||"").toLowerCase():"#document"}function An(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function _s(t){var e;return(e=(_O(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function _O(t){return vp()?t instanceof Node||t instanceof An(t).Node:!1}function br(t){return vp()?t instanceof Element||t instanceof An(t).Element:!1}function Gr(t){return vp()?t instanceof HTMLElement||t instanceof An(t).HTMLElement:!1}function oS(t){return!vp()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof An(t).ShadowRoot}const u6=new Set(["inline","contents"]);function bc(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Sr(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!u6.has(s)}const c6=new Set(["table","td","th"]);function d6(t){return c6.has(ba(t))}const f6=[":popover-open",":modal"];function xp(t){return f6.some(e=>{try{return t.matches(e)}catch{return!1}})}const h6=["transform","translate","scale","rotate","perspective"],p6=["transform","translate","scale","rotate","perspective","filter"],m6=["paint","layout","strict","content"];function wx(t){const e=kx(),n=br(t)?Sr(t):t;return h6.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||p6.some(r=>(n.willChange||"").includes(r))||m6.some(r=>(n.contain||"").includes(r))}function g6(t){let e=Pi(t);for(;Gr(e)&&!ha(e);){if(wx(e))return e;if(xp(e))return null;e=Pi(e)}return null}function kx(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const y6=new Set(["html","body","#document"]);function ha(t){return y6.has(ba(t))}function Sr(t){return An(t).getComputedStyle(t)}function wp(t){return br(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Pi(t){if(ba(t)==="html")return t;const e=t.assignedSlot||t.parentNode||oS(t)&&t.host||_s(t);return oS(e)?e.host:e}function PO(t){const e=Pi(t);return ha(e)?t.ownerDocument?t.ownerDocument.body:t.body:Gr(e)&&bc(e)?e:PO(e)}function IO(t,e,n){var r;e===void 0&&(e=[]);const s=PO(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),o=An(s);return i?(nv(o),e.concat(o,o.visualViewport||[],bc(s)?s:[],[])):e.concat(s,IO(s,[]))}function nv(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function DO(t){const e=Sr(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Gr(t),i=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=Gf(n)!==i||Gf(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function LO(t){return br(t)?t:t.contextElement}function _l(t){const e=LO(t);if(!Gr(e))return Br(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=DO(e);let o=(i?Gf(n.width):n.width)/r,l=(i?Gf(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const v6=Br(0);function jO(t){const e=An(t);return!kx()||!e.visualViewport?v6:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function x6(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==An(t)?!1:e}function sc(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=LO(t);let o=Br(1);e&&(r?br(r)&&(o=_l(r)):o=_l(t));const l=x6(i,n,r)?jO(i):Br(0);let a=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,c=s.width/o.x,d=s.height/o.y;if(i){const f=An(i),h=r&&br(r)?An(r):r;let p=f,m=nv(p);for(;m&&r&&h!==p;){const y=_l(m),g=m.getBoundingClientRect(),x=Sr(m),k=g.left+(m.clientLeft+parseFloat(x.paddingLeft))*y.x,b=g.top+(m.clientTop+parseFloat(x.paddingTop))*y.y;a*=y.x,u*=y.y,c*=y.x,d*=y.y,a+=k,u+=b,p=An(m),m=nv(p)}}return fa({width:c,height:d,x:a,y:u})}function kp(t,e){const n=wp(t).scrollLeft;return e?e.left+n:sc(_s(t)).left+n}function $O(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-kp(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function w6(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",o=_s(r),l=e?xp(e.floating):!1;if(r===o||l&&i)return n;let a={scrollLeft:0,scrollTop:0},u=Br(1);const c=Br(0),d=Gr(r);if((d||!d&&!i)&&((ba(r)!=="body"||bc(o))&&(a=wp(r)),Gr(r))){const h=sc(r);u=_l(r),c.x=h.x+r.clientLeft,c.y=h.y+r.clientTop}const f=o&&!d&&!i?$O(o,a):Br(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+c.x+f.x,y:n.y*u.y-a.scrollTop*u.y+c.y+f.y}}function k6(t){return Array.from(t.getClientRects())}function b6(t){const e=_s(t),n=wp(t),r=t.ownerDocument.body,s=tn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=tn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+kp(t);const l=-n.scrollTop;return Sr(r).direction==="rtl"&&(o+=tn(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}const lS=25;function S6(t,e){const n=An(t),r=_s(t),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,a=0;if(s){i=s.width,o=s.height;const c=kx();(!c||c&&e==="fixed")&&(l=s.offsetLeft,a=s.offsetTop)}const u=kp(r);if(u<=0){const c=r.ownerDocument,d=c.body,f=getComputedStyle(d),h=c.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=lS&&(i-=p)}else u<=lS&&(i+=u);return{width:i,height:o,x:l,y:a}}const C6=new Set(["absolute","fixed"]);function E6(t,e){const n=sc(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=Gr(t)?_l(t):Br(1),o=t.clientWidth*i.x,l=t.clientHeight*i.y,a=s*i.x,u=r*i.y;return{width:o,height:l,x:a,y:u}}function aS(t,e,n){let r;if(e==="viewport")r=S6(t,n);else if(e==="document")r=b6(_s(t));else if(br(e))r=E6(e,n);else{const s=jO(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return fa(r)}function zO(t,e){const n=Pi(t);return n===e||!br(n)||ha(n)?!1:Sr(n).position==="fixed"||zO(n,e)}function T6(t,e){const n=e.get(t);if(n)return n;let r=IO(t,[]).filter(l=>br(l)&&ba(l)!=="body"),s=null;const i=Sr(t).position==="fixed";let o=i?Pi(t):t;for(;br(o)&&!ha(o);){const l=Sr(o),a=wx(o);!a&&l.position==="fixed"&&(s=null),(i?!a&&!s:!a&&l.position==="static"&&!!s&&C6.has(s.position)||bc(o)&&!a&&zO(t,o))?r=r.filter(c=>c!==o):s=l,o=Pi(o)}return e.set(t,r),r}function R6(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?xp(e)?[]:T6(e,this._c):[].concat(n),r],l=o[0],a=o.reduce((u,c)=>{const d=aS(e,c,s);return u.top=tn(d.top,u.top),u.right=qr(d.right,u.right),u.bottom=qr(d.bottom,u.bottom),u.left=tn(d.left,u.left),u},aS(e,l,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function M6(t){const{width:e,height:n}=DO(t);return{width:e,height:n}}function N6(t,e,n){const r=Gr(e),s=_s(e),i=n==="fixed",o=sc(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=Br(0);function u(){a.x=kp(s)}if(r||!r&&!i)if((ba(e)!=="body"||bc(s))&&(l=wp(e)),r){const h=sc(e,!0,i,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else s&&u();i&&!r&&s&&u();const c=s&&!r&&!i?$O(s,l):Br(0),d=o.left+l.scrollLeft-a.x-c.x,f=o.top+l.scrollTop-a.y-c.y;return{x:d,y:f,width:o.width,height:o.height}}function Jm(t){return Sr(t).position==="static"}function uS(t,e){if(!Gr(t)||Sr(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return _s(t)===n&&(n=n.ownerDocument.body),n}function FO(t,e){const n=An(t);if(xp(t))return n;if(!Gr(t)){let s=Pi(t);for(;s&&!ha(s);){if(br(s)&&!Jm(s))return s;s=Pi(s)}return n}let r=uS(t,e);for(;r&&d6(r)&&Jm(r);)r=uS(r,e);return r&&ha(r)&&Jm(r)&&!wx(r)?n:r||g6(t)||n}const O6=async function(t){const e=this.getOffsetParent||FO,n=this.getDimensions,r=await n(t.floating);return{reference:N6(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function A6(t){return Sr(t).direction==="rtl"}const _6={convertOffsetParentRelativeRectToViewportRelativeRect:w6,getDocumentElement:_s,getClippingRect:R6,getOffsetParent:FO,getElementRects:O6,getClientRects:k6,getDimensions:M6,getScale:_l,isElement:br,isRTL:A6},BO=o6,VO=X5,HO=l6,UO=e6,WO=a6,qO=t6,GO=Z5,KO=r6,JO=(t,e,n)=>{const r=new Map,s={platform:_6,...n},i={...s.platform,_c:r};return Q5(t,e,{...s,platform:i})};let rv,sv;if(typeof WeakMap<"u"){let t=new WeakMap;rv=e=>t.get(e),sv=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;rv=r=>{for(let s=0;s<t.length;s+=2)if(t[s]==r)return t[s+1]},sv=(r,s)=>(n==10&&(n=0),t[n++]=r,t[n++]=s)}var cs=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,s=e/this.width|0;let i=r+1,o=s+1;for(let l=1;i<this.width&&this.map[e+l]==n;l++)i++;for(let l=1;o<this.height&&this.map[e+this.width*l]==n;l++)o++;return{left:r,top:s,right:i,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:s,top:i,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:s==this.width)?null:this.map[i*this.width+(n<0?r-1:s)]:(n<0?i==0:o==this.height)?null:this.map[r+this.width*(n<0?i-1:o)]}rectBetween(t,e){const{left:n,right:r,top:s,bottom:i}=this.findCell(t),{left:o,right:l,top:a,bottom:u}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(s,a),right:Math.max(r,l),bottom:Math.max(i,u)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let s=t.left;s<t.right;s++){const i=r*this.width+s,o=this.map[i];n[o]||(n[o]=!0,!(s==t.left&&s&&this.map[i-1]==o||r==t.top&&r&&this.map[i-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,s=0;;r++){const i=s+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const l=(t+1)*this.width;for(;o<l&&this.map[o]<s;)o++;return o==l?i-1:this.map[o]}s=i}}static get(t){return rv(t)||sv(t,P6(t))}};function P6(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=I6(t),n=t.childCount,r=[];let s=0,i=null;const o=[];for(let u=0,c=e*n;u<c;u++)r[u]=0;for(let u=0,c=0;u<n;u++){const d=t.child(u);c++;for(let p=0;;p++){for(;s<r.length&&r[s]!=0;)s++;if(p==d.childCount)break;const m=d.child(p),{colspan:y,rowspan:g,colwidth:x}=m.attrs;for(let k=0;k<g;k++){if(k+u>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:c,n:g-k});break}const b=s+k*e;for(let S=0;S<y;S++){r[b+S]==0?r[b+S]=c:(i||(i=[])).push({type:"collision",row:u,pos:c,n:y-S});const C=x&&x[S];if(C){const E=(b+S)%e*2,T=o[E];T==null||T!=C&&o[E+1]==1?(o[E]=C,o[E+1]=1):T==C&&o[E+1]++}}}s+=y,c+=m.nodeSize}const f=(u+1)*e;let h=0;for(;s<f;)r[s++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:u,n:h}),c++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new cs(e,n,r,i);let a=!1;for(let u=0;!a&&u<o.length;u+=2)o[u]!=null&&o[u+1]<n&&(a=!0);return a&&D6(l,o,t),l}function I6(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const s=t.child(r);let i=0;if(n)for(let o=0;o<r;o++){const l=t.child(o);for(let a=0;a<l.childCount;a++){const u=l.child(a);o+u.attrs.rowspan>r&&(i+=u.attrs.colspan)}}for(let o=0;o<s.childCount;o++){const l=s.child(o);i+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function D6(t,e,n){t.problems||(t.problems=[]);const r={};for(let s=0;s<t.map.length;s++){const i=t.map[s];if(r[i])continue;r[i]=!0;const o=n.nodeAt(i);if(!o)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=o.attrs;for(let u=0;u<a.colspan;u++){const c=e[(s+u)%t.width*2];c!=null&&(!a.colwidth||a.colwidth[u]!=c)&&((l||(l=L6(a)))[u]=c)}l&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function L6(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function bx(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],s=r.spec.tableRole;s&&(e[s]=r)}}return e}new rt("selectingCells");function j6(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 QO(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 $6(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=j6(e.$head)||z6(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function z6(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 cS(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function ZO(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function YO(t,e,n){const r=t.node(-1),s=cs.get(r),i=t.start(-1),o=s.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function dS(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(s=>s>0)||(r.colwidth=null)),r}var Vr=class ns extends me{constructor(e,n=e){const r=e.node(-1),s=cs.get(r),i=e.start(-1),o=s.rectBetween(e.pos-i,n.pos-i),l=e.node(0),a=s.cellsInRect(o).filter(c=>c!=n.pos-i);a.unshift(n.pos-i);const u=a.map(c=>{const d=r.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const f=i+c+1;return new ZM(l.resolve(f),l.resolve(f+d.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),s=e.resolve(n.map(this.$headCell.pos));if(cS(r)&&cS(s)&&ZO(r,s)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ns.rowSelection(r,s):i&&this.isColSelection()?ns.colSelection(r,s):new ns(r,s)}return ge.between(r,s)}content(){const e=this.$anchorCell.node(-1),n=cs.get(e),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let a=s.top;a<s.bottom;a++){const u=[];for(let c=a*n.width+s.left,d=s.left;d<s.right;d++,c++){const f=n.map[c];if(i[f])continue;i[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const m=s.left-h.left,y=h.right-s.right;if(m>0||y>0){let g=p.attrs;if(m>0&&(g=dS(g,0,m)),y>0&&(g=dS(g,g.colspan-y,y)),h.left<s.left){if(p=p.type.createAndFill(g),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(g)}`)}else p=p.type.create(g,p.content)}if(h.top<s.top||h.bottom>s.bottom){const g={...p.attrs,rowspan:Math.min(h.bottom,s.bottom)-Math.max(h.top,s.top)};h.top<s.top?p=p.type.createAndFill(g):p=p.type.create(g,p.content)}u.push(p)}o.push(e.child(a).copy(D.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new U(D.from(l),1,1)}replace(e,n=U.empty){const r=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){const{$from:l,$to:a}=s[o],u=e.mapping.slice(r);e.replace(u.map(l.pos),u.map(a.pos),o?U.empty:n)}const i=me.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new U(D.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=cs.get(n),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)e(n.nodeAt(i[o]),s+i[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),s=cs.get(r),i=e.start(-1),o=s.findCell(e.pos-i),l=s.findCell(n.pos-i),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(i+s.map[o.left])),l.bottom<s.height&&(n=a.resolve(i+s.map[s.width*(s.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(i+s.map[l.left])),o.bottom<s.height&&(e=a.resolve(i+s.map[s.width*(s.height-1)+o.right-1]))),new ns(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=cs.get(e),r=this.$anchorCell.start(-1),s=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(s,i)>0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==n.width}eq(e){return e instanceof ns&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),s=cs.get(r),i=e.start(-1),o=s.findCell(e.pos-i),l=s.findCell(n.pos-i),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(i+s.map[o.top*s.width])),l.right<s.width&&(n=a.resolve(i+s.map[s.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(i+s.map[l.top*s.width])),o.right<s.width&&(e=a.resolve(i+s.map[s.width*(o.top+1)-1]))),new ns(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new ns(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new ns(e.resolve(n),e.resolve(r))}getBookmark(){return new F6(this.$anchorCell.pos,this.$headCell.pos)}};Vr.prototype.visible=!1;me.jsonID("cell",Vr);var F6=class XO{constructor(e,n){this.anchor=e,this.head=n}map(e){return new XO(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&&ZO(n,r)?new Vr(n,r):me.near(r,1)}};new rt("fix-tables");function eA(t){const e=t.selection,n=$6(t),r=n.node(-1),s=n.start(-1),i=cs.get(r);return{...e instanceof Vr?i.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):i.findCell(n.pos-s),tableStart:s,map:i,table:r}}function B6(t){return function(e,n){if(!QO(e))return!1;if(n){const r=bx(e.schema),s=eA(e),i=e.tr,o=s.map.cellsInRect(t=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:t=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),l=o.map(a=>s.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[a],r.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<o.length;a++)i.setNodeMarkup(s.tableStart+o[a],r.header_cell,l[a].attrs);n(i)}return!0}}function fS(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 s=0;s<r.length;s++){const i=e.table.nodeAt(r[s]);if(i&&i.type!==n.header_cell)return!1}return!0}function Sx(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?B6(t):function(n,r){if(!QO(n))return!1;if(r){const s=bx(n.schema),i=eA(n),o=n.tr,l=fS("row",i,s),a=fS("column",i,s),u=(t==="column"?l:t==="row"&&a)?1:0,c=t=="column"?{left:0,top:u,right:1,bottom:i.map.height}:t=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,d=t=="column"?a?s.cell:s.header_cell:t=="row"?l?s.cell:s.header_cell:s.cell;i.map.cellsInRect(c).forEach(f=>{const h=f+i.tableStart,p=o.doc.nodeAt(h);p&&o.setNodeMarkup(h,d,p.attrs)}),r(o)}return!0}}Sx("row",{useDeprecatedLogic:!0});Sx("column",{useDeprecatedLogic:!0});Sx("cell",{useDeprecatedLogic:!0});function md(t,e){const n=t.selection;if(!(n instanceof Vr))return!1;if(e){const r=t.tr,s=bx(t.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new U(s,0,0))}),r.docChanged&&e(r)}return!0}sx({ArrowLeft:gd("horiz",-1),ArrowRight:gd("horiz",1),ArrowUp:gd("vert",-1),ArrowDown:gd("vert",1),"Shift-ArrowLeft":yd("horiz",-1),"Shift-ArrowRight":yd("horiz",1),"Shift-ArrowUp":yd("vert",-1),"Shift-ArrowDown":yd("vert",1),Backspace:md,"Mod-Backspace":md,Delete:md,"Mod-Delete":md});function qd(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function gd(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;if(i instanceof Vr)return qd(n,r,me.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=tA(s,t,e);if(o==null)return!1;if(t=="horiz")return qd(n,r,me.near(n.doc.resolve(i.head+e),e));{const l=n.doc.resolve(o),a=YO(l,t,e);let u;return a?u=me.near(a,1):e<0?u=me.near(n.doc.resolve(l.before(-1)),-1):u=me.near(n.doc.resolve(l.after(-1)),1),qd(n,r,u)}}}function yd(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;let o;if(i instanceof Vr)o=i;else{const a=tA(s,t,e);if(a==null)return!1;o=new Vr(n.doc.resolve(a))}const l=YO(o.$headCell,t,e);return l?qd(n,r,new Vr(o.$anchorCell,l)):!1}}function tA(t,e,n){if(!(t.state.selection instanceof ge))return null;const{$head:r}=t.state.selection;for(let s=r.depth-1;s>=0;s--){const i=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const o=r.before(s),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?o:null}}return null}new rt("tableColumnResizing");function V6(t,e){const n=Math.min(t.top,e.top),r=Math.max(t.bottom,e.bottom),s=Math.min(t.left,e.left),o=Math.max(t.right,e.right)-s,l=r-n,a=s,u=n;return new DOMRect(a,u,o,l)}var H6=class{constructor({editor:t,element:e,view:n,updateDelay:r=250,resizeDelay:s=60,shouldShow:i,appendTo:o,getReferencedVirtualElement:l,options:a}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:c,state:d,from:f,to:h})=>{const{doc:p,selection:m}=d,{empty:y}=m,g=!p.textBetween(f,h).length&&ax(d.selection),x=this.element.contains(document.activeElement);return!(!(c.hasFocus()||x)||y||g||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:c})=>{var d;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}c!=null&&c.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(c.relatedTarget))||(c==null?void 0:c.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(c,d)=>{const f=!(d!=null&&d.selection.eq(c.state.selection)),h=!(d!=null&&d.doc.eq(c.state.doc));!f&&!h||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(c,f,h,d)},this.updateDelay))},this.updateHandler=(c,d,f,h)=>{const{composing:p}=c;if(p||!d&&!f)return;if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:c})=>{const d=c.getMeta("bubbleMenu");d==="updatePosition"?this.updatePosition():d&&typeof d=="object"&&d.type==="updateOptions"&&this.updateOptions(d.options)};var u;this.editor=t,this.element=e,this.view=n,this.updateDelay=r,this.resizeDelay=s,this.appendTo=o,this.scrollTarget=(u=a==null?void 0:a.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(UO(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(HO(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(BO(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(GO(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(WO(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(VO(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(qO(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(KO(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}get virtualElement(){var t,e,n;const{selection:r}=this.editor.state,s=(t=this.getReferencedVirtualElement)==null?void 0:t.call(this);if(s)return s;if(!((n=(e=this.view)==null?void 0:e.dom)!=null&&n.parentNode))return;const i=uO(this.view,r.from,r.to);let o={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(r instanceof ue){let l=this.view.nodeDOM(r.from);const a=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");a&&(l=a),l&&(o={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(r instanceof Vr){const{$anchorCell:l,$headCell:a}=r,u=l?l.pos:a.pos,c=a?a.pos:l.pos,d=this.view.nodeDOM(u),f=this.view.nodeDOM(c);if(!d||!f)return;const h=d===f?d.getBoundingClientRect():V6(d.getBoundingClientRect(),f.getBoundingClientRect());o={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return o}updatePosition(){const t=this.virtualElement;t&&JO(t,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:n,strategy:r,middlewareData:s})=>{var i,o;if((i=s.hide)!=null&&i.referenceHidden||(o=s.hide)!=null&&o.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${e}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const{state:n}=t,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(t,e);return}const s=!(e!=null&&e.selection.eq(t.state.selection)),i=!(e!=null&&e.doc.eq(t.state.doc));this.updateHandler(t,s,i,e)}getShouldShow(t){var e;const{state:n}=this.view,{selection:r}=n,{ranges:s}=r,i=Math.min(...s.map(a=>a.$from.pos)),o=Math.max(...s.map(a=>a.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:t,from:i,to:o}))||!1}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=e??this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(t){var e;if(t.updateDelay!==void 0&&(this.updateDelay=t.updateDelay),t.resizeDelay!==void 0&&(this.resizeDelay=t.resizeDelay),t.appendTo!==void 0&&(this.appendTo=t.appendTo),t.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=t.getReferencedVirtualElement),t.shouldShow!==void 0&&t.shouldShow&&(this.shouldShow=t.shouldShow),t.options!==void 0){const n=(e=t.options.scrollTarget)!=null?e:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...t.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Cx=t=>new tt({key:typeof t.pluginKey=="string"?new rt(t.pluginKey):t.pluginKey,view:e=>new H6({view:e,...t})});st.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Cx({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var U6=class{constructor({editor:t,element:e,view:n,updateDelay:r=250,resizeDelay:s=60,options:i,appendTo:o,shouldShow:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:c})=>{const{selection:d}=c,{$anchor:f,empty:h}=d,p=f.depth===1,m=f.parent.isTextblock&&!f.parent.type.spec.code&&!f.parent.textContent&&f.parent.childCount===0&&!this.getTextContent(f.parent);return!(!u.hasFocus()||!h||!p||!m||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,c,d,f)=>{const{composing:h}=u;if(h||!c&&!d)return;if(!this.getShouldShow(f)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var c;if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&((c=this.element.parentNode)!=null&&c.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const c=u.getMeta("floatingMenu");c==="updatePosition"?this.updatePosition():c&&typeof c=="object"&&c.type==="updateOptions"&&this.updateOptions(c.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var a;this.editor=t,this.element=e,this.view=n,this.updateDelay=r,this.resizeDelay=s,this.appendTo=o,this.scrollTarget=(a=i==null?void 0:i.scrollTarget)!=null?a:window,this.floatingUIOptions={...this.floatingUIOptions,...i},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(t){return rO(t,{textSerializers:dx(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(UO(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(HO(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(BO(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(GO(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(WO(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(VO(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(qO(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(KO(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}getShouldShow(t){var e;const{state:n}=this.view,{selection:r}=n,{ranges:s}=r,i=Math.min(...s.map(a=>a.$from.pos)),o=Math.max(...s.map(a=>a.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:n,oldState:t,from:i,to:o})}updateOptions(t){var e;if(t.updateDelay!==void 0&&(this.updateDelay=t.updateDelay),t.resizeDelay!==void 0&&(this.resizeDelay=t.resizeDelay),t.appendTo!==void 0&&(this.appendTo=t.appendTo),t.shouldShow!==void 0&&t.shouldShow&&(this.shouldShow=t.shouldShow),t.options!==void 0){const n=(e=t.options.scrollTarget)!=null?e:window;n!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=n,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...t.options}}}updatePosition(){const{selection:t}=this.editor.state,e=uO(this.view,t.from,t.to);JO({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:r,y:s,strategy:i,middlewareData:o})=>{var l,a;if((l=o.hide)!=null&&l.referenceHidden||(a=o.hide)!=null&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${r}px`,this.element.style.top=`${s}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const n=!(e!=null&&e.selection.eq(t.state.selection)),r=!(e!=null&&e.doc.eq(t.state.doc));this.updateHandler(t,n,r,e)}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=e??this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Ex=t=>new tt({key:typeof t.pluginKey=="string"?new rt(t.pluginKey):t.pluginKey,view:e=>new U6({view:e,...t})});st.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:t,dispatch:e})=>(e&&t.setMeta("floatingMenu","updatePosition"),!0)}},addProseMirrorPlugins(){return this.options.element?[Ex({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var W6=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},q6=({contentComponent:t})=>{const e=z0.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return w.jsx(w.Fragment,{children:Object.values(e)})};function G6(){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]:uT.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var K6=class extends Yn.Component{constructor(t){var e;super(t),this.editorContentRef=Yn.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=G6(),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(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return w.jsxs(w.Fragment,{children:[w.jsx("div",{ref:W6(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&w.jsx(q6,{contentComponent:t.contentComponent})]})}},J6=v.forwardRef((t,e)=>{const n=Yn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Yn.createElement(K6,{key:n,innerRef:e,...t})}),nA=Yn.memo(J6),Q6=typeof window<"u"?v.useLayoutEffect:v.useEffect,Z6=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,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(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function Y6(t){var e;const[n]=v.useState(()=>new Z6(t.editor)),r=z5.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:O5);return Q6(()=>n.watch(t.editor),[t.editor,n]),v.useDebugValue(r),r}var X6=!1,iv=typeof window>"u",eW=iv||!!(typeof window<"u"&&window.next),tW=class rA{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?iv||eW?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new LU(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((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?rA.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,s)=>r===e[s]))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 nW(t={},e=[]){const n=v.useRef(t);n.current=t;const[r]=v.useState(()=>new tW(n)),s=z0.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return v.useDebugValue(s),v.useEffect(r.onRender(e)),Y6({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var Tx=v.createContext({editor:null});Tx.Consumer;var bp=()=>v.useContext(Tx),rW=v.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),sW=()=>v.useContext(rW);Yn.forwardRef((t,e)=>{const{onDragStart:n}=sW(),r=t.as||"div";return w.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});Yn.createContext({markViewContentRef:()=>{}});var iW=Yn.forwardRef(({pluginKey:t="bubbleMenu",editor:e,updateDelay:n,resizeDelay:r,appendTo:s,shouldShow:i=null,getReferencedVirtualElement:o,options:l,children:a,...u},c)=>{const d=v.useRef(document.createElement("div"));typeof c=="function"?c(d.current):c&&(c.current=d.current);const{editor:f}=bp(),h=e||f,p={updateDelay:n,resizeDelay:r,appendTo:s,pluginKey:t,shouldShow:i,getReferencedVirtualElement:o,options:l},m=v.useRef(p);m.current=p;const[y,g]=v.useState(!1),x=v.useRef(!0);return v.useEffect(()=>{if(h!=null&&h.isDestroyed)return;if(!h){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const k=d.current;k.style.visibility="hidden",k.style.position="absolute";const b=Cx({...m.current,editor:h,element:k});h.registerPlugin(b);const S=m.current.pluginKey;return x.current=!0,g(!0),()=>{g(!1),h.unregisterPlugin(S),window.requestAnimationFrame(()=>{k.parentNode&&k.parentNode.removeChild(k)})}},[h]),v.useEffect(()=>{if(!(!y||!h||h.isDestroyed)){if(x.current){x.current=!1;return}h.view.dispatch(h.state.tr.setMeta("bubbleMenu",{type:"updateOptions",options:m.current}))}},[y,h,n,r,i,l,s,o]),$o.createPortal(w.jsx("div",{...u,children:a}),d.current)}),oW=Yn.forwardRef(({pluginKey:t="floatingMenu",editor:e,updateDelay:n,resizeDelay:r,appendTo:s,shouldShow:i=null,options:o,children:l,...a},u)=>{const c=v.useRef(document.createElement("div"));typeof u=="function"?u(c.current):u&&(u.current=c.current);const{editor:d}=bp(),f=e||d,h={updateDelay:n,resizeDelay:r,appendTo:s,pluginKey:t,shouldShow:i,options:o},p=v.useRef(h);p.current=h;const[m,y]=v.useState(!1),g=v.useRef(!0);return v.useEffect(()=>{if(f!=null&&f.isDestroyed)return;if(!f){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const x=c.current;x.style.visibility="hidden",x.style.position="absolute";const k=Ex({...p.current,editor:f,element:x});f.registerPlugin(k);const b=p.current.pluginKey;return g.current=!0,y(!0),()=>{y(!1),f.unregisterPlugin(b),window.requestAnimationFrame(()=>{x.parentNode&&x.parentNode.removeChild(x)})}},[f]),v.useEffect(()=>{if(!(!m||!f||f.isDestroyed)){if(g.current){g.current=!1;return}f.view.dispatch(f.state.tr.setMeta("floatingMenu",{type:"updateOptions",options:p.current}))}},[m,f,n,r,i,o,s]),$o.createPortal(w.jsx("div",{...a,children:l}),c.current)}),Rx=v.createContext({editor:null,isReady:!1});Rx.displayName="TiptapContext";var Sp=()=>v.useContext(Rx);function sA({instance:t,children:e}){var n;const[r,s]=v.useState((n=t==null?void 0:t.isInitialized)!=null?n:!1);v.useEffect(()=>{if(!t){s(!1);return}if(t.isInitialized){s(!0);return}const l=()=>{s(!0)};return t.on("create",l),()=>{t.off("create",l)}},[t]);const i=v.useMemo(()=>({editor:t,isReady:r}),[t,r]),o=v.useMemo(()=>({editor:t}),[t]);return w.jsx(Tx.Provider,{value:o,children:w.jsx(Rx.Provider,{value:i,children:e})})}sA.displayName="Tiptap";function iA({...t}){const{editor:e}=Sp();return w.jsx(nA,{editor:e,...t})}iA.displayName="Tiptap.Content";function oA({children:t}){const{isReady:e}=Sp();return e?null:t}oA.displayName="Tiptap.Loading";function lA({children:t,...e}){const{editor:n}=Sp();return n?w.jsx(iW,{editor:n,...e,children:t}):null}lA.displayName="Tiptap.BubbleMenu";function aA({children:t,...e}){const{editor:n}=Sp();return n?w.jsx(oW,{...e,editor:n,children:t}):null}aA.displayName="Tiptap.FloatingMenu";var lW=Object.assign(sA,{Content:iA,Loading:oA,BubbleMenu:lA,FloatingMenu:aA}),aW=Yn.forwardRef(({pluginKey:t="bubbleMenu",editor:e,updateDelay:n,resizeDelay:r,appendTo:s,shouldShow:i=null,getReferencedVirtualElement:o,options:l,children:a,...u},c)=>{const d=v.useRef(document.createElement("div"));typeof c=="function"?c(d.current):c&&(c.current=d.current);const{editor:f}=bp(),h=e||f,p={updateDelay:n,resizeDelay:r,appendTo:s,pluginKey:t,shouldShow:i,getReferencedVirtualElement:o,options:l},m=v.useRef(p);m.current=p;const[y,g]=v.useState(!1),x=v.useRef(!0);return v.useEffect(()=>{if(h!=null&&h.isDestroyed)return;if(!h){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const k=d.current;k.style.visibility="hidden",k.style.position="absolute";const b=Cx({...m.current,editor:h,element:k});h.registerPlugin(b);const S=m.current.pluginKey;return x.current=!0,g(!0),()=>{g(!1),h.unregisterPlugin(S),window.requestAnimationFrame(()=>{k.parentNode&&k.parentNode.removeChild(k)})}},[h]),v.useEffect(()=>{if(!(!y||!h||h.isDestroyed)){if(x.current){x.current=!1;return}h.view.dispatch(h.state.tr.setMeta("bubbleMenu",{type:"updateOptions",options:m.current}))}},[y,h,n,r,i,l,s,o]),$o.createPortal(w.jsx("div",{...u,children:a}),d.current)});Yn.forwardRef(({pluginKey:t="floatingMenu",editor:e,updateDelay:n,resizeDelay:r,appendTo:s,shouldShow:i=null,options:o,children:l,...a},u)=>{const c=v.useRef(document.createElement("div"));typeof u=="function"?u(c.current):u&&(u.current=c.current);const{editor:d}=bp(),f=e||d,h={updateDelay:n,resizeDelay:r,appendTo:s,pluginKey:t,shouldShow:i,options:o},p=v.useRef(h);p.current=h;const[m,y]=v.useState(!1),g=v.useRef(!0);return v.useEffect(()=>{if(f!=null&&f.isDestroyed)return;if(!f){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const x=c.current;x.style.visibility="hidden",x.style.position="absolute";const k=Ex({...p.current,editor:f,element:x});f.registerPlugin(k);const b=p.current.pluginKey;return g.current=!0,y(!0),()=>{y(!1),f.unregisterPlugin(b),window.requestAnimationFrame(()=>{x.parentNode&&x.parentNode.removeChild(x)})}},[f]),v.useEffect(()=>{if(!(!m||!f||f.isDestroyed)){if(g.current){g.current=!1;return}f.view.dispatch(f.state.tr.setMeta("floatingMenu",{type:"updateOptions",options:p.current}))}},[m,f,n,r,i,o,s]),$o.createPortal(w.jsx("div",{...a,children:l}),c.current)});const or=t=>`tiptap-bubble-button${t?" is-active":""}`;function uW({editor:t}){const e=v.useCallback(()=>{const n=t.getAttributes("link").href,r=window.prompt("Enter URL",n??"");if(r===null)return;const s=r.trim();if(!s){t.chain().focus().extendMarkRange("link").unsetLink().run();return}t.chain().focus().extendMarkRange("link").setLink({href:s}).run()},[t]);return w.jsxs(aW,{editor:t,options:{offset:8},shouldShow:({editor:n,state:r})=>{if(!n.isEditable)return!1;const{empty:s}=r.selection;return!s||n.isActive("link")},className:"tiptap-bubble-menu",children:[w.jsx("button",{type:"button",className:or(t.isActive("bold")),onClick:()=>t.chain().focus().toggleBold().run(),"aria-label":"Toggle bold",children:w.jsx(IL,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:or(t.isActive("italic")),onClick:()=>t.chain().focus().toggleItalic().run(),"aria-label":"Toggle italic",children:w.jsx(lj,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:or(t.isActive("strike")),onClick:()=>t.chain().focus().toggleStrike().run(),"aria-label":"Toggle strikethrough",children:w.jsx(bj,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:or(t.isActive("code")),onClick:()=>t.chain().focus().toggleCode().run(),"aria-label":"Toggle inline code",children:w.jsx(UL,{className:"h-4 w-4"})}),w.jsx("span",{className:"tiptap-bubble-separator","aria-hidden":"true"}),w.jsx("button",{type:"button",className:or(t.isActive("heading",{level:2})),onClick:()=>t.chain().focus().toggleHeading({level:2}).run(),"aria-label":"Toggle heading level 2",children:w.jsx(nj,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:or(t.isActive("heading",{level:3})),onClick:()=>t.chain().focus().toggleHeading({level:3}).run(),"aria-label":"Toggle heading level 3",children:w.jsx(sj,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:or(t.isActive("bulletList")),onClick:()=>t.chain().focus().toggleBulletList().run(),"aria-label":"Toggle bullet list",children:w.jsx(hj,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:or(t.isActive("orderedList")),onClick:()=>t.chain().focus().toggleOrderedList().run(),"aria-label":"Toggle ordered list",children:w.jsx(dj,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:or(t.isActive("blockquote")),onClick:()=>t.chain().focus().toggleBlockquote().run(),"aria-label":"Toggle blockquote",children:w.jsx(xj,{className:"h-4 w-4"})}),w.jsx("span",{className:"tiptap-bubble-separator","aria-hidden":"true"}),w.jsx("button",{type:"button",className:or(t.isActive("link")),onClick:e,"aria-label":"Add or edit link",children:w.jsx(uj,{className:"h-4 w-4"})}),w.jsx("button",{type:"button",className:or(),onClick:()=>t.chain().focus().extendMarkRange("link").unsetLink().run(),"aria-label":"Remove link",disabled:!t.isActive("link"),children:w.jsx(Tj,{className:"h-4 w-4"})})]})}function cW(t){const{editor:e}=t;return w.jsx("div",{className:"min-h-0 flex-1",children:w.jsxs(lW,{instance:e,children:[e?w.jsx(uW,{editor:e}):null,w.jsx(nA,{editor:e,className:"tiptap-editor tiptap-content h-full"})]})})}const uA=t=>{var e;(e=t.openCreateDialog)==null||e.call(t,"markdown")},cA=t=>{var e;(e=t.openCreateDialog)==null||e.call(t,"json")},dA=t=>{var e;(e=t.openCreateDialog)==null||e.call(t,"app")},ov=async t=>{var e;t.activeDoc&&await((e=t.toggleDocPinned)==null?void 0:e.call(t,t.activeDoc))},lv=async t=>{var e;t.activeDoc&&await((e=t.archiveDoc)==null?void 0:e.call(t,t.activeDoc))},av=async t=>{var e;t.activeDoc&&await((e=t.deleteDoc)==null?void 0:e.call(t,t.activeDoc))},dW=()=>[{id:"doc.create.markdown",label:"Create markdown document",scope:"global",keywords:["new","create","markdown","doc"],run:uA},{id:"doc.create.json",label:"Create JSON document",scope:"global",keywords:["new","create","json","table","doc"],run:cA},{id:"doc.create.app",label:"Create React app document",scope:"global",keywords:["new","create","app","react","bundle","doc"],run:dA},{id:"doc.pin",label:"Pin document",scope:"doc",keywords:["pin","document","info"],run:ov},{id:"doc.archive",label:"Archive document",scope:"doc",keywords:["archive","document","info"],run:lv},{id:"doc.delete",label:"Delete document",scope:"doc",keywords:["delete","remove","document","info"],run:av}],fW=t=>t instanceof HTMLElement?!!t.closest("[data-command-palette-ignore]"):!1,hW=()=>{const[t,e]=v.useState(!1);return v.useEffect(()=>{const n=r=>{r.key.toLowerCase()==="k"&&(!r.metaKey&&!r.ctrlKey||fW(r.target)||(r.preventDefault(),e(s=>!s)))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[]),{open:t,setOpen:e}},pW=({active:t,isDirty:e,conflict:n,lastEditAt:r,autosave:s,autosaveTimeoutRef:i,saveStatusStartRef:o,setSaveStatus:l,tagsEqual:a,headerTags:u,activeTags:c,save:d})=>{v.useEffect(()=>{if(!t||!e||n||!r)return;const f=350;return i.current&&clearTimeout(i.current),l("saving"),o.current=Date.now(),i.current=setTimeout(()=>{s().catch(()=>{}),i.current=null},f),()=>{i.current&&(clearTimeout(i.current),i.current=null)}},[t,s,i,n,e,r,o,l]),v.useEffect(()=>{if(!t)return;!a(u,c)&&d().catch(()=>{})},[t,c,u,d,a])},mW=({docs:t,active:e,setActive:n,status:r,setStatus:s})=>{const i=vT(),o=x0(),l=v.useCallback(d=>d.split("/").map(f=>decodeURIComponent(f)).join("/"),[]),a=v.useCallback(d=>d.split("/").map(f=>encodeURIComponent(f)).join("/"),[]),u=o.pathname.replace(/^\/+/,""),c=u?l(u):"";return v.useEffect(()=>{if(!c||(e==null?void 0:e.name)===c)return;const d=t.find(f=>f.name===c);if(!d){r!==`Doc not found: ${c}`&&s(`Doc not found: ${c}`);return}r&&s(""),n(d)},[e==null?void 0:e.name,c,t,n,s,r]),v.useEffect(()=>{if(c||t.length===0)return;const d=t[0];i(`/${a(d.name)}`,{replace:!0})},[c,t,a,i]),{encodePath:a,decodePath:l,currentPathDoc:c}},gW=({open:t,onClose:e})=>{v.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n)}},[e,t])},yW=/^\uFEFF?\s*<!--\s*hyperdoc:([A-Za-z0-9+/=]+)\s*-->\s*(?:\r?\n|$)/i,vW=/^\uFEFF?\s*<!--\s*hyperdoc:[A-Za-z0-9+/=]+\s*-->\s*(?:\r?\n|$)/i,xW=/^\s*<!--\s*title:\s*.+?\s*-->\s*(?:\r?\n|$)/i,wW=t=>t.replace(/^\uFEFF/,""),kW=t=>{if(!t)return t;const e=t.match(/^\s*(?:\r?\n)/);return e?t.slice(e[0].length):t},bW=qn({bundleUrl:nn().trim().min(1).optional(),bundlePath:nn().trim().min(1).optional(),mountId:nn().trim().min(1),bundleType:pM(["module","classic"]).optional(),metadata:qn({tags:ra(nn()).optional(),pinned:Vd().optional()}).optional()}).passthrough().superRefine((t,e)=>{!t.bundleUrl&&!t.bundlePath&&e.addIssue({code:B.custom,message:"Provide bundleUrl or bundlePath."})}),SW=t=>{try{const e=atob(t),n=Uint8Array.from(e,r=>r.charCodeAt(0));return new TextDecoder().decode(n)}catch{return null}},CW=t=>{const e=new TextEncoder().encode(t);let n="";return e.forEach(r=>{n+=String.fromCharCode(r)}),btoa(n)},EW=t=>{const e=t.match(yW);if(!e)return null;const n=SW(e[1]);if(!n)return null;try{const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return null;const s=typeof r.title=="string"?r.title:null,i=Array.isArray(r.tags)?r.tags.filter(l=>typeof l=="string"):[],o=r.pinned===!0;return{title:s,tags:i,pinned:o}}catch{return null}},TW=t=>{let e="",n=!1,r=!1,s=!1,i=!1;for(let o=0;o<t.length;o+=1){const l=t[o],a=t[o+1];if(s){l===`
443
- `&&(s=!1,e+=l);continue}if(i){l==="*"&&a==="/"&&(i=!1,o+=1);continue}if(n){if(e+=l,r){r=!1;continue}if(l==="\\"){r=!0;continue}l==='"'&&(n=!1);continue}if(l==='"'){n=!0,e+=l;continue}if(l==="/"&&a==="/"){s=!0,o+=1;continue}if(l==="/"&&a==="*"){i=!0,o+=1;continue}e+=l}return e},RW=t=>{let e="",n=!1,r=!1;for(let s=0;s<t.length;s+=1){const i=t[s];if(n){if(e+=i,r){r=!1;continue}if(i==="\\"){r=!0;continue}i==='"'&&(n=!1);continue}if(i==='"'){n=!0,e+=i;continue}if(i===","){let o=s+1;for(;o<t.length&&/\s/.test(t[o]);)o+=1;if(t[o]==="}"||t[o]==="]")continue}e+=i}return e},Mx=t=>{const e=t.replace(/^\uFEFF/,"");try{const n=JSON.parse(e);return!n||typeof n!="object"||Array.isArray(n)?null:n}catch{try{const n=RW(TW(e)),r=JSON.parse(n);return!r||typeof r!="object"||Array.isArray(r)?null:r}catch{return null}}},fA=t=>{const e=Mx(t);if(!e)return null;const n=e.metadata;if(!n||typeof n!="object"||Array.isArray(n))return{tags:[]};const r=n,s=Array.isArray(r.tags)?r.tags.filter(o=>typeof o=="string"):[],i=r.pinned===!0;return{tags:s,pinned:i}},MW=t=>{const e=Mx(t);if(!e)return{config:null,error:"Invalid JSON."};const n=bW.safeParse(e);return n.success?{config:{bundleUrl:n.data.bundleUrl??n.data.bundlePath??"",mountId:n.data.mountId,bundleType:n.data.bundleType,metadata:n.data.metadata},error:null}:{config:null,error:n.error.issues.map(i=>i.message).join(" ")||"Invalid app config."}},NW=(t,e)=>{var n,r;return e==="markdown"?((n=EW(t))==null?void 0:n.tags)??[]:e==="json"||e==="app"?((r=fA(t))==null?void 0:r.tags)??[]:[]},hA=t=>{const e=JSON.stringify({v:1,title:t.title,tags:t.tags,...t.pinned?{pinned:!0}:{}});return`<!-- hyperdoc:${CW(e)} -->
444
-
445
- `},OW=t=>{let e=t.replace(/^\uFEFF/,""),n="";for(;e!==n;)n=e,e=e.replace(vW,"").replace(xW,"");return kW(e)},Qm=(t,e,n)=>{if(e==="markdown"){const r=wW(OW(t));return`${hA({title:null,tags:n.tags,pinned:n.pinned})}${r}`}if(e==="json"||e==="app"){const r=Mx(t);if(!r)return null;const s=r.metadata,i=s&&typeof s=="object"&&!Array.isArray(s)?{...s}:{};n.tags.length>0?i.tags=n.tags:delete i.tags,n.pinned?i.pinned=!0:delete i.pinned;const o={...r};return Object.keys(i).length>0?o.metadata=i:delete o.metadata,JSON.stringify(o,null,2)}return t};function AW(t,e){return v.useMemo(()=>{if(!t||t.type!=="app")return{config:null,error:""};const n=MW(e);return{config:n.config,error:n.error??""}},[t,e])}const _W=t=>!t||!t.id?[]:[{id:t.id,desc:!!t.desc}],PW=t=>t?[t]:[],IW=t=>Array.isArray(t)?t.filter(e=>typeof e=="string"):[],DW=t=>!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([,e])=>typeof e=="boolean")),eu=(t,e)=>{if(!t||!e)return!1;const n=t.sorting[0],r=e.sorting[0];if(!!n!=!!r||n&&r&&(n.id!==r.id||!!n.desc!=!!r.desc))return!1;const s=t.grouping[0]??"",i=e.grouping[0]??"";if(s!==i||t.columnOrder.length!==e.columnOrder.length||t.columnOrder.some((a,u)=>a!==e.columnOrder[u]))return!1;const o=Object.keys(t.columnVisibility).sort(),l=Object.keys(e.columnVisibility).sort();if(o.length!==l.length)return!1;for(let a=0;a<o.length;a+=1){const u=o[a];if(u!==l[a]||t.columnVisibility[u]!==e.columnVisibility[u])return!1}return!0},hS=t=>{const e=o=>{try{return JSON.parse(o)}catch{return null}},n=e(t);if(!n)return{error:"Invalid JSON",payload:null,format:"object"};let r=n,s="object";if(Array.isArray(n))s="array",r={data:n};else if(typeof n=="object"&&n!==null){const o=n;if(typeof o.content=="string"){const l=e(o.content);Array.isArray(l)?(s="array",r={data:l}):typeof l=="object"&&l!==null&&(s="object",r=l)}}else return{error:"JSON must be an object or array.",payload:null,format:s};const i=O3.safeParse(r);return i.success?{error:null,payload:i.data,format:s}:{error:"JSON must be an object or array.",payload:null,format:s}},LW=({active:t,content:e,lastSaved:n,headerTags:r,setContent:s,setIsDirty:i,setLastEditAt:o,writeDoc:l})=>{const[a,u]=v.useState(null),[c,d]=v.useState(null),[f,h]=v.useState(null),[p,m]=v.useState(null),[y,g]=v.useState("table"),[x,k]=v.useState(""),[b,S]=v.useState(""),[C,E]=v.useState({columns:[{id:"name",name:"Name",type:"text"}]}),T=v.useRef(null),N=v.useRef(null),O=v.useRef(null),H=v.useRef(null),ne=v.useRef(null),ae=v.useRef("object"),Q=v.useRef(!1),le=v.useRef(null);v.useEffect(()=>{!t||t.type!=="json"||g("table")},[t]),v.useEffect(()=>{var Kr;if(!t||t.type!=="json"||le.current===e)return;const{error:j,payload:F,format:xe}=hS(e);if(!F){k(j??"Invalid JSON"),u(null),d(null),h(null),m(null),ne.current=null,ae.current="object",Q.current=!1;return}if(!Array.isArray(F.data)){k("JSON `data` must be an array of objects."),u(null),d(null),h(null),m(null),ne.current=null,ae.current="object",Q.current=!1;return}if(!F.data.every(Ke=>Ke&&typeof Ke=="object"&&!Array.isArray(Ke))){k("JSON `data` must be an array of objects."),u(null),d(null),h(null),m(null),ne.current=null,ae.current="object",Q.current=!1;return}k(""),u(F.data);const Y=F.metadata?gM.safeParse(F.metadata):null,Se=F.schema?mM.safeParse(F.schema):null,we=Y!=null&&Y.success?Y.data:void 0,Ie=Se!=null&&Se.success?Se.data:void 0;d(Ie??null),ne.current={...F,metadata:we,schema:Ie},ae.current=xe,Q.current=!!((Kr=Ie==null?void 0:Ie.columns)!=null&&Kr.length);const Vt={sorting:_W(we==null?void 0:we.sortBy),grouping:PW(we==null?void 0:we.groupBy),columnOrder:IW(we==null?void 0:we.columnOrder),columnVisibility:DW(we==null?void 0:we.columnVisibility)},Et=O.current,bn=H.current,jn=Et&&bn&&!eu(Et,bn);h(Ke=>Ke&&eu(Ke,Vt)?Ke:Vt),m(Ke=>jn||Ke&&eu(Ke,Vt)?Ke:Vt)},[t,e]),v.useEffect(()=>{if(c&&c.columns.length>0)return;if(!a){b!==""&&(S(""),E({columns:[{id:"name",name:"Name",type:"text"}]}));return}const j=[];a.forEach((xe,Y)=>{const Se=Object.keys(xe);if(Y===0){j.push(...Se);return}Se.forEach(we=>{j.includes(we)||j.push(we)})});const F=j.join("|");F!==b&&(S(F),E(F.length>0?{columns:j.map(xe=>({id:xe,name:xe,type:"text"}))}:{columns:[{id:"name",name:"Name",type:"text"}]}))},[b,a,c]);const se=v.useMemo(()=>c&&c.columns.length>0?c:C,[C,c]),ye=v.useCallback((j,F)=>j.length!==F.length?!1:j.every((xe,Y)=>xe===F[Y]),[]),M=v.useCallback((j,F)=>{const xe=j.filter(Se=>F.includes(Se)),Y=F.filter(Se=>!xe.includes(Se));return[...xe,...Y]},[]),V=v.useCallback((j,F)=>{if(j.columnOrder.length===0)return j;const xe=F.columns.map(Se=>Se.id),Y=M(j.columnOrder,xe);return ye(Y,j.columnOrder)?j:{...j,columnOrder:Y}},[ye,M]);v.useEffect(()=>{if(!p)return;const j=V(p,se);j!==p&&m(j)},[se,V,p]),v.useEffect(()=>{T.current=a},[a]),v.useEffect(()=>{N.current=se},[se]),v.useEffect(()=>{O.current=f},[f]),v.useEffect(()=>{H.current=p},[p]);const ie=v.useCallback((j,F)=>{if(!t||t.type!=="json")return;const xe=ne.current??{},Y=(F==null?void 0:F.nextSchema)??null,Se={...xe??{},data:j};Y&&Y.columns.length>0?Se.schema=Y:delete Se.schema;const we=ae.current==="array"&&!Se.metadata&&!Se.schema,Ie=JSON.stringify(we?j:Se,null,2);le.current=Ie,s(Ie),k(""),o(Date.now()),i(Ie!==n),u(j),Y&&Y.columns.length>0&&(d(Y),Q.current=!0,ae.current="object"),ne.current=Se},[t,n,s,i,o]),Ee=v.useCallback(j=>{ie(j)},[ie]),P=v.useCallback(()=>{const j=N.current??se,F={};j.columns.forEach(Y=>{F[Y.id]=Y.type==="object"?null:""});const xe=T.current??a??[];ie([...xe,F])},[ie,se,a]),q=v.useCallback(async j=>{if(!t||t.type!=="json")return;const xe=hS(e).payload,Y=ne.current??xe??{},Se={...Y??{},data:Array.isArray(Y.data)?Y.data:a??[],metadata:{...(Y==null?void 0:Y.metadata)??{},sortBy:j.sorting[0]?{id:j.sorting[0].id,desc:!!j.sorting[0].desc}:null,groupBy:j.grouping[0]??null,columnOrder:j.columnOrder.length>0?j.columnOrder:null,columnVisibility:Object.keys(j.columnVisibility).length>0?j.columnVisibility:null}},we=JSON.stringify(Se,null,2);s(we),i(we!==n),le.current=we,await l(we,{tags:r,pinned:void 0}),h(j),m(j),ne.current=Se,ae.current="object"},[t,e,r,a,n,s,i,l]),G=v.useCallback((j,F)=>{const Y=j.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)+/g,"")||"column";let Se=Y,we=1;for(;F.includes(Se);)Se=`${Y}-${we}`,we+=1;return Se},[]),K=v.useCallback(j=>j.split(",").map(F=>F.trim()).filter(F=>F.length>0),[]);return{jsonView:y,setJsonView:g,jsonError:x,jsonData:a,tableDefaults:f,tableView:p,setTableView:m,effectiveSchema:se,tableSchema:c,handleTableRowsChange:Ee,handleAddRow:P,commitTableUpdate:ie,persistTableView:q,createColumnId:G,parseColumnOptions:K,viewEquals:eu}};var Qf=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},jW=/^\s*>\s$/,$W=Ln.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return Qf("blockquote",{...xt(this.options.HTMLAttributes,t),children:Qf("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(s=>{const l=e.renderChildren([s]).split(`
446
- `).map(a=>a.trim()===""?n:`${n} ${a}`);r.push(l.join(`
447
- `))}),r.join(`
448
- ${n}
449
- `)},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[da({find:jW,type:this.type})]}}),zW=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,FW=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,BW=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,VW=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,HW=Bo.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 Qf("strong",{...xt(this.options.HTMLAttributes,t),children:Qf("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,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[ca({find:zW,type:this.type}),ca({find:BW,type:this.type})]},addPasteRules(){return[Io({find:FW,type:this.type}),Io({find:VW,type:this.type})]}}),UW=/(^|[^`])`([^`]+)`(?!`)$/,WW=/(^|[^`])`([^`]+)`(?!`)/g,qW=Bo.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",xt(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",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[ca({find:UW,type:this.type})]},addPasteRules(){return[Io({find:WW,type:this.type})]}}),Zm=4,GW=/^```([a-z]+)?[\s\n]$/,KW=/^~~~([a-z]+)?[\s\n]$/,JW=Ln.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Zm,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;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",xt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
450
- `):r=`\`\`\`${s}
451
-
452
- \`\`\``,r},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},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Zm,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const l=" ".repeat(n);return o?t.commands.insertContent(l):t.commands.command(({tr:a})=>{const{from:u,to:c}=s,h=r.doc.textBetween(u,c,`
453
- `,`
454
- `).split(`
455
- `).map(p=>l+p).join(`
456
- `);return a.replaceWith(u,c,r.schema.text(h)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Zm,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:l})=>{var a;const{pos:u}=i,c=i.start(),d=i.end(),h=r.doc.textBetween(c,d,`
457
- `,`
458
- `).split(`
459
- `);let p=0,m=0;const y=u-c;for(let C=0;C<h.length;C+=1){if(m+h[C].length>=y){p=C;break}m+=h[C].length+1}const x=((a=h[p].match(/^ */))==null?void 0:a[0])||"",k=Math.min(x.length,n);if(k===0)return!0;let b=c;for(let C=0;C<p;C+=1)b+=h[C].length+1;return l.delete(b,b+k),u-b<=k&&l.setSelection(ge.create(l.doc,b)),!0}):t.commands.command(({tr:l})=>{const{from:a,to:u}=s,f=r.doc.textBetween(a,u,`
460
- `,`
461
- `).split(`
462
- `).map(h=>{var p;const m=((p=h.match(/^ */))==null?void 0:p[0])||"",y=Math.min(m.length,n);return h.slice(y)}).join(`
463
- `);return l.replaceWith(a,u,r.schema.text(f)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
464
-
465
- `);return!i||!o?!1:t.chain().command(({tr:l})=>(l.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:s,empty:i}=n;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const l=s.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:u})=>(u.setSelection(me.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[Xy({find:GW,type:this.type,getAttributes:t=>({language:t[1]})}),Xy({find:KW,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new tt({key:new rt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!n||!i)return!1;const{tr:o,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
466
- `));return o.replaceSelectionWith(this.type.create({language:i},a)),o.selection.$from.parent.type!==this.type&&o.setSelection(ge.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),QW=Ln.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
467
-
468
- `):""}),ZW=Ln.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",xt(this.options.HTMLAttributes,t)]},renderText(){return`
469
- `},renderMarkdown:()=>`
470
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&a&&o){const d=a.filter(f=>l.includes(f.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),YW=Ln.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]}`,xt(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},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=>Xy({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),XW=Ln.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",xt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!$U(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return oO(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:l})=>{if(l){const{$to:a}=o.selection,u=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?o.setSelection(ge.create(o.doc,a.pos+1)):a.nodeAfter.isBlock?o.setSelection(ue.create(o.doc,a.pos)):o.setSelection(ge.create(o.doc,a.pos));else{const c=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=c==null?void 0:c.create();d&&(o.insert(u,d),o.setSelection(ge.create(o.doc,u+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[jU({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),e9=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,t9=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,n9=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,r9=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,s9=Bo.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",xt(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)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ca({find:e9,type:this.type}),ca({find:n9,type:this.type})]},addPasteRules(){return[Io({find:t9,type:this.type}),Io({find:r9,type:this.type})]}});const i9="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",o9="ελ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",uv="numeric",cv="ascii",dv="alpha",yu="asciinumeric",tu="alphanumeric",fv="domain",pA="emoji",l9="scheme",a9="slashscheme",Ym="whitespace";function u9(t,e){return t in e||(e[t]=[]),e[t]}function no(t,e,n){e[uv]&&(e[yu]=!0,e[tu]=!0),e[cv]&&(e[yu]=!0,e[dv]=!0),e[yu]&&(e[tu]=!0),e[dv]&&(e[tu]=!0),e[tu]&&(e[fv]=!0),e[pA]&&(e[fv]=!0);for(const r in e){const s=u9(r,n);s.indexOf(t)<0&&s.push(t)}}function c9(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function mn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}mn.groups={};mn.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 s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||mn.groups;let s;return e&&e.j?s=e:(s=new mn(e),n&&r&&no(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||mn.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,l=s.go(t);if(l?(o=new mn,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new mn,i){if(r)if(o.t&&typeof o.t=="string"){const a=Object.assign(c9(o.t,r),n);no(i,a,r)}else n&&no(i,n,r);o.t=i}return s.j[t]=o,o}};const Re=(t,e,n,r,s)=>t.ta(e,n,r,s),ut=(t,e,n,r,s)=>t.tr(e,n,r,s),pS=(t,e,n,r,s)=>t.ts(e,n,r,s),$=(t,e,n,r,s)=>t.tt(e,n,r,s),rs="WORD",hv="UWORD",mA="ASCIINUMERICAL",gA="ALPHANUMERICAL",ic="LOCALHOST",pv="TLD",mv="UTLD",Gd="SCHEME",ul="SLASH_SCHEME",Nx="NUM",gv="WS",Ox="NL",vu="OPENBRACE",xu="CLOSEBRACE",Zf="OPENBRACKET",Yf="CLOSEBRACKET",Xf="OPENPAREN",eh="CLOSEPAREN",th="OPENANGLEBRACKET",nh="CLOSEANGLEBRACKET",rh="FULLWIDTHLEFTPAREN",sh="FULLWIDTHRIGHTPAREN",ih="LEFTCORNERBRACKET",oh="RIGHTCORNERBRACKET",lh="LEFTWHITECORNERBRACKET",ah="RIGHTWHITECORNERBRACKET",uh="FULLWIDTHLESSTHAN",ch="FULLWIDTHGREATERTHAN",dh="AMPERSAND",fh="APOSTROPHE",hh="ASTERISK",Hs="AT",ph="BACKSLASH",mh="BACKTICK",gh="CARET",Ks="COLON",Ax="COMMA",yh="DOLLAR",Nr="DOT",vh="EQUALS",_x="EXCLAMATION",Fn="HYPHEN",wu="PERCENT",xh="PIPE",wh="PLUS",kh="POUND",ku="QUERY",Px="QUOTE",yA="FULLWIDTHMIDDLEDOT",Ix="SEMI",Or="SLASH",bu="TILDE",bh="UNDERSCORE",vA="EMOJI",Sh="SYM";var xA=Object.freeze({__proto__:null,ALPHANUMERICAL:gA,AMPERSAND:dh,APOSTROPHE:fh,ASCIINUMERICAL:mA,ASTERISK:hh,AT:Hs,BACKSLASH:ph,BACKTICK:mh,CARET:gh,CLOSEANGLEBRACKET:nh,CLOSEBRACE:xu,CLOSEBRACKET:Yf,CLOSEPAREN:eh,COLON:Ks,COMMA:Ax,DOLLAR:yh,DOT:Nr,EMOJI:vA,EQUALS:vh,EXCLAMATION:_x,FULLWIDTHGREATERTHAN:ch,FULLWIDTHLEFTPAREN:rh,FULLWIDTHLESSTHAN:uh,FULLWIDTHMIDDLEDOT:yA,FULLWIDTHRIGHTPAREN:sh,HYPHEN:Fn,LEFTCORNERBRACKET:ih,LEFTWHITECORNERBRACKET:lh,LOCALHOST:ic,NL:Ox,NUM:Nx,OPENANGLEBRACKET:th,OPENBRACE:vu,OPENBRACKET:Zf,OPENPAREN:Xf,PERCENT:wu,PIPE:xh,PLUS:wh,POUND:kh,QUERY:ku,QUOTE:Px,RIGHTCORNERBRACKET:oh,RIGHTWHITECORNERBRACKET:ah,SCHEME:Gd,SEMI:Ix,SLASH:Or,SLASH_SCHEME:ul,SYM:Sh,TILDE:bu,TLD:pv,UNDERSCORE:bh,UTLD:mv,UWORD:hv,WORD:rs,WS:gv});const Xr=/[a-z]/,za=new RegExp("\\p{L}","u"),Xm=new RegExp("\\p{Emoji}","u"),es=/\d/,eg=/\s/,mS="\r",tg=`
471
- `,d9="️",f9="‍",ng="";let vd=null,xd=null;function h9(t=[]){const e={};mn.groups=e;const n=new mn;vd==null&&(vd=gS(i9)),xd==null&&(xd=gS(o9)),$(n,"'",fh),$(n,"{",vu),$(n,"}",xu),$(n,"[",Zf),$(n,"]",Yf),$(n,"(",Xf),$(n,")",eh),$(n,"<",th),$(n,">",nh),$(n,"(",rh),$(n,")",sh),$(n,"「",ih),$(n,"」",oh),$(n,"『",lh),$(n,"』",ah),$(n,"<",uh),$(n,">",ch),$(n,"&",dh),$(n,"*",hh),$(n,"@",Hs),$(n,"`",mh),$(n,"^",gh),$(n,":",Ks),$(n,",",Ax),$(n,"$",yh),$(n,".",Nr),$(n,"=",vh),$(n,"!",_x),$(n,"-",Fn),$(n,"%",wu),$(n,"|",xh),$(n,"+",wh),$(n,"#",kh),$(n,"?",ku),$(n,'"',Px),$(n,"/",Or),$(n,";",Ix),$(n,"~",bu),$(n,"_",bh),$(n,"\\",ph),$(n,"・",yA);const r=ut(n,es,Nx,{[uv]:!0});ut(r,es,r);const s=ut(r,Xr,mA,{[yu]:!0}),i=ut(r,za,gA,{[tu]:!0}),o=ut(n,Xr,rs,{[cv]:!0});ut(o,es,s),ut(o,Xr,o),ut(s,es,s),ut(s,Xr,s);const l=ut(n,za,hv,{[dv]:!0});ut(l,Xr),ut(l,es,i),ut(l,za,l),ut(i,es,i),ut(i,Xr),ut(i,za,i);const a=$(n,tg,Ox,{[Ym]:!0}),u=$(n,mS,gv,{[Ym]:!0}),c=ut(n,eg,gv,{[Ym]:!0});$(n,ng,c),$(u,tg,a),$(u,ng,c),ut(u,eg,c),$(c,mS),$(c,tg),ut(c,eg,c),$(c,ng,c);const d=ut(n,Xm,vA,{[pA]:!0});$(d,"#"),ut(d,Xm,d),$(d,d9,d);const f=$(d,f9);$(f,"#"),ut(f,Xm,d);const h=[[Xr,o],[es,s]],p=[[Xr,null],[za,l],[es,i]];for(let m=0;m<vd.length;m++)Ds(n,vd[m],pv,rs,h);for(let m=0;m<xd.length;m++)Ds(n,xd[m],mv,hv,p);no(pv,{tld:!0,ascii:!0},e),no(mv,{utld:!0,alpha:!0},e),Ds(n,"file",Gd,rs,h),Ds(n,"mailto",Gd,rs,h),Ds(n,"http",ul,rs,h),Ds(n,"https",ul,rs,h),Ds(n,"ftp",ul,rs,h),Ds(n,"ftps",ul,rs,h),no(Gd,{scheme:!0,ascii:!0},e),no(ul,{slashscheme:!0,ascii:!0},e),t=t.sort((m,y)=>m[0]>y[0]?1:-1);for(let m=0;m<t.length;m++){const y=t[m][0],x=t[m][1]?{[l9]:!0}:{[a9]:!0};y.indexOf("-")>=0?x[fv]=!0:Xr.test(y)?es.test(y)?x[yu]=!0:x[cv]=!0:x[uv]=!0,pS(n,y,y,x)}return pS(n,"localhost",ic,{ascii:!0}),n.jd=new mn(Sh),{start:n,tokens:Object.assign({groups:e},xA)}}function wA(t,e){const n=p9(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let l=t,a=null,u=0,c=null,d=-1,f=-1;for(;o<r&&(a=l.go(n[o]));)l=a,l.accepts()?(d=0,f=0,c=l):d>=0&&(d+=n[o].length,f++),u+=n[o].length,i+=n[o].length,o++;i-=d,o-=f,u-=d,s.push({t:c.t,v:e.slice(i-u,i),s:i-u,e:i})}return s}function p9(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Ds(t,e,n,r,s){let i;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];t.j[a]?i=t.j[a]:(i=new mn(r),i.jr=s.slice(),t.j[a]=i),t=i}return i=new mn(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function gS(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const oc={defaultProtocol:"http",events:null,format:yS,formatHref:yS,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Dx(t,e=null){let n=Object.assign({},oc);t&&(n=Object.assign(n,t instanceof Dx?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}Dx.prototype={o:oc,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:oc[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},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 yS(t){return t}function kA(t,e){this.t="token",this.v=t,this.tk=e}kA.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=oc.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),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},l=t.get("className",n,e),a=t.get("target",n,e),u=t.get("rel",n,e),c=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),u&&(o.rel=u),c&&Object.assign(o,c),{tagName:s,attributes:o,content:i,eventListeners:d}}};function Cp(t,e){class n extends kA{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const vS=Cp("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),xS=Cp("text"),m9=Cp("nl"),wd=Cp("url",{isLink:!0,toHref(t=oc.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==ic&&t[1].t===Ks}}),zn=t=>new mn(t);function g9({groups:t}){const e=t.domain.concat([dh,hh,Hs,ph,mh,gh,yh,vh,Fn,Nx,wu,xh,wh,kh,Or,Sh,bu,bh]),n=[fh,Ks,Ax,Nr,_x,wu,ku,Px,Ix,th,nh,vu,xu,Yf,Zf,Xf,eh,rh,sh,ih,oh,lh,ah,uh,ch],r=[dh,fh,hh,ph,mh,gh,yh,vh,Fn,vu,xu,wu,xh,wh,kh,ku,Or,Sh,bu,bh],s=zn(),i=$(s,bu);Re(i,r,i),Re(i,t.domain,i);const o=zn(),l=zn(),a=zn();Re(s,t.domain,o),Re(s,t.scheme,l),Re(s,t.slashscheme,a),Re(o,r,i),Re(o,t.domain,o);const u=$(o,Hs);$(i,Hs,u),$(l,Hs,u),$(a,Hs,u);const c=$(i,Nr);Re(c,r,i),Re(c,t.domain,i);const d=zn();Re(u,t.domain,d),Re(d,t.domain,d);const f=$(d,Nr);Re(f,t.domain,d);const h=zn(vS);Re(f,t.tld,h),Re(f,t.utld,h),$(u,ic,h);const p=$(d,Fn);$(p,Fn,p),Re(p,t.domain,d),Re(h,t.domain,d),$(h,Nr,f),$(h,Fn,p);const m=$(h,Ks);Re(m,t.numeric,vS);const y=$(o,Fn),g=$(o,Nr);$(y,Fn,y),Re(y,t.domain,o),Re(g,r,i),Re(g,t.domain,o);const x=zn(wd);Re(g,t.tld,x),Re(g,t.utld,x),Re(x,t.domain,o),Re(x,r,i),$(x,Nr,g),$(x,Fn,y),$(x,Hs,u);const k=$(x,Ks),b=zn(wd);Re(k,t.numeric,b);const S=zn(wd),C=zn();Re(S,e,S),Re(S,n,C),Re(C,e,S),Re(C,n,C),$(x,Or,S),$(b,Or,S);const E=$(l,Ks),T=$(a,Ks),N=$(T,Or),O=$(N,Or);Re(l,t.domain,o),$(l,Nr,g),$(l,Fn,y),Re(a,t.domain,o),$(a,Nr,g),$(a,Fn,y),Re(E,t.domain,S),$(E,Or,S),$(E,ku,S),Re(O,t.domain,S),Re(O,e,S),$(O,Or,S);const H=[[vu,xu],[Zf,Yf],[Xf,eh],[th,nh],[rh,sh],[ih,oh],[lh,ah],[uh,ch]];for(let ne=0;ne<H.length;ne++){const[ae,Q]=H[ne],le=$(S,ae);$(C,ae,le),$(le,Q,S);const se=zn(wd);Re(le,e,se);const ye=zn();Re(le,n),Re(se,e,se),Re(se,n,ye),Re(ye,e,se),Re(ye,n,ye),$(se,Q,S),$(ye,Q,S)}return $(s,ic,x),$(s,Ox,m9),{start:s,tokens:xA}}function y9(t,e,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let l=t,a=null,u=null,c=0,d=null,f=-1;for(;s<r&&!(a=l.go(n[s].t));)o.push(n[s++]);for(;s<r&&(u=a||l.go(n[s].t));)a=null,l=u,l.accepts()?(f=0,d=l):f>=0&&f++,s++,c++;if(f<0)s-=c,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(rg(xS,e,o)),o=[]),s-=f,c-=f;const h=d.t,p=n.slice(s-c,s);i.push(rg(h,e,p))}}return o.length>0&&i.push(rg(xS,e,o)),i}function rg(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const v9=typeof console<"u"&&console&&console.warn||(()=>{}),x9="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Xe={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function w9(){return mn.groups={},Xe.scanner=null,Xe.parser=null,Xe.tokenQueue=[],Xe.pluginQueue=[],Xe.customSchemes=[],Xe.initialized=!1,Xe}function wS(t,e=!1){if(Xe.initialized&&v9(`linkifyjs: already initialized - will not register custom scheme "${t}" ${x9}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
472
- 1. Must only contain digits, lowercase ASCII letters or "-"
473
- 2. Cannot start or end with "-"
474
- 3. "-" cannot repeat`);Xe.customSchemes.push([t,e])}function k9(){Xe.scanner=h9(Xe.customSchemes);for(let t=0;t<Xe.tokenQueue.length;t++)Xe.tokenQueue[t][1]({scanner:Xe.scanner});Xe.parser=g9(Xe.scanner.tokens);for(let t=0;t<Xe.pluginQueue.length;t++)Xe.pluginQueue[t][1]({scanner:Xe.scanner,parser:Xe.parser});return Xe.initialized=!0,Xe}function Lx(t){return Xe.initialized||k9(),y9(Xe.parser.start,t,wA(Xe.scanner.start,t))}Lx.scan=wA;function bA(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 Dx(n),s=Lx(t),i=[];for(let o=0;o<s.length;o++){const l=s[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var jx="[\0-   ᠎ -\u2029  ]",b9=new RegExp(jx),S9=new RegExp(`${jx}$`),C9=new RegExp(jx,"g");function E9(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function T9(t){return new tt({key:new rt("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,l=YN(n.doc,[...e]);if(iO(l).forEach(({newRange:u})=>{const c=$H(r.doc,u,h=>h.isTextblock);let d,f;if(c.length>1)d=c[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(c.length){const h=r.doc.textBetween(u.from,u.to," "," ");if(!S9.test(h))return;d=c[0],f=r.doc.textBetween(d.pos,u.to,void 0," ")}if(d&&f){const h=f.split(b9).filter(Boolean);if(h.length<=0)return!1;const p=h[h.length-1],m=d.pos+f.lastIndexOf(p);if(!p)return!1;const y=Lx(p).map(g=>g.toObject(t.defaultProtocol));if(!E9(y))return!1;y.filter(g=>g.isLink).map(g=>({...g,from:m+g.start+1,to:m+g.end+1})).filter(g=>r.schema.marks.code?!r.doc.rangeHasMark(g.from,g.to,r.schema.marks.code):!0).filter(g=>t.validate(g.value)).filter(g=>t.shouldAutoLink(g.value)).forEach(g=>{fx(g.from,g.to,r.doc).some(x=>x.mark.type===t.type)||o.addMark(g.from,g.to,t.type.create({href:g.href}))})}}),!!o.steps.length)return o}})}function R9(t){return new tt({key:new rt("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{const a=r.target;if(!a)return!1;const u=t.editor.view.dom;o=a.closest("a"),o&&!u.contains(o)&&(o=null)}if(!o)return!1;let l=!1;if(t.enableClickSelection&&(l=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const a=sO(e.state,t.type.name),u=(s=o.href)!=null?s:a.href,c=(i=o.target)!=null?i:a.target;u&&(window.open(u,c),l=!0)}return l}}})}function M9(t){return new tt({key:new rt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:l}=o;if(l)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});const u=bA(a,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===a);return!a||!u||s!==void 0&&!s(u.value)?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}function qi(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(C9,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var N9=Bo.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"){wS(t);return}wS(t.scheme,t.optionalSlashes)})},onDestroy(){w9()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!qi(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const s=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(s)||!/\./.test(s))}}},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=>!!qi(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=>!!qi(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",xt(this.options.HTMLAttributes,t),0]:["a",xt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const r=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${r})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qi(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 n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!qi(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Io({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,s=bA(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!qi(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(T9({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!qi(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(R9({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(M9({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),O9=Object.defineProperty,A9=(t,e)=>{for(var n in e)O9(t,n,{get:e[n],enumerable:!0})},_9="listItem",kS="textStyle",bS=/^\s*([-+*])\s$/,SA=Ln.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",xt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
475
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(_9,this.editor.getAttributes(kS)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=da({find:bS,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=da({find:bS,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(kS),editor:this.editor})),[t]}}),CA=Ln.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",xt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(s=>s.type==="paragraph"))n=e.parseChildren(t.tokens);else{const s=t.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),l=e.parseChildren(o);n.push(...l)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>gx(t,e,r=>{var s,i;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((i=(s=r.meta)==null?void 0:s.parentAttrs)==null?void 0:i.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),P9={};A9(P9,{findListItemPos:()=>Sc,getNextListDepth:()=>$x,handleBackspace:()=>yv,handleDelete:()=>vv,hasListBefore:()=>EA,hasListItemAfter:()=>I9,hasListItemBefore:()=>TA,listItemHasSubList:()=>RA,nextListIsDeeper:()=>MA,nextListIsHigher:()=>NA});var Sc=(t,e)=>{const{$from:n}=e.selection,r=vt(t,e.schema);let s=null,i=n.depth,o=n.pos,l=null;for(;i>0&&l===null;)s=n.node(i),s.type===r?l=i:(i-=1,o-=1);return l===null?null:{$pos:e.doc.resolve(o),depth:l}},$x=(t,e)=>{const n=Sc(t,e);if(!n)return!1;const[,r]=KH(e,t,n.$pos.pos+4);return r},EA=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),i=t.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},TA=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},RA=(t,e,n)=>{if(!n)return!1;const r=vt(t,e.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},yv=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!_i(t.state,e)&&EA(t.state,e,n)){const{$anchor:l}=t.state.selection,a=t.state.doc.resolve(l.before()-1),u=[];a.node().descendants((f,h)=>{f.type.name===e&&u.push({node:f,pos:h})});const c=u.at(-1);if(!c)return!1;const d=t.state.doc.resolve(a.start()+c.pos+1);return t.chain().cut({from:l.start()-1,to:l.end()+1},d.end()).joinForward().run()}if(!_i(t.state,e)||!YH(t.state))return!1;const r=Sc(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=RA(e,t.state,i);return TA(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},MA=(t,e)=>{const n=$x(t,e),r=Sc(t,e);return!r||!n?!1:n>r.depth},NA=(t,e)=>{const n=$x(t,e),r=Sc(t,e);return!r||!n?!1:n<r.depth},vv=(t,e)=>{if(!_i(t.state,e)||!ZH(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:MA(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():NA(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},I9=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},OA=st.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&vv(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&vv(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&yv(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&yv(t,n,r)&&(e=!0)}),e}}}}),SS=/^(\s*)(\d+)\.\s+(.*)$/,D9=/^\s/;function L9(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n],i=s.match(SS);if(!i)break;const[,o,l,a]=i,u=o.length;let c=a,d=n+1;const f=[s];for(;d<t.length;){const h=t[d];if(h.match(SS))break;if(h.trim()==="")f.push(h),c+=`
476
- `,d+=1;else if(h.match(D9))f.push(h),c+=`
477
- ${h.slice(u+2)}`,d+=1;else break}e.push({indent:u,number:parseInt(l,10),content:c.trim(),raw:f.join(`
478
- `)}),r=d,n=d}return[e,r]}function AA(t,e,n){var r;const s=[];let i=0;for(;i<t.length;){const o=t[i];if(o.indent===e){const l=o.content.split(`
479
- `),a=((r=l[0])==null?void 0:r.trim())||"",u=[];a&&u.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});const c=l.slice(1).join(`
480
- `).trim();if(c){const h=n.blockTokens(c);u.push(...h)}let d=i+1;const f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){const h=Math.min(...f.map(m=>m.indent)),p=AA(f,h,n);u.push({type:"list",ordered:!0,start:f[0].number,items:p,raw:f.map(m=>m.raw).join(`
481
- `)})}s.push({type:"list_item",raw:o.raw,tokens:u}),i=d}else i+=1}return s}function j9(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var $9="listItem",CS="textStyle",ES=/^(\d+)\.\s$/,_A=Ln.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",xt(this.options.HTMLAttributes,n),0]:["ol",xt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?j9(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
482
- `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const s=t.split(`
483
- `),[i,o]=L9(s);if(i.length===0)return;const l=AA(i,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:l,raw:s.slice(0,o).join(`
484
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes($9,this.editor.getAttributes(CS)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=da({find:ES,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=da({find:ES,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(CS)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),z9=/^\s*(\[([( |x])?\])\s$/,F9=Ln.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",xt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return gx(t,e,s)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),u=d=>{var f,h;l.ariaLabel=((h=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:h.call(f,d,l.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};u(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=n();if(typeof p!="number")return!1;const m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m==null?void 0:m.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{s.setAttribute(d,f)}),s.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,o),s.append(i,a),Object.entries(e).forEach(([d,f])=>{s.setAttribute(d,f)});let c=new Set(Object.keys(e));return{dom:s,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;s.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,u(d);const f=r.extensionManager.attributes,h=rc(d,f),p=new Set(Object.keys(h)),m=this.options.HTMLAttributes;return c.forEach(y=>{p.has(y)||(y in m?s.setAttribute(y,m[y]):s.removeAttribute(y))}),Object.entries(h).forEach(([y,g])=>{g==null?y in m?s.setAttribute(y,m[y]):s.removeAttribute(y):s.setAttribute(y,g)}),c=p,!0}}}},addInputRules(){return[da({find:z9,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),B9=Ln.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",xt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
485
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=ev(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},s=ev(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});st.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(SA.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(CA.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(OA.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(_A.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(F9.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(B9.configure(this.options.taskList)),t}});var TS="&nbsp;",V9=" ",H9=Ln.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",xt(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===TS||r[0].text===V9)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?TS:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),U9=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,W9=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,q9=Bo.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",xt(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,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[ca({find:U9,type:this.type})]},addPasteRules(){return[Io({find:W9,type:this.type})]}}),G9=Ln.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),K9=Bo.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",xt(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function J9(t={}){return new tt({view(e){return new Q9(e,t)}})}class Q9{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(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}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,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,l=i.height/s.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:m-y,bottom:m+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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 u,c;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;u=d.left-a.scrollLeft*f,c=d.top-a.scrollTop*h}this.element.style.left=(r.left-u)/o+"px",this.element.style.top=(r.top-c)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"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),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=WM(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ft extends me{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return ft.valid(r)?new ft(r):me.near(r)}content(){return U.empty}eq(e){return e instanceof ft&&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 ft(e.resolve(n.pos))}getBookmark(){return new zx(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Z9(e)||!Y9(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&ft.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let l=e.node(o);if(n>0?e.indexAfter(o)<l.childCount:e.index(o)>0){i=l.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let a=e.doc.resolve(s);if(ft.valid(a))return a}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!ue.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let l=e.doc.resolve(s);if(ft.valid(l))return l}return null}}}ft.prototype.visible=!1;ft.findFrom=ft.findGapCursorFrom;me.jsonID("gapcursor",ft);class zx{constructor(e){this.pos=e}map(e){return new zx(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ft.valid(n)?new ft(n):me.near(n)}}function PA(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Z9(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 s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||PA(s.type))return!0;if(s.inlineContent)return!1}}return!0}function Y9(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 s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||PA(s.type))return!0;if(s.inlineContent)return!1}}return!0}function X9(){return new tt({props:{decorations:r8,createSelectionBetween(t,e,n){return e.pos==n.pos&&ft.valid(n)?new ft(n):null},handleClick:t8,handleKeyDown:e8,handleDOMEvents:{beforeinput:n8}}})}const e8=sx({ArrowLeft:kd("horiz",-1),ArrowRight:kd("horiz",1),ArrowUp:kd("vert",-1),ArrowDown:kd("vert",1)});function kd(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof ge){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let u=ft.findGapCursorFrom(l,e,a);return u?(s&&s(r.tr.setSelection(new ft(u))),!0):!1}}function t8(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!ft.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&ue.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ft(r))),!0)}function n8(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ft))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 s=D.empty;for(let o=r.length-1;o>=0;o--)s=D.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new U(s,0,0));return i.setSelection(ge.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function r8(t){if(!(t.selection instanceof ft))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ot.create(t.doc,[rn.widget(t.selection.head,e,{key:"gapcursor"})])}var Ch=200,Pt=function(){};Pt.prototype.append=function(e){return e.length?(e=Pt.from(e),!this.length&&e||e.length<Ch&&this.leafAppend(e)||this.length<Ch&&e.leafPrepend(this)||this.appendInner(e)):this};Pt.prototype.prepend=function(e){return e.length?Pt.from(e).append(this):this};Pt.prototype.appendInner=function(e){return new s8(this,e)};Pt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Pt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Pt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Pt.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)};Pt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};Pt.from=function(e){return e instanceof Pt?e:e&&e.length?new IA(e):Pt.empty};var IA=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(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,l){for(var a=i;a<o;a++)if(s(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,l){for(var a=i-1;a>=o;a--)if(s(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Ch)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Ch)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Pt);Pt.empty=new IA([]);var s8=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,s,i,o){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(i,l),o)===!1||i>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,i)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(i,l)-l,o+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(s,l),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,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}(Pt);const i8=500;class mr{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 s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,l,a,u=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,c.push(d);return}if(s){c.push(new Ar(d.map));let h=d.step.map(s.slice(i)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],u.push(new Ar(p,void 0,void 0,u.length+c.length))),i--,p&&s.appendMap(p,i)}else o.maybeStep(d.step);if(d.selection)return l=s?d.selection.map(s.slice(i)):d.selection,a=new mr(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,n,r,s){let i=[],o=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),f=new Ar(e.mapping.maps[c],d,n),h;(h=a&&a.merge(f))&&(f=h,c?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(o++,n=void 0),s||(a=f)}let u=o-r.depth;return u>l8&&(l=o8(l,u),o-=u),new mr(l.append(i),o)}remapping(e,n){let r=new Zu;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new mr(this.items.append(e.map(n=>new Ar(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},s);let a=n;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;o=Math.min(o,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(i.slice(a+1,h));y&&l++,r.push(new Ar(p,m,y))}else r.push(new Ar(p))},s);let u=[];for(let f=n;f<o;f++)u.push(new Ar(i.maps[f]));let c=this.items.slice(0,s).append(u).append(r),d=new mr(c,l);return d.emptyItemCount()>i8&&(d=d.compress(this.items.length-r.length)),d}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,s=[],i=0;return this.items.forEach((o,l)=>{if(l>=e)s.push(o),o.selection&&i++;else if(o.step){let a=o.step.map(n.slice(r)),u=a&&a.getMap();if(r--,u&&n.appendMap(u,r),a){let c=o.selection&&o.selection.map(n.slice(r));c&&i++;let d=new Ar(u.invert(),a,c),f,h=s.length-1;(f=s.length&&s[h].merge(d))?s[h]=f:s.push(d)}}else o.map&&r--},this.items.length,0),new mr(Pt.from(s.reverse()),i)}}mr.empty=new mr(Pt.empty,0);function o8(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class Ar{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Ar(n.getMap().invert(),n,this.selection)}}}class Us{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const l8=20;function a8(t,e,n,r){let s=n.getMeta(wo),i;if(s)return s.historyState;n.getMeta(d8)&&(t=new Us(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(wo))return o.getMeta(wo).redo?new Us(t.done.addTransform(n,void 0,r,Kd(e)),t.undone,RS(n.mapping.maps),t.prevTime,t.prevComposition):new Us(t.done,t.undone.addTransform(n,void 0,r,Kd(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!o&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!u8(n,t.prevRanges)),u=o?sg(t.prevRanges,n.mapping):RS(n.mapping.maps);return new Us(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Kd(e)),mr.empty,u,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Us(t.done.rebased(n,i),t.undone.rebased(n,i),sg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Us(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),sg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function u8(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function RS(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function sg(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function c8(t,e,n){let r=Kd(e),s=wo.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),a=new Us(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(o).setMeta(wo,{redo:n,historyState:a})}let ig=!1,MS=null;function Kd(t){let e=t.plugins;if(MS!=e){ig=!1,MS=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){ig=!0;break}}return ig}const wo=new rt("history"),d8=new rt("closeHistory");function f8(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new tt({key:wo,state:{init(){return new Us(mr.empty,mr.empty,null,0,-1)},apply(e,n,r){return a8(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?LA:r=="historyRedo"?jA:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function DA(t,e){return(n,r)=>{let s=wo.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=c8(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const LA=DA(!1,!0),jA=DA(!0,!0);st.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new tt({key:new rt("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>s){const o=i-s,l=0,a=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const u=r.tr.deleteRange(l,a);return t=!0,u}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-r,u=l-a,c=l;return e.deleteRange(u,c),!(this.storage.characters({node:e.doc})>r)}})]}});var h8=st.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[J9(this.options)]}});st.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new tt({key:new rt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return ot.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((a,u)=>{if(a.isText)return;if(!(s>=u&&s<=u+a.nodeSize-1))return!1;o+=1});let l=0;return t.descendants((a,u)=>{if(a.isText||!(s>=u&&s<=u+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&o-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(rn.node(u,u+a.nodeSize,{class:this.options.className}))}),ot.create(t,i)}}})]}});var p8=st.create({name:"gapCursor",addProseMirrorPlugins(){return[X9()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=Ve(re(t,"allowGapCursor",n)))!=null?e:null}}}),NS="placeholder";function m8(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}st.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:NS,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${m8(this.options.dataAttribute)}`:`data-${NS}`;return[new tt({key:new rt("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=n,i=[];if(!r)return null;const o=this.editor.isEmpty;return e.descendants((l,a)=>{const u=s>=a&&s<=a+l.nodeSize,c=!l.isLeaf&&pp(l);if((u||!this.options.showOnlyCurrent)&&c){const d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);const f=rn.node(a,a+l.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:u}):this.options.placeholder});i.push(f)}return this.options.includeChildren}),ot.create(e,i)}}})]}});st.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new tt({key:new rt("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||oO(n.selection)||t.view.dragging?null:ot.create(n.doc,[rn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function OS({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var g8=st.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new rt(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new tt({key:e,appendTransaction:(s,i,o)=>{const{doc:l,tr:a,schema:u}=o,c=e.getState(o),d=l.content.size,f=u.nodes[n];if(c)return a.insert(d,f.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!OS({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!OS({node:o,types:r})}}})]}}),y8=st.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>LA(t,e),redo:()=>({state:t,dispatch:e})=>jA(t,e)}},addProseMirrorPlugins(){return[f8(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()}}}),v8=st.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(HW.configure(this.options.bold)),this.options.blockquote!==!1&&s.push($W.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(SA.configure(this.options.bulletList)),this.options.code!==!1&&s.push(qW.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(JW.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(QW.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(h8.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(p8.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(ZW.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(YW.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(y8.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(XW.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(s9.configure(this.options.italic)),this.options.listItem!==!1&&s.push(CA.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(OA.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(N9.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(_A.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(H9.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(q9.configure(this.options.strike)),this.options.text!==!1&&s.push(G9.configure(this.options.text)),this.options.underline!==!1&&s.push(K9.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(g8.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),x8=v8;function Fx(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ho=Fx();function $A(t){Ho=t}var Su={exec:()=>null};function $e(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(sn.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var w8=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),sn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},k8=/^(?:[ \t]*(?:\n|$))+/,b8=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,S8=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Cc=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,C8=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Bx=/(?:[*+-]|\d{1,9}[.)])/,zA=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,FA=$e(zA).replace(/bull/g,Bx).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),E8=$e(zA).replace(/bull/g,Bx).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Vx=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,T8=/^[^\n]+/,Hx=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,R8=$e(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Hx).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),M8=$e(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Bx).getRegex(),Ep="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ux=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,N8=$e("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ux).replace("tag",Ep).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),BA=$e(Vx).replace("hr",Cc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ep).getRegex(),O8=$e(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",BA).getRegex(),Wx={blockquote:O8,code:b8,def:R8,fences:S8,heading:C8,hr:Cc,html:N8,lheading:FA,list:M8,newline:k8,paragraph:BA,table:Su,text:T8},AS=$e("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Cc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ep).getRegex(),A8={...Wx,lheading:E8,table:AS,paragraph:$e(Vx).replace("hr",Cc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",AS).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ep).getRegex()},_8={...Wx,html:$e(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ux).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Su,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$e(Vx).replace("hr",Cc).replace("heading",` *#{1,6} *[^
486
- ]`).replace("lheading",FA).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},P8=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,I8=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,VA=/^( {2,}|\\)\n(?!\s*$)/,D8=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Tp=/[\p{P}\p{S}]/u,qx=/[\s\p{P}\p{S}]/u,HA=/[^\s\p{P}\p{S}]/u,L8=$e(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,qx).getRegex(),UA=/(?!~)[\p{P}\p{S}]/u,j8=/(?!~)[\s\p{P}\p{S}]/u,$8=/(?:[^\s\p{P}\p{S}]|~)/u,z8=$e(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",w8?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),WA=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,F8=$e(WA,"u").replace(/punct/g,Tp).getRegex(),B8=$e(WA,"u").replace(/punct/g,UA).getRegex(),qA="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",V8=$e(qA,"gu").replace(/notPunctSpace/g,HA).replace(/punctSpace/g,qx).replace(/punct/g,Tp).getRegex(),H8=$e(qA,"gu").replace(/notPunctSpace/g,$8).replace(/punctSpace/g,j8).replace(/punct/g,UA).getRegex(),U8=$e("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,HA).replace(/punctSpace/g,qx).replace(/punct/g,Tp).getRegex(),W8=$e(/\\(punct)/,"gu").replace(/punct/g,Tp).getRegex(),q8=$e(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),G8=$e(Ux).replace("(?:-->|$)","-->").getRegex(),K8=$e("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",G8).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Eh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,J8=$e(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Eh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),GA=$e(/^!?\[(label)\]\[(ref)\]/).replace("label",Eh).replace("ref",Hx).getRegex(),KA=$e(/^!?\[(ref)\](?:\[\])?/).replace("ref",Hx).getRegex(),Q8=$e("reflink|nolink(?!\\()","g").replace("reflink",GA).replace("nolink",KA).getRegex(),_S=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Gx={_backpedal:Su,anyPunctuation:W8,autolink:q8,blockSkip:z8,br:VA,code:I8,del:Su,emStrongLDelim:F8,emStrongRDelimAst:V8,emStrongRDelimUnd:U8,escape:P8,link:J8,nolink:KA,punctuation:L8,reflink:GA,reflinkSearch:Q8,tag:K8,text:D8,url:Su},Z8={...Gx,link:$e(/^!?\[(label)\]\((.*?)\)/).replace("label",Eh).getRegex(),reflink:$e(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Eh).getRegex()},xv={...Gx,emStrongRDelimAst:H8,emStrongLDelim:B8,url:$e(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",_S).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:$e(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",_S).getRegex()},Y8={...xv,br:$e(VA).replace("{2,}","*").getRegex(),text:$e(xv.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},bd={normal:Wx,gfm:A8,pedantic:_8},Fa={normal:Gx,gfm:xv,breaks:Y8,pedantic:Z8},X8={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},PS=t=>X8[t];function ss(t,e){if(e){if(sn.escapeTest.test(t))return t.replace(sn.escapeReplace,PS)}else if(sn.escapeTestNoEncode.test(t))return t.replace(sn.escapeReplaceNoEncode,PS);return t}function IS(t){try{t=encodeURI(t).replace(sn.percentDecode,"%")}catch{return null}return t}function DS(t,e){var i;let n=t.replace(sn.findPipe,(o,l,a)=>{let u=!1,c=l;for(;--c>=0&&a[c]==="\\";)u=!u;return u?"|":" |"}),r=n.split(sn.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(sn.slashPipe,"|");return r}function Ba(t,e,n){let r=t.length;if(r===0)return"";let s=0;for(;s<r&&t.charAt(r-s-1)===e;)s++;return t.slice(0,r-s)}function eq(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function LS(t,e,n,r,s){let i=e.href,o=e.title||null,l=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;let a={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,a}function tq(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
487
- `).map(i=>{let o=i.match(n.other.beginningSpace);if(o===null)return i;let[l]=o;return l.length>=s.length?i.slice(s.length):i}).join(`
488
- `)}var Th=class{constructor(t){qe(this,"options");qe(this,"rules");qe(this,"lexer");this.options=t||Ho}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Ba(n,`
489
- `)}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=tq(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=Ba(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Ba(e[0],`
490
- `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Ba(e[0],`
491
- `).split(`
492
- `),r="",s="",i=[];for(;n.length>0;){let o=!1,l=[],a;for(a=0;a<n.length;a++)if(this.rules.other.blockquoteStart.test(n[a]))l.push(n[a]),o=!0;else if(!o)l.push(n[a]);else break;n=n.slice(a);let u=l.join(`
493
- `),c=u.replace(this.rules.other.blockquoteSetextReplace,`
494
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
495
- ${u}`:u,s=s?`${s}
496
- ${c}`:c;let d=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=d,n.length===0)break;let f=i.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let h=f,p=h.raw+`
497
- `+n.join(`
498
- `),m=this.blockquote(p);i[i.length-1]=m,r=r.substring(0,r.length-h.raw.length)+m.raw,s=s.substring(0,s.length-h.text.length)+m.text;break}else if((f==null?void 0:f.type)==="list"){let h=f,p=h.raw+`
499
- `+n.join(`
500
- `),m=this.list(p);i[i.length-1]=m,r=r.substring(0,r.length-f.raw.length)+m.raw,s=s.substring(0,s.length-h.raw.length)+m.raw,n=p.substring(i.at(-1).raw.length).split(`
501
- `);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){var n,r;let e=this.rules.block.list.exec(t);if(e){let s=e[1].trim(),i=s.length>1,o={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let l=this.rules.other.listItemRegex(s),a=!1;for(;t;){let c=!1,d="",f="";if(!(e=l.exec(t))||this.rules.block.hr.test(t))break;d=e[0],t=t.substring(d.length);let h=e[2].split(`
502
- `,1)[0].replace(this.rules.other.listReplaceTabs,g=>" ".repeat(3*g.length)),p=t.split(`
503
- `,1)[0],m=!h.trim(),y=0;if(this.options.pedantic?(y=2,f=h.trimStart()):m?y=e[1].length+1:(y=e[2].search(this.rules.other.nonSpaceChar),y=y>4?1:y,f=h.slice(y),y+=e[1].length),m&&this.rules.other.blankLine.test(p)&&(d+=p+`
504
- `,t=t.substring(p.length+1),c=!0),!c){let g=this.rules.other.nextBulletRegex(y),x=this.rules.other.hrRegex(y),k=this.rules.other.fencesBeginRegex(y),b=this.rules.other.headingBeginRegex(y),S=this.rules.other.htmlBeginRegex(y);for(;t;){let C=t.split(`
505
- `,1)[0],E;if(p=C,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),E=p):E=p.replace(this.rules.other.tabCharGlobal," "),k.test(p)||b.test(p)||S.test(p)||g.test(p)||x.test(p))break;if(E.search(this.rules.other.nonSpaceChar)>=y||!p.trim())f+=`
506
- `+E.slice(y);else{if(m||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||k.test(h)||b.test(h)||x.test(h))break;f+=`
507
- `+p}!m&&!p.trim()&&(m=!0),d+=C+`
508
- `,t=t.substring(C.length+1),h=E.slice(y)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(a=!0)),o.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(f),loose:!1,text:f,tokens:[]}),o.raw+=d}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let c of o.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),((n=c.tokens[0])==null?void 0:n.type)==="text"||((r=c.tokens[0])==null?void 0:r.type)==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(c.raw);if(d){let f={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};c.checked=f.checked,o.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=f.raw+c.tokens[0].raw,c.tokens[0].text=f.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(f)):c.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):c.tokens.unshift(f)}}if(!o.loose){let d=c.tokens.filter(h=>h.type==="space"),f=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));o.loose=f}}if(o.loose)for(let c of o.items){c.loose=!0;for(let d of c.tokens)d.type==="text"&&(d.type="paragraph")}return o}}html(t){let e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:s}}}table(t){var o;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=DS(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
509
- `):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let l of r)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<n.length;l++)i.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:i.align[l]});for(let l of s)i.rows.push(DS(l,i.header.length).map((a,u)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[u]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
510
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=Ba(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=eq(e[2],"()");if(i===-2)return;if(i>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),LS(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return LS(n,s,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let s=[...r[0]].length-1,i,o,l=s,a=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+s);(r=u.exec(e))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(o=[...i].length,r[3]||r[4]){l+=o;continue}else if((r[5]||r[6])&&s%3&&!((s+o)%3)){a+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+a);let c=[...r[0]][0].length,d=t.slice(0,s+r.index+c+o);if(Math.min(s,o)%2){let h=d.slice(1,-1);return{type:"em",raw:d,text:h,tokens:this.lexer.inlineTokens(h)}}let f=d.slice(2,-2);return{type:"strong",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){let e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let i;do i=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(i!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},hr=class wv{constructor(e){qe(this,"tokens");qe(this,"options");qe(this,"state");qe(this,"inlineQueue");qe(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ho,this.options.tokenizer=this.options.tokenizer||new Th,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:sn,block:bd.normal,inline:Fa.normal};this.options.pedantic?(n.block=bd.pedantic,n.inline=Fa.pedantic):this.options.gfm&&(n.block=bd.gfm,this.options.breaks?n.inline=Fa.breaks:n.inline=Fa.gfm),this.tokenizer.rules=n}static get rules(){return{block:bd,inline:Fa}}static lex(e,n){return new wv(n).lex(e)}static lexInline(e,n){return new wv(n).inlineTokens(e)}lex(e){e=e.replace(sn.carriageReturn,`
511
- `),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){var s,i,o;for(this.options.pedantic&&(e=e.replace(sn.tabCharGlobal," ").replace(sn.spaceLine,""));e;){let l;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(u=>(l=u.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(e)){e=e.substring(l.raw.length);let u=n.at(-1);l.raw.length===1&&u!==void 0?u.raw+=`
512
- `:n.push(l);continue}if(l=this.tokenizer.code(e)){e=e.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
513
- `)?"":`
514
- `)+l.raw,u.text+=`
515
- `+l.text,this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(l=this.tokenizer.fences(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.heading(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.hr(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.blockquote(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.list(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.html(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.def(e)){e=e.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
516
- `)?"":`
517
- `)+l.raw,u.text+=`
518
- `+l.raw,this.inlineQueue.at(-1).src=u.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},n.push(l));continue}if(l=this.tokenizer.table(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(e)){e=e.substring(l.raw.length),n.push(l);continue}let a=e;if((o=this.options.extensions)!=null&&o.startBlock){let u=1/0,c=e.slice(1),d;this.options.extensions.startBlock.forEach(f=>{d=f.call({lexer:this},c),typeof d=="number"&&d>=0&&(u=Math.min(u,d))}),u<1/0&&u>=0&&(a=e.substring(0,u+1))}if(this.state.top&&(l=this.tokenizer.paragraph(a))){let u=n.at(-1);r&&(u==null?void 0:u.type)==="paragraph"?(u.raw+=(u.raw.endsWith(`
519
- `)?"":`
520
- `)+l.raw,u.text+=`
521
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l),r=a.length!==e.length,e=e.substring(l.raw.length);continue}if(l=this.tokenizer.text(e)){e=e.substring(l.raw.length);let u=n.at(-1);(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
522
- `)?"":`
523
- `)+l.raw,u.text+=`
524
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=u.text):n.push(l);continue}if(e){let u="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var a,u,c,d,f;let r=e,s=null;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)h.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)i=s[2]?s[2].length:0,r=r.slice(0,s.index+i)+"["+"a".repeat(s[0].length-i-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((u=(a=this.options.hooks)==null?void 0:a.emStrongMask)==null?void 0:u.call({lexer:this},r))??r;let o=!1,l="";for(;e;){o||(l=""),o=!1;let h;if((d=(c=this.options.extensions)==null?void 0:c.inline)!=null&&d.some(m=>(h=m.call({lexer:this},e,n))?(e=e.substring(h.raw.length),n.push(h),!0):!1))continue;if(h=this.tokenizer.escape(e)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.tag(e)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.link(e)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(h.raw.length);let m=n.at(-1);h.type==="text"&&(m==null?void 0:m.type)==="text"?(m.raw+=h.raw,m.text+=h.text):n.push(h);continue}if(h=this.tokenizer.emStrong(e,r,l)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.codespan(e)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.br(e)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.del(e)){e=e.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.autolink(e)){e=e.substring(h.raw.length),n.push(h);continue}if(!this.state.inLink&&(h=this.tokenizer.url(e))){e=e.substring(h.raw.length),n.push(h);continue}let p=e;if((f=this.options.extensions)!=null&&f.startInline){let m=1/0,y=e.slice(1),g;this.options.extensions.startInline.forEach(x=>{g=x.call({lexer:this},y),typeof g=="number"&&g>=0&&(m=Math.min(m,g))}),m<1/0&&m>=0&&(p=e.substring(0,m+1))}if(h=this.tokenizer.inlineText(p)){e=e.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(l=h.raw.slice(-1)),o=!0;let m=n.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=h.raw,m.text+=h.text):n.push(h);continue}if(e){let m="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return n}},Rh=class{constructor(t){qe(this,"options");qe(this,"parser");this.options=t||Ho}space(t){return""}code({text:t,lang:e,escaped:n}){var i;let r=(i=(e||"").match(sn.notSpaceStart))==null?void 0:i[0],s=t.replace(sn.endingNewline,"")+`
525
- `;return r?'<pre><code class="language-'+ss(r)+'">'+(n?s:ss(s,!0))+`</code></pre>
526
- `:"<pre><code>"+(n?s:ss(s,!0))+`</code></pre>
527
- `}blockquote({tokens:t}){return`<blockquote>
528
- ${this.parser.parse(t)}</blockquote>
529
- `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
530
- `}hr(t){return`<hr>
531
- `}list(t){let e=t.ordered,n=t.start,r="";for(let o=0;o<t.items.length;o++){let l=t.items[o];r+=this.listitem(l)}let s=e?"ol":"ul",i=e&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
532
- `+r+"</"+s+`>
533
- `}listitem(t){return`<li>${this.parser.parse(t.tokens)}</li>
534
- `}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
535
- `}table(t){let e="",n="";for(let s=0;s<t.header.length;s++)n+=this.tablecell(t.header[s]);e+=this.tablerow({text:n});let r="";for(let s=0;s<t.rows.length;s++){let i=t.rows[s];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
536
- <thead>
537
- `+e+`</thead>
538
- `+r+`</table>
539
- `}tablerow({text:t}){return`<tr>
540
- ${t}</tr>
541
- `}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
542
- `}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${ss(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),s=IS(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+ss(e)+'"'),i+=">"+r+"</a>",i}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let s=IS(t);if(s===null)return ss(n);t=s;let i=`<img src="${t}" alt="${n}"`;return e&&(i+=` title="${ss(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:ss(t.text)}},Kx=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},pr=class kv{constructor(e){qe(this,"options");qe(this,"renderer");qe(this,"textRenderer");this.options=e||Ho,this.options.renderer=this.options.renderer||new Rh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Kx}static parse(e,n){return new kv(n).parse(e)}static parseInline(e,n){return new kv(n).parseInline(e)}parse(e){var r,s;let n="";for(let i=0;i<e.length;i++){let o=e[i];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[o.type]){let a=o,u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){n+=u||"";continue}}let l=o;switch(l.type){case"space":{n+=this.renderer.space(l);break}case"hr":{n+=this.renderer.hr(l);break}case"heading":{n+=this.renderer.heading(l);break}case"code":{n+=this.renderer.code(l);break}case"table":{n+=this.renderer.table(l);break}case"blockquote":{n+=this.renderer.blockquote(l);break}case"list":{n+=this.renderer.list(l);break}case"checkbox":{n+=this.renderer.checkbox(l);break}case"html":{n+=this.renderer.html(l);break}case"def":{n+=this.renderer.def(l);break}case"paragraph":{n+=this.renderer.paragraph(l);break}case"text":{n+=this.renderer.text(l);break}default:{let a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,n=this.renderer){var s,i;let r="";for(let o=0;o<e.length;o++){let l=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[l.type]){let u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=u||"";continue}}let a=l;switch(a.type){case"escape":{r+=n.text(a);break}case"html":{r+=n.html(a);break}case"link":{r+=n.link(a);break}case"image":{r+=n.image(a);break}case"checkbox":{r+=n.checkbox(a);break}case"strong":{r+=n.strong(a);break}case"em":{r+=n.em(a);break}case"codespan":{r+=n.codespan(a);break}case"br":{r+=n.br(a);break}case"del":{r+=n.del(a);break}case"text":{r+=n.text(a);break}default:{let u='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},Cd,nu=(Cd=class{constructor(t){qe(this,"options");qe(this,"block");this.options=t||Ho}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(){return this.block?hr.lex:hr.lexInline}provideParser(){return this.block?pr.parse:pr.parseInline}},qe(Cd,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),qe(Cd,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Cd),nq=class{constructor(...t){qe(this,"defaults",Fx());qe(this,"options",this.setOptions);qe(this,"parse",this.parseMarkdown(!0));qe(this,"parseInline",this.parseMarkdown(!1));qe(this,"Parser",pr);qe(this,"Renderer",Rh);qe(this,"TextRenderer",Kx);qe(this,"Lexer",hr);qe(this,"Tokenizer",Th);qe(this,"Hooks",nu);this.use(...t)}walkTokens(t,e){var r,s;let n=[];for(let i of t)switch(n=n.concat(e.call(this,i)),i.type){case"table":{let o=i;for(let l of o.header)n=n.concat(this.walkTokens(l.tokens,e));for(let l of o.rows)for(let a of l)n=n.concat(this.walkTokens(a.tokens,e));break}case"list":{let o=i;n=n.concat(this.walkTokens(o.items,e));break}default:{let o=i;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let a=o[l].flat(1/0);n=n.concat(this.walkTokens(a,e))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let l=s.renderer.apply(this,o);return l===!1&&(l=i.apply(this,o)),l}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){let s=this.defaults.renderer||new Rh(this.defaults);for(let i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,l=n.renderer[o],a=s[o];s[o]=(...u)=>{let c=l.apply(s,u);return c===!1&&(c=a.apply(s,u)),c||""}}r.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new Th(this.defaults);for(let i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,l=n.tokenizer[o],a=s[o];s[o]=(...u)=>{let c=l.apply(s,u);return c===!1&&(c=a.apply(s,u)),c}}r.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new nu;for(let i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,l=n.hooks[o],a=s[o];nu.passThroughHooks.has(i)?s[o]=u=>{if(this.defaults.async&&nu.passThroughHooksRespectAsync.has(i))return(async()=>{let d=await l.call(s,u);return a.call(s,d)})();let c=l.call(s,u);return a.call(s,c)}:s[o]=(...u)=>{if(this.defaults.async)return(async()=>{let d=await l.apply(s,u);return d===!1&&(d=await a.apply(s,u)),d})();let c=l.apply(s,u);return c===!1&&(c=a.apply(s,u)),c}}r.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let l=[];return l.push(i.call(this,o)),s&&(l=l.concat(s.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return hr.lex(t,e??this.defaults)}parser(t,e){return pr.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},s={...this.defaults,...r},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(e):e,l=await(s.hooks?await s.hooks.provideLexer():t?hr.lex:hr.lexInline)(o,s),a=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(a,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser():t?pr.parse:pr.parseInline)(a,s);return s.hooks?await s.hooks.postprocess(u):u})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer():t?hr.lex:hr.lexInline)(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let l=(s.hooks?s.hooks.provideParser():t?pr.parse:pr.parseInline)(o,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(o){return i(o)}}}onError(t,e){return n=>{if(n.message+=`
543
- Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+ss(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Do=new nq;function He(t,e){return Do.parse(t,e)}He.options=He.setOptions=function(t){return Do.setOptions(t),He.defaults=Do.defaults,$A(He.defaults),He};He.getDefaults=Fx;He.defaults=Ho;He.use=function(...t){return Do.use(...t),He.defaults=Do.defaults,$A(He.defaults),He};He.walkTokens=function(t,e){return Do.walkTokens(t,e)};He.parseInline=Do.parseInline;He.Parser=pr;He.parser=pr.parse;He.Renderer=Rh;He.TextRenderer=Kx;He.Lexer=hr;He.lexer=hr.lex;He.Tokenizer=Th;He.Hooks=nu;He.parse=He;He.options;He.setOptions;He.use;He.walkTokens;He.parseInline;pr.parse;hr.lex;function rq(t,e){const r=e.split(`
544
- `).flatMap(s=>[s,""]).map(s=>`${t}${s}`).join(`
545
- `);return r.slice(0,r.length-1)}function sq(t,e){const n=[];return Array.from(t.keys()).forEach(r=>{(!e||!e.marks||!e.marks.map(s=>s.type).includes(r))&&n.push(r)}),n}function iq(t,e){const n=[];return Array.from(e.entries()).forEach(([r,s])=>{t.has(r)||n.push({type:r,mark:s})}),n}function oq(t,e,n,r){const s=!n,i=n&&n.type==="text"&&(!n.marks||n.marks.length===0),o=n&&n.type==="text"&&n.marks&&!r(e,new Map(n.marks.map(a=>[a.type,a]))),l=[];if(s||i||o)if(n&&n.type==="text"&&n.marks){const a=new Map(n.marks.map(u=>[u.type,u]));Array.from(t.keys()).forEach(u=>{a.has(u)||l.push(u)})}else(s||i)&&l.push(...Array.from(t.keys()));return l}function lq(t,e){let n="";return Array.from(t.keys()).reverse().forEach(r=>{const s=t.get(r),i=e(r,s);i&&(n=i+n)}),t.clear(),n}function aq(t,e,n){let r="";return Array.from(t.entries()).forEach(([s,i])=>{const o=n(s,i);o&&(r+=o),e.set(s,i)}),r}function og(t){const n=(t.raw||t.text||"").match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);return n?{isTask:!0,checked:n[2].toLowerCase()==="x",indentLevel:n[1].length}:{isTask:!1,indentLevel:0}}function Sd(t,e){return typeof t!="string"?"json":e}var uq=class{constructor(t){this.baseExtensions=[],this.extensions=[],this.lastParseResult=null;var e,n,r,s,i;this.markedInstance=(e=t==null?void 0:t.marked)!=null?e:He,this.lexer=new this.markedInstance.Lexer,this.indentStyle=(r=(n=t==null?void 0:t.indentation)==null?void 0:n.style)!=null?r:"space",this.indentSize=(i=(s=t==null?void 0:t.indentation)==null?void 0:s.size)!=null?i:2,this.baseExtensions=(t==null?void 0:t.extensions)||[],t!=null&&t.markedOptions&&typeof this.markedInstance.setOptions=="function"&&this.markedInstance.setOptions(t.markedOptions),this.registry=new Map,this.nodeTypeRegistry=new Map,t!=null&&t.extensions&&(this.baseExtensions=t.extensions,hp(t.extensions).forEach(l=>this.registerExtension(l,!1))),this.lexer=new this.markedInstance.Lexer}get instance(){return this.markedInstance}get indentCharacter(){return this.indentStyle==="space"?" ":" "}get indentString(){return this.indentCharacter.repeat(this.indentSize)}hasMarked(){return!!this.markedInstance}registerExtension(t,e=!0){var n,r;this.extensions.push(t);const s=t.name,i=re(t,"markdownTokenName")||s,o=re(t,"parseMarkdown"),l=re(t,"renderMarkdown"),a=re(t,"markdownTokenizer"),u=(n=re(t,"markdownOptions"))!=null?n:null,c=(r=u==null?void 0:u.indentsContent)!=null?r:!1,d={tokenName:i,nodeName:s,parseMarkdown:o,renderMarkdown:l,isIndenting:c,tokenizer:a};if(i&&o){const f=this.registry.get(i)||[];f.push(d),this.registry.set(i,f)}if(l){const f=this.nodeTypeRegistry.get(s)||[];f.push(d),this.nodeTypeRegistry.set(s,f)}a&&this.hasMarked()&&(this.registerTokenizer(a),e&&(this.lexer=new this.markedInstance.Lexer))}registerTokenizer(t){if(!this.hasMarked())return;const{name:e,start:n,level:r="inline",tokenize:s}=t,l={inlineTokens:c=>this.lexer.inlineTokens(c),blockTokens:c=>this.lexer.blockTokens(c)};let a;n?a=typeof n=="function"?n:c=>c.indexOf(n):a=c=>{const d=s(c,[],l);return d&&d.raw?c.indexOf(d.raw):-1};const u={name:e,level:r,start:a,tokenizer:(c,d)=>{const f=s(c,d,l);if(f&&f.type)return{...f,type:f.type||e,raw:f.raw||"",tokens:f.tokens||[]}},childTokens:[]};this.markedInstance.use({extensions:[u]})}getHandlersForToken(t){try{return this.registry.get(t)||[]}catch{return[]}}getHandlerForToken(t){const e=this.getHandlersForToken(t);if(e.length>0)return e[0];const n=this.getHandlersForNodeType(t);return n.length>0?n[0]:void 0}getHandlersForNodeType(t){try{return this.nodeTypeRegistry.get(t)||[]}catch{return[]}}serialize(t){return t?Array.isArray(t)?this.renderNodes(t,t):this.renderNodes(t,t):""}parse(t){if(!this.hasMarked())throw new Error("No marked instance available for parsing");const e=this.markedInstance.lexer(t);return{type:"doc",content:this.parseTokens(e)}}parseTokens(t){return t.map(e=>this.parseToken(e)).filter(e=>e!==null).flatMap(e=>Array.isArray(e)?e:[e])}parseToken(t){if(!t.type)return null;if(t.type==="list")return this.parseListToken(t);const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(s=>{if(!s.parseMarkdown)return!1;const i=s.parseMarkdown(t,n),o=this.normalizeParseResult(i);return o&&(!Array.isArray(o)||o.length>0)?(this.lastParseResult=o,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}return this.parseFallbackToken(t)}parseListToken(t){if(!t.items||t.items.length===0)return this.parseTokenWithHandlers(t);const e=t.items.some(l=>og(l).isTask),n=t.items.some(l=>!og(l).isTask);if(!e||!n||this.getHandlersForToken("taskList").length===0)return this.parseTokenWithHandlers(t);const r=[];let s=[],i=null;for(let l=0;l<t.items.length;l+=1){const a=t.items[l],{isTask:u,checked:c,indentLevel:d}=og(a);let f=a;if(u){const m=(a.raw||a.text||"").split(`
546
- `),y=m[0].match(/^\s*[-+*]\s+\[([ xX])\]\s+(.*)$/),g=y?y[2]:"";let x=[];if(m.length>1&&m.slice(1).join(`
547
- `).trim()){const b=m.slice(1),S=b.filter(C=>C.trim());if(S.length>0){const C=Math.min(...S.map(N=>N.length-N.trimStart().length)),T=b.map(N=>N.trim()?N.slice(C):"").join(`
548
- `).trim();T&&(x=this.markedInstance.lexer(`${T}
549
- `))}}f={type:"taskItem",raw:"",mainContent:g,indentLevel:d,checked:c??!1,text:g,tokens:this.lexer.inlineTokens(g),nestedTokens:x}}const h=u?"taskList":"list";i!==h?(s.length>0&&r.push({type:i,items:s}),s=[f],i=h):s.push(f)}s.length>0&&r.push({type:i,items:s});const o=[];for(let l=0;l<r.length;l+=1){const a=r[l],u={...t,type:a.type,items:a.items},c=this.parseToken(u);c&&(Array.isArray(c)?o.push(...c):o.push(c))}return o.length>0?o:null}parseTokenWithHandlers(t){if(!t.type)return null;const e=this.getHandlersForToken(t.type),n=this.createParseHelpers();if(e.find(s=>{if(!s.parseMarkdown)return!1;const i=s.parseMarkdown(t,n),o=this.normalizeParseResult(i);return o&&(!Array.isArray(o)||o.length>0)?(this.lastParseResult=o,!0):!1})&&this.lastParseResult){const s=this.lastParseResult;return this.lastParseResult=null,s}return this.parseFallbackToken(t)}createParseHelpers(){return{parseInline:t=>this.parseInlineTokens(t),parseChildren:t=>this.parseTokens(t),createTextNode:(t,e)=>({type:"text",text:t,marks:e||void 0}),createNode:(t,e,n)=>{const r={type:t,attrs:e||void 0,content:n||void 0};return(!e||Object.keys(e).length===0)&&delete r.attrs,r},applyMark:(t,e,n)=>({mark:t,content:e,attrs:n&&Object.keys(n).length>0?n:void 0})}}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}parseInlineTokens(t){var e,n,r,s;const i=[];for(let o=0;o<t.length;o+=1){const l=t[o];if(l.type==="text")i.push({type:"text",text:l.text||""});else if(l.type==="html"){const a=((n=(e=l.raw)!=null?e:l.text)!=null?n:"").toString(),u=/^<\/[\s]*[\w-]+/i.test(a),c=a.match(/^<[\s]*([\w-]+)(\s|>|\/|$)/i);if(!u&&c&&!/\/>$/.test(a)){const f=c[1],h=this.escapeRegex(f),p=new RegExp(`^<\\/\\s*${h}\\b`,"i");let m=-1;const y=[a];for(let g=o+1;g<t.length;g+=1){const x=t[g],k=((s=(r=x.raw)!=null?r:x.text)!=null?s:"").toString();if(y.push(k),x.type==="html"&&p.test(k)){m=g;break}}if(m!==-1){const g=y.join(""),x={type:"html",raw:g,text:g,block:!1},k=this.parseHTMLToken(x);if(k){const b=this.normalizeParseResult(k);Array.isArray(b)?i.push(...b):b&&i.push(b)}o=m;continue}}const d=this.parseHTMLToken(l);if(d){const f=this.normalizeParseResult(d);Array.isArray(f)?i.push(...f):f&&i.push(f)}}else if(l.type){const a=this.getHandlerForToken(l.type);if(a&&a.parseMarkdown){const u=this.createParseHelpers(),c=a.parseMarkdown(l,u);if(this.isMarkResult(c)){const d=this.applyMarkToContent(c.mark,c.content,c.attrs);i.push(...d)}else{const d=this.normalizeParseResult(c);Array.isArray(d)?i.push(...d):d&&i.push(d)}}else l.tokens&&i.push(...this.parseInlineTokens(l.tokens))}}return i}applyMarkToContent(t,e,n){return e.map(r=>{if(r.type==="text"){const s=r.marks||[],i=n?{type:t,attrs:n}:{type:t};return{...r,marks:[...s,i]}}return{...r,content:r.content?this.applyMarkToContent(t,r.content,n):void 0}})}isMarkResult(t){return t&&typeof t=="object"&&"mark"in t}normalizeParseResult(t){return t?this.isMarkResult(t)?t.content:t:null}parseFallbackToken(t){switch(t.type){case"paragraph":return{type:"paragraph",content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"heading":return{type:"heading",attrs:{level:t.depth||1},content:t.tokens?this.parseInlineTokens(t.tokens):[]};case"text":return{type:"text",text:t.text||""};case"html":return this.parseHTMLToken(t);case"space":return null;default:return t.tokens?this.parseTokens(t.tokens):null}}parseHTMLToken(t){const e=t.text||t.raw||"";if(!e.trim())return null;if(typeof window>"u")return t.block?{type:"paragraph",content:[{type:"text",text:e}]}:{type:"text",text:e};try{const n=UH(e,this.baseExtensions);return n.type==="doc"&&n.content?t.block?n.content:n.content.length===1&&n.content[0].type==="paragraph"&&n.content[0].content?n.content[0].content:n.content:n}catch(n){throw new Error(`Failed to parse HTML in markdown: ${n}`)}}renderNodeToMarkdown(t,e,n=0,r=0){var s;if(t.type==="text")return t.text||"";if(!t.type)return"";const i=this.getHandlerForToken(t.type);if(!i)return"";const o={renderChildren:(u,c)=>{const d=i.isIndenting?r+1:r;return!Array.isArray(u)&&u.content?this.renderNodes(u.content,t,c||"",n,d):this.renderNodes(u,t,c||"",n,d)},indent:u=>this.indentString+u,wrapInBlock:rq},l={index:n,level:r,parentType:e==null?void 0:e.type,meta:{parentAttrs:e==null?void 0:e.attrs}};return((s=i.renderMarkdown)==null?void 0:s.call(i,t,o,l))||""}renderNodes(t,e,n="",r=0,s=0){return Array.isArray(t)?this.renderNodesWithMarkBoundaries(t,e,n,s):t.type?this.renderNodeToMarkdown(t,e,r,s):""}renderNodesWithMarkBoundaries(t,e,n="",r=0){const s=[],i=new Map;return t.forEach((o,l)=>{const a=l<t.length-1?t[l+1]:null;if(o.type)if(o.type==="text"){let u=o.text||"";const c=new Map((o.marks||[]).map(g=>[g.type,g])),d=iq(i,c),f=sq(c,a);let h="";if(f.length>0){const g=u.match(/(\s+)$/);g&&(h=g[1],u=u.slice(0,-h.length))}f.forEach(g=>{const x=c.get(g),k=this.getMarkClosing(g,x);k&&(u+=k),i.has(g)&&i.delete(g)});let p="";if(d.length>0){const g=u.match(/^(\s+)/);g&&(p=g[1],u=u.slice(p.length))}d.forEach(({type:g,mark:x})=>{const k=this.getMarkOpening(g,x);k&&(u=k+u),f.includes(g)||i.set(g,x)}),u=p+u;const m=oq(i,c,a,this.markSetsEqual.bind(this));let y="";if(m.length>0){const g=u.match(/(\s+)$/);g&&(y=g[1],u=u.slice(0,-y.length))}m.forEach(g=>{const x=i.get(g),k=this.getMarkClosing(g,x);k&&(u+=k),i.delete(g)}),u+=y,u+=h,s.push(u)}else{const u=new Map(i),c=lq(i,this.getMarkClosing.bind(this)),d=this.renderNodeToMarkdown(o,e,l,r),f=o.type==="hardBreak"?"":aq(u,i,this.getMarkOpening.bind(this));s.push(c+d+f)}}),s.join(n)}getMarkOpening(t,e){const n=this.getHandlersForNodeType(t),r=n.length>0?n[0]:void 0;if(!r||!r.renderMarkdown)return"";const s="__TIPTAP_MARKDOWN_PLACEHOLDER__",i={type:t,attrs:e.attrs||{},content:[{type:"text",text:s}]};try{const o=r.renderMarkdown(i,{renderChildren:()=>s,indent:a=>a,wrapInBlock:(a,u)=>a+u},{index:0,level:0,parentType:"text",meta:{}}),l=o.indexOf(s);return l>=0?o.substring(0,l):""}catch(o){throw new Error(`Failed to get mark opening for ${t}: ${o}`)}}getMarkClosing(t,e){const n=this.getHandlersForNodeType(t),r=n.length>0?n[0]:void 0;if(!r||!r.renderMarkdown)return"";const s="__TIPTAP_MARKDOWN_PLACEHOLDER__",i={type:t,attrs:e.attrs||{},content:[{type:"text",text:s}]};try{const o=r.renderMarkdown(i,{renderChildren:()=>s,indent:u=>u,wrapInBlock:(u,c)=>u+c},{index:0,level:0,parentType:"text",meta:{}}),l=o.indexOf(s),a=l+s.length;return l>=0?o.substring(a):""}catch(o){throw new Error(`Failed to get mark closing for ${t}: ${o}`)}}markSetsEqual(t,e){return t.size!==e.size?!1:Array.from(t.keys()).every(n=>e.has(n))}},jS=uq,cq=st.create({name:"markdown",addOptions(){return{indentation:{style:"space",size:2},marked:void 0,markedOptions:{}}},addCommands(){return{setContent:(t,e)=>{if(!(e!=null&&e.contentType)||Sd(t,e==null?void 0:e.contentType)!=="markdown"||!this.editor.markdown)return lr.setContent(t,e);const r=this.editor.markdown.parse(t);return lr.setContent(r,e)},insertContent:(t,e)=>{if(!(e!=null&&e.contentType)||Sd(t,e==null?void 0:e.contentType)!=="markdown"||!this.editor.markdown)return lr.insertContent(t,e);const r=this.editor.markdown.parse(t);return lr.insertContent(r,e)},insertContentAt:(t,e,n)=>{if(!(n!=null&&n.contentType)||Sd(e,n==null?void 0:n.contentType)!=="markdown"||!this.editor.markdown)return lr.insertContentAt(t,e,n);const s=this.editor.markdown.parse(e);return lr.insertContentAt(t,s,n)}}},addStorage(){return{manager:new jS({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:[]})}},onBeforeCreate(){if(this.editor.markdown){console.error("[tiptap][markdown]: There is already a `markdown` property on the editor instance. This might lead to unexpected behavior.");return}if(this.storage.manager=new jS({indentation:this.options.indentation,marked:this.options.marked,markedOptions:this.options.markedOptions,extensions:this.editor.extensionManager.baseExtensions}),this.editor.markdown=this.storage.manager,this.editor.getMarkdown=()=>this.storage.manager.serialize(this.editor.getJSON()),!this.editor.options.contentType||Sd(this.editor.options.content,this.editor.options.contentType)!=="markdown")return;if(!this.editor.markdown)throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the Markdown extension is not added to the editor. Please add the Markdown extension to use this feature.');if(this.editor.options.content===void 0||typeof this.editor.options.content!="string")throw new Error('[tiptap][markdown]: The `contentType` option is set to "markdown", but the initial content is not a string. Please provide the initial content as a markdown string.');const e=this.editor.markdown.parse(this.editor.options.content);this.editor.options.content=e}});function dq(){const t=nW({extensions:[x8.configure({codeBlock:{languageClassPrefix:"language-"}}),cq.configure({markedOptions:{breaks:!0}})],content:"",editorProps:{attributes:{class:"h-full min-h-0 w-full border border-input bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2"}}}),e=v.useCallback(()=>{if(!t)return"";const r=t;return r.getMarkdown?r.getMarkdown():""},[t]),n=v.useCallback(r=>{if(!t)return;const s=t;if(s.markdown){const i=s.markdown.parse(r);t.commands.setContent(i,{emitUpdate:!1})}else t.commands.setContent(r,{emitUpdate:!1})},[t]);return{editor:t,getMarkdownFromEditor:e,setMarkdownInEditor:n}}const fq=({editor:t,active:e,content:n,setIsDirty:r,setLastEditAt:s,setMarkdownInEditor:i,pendingNormalizeRef:o,lastEditorContentRef:l})=>{v.useEffect(()=>{t&&(!e||e.type!=="markdown"||n&&l.current!==n&&(i(n),l.current=n,o.current=!0))},[e,n,t,l,o,i]),v.useEffect(()=>{if(!t||!e||e.type!=="markdown")return;const a=()=>{if(o.current){o.current=!1,r(!1);return}s(Date.now()),r(!0)};return t.on("update",a),()=>{t.off("update",a)}},[e,t,o,r,s])},$S=({open:t,setOpen:e,ref:n})=>{v.useEffect(()=>{if(!t)return;const r=i=>{n.current&&(n.current.contains(i.target)||e(!1))},s=i=>{i.key==="Escape"&&e(!1)};return document.addEventListener("mousedown",r),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",s)}},[t,n,e])},hq="/api",pq=async()=>{const t=await fetch(`${hq}/tags`);if(!t.ok)throw new Error(t.statusText);const e=await t.json();return!e||!Array.isArray(e.tags)?[]:[...new Set(e.tags)].sort()},mq=()=>{const t=Kh(),e=C0({queryKey:["tags"],queryFn:pq,refetchInterval:1e4,refetchOnWindowFocus:!1}),n=v.useMemo(()=>e.data??[],[e.data]),r=v.useMemo(()=>e.error?String(e.error):"",[e.error]),s=v.useCallback(()=>{t.invalidateQueries({queryKey:["tags"]}).catch(()=>{})},[t]);return{tags:n,errorMessage:r,invalidateTags:s}},rl="/api",gq=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`client_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,yq=()=>typeof crypto<"u"&&"randomUUID"in crypto?`hyperdoc-${crypto.randomUUID()}`:`hyperdoc-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;function vq(){const[t,e]=v.useState(null),[n,r]=v.useState(""),[s,i]=v.useState(""),[o,l]=v.useState(""),a=v.useRef(!1),u=v.useRef(""),c=v.useRef(""),[d,f]=v.useState("idle"),h=v.useRef(null),p=v.useRef(null),m=v.useRef(null),[y,g]=v.useState(null),[x,k]=v.useState(""),[b,S]=v.useState(!1),[C,E]=v.useState(!1),[T,N]=v.useState(""),[O,H]=v.useState("markdown"),[ne,ae]=v.useState(!1),[Q,le]=v.useState(""),[se,ye]=v.useState("text"),[M,V]=v.useState(""),[ie,Ee]=v.useState(""),[P,q]=v.useState("app"),[G,K]=v.useState(!1),[j,F]=v.useState(!1),[xe,Y]=v.useState(null),[Se,we]=v.useState(""),[Ie,Vt]=v.useState([]),[Et,bn]=v.useState([]),[jn,Kr]=v.useState(""),[Ke,Sa]=v.useState([]),[Ec,rr]=v.useState(!1),[wt,Jr]=v.useState([]),[Er,Uo]=v.useState(""),[Ca,Bi]=v.useState(""),Sn=vT(),Tc=v.useRef(null),_=v.useRef(null),I=v.useRef(null),pe=v.useRef(!1),Ce=v.useRef(gq()),[be,pt]=v.useState(null),[Yt,JA]=v.useState(null),{open:Jx,setOpen:Vi}=hW(),Qx=v.useMemo(()=>dW(),[]),{editor:Tr,getMarkdownFromEditor:Wo,setMarkdownInEditor:Rp}=dq(),Zx=Kh(),{docs:Rc,docsQuery:Mp,updateDocsCache:sr,invalidateDocs:QA}=tR(),{tags:qo,errorMessage:Yx,invalidateTags:Np}=mq(),{encodePath:Go}=mW({docs:Rc,active:t,setActive:e,status:s,setStatus:i});v.useEffect(()=>{Mp.error&&i(String(Mp.error))},[Mp.error]);const Xx=v.useCallback(A=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(A)==="1"}catch{return!1}},[]),ew=v.useCallback((A,L)=>O2(A,L),[]),tw=v.useCallback(A=>A2(A),[]),Hi=v.useCallback((A,L)=>ew(A,L),[ew]),Mc=v.useCallback(A=>{const L=A.trim().toLowerCase();return!L||!/^[a-z]+$/.test(L)?"":L},[]),Op=v.useCallback(async A=>{const L=await fetch(`${rl}/doc/${encodeURIComponent(A)}`,{cache:"no-store"});if(!L.ok)throw new Error(L.statusText);return(L.headers.get("content-type")??"").includes("application/json")?await L.json():{content:await L.text()}},[]),Ko=C0({queryKey:["doc",t==null?void 0:t.name],queryFn:()=>Op((t==null?void 0:t.name)??""),enabled:!!(t!=null&&t.name),refetchInterval:!1,refetchOnWindowFocus:!1});v.useEffect(()=>{Ko.error&&i(String(Ko.error))},[Ko.error]),v.useEffect(()=>{var Ze;if(!t||!Ko.data||G)return;const A=Ko.data,L=A.content??"",ce=A.metadata??null,Te=L===n;if(t.type==="markdown"?Vt((ce==null?void 0:ce.tags)??[]):Vt(NW(L,t.type)),typeof A.mtimeMs=="number"&&Y(A.mtimeMs),!(u.current!==t.name)&&Te)return;r(L),l(L),K(!1),F(!1),t.type==="markdown"&&Tr&&(Rp(L),c.current=L,a.current=!0);const Je=t.type==="markdown"?ce==null?void 0:ce.pinned:(Ze=fA(L))==null?void 0:Ze.pinned;Je!==void 0&&(sr(We=>We.map($n=>$n.name===t.name?{...$n,pinned:Je}:$n)),e(We=>We&&We.name===t.name?{...We,pinned:Je}:We)),u.current=t.name},[t,n,Ko.data,Tr,G,e,Rp,sr]),fq({editor:Tr,active:t,content:n,setIsDirty:K,setLastEditAt:g,setMarkdownInEditor:Rp,pendingNormalizeRef:a,lastEditorContentRef:c}),v.useEffect(()=>{t||Y(null)},[t]);const nw=v.useMemo(()=>t?(t.displayName??tw(t.name)).trim():"",[t,tw]);v.useEffect(()=>{if(!t){Jr([]),Uo(""),Bi("");return}Jr(Ie),Uo(""),Bi("")},[t,Ie]),v.useEffect(()=>{Yt&&(!t||t.name!==Yt.name||(requestAnimationFrame(()=>{var A;return(A=I.current)==null?void 0:A.focus()}),JA(null)))},[t,Yt]),v.useEffect(()=>{!t||t.type!=="app"||q("app")},[t]),gW({open:Ec,onClose:()=>rr(!1)}),v.useEffect(()=>{rr(!1)},[t==null?void 0:t.name]),v.useEffect(()=>{ae(!1),Ee("")},[t==null?void 0:t.name]);const Ap=v.useCallback((A,L)=>{if(A.length!==L.length)return!1;const ce=[...A].sort(),Te=[...L].sort();return ce.every((De,Je)=>De===Te[Je])},[]),Ui=v.useCallback(async(A,L)=>{if(!t)return null;const ce=(L==null?void 0:L.name)??t.name,Te=(L==null?void 0:L.type)??t.type,De=t.name===ce,Je=(L==null?void 0:L.tags)??(De?wt:[]),Ze=(L==null?void 0:L.pinned)??(De?t.pinned??!1:!1);let We=A;if(Te==="markdown"){const Ht=Qm(We,Te,{tags:Je,pinned:Ze});if(Ht===null)return i("Cannot update metadata. JSON must be an object."),null;We=Ht}else if((Te==="json"||Te==="app")&&((L==null?void 0:L.tags)!==void 0||(L==null?void 0:L.pinned)!==void 0)){const Ac=Qm(A,Te,{tags:Je,pinned:Ze});if(Ac===null)return i("Cannot update metadata. JSON must be an object."),null;We=Ac}const $n=250;De&&(h.current&&(clearTimeout(h.current),h.current=null),p.current=Date.now(),f("saving")),pe.current=!0;const En=(L==null?void 0:L.baseVersion)??(De?xe:null),Qr=await fetch(`${rl}/doc/${encodeURIComponent(ce)}`,{method:"PUT",headers:{"Content-Type":"text/plain",...En!=null?{"x-hyperdoc-base-version":String(En)}:{},"x-hyperdoc-client-id":Ce.current},body:We});setTimeout(()=>{pe.current=!1},500);const Dp=Ht=>{if(!De)return;const Ac=p.current??Date.now(),w_=Date.now()-Ac,k_=Math.max(0,$n-w_);h.current=setTimeout(()=>{f(Ht),h.current=null},k_)};if(Qr.status===409){try{const Ht=await Qr.json();De&&typeof Ht.mtimeMs=="number"&&Y(Ht.mtimeMs)}catch{}return De&&F(!0),i("Conflict: file changed on disk."),Dp("idle"),null}if(!Qr.ok)return i(`Save failed: ${Qr.status}`),Dp("idle"),null;const vw=await Qr.json();return De&&(Y(vw.mtimeMs??null),l(We),K(!1),F(!1)),Zx.setQueryData(["doc",ce],Ht=>({...Ht??{content:We},content:We,mtimeMs:vw.mtimeMs??(Ht==null?void 0:Ht.mtimeMs),metadata:Te==="markdown"?{tags:Je,pinned:Ze}:(Ht==null?void 0:Ht.metadata)??null})),Dp("saved"),We},[t,xe,wt,Zx]),{jsonView:Nc,jsonError:ZA,jsonData:_p,tableDefaults:Ea,tableView:Oc,setTableView:rw,effectiveSchema:Pp,handleTableRowsChange:YA,handleAddRow:XA,commitTableUpdate:sw,persistTableView:e_,createColumnId:iw,parseColumnOptions:ow}=LW({active:t,content:n,lastSaved:o,headerTags:wt,writeDoc:Ui,setContent:r,setIsDirty:K,setLastEditAt:g}),{config:t_,error:n_}=AW(t,n),lw=v.useCallback(async A=>{if(!t)return;const L=Hi(A,t.type);if(L===t.name)return;const ce=await fetch(`${rl}/doc/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({from:t.name,to:L})});if(!ce.ok){i(`Rename failed: ${ce.status}`);return}const Te=await ce.json();e(De=>De&&{...De,...Te}),sr(De=>{const Je=De.map(Ze=>Ze.name===t.name?{...Ze,...Te}:Ze);return Je.sort((Ze,We)=>(Ze.displayName??Ze.name).localeCompare(We.displayName??We.name)),Je}),Sn(`/${Go(Te.name)}`,{replace:!0})},[t,Hi,Go,Sn,sr]),Ip=v.useCallback(async()=>{if(!t)return;const A=t.type==="markdown"&&Tr?Wo():n,L=!Ap(wt,Ie);if(G||L){const Te=t.type==="markdown"||L?wt:void 0;if(!await Ui(A,{tags:Te,pinned:t.type==="markdown"?t.pinned??!1:void 0}))return}L&&(Vt(wt),Np())},[t,Ie,n,Tr,Wo,wt,Np,G,Ap,Ui]),r_=v.useCallback(async()=>{if(!t||!G||j||Xx("hyperdoc.disableAutosave"))return;const A=t.type==="markdown"&&Tr?Wo():n;await Ui(A,{pinned:t.type==="markdown"?t.pinned??!1:void 0})},[t,j,n,Tr,Wo,G,Xx,Ui]),aw=v.useCallback(async A=>{try{const L=(t==null?void 0:t.name)===A.name;let ce="",Te=null,De=[],Je=A.pinned??!1;if(L&&t)t.type==="markdown"?G?Tr?ce=Wo():ce=n:ce=o:ce=n,De=wt,Je=t.pinned??Je,Te=xe;else{const En=await Op(A.name);ce=En.content??"",Te=En.mtimeMs??null,De=A.tags??[],Je=A.pinned??Je}const Ze=!Je,We=Qm(ce,A.type,{tags:De,pinned:Ze});if(We===null){i("Cannot update metadata. JSON must be an object.");return}if(!await Ui(We,{name:A.name,type:A.type,tags:De,pinned:Ze,baseVersion:Te}))return;sr(En=>En.map(Qr=>Qr.name===A.name?{...Qr,pinned:Ze}:Qr)),L&&e(En=>En&&{...En,pinned:Ze})}catch(L){i(`Pin failed: ${String(L)}`)}},[t,n,xe,Tr,Op,Wo,wt,G,o,e,sr,Ui]),uw=v.useCallback(async A=>{try{const L=await fetch(`${rl}/doc/${encodeURIComponent(A.name)}/archive`,{method:"POST"});if(!L.ok){i(`Archive failed: ${L.statusText}`);return}sr(ce=>ce.map(Te=>Te.name===A.name?{...Te,archived:!0}:Te)),(t==null?void 0:t.name)===A.name&&(e(null),Sn("/",{replace:!0}))}catch(L){i(`Archive failed: ${String(L)}`)}},[t,Sn,e,sr]),cw=v.useCallback(async A=>{try{const L=await fetch(`${rl}/doc/${encodeURIComponent(A.name)}`,{method:"DELETE"});if(!L.ok){i(`Delete failed: ${L.statusText}`);return}sr(ce=>ce.filter(Te=>Te.name!==A.name)),(t==null?void 0:t.name)===A.name&&(e(null),Sn("/",{replace:!0}))}catch(L){i(`Delete failed: ${String(L)}`)}},[t,Sn,e,sr]);pW({active:t,isDirty:G,conflict:j,lastEditAt:y,autosave:r_,autosaveTimeoutRef:m,saveStatusStartRef:p,setSaveStatus:f,tagsEqual:Ap,headerTags:wt,activeTags:Ie,save:Ip}),v.useEffect(()=>{!t||t.type!=="json"&&t.type!=="app"||K(n!==o)},[n,t,o]),$S({open:C,setOpen:E,ref:Tc}),$S({open:!!be,setOpen:A=>{A||pt(null)},ref:_}),v.useEffect(()=>{b&&k("")},[b]);const dw=v.useCallback(A=>{H(A),N(""),bn([]),Kr(""),E(!1),S(!0)},[]),fw=v.useMemo(()=>({activeDoc:t,announce:i,openCreateDialog:dw,toggleDocPinned:aw,archiveDoc:uw,deleteDoc:cw}),[t,uw,cw,dw,aw]),Cn=v.useCallback(async(A,L)=>{if(!A)return;const ce={...fw,...L};await A(ce)},[fw]),hw=v.useCallback(A=>{Vi(!1),Sn(`/${Go(A.name)}`,{replace:!0})},[Go,Sn,Vi]),pw=v.useCallback(A=>{Vi(!1),Cn(A.run)},[Cn,Vi]),s_=v.useCallback(async(A,L)=>{pt(null),L==="pin"?await Cn(ov,{activeDoc:A}):L==="archive"?await Cn(lv,{activeDoc:A}):await Cn(av,{activeDoc:A})},[Cn]),i_=v.useMemo(()=>Hi(T,O),[Hi,T,O]),o_=v.useMemo(()=>{const A=new Set([...qo,...Et]);return Array.from(A).sort()},[qo,Et]),mw=v.useMemo(()=>{const A=new Set([...qo,...wt]);return Array.from(A).sort()},[wt,qo]),l_=v.useCallback(A=>{bn(L=>L.includes(A)?L.filter(ce=>ce!==A):[...L,A].sort())},[]),a_=v.useCallback(()=>{const A=Mc(jn);if(!A){we("Tags must be lowercase letters only.");return}bn(L=>L.includes(A)?L:[...L,A].sort()),Kr(""),we("")},[Mc,jn]),gw=v.useCallback(A=>{Jr(L=>L.includes(A)?L.filter(ce=>ce!==A):[...L,A].sort())},[]),yw=v.useCallback(()=>{const A=Mc(Er);if(!A){Bi("Tags must be lowercase letters only.");return}Jr(L=>L.includes(A)?L:[...L,A].sort()),Uo(""),Bi("")},[Er,Mc]),u_=async()=>{k("");const A=Hi(T,O),ce=await(async De=>{const Je=T.trim(),Ze=O==="markdown"?`${hA({title:Je||null,tags:Et})}`:void 0,We=O==="json"?JSON.stringify({data:[],schema:{columns:[{id:"name",name:"Name",type:"text"}]},...Et.length>0?{metadata:{tags:Et}}:{}},null,2):void 0,$n=O==="app"?JSON.stringify({bundleUrl:"",mountId:yq()},null,2):void 0;return await fetch(`${rl}/docs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:Je,name:De,type:O,content:O==="markdown"?Ze:O==="json"?We:$n})})})(A);if(!ce.ok){k(`Create failed: ${ce.status}`);return}const Te=await ce.json();sr(De=>{const Je=[...De,Te];return Je.sort((Ze,We)=>(Ze.displayName??Ze.name).localeCompare(We.displayName??We.name)),Je}),N(""),k(""),S(!1),e(Te),Et.length>0&&(Vt(Et),Np()),QA(),Sn(`/${Go(Te.name)}`,{replace:!0})},c_=v.useCallback(()=>{const A=Q.trim();if(!A){Ee("Column name is required.");return}const L=se==="select"?ow(M):[];if(se==="select"&&L.length===0){Ee("Select columns need at least one option.");return}const ce=Pp,Te=ce.columns.map($n=>$n.id),De=iw(A,Te),Je={id:De,name:A,type:se,...se==="select"?{options:L}:{}},Ze={columns:[...ce.columns,Je]},We=(_p??[]).map($n=>({...$n,[De]:se==="object"?null:""}));sw(We,{nextSchema:Ze}),ae(!1),le(""),V(""),ye("text"),Ee("")},[sw,iw,Pp,_p,Q,M,se,ow]),d_=v.useMemo(()=>Nc!=="table"||!Ea||!Oc?!1:!eu(Ea,Oc),[Nc,Ea,Oc]),f_=v.useMemo(()=>{const L=(Ke.length===0?Rc:Rc.filter(ce=>Ke.every(Te=>{var De;return(De=ce.tags)==null?void 0:De.includes(Te)}))).map((ce,Te)=>({doc:ce,index:Te})).sort((ce,Te)=>ce.doc.pinned===Te.doc.pinned?ce.index-Te.index:ce.doc.pinned?-1:1).map(({doc:ce})=>ce);return Ke.length===0,L},[Rc,Ke]),h_=v.useMemo(()=>{if(!t)return null;if(t.type==="markdown")return{type:"markdown",metadata:{base64:null,decoded:null,json:{tags:Ie,pinned:t.pinned??!1},error:null},rawMarkdown:n};if(t.type==="json")try{const A=JSON.parse(n);return{type:"json",prettyJson:JSON.stringify(A,null,2),error:null,rawJson:n}}catch{return{type:"json",prettyJson:null,error:"Invalid JSON",rawJson:n}}if(t.type==="app")try{const A=JSON.parse(n);return{type:"app",prettyJson:JSON.stringify(A,null,2),error:null,rawJson:n}}catch{return{type:"app",prettyJson:null,error:"Invalid JSON",rawJson:n}}return null},[t,Ie,n]),p_=v.useCallback(A=>{Sa(L=>L.includes(A)?L.filter(ce=>ce!==A):[...L,A].sort())},[]),m_=v.useCallback(()=>{Sa([])},[]),g_=qo.length>0||!!Yx,y_=v.useMemo(()=>typeof navigator>"u"?"Ctrl K":navigator.platform.includes("Mac")?"⌘ K":"Ctrl K",[]),v_=v.useMemo(()=>({open:Jx,onOpenChange:Vi,activeDoc:t,commands:Qx,onSelectDoc:hw,onRunCommand:pw}),[Qx,Jx,hw,pw,t,Vi]),x_=v.useMemo(()=>({docType:(t==null?void 0:t.type)??null,title:nw,titleInputRef:I,onTitleChange:A=>{lw(A).catch(()=>{})},deriveFileName:t?A=>Hi(A,t.type):void 0,onManualSave:t?()=>Ip().catch(()=>{}):void 0,saveStatus:d,errorStatus:s,conflict:j,showMetadataButton:(t==null?void 0:t.type)==="markdown"||(t==null?void 0:t.type)==="json"||(t==null?void 0:t.type)==="app",onShowMetadata:()=>rr(!0),fileName:(t==null?void 0:t.name)??"",isPinned:(t==null?void 0:t.pinned)??!1,onTogglePinned:t?()=>Cn(ov):void 0,onArchive:t?()=>Cn(lv):void 0,onDelete:t?()=>Cn(av):void 0,availableTags:mw,selectedTags:wt,onToggleTag:gw,tagInput:Er,onTagInputChange:A=>{Uo(A),Ca&&Bi("")},onTagAdd:yw,tagStatus:Ca}),[t,nw,yw,mw,j,Hi,Er,Ca,wt,lw,Cn,Ip,d,s,gw]);return w.jsx(Oj,{value:v_,children:w.jsx(Qz,{value:x_,children:w.jsxs("div",{className:"flex h-screen font-sans",children:[w.jsx(eF,{docs:f_,activeDocName:(t==null?void 0:t.name)??null,tagFilters:Ke,tags:qo,systemTagStatus:Yx,showTagsSection:g_,onToggleTagFilter:p_,onClearTagFilters:m_,onOpenCommandPalette:()=>Vi(!0),onSelectDoc:A=>Sn(`/${Go(A.name)}`,{replace:!0}),createMenuOpen:C,onToggleCreateMenu:()=>E(A=>!A),onCreateMarkdown:()=>Cn(uA),onCreateJson:()=>Cn(cA),onCreateApp:()=>Cn(dA),docMenuOpen:be,onToggleDocMenu:A=>pt(L=>L===A?null:A),onRunDocMenuAction:s_,createMenuRef:Tc,docMenuRef:_,commandShortcut:y_}),w.jsxs("main",{className:"flex min-h-0 flex-1 flex-col gap-3 p-4",children:[w.jsx(Yz,{}),w.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-3",children:(t==null?void 0:t.type)==="markdown"?w.jsx(cW,{editor:Tr}):(t==null?void 0:t.type)==="json"?w.jsx(_3,{jsonView:Nc,jsonError:ZA,jsonData:_p,tableView:Oc,effectiveSchema:Pp,showSaveViewBanner:Nc==="table"&&d_,onViewChange:rw,onPersistView:e_,onResetView:()=>{Ea&&rw(Ea)},onRowsChange:YA,onAddRow:XA,onAddColumn:()=>ae(!0),addColumnOpen:ne,onAddColumnOpenChange:A=>{ae(A),A||Ee("")},newColumnName:Q,newColumnType:se,newColumnOptions:M,addColumnError:ie,onNewColumnNameChange:A=>{le(A),ie&&Ee("")},onNewColumnTypeChange:A=>{ye(A),ie&&Ee("")},onNewColumnOptionsChange:A=>{V(A),ie&&Ee("")},onAddColumnConfirm:c_,content:n,onContentChange:A=>{r(A),g(Date.now())}}):(t==null?void 0:t.type)==="app"?w.jsx(SL,{appView:P,appConfig:t_,appConfigError:n_,content:n,onViewChange:q,onContentChange:A=>{r(A),g(Date.now())},docName:t.name}):null})]}),w.jsx(qz,{}),w.jsx(Xz,{open:Ec,active:t,infoInspector:h_,onClose:()=>rr(!1)}),w.jsx(Gz,{open:b,newDocType:O,newDocTitle:T,derivedFileName:i_,availableCreateTags:o_,draftTags:Et,tagInput:jn,tagStatus:Se,createStatus:x,onClose:()=>S(!1),onTitleChange:N,onToggleDraftTag:l_,onTagInputChange:A=>{Kr(A),Se&&we("")},onAddDraftTag:a_,onCreate:()=>u_().catch(()=>{})})]})})})}const zS=document.getElementById("root"),xq=new m2;zS&&cT(zS).render(w.jsx(g2,{client:xq,children:w.jsx(WD,{children:w.jsx(VD,{children:w.jsx(bT,{path:"/*",element:w.jsx(vq,{})})})})}));