@plandesk/api 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/routes/auth.d.ts +1 -1
- package/dist/routes/auth.js +10 -3
- package/package.json +1 -1
- package/web/assets/geist-sans-latin-400-normal-BOaIZNA2.woff +0 -0
- package/web/assets/geist-sans-latin-400-normal-gapTbOY8.woff2 +0 -0
- package/web/assets/geist-sans-latin-500-normal-CN2lyvyL.woff +0 -0
- package/web/assets/geist-sans-latin-500-normal-uokXdC-Q.woff2 +0 -0
- package/web/assets/geist-sans-latin-600-normal-CA1yjETN.woff +0 -0
- package/web/assets/geist-sans-latin-600-normal-DFOURf8L.woff2 +0 -0
- package/web/assets/geist-sans-latin-700-normal-BmN9tIp5.woff2 +0 -0
- package/web/assets/geist-sans-latin-700-normal-CjScfYeH.woff +0 -0
- package/web/assets/index-98uRA-xM.css +2 -0
- package/web/assets/index-BSAeuPkR.js +358 -0
- package/web/index.html +2 -2
- package/web/assets/index-BBNvafSX.js +0 -358
- package/web/assets/index-BqoMRSUH.css +0 -2
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),m=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},te=[],ne=-1;function R(e){return{current:e}}function z(e){0>ne||(e.current=te[ne],te[ne]=null,ne--)}function B(e,t){ne++,te[ne]=e.current,e.current=t}var re=R(null),V=R(null),ie=R(null),ae=R(null);function oe(e,t){switch(B(ie,t),B(V,e),B(re,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}z(re),B(re,e)}function se(){z(re),z(V),z(ie)}function ce(e){e.memoizedState!==null&&B(ae,e);var t=re.current,n=Xd(t,e.type);t!==n&&(B(V,e),B(re,n))}function le(e){V.current===e&&(z(re),z(V)),ae.current===e&&(z(ae),op._currentValue=ee)}var ue,de;function fe(e){if(ue===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ue=t&&t[1]||``,de=-1<e.stack.indexOf(`
|
|
2
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
+
`+ue+e+de}var pe=!1;function me(e,t){if(!e||pe)return``;pe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
|
+
`),l=s.split(`
|
|
5
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?fe(n):``}function he(e,t){switch(e.tag){case 26:case 27:case 5:return fe(e.type);case 16:return fe(`Lazy`);case 13:return e.child!==t&&t!==null?fe(`Suspense Fallback`):fe(`Suspense`);case 19:return fe(`SuspenseList`);case 0:case 15:return me(e.type,!1);case 11:return me(e.type.render,!1);case 1:return me(e.type,!0);case 31:return fe(`Activity`);default:return``}}function ge(e){try{var t=``,n=null;do t+=he(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
+
Error generating stack: `+e.message+`
|
|
8
|
+
`+e.stack}}var _e=Object.prototype.hasOwnProperty,ve=t.unstable_scheduleCallback,ye=t.unstable_cancelCallback,be=t.unstable_shouldYield,xe=t.unstable_requestPaint,Se=t.unstable_now,Ce=t.unstable_getCurrentPriorityLevel,we=t.unstable_ImmediatePriority,Te=t.unstable_UserBlockingPriority,Ee=t.unstable_NormalPriority,De=t.unstable_LowPriority,Oe=t.unstable_IdlePriority,ke=t.log,Ae=t.unstable_setDisableYieldValue,je=null,Me=null;function Ne(e){if(typeof ke==`function`&&Ae(e),Me&&typeof Me.setStrictMode==`function`)try{Me.setStrictMode(je,e)}catch{}}var Pe=Math.clz32?Math.clz32:Le,Fe=Math.log,Ie=Math.LN2;function Le(e){return e>>>=0,e===0?32:31-(Fe(e)/Ie|0)|0}var Re=256,ze=262144,H=4194304;function U(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Be(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=U(n))):i=U(o):i=U(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=U(n))):i=U(o)):i=U(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function W(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ve(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function He(){var e=H;return H<<=1,!(H&62914560)&&(H=4194304),e}function Ue(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function We(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ge(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Pe(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ke(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ke(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Pe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function qe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Pe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Je(e,t){var n=t&-t;return n=n&42?1:Ye(n),(n&(e.suspendedLanes|t))===0?n:0}function Ye(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Xe(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ze(){var e=L.p;return e===0?(e=window.event,e===void 0?32:Sp(e.type)):e}function Qe(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var $e=Math.random().toString(36).slice(2),et=`__reactFiber$`+$e,tt=`__reactProps$`+$e,nt=`__reactContainer$`+$e,rt=`__reactEvents$`+$e,it=`__reactListeners$`+$e,at=`__reactHandles$`+$e,ot=`__reactResources$`+$e,st=`__reactMarker$`+$e;function ct(e){delete e[et],delete e[tt],delete e[rt],delete e[it],delete e[at]}function lt(e){var t=e[et];if(t)return t;for(var n=e.parentNode;n;){if(t=n[nt]||n[et]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=yf(e);e!==null;){if(n=e[et])return n;e=yf(e)}return t}e=n,n=e.parentNode}return null}function ut(e){if(e=e[et]||e[nt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function dt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ft(e){var t=e[ot];return t||=e[ot]={hoistableStyles:new Map,hoistableScripts:new Map},t}function pt(e){e[st]=!0}var mt=new Set,ht={};function gt(e,t){_t(e,t),_t(e+`Capture`,t)}function _t(e,t){for(ht[e]=t,e=0;e<t.length;e++)mt.add(t[e])}var vt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),yt={},bt={};function xt(e){return _e.call(bt,e)?!0:_e.call(yt,e)?!1:vt.test(e)?bt[e]=!0:(yt[e]=!0,!1)}function St(e,t,n){if(xt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Ct(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function wt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Tt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Et(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Dt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ot(e){if(!e._valueTracker){var t=Et(e)?`checked`:`value`;e._valueTracker=Dt(e,t,``+e[t])}}function kt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Et(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function At(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var jt=/[\n"\\]/g;function Mt(e){return e.replace(jt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Nt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Tt(t)):e.value!==``+Tt(t)&&(e.value=``+Tt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ft(e,o,Tt(n)):Ft(e,o,Tt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Tt(s):e.removeAttribute(`name`)}function Pt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Ot(e);return}n=n==null?``:``+Tt(n),t=t==null?n:``+Tt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Ot(e)}function Ft(e,t,n){t===`number`&&At(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function It(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Tt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Lt(e,t,n){if(t!=null&&(t=``+Tt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Tt(n)}function Rt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(F(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Tt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ot(e)}function zt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Bt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Vt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Bt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Ht(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Vt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Vt(e,o,t[o])}function Ut(e){if(e.indexOf(`-`)===-1)return!1;switch(e){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 Wt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Gt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Kt(e){return Gt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function qt(){}var Jt=null;function Yt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xt=null,Zt=null;function Qt(e){var t=ut(e);if(t&&(e=t.stateNode)){var n=e[tt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Nt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Mt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[tt]||null;if(!a)throw Error(i(90));Nt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&kt(r)}break a;case`textarea`:Lt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&It(e,!!n.multiple,t,!1)}}}var $t=!1;function en(e,t,n){if($t)return e(t,n);$t=!0;try{return e(t)}finally{if($t=!1,(Xt!==null||Zt!==null)&&(Tu(),Xt&&(t=Xt,e=Zt,Zt=Xt=null,Qt(t),e)))for(t=0;t<e.length;t++)Qt(e[t])}}function tn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[tt]||null;if(r===null)return null;n=r[t];a:switch(t){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)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var nn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),rn=!1;if(nn)try{var an={};Object.defineProperty(an,"passive",{get:function(){rn=!0}}),window.addEventListener(`test`,an,an),window.removeEventListener(`test`,an,an)}catch{rn=!1}var on=null,sn=null,cn=null;function ln(){if(cn)return cn;var e,t=sn,n=t.length,r,i=`value`in on?on.value:on.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return cn=i.slice(e,1<r?1-r:void 0)}function un(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function dn(){return!0}function fn(){return!1}function pn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?dn:fn,this.isPropagationStopped=fn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=dn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=dn)},persist:function(){},isPersistent:dn}),t}var mn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hn=pn(mn),gn=h({},mn,{view:0,detail:0}),_n=pn(gn),vn,yn,bn,xn=h({},gn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==bn&&(bn&&e.type===`mousemove`?(vn=e.screenX-bn.screenX,yn=e.screenY-bn.screenY):yn=vn=0,bn=e),vn)},movementY:function(e){return`movementY`in e?e.movementY:yn}}),Sn=pn(xn),Cn=pn(h({},xn,{dataTransfer:0})),wn=pn(h({},gn,{relatedTarget:0})),Tn=pn(h({},mn,{animationName:0,elapsedTime:0,pseudoElement:0})),En=pn(h({},mn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Dn=pn(h({},mn,{data:0})),On={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},kn={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`},An={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function jn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=An[e])?!!t[e]:!1}function Mn(){return jn}var Nn=pn(h({},gn,{key:function(e){if(e.key){var t=On[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=un(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?kn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mn,charCode:function(e){return e.type===`keypress`?un(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?un(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Pn=pn(h({},xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Fn=pn(h({},gn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mn})),In=pn(h({},mn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Ln=pn(h({},xn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Rn=pn(h({},mn,{newState:0,oldState:0})),zn=[9,13,27,32],Bn=nn&&`CompositionEvent`in window,Vn=null;nn&&`documentMode`in document&&(Vn=document.documentMode);var Hn=nn&&`TextEvent`in window&&!Vn,Un=nn&&(!Bn||Vn&&8<Vn&&11>=Vn),Wn=` `,Gn=!1;function Kn(e,t){switch(e){case`keyup`:return zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Jn=!1;function Yn(e,t){switch(e){case`compositionend`:return qn(t);case`keypress`:return t.which===32?(Gn=!0,Wn):null;case`textInput`:return e=t.data,e===Wn&&Gn?null:e;default:return null}}function Xn(e,t){if(Jn)return e===`compositionend`||!Bn&&Kn(e,t)?(e=ln(),cn=sn=on=null,Jn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Un&&t.locale!==`ko`?null:t.data;default:return null}}var Zn={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 Qn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Zn[e.type]:t===`textarea`}function $n(e,t,n,r){Xt?Zt?Zt.push(r):Zt=[r]:Xt=r,t=Nd(t,`onChange`),0<t.length&&(n=new hn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var er=null,tr=null;function nr(e){Td(e,0)}function rr(e){if(kt(dt(e)))return e}function ir(e,t){if(e===`change`)return t}var ar=!1;if(nn){var or;if(nn){var sr=`oninput`in document;if(!sr){var cr=document.createElement(`div`);cr.setAttribute(`oninput`,`return;`),sr=typeof cr.oninput==`function`}or=sr}else or=!1;ar=or&&(!document.documentMode||9<document.documentMode)}function lr(){er&&(er.detachEvent(`onpropertychange`,ur),tr=er=null)}function ur(e){if(e.propertyName===`value`&&rr(tr)){var t=[];$n(t,tr,e,Yt(e)),en(nr,t)}}function dr(e,t,n){e===`focusin`?(lr(),er=t,tr=n,er.attachEvent(`onpropertychange`,ur)):e===`focusout`&&lr()}function fr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return rr(tr)}function pr(e,t){if(e===`click`)return rr(t)}function mr(e,t){if(e===`input`||e===`change`)return rr(t)}function hr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var gr=typeof Object.is==`function`?Object.is:hr;function _r(e,t){if(gr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!_e.call(t,i)||!gr(e[i],t[i]))return!1}return!0}function vr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function yr(e,t){var n=vr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=vr(n)}}function br(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?br(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=At(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=At(e.document)}return t}function Sr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Cr=nn&&`documentMode`in document&&11>=document.documentMode,wr=null,Tr=null,Er=null,Dr=!1;function Or(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Dr||wr==null||wr!==At(r)||(r=wr,`selectionStart`in r&&Sr(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}),Er&&_r(Er,r)||(Er=r,r=Nd(Tr,`onSelect`),0<r.length&&(t=new hn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=wr)))}function kr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ar={animationend:kr(`Animation`,`AnimationEnd`),animationiteration:kr(`Animation`,`AnimationIteration`),animationstart:kr(`Animation`,`AnimationStart`),transitionrun:kr(`Transition`,`TransitionRun`),transitionstart:kr(`Transition`,`TransitionStart`),transitioncancel:kr(`Transition`,`TransitionCancel`),transitionend:kr(`Transition`,`TransitionEnd`)},jr={},Mr={};nn&&(Mr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ar.animationend.animation,delete Ar.animationiteration.animation,delete Ar.animationstart.animation),`TransitionEvent`in window||delete Ar.transitionend.transition);function Nr(e){if(jr[e])return jr[e];if(!Ar[e])return e;var t=Ar[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Mr)return jr[e]=t[n];return e}var Pr=Nr(`animationend`),Fr=Nr(`animationiteration`),Ir=Nr(`animationstart`),Lr=Nr(`transitionrun`),Rr=Nr(`transitionstart`),zr=Nr(`transitioncancel`),Br=Nr(`transitionend`),Vr=new Map,Hr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Hr.push(`scrollEnd`);function Ur(e,t){Vr.set(e,t),gt(t,[e])}var Wr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Gr=[],Kr=0,qr=0;function Jr(){for(var e=Kr,t=qr=Kr=0;t<e;){var n=Gr[t];Gr[t++]=null;var r=Gr[t];Gr[t++]=null;var i=Gr[t];Gr[t++]=null;var a=Gr[t];if(Gr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Qr(n,i,a)}}function Yr(e,t,n,r){Gr[Kr++]=e,Gr[Kr++]=t,Gr[Kr++]=n,Gr[Kr++]=r,qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Xr(e,t,n,r){return Yr(e,t,n,r),$r(e)}function Zr(e,t){return Yr(e,null,null,t),$r(e)}function Qr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Pe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function $r(e){if(50<gu)throw gu=0,_u=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ei={};function ti(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,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 ni(e,t,n,r){return new ti(e,t,n,r)}function ri(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ii(e,t){var n=e.alternate;return n===null?(n=ni(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ai(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function oi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ri(e)&&(s=1);else if(typeof e==`string`)s=Zf(e,n,re.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ni(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return si(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ni(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ni(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ni(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ni(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function si(e,t,n,r){return e=ni(7,e,r,t),e.lanes=n,e}function ci(e,t,n){return e=ni(6,e,null,t),e.lanes=n,e}function li(e){var t=ni(18,null,null,0);return t.stateNode=e,t}function ui(e,t,n){return t=ni(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var di=new WeakMap;function fi(e,t){if(typeof e==`object`&&e){var n=di.get(e);return n===void 0?(t={value:e,source:t,stack:ge(t)},di.set(e,t),t):n}return{value:e,source:t,stack:ge(t)}}var pi=[],mi=0,hi=null,gi=0,_i=[],vi=0,yi=null,bi=1,xi=``;function Si(e,t){pi[mi++]=gi,pi[mi++]=hi,hi=e,gi=t}function Ci(e,t,n){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,yi=e;var r=bi;e=xi;var i=32-Pe(r)-1;r&=~(1<<i),n+=1;var a=32-Pe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,bi=1<<32-Pe(t)+i|n<<i|r,xi=a+e}else bi=1<<a|n<<i|r,xi=e}function wi(e){e.return!==null&&(Si(e,1),Ci(e,1,0))}function Ti(e){for(;e===hi;)hi=pi[--mi],pi[mi]=null,gi=pi[--mi],pi[mi]=null;for(;e===yi;)yi=_i[--vi],_i[vi]=null,xi=_i[--vi],_i[vi]=null,bi=_i[--vi],_i[vi]=null}function Ei(e,t){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,bi=t.id,xi=t.overflow,yi=e}var Di=null,Oi=null,ki=!1,Ai=null,ji=!1,Mi=Error(i(519));function Ni(e){throw zi(fi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Mi}function Pi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[et]=e,t[tt]=r,n){case`dialog`:Ed(`cancel`,t),Ed(`close`,t);break;case`iframe`:case`object`:case`embed`:Ed(`load`,t);break;case`video`:case`audio`:for(n=0;n<Cd.length;n++)Ed(Cd[n],t);break;case`source`:Ed(`error`,t);break;case`img`:case`image`:case`link`:Ed(`error`,t),Ed(`load`,t);break;case`details`:Ed(`toggle`,t);break;case`input`:Ed(`invalid`,t),Pt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Ed(`invalid`,t);break;case`textarea`:Ed(`invalid`,t),Rt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||zd(t.textContent,n)?(r.popover!=null&&(Ed(`beforetoggle`,t),Ed(`toggle`,t)),r.onScroll!=null&&Ed(`scroll`,t),r.onScrollEnd!=null&&Ed(`scrollend`,t),r.onClick!=null&&(t.onclick=qt),t=!0):t=!1,t||Ni(e,!0)}function Fi(e){for(Di=e.return;Di;)switch(Di.tag){case 5:case 31:case 13:ji=!1;return;case 27:case 3:ji=!0;return;default:Di=Di.return}}function Ii(e){if(e!==Di)return!1;if(!ki)return Fi(e),ki=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Zd(e.type,e.memoizedProps)),n=!n),n&&Oi&&Ni(e),Fi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Oi=vf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Oi=vf(e)}else t===27?(t=Oi,of(e.type)?(e=_f,_f=null,Oi=e):Oi=t):Oi=Di?gf(e.stateNode.nextSibling):null;return!0}function Li(){Oi=Di=null,ki=!1}function Ri(){var e=Ai;return e!==null&&(nu===null?nu=e:nu.push.apply(nu,e),Ai=null),e}function zi(e){Ai===null?Ai=[e]:Ai.push(e)}var Bi=R(null),Vi=null,Hi=null;function Ui(e,t,n){B(Bi,t._currentValue),t._currentValue=n}function Wi(e){e._currentValue=Bi.current,z(Bi)}function Gi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ki(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Gi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Gi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function qi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;gr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ae.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[op]:e.push(op))}a=a.return}e!==null&&Ki(t,e,n,r),t.flags|=262144}function Ji(e){for(e=e.firstContext;e!==null;){if(!gr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){Vi=e,Hi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Xi(e){return Qi(Vi,e)}function Zi(e,t){return Vi===null&&Yi(e),Qi(e,t)}function Qi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Hi===null){if(e===null)throw Error(i(308));Hi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Hi=Hi.next=t;return n}var $i=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ea=t.unstable_scheduleCallback,ta=t.unstable_NormalPriority,na={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ra(){return{controller:new $i,data:new Map,refCount:0}}function ia(e){e.refCount--,e.refCount===0&&ea(ta,function(){e.controller.abort()})}var aa=null,oa=0,sa=0,ca=null;function la(e,t){if(aa===null){var n=aa=[];oa=0,sa=_d(),ca={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return oa++,t.then(ua,ua),t}function ua(){if(--oa===0&&aa!==null){ca!==null&&(ca.status=`fulfilled`);var e=aa;aa=null,sa=0,ca=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function da(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var fa=I.S;I.S=function(e,t){au=Se(),typeof t==`object`&&t&&typeof t.then==`function`&&la(e,t),fa!==null&&fa(e,t)};var pa=R(null);function ma(){var e=pa.current;return e===null?Bl.pooledCache:e}function ha(e,t){t===null?B(pa,pa.current):B(pa,t.pool)}function ga(){var e=ma();return e===null?null:{parent:na._currentValue,pool:e}}var _a=Error(i(460)),va=Error(i(474)),ya=Error(i(542)),ba={then:function(){}};function xa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Sa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(qt,qt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ea(e),e;default:if(typeof t.status==`string`)t.then(qt,qt);else{if(e=Bl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ea(e),e}throw wa=t,_a}}function Ca(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(wa=e,_a):e}}var wa=null;function Ta(){if(wa===null)throw Error(i(459));var e=wa;return wa=null,e}function Ea(e){if(e===_a||e===ya)throw Error(i(483))}var Da=null,Oa=0;function ka(e){var t=Oa;return Oa+=1,Da===null&&(Da=[]),Sa(Da,e,t)}function Aa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ja(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ma(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ii(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ci(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&Ca(i)===t.type)?(t=a(t,n.props),Aa(t,n),t.return=e,t):(t=oi(n.type,n.key,n.props,null,e.mode,r),Aa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ui(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=si(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ci(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=oi(t.type,t.key,t.props,null,e.mode,n),Aa(n,t),n.return=e,n;case v:return t=ui(t,e.mode,n),t.return=e,t;case O:return t=Ca(t),f(e,t,n)}if(F(t)||M(t))return t=si(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,ka(t),n);if(t.$$typeof===C)return f(e,Zi(e,t),n);ja(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=Ca(n),p(e,t,n,r)}if(F(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,ka(n),r);if(n.$$typeof===C)return p(e,t,Zi(e,n),r);ja(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Ca(r),m(e,t,n,r,i)}if(F(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,ka(r),i);if(r.$$typeof===C)return m(e,t,n,Zi(t,r),i);ja(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),ki&&Si(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return ki&&Si(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),ki&&Si(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ki&&Si(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ki&&Si(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ki&&Si(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Ca(l)===r.type){n(e,r.sibling),c=a(r,o.props),Aa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=si(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=oi(o.type,o.key,o.props,null,e.mode,c),Aa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ui(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Ca(o),b(e,r,o,c)}if(F(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,ka(o),c);if(o.$$typeof===C)return b(e,r,Zi(e,o),c);ja(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ci(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Oa=0;var i=b(e,t,n,r);return Da=null,i}catch(t){if(t===_a||t===ya)throw t;var a=ni(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var G=Ma(!0),Na=Ma(!1),Pa=!1;function Fa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ia(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function La(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ra(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,zl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=$r(e),Qr(e,null,n),t}return Yr(e,r,t,n),$r(e)}function za(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qe(e,n)}}function Ba(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Va=!1;function Ha(){if(Va){var e=ca;if(e!==null)throw e}}function Ua(e,t,n,r){Va=!1;var i=e.updateQueue;Pa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Hl&f)===f:(r&f)===f){f!==0&&f===sa&&(Va=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Pa=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Xl|=o,e.lanes=o,e.memoizedState=d}}function Wa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ga(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Wa(n[e],t)}var Ka=R(null),qa=R(0);function Ja(e,t){e=Jl,B(qa,e),B(Ka,t),Jl=e|t.baseLanes}function Ya(){B(qa,Jl),B(Ka,Ka.current)}function Xa(){Jl=qa.current,z(Ka),z(qa)}var Za=R(null),Qa=null;function $a(e){var t=e.alternate;B(io,io.current&1),B(Za,e),Qa===null&&(t===null||Ka.current!==null||t.memoizedState!==null)&&(Qa=e)}function eo(e){B(io,io.current),B(Za,e),Qa===null&&(Qa=e)}function to(e){e.tag===22?(B(io,io.current),B(Za,e),Qa===null&&(Qa=e)):no(e)}function no(){B(io,io.current),B(Za,Za.current)}function ro(e){z(Za),Qa===e&&(Qa=null),z(io)}var io=R(0);function ao(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||pf(n)||mf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var oo=0,so=null,co=null,lo=null,uo=!1,fo=!1,po=!1,mo=0,ho=0,go=null,_o=0;function vo(){throw Error(i(321))}function yo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gr(e[n],t[n]))return!1;return!0}function bo(e,t,n,r,i,a){return oo=a,so=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Ls:Rs,po=!1,a=n(r,i),po=!1,fo&&(a=So(t,n,r,i)),xo(e),a}function xo(e){I.H=Is;var t=co!==null&&co.next!==null;if(oo=0,lo=co=so=null,uo=!1,ho=0,go=null,t)throw Error(i(300));e===null||tc||(e=e.dependencies,e!==null&&Ji(e)&&(tc=!0))}function So(e,t,n,r){so=e;var a=0;do{if(fo&&(go=null),ho=0,fo=!1,25<=a)throw Error(i(301));if(a+=1,lo=co=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}I.H=zs,o=t(n,r)}while(fo);return o}function Co(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?Ao(t):t,e=e.useState()[0],(co===null?null:co.memoizedState)!==e&&(so.flags|=1024),t}function wo(){var e=mo!==0;return mo=0,e}function To(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Eo(e){if(uo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}uo=!1}oo=0,lo=co=so=null,fo=!1,ho=mo=0,go=null}function Do(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lo===null?so.memoizedState=lo=e:lo=lo.next=e,lo}function Oo(){if(co===null){var e=so.alternate;e=e===null?null:e.memoizedState}else e=co.next;var t=lo===null?so.memoizedState:lo.next;if(t!==null)lo=t,co=e;else{if(e===null)throw so.alternate===null?Error(i(467)):Error(i(310));co=e,e={memoizedState:co.memoizedState,baseState:co.baseState,baseQueue:co.baseQueue,queue:co.queue,next:null},lo===null?so.memoizedState=lo=e:lo=lo.next=e}return lo}function ko(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ao(e){var t=ho;return ho+=1,go===null&&(go=[]),e=Sa(go,e,t),t=so,(lo===null?t.memoizedState:lo.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Ls:Rs),e}function jo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Ao(e);if(e.$$typeof===C)return Xi(e)}throw Error(i(438,String(e)))}function Mo(e){var t=null,n=so.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=so.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=ko(),so.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function No(e,t){return typeof t==`function`?t(e):t}function Po(e){return Fo(Oo(),co,e)}function Fo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(oo&f)===f:(Hl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===sa&&(d=!0);else if((oo&p)===p){u=u.next,p===sa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,so.lanes|=p,Xl|=p;f=u.action,po&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,so.lanes|=f,Xl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!gr(o,e.memoizedState)&&(tc=!0,d&&(n=ca,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Io(e){var t=Oo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);gr(o,t.memoizedState)||(tc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Lo(e,t,n){var r=so,a=Oo(),o=ki;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!gr((co||a).memoizedState,n);if(s&&(a.memoizedState=n,tc=!0),a=a.queue,ls(Bo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||lo!==null&&lo.memoizedState.tag&1){if(r.flags|=2048,rs(9,{destroy:void 0},zo.bind(null,r,a,n,t),null),Bl===null)throw Error(i(349));o||oo&127||Ro(r,t,n)}return n}function Ro(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=so.updateQueue,t===null?(t=ko(),so.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zo(e,t,n,r){t.value=n,t.getSnapshot=r,Vo(t)&&Ho(e)}function Bo(e,t,n){return n(function(){Vo(t)&&Ho(e)})}function Vo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gr(e,n)}catch{return!0}}function Ho(e){var t=Zr(e,2);t!==null&&bu(t,e,2)}function Uo(e){var t=Do();if(typeof e==`function`){var n=e;if(e=n(),po){Ne(!0);try{n()}finally{Ne(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:e},t}function Wo(e,t,n,r){return e.baseState=n,Fo(e,co,typeof r==`function`?r:No)}function Go(e,t,n,r,a){if(Ns(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};I.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Ko(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ko(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=I.T,o={};I.T=o;try{var s=n(i,r),c=I.S;c!==null&&c(o,s),qo(e,t,s)}catch(n){Yo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),qo(e,t,a)}catch(n){Yo(e,t,n)}}function qo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Jo(e,t,n)},function(n){return Yo(e,t,n)}):Jo(e,t,n)}function Jo(e,t,n){t.status=`fulfilled`,t.value=n,Xo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ko(e,n)))}function Yo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Xo(t),t=t.next;while(t!==r)}e.action=null}function Xo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Zo(e,t){return t}function Qo(e,t){if(ki){var n=Bl.formState;if(n!==null){a:{var r=so;if(ki){if(Oi){b:{for(var i=Oi,a=ji;i.nodeType!==8;){if(!a){i=null;break b}if(i=gf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Oi=gf(i.nextSibling),r=i.data===`F!`;break a}}Ni(r)}r=!1}r&&(t=n[0])}}return n=Do(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zo,lastRenderedState:t},n.queue=r,n=K.bind(null,so,r),r.dispatch=n,r=Uo(!1),a=Ms.bind(null,so,!1,r.queue),r=Do(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Go.bind(null,so,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function $o(e){return es(Oo(),co,e)}function es(e,t,n){if(t=Fo(e,t,Zo)[0],e=Po(No)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Ao(t)}catch(e){throw e===_a?ya:e}else r=t;t=Oo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(so.flags|=2048,rs(9,{destroy:void 0},ts.bind(null,i,n),null)),[r,a,e]}function ts(e,t){e.action=t}function ns(e){var t=Oo(),n=co;if(n!==null)return es(t,n,e);Oo(),t=t.memoizedState,n=Oo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function rs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=so.updateQueue,t===null&&(t=ko(),so.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function is(){return Oo().memoizedState}function as(e,t,n,r){var i=Do();so.flags|=e,i.memoizedState=rs(1|t,{destroy:void 0},n,r===void 0?null:r)}function ss(e,t,n,r){var i=Oo();r=r===void 0?null:r;var a=i.memoizedState.inst;co!==null&&r!==null&&yo(r,co.memoizedState.deps)?i.memoizedState=rs(t,a,n,r):(so.flags|=e,i.memoizedState=rs(1|t,a,n,r))}function cs(e,t){as(8390656,8,e,t)}function ls(e,t){ss(2048,8,e,t)}function us(e){so.flags|=4;var t=so.updateQueue;if(t===null)t=ko(),so.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ds(e){var t=Oo().memoizedState;return us({ref:t,nextImpl:e}),function(){if(zl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function fs(e,t){return ss(4,2,e,t)}function ps(e,t){return ss(4,4,e,t)}function ms(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function hs(e,t,n){n=n==null?null:n.concat([e]),ss(4,4,ms.bind(null,t,e),n)}function gs(){}function _s(e,t){var n=Oo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&yo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function vs(e,t){var n=Oo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&yo(t,r[1]))return r[0];if(r=e(),po){Ne(!0);try{e()}finally{Ne(!1)}}return n.memoizedState=[r,t],r}function ys(e,t,n){return n===void 0||oo&1073741824&&!(Hl&261930)?e.memoizedState=t:(e.memoizedState=n,e=yu(),so.lanes|=e,Xl|=e,n)}function bs(e,t,n,r){return gr(n,t)?n:Ka.current===null?!(oo&42)||oo&1073741824&&!(Hl&261930)?(tc=!0,e.memoizedState=n):(e=yu(),so.lanes|=e,Xl|=e,t):(e=ys(e,n,r),gr(e,t)||(tc=!0),e)}function xs(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};I.T=s,Ms(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?js(e,t,da(c,r),vu(e)):js(e,t,r,vu(e))}catch(n){js(e,t,{then:function(){},status:`rejected`,reason:n},vu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function Ss(){}function Cs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ws(e).queue;xs(e,a,t,ee,n===null?Ss:function(){return Ts(e),n(r)})}function ws(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:ee},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:No,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ts(e){var t=ws(e);t.next===null&&(t=e.alternate.memoizedState),js(e,t.next.queue,{},vu())}function Es(){return Xi(op)}function Ds(){return Oo().memoizedState}function Os(){return Oo().memoizedState}function ks(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=vu();e=La(n);var r=Ra(t,e,n);r!==null&&(bu(r,t,n),za(r,t,n)),t={cache:ra()},e.payload=t;return}t=t.return}}function As(e,t,n){var r=vu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ns(e)?Ps(t,n):(n=Xr(e,t,n,r),n!==null&&(bu(n,e,r),Fs(n,t,r)))}function K(e,t,n){js(e,t,n,vu())}function js(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ns(e))Ps(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,gr(s,o))return Yr(e,t,i,0),Bl===null&&Jr(),!1}catch{}if(n=Xr(e,t,i,r),n!==null)return bu(n,e,r),Fs(n,t,r),!0}return!1}function Ms(e,t,n,r){if(r={lane:2,revertLane:_d(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ns(e)){if(t)throw Error(i(479))}else t=Xr(e,n,r,2),t!==null&&bu(t,e,2)}function Ns(e){var t=e.alternate;return e===so||t!==null&&t===so}function Ps(e,t){fo=uo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Fs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qe(e,n)}}var Is={readContext:Xi,use:jo,useCallback:vo,useContext:vo,useEffect:vo,useImperativeHandle:vo,useLayoutEffect:vo,useInsertionEffect:vo,useMemo:vo,useReducer:vo,useRef:vo,useState:vo,useDebugValue:vo,useDeferredValue:vo,useTransition:vo,useSyncExternalStore:vo,useId:vo,useHostTransitionStatus:vo,useFormState:vo,useActionState:vo,useOptimistic:vo,useMemoCache:vo,useCacheRefresh:vo};Is.useEffectEvent=vo;var Ls={readContext:Xi,use:jo,useCallback:function(e,t){return Do().memoizedState=[e,t===void 0?null:t],e},useContext:Xi,useEffect:cs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),as(4194308,4,ms.bind(null,t,e),n)},useLayoutEffect:function(e,t){return as(4194308,4,e,t)},useInsertionEffect:function(e,t){as(4,2,e,t)},useMemo:function(e,t){var n=Do();t=t===void 0?null:t;var r=e();if(po){Ne(!0);try{e()}finally{Ne(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Do();if(n!==void 0){var i=n(t);if(po){Ne(!0);try{n(t)}finally{Ne(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=As.bind(null,so,e),[r.memoizedState,e]},useRef:function(e){var t=Do();return e={current:e},t.memoizedState=e},useState:function(e){e=Uo(e);var t=e.queue,n=K.bind(null,so,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:gs,useDeferredValue:function(e,t){return ys(Do(),e,t)},useTransition:function(){var e=Uo(!1);return e=xs.bind(null,so,e.queue,!0,!1),Do().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=so,a=Do();if(ki){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Bl===null)throw Error(i(349));Hl&127||Ro(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,cs(Bo.bind(null,r,o,e),[e]),r.flags|=2048,rs(9,{destroy:void 0},zo.bind(null,r,o,n,t),null),n},useId:function(){var e=Do(),t=Bl.identifierPrefix;if(ki){var n=xi,r=bi;n=(r&~(1<<32-Pe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=mo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=_o++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Es,useFormState:Qo,useActionState:Qo,useOptimistic:function(e){var t=Do();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ms.bind(null,so,!0,n),n.dispatch=t,[e,t]},useMemoCache:Mo,useCacheRefresh:function(){return Do().memoizedState=ks.bind(null,so)},useEffectEvent:function(e){var t=Do(),n={impl:e};return t.memoizedState=n,function(){if(zl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Rs={readContext:Xi,use:jo,useCallback:_s,useContext:Xi,useEffect:ls,useImperativeHandle:hs,useInsertionEffect:fs,useLayoutEffect:ps,useMemo:vs,useReducer:Po,useRef:is,useState:function(){return Po(No)},useDebugValue:gs,useDeferredValue:function(e,t){return bs(Oo(),co.memoizedState,e,t)},useTransition:function(){var e=Po(No)[0],t=Oo().memoizedState;return[typeof e==`boolean`?e:Ao(e),t]},useSyncExternalStore:Lo,useId:Ds,useHostTransitionStatus:Es,useFormState:$o,useActionState:$o,useOptimistic:function(e,t){return Wo(Oo(),co,e,t)},useMemoCache:Mo,useCacheRefresh:Os};Rs.useEffectEvent=ds;var zs={readContext:Xi,use:jo,useCallback:_s,useContext:Xi,useEffect:ls,useImperativeHandle:hs,useInsertionEffect:fs,useLayoutEffect:ps,useMemo:vs,useReducer:Io,useRef:is,useState:function(){return Io(No)},useDebugValue:gs,useDeferredValue:function(e,t){var n=Oo();return co===null?ys(n,e,t):bs(n,co.memoizedState,e,t)},useTransition:function(){var e=Io(No)[0],t=Oo().memoizedState;return[typeof e==`boolean`?e:Ao(e),t]},useSyncExternalStore:Lo,useId:Ds,useHostTransitionStatus:Es,useFormState:ns,useActionState:ns,useOptimistic:function(e,t){var n=Oo();return co===null?(n.baseState=e,[e,n.queue.dispatch]):Wo(n,co,e,t)},useMemoCache:Mo,useCacheRefresh:Os};zs.useEffectEvent=ds;function Bs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Vs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=vu(),i=La(r);i.payload=t,n!=null&&(i.callback=n),t=Ra(e,i,r),t!==null&&(bu(t,e,r),za(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=vu(),i=La(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ra(e,i,r),t!==null&&(bu(t,e,r),za(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=vu(),r=La(n);r.tag=2,t!=null&&(r.callback=t),t=Ra(e,r,n),t!==null&&(bu(t,e,n),za(t,e,n))}};function Hs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!_r(n,r)||!_r(i,a):!0}function Us(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Vs.enqueueReplaceState(t,t.state,null)}function Ws(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Gs(e){Wr(e)}function Ks(e){console.error(e)}function qs(e){Wr(e)}function Js(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ys(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Xs(e,t,n){return n=La(n),n.tag=3,n.payload={element:null},n.callback=function(){Js(e,t)},n}function Zs(e){return e=La(e),e.tag=3,e}function Qs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ys(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ys(t,n,r),typeof i!=`function`&&(cu===null?cu=new Set([this]):cu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function $s(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&qi(t,n,a,!0),n=Za.current,n!==null){switch(n.tag){case 31:case 13:return Qa===null?Mu():n.alternate===null&&Yl===0&&(Yl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ba?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Zu(e,r,a)),!1;case 22:return n.flags|=65536,r===ba?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Zu(e,r,a)),!1}throw Error(i(435,n.tag))}return Zu(e,r,a),Mu(),!1}if(ki)return t=Za.current,t===null?(r!==Mi&&(t=Error(i(423),{cause:r}),zi(fi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=fi(r,n),a=Xs(e.stateNode,r,a),Ba(e,a),Yl!==4&&(Yl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Mi&&(e=Error(i(422),{cause:r}),zi(fi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=fi(o,n),tu===null?tu=[o]:tu.push(o),Yl!==4&&(Yl=2),t===null)return!0;r=fi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Xs(n.stateNode,r,e),Ba(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(cu===null||!cu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Zs(a),Qs(a,e,n,r),Ba(n,a),!1}n=n.return}while(n!==null);return!1}var ec=Error(i(461)),tc=!1;function nc(e,t,n,r){t.child=e===null?Na(t,null,n,r):G(t,e.child,n,r)}function rc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Yi(t),r=bo(e,t,n,o,a,i),s=wo(),e!==null&&!tc?(To(e,t,i),Dc(e,t,i)):(ki&&s&&wi(t),t.flags|=1,nc(e,t,r,i),t.child)}function ic(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ri(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ac(e,t,a,r,i)):(e=oi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Oc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?_r:n,n(o,r)&&e.ref===t.ref)return Dc(e,t,i)}return t.flags|=1,e=ii(a,r),e.ref=t.ref,e.return=t,t.child=e}function ac(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(_r(a,r)&&e.ref===t.ref)if(tc=!1,t.pendingProps=r=a,Oc(e,i))e.flags&131072&&(tc=!0);else return t.lanes=e.lanes,Dc(e,t,i)}return pc(e,t,n,r,i)}function oc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return cc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ha(t,a===null?null:a.cachePool),a===null?Ya():Ja(t,a),to(t);else return r=t.lanes=536870912,cc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ha(t,null),Ya(),no(t)):(ha(t,a.cachePool),Ja(t,a),no(t),t.memoizedState=null);return nc(e,t,i,n),t.child}function sc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function cc(e,t,n,r,i){var a=ma();return a=a===null?null:{parent:na._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ha(t,null),Ya(),to(t),e!==null&&qi(e,t,r,!0),t.childLanes=i,null}function lc(e,t){return t=Sc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function uc(e,t,n){return G(t,e.child,null,n),e=lc(t,t.pendingProps),e.flags|=2,ro(t),t.memoizedState=null,e}function dc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(ki){if(r.mode===`hidden`)return e=lc(t,r),t.lanes=536870912,sc(null,e);if(eo(t),(e=Oi)?(e=ff(e,ji),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=li(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Ni(t);return t.lanes=536870912,null}return lc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(eo(t),a)if(t.flags&256)t.flags&=-257,t=uc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(tc||qi(e,t,n,!1),a=(n&e.childLanes)!==0,tc||a){if(r=Bl,r!==null&&(s=Je(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Zr(e,s),bu(r,e,s),ec;Mu(),t=uc(e,t,n)}else e=o.treeContext,Oi=gf(s.nextSibling),Di=t,ki=!0,Ai=null,ji=!1,e!==null&&Ei(t,e),t=lc(t,r),t.flags|=4096;return t}return e=ii(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function fc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function pc(e,t,n,r,i){return Yi(t),n=bo(e,t,n,r,void 0,i),r=wo(),e!==null&&!tc?(To(e,t,i),Dc(e,t,i)):(ki&&r&&wi(t),t.flags|=1,nc(e,t,n,i),t.child)}function mc(e,t,n,r,i,a){return Yi(t),t.updateQueue=null,n=So(t,r,n,i),xo(e),r=wo(),e!==null&&!tc?(To(e,t,a),Dc(e,t,a)):(ki&&r&&wi(t),t.flags|=1,nc(e,t,n,a),t.child)}function hc(e,t,n,r,i){if(Yi(t),t.stateNode===null){var a=ei,o=n.contextType;typeof o==`object`&&o&&(a=Xi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Vs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Fa(t),o=n.contextType,a.context=typeof o==`object`&&o?Xi(o):ei,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Bs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Vs.enqueueReplaceState(a,a.state,null),Ua(t,r,a,i),Ha(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Ws(n,s);a.props=c;var l=a.context,u=n.contextType;o=ei,typeof u==`object`&&u&&(o=Xi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Us(t,a,r,o),Pa=!1;var f=t.memoizedState;a.state=f,Ua(t,r,a,i),Ha(),l=t.memoizedState,s||f!==l||Pa?(typeof d==`function`&&(Bs(t,n,d,r),l=t.memoizedState),(c=Pa||Hs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ia(e,t),o=t.memoizedProps,u=Ws(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ei,typeof l==`object`&&l&&(c=Xi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Us(t,a,r,c),Pa=!1,f=t.memoizedState,a.state=f,Ua(t,r,a,i),Ha();var p=t.memoizedState;o!==d||f!==p||Pa||e!==null&&e.dependencies!==null&&Ji(e.dependencies)?(typeof s==`function`&&(Bs(t,n,s,r),p=t.memoizedState),(u=Pa||Hs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ji(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,fc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=G(t,e.child,null,i),t.child=G(t,null,n,i)):nc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Dc(e,t,i),e}function gc(e,t,n,r){return Li(),t.flags|=256,nc(e,t,n,r),t.child}var _c={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function vc(e){return{baseLanes:e,cachePool:ga()}}function yc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=$l),e}function bc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(io.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(ki){if(a?$a(t):no(t),(e=Oi)?(e=ff(e,ji),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=li(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Ni(t);return mf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(no(t),a=t.mode,c=Sc({mode:`hidden`,children:c},a),r=si(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=vc(n),r.childLanes=yc(e,s,n),t.memoizedState=_c,sc(null,r)):($a(t),xc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?($a(t),t.flags&=-257,t=Cc(e,t,n)):t.memoizedState===null?(no(t),c=r.fallback,a=t.mode,r=Sc({mode:`visible`,children:r.children},a),c=si(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,G(t,e.child,null,n),r=t.child,r.memoizedState=vc(n),r.childLanes=yc(e,s,n),t.memoizedState=_c,t=sc(null,r)):(no(t),t.child=e.child,t.flags|=128,t=null);else if($a(t),mf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,zi({value:r,source:null,stack:null}),t=Cc(e,t,n)}else if(tc||qi(e,t,n,!1),s=(n&e.childLanes)!==0,tc||s){if(s=Bl,s!==null&&(r=Je(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Zr(e,r),bu(s,e,r),ec;pf(c)||Mu(),t=Cc(e,t,n)}else pf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Oi=gf(c.nextSibling),Di=t,ki=!0,Ai=null,ji=!1,e!==null&&Ei(t,e),t=xc(t,r.children),t.flags|=4096);return t}return a?(no(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ii(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=si(c,a,n,null),c.flags|=2):c=ii(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,sc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=vc(n):(a=c.cachePool,a===null?a=ga():(l=na._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=yc(e,s,n),t.memoizedState=_c,sc(e.child,r)):($a(t),n=e.child,e=n.sibling,n=ii(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function xc(e,t){return t=Sc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Sc(e,t){return e=ni(22,e,null,t),e.lanes=0,e}function Cc(e,t,n){return G(t,e.child,null,n),e=xc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function wc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Gi(e.return,t,n)}function Tc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Ec(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=io.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,B(io,o),nc(e,t,r,n),r=ki?gi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&wc(e,n,t);else if(e.tag===19)wc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ao(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Tc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ao(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Tc(t,!0,n,null,a,r);break;case`together`:Tc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Dc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Xl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(qi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ii(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ii(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Oc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Ji(e))):!0}function kc(e,t,n){switch(t.tag){case 3:oe(t,t.stateNode.containerInfo),Ui(t,na,e.memoizedState.cache),Li();break;case 27:case 5:ce(t);break;case 4:oe(t,t.stateNode.containerInfo);break;case 10:Ui(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,eo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?($a(t),e=Dc(e,t,n),e===null?null:e.sibling):bc(e,t,n):($a(t),t.flags|=128,null);$a(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(qi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Ec(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),B(io,io.current),r)break;return null;case 22:return t.lanes=0,oc(e,t,n,t.pendingProps);case 24:Ui(t,na,e.memoizedState.cache)}return Dc(e,t,n)}function Ac(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)tc=!0;else{if(!Oc(e,n)&&!(t.flags&128))return tc=!1,kc(e,t,n);tc=!!(e.flags&131072)}else tc=!1,ki&&t.flags&1048576&&Ci(t,gi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ca(t.elementType),t.type=e,typeof e==`function`)ri(e)?(r=Ws(e,r),t.tag=1,t=hc(null,t,e,r,n)):(t.tag=0,t=pc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=rc(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=ic(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return pc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Ws(r,t.pendingProps),hc(e,t,r,a,n);case 3:a:{if(oe(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ia(e,t),Ua(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ui(t,na,r),r!==o.cache&&Ki(t,[na],n,!0),Ha(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=gc(e,t,r,n);break a}else if(r!==a){a=fi(Error(i(424)),t),zi(a),t=gc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Oi=gf(e.firstChild),Di=t,ki=!0,Ai=null,ji=!0,n=Na(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Li(),r===a){t=Dc(e,t,n);break a}nc(e,t,r,n)}t=t.child}return t;case 26:return fc(e,t),e===null?(n=Lf(t.type,null,t.pendingProps,null))?t.memoizedState=n:ki||(n=t.type,e=t.pendingProps,r=Jd(ie.current).createElement(n),r[et]=t,r[tt]=e,Hd(r,n,e),pt(r),t.stateNode=r):t.memoizedState=Lf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ce(t),e===null&&ki&&(r=t.stateNode=bf(t.type,t.pendingProps,ie.current),Di=t,ji=!0,a=Oi,of(t.type)?(_f=a,Oi=gf(r.firstChild)):Oi=a),nc(e,t,t.pendingProps.children,n),fc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ki&&((a=r=Oi)&&(r=uf(r,t.type,t.pendingProps,ji),r===null?a=!1:(t.stateNode=r,Di=t,Oi=gf(r.firstChild),ji=!1,a=!0)),a||Ni(t)),ce(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Zd(a,o)?r=null:s!==null&&Zd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=bo(e,t,Co,null,null,n),op._currentValue=a),fc(e,t),nc(e,t,r,n),t.child;case 6:return e===null&&ki&&((e=n=Oi)&&(n=df(n,t.pendingProps,ji),n===null?e=!1:(t.stateNode=n,Di=t,Oi=null,e=!0)),e||Ni(t)),null;case 13:return bc(e,t,n);case 4:return oe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=G(t,null,r,n):nc(e,t,r,n),t.child;case 11:return rc(e,t,t.type,t.pendingProps,n);case 7:return nc(e,t,t.pendingProps,n),t.child;case 8:return nc(e,t,t.pendingProps.children,n),t.child;case 12:return nc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ui(t,t.type,r.value),nc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Yi(t),a=Xi(a),r=r(a),t.flags|=1,nc(e,t,r,n),t.child;case 14:return ic(e,t,t.type,t.pendingProps,n);case 15:return ac(e,t,t.type,t.pendingProps,n);case 19:return Ec(e,t,n);case 31:return dc(e,t,n);case 22:return oc(e,t,n,t.pendingProps);case 24:return Yi(t),r=Xi(na),e===null?(a=ma(),a===null&&(a=Bl,o=ra(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Fa(t),Ui(t,na,a)):((e.lanes&n)!==0&&(Ia(e,t),Ua(t,null,null,n),Ha()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ui(t,na,r),r!==a.cache&&Ki(t,[na],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ui(t,na,r))),nc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function jc(e){e.flags|=4}function Mc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(ku())e.flags|=8192;else throw wa=ba,va}else e.flags&=-16777217}function Nc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Qf(t))if(ku())e.flags|=8192;else throw wa=ba,va}function Pc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:He(),e.lanes|=t,eu|=t)}function Fc(e,t){if(!ki)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ic(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Lc(e,t,n){var r=t.pendingProps;switch(Ti(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ic(t),null;case 1:return Ic(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Wi(na),se(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ii(t)?jc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ri())),Ic(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(jc(t),o===null?(Ic(t),Mc(t,a,null,r,n)):(Ic(t),Nc(t,o))):o?o===e.memoizedState?(Ic(t),t.flags&=-16777217):(jc(t),Ic(t),Nc(t,o)):(e=e.memoizedProps,e!==r&&jc(t),Ic(t),Mc(t,a,e,r,n)),null;case 27:if(le(t),n=ie.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&jc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Ic(t),null}e=re.current,Ii(t)?Pi(t,e):(e=bf(a,r,n),t.stateNode=e,jc(t))}return Ic(t),null;case 5:if(le(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&jc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Ic(t),null}if(o=re.current,Ii(t))Pi(t,o);else{var s=Jd(ie.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[et]=t,o[tt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Hd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&jc(t)}}return Ic(t),Mc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&jc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ie.current,Ii(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Di,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[et]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||zd(e.nodeValue,n)),e||Ni(t,!0)}else e=Jd(e).createTextNode(r),e[et]=t,t.stateNode=e}return Ic(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ii(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[et]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),e=!1}else n=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ro(t),t):(ro(t),null);if(t.flags&128)throw Error(i(558))}return Ic(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ii(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[et]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ic(t),a=!1}else a=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ro(t),t):(ro(t),null)}return ro(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Pc(t,t.updateQueue),Ic(t),null);case 4:return se(),e===null&&kd(t.stateNode.containerInfo),Ic(t),null;case 10:return Wi(t.type),Ic(t),null;case 19:if(z(io),r=t.memoizedState,r===null)return Ic(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Fc(r,!1);else{if(Yl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ao(e),o!==null){for(t.flags|=128,Fc(r,!1),e=o.updateQueue,t.updateQueue=e,Pc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ai(n,e),n=n.sibling;return B(io,io.current&1|2),ki&&Si(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Se()>ou&&(t.flags|=128,a=!0,Fc(r,!1),t.lanes=4194304)}else{if(!a)if(e=ao(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Pc(t,e),Fc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!ki)return Ic(t),null}else 2*Se()-r.renderingStartTime>ou&&n!==536870912&&(t.flags|=128,a=!0,Fc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Ic(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Se(),e.sibling=null,n=io.current,B(io,a?n&1|2:n&1),ki&&Si(t,r.treeForkCount),e);case 22:case 23:return ro(t),Xa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ic(t),t.subtreeFlags&6&&(t.flags|=8192)):Ic(t),n=t.updateQueue,n!==null&&Pc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&z(pa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Wi(na),Ic(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Rc(e,t){switch(Ti(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wi(na),se(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return le(t),null;case 31:if(t.memoizedState!==null){if(ro(t),t.alternate===null)throw Error(i(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ro(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(io),null;case 4:return se(),null;case 10:return Wi(t.type),null;case 22:case 23:return ro(t),Xa(),e!==null&&z(pa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Wi(na),null;case 25:return null;default:return null}}function zc(e,t){switch(Ti(t),t.tag){case 3:Wi(na),se();break;case 26:case 27:case 5:le(t);break;case 4:se();break;case 31:t.memoizedState!==null&&ro(t);break;case 13:ro(t);break;case 19:z(io);break;case 10:Wi(t.type);break;case 22:case 23:ro(t),Xa(),e!==null&&z(pa);break;case 24:Wi(na)}}function Bc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Xu(t,t.return,e)}}function Vc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Xu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Xu(t,t.return,e)}}function Hc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ga(t,n)}catch(t){Xu(e,e.return,t)}}}function Uc(e,t,n){n.props=Ws(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Xu(e,t,n)}}function Wc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Xu(e,t,n)}}function Gc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Xu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Xu(e,t,n)}else n.current=null}function Kc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Xu(e,e.return,t)}}function qc(e,t,n){try{var r=e.stateNode;Ud(r,e.type,n,t),r[tt]=t}catch(t){Xu(e,e.return,t)}}function Jc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&of(e.type)||e.tag===4}function Yc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Jc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&of(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Xc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=qt));else if(r!==4&&(r===27&&of(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}function Zc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&of(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Hd(t,r,n),t[et]=e,t[tt]=n}catch(t){Xu(e,e.return,t)}}var $c=!1,el=!1,tl=!1,nl=typeof WeakSet==`function`?WeakSet:Set,rl=null;function il(e,t){if(e=e.containerInfo,Kd=hp,e=xr(e),Sr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(qd={focusedElem:e,selectionRange:n},hp=!1,rl=t;rl!==null;)if(t=rl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,rl=e;else for(;rl!==null;){switch(t=rl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Ws(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Xu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)lf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:lf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,rl=e;break}rl=t.return}}function al(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:bl(e,n),r&4&&Bc(5,n);break;case 1:if(bl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Xu(n,n.return,e)}else{var i=Ws(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Xu(n,n.return,e)}}r&64&&Hc(n),r&512&&Wc(n,n.return);break;case 3:if(bl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ga(e,t)}catch(e){Xu(n,n.return,e)}}break;case 27:t===null&&r&4&&Qc(n);case 26:case 5:bl(e,n),t===null&&r&4&&Kc(n),r&512&&Wc(n,n.return);break;case 12:bl(e,n);break;case 31:bl(e,n),r&4&&dl(e,n);break;case 13:bl(e,n),r&4&&fl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=ed.bind(null,n),hf(e,n))));break;case 22:if(r=n.memoizedState!==null||$c,!r){t=t!==null&&t.memoizedState!==null||el,i=$c;var a=el;$c=r,(el=t)&&!a?Sl(e,n,(n.subtreeFlags&8772)!=0):bl(e,n),$c=i,el=a}break;case 30:break;default:bl(e,n)}}function ol(e){var t=e.alternate;t!==null&&(e.alternate=null,ol(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ct(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var sl=null,cl=!1;function ll(e,t,n){for(n=n.child;n!==null;)ul(e,t,n),n=n.sibling}function ul(e,t,n){if(Me&&typeof Me.onCommitFiberUnmount==`function`)try{Me.onCommitFiberUnmount(je,n)}catch{}switch(n.tag){case 26:el||Gc(n,t),ll(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:el||Gc(n,t);var r=sl,i=cl;of(n.type)&&(sl=n.stateNode,cl=!1),ll(e,t,n),xf(n.stateNode),sl=r,cl=i;break;case 5:el||Gc(n,t);case 6:if(r=sl,i=cl,sl=null,ll(e,t,n),sl=r,cl=i,sl!==null)if(cl)try{(sl.nodeType===9?sl.body:sl.nodeName===`HTML`?sl.ownerDocument.body:sl).removeChild(n.stateNode)}catch(e){Xu(n,t,e)}else try{sl.removeChild(n.stateNode)}catch(e){Xu(n,t,e)}break;case 18:sl!==null&&(cl?(e=sl,sf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Vp(e)):sf(sl,n.stateNode));break;case 4:r=sl,i=cl,sl=n.stateNode.containerInfo,cl=!0,ll(e,t,n),sl=r,cl=i;break;case 0:case 11:case 14:case 15:Vc(2,n,t),el||Vc(4,n,t),ll(e,t,n);break;case 1:el||(Gc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Uc(n,t,r)),ll(e,t,n);break;case 21:ll(e,t,n);break;case 22:el=(r=el)||n.memoizedState!==null,ll(e,t,n),el=r;break;default:ll(e,t,n)}}function dl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Vp(e)}catch(e){Xu(t,t.return,e)}}}function fl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Vp(e)}catch(e){Xu(t,t.return,e)}}function pl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new nl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new nl),t;default:throw Error(i(435,e.tag))}}function ml(e,t){var n=pl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=td.bind(null,e,t);t.then(r,r)}})}function hl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(of(c.type)){sl=c.stateNode,cl=!1;break a}break;case 5:sl=c.stateNode,cl=!1;break a;case 3:case 4:sl=c.stateNode.containerInfo,cl=!0;break a}c=c.return}if(sl===null)throw Error(i(160));ul(o,s,a),sl=null,cl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)_l(t,e),t=t.sibling}var gl=null;function _l(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:hl(t,e),vl(e),r&4&&(Vc(3,e,e.return),Bc(3,e),Vc(5,e,e.return));break;case 1:hl(t,e),vl(e),r&512&&(el||n===null||Gc(n,n.return)),r&64&&$c&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=gl;if(hl(t,e),vl(e),r&512&&(el||n===null||Gc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[st]||o[et]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Hd(o,r,n),o[et]=e,pt(o),r=o;break a;case`link`:var s=Yf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Hd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Yf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Hd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[et]=e,pt(o),r=o}e.stateNode=r}else Xf(a,e.type,e.stateNode);else e.stateNode=Wf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&qc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Xf(a,e.type,e.stateNode):Wf(a,r,e.memoizedProps))}break;case 27:hl(t,e),vl(e),r&512&&(el||n===null||Gc(n,n.return)),n!==null&&r&4&&qc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(hl(t,e),vl(e),r&512&&(el||n===null||Gc(n,n.return)),e.flags&32){a=e.stateNode;try{zt(a,``)}catch(t){Xu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,qc(e,a,n===null?a:n.memoizedProps)),r&1024&&(tl=!0);break;case 6:if(hl(t,e),vl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Xu(e,e.return,t)}}break;case 3:if(Jf=null,a=gl,gl=wf(t.containerInfo),hl(t,e),gl=a,vl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Vp(t.containerInfo)}catch(t){Xu(e,e.return,t)}tl&&(tl=!1,yl(e));break;case 4:r=gl,gl=wf(e.stateNode.containerInfo),hl(t,e),vl(e),gl=r;break;case 12:hl(t,e),vl(e);break;case 31:hl(t,e),vl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ml(e,r)));break;case 13:hl(t,e),vl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(iu=Se()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ml(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=$c,d=el;if($c=u||a,el=d||l,hl(t,e),el=d,$c=u,vl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||$c||el||xl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Xu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Xu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?cf(m,!0):cf(l.stateNode,!1)}catch(e){Xu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ml(e,n))));break;case 19:hl(t,e),vl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ml(e,r)));break;case 30:break;case 21:break;default:hl(t,e),vl(e)}}function vl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Jc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Zc(e,Yc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(zt(o,``),n.flags&=-33),Zc(e,Yc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Xc(e,Yc(e),s);break;default:throw Error(i(161))}}catch(t){Xu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;yl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function bl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)al(e,t.alternate,t),t=t.sibling}function xl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Vc(4,t,t.return),xl(t);break;case 1:Gc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Uc(t,t.return,n),xl(t);break;case 27:xf(t.stateNode);case 26:case 5:Gc(t,t.return),xl(t);break;case 22:t.memoizedState===null&&xl(t);break;case 30:xl(t);break;default:xl(t)}e=e.sibling}}function Sl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Sl(i,a,n),Bc(4,a);break;case 1:if(Sl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Xu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Wa(c[i],s)}catch(e){Xu(r,r.return,e)}}n&&o&64&&Hc(a),Wc(a,a.return);break;case 27:Qc(a);case 26:case 5:Sl(i,a,n),n&&r===null&&o&4&&Kc(a),Wc(a,a.return);break;case 12:Sl(i,a,n);break;case 31:Sl(i,a,n),n&&o&4&&dl(i,a);break;case 13:Sl(i,a,n),n&&o&4&&fl(i,a);break;case 22:a.memoizedState===null&&Sl(i,a,n),Wc(a,a.return);break;case 30:break;default:Sl(i,a,n)}t=t.sibling}}function Cl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ia(n))}function wl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ia(e))}function Tl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)El(e,t,n,r),t=t.sibling}function El(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Tl(e,t,n,r),i&2048&&Bc(9,t);break;case 1:Tl(e,t,n,r);break;case 3:Tl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ia(e)));break;case 12:if(i&2048){Tl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Xu(t,t.return,e)}}else Tl(e,t,n,r);break;case 31:Tl(e,t,n,r);break;case 13:Tl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Tl(e,t,n,r):(a._visibility|=2,Dl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Tl(e,t,n,r):Ol(e,t),i&2048&&Cl(o,t);break;case 24:Tl(e,t,n,r),i&2048&&wl(t.alternate,t);break;default:Tl(e,t,n,r)}}function Dl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Dl(a,o,s,c,i),Bc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Dl(a,o,s,c,i)):u._visibility&2?Dl(a,o,s,c,i):Ol(a,o),i&&l&2048&&Cl(o.alternate,o);break;case 24:Dl(a,o,s,c,i),i&&l&2048&&wl(o.alternate,o);break;default:Dl(a,o,s,c,i)}t=t.sibling}}function Ol(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Ol(n,r),i&2048&&Cl(r.alternate,r);break;case 24:Ol(n,r),i&2048&&wl(r.alternate,r);break;default:Ol(n,r)}t=t.sibling}}var kl=8192;function Al(e,t,n){if(e.subtreeFlags&kl)for(e=e.child;e!==null;)jl(e,t,n),e=e.sibling}function jl(e,t,n){switch(e.tag){case 26:Al(e,t,n),e.flags&kl&&e.memoizedState!==null&&$f(n,gl,e.memoizedState,e.memoizedProps);break;case 5:Al(e,t,n);break;case 3:case 4:var r=gl;gl=wf(e.stateNode.containerInfo),Al(e,t,n),gl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=kl,kl=16777216,Al(e,t,n),kl=r):Al(e,t,n));break;default:Al(e,t,n)}}function Ml(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Nl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];rl=r,Il(r,e)}Ml(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Pl(e),e=e.sibling}function Pl(e){switch(e.tag){case 0:case 11:case 15:Nl(e),e.flags&2048&&Vc(9,e,e.return);break;case 3:Nl(e);break;case 12:Nl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Fl(e)):Nl(e);break;default:Nl(e)}}function Fl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];rl=r,Il(r,e)}Ml(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Vc(8,t,t.return),Fl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Fl(t));break;default:Fl(t)}e=e.sibling}}function Il(e,t){for(;rl!==null;){var n=rl;switch(n.tag){case 0:case 11:case 15:Vc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ia(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,rl=r;else a:for(n=e;rl!==null;){r=rl;var i=r.sibling,a=r.return;if(ol(r),r===n){rl=null;break a}if(i!==null){i.return=a,rl=i;break a}rl=a}}}var Ll={getCacheForType:function(e){var t=Xi(na),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Xi(na).controller.signal}},Rl=typeof WeakMap==`function`?WeakMap:Map,zl=0,Bl=null,Vl=null,Hl=0,Ul=0,Wl=null,Gl=!1,Kl=!1,ql=!1,Jl=0,Yl=0,Xl=0,Zl=0,Ql=0,$l=0,eu=0,tu=null,nu=null,ru=!1,iu=0,au=0,ou=1/0,su=null,cu=null,lu=0,uu=null,du=null,fu=0,pu=0,mu=null,hu=null,gu=0,_u=null;function vu(){return zl&2&&Hl!==0?Hl&-Hl:I.T===null?Ze():_d()}function yu(){if($l===0)if(!(Hl&536870912)||ki){var e=ze;ze<<=1,!(ze&3932160)&&(ze=262144),$l=e}else $l=536870912;return e=Za.current,e!==null&&(e.flags|=32),$l}function bu(e,t,n){(e===Bl&&(Ul===2||Ul===9)||e.cancelPendingCommit!==null)&&(Du(e,0),wu(e,Hl,$l,!1)),We(e,n),(!(zl&2)||e!==Bl)&&(e===Bl&&(!(zl&2)&&(Zl|=n),Yl===4&&wu(e,Hl,$l,!1)),ld(e))}function xu(e,t,n){if(zl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||W(e,t),a=r?Fu(e,t):Nu(e,t,!0),o=r;do{if(a===0){Kl&&!r&&wu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Cu(n)){a=Nu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=tu;var l=c.current.memoizedState.isDehydrated;if(l&&(Du(c,s).flags|=256),s=Nu(c,s,!1),s!==2){if(ql&&!l){c.errorRecoveryDisabledLanes|=o,Zl|=o,a=4;break a}o=nu,nu=a,o!==null&&(nu===null?nu=o:nu.push.apply(nu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Du(e,0),wu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:wu(r,t,$l,!Gl);break a;case 2:nu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=iu+300-Se(),10<a)){if(wu(r,t,$l,!Gl),Be(r,0,!0)!==0)break a;fu=t,r.timeoutHandle=ef(Su.bind(null,r,n,nu,su,ru,t,$l,Zl,eu,Gl,o,`Throttled`,-0,0),a);break a}Su(r,n,nu,su,ru,t,$l,Zl,eu,Gl,o,null,-0,0)}}break}while(1);ld(e)}function Su(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qt},jl(t,a,d);var m=(a&62914560)===a?iu-Se():(a&4194048)===a?au-Se():0;if(m=tp(d,m),m!==null){fu=a,e.cancelPendingCommit=m(Hu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),wu(e,a,o,!l);return}}Hu(e,t,a,n,r,i,o,s,c)}function Cu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!gr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function wu(e,t,n,r){t&=~Ql,t&=~Zl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Pe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ke(e,n,t)}function Tu(){return zl&6?!0:(ud(0,!1),!1)}function Eu(){if(Vl!==null){if(Ul===0)var e=Vl.return;else e=Vl,Hi=Vi=null,Eo(e),Da=null,Oa=0,e=Vl;for(;e!==null;)zc(e.alternate,e),e=e.return;Vl=null}}function Du(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,tf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),fu=0,Eu(),Bl=e,Vl=n=ii(e.current,null),Hl=t,Ul=0,Wl=null,Gl=!1,Kl=W(e,t),ql=!1,eu=$l=Ql=Zl=Xl=Yl=0,nu=tu=null,ru=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Pe(r),a=1<<i;t|=e[i],r&=~a}return Jl=t,Jr(),n}function Ou(e,t){so=null,I.H=Is,t===_a||t===ya?(t=Ta(),Ul=3):t===va?(t=Ta(),Ul=4):Ul=t===ec?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Wl=t,Vl===null&&(Yl=1,Js(e,fi(t,e.current)))}function ku(){var e=Za.current;return e===null?!0:(Hl&4194048)===Hl?Qa===null:(Hl&62914560)===Hl||Hl&536870912?e===Qa:!1}function Au(){var e=I.H;return I.H=Is,e===null?Is:e}function ju(){var e=I.A;return I.A=Ll,e}function Mu(){Yl=4,Gl||(Hl&4194048)!==Hl&&Za.current!==null||(Kl=!0),!(Xl&134217727)&&!(Zl&134217727)||Bl===null||wu(Bl,Hl,$l,!1)}function Nu(e,t,n){var r=zl;zl|=2;var i=Au(),a=ju();(Bl!==e||Hl!==t)&&(su=null,Du(e,t)),t=!1;var o=Yl;a:do try{if(Ul!==0&&Vl!==null){var s=Vl,c=Wl;switch(Ul){case 8:Eu(),o=6;break a;case 3:case 2:case 9:case 6:Za.current===null&&(t=!0);var l=Ul;if(Ul=0,Wl=null,zu(e,s,c,l),n&&Kl){o=0;break a}break;default:l=Ul,Ul=0,Wl=null,zu(e,s,c,l)}}Pu(),o=Yl;break}catch(t){Ou(e,t)}while(1);return t&&e.shellSuspendCounter++,Hi=Vi=null,zl=r,I.H=i,I.A=a,Vl===null&&(Bl=null,Hl=0,Jr()),o}function Pu(){for(;Vl!==null;)Lu(Vl)}function Fu(e,t){var n=zl;zl|=2;var r=Au(),a=ju();Bl!==e||Hl!==t?(su=null,ou=Se()+500,Du(e,t)):Kl=W(e,t);a:do try{if(Ul!==0&&Vl!==null){t=Vl;var o=Wl;b:switch(Ul){case 1:Ul=0,Wl=null,zu(e,t,o,1);break;case 2:case 9:if(xa(o)){Ul=0,Wl=null,Ru(t);break}t=function(){Ul!==2&&Ul!==9||Bl!==e||(Ul=7),ld(e)},o.then(t,t);break a;case 3:Ul=7;break a;case 4:Ul=5;break a;case 7:xa(o)?(Ul=0,Wl=null,Ru(t)):(Ul=0,Wl=null,zu(e,t,o,7));break;case 5:var s=null;switch(Vl.tag){case 26:s=Vl.memoizedState;case 5:case 27:var c=Vl;if(s?Qf(s):c.stateNode.complete){Ul=0,Wl=null;var l=c.sibling;if(l!==null)Vl=l;else{var u=c.return;u===null?Vl=null:(Vl=u,Bu(u))}break b}}Ul=0,Wl=null,zu(e,t,o,5);break;case 6:Ul=0,Wl=null,zu(e,t,o,6);break;case 8:Eu(),Yl=6;break a;default:throw Error(i(462))}}Iu();break}catch(t){Ou(e,t)}while(1);return Hi=Vi=null,I.H=r,I.A=a,zl=n,Vl===null?(Bl=null,Hl=0,Jr(),Yl):0}function Iu(){for(;Vl!==null&&!be();)Lu(Vl)}function Lu(e){var t=Ac(e.alternate,e,Jl);e.memoizedProps=e.pendingProps,t===null?Bu(e):Vl=t}function Ru(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=mc(n,t,t.pendingProps,t.type,void 0,Hl);break;case 11:t=mc(n,t,t.pendingProps,t.type.render,t.ref,Hl);break;case 5:Eo(t);default:zc(n,t),t=Vl=ai(t,Jl),t=Ac(n,t,Jl)}e.memoizedProps=e.pendingProps,t===null?Bu(e):Vl=t}function zu(e,t,n,r){Hi=Vi=null,Eo(t),Da=null,Oa=0;var i=t.return;try{if($s(e,i,t,n,Hl)){Yl=1,Js(e,fi(n,e.current)),Vl=null;return}}catch(t){if(i!==null)throw Vl=i,t;Yl=1,Js(e,fi(n,e.current)),Vl=null;return}t.flags&32768?(ki||r===1?e=!0:Kl||Hl&536870912?e=!1:(Gl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Za.current,r!==null&&r.tag===13&&(r.flags|=16384))),Vu(t,e)):Bu(t)}function Bu(e){var t=e;do{if(t.flags&32768){Vu(t,Gl);return}e=t.return;var n=Lc(t.alternate,t,Jl);if(n!==null){Vl=n;return}if(t=t.sibling,t!==null){Vl=t;return}Vl=t=e}while(t!==null);Yl===0&&(Yl=5)}function Vu(e,t){do{var n=Rc(e.alternate,e);if(n!==null){n.flags&=32767,Vl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Vl=e;return}Vl=e=n}while(e!==null);Yl=6,Vl=null}function Hu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do qu();while(lu!==0);if(zl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=qr,Ge(e,n,o,s,c,l),e===Bl&&(Vl=Bl=null,Hl=0),du=t,uu=e,fu=n,pu=o,mu=a,hu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,nd(Ee,function(){return Ju(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=I.T,I.T=null,a=L.p,L.p=2,s=zl,zl|=4;try{il(e,t,n)}finally{zl=s,L.p=a,I.T=r}}lu=1,Uu(),Wu(),Gu()}}function Uu(){if(lu===1){lu=0;var e=uu,t=du,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=zl;zl|=4;try{_l(t,e);var a=qd,o=xr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&br(s.ownerDocument.documentElement,s)){if(c!==null&&Sr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=yr(s,h),v=yr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}hp=!!Kd,qd=Kd=null}finally{zl=i,L.p=r,I.T=n}}e.current=t,lu=2}}function Wu(){if(lu===2){lu=0;var e=uu,t=du,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=zl;zl|=4;try{al(e,t.alternate,t)}finally{zl=i,L.p=r,I.T=n}}lu=3}}function Gu(){if(lu===4||lu===3){lu=0,xe();var e=uu,t=du,n=fu,r=hu;t.subtreeFlags&10256||t.flags&10256?lu=5:(lu=0,du=uu=null,Ku(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(cu=null),Xe(n),t=t.stateNode,Me&&typeof Me.onCommitFiberRoot==`function`)try{Me.onCommitFiberRoot(je,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=I.T,i=L.p,L.p=2,I.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{I.T=t,L.p=i}}fu&3&&qu(),ld(e),i=e.pendingLanes,n&261930&&i&42?e===_u?gu++:(gu=0,_u=e):gu=0,ud(0,!1)}}function Ku(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ia(t)))}function qu(){return Uu(),Wu(),Gu(),Ju()}function Ju(){if(lu!==5)return!1;var e=uu,t=pu;pu=0;var n=Xe(fu),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=mu,mu=null;var o=uu,s=fu;if(lu=0,du=uu=null,fu=0,zl&6)throw Error(i(331));var c=zl;if(zl|=4,Pl(o.current),El(o,o.current,s,n),zl=c,ud(0,!1),Me&&typeof Me.onPostCommitFiberRoot==`function`)try{Me.onPostCommitFiberRoot(je,o)}catch{}return!0}finally{L.p=a,I.T=r,Ku(e,t)}}function Yu(e,t,n){t=fi(n,t),t=Xs(e.stateNode,t,2),e=Ra(e,t,2),e!==null&&(We(e,2),ld(e))}function Xu(e,t,n){if(e.tag===3)Yu(e,e,n);else for(;t!==null;){if(t.tag===3){Yu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(cu===null||!cu.has(r))){e=fi(n,e),n=Zs(2),r=Ra(t,n,2),r!==null&&(Qs(n,r,t,e),We(r,2),ld(r));break}}t=t.return}}function Zu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Rl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ql=!0,i.add(n),e=Qu.bind(null,e,t,n),t.then(e,e))}function Qu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Bl===e&&(Hl&n)===n&&(Yl===4||Yl===3&&(Hl&62914560)===Hl&&300>Se()-iu?!(zl&2)&&Du(e,0):Ql|=n,eu===Hl&&(eu=0)),ld(e)}function $u(e,t){t===0&&(t=He()),e=Zr(e,t),e!==null&&(We(e,t),ld(e))}function ed(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),$u(e,n)}function td(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),$u(e,n)}function nd(e,t){return ve(e,t)}var rd=null,id=null,ad=!1,od=!1,sd=!1,cd=0;function ld(e){e!==id&&e.next===null&&(id===null?rd=id=e:id=id.next=e),od=!0,ad||(ad=!0,gd())}function ud(e,t){if(!sd&&od){sd=!0;do for(var n=!1,r=rd;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Pe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,hd(r,a))}else a=Hl,a=Be(r,r===Bl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||W(r,a)||(n=!0,hd(r,a));r=r.next}while(n);sd=!1}}function dd(){fd()}function fd(){od=ad=!1;var e=0;cd!==0&&$d()&&(e=cd);for(var t=Se(),n=null,r=rd;r!==null;){var i=r.next,a=pd(r,t);a===0?(r.next=null,n===null?rd=i:n.next=i,i===null&&(id=n)):(n=r,(e!==0||a&3)&&(od=!0)),r=i}lu!==0&&lu!==5||ud(e,!1),cd!==0&&(cd=0)}function pd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Pe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ve(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Bl,n=Hl,n=Be(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Ul===2||Ul===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ye(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||W(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ye(r),Xe(n)){case 2:case 8:n=Te;break;case 32:n=Ee;break;case 268435456:n=Oe;break;default:n=Ee}return r=md.bind(null,e),n=ve(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ye(r),e.callbackPriority=2,e.callbackNode=null,2}function md(e,t){if(lu!==0&&lu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(qu()&&e.callbackNode!==n)return null;var r=Hl;return r=Be(e,e===Bl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(xu(e,r,t),pd(e,Se()),e.callbackNode!=null&&e.callbackNode===n?md.bind(null,e):null)}function hd(e,t){if(qu())return null;xu(e,t,!0)}function gd(){rf(function(){zl&6?ve(we,dd):fd()})}function _d(){if(cd===0){var e=sa;e===0&&(e=Re,Re<<=1,!(Re&261888)&&(Re=256)),cd=e}return cd}function vd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Kt(``+e)}function yd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function bd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=vd((i[tt]||null).action),o=r.submitter;o&&(t=(t=o[tt]||null)?vd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new hn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(cd!==0){var e=o?yd(i,o):new FormData(i);Cs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?yd(i,o):new FormData(i),Cs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var xd=0;xd<Hr.length;xd++){var Sd=Hr[xd];Ur(Sd.toLowerCase(),`on`+(Sd[0].toUpperCase()+Sd.slice(1)))}Ur(Pr,`onAnimationEnd`),Ur(Fr,`onAnimationIteration`),Ur(Ir,`onAnimationStart`),Ur(`dblclick`,`onDoubleClick`),Ur(`focusin`,`onFocus`),Ur(`focusout`,`onBlur`),Ur(Lr,`onTransitionRun`),Ur(Rr,`onTransitionStart`),Ur(zr,`onTransitionCancel`),Ur(Br,`onTransitionEnd`),_t(`onMouseEnter`,[`mouseout`,`mouseover`]),_t(`onMouseLeave`,[`mouseout`,`mouseover`]),_t(`onPointerEnter`,[`pointerout`,`pointerover`]),_t(`onPointerLeave`,[`pointerout`,`pointerover`]),gt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),gt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),gt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),gt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),gt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),gt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Cd=`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(` `),wd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Cd));function Td(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Wr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Wr(e)}i.currentTarget=null,a=c}}}}function Ed(e,t){var n=t[rt];n===void 0&&(n=t[rt]=new Set);var r=e+`__bubble`;n.has(r)||(Ad(t,e,2,!1),n.add(r))}function Dd(e,t,n){var r=0;t&&(r|=4),Ad(n,e,r,t)}var Od=`_reactListening`+Math.random().toString(36).slice(2);function kd(e){if(!e[Od]){e[Od]=!0,mt.forEach(function(t){t!==`selectionchange`&&(wd.has(t)||Dd(t,!1,e),Dd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Od]||(t[Od]=!0,Dd(`selectionchange`,!1,t))}}function Ad(e,t,n,r){switch(Sp(t)){case 2:var i=gp;break;case 8:i=_p;break;default:i=vp}n=i.bind(null,t,n,e),i=void 0,!rn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function jd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=lt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}en(function(){var r=a,i=Yt(n),s=[];a:{var c=Vr.get(e);if(c!==void 0){var l=hn,u=e;switch(e){case`keypress`:if(un(n)===0)break a;case`keydown`:case`keyup`:l=Nn;break;case`focusin`:u=`focus`,l=wn;break;case`focusout`:u=`blur`,l=wn;break;case`beforeblur`:case`afterblur`:l=wn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Sn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Cn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Fn;break;case Pr:case Fr:case Ir:l=Tn;break;case Br:l=In;break;case`scroll`:case`scrollend`:l=_n;break;case`wheel`:l=Ln;break;case`copy`:case`cut`:case`paste`:l=En;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Pn;break;case`toggle`:case`beforetoggle`:l=Rn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=tn(m,p),g!=null&&d.push(Md(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Jt&&(u=n.relatedTarget||n.fromElement)&&(lt(u)||u[nt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?lt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Sn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Pn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:dt(l),h=u==null?c:dt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,lt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Pd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Fd(s,c,l,d,!1),u!==null&&f!==null&&Fd(s,f,u,d,!0)}}a:{if(c=r?dt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ir;else if(Qn(c))if(ar)v=mr;else{v=fr;var y=dr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Ut(r.elementType)&&(v=ir):v=pr;if(v&&=v(e,r)){$n(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Ft(c,`number`,c.value)}switch(y=r?dt(r):window,e){case`focusin`:(Qn(y)||y.contentEditable===`true`)&&(wr=y,Tr=r,Er=null);break;case`focusout`:Er=Tr=wr=null;break;case`mousedown`:Dr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Dr=!1,Or(s,n,i);break;case`selectionchange`:if(Cr)break;case`keydown`:case`keyup`:Or(s,n,i)}var b;if(Bn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Jn?Kn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Un&&n.locale!==`ko`&&(Jn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Jn&&(b=ln()):(on=i,sn=`value`in on?on.value:on.textContent,Jn=!0)),y=Nd(r,x),0<y.length&&(x=new Dn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=qn(n),b!==null&&(x.data=b)))),(b=Hn?Yn(e,n):Xn(e,n))&&(x=Nd(r,`onBeforeInput`),0<x.length&&(y=new Dn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),bd(s,e,r,n,i)}Td(s,t)})}function Md(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Nd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=tn(e,n),i!=null&&r.unshift(Md(e,i,a)),i=tn(e,t),i!=null&&r.push(Md(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Pd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Fd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=tn(n,a),l!=null&&o.unshift(Md(n,l,c))):i||(l=tn(n,a),l!=null&&o.push(Md(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Id=/\r\n?/g,Ld=/\u0000|\uFFFD/g;function Rd(e){return(typeof e==`string`?e:``+e).replace(Id,`
|
|
9
|
+
`).replace(Ld,``)}function zd(e,t){return t=Rd(t),Rd(e)===t}function Bd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&zt(e,``+r);break;case`className`:Ct(e,`class`,r);break;case`tabIndex`:Ct(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ct(e,n,r);break;case`style`:Ht(e,r,o);break;case`data`:if(t!==`object`){Ct(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Kt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Bd(e,t,`name`,a.name,a,null),Bd(e,t,`formEncType`,a.formEncType,a,null),Bd(e,t,`formMethod`,a.formMethod,a,null),Bd(e,t,`formTarget`,a.formTarget,a,null)):(Bd(e,t,`encType`,a.encType,a,null),Bd(e,t,`method`,a.method,a,null),Bd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Kt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=qt);break;case`onScroll`:r!=null&&Ed(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ed(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Kt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Ed(`beforetoggle`,e),Ed(`toggle`,e),St(e,`popover`,r);break;case`xlinkActuate`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:St(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Wt.get(n)||n,St(e,n,r))}}function Vd(e,t,n,r,a,o){switch(n){case`style`:Ht(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&zt(e,``+r);break;case`onScroll`:r!=null&&Ed(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ed(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=qt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!ht.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[tt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):St(e,n,r)}}}function Hd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Ed(`error`,e),Ed(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Bd(e,t,o,s,n,null)}}a&&Bd(e,t,`srcSet`,n.srcSet,n,null),r&&Bd(e,t,`src`,n.src,n,null);return;case`input`:Ed(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Bd(e,t,r,d,n,null)}}Pt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Ed(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Bd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&It(e,!!r,n,!0):It(e,!!r,t,!1);return;case`textarea`:for(s in Ed(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Bd(e,t,s,c,n,null)}Rt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Bd(e,t,l,r,n,null)}return;case`dialog`:Ed(`beforetoggle`,e),Ed(`toggle`,e),Ed(`cancel`,e),Ed(`close`,e);break;case`iframe`:case`object`:Ed(`load`,e);break;case`video`:case`audio`:for(r=0;r<Cd.length;r++)Ed(Cd[r],e);break;case`image`:Ed(`error`,e),Ed(`load`,e);break;case`details`:Ed(`toggle`,e);break;case`embed`:case`source`:case`link`:Ed(`error`,e),Ed(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Bd(e,t,u,r,n,null)}return;default:if(Ut(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Vd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Bd(e,t,c,r,n,null))}function Ud(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Bd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Bd(e,t,p,m,r,f)}}Nt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Bd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Bd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?It(e,!!n,n?[]:``,!1):It(e,!!n,t,!0)):It(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Bd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Bd(e,t,s,a,r,o)}Lt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Bd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Bd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Bd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Bd(e,t,u,p,r,m)}return;default:if(Ut(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Vd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Vd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Bd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Bd(e,t,f,p,r,m)}function Wd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Gd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Wd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Wd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Kd=null,qd=null;function Jd(e){return e.nodeType===9?e:e.ownerDocument}function Yd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Xd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Zd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Qd=null;function $d(){var e=window.event;return e&&e.type===`popstate`?e===Qd?!1:(Qd=e,!0):(Qd=null,!1)}var ef=typeof setTimeout==`function`?setTimeout:void 0,tf=typeof clearTimeout==`function`?clearTimeout:void 0,nf=typeof Promise==`function`?Promise:void 0,rf=typeof queueMicrotask==`function`?queueMicrotask:nf===void 0?ef:function(e){return nf.resolve(null).then(e).catch(af)};function af(e){setTimeout(function(){throw e})}function of(e){return e===`head`}function sf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Vp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)xf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,xf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[st]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&xf(e.ownerDocument.body);n=i}while(n);Vp(t)}function cf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function lf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:lf(n),ct(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function uf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[st])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=gf(e.nextSibling),e===null)break}return null}function df(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=gf(e.nextSibling),e===null))return null;return e}function ff(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=gf(e.nextSibling),e===null))return null;return e}function pf(e){return e.data===`$?`||e.data===`$~`}function mf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function hf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function gf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var _f=null;function vf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return gf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function yf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function bf(e,t,n){switch(t=Jd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function xf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ct(e)}var Sf=new Map,Cf=new Set;function wf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Tf=L.d;L.d={f:Ef,r:Df,D:Af,C:jf,L:Mf,m:Nf,X:Ff,S:Pf,M:If};function Ef(){var e=Tf.f(),t=Tu();return e||t}function Df(e){var t=ut(e);t!==null&&t.tag===5&&t.type===`form`?Ts(t):Tf.r(e)}var Of=typeof document>`u`?null:document;function kf(e,t,n){var r=Of;if(r&&typeof t==`string`&&t){var i=Mt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Cf.has(i)||(Cf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Hd(t,`link`,e),pt(t),r.head.appendChild(t)))}}function Af(e){Tf.D(e),kf(`dns-prefetch`,e,null)}function jf(e,t){Tf.C(e,t),kf(`preconnect`,e,t)}function Mf(e,t,n){Tf.L(e,t,n);var r=Of;if(r&&e&&t){var i=`link[rel="preload"][as="`+Mt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Mt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Mt(n.imageSizes)+`"]`)):i+=`[href="`+Mt(e)+`"]`;var a=i;switch(t){case`style`:a=Rf(e);break;case`script`:a=Hf(e)}Sf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Sf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(zf(a))||t===`script`&&r.querySelector(Uf(a))||(t=r.createElement(`link`),Hd(t,`link`,e),pt(t),r.head.appendChild(t)))}}function Nf(e,t){Tf.m(e,t);var n=Of;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Mt(r)+`"][href="`+Mt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Hf(e)}if(!Sf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),Sf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Uf(a)))return}r=n.createElement(`link`),Hd(r,`link`,e),pt(r),n.head.appendChild(r)}}}function Pf(e,t,n){Tf.S(e,t,n);var r=Of;if(r&&e){var i=ft(r).hoistableStyles,a=Rf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(zf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Sf.get(a))&&Kf(e,n);var c=o=r.createElement(`link`);pt(c),Hd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Gf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Ff(e,t){Tf.X(e,t);var n=Of;if(n&&e){var r=ft(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=h({src:e,async:!0},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),pt(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function If(e,t){Tf.M(e,t);var n=Of;if(n&&e){var r=ft(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),pt(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t,n,r){var a=(a=ie.current)?wf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Rf(n.href),n=ft(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Rf(n.href);var o=ft(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(zf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Sf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Sf.set(e,n),o||Vf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Hf(n),n=ft(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Rf(e){return`href="`+Mt(e)+`"`}function zf(e){return`link[rel="stylesheet"][`+e+`]`}function Bf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Vf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Hd(t,`link`,n),pt(t),e.head.appendChild(t))}function Hf(e){return`[src="`+Mt(e)+`"]`}function Uf(e){return`script[async]`+e}function Wf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Mt(n.href)+`"]`);if(r)return t.instance=r,pt(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),pt(r),Hd(r,`style`,a),Gf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Rf(n.href);var o=e.querySelector(zf(a));if(o)return t.state.loading|=4,t.instance=o,pt(o),o;r=Bf(n),(a=Sf.get(a))&&Kf(r,a),o=(e.ownerDocument||e).createElement(`link`),pt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Hd(o,`link`,r),t.state.loading|=4,Gf(o,n.precedence,e),t.instance=o;case`script`:return o=Hf(n.src),(a=e.querySelector(Uf(o)))?(t.instance=a,pt(a),a):(r=n,(a=Sf.get(o))&&(r=h({},n),qf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),pt(a),Hd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Gf(r,n.precedence,e));return t.instance}function Gf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Kf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function qf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Jf=null;function Yf(e,t,n){if(Jf===null){var r=new Map,i=Jf=new Map;i.set(n,r)}else i=Jf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[st]||a[et]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Xf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Zf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function $f(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Rf(r.href),a=t.querySelector(zf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=np.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,pt(a);return}a=t.ownerDocument||t,r=Bf(r),(i=Sf.get(i))&&Kf(r,i),a=a.createElement(`link`),pt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Hd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=np.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ep=0;function tp(e,t){return e.stylesheets&&e.count===0&&ip(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ip(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ep===0&&(ep=62500*Gd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ip(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ep?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function np(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ip(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var rp=null;function ip(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,rp=new Map,t.forEach(ap,e),rp=null,np.call(e))}function ap(e,t){if(!(t.state.loading&4)){var n=rp.get(e);if(n)var r=n.get(null);else{n=new Map,rp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=np.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var op={$$typeof:C,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function sp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ue(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ue(0),this.hiddenUpdates=Ue(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function cp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new sp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ni(3,null,null,t),e.current=a,a.stateNode=e,t=ra(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Fa(a),e}function lp(e){return e?(e=ei,e):ei}function up(e,t,n,r,i,a){i=lp(i),r.context===null?r.context=i:r.pendingContext=i,r=La(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ra(e,r,t),n!==null&&(bu(n,e,t),za(n,e,t))}function dp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fp(e,t){dp(e,t),(e=e.alternate)&&dp(e,t)}function pp(e){if(e.tag===13||e.tag===31){var t=Zr(e,67108864);t!==null&&bu(t,e,67108864),fp(e,67108864)}}function mp(e){if(e.tag===13||e.tag===31){var t=vu();t=Ye(t);var n=Zr(e,t);n!==null&&bu(n,e,t),fp(e,t)}}var hp=!0;function gp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,vp(e,t,n,r)}finally{L.p=a,I.T=i}}function _p(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,vp(e,t,n,r)}finally{L.p=a,I.T=i}}function vp(e,t,n,r){if(hp){var i=yp(r);if(i===null)jd(e,t,r,bp,n),jp(e,r);else if(Np(i,e,t,n,r))r.stopPropagation();else if(jp(e,r),t&4&&-1<Ap.indexOf(e)){for(;i!==null;){var a=ut(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=U(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Pe(o);s.entanglements[1]|=c,o&=~c}ld(a),!(zl&6)&&(ou=Se()+500,ud(0,!1))}}break;case 31:case 13:s=Zr(a,2),s!==null&&bu(s,a,2),Tu(),fp(a,2)}if(a=yp(r),a===null&&jd(e,t,r,bp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else jd(e,t,r,null,n)}}function yp(e){return e=Yt(e),xp(e)}var bp=null;function xp(e){if(bp=null,e=lt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return bp=e,null}function Sp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ce()){case we:return 2;case Te:return 8;case Ee:case De:return 32;case Oe:return 268435456;default:return 32}default:return 32}}var Cp=!1,wp=null,Tp=null,Ep=null,Dp=new Map,Op=new Map,kp=[],Ap=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function jp(e,t){switch(e){case`focusin`:case`focusout`:wp=null;break;case`dragenter`:case`dragleave`:Tp=null;break;case`mouseover`:case`mouseout`:Ep=null;break;case`pointerover`:case`pointerout`:Dp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Op.delete(t.pointerId)}}function Mp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ut(t),t!==null&&pp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Np(e,t,n,r,i){switch(t){case`focusin`:return wp=Mp(wp,e,t,n,r,i),!0;case`dragenter`:return Tp=Mp(Tp,e,t,n,r,i),!0;case`mouseover`:return Ep=Mp(Ep,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Dp.set(a,Mp(Dp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Op.set(a,Mp(Op.get(a)||null,e,t,n,r,i)),!0}return!1}function Pp(e){var t=lt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Qe(e.priority,function(){mp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Qe(e.priority,function(){mp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Fp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=yp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Jt=r,n.target.dispatchEvent(r),Jt=null}else return t=ut(n),t!==null&&pp(t),e.blockedOn=n,!1;t.shift()}return!0}function Ip(e,t,n){Fp(e)&&n.delete(t)}function Lp(){Cp=!1,wp!==null&&Fp(wp)&&(wp=null),Tp!==null&&Fp(Tp)&&(Tp=null),Ep!==null&&Fp(Ep)&&(Ep=null),Dp.forEach(Ip),Op.forEach(Ip)}function Rp(e,n){e.blockedOn===n&&(e.blockedOn=null,Cp||(Cp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Lp)))}var zp=null;function Bp(e){zp!==e&&(zp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){zp===e&&(zp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(xp(r||n)===null)continue;break}var a=ut(n);a!==null&&(e.splice(t,3),t-=3,Cs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Vp(e){function t(t){return Rp(t,e)}wp!==null&&Rp(wp,e),Tp!==null&&Rp(Tp,e),Ep!==null&&Rp(Ep,e),Dp.forEach(t),Op.forEach(t);for(var n=0;n<kp.length;n++){var r=kp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<kp.length&&(n=kp[0],n.blockedOn===null);)Pp(n),n.blockedOn===null&&kp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[tt]||null;if(typeof a==`function`)o||Bp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[tt]||null)s=o.formAction;else if(xp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Bp(n)}}}function Hp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Up(e){this._internalRoot=e}Wp.prototype.render=Up.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;up(n,vu(),e,t,null,null)},Wp.prototype.unmount=Up.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;up(e.current,2,null,e,null,null),Tu(),t[nt]=null}};function Wp(e){this._internalRoot=e}Wp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ze();e={blockedOn:null,target:e,priority:t};for(var n=0;n<kp.length&&t!==0&&t<kp[n].priority;n++);kp.splice(n,0,e),n===0&&Pp(e)}};var Gp=n.version;if(Gp!==`19.2.7`)throw Error(i(527,Gp,`19.2.7`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Kp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var qp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qp.isDisabled&&qp.supportsFiber)try{je=qp.inject(Kp),Me=qp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Gs,s=Ks,c=qs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=cp(e,1,!1,null,null,n,r,null,o,s,c,Hp),e[nt]=t.current,kd(e),new Up(t)}})),g=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},v=new class extends _{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},y={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},b=new class{#e=y;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function x(e){setTimeout(e,0)}var S=typeof window>`u`||`Deno`in globalThis;function C(){}function w(e,t){return typeof e==`function`?e(t):e}function T(e){return typeof e==`number`&&e>=0&&e!==1/0}function E(e,t){return Math.max(e+(t||0)-Date.now(),0)}function D(e,t){return typeof e==`function`?e(t):e}function O(e,t){return typeof e==`function`?e(t):e}function k(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==j(o,t.options))return!1}else if(!N(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function A(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(M(t.options.mutationKey)!==M(a))return!1}else if(!N(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function j(e,t){return(t?.queryKeyHashFn||M)(e)}function M(e){return JSON.stringify(e,(e,t)=>ee(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function N(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>N(e[n],t[n])):!1}var P=Object.prototype.hasOwnProperty;function F(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=L(e)&&L(t);if(!r&&!(ee(e)&&ee(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:P.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=F(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function I(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function L(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ee(e){if(!te(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!te(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function te(e){return Object.prototype.toString.call(e)===`[object Object]`}function ne(e){return new Promise(t=>{b.setTimeout(t,e)})}function R(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:F(e,t)}function z(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function B(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var re=Symbol();function V(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===re?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ie(e,t){return typeof e==`function`?e(...t):!!e}function ae(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var oe=(()=>{let e=()=>S;return{isServer(){return e()},setIsServer(t){e=t}}})();function se(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var ce=x;function le(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=ce,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ue=le(),de=new class extends _{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function fe(e){return Math.min(1e3*2**e,3e4)}function pe(e){return(e??`online`)===`online`?de.isOnline():!0}var me=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function he(e){let t=!1,n=0,r,i=se(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new me(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>v.isFocused()&&(e.networkMode===`always`||de.isOnline())&&e.canRun(),u=()=>pe(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(oe.isServer()?0:3),o=e.retryDelay??fe,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),ne(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var ge=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),T(this.gcTime)&&(this.#e=b.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(oe.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(b.clearTimeout(this.#e),this.#e=void 0)}};function _e(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ae(e,()=>t.signal,()=>n=!0)},u=V(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?B:z;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?ye:ve,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:ve(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function ve(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function ye(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var be=class extends ge{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ce(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ce(this.options);e.data!==void 0&&(this.setState(Se(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=R(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(C).catch(C):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>O(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===re||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>D(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:!E(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=V(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?_e(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=he({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof me&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof me){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...xe(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Se(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ue.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function xe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:pe(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Se(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ce(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,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 we=class extends _{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=se(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ee(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return De(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return De(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof O(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!I(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Oe(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||O(this.options.enabled,this.#t)!==O(t.enabled,this.#t)||D(this.options.staleTime,this.#t)!==D(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||O(this.options.enabled,this.#t)!==O(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ae(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(C)),t}#g(){this.#b();let e=D(this.options.staleTime,this.#t);if(oe.isServer()||this.#r.isStale||!T(e))return;let t=E(this.#r.dataUpdatedAt,e)+1;this.#d=b.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(oe.isServer()||O(this.options.enabled,this.#t)===!1||!T(this.#p)||this.#p===0)&&(this.#f=b.setInterval(()=>{(this.options.refetchIntervalInBackground||v.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(b.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(b.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ee(e,t),o=i&&Oe(e,n,t,r);(a||o)&&(l={...l,...xe(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=R(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=R(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:ke(e,t),refetch:this.refetch,promise:this.#o,isEnabled:O(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=se())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!I(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){ue.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Te(e,t){return O(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&O(t.retryOnMount,e)===!1)}function Ee(e,t){return Te(e,t)||e.state.data!==void 0&&De(e,t,t.refetchOnMount)}function De(e,t,n){if(O(t.enabled,e)!==!1&&D(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&ke(e,t)}return!1}function Oe(e,t,n,r){return(e!==t||O(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ke(e,n)}function ke(e,t){return O(t.enabled,e)!==!1&&e.isStaleByTime(D(t.staleTime,e))}function Ae(e,t){return!I(e.getCurrentResult(),t)}var je=class extends ge{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Me(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=he({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,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{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),ue.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Me(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ne=class extends _{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new je({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Pe(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Pe(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Pe(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Pe(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ue.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>A(t,e))}findAll(e={}){return this.getAll().filter(t=>A(e,t))}notify(e){ue.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ue.batch(()=>Promise.all(e.map(e=>e.continue().catch(C))))}};function Pe(e){return e.options.scope?.id}var Fe=class extends _{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),I(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&M(t.mutationKey)!==M(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Me();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){ue.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Ie=class extends _{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??j(r,t),a=this.get(i);return a||(a=new be({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ue.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>k(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>k(e,t)):t}notify(e){ue.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ue.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ue.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Le=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ie,this.#t=e.mutationCache||new Ne,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=v.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=de.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(D(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=w(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ue.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ue.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ue.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=ue.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(C).catch(C)}invalidateQueries(e,t={}){return ue.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ue.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(C)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(C)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(D(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(C).catch(C)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(C).catch(C)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return de.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(M(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{N(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(M(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{N(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=j(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===re&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Re=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),ze=o(((e,t)=>{t.exports=Re()})),H=c(u(),1),U=ze(),Be=H.createContext(void 0),W=e=>{let t=H.useContext(Be);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ve=({client:e,children:t})=>(H.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,U.jsx)(Be.Provider,{value:e,children:t})),He=H.createContext(!1),Ue=()=>H.useContext(He);He.Provider;function We(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ge=H.createContext(We()),Ke=()=>H.useContext(Ge),qe=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?ie(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Je=e=>{H.useEffect(()=>{e.clearReset()},[e])},Ye=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||ie(n,[e.error,r])),Xe=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ze=(e,t)=>e.isLoading&&e.isFetching&&!t,Qe=(e,t)=>e?.suspense&&t.isPending,$e=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function et(e,t,n){let r=Ue(),i=Ke(),a=W(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Xe(o),qe(o,i,s),Je(i);let l=!a.getQueryCache().get(o.queryHash),[u]=H.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(H.useSyncExternalStore(H.useCallback(e=>{let t=f?u.subscribe(ue.batchCalls(e)):C;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),H.useEffect(()=>{u.setOptions(o)},[o,u]),Qe(o,d))throw $e(o,u,i);if(Ye({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!oe.isServer()&&Ze(d,r)&&(l?$e(o,u,i):s?.promise)?.catch(C).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function tt(e,t){return et(e,we,t)}function nt(e,t){let n=W(t),[r]=H.useState(()=>new Fe(n,e));H.useEffect(()=>{r.setOptions(e)},[r,e]);let i=H.useSyncExternalStore(H.useCallback(e=>r.subscribe(ue.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=H.useCallback((e,t)=>{r.mutate(e,t).catch(C)},[r]);if(i.error&&ie(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var rt=typeof window<`u`?H.useLayoutEffect:H.useEffect;function it(e){let t=H.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function at(e,t,n={},r={}){H.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function ot(e){let t=H.useRef(null);return H.useImperativeHandle(e,()=>t.current,[]),t}function st(e){return e[e.length-1]}function ct(e){return typeof e==`function`}function lt(e,t){return ct(e)?e(t):e}var ut=Object.prototype.hasOwnProperty,dt=Object.prototype.propertyIsEnumerable;function ft(e){for(let t in e)if(ut.call(e,t))return!0;return!1}var pt=()=>Object.create(null),mt=(e,t)=>ht(e,t,pt);function ht(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=yt(e)&&yt(i);if(!a&&!(_t(e)&&_t(i)))return i;let o=a?e:gt(e);if(!o)return i;let s=a?i:gt(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:ut.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=ht(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function gt(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!dt.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!dt.call(e,t))return!1;r.push(t)}return r}function _t(e){if(!vt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!vt(n)||!n.hasOwnProperty(`isPrototypeOf`))}function vt(e){return Object.prototype.toString.call(e)===`[object Object]`}function yt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function bt(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!bt(e[r],t[r],n))return!1;return!0}if(_t(e)&&_t(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!bt(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!bt(e[o],t[o],n)))return!1;return i===a}return!1}function xt(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function St(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function Ct(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function wt(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Ct(t)}var Tt=[`http:`,`https:`,`mailto:`,`tel:`];function Et(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Dt(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=wt(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=wt(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Ot(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function kt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function At(){throw Error(`Invariant failed`)}function jt(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var Mt=4,Nt=5;function Pt(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function Ft(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=Pt(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function It(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=Ft(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=zt(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=zt(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Bt(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Bt(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=Bt(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=zt(n.fullPath??n.from);e.kind=Nt,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=zt(n.fullPath??n.from);e.kind=Mt,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)It(e,t,r,s,i,a,o)}function Lt(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Rt(e){if(e.pathless)for(let t of e.pathless)Rt(t);if(e.static)for(let t of e.static.values())Rt(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())Rt(t);if(e.dynamic?.length){e.dynamic.sort(Lt);for(let t of e.dynamic)Rt(t)}if(e.optional?.length){e.optional.sort(Lt);for(let t of e.optional)Rt(t)}if(e.wildcard?.length){e.wildcard.sort(Lt);for(let t of e.wildcard)Rt(t)}}function zt(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Bt(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Vt(e,t){let n=zt(`/`),r=new Uint16Array(6);for(let t of e)It(!1,r,t,1,n,0);Rt(n),t.masksTree=n,t.flatCache=jt(1e3)}function Ht(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=qt(e,t.masksTree);return t.flatCache.set(e,r),r}function Ut(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=zt(`/`),It(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),qt(r,o,n)}function Wt(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=qt(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Yt(a.route)),t.matchCache.set(r,a),a}function Gt(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Kt(e,t=!1,n){let r=zt(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return It(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&At(),a[e.id]=e,s!==0&&e.path){let t=Gt(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),Rt(r),{processedTree:{segmentTree:r,singleCache:jt(1e3),matchCache:jt(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function qt(e,t,n=!1){let r=e.split(`/`),i=Zt(e,r,t,n);if(!i)return null;let[a]=Jt(e,r,i);return{route:i.node.route,rawParams:a}}function Jt(e,t,n){let r=Xt(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===Mt)break;if(u.kind===Nt){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function Yt(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Xt(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Zt(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!st(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!tn(l,n))continue;if(i.parse){if(!en(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==Mt&&tn(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===Mt||i.kind===2)&&tn(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(en(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&$t(p,o))return n;tn(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+Qt(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+Qt(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+Qt(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+Qt(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function Qt(e,t){return 2**(e-t-1)}function $t(e,t){return e===2**(t-1)-1}function en(e,t,n){let r,i;try{[r,i]=Jt(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function tn(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Mt)>(e.node.kind===Mt)||t.node.kind===Mt==(e.node.kind===Mt)&&t.depth>e.depth))):!0}function nn(e){return rn(e.filter(e=>e!==void 0).join(`/`))}function rn(e){return e.replace(/\/{2,}/g,`/`)}function an(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function on(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function sn(e){return on(an(e))}function cn(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function ln(e,t,n){return cn(e,n)===cn(t,n)}function un({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&st(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(st(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=rn(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function dn(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function fn(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>mn(e,n)).join(`/`):mn(r,n):r}function pn({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=Ft(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=fn(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=fn(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=fn(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function mn(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function hn(e){return e?.isNotFound===!0}function gn(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function _n(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function vn(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=_n(r):Array.isArray(t)?t.push(_n(r)):n[e]=[t,_n(r)]}return n}var yn=xn(JSON.parse),bn=Sn(JSON.stringify,JSON.parse);function xn(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=vn(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Sn(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=gn(e,r);return t?`?${t}`:``}}var Cn=`__root__`;function wn(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Tn(e){return e instanceof Response&&!!e.options}var En=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Dn=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),On=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),kn=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},An=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},jn=(e,t,n)=>{if(!(!Tn(n)&&!hn(n)))throw Tn(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:Tn(n)?`redirected`:hn(n)?`notFound`:r.status===`pending`?`success`:r.status,context:kn(e,t.index),isFetching:!1,error:n})),hn(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Tn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},Mn=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Nn=(e,t,n)=>{let r=kn(e,n);e.updateMatch(t,e=>({...e,context:r}))},Pn=(e,t,n)=>{let{id:r,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,jn(e,e.router.getMatch(r),n);try{a.options.onError?.(n)}catch(t){n=t,jn(e,e.router.getMatch(r),n)}e.updateMatch(r,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Tn(n)&&!hn(n)&&(e.serialError??=n)},Fn=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!On(e,t)&&(n.options.loader||n.options.beforeLoad||Kn(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{En(e)},i);r._nonReactive.pendingTimeout=t}},In=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;Fn(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&jn(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},Ln=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=xt(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&Pn(e,n,o),s&&Pn(e,n,s),Fn(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=xt();let f={...kn(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=On(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(Tn(r)||hn(r))&&(u(),Pn(e,n,r)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),St(y))return u(),y.catch(t=>{Pn(e,n,t)}).then(v)}catch(t){u(),Pn(e,n,t)}v(y)},Rn=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>Ln(e,n,t,i),s=()=>{if(Mn(e,n))return;let t=In(e,n,i);return St(t)?t.then(o):o()};return a()},zn=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},Bn=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=kn(e,r),d=On(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},Vn=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{Gn(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(Bn(e,t,n,r,i)),l=!!s&&St(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;jn(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:kn(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:kn(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,hn(t)&&await i.options.notFoundComponent?.preload?.(),jn(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,jn(e,e.router.getMatch(n),t)}!Tn(o)&&!hn(o)&&await Gn(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:kn(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),jn(e,r,t)}},Hn=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(Bn(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await Vn(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){Tn(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await Vn(e,t,i,n,d):Nn(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(Mn(e,i)){if(!e.router.getMatch(i))return e.matches[n];Nn(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=On(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&jn(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=xt(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function Un(e){let t=e,n=[];Dn(t.router)&&En(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=Rn(t,e);St(n)&&await n}catch(e){if(Tn(e))throw e;if(hn(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?An(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(Hn(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(Tn(e))throw e;hn(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!l&&r&&t.preload)return t.matches;if(l){let e=An(t,l);e===void 0&&At();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await Gn(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await Gn(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=zn(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=En(t);if(St(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Wn(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function Gn(e,t=qn){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===qn?(()=>{if(e._componentsPromise===void 0){let t=Wn(e,qn);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Wn(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function Kn(e){for(let t of qn)if(e.options[t]?.preload)return!0;return!1}var qn=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`];function Jn(e){return{input:({url:t})=>{for(let n of e)t=Xn(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Zn(e[n],t);return t}}}function Yn(e){let t=sn(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=nn([`/`,t,e.pathname]),e)}}function Xn(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Zn(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Qn(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>$n(o,_.get())),x=r(()=>$n(s,v.get())),S=r(()=>$n(c,y.get())),C=r(()=>_.get()[0]),w=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),T=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),E=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),D=jt(64);function O(e){let t=D.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),D.set(e,t)),t}let k={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:w,matchRouteDeps:T,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:E,getRouteMatchStore:O,setMatches:A,setPending:j,setCached:M};A(e.matches),a?.(k);function A(e){er(e,o,_,n,i)}function j(e){er(e,s,v,n,i)}function M(e){er(e,c,y,n,i)}return k}function $n(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function er(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}kt(n.get(),a)||n.set(a)})}var tr=`__TSR_index`,nr=`popstate`,rr=`beforeunload`;function ir(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=cr(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[tr];i=ar(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[tr];i=ar(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[tr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function ar(e,t){t||={};let n=lr();return{...t,key:n,__TSR_key:n,[tr]:e}}function or(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>cr(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=lr();t.history.replaceState({[tr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=cr(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[tr]-l.state[tr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=ir({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(rr,S,{capture:!0}),t.removeEventListener(nr,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(rr,S,{capture:!0}),t.addEventListener(nr,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function sr(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function cr(e,t){let n=sr(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=lr();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[tr]:0,key:a,__TSR_key:a}}}function lr(){return(Math.random()+1).toString(36).substring(7)}function ur(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var dr=new WeakMap,fr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=dn(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=or()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=jt(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Qn(hr(this.latestLocation),e),Fr(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=sn(o);t&&t!==`/`&&e.push(Yn({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Jn(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Kt(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Vt(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Dt(e).path,external:!1,searchStr:o,search:mt(t?.search,i),hash:Dt(r.slice(1)).path,state:ht(t?.state,a)}}let o=new URL(i,this.origin),s=Xn(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Dt(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:mt(t?.search,c),hash:Dt(s.hash.slice(1)).path,state:ht(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>un({base:e,to:t.includes(`//`)?rn(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>_r({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=t.to?`${t.to}`:void 0,o=r.search,s=Object.assign(Object.create(null),r.params),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,lt(t.params,s)),d=this.routesByPath[on(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let e=this.getMatchedRoutes(l);f=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&ft(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:Dt(pn({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,gr(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=vr({search:m,dest:t,destRoutes:f,_includeValidateSearch:e._includeValidateSearch}),m=mt(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?lt(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?lt(t.state,n.state):{};v=ht(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=Zn(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=Ot(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=Ht(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,lt(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=bt(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=on(this.latestLocation.href)===on(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=xt(()=>{o?.resolve(),o=void 0}),a&&i())this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this._scroll.next=n.resetScroll??!0,this.history.subscribers.size||this.load(r?{action:{type:r}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=cr(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Xn(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(Et(t,this.protocolAllowlist))return Promise.resolve();if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return i.replace?window.location.replace(t):window.location.href=t,Promise.resolve()}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,i,a=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad(),t?dr.set(this.latestLocation,t):dr.delete(this.latestLocation);let n=this.latestLocation,r=ur(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await Un({router:this,sync:e?.sync,forceStaleReload:a.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){Tn(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):hn(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.stores.matches.get().some(e=>e.status===`error`)&&(o=500),o!==void 0&&this.stores.statusCode.set(o)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(ur(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&Et(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return t.status===`error`?!0:e-t.updatedAt>=r}})},this.loadRouteChunk=Gn,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await Un({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Tn(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});hn(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=Ut(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!bt(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?bt(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??bn,parseSearch:e.parseSearch??yn,protocolAllowlist:e.protocolAllowlist??Tt}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=Yt(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:on(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?br(this.options.notFoundMode,a):void 0,c=Array(a.length),l=new Map;for(let e of this.stores.matchStores.values())e.routeId&&l.set(e.routeId,e.get());for(let n=0;n<a.length;n++){let r=a[n],o=c[n-1],u,d,f;{let n=o?.search??e.search,i=o?._strictSearch??void 0;try{let e=gr(r.options.validateSearch,{...n})??void 0;u={...n,...e},d={...i,...e},f=void 0}catch(e){let r=e;if(e instanceof pr||(r=new pr(e.message,{cause:e})),t?.throwOnError)throw r;u=n,d={},f=r}}let p=r.options.loaderDeps?.({search:u})??``,m=p?JSON.stringify(p):``,{interpolatedPath:h,usedParams:g}=pn({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),_=r.id+h+m,v=this.getMatch(_),y=l.get(r.id),b=v?._strictParams??g,x;if(!v)try{xr(r,b)}catch(e){if(x=hn(e)||Tn(e)?e:new mr(e.message,{cause:e}),t?.throwOnError)throw x}Object.assign(i,b);let S=y?`stay`:`enter`,C;if(v)C={...v,cause:S,params:y?.params??i,_strictParams:b,search:mt(y?y.search:v.search,u),_strictSearch:d};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||Kn(r)?`pending`:`success`;C={id:_,ssr:r.options.ssr,index:n,routeId:r.id,params:y?.params??i,_strictParams:b,pathname:h,updatedAt:Date.now(),search:y?mt(y.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:x,__routeContext:void 0,_nonReactive:{loadPromise:xt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:S,loaderDeps:y?ht(y.loaderDeps,p):p,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(C.globalNotFound=s===r.id),C.searchError=f;let w=this.getParentContext(o);C.context={...w,...C.__routeContext,...C.__beforeLoadContext},c[n]=C}for(let t=0;t<c.length;t++){let n=c[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=l.get(n.routeId);if(n.params=o?mt(o.params,i):i,!a){let i=c[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return c}matchRoutesLightweight(e){let{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),r=st(t),i={...e.search};for(let e of t)try{Object.assign(i,gr(e.options.validateSearch,i))}catch{}let a=st(this.stores.matchesId.get()),o=a&&this.stores.matchStores.get(a)?.get(),s=o&&o.routeId===r.id&&o.pathname===e.pathname,c;if(s)c=o.params;else{let e=Object.assign(Object.create(null),n);for(let n of t)try{xr(n,e)}catch{}c=e}return{matchedRoutes:t,fullPath:r.fullPath,search:i,params:c}}},pr=class extends Error{},mr=class extends Error{};function hr(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function gr(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new pr(`Async validation not supported`);if(n.issues)throw new pr(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function _r({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=on(e),a,o=Wt(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function vr({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return yr(n)(e,t,r??!1)}function yr(e){let t,n,r=[];for(let t of e){let e=t.options;`search`in e?e.search?.middlewares&&r.push(...e.search.middlewares):(e.preSearchFilters||e.postSearchFilters)&&r.push(({search:t,next:n})=>{let r=n(e.preSearchFilters?e.preSearchFilters.reduce((e,t)=>t(e),t):t);return e.postSearchFilters?e.postSearchFilters.reduce((e,t)=>t(e),r):r});let i=e.validateSearch;i&&r.push(({search:e,next:t,meta:r})=>{let a=t(e);if(n)try{let e=gr(i,a);if(r&&e)for(let t in e)t in a||(r.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let i=(e,n,a)=>{if(e>=r.length){if(!t.search)return{};if(t.search===!0)return n;let e=lt(t.search,n);return a&&(a.explicit=e),e}return r[e]({search:n,next:(t,n)=>{if(n){let n=a||{};return{search:i(e+1,t,n),meta:n}}return i(e+1,t,a)},meta:a})};return function(e,r,a){return t=r,n=a,i(0,e)}}function br(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return Cn}function xr(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}function Sr(){try{return sessionStorage}catch{return}}var Cr=`tsr-scroll-restoration-v1_3`,wr=Sr();function Tr(){try{return JSON.parse(wr?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Er(){try{wr?.setItem(Cr,JSON.stringify(Dr))}catch{}}var Dr=Tr(),Or=`data-scroll-restoration-id`,kr=e=>e.state.__TSR_key||e.href;function Ar(e){let t=e.getAttribute(Or);if(t)return`[${Or}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var jr=!1,Mr=`window`;function Nr(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Pr(e){let t=[];for(let n of e){if(n===Mr)continue;let e=Nr(n);e&&t.push(e)}return t}function Fr(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||kr,a=new Map,o=(e,t,n)=>{let r=a.get(e)||{};r.scrollX=t,r.scrollY=n,a.set(e,r)},s=e=>{if(!(jr||!r.restoring))if(e.target===document)o(Mr,scrollX,scrollY);else{let t=e.target;o(t,t.scrollLeft,t.scrollTop)}},c=e=>{if(!r.restoring)return;let t=Dr[e]||={};for(let[e,n]of a)e===Mr?t[Mr]=n:e.isConnected&&(t[Ar(e)]=n)};n&&!r.restoration&&(r.restoration=!0,jr=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,s,!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&c(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{c(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Er()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c;if(a.clear(),s||(r.next=!0),typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let l=i(t.toLocation),u=t.fromLocation&&i(t.fromLocation);if(r.restoring&&u&&u!==l){let e=Dr[u];if(e){let t=Dr[l];for(let n in e){if(n===Mr){if(s)continue}else{let e=Nr(n);if(!e||s&&o&&(c??=Pr(o),c.includes(e)))continue}t||=Dr[l]={},t[n]??=e[n]}}}jr=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){let s=dr.get(t.toLocation),u=e&&i&&(s===`PUSH`||s===`REPLACE`),d=r.restoring?Dr[l]:void 0;if(d)for(let e in d){let{scrollX:t,scrollY:r}=d[e];if(e===Mr){if(u)continue;scrollTo({top:r,left:t,behavior:n}),a=!0}else{let n=Nr(e);n&&(n.scrollLeft=t,n.scrollTop=r)}}if(!a&&!e){let e={top:0,left:0,behavior:n};if(scrollTo(e),o){c??=Pr(o);for(let t of c)t.scrollTo(e)}}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{jr=!1}}))}var Ir=`Error preloading route! ☝️`,Lr=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Cn:this.parentRoute||At();let r=n?Cn:t?.path;r&&r!==`/`&&(r=an(r));let i=t?.id||r,a=n?Cn:nn([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=nn([`/`,a]));let o=a===`__root__`?`/`:nn([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=on(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>wn({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Rr=class extends Lr{constructor(e){super(e)}};function zr(e){let t=e.errorComponent??Vr;return(0,U.jsx)(Br,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?H.createElement(t,{error:n,reset:r}):e.children})}var Br=class extends H.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function Vr({error:e}){let[t,n]=H.useState(!1);return(0,U.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,U.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,U.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,U.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,U.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,U.jsx)(`div`,{children:(0,U.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,U.jsx)(`code`,{children:e.message}):null})}):null]})}function Hr({children:e,fallback:t=null}){return Ur()?(0,U.jsx)(H.Fragment,{children:e}):(0,U.jsx)(H.Fragment,{children:t})}function Ur(){return H.useSyncExternalStore(Wr,()=>!0,()=>!1)}function Wr(){return()=>{}}var Gr=H.createContext(null);function Kr(e){return H.useContext(Gr)}var qr=H.createContext(void 0),Jr=H.createContext(void 0),Yr=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(Yr||{});function Xr({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Zr(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Qr=[],$r=0,{link:ei,unlink:ti,propagate:ni,checkDirty:ri,shallowPropagate:ii}=Xr({update(e){return e._update()},notify(e){Qr[oi++]=e,e.flags&=~Yr.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Yr.Mutable|Yr.Dirty,ui(e))}}),ai=0,oi=0,si,ci=0;function li(e){try{++ci,e()}finally{--ci||di()}}function ui(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=ti(n,e)}function di(){if(!(ci>0)){for(;ai<oi;){let e=Qr[ai];Qr[ai++]=void 0,e.notify()}ai=0,oi=0}}function fi(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?Yr.None:Yr.Mutable,get(){return si!==void 0&&ei(i,si,$r),i._snapshot},subscribe(e){let t=Zr(e),n={current:!1},r=pi(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=si,o=t?.compare??Object.is;if(n)si=i,++$r,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=Yr.Mutable|Yr.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{si=a,n&&(i.flags&=~Yr.RecursedCheck),ui(i)}}};return n?(i.flags=Yr.Mutable|Yr.Dirty,i.get=function(){let e=i.flags;if(e&Yr.Dirty||e&Yr.Pending&&ri(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&ii(e)}}else e&Yr.Pending&&(i.flags=e&~Yr.Pending);return si!==void 0&&ei(i,si,$r),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(ni(e),ii(e),di())}},i}function pi(e){let t=()=>{let t=si;si=n,++$r,n.depsTail=void 0,n.flags=Yr.Watching|Yr.RecursedCheck;try{return e()}finally{si=t,n.flags&=~Yr.RecursedCheck,ui(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Yr.Watching|Yr.RecursedCheck,notify(){let e=this.flags;e&Yr.Dirty||e&Yr.Pending&&ri(this.deps,this)?t():this.flags=Yr.Watching},stop(){this.flags=Yr.None,this.depsTail=void 0,ui(this)}};return t(),n}var mi=o((e=>{var t=u();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),hi=o(((e,t)=>{t.exports=mi()})),gi=o((e=>{var t=u(),n=hi();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),_i=c(o(((e,t)=>{t.exports=gi()}))(),1);function vi(e,t){return e===t}function yi(e,t,n=vi){let r=(0,H.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,H.useCallback)(()=>e?.get(),[e]);return(0,_i.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var bi={get:()=>void 0,subscribe:()=>({unsubscribe:()=>{}})};function xi(e){let t=Kr(),n=H.useContext(e.from?Jr:qr),r=e.from??n,i=r?e.from?t.stores.getRouteMatchStore(r):t.stores.matchStores.get(r):void 0,a=H.useRef(void 0);return yi(i??bi,n=>{if((e.shouldThrow??!0)&&!n&&At(),n===void 0)return;let r=e.select?e.select(n):n;if(e.structuralSharing??t.options.defaultStructuralSharing){let e=ht(a.current,r);return a.current=e,e}return r})}function Si(e){return xi({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Ci(e){let{select:t,...n}=e;return xi({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function wi(e){return xi({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Ti(e){return xi({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ei(e){let t=Kr();return H.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Di(e){return xi({...e,select:t=>e.select?e.select(t.context):t.context})}var Oi=c(m(),1);function ki(e,t){let n=Kr(),r=ot(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:A,state:j,mask:M,reloadDocument:N,unsafeRelative:P,from:F,_fromLocation:I,...L}=e,ee=Ur(),te=H.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),ne=yi(n.stores.location,e=>e,(e,t)=>e.href===t.href),R=H.useMemo(()=>{let e={_fromLocation:ne,...te};return n.buildLocation(e)},[n,ne,te]),z=R.maskedLocation?R.maskedLocation.publicHref:R.publicHref,B=R.maskedLocation?R.maskedLocation.external:R.external,re=H.useMemo(()=>Ri(z,B,n.history,v),[v,B,z,n.history]),V=H.useMemo(()=>{if(re?.external)return Et(re.href,n.protocolAllowlist)?void 0:re.href;if(!zi(s)&&!(typeof s!=`string`||s.indexOf(`:`)===-1))try{return new URL(s),Et(s,n.protocolAllowlist)?void 0:s}catch{}},[s,re,n.protocolAllowlist]),ie=H.useMemo(()=>{if(V)return!1;if(o?.exact){if(!ln(ne.pathname,R.pathname,n.basepath))return!1}else{let e=cn(ne.pathname,n.basepath),t=cn(R.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!bt(ne.search,R.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:o?.includeHash?ee&&ne.hash===R.hash:!0},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,ne,V,ee,R.hash,R.pathname,R.search,n.basepath]),ae=ie?lt(i,{})??ji:Ai,oe=ie?Ai:lt(a,{})??Ai,se=[b,ae.className,oe.className].filter(Boolean).join(` `),ce=(y||ae.style||oe.style)&&{...y,...ae.style,...oe.style},[le,ue]=H.useState(!1),de=H.useRef(!1),fe=e.reloadDocument||V?!1:c??n.options.defaultPreload,pe=l??n.options.defaultPreloadDelay??0,me=H.useCallback(()=>{n.preloadRoute({...te,_builtLocation:R}).catch(e=>{console.warn(e),console.warn(Ir)})},[n,te,R]);at(r,H.useCallback(e=>{e?.isIntersecting&&me()},[me]),Ii,{disabled:!!v||fe!==`viewport`}),H.useEffect(()=>{de.current||!v&&fe===`render`&&(me(),de.current=!0)},[v,me,fe]);let he=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;if(!v&&!Vi(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Oi.flushSync)(()=>{ue(!0)});let t=n.subscribe(`onResolved`,()=>{t(),ue(!1)});n.navigate({...te,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D})}};if(V)return{...L,ref:r,href:V,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let ge=e=>{if(v||fe!==`intent`)return;if(!pe){me();return}let t=e.currentTarget;if(Fi.has(t))return;let n=setTimeout(()=>{Fi.delete(t),me()},pe);Fi.set(t,n)},_e=e=>{v||fe!==`intent`||me()},ve=e=>{if(v||!fe||!pe)return;let t=e.currentTarget,n=Fi.get(t);n&&(clearTimeout(n),Fi.delete(t))};return{...L,...ae,...oe,href:re?.href,ref:r,onClick:Li([x,he]),onBlur:Li([S,ve]),onFocus:Li([C,ge]),onMouseEnter:Li([w,ge]),onMouseLeave:Li([T,ve]),onTouchStart:Li([E,_e]),disabled:!!v,target:_,...ce&&{style:ce},...se&&{className:se},...v&&Mi,...ie&&Ni,...ee&&le&&Pi}}var Ai={},ji={className:`active`},Mi={role:`link`,"aria-disabled":!0},Ni={"data-status":`active`,"aria-current":`page`},Pi={"data-transitioning":`transitioning`},Fi=new WeakMap,Ii={rootMargin:`100px`},Li=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Ri(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function zi(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Bi=H.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=ki(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return H.createElement(`a`,t,o)}return H.createElement(n,a,o)});function Vi(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Hi=class extends Lr{constructor(e){super(e),this.useMatch=e=>xi({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Di({...e,from:this.id}),this.useSearch=e=>Ti({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>wi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Ci({...e,from:this.id}),this.useLoaderData=e=>Si({...e,from:this.id}),this.useNavigate=()=>Ei({from:this.fullPath}),this.Link=H.forwardRef((e,t)=>(0,U.jsx)(Bi,{ref:t,from:this.fullPath,...e}))}};function Ui(e){return new Hi(e)}var Wi=class extends Rr{constructor(e){super(e),this.useMatch=e=>xi({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Di({...e,from:this.id}),this.useSearch=e=>Ti({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>wi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Ci({...e,from:this.id}),this.useLoaderData=e=>Si({...e,from:this.id}),this.useNavigate=()=>Ei({from:this.fullPath}),this.Link=H.forwardRef((e,t)=>(0,U.jsx)(Bi,{ref:t,from:this.fullPath,...e}))}};function Gi(e){return new Wi(e)}function Ki(e){return new qi(e,{silent:!0}).createRoute}var qi=class{constructor(e,t){this.path=e,this.createRoute=e=>{let t=Ui(e);return t.isRoot=!1,t},this.silent=t?.silent}};function Ji(e){let t=Kr(),n=`not-found-${yi(t.stores.location,e=>e.pathname)}-${yi(t.stores.status,e=>e)}`;return(0,U.jsx)(zr,{getResetKey:()=>n,onCatch:(t,n)=>{if(hn(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(hn(t))return e.fallback?.(t);throw t},children:e.children})}function Yi(){return(0,U.jsx)(`p`,{children:`Not Found`})}function Xi(e){return(0,U.jsx)(U.Fragment,{children:e.children})}function Zi(e,t,n){return t.options.notFoundComponent?(0,U.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,U.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,U.jsx)(Yi,{})}var Qi=H.memo(function({matchId:e}){let t=Kr(),n=t.stores.matchStores.get(e);n||At();let r=yi(t.stores.loadedAt,e=>e),i=yi(n,e=>e);return(0,U.jsx)($i,{router:t,matchId:e,resetKey:r,matchState:H.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function $i({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,U.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?H.Suspense:Xi,f=s?zr:Xi,p=l?Ji:Xi;return(0,U.jsxs)(i.isRoot?i.options.shellComponent??Xi:Xi,{children:[(0,U.jsx)(qr.Provider,{value:t,children:(0,U.jsx)(d,{fallback:o,children:(0,U.jsx)(f,{getResetKey:()=>n,errorComponent:s||Vr,onCatch:(e,t)=>{if(hn(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,U.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return H.createElement(l,e)},children:u||r._displayPending?(0,U.jsx)(Hr,{fallback:o,children:(0,U.jsx)(ta,{matchId:t})}):(0,U.jsx)(ta,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ea,{resetKey:n}),(e.options.scrollRestoration,null)]}):null]})}function ea({resetKey:e}){let t=Kr(),n=H.useRef(void 0);return rt(()=>{let e=t.latestLocation.href;(n.current===void 0||n.current!==e)&&(t.emit({type:`onRendered`,...ur(t.stores.location.get(),t.stores.resolvedLocation.get())}),n.current=e)},[t.latestLocation.state.__TSR_key,e,t]),null}var ta=H.memo(function({matchId:e}){let t=Kr(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||At();let i=yi(r,e=>e),a=i.routeId,o=t.routesById[a],s=H.useMemo(()=>{let e=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[a,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),c=H.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?(0,U.jsx)(e,{},s):(0,U.jsx)(na,{})},[s,o.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=xt();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return hn(i.error)||At(),Zi(t,o,i.error);if(i.status===`redirected`)throw Tn(i.error)||At(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return c}),na=H.memo(function(){let e=Kr(),t=H.useContext(qr),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=yi(a,e=>[e?.routeId,e?.globalNotFound??!1]),i=yi(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,U.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||At(),Zi(e,a,void 0);if(!i)return null;let s=(0,U.jsx)(Qi,{matchId:i});return n===`__root__`?(0,U.jsx)(H.Suspense,{fallback:o,children:s}):s});function ra(){let e=Kr(),t=H.useRef({router:e,mounted:!1}),[n,r]=H.useState(!1),i=yi(e.stores.isLoading,e=>e),a=yi(e.stores.hasPending,e=>e),o=it(i),s=i||n||a,c=it(s),l=i||a,u=it(l);return e.startTransition=e=>{r(!0),H.startTransition(()=>{e(),r(!1)})},H.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return on(e.latestLocation.publicHref)!==on(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),rt(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),rt(()=>{o&&!i&&e.emit({type:`onLoad`,...ur(e.stores.location.get(),e.stores.resolvedLocation.get())})},[o,e,i]),rt(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...ur(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,u,e]),rt(()=>{if(c&&!s){let t=ur(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),li(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())})}},[s,c,e]),null}function ia(){let e=Kr(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,U.jsx)(t,{}):null,r=(0,U.jsxs)(typeof document<`u`&&e.ssr?Xi:H.Suspense,{fallback:n,children:[(0,U.jsx)(ra,{}),(0,U.jsx)(aa,{})]});return e.options.InnerWrap?(0,U.jsx)(e.options.InnerWrap,{children:r}):r}function aa(){let e=Kr(),t=yi(e.stores.firstId,e=>e),n=yi(e.stores.loadedAt,e=>e),r=t?(0,U.jsx)(Qi,{matchId:t}):null;return(0,U.jsx)(qr.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,U.jsx)(zr,{getResetKey:()=>n,errorComponent:Vr,onCatch:void 0,children:r})})}var oa=e=>({createMutableStore:fi,createReadonlyStore:fi,batch:li}),sa=e=>new ca(e),ca=class extends fr{constructor(e){super(e,oa)}};function la({router:e,children:t,...n}){ft(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,U.jsx)(Gr.Provider,{value:e,children:t});return e.options.Wrap?(0,U.jsx)(e.options.Wrap,{children:r}):r}function ua({router:e,...t}){return(0,U.jsx)(la,{router:e,...t,children:(0,U.jsx)(ia,{})})}function da(e){let t=Kr(),n=(0,H.useRef)(void 0);return yi(t.stores.location,r=>{let i=e?.select?e.select(r):r;if(e?.structuralSharing??t.options.defaultStructuralSharing){let e=ht(n.current,i);return n.current=e,e}return i})}var fa=g(),pa=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},ma=[`light`,`dark`],ha=`(prefers-color-scheme: dark)`,ga=typeof window>`u`,_a=H.createContext(void 0),va={setTheme:e=>{},themes:[]},ya=()=>H.useContext(_a)??va,ba=e=>H.useContext(_a)?H.createElement(H.Fragment,null,e.children):H.createElement(Sa,{...e}),xa=[`light`,`dark`],Sa=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:i=`theme`,themes:a=xa,defaultTheme:o=n?`system`:`light`,attribute:s=`data-theme`,value:c,children:l,nonce:u,scriptProps:d})=>{let[f,p]=H.useState(()=>wa(i,o)),[m,h]=H.useState(()=>f===`system`?Ea():f),g=c?Object.values(c):a,_=H.useCallback(e=>{let i=e;if(!i)return;e===`system`&&n&&(i=Ea());let a=c?c[i]:i,l=t?Ta(u):null,d=document.documentElement,f=e=>{e===`class`?(d.classList.remove(...g),a&&d.classList.add(a)):e.startsWith(`data-`)&&(a?d.setAttribute(e,a):d.removeAttribute(e))};if(Array.isArray(s)?s.forEach(f):f(s),r){let e=ma.includes(o)?o:null,t=ma.includes(i)?i:e;d.style.colorScheme=t}l?.()},[u]),v=H.useCallback(e=>{let t=typeof e==`function`?e(f):e;p(t);try{localStorage.setItem(i,t)}catch{}},[f]),y=H.useCallback(t=>{h(Ea(t)),f===`system`&&n&&!e&&_(`system`)},[f,e]);H.useEffect(()=>{let e=window.matchMedia(ha);return e.addListener(y),y(e),()=>e.removeListener(y)},[y]),H.useEffect(()=>{let e=e=>{e.key===i&&(e.newValue?p(e.newValue):v(o))};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[v]),H.useEffect(()=>{_(e??f)},[e,f]);let b=H.useMemo(()=>({theme:f,setTheme:v,forcedTheme:e,resolvedTheme:f===`system`?m:f,themes:n?[...a,`system`]:a,systemTheme:n?m:void 0}),[f,v,e,m,n,a]);return H.createElement(_a.Provider,{value:b},H.createElement(Ca,{forcedTheme:e,storageKey:i,attribute:s,enableSystem:n,enableColorScheme:r,defaultTheme:o,value:c,themes:a,nonce:u,scriptProps:d}),l)},Ca=H.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:l})=>{let u=JSON.stringify([n,t,a,e,s,o,r,i]).slice(1,-1);return H.createElement(`script`,{...l,suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(${pa.toString()})(${u})`}})}),wa=(e,t)=>{if(ga)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},Ta=e=>{let t=document.createElement(`style`);return e&&t.setAttribute(`nonce`,e),t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},Ea=e=>(e||=window.matchMedia(ha),e.matches?`dark`:`light`),Da=[`scope`,`todo`,`in_progress`,`done`,`backlog`],Oa=[`blocks`,`depends_on`,`unblocks`,`feeds`,`clarifies`,`enables`,`supports`,`relates`],ka=`depends_on`;function Aa(e){return`/${e.type}s/${e.id}/comments`}var ja=class extends Error{status;body;constructor(e,t){super(`API error ${String(e)}: ${t}`),this.status=e,this.body=t,this.name=`ApiError`}},Ma=`/api/v1`;async function G(e,t){let n=new Headers(t?.headers);n.has(`Content-Type`)||n.set(`Content-Type`,`application/json`);let r=await fetch(`${Ma}${e}`,{...t,headers:n,credentials:`include`});if(!r.ok)throw new ja(r.status,await r.text());if(r.status!==204)return r.json()}function Na(){return G(`/projects`)}function Pa(e){return G(`/projects`,{method:`POST`,body:JSON.stringify(e)})}function Fa(e){return G(`/projects/${e}`)}function Ia(e,t={}){let n=new URLSearchParams;t.status!==void 0&&n.set(`status`,t.status);let r=n.toString();return G(`/projects/${e}/tasks${r?`?${r}`:``}`)}function La(e,t){return G(`/projects/${e}/tasks`,{method:`POST`,body:JSON.stringify(t)})}function Ra(e,t){return G(`/tasks/${e}`,{method:`PATCH`,body:JSON.stringify(t)})}function za(e){return G(`/tasks/${e}`,{method:`DELETE`})}function Ba(e,t){return G(`/tasks/${e}/share`,{method:`POST`,body:JSON.stringify({expires:t})})}function Va(e,t){return G(`/documents/${e}/share`,{method:`POST`,body:JSON.stringify({expires:t})})}function Ha(e,t){return G(`/workspaces/${e}/share`,{method:`POST`,body:JSON.stringify(t)})}function Ua(e){return G(`/projects/${e}/tags`)}function Wa(e,t){return G(`/projects/${e}`,{method:`PATCH`,body:JSON.stringify(t)})}function Ga(e){return G(`/projects/${e}`,{method:`DELETE`})}function Ka(e){return G(`/projects/${e}/canvas`)}function qa(e,t){return G(`/projects/${e}/canvas`,{method:`PUT`,body:JSON.stringify(t)})}function Ja(e){return G(`/projects/${e}/documents`)}function Ya(e,t){return G(`/projects/${e}/documents`,{method:`POST`,body:JSON.stringify(t)})}function Xa(e){return G(`/documents/${e}`)}function Za(e,t){return G(`/documents/${e}`,{method:`PATCH`,body:JSON.stringify(t)})}function Qa(e){return G(`/documents/${e}`,{method:`DELETE`})}function $a(e,t){return G(`/projects/${e}/files`,{method:`POST`,body:JSON.stringify(t)})}function eo(e){return G(`/projects/${e}/folders`)}function to(e,t){return G(`/projects/${e}/folders`,{method:`POST`,body:JSON.stringify(t)})}function no(e,t){return G(`/folders/${e}`,{method:`PATCH`,body:JSON.stringify(t)})}function ro(e){return G(`/folders/${e}`,{method:`DELETE`})}function io(e){return G(`/projects/${e}/notes`)}function ao(e,t){return G(`/projects/${e}/notes`,{method:`POST`,body:JSON.stringify(t)})}function oo(e){return G(`/notes/${e}`)}function so(e,t){return G(`/notes/${e}`,{method:`PATCH`,body:JSON.stringify(t)})}function co(e){return G(`/notes/${e}`,{method:`DELETE`})}function lo(e,t){let n=new URLSearchParams;t?.includeResolved===!0&&n.set(`include_resolved`,`true`);let r=n.toString();return G(`${Aa(e)}${r?`?${r}`:``}`)}function uo(e,t){return G(Aa(e),{method:`POST`,body:JSON.stringify(t)})}function fo(e,t){return G(`/comments/${e}`,{method:`PATCH`,body:JSON.stringify(t)})}function po(e){return G(`/comments/${e}`,{method:`DELETE`})}function mo(e,t){return G(`/projects/${e}/edges/${t}`,{method:`DELETE`})}function ho(e){return G(`/auth/cli-token`,{method:`POST`,body:JSON.stringify(e===void 0?{}:{name:e})})}function go(e){return G(`/orgs/${e}/members`)}function _o(e,t){return G(`/orgs/${e}/invitations`,{method:`POST`,body:JSON.stringify({email:t.email,role:t.role,team_id:t.teamId})})}function vo(e){return G(`/invitations/${e}`)}function yo(e){return G(`/invitations/${e}/accept`,{method:`POST`})}function bo(e){return G(`/projects/${e}/agent-runs`)}function xo(e,t=`pending`){return G(`/projects/${e}/submissions?status=${t}`)}function So(e,t){return G(`/submissions/${e}/triage`,{method:`POST`,body:JSON.stringify(t)})}function Co(e){return G(`/projects/${e}/goals`)}function wo(e){return G(`/goals/${e}`)}function To(e,t){return G(`/projects/${e}/goals`,{method:`POST`,body:JSON.stringify(t)})}function Eo(e){return G(`/goals/${e}/pause`,{method:`POST`})}function Do(e){return G(`/goals/${e}/resume`,{method:`POST`})}function Oo(e,t){return G(`/goals/${e}/complete`,{method:`POST`,body:JSON.stringify(t===void 0?{}:{evidence:t})})}function ko(){return G(`/auth/session`)}async function Ao(e){let t=await fetch(`/api/auth/organization/set-active`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({organizationId:e})});if(!t.ok)throw new ja(t.status,await t.text())}async function jo(e,t){let n=await fetch(`/api/auth/organization/${e}`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!n.ok)throw new ja(n.status,await n.text());return n}async function Mo(){return(await G(`/auth/session`)).org?.id??void 0}async function No(e){try{await jo(`set-active-team`,{teamId:e})}catch(e){if(e instanceof ja&&e.status===401)return;throw e}}async function Po(){let e=await Mo();return e===void 0?[]:(await G(`/orgs/${encodeURIComponent(e)}/workspaces`)).workspaces}async function Fo(e){let t=await Mo();if(t===void 0)throw new ja(400,`No active organization`);return G(`/orgs/${encodeURIComponent(t)}/workspaces`,{method:`POST`,body:JSON.stringify({name:e})})}async function Io(e,t){let n=await(await jo(`update-team`,{teamId:e,data:{name:t}})).json();if(n===null)throw new ja(404,`workspace not found`);return{id:n.id,name:n.name}}async function Lo(e){await jo(`remove-team`,{teamId:e})}async function Ro(e){let t=new URLSearchParams({teamId:e}),n=await fetch(`/api/auth/organization/list-team-members?${t.toString()}`,{method:`GET`,credentials:`include`});if(!n.ok)throw new ja(n.status,await n.text());return(await n.json()).map(e=>({id:e.id,teamId:e.teamId,userId:e.userId,createdAt:e.createdAt}))}async function zo(e,t){await jo(`add-team-member`,{teamId:e,userId:t})}async function Bo(e,t){await jo(`remove-team-member`,{teamId:e,userId:t})}function Vo(e,t){return G(`/projects/${e}`,{method:`PATCH`,body:JSON.stringify({workspace_id:t})})}function Ho(){return G(`/auth/methods`)}async function Uo(){let e=await fetch(`/api/auth/sign-out`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:`{}`});if(!e.ok)throw new ja(e.status,await e.text());return{ok:!0}}var Wo=`/api/auth/sign-in/social`;async function Go(e=`/`){let t=await fetch(Wo,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({provider:`github`,callbackURL:e})});if(!t.ok)throw new ja(t.status,await t.text());let n=await t.json();if(typeof n!=`object`||!n||!(`url`in n)||typeof n.url!=`string`||n.url.length===0)throw Error(`better-auth sign-in/social did not return a url`);return{url:n.url,redirect:`redirect`in n&&n.redirect===!0}}var Ko=[`auth`,`session`],qo=[`auth`,`methods`],Jo=[`workspaces`];function Yo(){return tt({queryKey:Ko,queryFn:async()=>{try{return await ko()}catch(e){if(e instanceof ja&&e.status===401)return null;throw e}},retry:!1})}function Xo(){return tt({queryKey:qo,queryFn:Ho,retry:!1})}function Zo(){let e=W();return nt({mutationFn:Uo,onSuccess:async()=>{await e.invalidateQueries()}})}function Qo(){let e=W();return nt({mutationFn:Ao,onSuccess:async()=>{await e.invalidateQueries()}})}function $o(){let e=W();return nt({mutationFn:No,onSuccess:async()=>{await e.invalidateQueries()}})}function es(){return tt({queryKey:Jo,queryFn:Po})}function ts(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=ts(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function ns(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ts(e))&&(r&&(r+=` `),r+=t);return r}var rs=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,is=ns,as=(e,t)=>n=>{if(t?.variants==null)return is(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=rs(t)||rs(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return is(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)};function ss(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function cs(...e){return t=>{let n=!1,r=e.map(e=>{let r=ss(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():ss(e[t],null)}}}}function ls(...e){return H.useCallback(cs(...e),e)}function us(e){let t=H.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];vs(r)&&typeof Ss==`function`&&(r=Ss(r._payload)),H.Children.forEach(r,e=>{if(gs(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;vs(n)&&typeof Ss==`function`&&(n=Ss(n._payload)),a=ps(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=H.cloneElement(a,void 0,s):!o&&H.Children.count(r)===1&&H.isValidElement(r)&&(a=r);let c=a?hs(a):void 0,l=ls(n,c);if(!a){if(r||r===0)throw Error(o?xs(e):bs(e));return r}let u=ms(i,a.props??{});return a.type!==H.Fragment&&(u.ref=n?l:c),H.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var ds=us(`Slot`),fs=Symbol.for(`radix.slottable`),ps=(e,t)=>{if(`child`in e.props){let t=e.props.child;return H.isValidElement(t)?H.cloneElement(t,void 0,e.props.children(t.props.children)):null}return H.isValidElement(t)?t:null};function ms(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function hs(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function gs(e){return H.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===fs}var _s=Symbol.for(`react.lazy`);function vs(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===_s&&`_payload`in e&&ys(e._payload)}function ys(e){return typeof e==`object`&&!!e&&`then`in e}var bs=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,xs=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Ss=H.use,Cs=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=us(`Primitive.${t}`),r=H.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,U.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ws(e,t){e&&Oi.flushSync(()=>e.dispatchEvent(t))}var Ts=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Es=`VisuallyHidden`,Ds=H.forwardRef((e,t)=>(0,U.jsx)(Cs.span,{...e,ref:t,style:{...Ts,...e.style}}));Ds.displayName=Es;function Os(e,t=[]){let n=[];function r(t,r){let i=H.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=H.useMemo(()=>o,Object.values(o));return(0,U.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=H.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>H.createContext(e));return function(n){let r=n?.[e]||t;return H.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,ks(i,...t)]}function ks(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return H.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function As(e){let t=e+`CollectionProvider`,[n,r]=Os(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=H.useRef(null),a=H.useRef(new Map).current;return(0,U.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=us(s),l=H.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,U.jsx)(c,{ref:ls(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=us(u),p=H.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=H.useRef(null),s=ls(t,o),c=a(u,n);return H.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,U.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return H.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}typeof window<`u`&&window.document&&window.document.createElement;function K(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}var js=globalThis?.document?H.useLayoutEffect:()=>{},Ms=H.useInsertionEffect||js;function Ns({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Ps({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=H.useRef(e!==void 0);H.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`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.`),t.current=s},[s,r])}return[c,H.useCallback(t=>{if(s){let n=Fs(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Ps({defaultProp:e,onChange:t}){let[n,r]=H.useState(e),i=H.useRef(n),a=H.useRef(t);return Ms(()=>{a.current=t},[t]),H.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Fs(e){return typeof e==`function`}function Is(e,t){return H.useReducer((e,n)=>t[e][n]??e,e)}var Ls=e=>{let{present:t,children:n}=e,r=Rs(t),i=typeof n==`function`?n({present:r.isPresent}):H.Children.only(n),a=Bs(r.ref,Hs(i));return typeof n==`function`||r.isPresent?H.cloneElement(i,{ref:a}):null};Ls.displayName=`Presence`;function Rs(e){let[t,n]=H.useState(),r=H.useRef(null),i=H.useRef(e),a=H.useRef(`none`),o=H.useRef(void 0),[s,c]=Is(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return H.useEffect(()=>{s===`mounted`?(a.current=o.current??Vs(r.current),o.current=void 0):a.current=`none`},[s]),js(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=Vs(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),js(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Vs(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=Vs(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:H.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=Vs(t)}else r.current=null;n(e)},[])}}function zs(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Bs(...e){let t=H.useRef(e);return t.current=e,H.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=zs(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():zs(n[e],null)}}},[])}function Vs(e){return e?.animationName||`none`}function Hs(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Us=H.useId||(()=>void 0),Ws=0;function Gs(e){let[t,n]=H.useState(Us());return js(()=>{e||n(e=>e??String(Ws++))},[e]),e||(t?`radix-${t}`:``)}var Ks=H.createContext(void 0);function qs(e){let t=H.useContext(Ks);return e||t||`ltr`}function Js(e){let t=H.useRef(e);return H.useEffect(()=>{t.current=e}),H.useMemo(()=>((...e)=>t.current?.(...e)),[])}var Ys=`DismissableLayer`,Xs=`dismissableLayer.update`,Zs=`dismissableLayer.pointerDownOutside`,Qs=`dismissableLayer.focusOutside`,$s,ec=H.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),tc=H.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=H.useContext(ec),[d,f]=H.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=H.useState({}),h=ls(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=H.useRef(!1),C=oc(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:H.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=sc(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=Js(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return H.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),H.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&($s=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),cc(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=$s))}},[d,p,n,u]),H.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),cc())},[d,u]),H.useEffect(()=>{let e=()=>m({});return document.addEventListener(Xs,e),()=>document.removeEventListener(Xs,e)},[]),(0,U.jsx)(Cs.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:K(e.onFocusCapture,w.onFocusCapture),onBlurCapture:K(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:K(e.onPointerDownCapture,C.onPointerDownCapture)})});tc.displayName=Ys;var nc=`DismissableLayerBranch`,rc=H.forwardRef((e,t)=>{let n=H.useContext(ec),r=H.useRef(null),i=ls(t,r);return H.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,U.jsx)(Cs.div,{...e,ref:i})});rc.displayName=nc;function ic(){let e=H.useContext(ec),[t,n]=H.useState(null);return H.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var ac=()=>!0;function oc(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=ac}=t,s=Js(e),c=H.useRef(!1),l=H.useRef(!1),u=H.useRef(new Map),d=H.useRef(()=>{});return H.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}function p(e){l.current&&u.current.set(e.type,!1)}let m=a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||lc(Zs,s,p,{discrete:!0})};if(!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:()=>c.current=!0}}function sc(e,t=globalThis?.document){let n=Js(e),r=H.useRef(!1);return H.useEffect(()=>{let e=e=>{e.target&&!r.current&&lc(Qs,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function cc(){let e=new CustomEvent(Xs);document.dispatchEvent(e)}function lc(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?ws(i,a):i.dispatchEvent(a)}var uc=`focusScope.autoFocusOnMount`,dc=`focusScope.autoFocusOnUnmount`,fc={bubbles:!1,cancelable:!0},pc=`FocusScope`,mc=H.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=H.useState(null),l=Js(i),u=Js(a),d=H.useRef(null),f=ls(t,c),p=H.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;H.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:xc(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||xc(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&xc(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),H.useEffect(()=>{if(s){Sc.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(uc,fc);s.addEventListener(uc,l),s.dispatchEvent(t),t.defaultPrevented||(hc(Tc(_c(s)),{select:!0}),document.activeElement===e&&xc(s))}return()=>{s.removeEventListener(uc,l),setTimeout(()=>{let t=new CustomEvent(dc,fc);s.addEventListener(dc,u),s.dispatchEvent(t),t.defaultPrevented||xc(e??document.body,{select:!0}),s.removeEventListener(dc,u),Sc.remove(p)},0)}}},[s,l,u,p]);let m=H.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=gc(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&xc(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&xc(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,U.jsx)(Cs.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});mc.displayName=pc;function hc(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(xc(r,{select:t}),document.activeElement!==n)return}function gc(e){let t=_c(e);return[vc(t,e),vc(t.reverse(),e)]}function _c(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function vc(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):yc(r,{upTo:t})))return r}function yc(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function bc(e){return e instanceof HTMLInputElement&&`select`in e}function xc(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&bc(e)&&t&&e.select()}}var Sc=Cc();function Cc(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=wc(e,t),e.unshift(t)},remove(t){e=wc(e,t),e[0]?.resume()}}}function wc(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Tc(e){return e.filter(e=>e.tagName!==`A`)}var Ec=`Portal`,Dc=H.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=H.useState(!1);js(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Oi.createPortal((0,U.jsx)(Cs.div,{...r,ref:t}),o):null});Dc.displayName=Ec;var Oc=0,kc=null;function Ac(){H.useEffect(()=>{kc||={start:jc(),end:jc()};let{start:e,end:t}=kc;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Oc++,()=>{Oc===1&&(kc?.start.remove(),kc?.end.remove(),kc=null),Oc=Math.max(0,Oc-1)}},[])}function jc(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var Mc=function(){return Mc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Mc.apply(this,arguments)};function Nc(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Pc(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Fc=`right-scroll-bar-position`,Ic=`width-before-scroll-bar`,Lc=`with-scroll-bars-hidden`,Rc=`--removed-body-scroll-bar-size`;function zc(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Bc(e,t){var n=(0,H.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Vc=typeof window<`u`?H.useLayoutEffect:H.useEffect,Hc=new WeakMap;function Uc(e,t){var n=Bc(t||null,function(t){return e.forEach(function(e){return zc(e,t)})});return Vc(function(){var t=Hc.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||zc(e,null)}),i.forEach(function(e){r.has(e)||zc(e,a)})}Hc.set(n,e)},[e]),n}function Wc(e){return e}function Gc(e,t){t===void 0&&(t=Wc);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Kc(e){e===void 0&&(e={});var t=Gc(null);return t.options=Mc({async:!0,ssr:!1},e),t}var qc=function(e){var t=e.sideCar,n=Nc(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return H.createElement(r,Mc({},n))};qc.isSideCarExport=!0;function Jc(e,t){return e.useMedium(t),qc}var Yc=Kc(),Xc=function(){},Zc=H.forwardRef(function(e,t){var n=H.useRef(null),r=H.useState({onScrollCapture:Xc,onWheelCapture:Xc,onTouchMoveCapture:Xc}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Nc(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Uc([n,t]),C=Mc(Mc({},b),i);return H.createElement(H.Fragment,null,u&&H.createElement(x,{sideCar:Yc,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?H.cloneElement(H.Children.only(s),Mc(Mc({},C),{ref:S})):H.createElement(v,Mc({},C,{className:c,ref:S}),s))});Zc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Zc.classNames={fullWidth:Ic,zeroRight:Fc};var Qc,$c=function(){if(Qc)return Qc;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function el(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=$c();return t&&e.setAttribute(`nonce`,t),e}function tl(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function nl(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var rl=function(){var e=0,t=null;return{add:function(n){e==0&&(t=el())&&(tl(t,n),nl(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},il=function(){var e=rl();return function(t,n){H.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},al=function(){var e=il();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},ol={left:0,top:0,right:0,gap:0},sl=function(e){return parseInt(e||``,10)||0},cl=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[sl(n),sl(r),sl(i)]},ll=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return ol;var t=cl(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ul=al(),dl=`data-scroll-locked`,fl=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
10
|
+
.${Lc} {
|
|
11
|
+
overflow: hidden ${r};
|
|
12
|
+
padding-right: ${s}px ${r};
|
|
13
|
+
}
|
|
14
|
+
body[${dl}] {
|
|
15
|
+
overflow: hidden ${r};
|
|
16
|
+
overscroll-behavior: contain;
|
|
17
|
+
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
18
|
+
padding-left: ${i}px;
|
|
19
|
+
padding-top: ${a}px;
|
|
20
|
+
padding-right: ${o}px;
|
|
21
|
+
margin-left:0;
|
|
22
|
+
margin-top:0;
|
|
23
|
+
margin-right: ${s}px ${r};
|
|
24
|
+
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.${Fc} {
|
|
28
|
+
right: ${s}px ${r};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.${Ic} {
|
|
32
|
+
margin-right: ${s}px ${r};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.${Fc} .${Fc} {
|
|
36
|
+
right: 0 ${r};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.${Ic} .${Ic} {
|
|
40
|
+
margin-right: 0 ${r};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
body[${dl}] {
|
|
44
|
+
${Rc}: ${s}px;
|
|
45
|
+
}
|
|
46
|
+
`},pl=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},ml=function(){H.useEffect(function(){return document.body.setAttribute(dl,(pl()+1).toString()),function(){var e=pl()-1;e<=0?document.body.removeAttribute(dl):document.body.setAttribute(dl,e.toString())}},[])},hl=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;ml();var a=H.useMemo(function(){return ll(i)},[i]);return H.createElement(ul,{styles:fl(a,!t,i,n?``:`!important`)})},gl=!1;if(typeof window<`u`)try{var _l=Object.defineProperty({},"passive",{get:function(){return gl=!0,!0}});window.addEventListener(`test`,_l,_l),window.removeEventListener(`test`,_l,_l)}catch{gl=!1}var vl=gl?{passive:!1}:!1,yl=function(e){return e.tagName===`TEXTAREA`},bl=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!yl(e)&&n[t]===`visible`)},xl=function(e){return bl(e,`overflowY`)},Sl=function(e){return bl(e,`overflowX`)},Cl=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),El(e,r)){var i=Dl(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},wl=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Tl=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},El=function(e,t){return e===`v`?xl(t):Sl(t)},Dl=function(e,t){return e===`v`?wl(t):Tl(t)},Ol=function(e,t){return e===`h`&&t===`rtl`?-1:1},kl=function(e,t,n,r,i){var a=Ol(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Dl(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&El(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Al=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},jl=function(e){return[e.deltaX,e.deltaY]},Ml=function(e){return e&&`current`in e?e.current:e},Nl=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Pl=function(e){return`
|
|
47
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
48
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
49
|
+
`},Fl=0,Il=[];function Ll(e){var t=H.useRef([]),n=H.useRef([0,0]),r=H.useRef(),i=H.useState(Fl++)[0],a=H.useState(al)[0],o=H.useRef(e);H.useEffect(function(){o.current=e},[e]),H.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Pc([e.lockRef.current],(e.shards||[]).map(Ml),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=H.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Al(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Cl(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Cl(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return kl(h,t,e,h===`h`?s:c,!0)},[]),c=H.useCallback(function(e){var n=e;if(!(!Il.length||Il[Il.length-1]!==a)){var r=`deltaY`in n?jl(n):Al(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Nl(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Ml).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=H.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Rl(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=H.useCallback(function(e){n.current=Al(e),r.current=void 0},[]),d=H.useCallback(function(t){l(t.type,jl(t),t.target,s(t,e.lockRef.current))},[]),f=H.useCallback(function(t){l(t.type,Al(t),t.target,s(t,e.lockRef.current))},[]);H.useEffect(function(){return Il.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,vl),document.addEventListener(`touchmove`,c,vl),document.addEventListener(`touchstart`,u,vl),function(){Il=Il.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,vl),document.removeEventListener(`touchmove`,c,vl),document.removeEventListener(`touchstart`,u,vl)}},[]);var p=e.removeScrollBar,m=e.inert;return H.createElement(H.Fragment,null,m?H.createElement(a,{styles:Pl(i)}):null,p?H.createElement(hl,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Rl(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var zl=Jc(Yc,Ll),Bl=H.forwardRef(function(e,t){return H.createElement(Zc,Mc({},e,{ref:t,sideCar:zl}))});Bl.classNames=Zc.classNames;var Vl=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Hl=new WeakMap,Ul=new WeakMap,Wl={},Gl=0,Kl=function(e){return e&&(e.host||Kl(e.parentNode))},ql=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Kl(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Jl=function(e,t,n,r){var i=ql(t,Array.isArray(e)?e:[e]);Wl[n]||(Wl[n]=new WeakMap);var a=Wl[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Hl.get(e)||0)+1,l=(a.get(e)||0)+1;Hl.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Ul.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Gl++,function(){o.forEach(function(e){var t=Hl.get(e)-1,i=a.get(e)-1;Hl.set(e,t),a.set(e,i),t||(Ul.has(e)||e.removeAttribute(r),Ul.delete(e)),i||e.removeAttribute(n)}),Gl--,Gl||(Hl=new WeakMap,Hl=new WeakMap,Ul=new WeakMap,Wl={})}},Yl=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Vl(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Jl(r,i,n,`aria-hidden`)):function(){return null}},Xl=`Dialog`,[Zl,Ql]=Os(Xl),[$l,eu]=Zl(Xl),tu=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=H.useRef(null),c=H.useRef(null),[l,u]=Ns({prop:r,defaultProp:i??!1,onChange:a,caller:Xl});return(0,U.jsx)($l,{scope:t,triggerRef:s,contentRef:c,contentId:Gs(),titleId:Gs(),descriptionId:Gs(),open:l,onOpenChange:u,onOpenToggle:H.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};tu.displayName=Xl;var nu=`DialogTrigger`,ru=H.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=eu(nu,n),a=ls(t,i.triggerRef);return(0,U.jsx)(Cs.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Cu(i.open),...r,ref:a,onClick:K(e.onClick,i.onOpenToggle)})});ru.displayName=nu;var iu=`DialogPortal`,[au,ou]=Zl(iu,{forceMount:void 0}),su=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=eu(iu,t);return(0,U.jsx)(au,{scope:t,forceMount:n,children:H.Children.map(r,e=>(0,U.jsx)(Ls,{present:n||a.open,children:(0,U.jsx)(Dc,{asChild:!0,container:i,children:e})}))})};su.displayName=iu;var cu=`DialogOverlay`,lu=H.forwardRef((e,t)=>{let n=ou(cu,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=eu(cu,e.__scopeDialog);return a.modal?(0,U.jsx)(Ls,{present:r||a.open,children:(0,U.jsx)(du,{...i,ref:t})}):null});lu.displayName=cu;var uu=us(`DialogOverlay.RemoveScroll`),du=H.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=eu(cu,n),a=ls(t,ic());return(0,U.jsx)(Bl,{as:uu,allowPinchZoom:!0,shards:[i.contentRef],children:(0,U.jsx)(Cs.div,{"data-state":Cu(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),fu=`DialogContent`,pu=H.forwardRef((e,t)=>{let n=ou(fu,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=eu(fu,e.__scopeDialog);return(0,U.jsx)(Ls,{present:r||a.open,children:a.modal?(0,U.jsx)(mu,{...i,ref:t}):(0,U.jsx)(hu,{...i,ref:t})})});pu.displayName=fu;var mu=H.forwardRef((e,t)=>{let n=eu(fu,e.__scopeDialog),r=H.useRef(null),i=ls(t,n.contentRef,r);return H.useEffect(()=>{let e=r.current;if(e)return Yl(e)},[]),(0,U.jsx)(gu,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:K(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:K(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:K(e.onFocusOutside,e=>e.preventDefault())})}),hu=H.forwardRef((e,t)=>{let n=eu(fu,e.__scopeDialog),r=H.useRef(!1),i=H.useRef(!1);return(0,U.jsx)(gu,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),gu=H.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=eu(fu,n);return Ac(),(0,U.jsx)(U.Fragment,{children:(0,U.jsx)(mc,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)(tc,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Cu(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),_u=`DialogTitle`,vu=H.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=eu(_u,n);return(0,U.jsx)(Cs.h2,{id:i.titleId,...r,ref:t})});vu.displayName=_u;var yu=`DialogDescription`,bu=H.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=eu(yu,n);return(0,U.jsx)(Cs.p,{id:i.descriptionId,...r,ref:t})});bu.displayName=yu;var xu=`DialogClose`,Su=H.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=eu(xu,n);return(0,U.jsx)(Cs.button,{type:`button`,...r,ref:t,onClick:K(e.onClick,()=>i.onOpenChange(!1))})});Su.displayName=xu;function Cu(e){return e?`open`:`closed`}var wu=`Avatar`,[Tu,Eu]=Os(wu),Du=[0,()=>void 0],[Ou,ku]=Tu(wu),Au=H.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=H.useState(`idle`),[o,s]=Lu();return(0,U.jsx)(Ou,{scope:n,imageLoadingStatus:i,setImageLoadingStatus:a,imageCount:o,setImageCount:s,children:(0,U.jsx)(Cs.span,{...r,ref:t})})});Au.displayName=wu;var ju=`AvatarImage`,Mu=H.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i,...a}=e,o=ku(ju,n);Ru(o.setImageCount);let s=Fu(r,{referrerPolicy:a.referrerPolicy,crossOrigin:a.crossOrigin,loadingStatus:o.imageLoadingStatus,setLoadingStatus:o.setImageLoadingStatus}),c=Js(e=>{i?.(e)}),l=H.useRef(s);return js(()=>{let e=l.current;l.current=s,s!==e&&c(s)},[s,c]),s===`loaded`?(0,U.jsx)(Cs.img,{...a,ref:t,src:r}):null});Mu.displayName=ju;var Nu=`AvatarFallback`,Pu=H.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=ku(Nu,n),[o,s]=H.useState(r===void 0);return H.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,U.jsx)(Cs.span,{...i,ref:t}):null});Pu.displayName=Nu;function Fu(e,{loadingStatus:t,setLoadingStatus:n,referrerPolicy:r,crossOrigin:i}){return js(()=>{if(!e){n(`error`);return}let t=new window.Image,a=e=>{let t=e.currentTarget;n(Iu(t))},o=()=>n(`error`);return t.addEventListener(`load`,a),t.addEventListener(`error`,o),r&&(t.referrerPolicy=r),t.crossOrigin=i??null,t.src=e,n(Iu(t)),()=>{t.removeEventListener(`load`,a),t.removeEventListener(`error`,o),n(`idle`)}},[e,i,r,n]),t}function Iu(e){return e.complete?e.naturalWidth>0?`loaded`:`error`:`loading`}function Lu(){let e=Du;{e=H.useState(0);let[t]=e,n=H.useRef(!1);H.useEffect(()=>{t>1&&!n.current&&(n.current=!0,console.warn("Avatar: Only one `Avatar.Image` component should be rendered per `Avatar.Root`, but multiple were detected. This will lead to unexpected behavior."))},[t])}return e}function Ru(e){H.useEffect(()=>(e(e=>e+1),()=>{e(e=>e-1)}),[e])}function zu(e){let t=H.useRef({value:e,previous:e});return H.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Bu(e){let[t,n]=H.useState(void 0);return js(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Vu=hi(),Hu=[`top`,`right`,`bottom`,`left`],Uu=Math.min,Wu=Math.max,Gu=Math.round,Ku=Math.floor,qu=e=>({x:e,y:e}),Ju={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Yu(e,t,n){return Wu(e,Uu(t,n))}function Xu(e,t){return typeof e==`function`?e(t):e}function Zu(e){return e.split(`-`)[0]}function Qu(e){return e.split(`-`)[1]}function $u(e){return e===`x`?`y`:`x`}function ed(e){return e===`y`?`height`:`width`}function td(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function nd(e){return $u(td(e))}function rd(e,t,n){n===void 0&&(n=!1);let r=Qu(e),i=nd(e),a=ed(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=fd(o)),[o,fd(o)]}function id(e){let t=fd(e);return[ad(e),t,ad(t)]}function ad(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var od=[`left`,`right`],sd=[`right`,`left`],cd=[`top`,`bottom`],ld=[`bottom`,`top`];function ud(e,t,n){switch(e){case`top`:case`bottom`:return n?t?sd:od:t?od:sd;case`left`:case`right`:return t?cd:ld;default:return[]}}function dd(e,t,n,r){let i=Qu(e),a=ud(Zu(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ad)))),a}function fd(e){let t=Zu(e);return Ju[t]+e.slice(t.length)}function pd(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function md(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:pd(e)}function hd(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function gd(e,t,n){let{reference:r,floating:i}=e,a=td(t),o=nd(t),s=ed(o),c=Zu(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Qu(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function _d(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Xu(t,e),p=md(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=hd(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=hd(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var vd=50,yd=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:_d},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=gd(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<vd&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=gd(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},bd=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Xu(e,t)||{};if(l==null)return{};let d=md(u),f={x:n,y:r},p=nd(i),m=ed(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Uu(d[_],T),D=Uu(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Yu(E,k,O),j=!c.arrow&&Qu(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),xd=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Xu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Zu(r),_=td(o),v=Zu(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[fd(o)]:id(o)),x=p!==`none`;!d&&x&&b.push(...dd(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=rd(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==td(t))||T.every(e=>td(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=td(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Sd(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Cd(e){return Hu.some(t=>e[t]>=0)}var wd=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Xu(e,t);switch(i){case`referenceHidden`:{let e=Sd(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Cd(e)}}}case`escaped`:{let e=Sd(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Cd(e)}}}default:return{}}}}},Td=new Set([`left`,`top`]);async function Ed(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Zu(n),s=Qu(n),c=td(n)===`y`,l=Td.has(o)?-1:1,u=a&&c?-1:1,d=Xu(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Dd=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Ed(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Od=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Xu(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=td(i),p=$u(f),m=u[p],h=u[f],g=(e,t)=>Yu(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},kd=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Xu(e,t),u={x:n,y:r},d=td(i),f=$u(d),p=u[f],m=u[d],h=Xu(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Td.has(Zu(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ad=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Xu(e,t),c=await i.detectOverflow(t,s),l=Zu(n),u=Qu(n),d=td(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Uu(p-c[m],g),y=Uu(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Wu(c.left,c.right):S=p-2*Wu(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function jd(){return typeof window<`u`}function Md(e){return Fd(e)?(e.nodeName||``).toLowerCase():`#document`}function Nd(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pd(e){return((Fd(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Fd(e){return jd()?e instanceof Node||e instanceof Nd(e).Node:!1}function Id(e){return jd()?e instanceof Element||e instanceof Nd(e).Element:!1}function Ld(e){return jd()?e instanceof HTMLElement||e instanceof Nd(e).HTMLElement:!1}function Rd(e){return!jd()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Nd(e).ShadowRoot}function zd(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Xd(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Bd(e){return/^(table|td|th)$/.test(Md(e))}function Vd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Hd=/transform|translate|scale|rotate|perspective|filter/,Ud=/paint|layout|strict|content/,Wd=e=>!!e&&e!==`none`,Gd;function Kd(e){let t=Id(e)?Xd(e):e;return Wd(t.transform)||Wd(t.translate)||Wd(t.scale)||Wd(t.rotate)||Wd(t.perspective)||!Jd()&&(Wd(t.backdropFilter)||Wd(t.filter))||Hd.test(t.willChange||``)||Ud.test(t.contain||``)}function qd(e){let t=Qd(e);for(;Ld(t)&&!Yd(t);){if(Kd(t))return t;if(Vd(t))return null;t=Qd(t)}return null}function Jd(){return Gd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Gd}function Yd(e){return/^(html|body|#document)$/.test(Md(e))}function Xd(e){return Nd(e).getComputedStyle(e)}function Zd(e){return Id(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qd(e){if(Md(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Rd(e)&&e.host||Pd(e);return Rd(t)?t.host:t}function $d(e){let t=Qd(e);return Yd(t)?(e.ownerDocument||e).body:Ld(t)&&zd(t)?t:$d(t)}function ef(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=$d(e),i=r===e.ownerDocument?.body,a=Nd(r);if(i){let e=tf(a);return t.concat(a,a.visualViewport||[],zd(r)?r:[],e&&n?ef(e):[])}else return t.concat(r,ef(r,[],n))}function tf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function nf(e){let t=Xd(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ld(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Gu(n)!==a||Gu(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function rf(e){return Id(e)?e:e.contextElement}function af(e){let t=rf(e);if(!Ld(t))return qu(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=nf(t),o=(a?Gu(n.width):n.width)/r,s=(a?Gu(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var of=qu(0);function sf(e){let t=Nd(e);return!Jd()||!t.visualViewport?of:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cf(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Nd(e)}function lf(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=rf(e),o=qu(1);t&&(r?Id(r)&&(o=af(r)):o=af(e));let s=cf(a,n,r)?sf(a):qu(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Nd(a),t=Id(r)?Nd(r):r,n=e,i=tf(n);for(;i&&t!==n;){let e=af(i),t=i.getBoundingClientRect(),r=Xd(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Nd(i),i=tf(n)}}return hd({width:u,height:d,x:c,y:l})}function uf(e,t){let n=Zd(e).scrollLeft;return t?t.left+n:lf(Pd(e)).left+n}function df(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-uf(e,n),y:n.top+t.scrollTop}}function ff(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Pd(r),s=t?Vd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=qu(1),u=qu(0),d=Ld(r);if((d||!a)&&((Md(r)!==`body`||zd(o))&&(c=Zd(r)),d)){let e=lf(r);l=af(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?df(o,c):qu(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function pf(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function mf(e){let t=Zd(e),n=e.ownerDocument.body,r=Wu(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Wu(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+uf(e),o=-t.scrollTop;return Xd(n).direction===`rtl`&&(a+=Wu(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var hf=25;function gf(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Nd(e),a=Pd(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Jd()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(uf(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=hf&&(s-=o)}return{width:s,height:c,x:l,y:u}}function _f(e,t){let n=lf(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=af(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function vf(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=gf(e,n,t);else if(t===`document`)r=mf(Pd(e));else if(Id(t))r=_f(t,n);else{let n=sf(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return hd(r)}function yf(e,t){let n=t.get(e);if(n)return n;let r=ef(e,[],!1).filter(e=>Id(e)&&Md(e)!==`body`),i=null,a=Xd(e).position===`fixed`,o=a?Qd(e):e;for(;Id(o)&&!Yd(o);){let e=Xd(o),t=Kd(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Qd(o)}return t.set(e,r),r}function bf(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Vd(t)?[]:yf(t,this._c):[].concat(n),r],o=vf(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=vf(t,a[e],i);s=Wu(n.top,s),c=Uu(n.right,c),l=Uu(n.bottom,l),u=Wu(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function xf(e){let{width:t,height:n}=nf(e);return{width:t,height:n}}function Sf(e,t,n){let r=Ld(t),i=Pd(t),a=n===`fixed`,o=lf(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=qu(0);if((r||!a)&&((Md(t)!==`body`||zd(i))&&(s=Zd(t)),r)){let e=lf(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=uf(i));let l=i&&!r&&!a?df(i,s):qu(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function Cf(e){return Xd(e).position===`static`}function wf(e,t){if(!Ld(e)||Xd(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Pd(e)===n&&(n=n.ownerDocument.body),n}function Tf(e,t){let n=Nd(e);if(Vd(e))return n;if(!Ld(e)){let t=Qd(e);for(;t&&!Yd(t);){if(Id(t)&&!Cf(t))return t;t=Qd(t)}return n}let r=wf(e,t);for(;r&&Bd(r)&&Cf(r);)r=wf(r,t);return r&&Yd(r)&&Cf(r)&&!Kd(r)?n:r||qd(e)||n}var Ef=async function(e){let t=this.getOffsetParent||Tf,n=this.getDimensions,r=await n(e.floating);return{reference:Sf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Df(e){return Xd(e).direction===`rtl`}var Of={convertOffsetParentRelativeRectToViewportRelativeRect:ff,getDocumentElement:Pd,getClippingRect:bf,getOffsetParent:Tf,getElementRects:Ef,getClientRects:pf,getDimensions:xf,getScale:af,isElement:Id,isRTL:Df};function kf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Af(e,t,n){let r=null,i,a=Pd(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Ku(d),h=Ku(a.clientWidth-(u+f)),g=Ku(a.clientHeight-(d+p)),_=Ku(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Wu(0,Uu(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!kf(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Nd(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function jf(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=rf(e),u=i||a?[...l?ef(l):[],...t?ef(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Af(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?lf(e):null;c&&g();function g(){let t=lf(e);h&&!kf(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Mf=Dd,Nf=Od,Pf=xd,Ff=Ad,If=wd,Lf=bd,Rf=kd,zf=(e,t,n)=>{let r=new Map,i=n??{},a={...Of,...i.platform,_c:r};return yd(e,t,{...i,platform:a})},Bf=typeof document<`u`?H.useLayoutEffect:function(){};function Vf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Vf(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Vf(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Hf(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Uf(e,t){let n=Hf(e);return Math.round(t*n)/n}function Wf(e){let t=H.useRef(e);return Bf(()=>{t.current=e}),t}function Gf(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=H.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=H.useState(r);Vf(f,r)||p(r);let[m,h]=H.useState(null),[g,_]=H.useState(null),v=H.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=H.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=H.useRef(null),C=H.useRef(null),w=H.useRef(u),T=c!=null,E=Wf(c),D=Wf(i),O=Wf(l),k=H.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),zf(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Vf(w.current,t)&&(w.current=t,Oi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Bf(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=H.useRef(!1);Bf(()=>(A.current=!0,()=>{A.current=!1}),[]),Bf(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=H.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=H.useMemo(()=>({reference:b,floating:x}),[b,x]),N=H.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Uf(M.floating,u.x),r=Uf(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Hf(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return H.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Kf=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Lf({element:r.current,padding:i}).fn(n):r?Lf({element:r,padding:i}).fn(n):{}}}},qf=(e,t)=>{let n=Mf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jf=(e,t)=>{let n=Nf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yf=(e,t)=>({fn:Rf(e).fn,options:[e,t]}),Xf=(e,t)=>{let n=Pf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zf=(e,t)=>{let n=Ff(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qf=(e,t)=>{let n=If(e);return{name:n.name,fn:n.fn,options:[e,t]}},$f=(e,t)=>{let n=Kf(e);return{name:n.name,fn:n.fn,options:[e,t]}},ep=`Arrow`,tp=H.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,U.jsx)(Cs.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,U.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});tp.displayName=ep;var np=tp,rp=`Popper`,[ip,ap]=Os(rp),[op,sp]=ip(rp),cp=e=>{let{__scopePopper:t,children:n}=e,[r,i]=H.useState(null),[a,o]=H.useState(void 0);return(0,U.jsx)(op,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};cp.displayName=rp;var lp=`PopperAnchor`,up=H.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=sp(lp,n),o=H.useRef(null),s=a.onAnchorChange,c=ls(t,H.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=H.useRef(null);H.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&bp(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,U.jsx)(Cs.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});up.displayName=lp;var dp=`PopperContent`,[fp,pp]=ip(dp),mp=H.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=sp(dp,n),[_,v]=H.useState(null),y=ls(t,v),[b,x]=H.useState(null),S=Bu(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(vp),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=Gf({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>jf(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[qf({mainAxis:i+w,alignmentAxis:o}),c&&Jf({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Yf():void 0,...k}),c&&Xf({...k}),Zf({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&$f({element:b,padding:s}),yp({arrowWidth:C,arrowHeight:w}),f&&Qf({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),F=g.setPlacementState;js(()=>(F(M),()=>{F(void 0)}),[M,F]);let[I,L]=bp(M),ee=Js(m);js(()=>{N&&ee?.()},[N,ee]);let te=P.arrow?.x,ne=P.arrow?.y,R=P.arrow?.centerOffset!==0,[z,B]=H.useState();return js(()=>{_&&B(window.getComputedStyle(_).zIndex)},[_]),(0,U.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:z,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,U.jsx)(fp,{scope:n,placedSide:I,placedAlign:L,onArrowChange:x,arrowX:te,arrowY:ne,shouldHideArrow:R,children:(0,U.jsx)(Cs.div,{"data-side":I,"data-align":L,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});mp.displayName=dp;var hp=`PopperArrow`,gp={top:`bottom`,right:`left`,bottom:`top`,left:`right`},_p=H.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=pp(hp,n),a=gp[i.placedSide];return(0,U.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,U.jsx)(np,{...r,ref:t,style:{...r.style,display:`block`}})})});_p.displayName=hp;function vp(e){return e!==null}var yp=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=bp(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function bp(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var xp=cp,Sp=up,Cp=mp,wp=_p,Tp=!1;function Ep(){let[e,t]=H.useState(Tp);return H.useEffect(()=>{Tp||(Tp=!0,t(!0))},[]),e}var Dp=H.useSyncExternalStore;function Op(){return()=>{}}function kp(){return Dp(Op,()=>!0,()=>!1)}var Ap=typeof Dp==`function`?kp:Ep,jp=`rovingFocusGroup.onEntryFocus`,Mp={bubbles:!1,cancelable:!0},Np=`RovingFocusGroup`,[Pp,Fp,Ip]=As(Np),[Lp,Rp]=Os(Np,[Ip]),[zp,Bp]=Lp(Np),Vp=H.forwardRef((e,t)=>(0,U.jsx)(Pp.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,U.jsx)(Pp.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,U.jsx)(Hp,{...e,ref:t})})}));Vp.displayName=Np;var Hp=H.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=H.useRef(null),p=ls(t,f),m=qs(a),[h,g]=Ns({prop:o,defaultProp:s??null,onChange:c,caller:Np}),[_,v]=H.useState(!1),y=Js(l),b=Fp(n),x=H.useRef(!1),[S,C]=H.useState(0);return H.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(jp,y),()=>e.removeEventListener(jp,y)},[y]),(0,U.jsx)(zp,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:H.useCallback(e=>g(e),[g]),onItemShiftTab:H.useCallback(()=>v(!0),[]),onFocusableItemAdd:H.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:H.useCallback(()=>C(e=>e-1),[]),children:(0,U.jsx)(Cs.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:K(e.onMouseDown,()=>{x.current=!0}),onFocus:K(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(jp,Mp);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Jp([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:K(e.onBlur,()=>v(!1))})})}),Up=`RovingFocusGroupItem`,Wp=H.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Gs(),l=a||c,u=Bp(Up,n),d=u.currentTabStopId===l,f=Fp(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=Ap();return js(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),H.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,U.jsx)(Pp.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,U.jsx)(Cs.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:K(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:K(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:K(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=qp(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Yp(n,r+1):n.slice(r+1)}setTimeout(()=>Jp(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Wp.displayName=Up;var Gp={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Kp(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function qp(e,t,n){let r=Kp(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Gp[r]}function Jp(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Yp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Xp=Vp,Zp=Wp,Qp=[`Enter`,` `],$p=[`ArrowDown`,`PageUp`,`Home`],em=[`ArrowUp`,`PageDown`,`End`],tm=[...$p,...em],nm={ltr:[...Qp,`ArrowRight`],rtl:[...Qp,`ArrowLeft`]},rm={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},im=`Menu`,[am,om,eee]=As(im),[sm,cm]=Os(im,[eee,ap,Rp]),lm=ap(),um=Rp(),[dm,fm]=sm(im),[tee,pm]=sm(im),mm=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=lm(t),[c,l]=H.useState(null),u=H.useRef(!1),d=Js(a),f=qs(i);return H.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),H.useEffect(()=>{if(!n)return;let e=()=>d(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,U.jsx)(xp,{...s,children:(0,U.jsx)(dm,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,U.jsx)(tee,{scope:t,onClose:H.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};mm.displayName=im;var hm=`MenuAnchor`,gm=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=lm(n);return(0,U.jsx)(Sp,{...i,...r,ref:t})});gm.displayName=hm;var _m=`MenuPortal`,[vm,ym]=sm(_m,{forceMount:void 0}),bm=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=fm(_m,t);return(0,U.jsx)(vm,{scope:t,forceMount:n,children:(0,U.jsx)(Ls,{present:n||a.open,children:(0,U.jsx)(Dc,{asChild:!0,container:i,children:r})})})};bm.displayName=_m;var xm=`MenuContent`,[Sm,Cm]=sm(xm),wm=H.forwardRef((e,t)=>{let n=ym(xm,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=fm(xm,e.__scopeMenu),o=pm(xm,e.__scopeMenu);return(0,U.jsx)(am.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(Ls,{present:r||a.open,children:(0,U.jsx)(am.Slot,{scope:e.__scopeMenu,children:o.modal?(0,U.jsx)(nee,{...i,ref:t}):(0,U.jsx)(ree,{...i,ref:t})})})})}),nee=H.forwardRef((e,t)=>{let n=fm(xm,e.__scopeMenu),r=H.useRef(null),i=ls(t,r);return H.useEffect(()=>{let e=r.current;if(e)return Yl(e)},[]),(0,U.jsx)(Tm,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:K(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ree=H.forwardRef((e,t)=>{let n=fm(xm,e.__scopeMenu);return(0,U.jsx)(Tm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),iee=us(`MenuContent.ScrollLock`),Tm=H.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=fm(xm,n),_=pm(xm,n),v=lm(n),y=um(n),b=om(n),[x,S]=H.useState(null),C=H.useRef(null),w=ls(t,C,g.onContentChange),T=H.useRef(0),E=H.useRef(``),D=H.useRef(0),O=H.useRef(null),k=H.useRef(`right`),A=H.useRef(0),j=m?Bl:H.Fragment,M=m?{as:iee,allowPinchZoom:!0}:void 0,N=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=lh(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};H.useEffect(()=>()=>window.clearTimeout(T.current),[]),Ac();let P=H.useCallback(e=>k.current===O.current?.side&&dh(e,O.current?.area),[]);return(0,U.jsx)(Sm,{scope:n,searchRef:E,onItemEnter:H.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:H.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:H.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:D,onPointerGraceIntentChange:H.useCallback(e=>{O.current=e},[]),children:(0,U.jsx)(j,{...M,children:(0,U.jsx)(mc,{asChild:!0,trapped:i,onMountAutoFocus:K(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,U.jsx)(tc,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,U.jsx)(Xp,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:K(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,U.jsx)(Cp,{role:`menu`,"aria-orientation":`vertical`,"data-state":ih(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:K(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&N(e.key));let i=C.current;if(e.target!==i||!tm.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);em.includes(e.key)&&a.reverse(),sh(a)}),onBlur:K(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:K(e.onPointerMove,fh(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});wm.displayName=xm;var Em=`MenuGroup`,Dm=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,U.jsx)(Cs.div,{role:`group`,...r,ref:t})});Dm.displayName=Em;var Om=`MenuLabel`,km=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,U.jsx)(Cs.div,{...r,ref:t})});km.displayName=Om;var Am=`MenuItem`,jm=`menu.itemSelect`,Mm=H.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=H.useRef(null),o=pm(Am,e.__scopeMenu),s=Cm(Am,e.__scopeMenu),c=ls(t,a),l=H.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(jm,{bubbles:!0,cancelable:!0});e.addEventListener(jm,e=>r?.(e),{once:!0}),ws(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,U.jsx)(Nm,{...i,ref:c,disabled:n,onClick:K(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:K(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:K(e.onKeyDown,e=>{n||e.target!==e.currentTarget||s.searchRef.current!==``&&e.key===` `||Qp.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});Mm.displayName=Am;var Nm=H.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=Cm(Am,n),s=um(n),c=H.useRef(null),l=ls(t,c),[u,d]=H.useState(!1),[f,p]=H.useState(``);return H.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,U.jsx)(am.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,U.jsx)(Zp,{asChild:!0,...s,focusable:!r,children:(0,U.jsx)(Cs.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:K(e.onPointerMove,fh(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:K(e.onPointerLeave,fh(e=>o.onItemLeave(e))),onFocus:K(e.onFocus,()=>d(!0)),onBlur:K(e.onBlur,()=>d(!1))})})})}),Pm=`MenuCheckboxItem`,Fm=H.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,U.jsx)(Um,{scope:e.__scopeMenu,checked:n,children:(0,U.jsx)(Mm,{role:`menuitemcheckbox`,"aria-checked":ah(n)?`mixed`:n,...i,ref:t,"data-state":oh(n),onSelect:K(i.onSelect,()=>r?.(ah(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Fm.displayName=Pm;var Im=`MenuRadioGroup`,[Lm,Rm]=sm(Im,{value:void 0,onValueChange:()=>{}}),zm=H.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Js(r);return(0,U.jsx)(Lm,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,U.jsx)(Dm,{...i,ref:t})})});zm.displayName=Im;var Bm=`MenuRadioItem`,Vm=H.forwardRef((e,t)=>{let{value:n,...r}=e,i=Rm(Bm,e.__scopeMenu),a=n===i.value;return(0,U.jsx)(Um,{scope:e.__scopeMenu,checked:a,children:(0,U.jsx)(Mm,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":oh(a),onSelect:K(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Vm.displayName=Bm;var Hm=`MenuItemIndicator`,[Um,Wm]=sm(Hm,{checked:!1}),Gm=H.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Wm(Hm,n);return(0,U.jsx)(Ls,{present:r||ah(a.checked)||a.checked===!0,children:(0,U.jsx)(Cs.span,{...i,ref:t,"data-state":oh(a.checked)})})});Gm.displayName=Hm;var Km=`MenuSeparator`,qm=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,U.jsx)(Cs.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});qm.displayName=Km;var Jm=`MenuArrow`,Ym=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=lm(n);return(0,U.jsx)(wp,{...i,...r,ref:t})});Ym.displayName=Jm;var Xm=`MenuSub`,[Zm,Qm]=sm(Xm),$m=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=fm(Xm,t),o=lm(t),[s,c]=H.useState(null),[l,u]=H.useState(null),d=Js(i);return H.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,U.jsx)(xp,{...o,children:(0,U.jsx)(dm,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,U.jsx)(Zm,{scope:t,contentId:Gs(),triggerId:Gs(),trigger:s,onTriggerChange:c,children:n})})})};$m.displayName=Xm;var eh=`MenuSubTrigger`,th=H.forwardRef((e,t)=>{let n=fm(eh,e.__scopeMenu),r=pm(eh,e.__scopeMenu),i=Qm(eh,e.__scopeMenu),a=Cm(eh,e.__scopeMenu),o=H.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=H.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);H.useEffect(()=>u,[u]),H.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]);let d=ls(t,i.onTriggerChange);return(0,U.jsx)(gm,{asChild:!0,...l,children:(0,U.jsx)(Nm,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":ih(n.open),...e,ref:d,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:K(e.onPointerMove,fh(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:K(e.onPointerLeave,fh(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:K(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||a.searchRef.current!==``&&t.key===` `||nm[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});th.displayName=eh;var nh=`MenuSubContent`,rh=H.forwardRef((e,t)=>{let n=ym(xm,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=fm(xm,e.__scopeMenu),s=pm(xm,e.__scopeMenu),c=Qm(nh,e.__scopeMenu),l=H.useRef(null),u=ls(t,l);return(0,U.jsx)(am.Provider,{scope:e.__scopeMenu,children:(0,U.jsx)(Ls,{present:r||o.open,children:(0,U.jsx)(am.Slot,{scope:e.__scopeMenu,children:(0,U.jsx)(Tm,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:K(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:K(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:K(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=rm[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});rh.displayName=nh;function ih(e){return e?`open`:`closed`}function ah(e){return e===`indeterminate`}function oh(e){return ah(e)?`indeterminate`:e?`checked`:`unchecked`}function sh(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ch(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function lh(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ch(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function uh(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function dh(e,t){return t?uh({x:e.clientX,y:e.clientY},t):!1}function fh(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ph=mm,mh=gm,hh=bm,gh=wm,_h=Dm,vh=km,aee=Mm,oee=Fm,see=zm,cee=Vm,lee=Gm,uee=qm,dee=Ym,fee=$m,pee=th,mee=rh,yh=`DropdownMenu`,[hee,gee]=Os(yh,[cm]),bh=cm(),[_ee,xh]=hee(yh),Sh=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=bh(t),l=H.useRef(null),[u,d]=Ns({prop:i,defaultProp:a??!1,onChange:o,caller:yh});return(0,U.jsx)(_ee,{scope:t,triggerId:Gs(),triggerRef:l,contentId:Gs(),open:u,onOpenChange:d,onOpenToggle:H.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,U.jsx)(ph,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Sh.displayName=yh;var Ch=`DropdownMenuTrigger`,wh=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=xh(Ch,n),o=bh(n),s=ls(t,a.triggerRef);return(0,U.jsx)(mh,{asChild:!0,...o,children:(0,U.jsx)(Cs.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:K(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:K(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});wh.displayName=Ch;var Th=`DropdownMenuPortal`,Eh=e=>{let{__scopeDropdownMenu:t,...n}=e,r=bh(t);return(0,U.jsx)(hh,{...r,...n})};Eh.displayName=Th;var Dh=`DropdownMenuContent`,Oh=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=xh(Dh,n),a=bh(n),o=H.useRef(!1);return(0,U.jsx)(gh,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:K(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:K(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Oh.displayName=Dh;var kh=`DropdownMenuGroup`,Ah=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=bh(n);return(0,U.jsx)(_h,{...i,...r,ref:t})});Ah.displayName=kh;var jh=`DropdownMenuLabel`,Mh=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=bh(n);return(0,U.jsx)(vh,{...i,...r,ref:t})});Mh.displayName=jh;var Nh=`DropdownMenuItem`,Ph=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=bh(n);return(0,U.jsx)(aee,{...i,...r,ref:t})});Ph.displayName=Nh;var Fh=`DropdownMenuCheckboxItem`,Ih=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=bh(n);return(0,U.jsx)(oee,{...i,...r,ref:t})});Ih.displayName=Fh;var Lh=`DropdownMenuRadioGroup`,Rh=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=bh(n);return(0,U.jsx)(see,{...i,...r,ref:t})});Rh.displayName=Lh;var zh=`DropdownMenuRadioItem`,Bh=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=bh(n);return(0,U.jsx)(cee,{...i,...r,ref:t})});Bh.displayName=zh;var Vh=`DropdownMenuItemIndicator`,Hh=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=bh(n);return(0,U.jsx)(lee,{...i,...r,ref:t})});Hh.displayName=Vh;var Uh=`DropdownMenuSeparator`,Wh=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=bh(n);return(0,U.jsx)(uee,{...i,...r,ref:t})});Wh.displayName=Uh;var Gh=`DropdownMenuArrow`,Kh=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=bh(n);return(0,U.jsx)(dee,{...i,...r,ref:t})});Kh.displayName=Gh;var qh=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=bh(t),[s,c]=Ns({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,U.jsx)(fee,{...o,open:s,onOpenChange:c,children:n})},Jh=`DropdownMenuSubTrigger`,Yh=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=bh(n);return(0,U.jsx)(pee,{...i,...r,ref:t})});Yh.displayName=Jh;var Xh=`DropdownMenuSubContent`,Zh=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=bh(n);return(0,U.jsx)(mee,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Zh.displayName=Xh;var Qh=Sh,$h=wh,eg=Eh,tg=Oh,ng=Mh,rg=Ph,ig=Wh,ag=qh,og=Yh,sg=Zh,cg=`Label`,lg=H.forwardRef((e,t)=>(0,U.jsx)(Cs.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));lg.displayName=cg;var ug=lg;function dg(e,[t,n]){return Math.min(n,Math.max(t,e))}function fg(e,t){return H.useReducer((e,n)=>t[e][n]??e,e)}var pg=`ScrollArea`,[mg,vee]=Os(pg),[hg,gg]=mg(pg),_g=H.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=H.useState(null),[l,u]=H.useState(null),[d,f]=H.useState(null),[p,m]=H.useState(null),[h,g]=H.useState(null),[_,v]=H.useState(0),[y,b]=H.useState(0),[x,S]=H.useState(!1),[C,w]=H.useState(!1),T=ls(t,c),E=qs(i);return(0,U.jsx)(hg,{scope:n,type:r,dir:E,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:x,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:C,onScrollbarYEnabledChange:w,onCornerWidthChange:v,onCornerHeightChange:b,children:(0,U.jsx)(Cs.div,{dir:E,...o,ref:T,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})});_g.displayName=pg;var vg=`ScrollAreaViewport`,yg=H.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=gg(vg,n),s=ls(t,H.useRef(null),o.onViewportChange);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(bg,{nonce:i}),(0,U.jsx)(Cs.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,U.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});yg.displayName=vg;var bg=H.memo(({nonce:e})=>(0,U.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e}),(e,t)=>e.nonce===t.nonce),xg=`ScrollAreaScrollbar`,Sg=H.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=gg(xg,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return H.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,U.jsx)(Cg,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,U.jsx)(wg,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,U.jsx)(Tg,{...r,ref:t,forceMount:n}):i.type===`always`?(0,U.jsx)(Eg,{...r,ref:t,"data-state":`visible`}):null});Sg.displayName=xg;var Cg=H.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=gg(xg,e.__scopeScrollArea),[a,o]=H.useState(!1);return H.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,U.jsx)(Ls,{present:n||a,children:(0,U.jsx)(Tg,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),wg=H.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=gg(xg,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Wg(()=>c(`SCROLL_END`),100),[s,c]=fg(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return H.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),H.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,U.jsx)(Ls,{present:n||s!==`hidden`,children:(0,U.jsx)(Eg,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:K(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:K(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),Tg=H.forwardRef((e,t)=>{let n=gg(xg,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=H.useState(!1),s=e.orientation===`horizontal`,c=Wg(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Gg(n.viewport,c),Gg(n.content,c),(0,U.jsx)(Ls,{present:r||a,children:(0,U.jsx)(Eg,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),Eg=H.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=gg(xg,e.__scopeScrollArea),a=H.useRef(null),o=H.useRef(0),[s,c]=H.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=zg(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return yee(e,o.current,s,t)}return n===`horizontal`?(0,U.jsx)(Dg,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Vg(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,U.jsx)(Og,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Vg(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),Dg=H.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=gg(xg,e.__scopeScrollArea),[o,s]=H.useState(),c=H.useRef(null),l=ls(t,c,a.onScrollbarXChange);return H.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,U.jsx)(jg,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":Bg(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Ug(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Rg(o.paddingLeft),paddingEnd:Rg(o.paddingRight)}})}})}),Og=H.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=gg(xg,e.__scopeScrollArea),[o,s]=H.useState(),c=H.useRef(null),l=ls(t,c,a.onScrollbarYChange);return H.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,U.jsx)(jg,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":Bg(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Ug(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Rg(o.paddingTop),paddingEnd:Rg(o.paddingBottom)}})}})}),[kg,Ag]=mg(xg),jg=H.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=gg(xg,n),[m,h]=H.useState(null),g=ls(t,h),_=H.useRef(null),v=H.useRef(``),y=p.viewport,b=r.content-r.viewport,x=Js(u),S=Js(c),C=Wg(d,10);function w(e){_.current&&l({x:e.clientX-_.current.left,y:e.clientY-_.current.top})}return H.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&x(e,b)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b,x]),H.useEffect(S,[r,S]),Gg(m,C),Gg(p.content,C),(0,U.jsx)(kg,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:Js(a),onThumbPointerUp:Js(o),onThumbPositionChange:S,onThumbPointerDown:Js(s),children:(0,U.jsx)(Cs.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:K(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),w(e))}),onPointerMove:K(e.onPointerMove,w),onPointerUp:K(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})}),Mg=`ScrollAreaThumb`,Ng=H.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Ag(Mg,e.__scopeScrollArea);return(0,U.jsx)(Ls,{present:n||i.hasThumb,children:(0,U.jsx)(Pg,{ref:t,...r})})}),Pg=H.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=gg(Mg,n),o=Ag(Mg,n),{onThumbPositionChange:s}=o,c=ls(t,o.onThumbChange),l=H.useRef(void 0),u=Wg(()=>{l.current&&=(l.current(),void 0)},100);return H.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{u(),l.current||(l.current=bee(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,U.jsx)(Cs.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:K(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:K(e.onPointerUp,o.onThumbPointerUp)})});Ng.displayName=Mg;var Fg=`ScrollAreaCorner`,Ig=H.forwardRef((e,t)=>{let n=gg(Fg,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,U.jsx)(Lg,{...e,ref:t}):null});Ig.displayName=Fg;var Lg=H.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=gg(Fg,n),[a,o]=H.useState(0),[s,c]=H.useState(0),l=!!(a&&s),{onCornerWidthChange:u,onCornerHeightChange:d}=i;return Gg(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Gg(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),H.useEffect(()=>()=>{u(0),d(0)},[u,d]),l?(0,U.jsx)(Cs.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function Rg(e){return e?parseInt(e,10):0}function zg(e,t){let n=e/t;return isNaN(n)?0:n}function Bg(e){let t=zg(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function yee(e,t,n,r=`ltr`){let i=Bg(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Hg([c,l],d)(e)}function Vg(e,t,n=`ltr`){let r=Bg(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=dg(e,n===`ltr`?[0,o]:[o*-1,0]);return Hg([0,o],[0,s])(c)}function Hg(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Ug(e,t){return e>0&&e<t}var bee=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function Wg(e,t){let n=Js(e),r=H.useRef(0);return H.useEffect(()=>()=>window.clearTimeout(r.current),[]),H.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Gg(e,t){let n=Js(t);js(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var xee=_g,See=yg,Cee=Ig,wee=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Tee=[` `,`Enter`],Kg=`Select`,[qg,Jg,Eee]=As(Kg),[Yg,Dee]=Os(Kg,[Eee,ap]),Xg=ap(),[Oee,Zg]=Yg(Kg),[kee,Aee]=Yg(Kg),jee=`SelectProvider`;function Qg(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=Xg(t),[_,v]=H.useState(null),[y,b]=H.useState(null),[x,S]=H.useState(!1),C=qs(l),[w,T]=Ns({prop:r,defaultProp:i??!1,onChange:a,caller:Kg}),[E,D]=Ns({prop:o,defaultProp:s,onChange:c,caller:Kg}),O=H.useRef(null),k=H.useRef(E);H.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>D(k.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,D]);let A=_?!!m||!!_.closest(`form`):!0,[j,M]=H.useState(new Set),N=Gs(),P=Array.from(j).map(e=>e.props.value).join(`;`),F=H.useCallback(e=>{M(t=>new Set(t).add(e))},[]),I=H.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),L={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:N,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:j,nativeSelectKey:P,isFormControl:A};return(0,U.jsx)(xp,{...g,children:(0,U.jsx)(Oee,{scope:t,...L,children:(0,U.jsx)(qg.Provider,{scope:t,children:(0,U.jsx)(kee,{scope:t,onNativeOptionAdd:F,onNativeOptionRemove:I,children:Q_(h)?h(L):n})})})})}Qg.displayName=jee;var $g=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,U.jsx)(Qg,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,U.jsxs)(U.Fragment,{children:[n,e?(0,U.jsx)(Z_,{__scopeSelect:t}):null]})})};$g.displayName=Kg;var e_=`SelectTrigger`,t_=H.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Xg(n),o=Zg(e_,n),s=o.disabled||r,c=ls(t,o.onTriggerChange),l=Jg(n),u=H.useRef(`touch`),[d,f,p]=ev(e=>{let t=l().filter(e=>!e.disabled),n=tv(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,U.jsx)(Sp,{asChild:!0,...a,children:(0,U.jsx)(Cs.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$_(o.value)?``:void 0,...i,ref:c,onClick:K(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:K(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:K(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&wee.includes(e.key)&&(m(),e.preventDefault())})})})});t_.displayName=e_;var n_=`SelectValue`,r_=H.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=Zg(n_,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=ls(t,c.onValueNodeChange);js(()=>{l(u)},[l,u]);let f=$_(c.value);return(0,U.jsx)(Cs.span,{...s,asChild:f?!1:s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,U.jsx)(H.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});r_.displayName=n_;var i_=`SelectIcon`,a_=H.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,U.jsx)(Cs.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});a_.displayName=i_;var o_=`SelectPortal`,[s_,c_]=Yg(o_,{forceMount:void 0}),l_=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,U.jsx)(s_,{scope:e.__scopeSelect,forceMount:n,children:(0,U.jsx)(Dc,{asChild:!0,...r})})};l_.displayName=o_;var u_=`SelectContent`,d_=H.forwardRef((e,t)=>{let n=c_(u_,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=Zg(u_,e.__scopeSelect),[o,s]=H.useState();return js(()=>{s(new DocumentFragment)},[]),(0,U.jsx)(Ls,{present:r||a.open,children:({present:e})=>e?(0,U.jsx)(v_,{...i,ref:t}):(0,U.jsx)(f_,{...i,fragment:o})})});d_.displayName=u_;var f_=H.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Oi.createPortal((0,U.jsx)(m_,{scope:n,children:(0,U.jsx)(qg.Slot,{scope:n,children:(0,U.jsx)(`div`,{ref:t,children:r})})}),i):null});f_.displayName=`SelectContentFragment`;var p_=10,[m_,h_]=Yg(u_),g_=`SelectContentImpl`,__=us(`SelectContent.RemoveScroll`),v_=H.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=Zg(u_,n),[y,b]=H.useState(null),[x,S]=H.useState(null),C=ls(t,b),[w,T]=H.useState(null),[E,D]=H.useState(null),O=Jg(n),[k,A]=H.useState(!1),j=H.useRef(!1);H.useEffect(()=>{if(y)return Yl(y)},[y]),Ac();let M=H.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),N=H.useCallback(()=>M([w,y]),[M,w,y]);H.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;H.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),H.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[I,L]=ev(e=>{let t=O().filter(e=>!e.disabled),n=tv(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),ee=H.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),te=H.useCallback(()=>y?.focus(),[y]),ne=H.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),R=r===`popper`?S_:b_,z=R===S_?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,U.jsx)(m_,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ee,selectedItem:w,onItemLeave:te,itemTextRefCallback:ne,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:I,children:(0,U.jsx)(Bl,{as:__,allowPinchZoom:!0,children:(0,U.jsx)(mc,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:K(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,U.jsx)(tc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,U.jsx)(R,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...z,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:K(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&L(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})});v_.displayName=g_;var y_=`SelectItemAlignedPosition`,b_=H.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Zg(u_,n),o=h_(u_,n),[s,c]=H.useState(null),[l,u]=H.useState(null),d=ls(t,u),f=Jg(n),p=H.useRef(!1),m=H.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=H.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-p_,d=dg(a,[p_,Math.max(p_,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-p_,d=dg(a,[p_,Math.max(p_,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-p_*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-p_,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${p_}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);js(()=>y(),[y]);let[b,x]=H.useState();return js(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,U.jsx)(C_,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:H.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,U.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,U.jsx)(Cs.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});b_.displayName=y_;var x_=`SelectPopperPosition`,S_=H.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=p_,...a}=e,o=Xg(n);return(0,U.jsx)(Cp,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});S_.displayName=x_;var[C_,w_]=Yg(u_,{}),T_=`SelectViewport`,E_=H.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=h_(T_,n),o=w_(T_,n),s=ls(t,a.onViewportChange),c=H.useRef(0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,U.jsx)(qg.Slot,{scope:n,children:(0,U.jsx)(Cs.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:K(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-p_*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});E_.displayName=T_;var D_=`SelectGroup`,[O_,k_]=Yg(D_),A_=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Gs();return(0,U.jsx)(O_,{scope:n,id:i,children:(0,U.jsx)(Cs.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});A_.displayName=D_;var j_=`SelectLabel`,M_=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=k_(j_,n);return(0,U.jsx)(Cs.div,{id:i.id,...r,ref:t})});M_.displayName=j_;var N_=`SelectItem`,[P_,F_]=Yg(N_),I_=H.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Zg(N_,n),c=h_(N_,n),l=s.value===r,[u,d]=H.useState(a??``),[f,p]=H.useState(!1),m=ls(t,Js(e=>c.itemRefCallback?.(e,r,i))),h=Gs(),g=H.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,U.jsx)(P_,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:H.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,U.jsx)(qg.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,U.jsx)(Cs.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:K(o.onFocus,()=>p(!0)),onBlur:K(o.onBlur,()=>p(!1)),onClick:K(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:K(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:K(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:K(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:K(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:K(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(Tee.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});I_.displayName=N_;var L_=`SelectItemText`,R_=H.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Zg(L_,n),s=h_(L_,n),c=F_(L_,n),l=Aee(L_,n),[u,d]=H.useState(null),f=Js(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=ls(t,d,c.onItemTextChange,f),m=u?.textContent,h=H.useMemo(()=>(0,U.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return js(()=>(g(h),()=>_(h)),[g,_,h]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Cs.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$_(o.value)?Oi.createPortal(a.children,o.valueNode):null]})});R_.displayName=L_;var z_=`SelectItemIndicator`,B_=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return F_(z_,n).isSelected?(0,U.jsx)(Cs.span,{"aria-hidden":!0,...r,ref:t}):null});B_.displayName=z_;var V_=`SelectScrollUpButton`,H_=H.forwardRef((e,t)=>{let n=h_(V_,e.__scopeSelect),r=w_(V_,e.__scopeSelect),[i,a]=H.useState(!1),o=ls(t,r.onScrollButtonChange);return js(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(G_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});H_.displayName=V_;var U_=`SelectScrollDownButton`,W_=H.forwardRef((e,t)=>{let n=h_(U_,e.__scopeSelect),r=w_(U_,e.__scopeSelect),[i,a]=H.useState(!1),o=ls(t,r.onScrollButtonChange);return js(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(G_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});W_.displayName=U_;var G_=H.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=h_(`SelectScrollButton`,n),o=H.useRef(null),s=Jg(n),c=H.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return H.useEffect(()=>()=>c(),[c]),js(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,U.jsx)(Cs.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:K(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:K(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:K(i.onPointerLeave,()=>{c()})})}),K_=`SelectSeparator`,q_=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,U.jsx)(Cs.div,{"aria-hidden":!0,...r,ref:t})});q_.displayName=K_;var J_=`SelectArrow`,Y_=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Xg(n);return h_(J_,n).position===`popper`?(0,U.jsx)(wp,{...i,...r,ref:t}):null});Y_.displayName=J_;var X_=`SelectBubbleInput`,Z_=H.forwardRef(({__scopeSelect:e,...t},n)=>{let r=Zg(X_,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=H.useRef(null),m=ls(n,p),h=i??``,g=zu(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return H.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,U.jsxs)(Cs.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...Ts,...t.style},ref:m,defaultValue:h,children:[$_(i)&&!_?(0,U.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});Z_.displayName=X_;function Q_(e){return typeof e==`function`}function $_(e){return e===``||e===void 0}function ev(e){let t=Js(e),n=H.useRef(``),r=H.useRef(0),i=H.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=H.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return H.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function tv(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=nv(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function nv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var rv=`Separator`,iv=`horizontal`,av=[`horizontal`,`vertical`],ov=H.forwardRef((e,t)=>{let{decorative:n,orientation:r=iv,...i}=e,a=sv(r)?r:iv,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,U.jsx)(Cs.div,{"data-orientation":a,...o,...i,ref:t})});ov.displayName=rv;function sv(e){return av.includes(e)}var cv=ov,lv=`Tabs`,[uv,Mee]=Os(lv,[Rp]),dv=Rp(),[fv,pv]=uv(lv),mv=H.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=qs(s),[d,f]=Ns({prop:r,onChange:i,defaultProp:a??``,caller:lv});return(0,U.jsx)(fv,{scope:n,baseId:Gs(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,U.jsx)(Cs.div,{dir:u,"data-orientation":o,...l,ref:t})})});mv.displayName=lv;var hv=`TabsList`,gv=H.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=pv(hv,n),o=dv(n);return(0,U.jsx)(Xp,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,U.jsx)(Cs.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});gv.displayName=hv;var _v=`TabsTrigger`,vv=H.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=pv(_v,n),s=dv(n),c=xv(o.baseId,r),l=Sv(o.baseId,r),u=r===o.value;return(0,U.jsx)(Zp,{asChild:!0,...s,focusable:!i,active:u,children:(0,U.jsx)(Cs.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:K(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:K(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:K(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});vv.displayName=_v;var yv=`TabsContent`,bv=H.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=pv(yv,n),c=xv(s.baseId,r),l=Sv(s.baseId,r),u=r===s.value,d=H.useRef(u);return H.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,U.jsx)(Ls,{present:i||u,children:({present:n})=>(0,U.jsx)(Cs.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});bv.displayName=yv;function xv(e,t){return`${e}-trigger-${t}`}function Sv(e,t){return`${e}-content-${t}`}var Cv=mv,wv=gv,Tv=vv,Ev=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Dv=(e,t)=>({classGroupId:e,validator:t}),Ov=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),kv=`-`,Av=[],jv=`arbitrary..`,Mv=e=>{let t=Fv(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Pv(e);let n=e.split(kv);return Nv(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ev(i,t):t:i||Av}return n[e]||Av}}},Nv=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Nv(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(kv):e.slice(t).join(kv),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Pv=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?jv+r:void 0})(),Fv=e=>{let{theme:t,classGroups:n}=e;return Iv(n,t)},Iv=(e,t)=>{let n=Ov();for(let r in e){let i=e[r];Lv(i,n,r,t)}return n},Lv=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Rv(i,t,n,r)}},Rv=(e,t,n,r)=>{if(typeof e==`string`){zv(e,t,n);return}if(typeof e==`function`){Bv(e,t,n,r);return}Vv(e,t,n,r)},zv=(e,t,n)=>{let r=e===``?t:Hv(t,e);r.classGroupId=n},Bv=(e,t,n,r)=>{if(Uv(e)){Lv(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Dv(n,e))},Vv=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Lv(o,Hv(t,a),n,r)}},Hv=(e,t)=>{let n=e,r=t.split(kv),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Ov(),n.nextPart.set(t,i)),n=i}return n},Uv=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Wv=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Gv=`!`,Kv=`:`,qv=[],Jv=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Yv=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Kv){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Gv)?(c=s.slice(0,-1),l=!0):s.startsWith(Gv)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Jv(t,l,c,u)};if(t){let e=t+Kv,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Jv(qv,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Xv=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Zv=e=>({cache:Wv(e.cacheSize),parseClassName:Yv(e),sortModifiers:Xv(e),postfixLookupClassGroupIds:Qv(e),...Mv(e)}),Qv=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},$v=/\s+/,ey=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split($v),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Gv:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},ty=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=ny(n))&&(i&&(i+=` `),i+=r);return i},ny=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=ny(e[r]))&&(n&&(n+=` `),n+=t);return n},ry=(e,...t)=>{let n,r,i,a,o=o=>(n=Zv(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=ey(e,n);return i(e,a),a};return a=o,(...e)=>a(ty(...e))},iy=[],ay=e=>{let t=t=>t[e]||iy;return t.isThemeGetter=!0,t},oy=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,sy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,cy=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ly=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uy=/\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$/,dy=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fy=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,py=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,my=e=>cy.test(e),hy=e=>!!e&&!Number.isNaN(Number(e)),gy=e=>!!e&&Number.isInteger(Number(e)),_y=e=>e.endsWith(`%`)&&hy(e.slice(0,-1)),vy=e=>ly.test(e),yy=()=>!0,by=e=>uy.test(e)&&!dy.test(e),xy=()=>!1,Sy=e=>fy.test(e),Cy=e=>py.test(e),wy=e=>!q(e)&&!J(e),Ty=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Ey=e=>Py(e,Ry,xy),q=e=>oy.test(e),Dy=e=>Py(e,zy,by),Oy=e=>Py(e,Bee,hy),Nee=e=>Py(e,Vy,yy),Pee=e=>Py(e,By,xy),ky=e=>Py(e,Iy,xy),Fee=e=>Py(e,Ly,Cy),Ay=e=>Py(e,Hy,Sy),J=e=>sy.test(e),jy=e=>Fy(e,zy),Iee=e=>Fy(e,By),My=e=>Fy(e,Iy),Lee=e=>Fy(e,Ry),Ree=e=>Fy(e,Ly),Ny=e=>Fy(e,Hy,!0),zee=e=>Fy(e,Vy,!0),Py=(e,t,n)=>{let r=oy.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Fy=(e,t,n=!1)=>{let r=sy.exec(e);return r?r[1]?t(r[1]):n:!1},Iy=e=>e===`position`||e===`percentage`,Ly=e=>e===`image`||e===`url`,Ry=e=>e===`length`||e===`size`||e===`bg-size`,zy=e=>e===`length`,Bee=e=>e===`number`,By=e=>e===`family-name`,Vy=e=>e===`number`||e===`weight`,Hy=e=>e===`shadow`,Vee=ry(()=>{let e=ay(`color`),t=ay(`font`),n=ay(`text`),r=ay(`font-weight`),i=ay(`tracking`),a=ay(`leading`),o=ay(`breakpoint`),s=ay(`container`),c=ay(`spacing`),l=ay(`radius`),u=ay(`shadow`),d=ay(`inset-shadow`),f=ay(`text-shadow`),p=ay(`drop-shadow`),m=ay(`blur`),h=ay(`perspective`),g=ay(`aspect`),_=ay(`ease`),v=ay(`animate`),y=()=>[`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`],x=()=>[...b(),J,q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[J,q,c],T=()=>[my,`full`,`auto`,...w()],E=()=>[gy,`none`,`subgrid`,J,q],D=()=>[`auto`,{span:[`full`,gy,J,q]},gy,J,q],O=()=>[gy,`auto`,J,q],k=()=>[`auto`,`min`,`max`,`fr`,J,q],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[my,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[my,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[my,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,J,q],L=()=>[...b(),My,ky,{position:[J,q]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],te=()=>[`auto`,`cover`,`contain`,Lee,Ey,{size:[J,q]}],ne=()=>[_y,jy,Dy],R=()=>[``,`none`,`full`,l,J,q],z=()=>[``,hy,jy,Dy],B=()=>[`solid`,`dashed`,`dotted`,`double`],re=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],V=()=>[hy,_y,My,ky],ie=()=>[``,`none`,m,J,q],ae=()=>[`none`,hy,J,q],oe=()=>[`none`,hy,J,q],se=()=>[hy,J,q],ce=()=>[my,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[vy],breakpoint:[vy],color:[yy],container:[vy],"drop-shadow":[vy],ease:[`in`,`out`,`in-out`],font:[wy],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[vy],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[vy],shadow:[vy],spacing:[`px`,hy],text:[vy],"text-shadow":[vy],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,my,q,J,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,J,q]}],"container-named":[Ty],columns:[{columns:[hy,q,J,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[gy,`auto`,J,q]}],basis:[{basis:[my,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[hy,my,`auto`,`initial`,`none`,q]}],grow:[{grow:[``,hy,J,q]}],shrink:[{shrink:[``,hy,J,q]}],order:[{order:[gy,`first`,`last`,`none`,J,q]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,jy,Dy]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,zee,Nee]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,_y,q]}],"font-family":[{font:[Iee,Pee,t]}],"font-features":[{"font-features":[q]}],"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:[i,J,q]}],"line-clamp":[{"line-clamp":[hy,`none`,J,Oy]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,J,q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,J,q]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[hy,`from-font`,`auto`,J,Dy]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[hy,`auto`,J,q]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[gy,J,q]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,J,q]}],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`,J,q]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:te()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},gy,J,q],radial:[``,J,q],conic:[gy,J,q]},Ree,Fee]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-bs":[{"border-bs":z()}],"border-w-be":[{"border-be":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[hy,J,q]}],"outline-w":[{outline:[``,hy,jy,Dy]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Ny,Ay]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Ny,Ay]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[hy,Dy]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Ny,Ay]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[hy,J,q]}],"mix-blend":[{"mix-blend":[...re(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":re()}],"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":[hy]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[J,q]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":[hy]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,J,q]}],filter:[{filter:[``,`none`,J,q]}],blur:[{blur:ie()}],brightness:[{brightness:[hy,J,q]}],contrast:[{contrast:[hy,J,q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Ny,Ay]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,hy,J,q]}],"hue-rotate":[{"hue-rotate":[hy,J,q]}],invert:[{invert:[``,hy,J,q]}],saturate:[{saturate:[hy,J,q]}],sepia:[{sepia:[``,hy,J,q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,J,q]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[hy,J,q]}],"backdrop-contrast":[{"backdrop-contrast":[hy,J,q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,hy,J,q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[hy,J,q]}],"backdrop-invert":[{"backdrop-invert":[``,hy,J,q]}],"backdrop-opacity":[{"backdrop-opacity":[hy,J,q]}],"backdrop-saturate":[{"backdrop-saturate":[hy,J,q]}],"backdrop-sepia":[{"backdrop-sepia":[``,hy,J,q]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,J,q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[hy,`initial`,J,q]}],ease:[{ease:[`linear`,`initial`,_,J,q]}],delay:[{delay:[hy,J,q]}],animate:[{animate:[`none`,v,J,q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,J,q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":[`scale-3d`],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[J,q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ce()}],"translate-x":[{"translate-x":ce()}],"translate-y":[{"translate-y":ce()}],"translate-z":[{"translate-z":ce()}],"translate-none":[`translate-none`],zoom:[{zoom:[gy,J,q]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"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`,J,q]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"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`,J,q]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[hy,jy,Dy,Oy]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`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`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`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-bs`,`border-w-be`,`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-bs`,`border-color-be`,`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-mbs`,`scroll-mbe`,`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-pbs`,`scroll-pbe`,`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`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Y(...e){return Vee(ns(e))}var Uy=as(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function Wy({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,U.jsx)(n?ds:`span`,{"data-slot":`badge`,"data-variant":t,className:Y(Uy({variant:t}),e),...r})}var Hee=as(`inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40`,outline:`border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,xs:`h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5`,lg:`h-10 rounded-md px-6 has-[>svg]:px-4`,icon:`size-9`,"icon-xs":`size-6 rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function X({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,U.jsx)(r?ds:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:Y(Hee({variant:t,size:n,className:e})),...i})}var Gy=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Uee=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Wee=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Ky=e=>{let t=Wee(e);return t.charAt(0).toUpperCase()+t.slice(1)},qy={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`},Gee=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Kee=(0,H.createContext)({}),qee=()=>(0,H.useContext)(Kee),Jee=(0,H.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=qee()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,H.createElement)(`svg`,{ref:c,...qy,width:t??l??qy.width,height:t??l??qy.height,stroke:e??f,strokeWidth:m,className:Gy(`lucide`,p,i),...!a&&!Gee(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,H.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Jy=(e,t)=>{let n=(0,H.forwardRef)(({className:n,...r},i)=>(0,H.createElement)(Jee,{ref:i,iconNode:t,className:Gy(`lucide-${Uee(Ky(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Ky(e),n},Yy=Jy(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Yee=Jy(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Xy=Jy(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Zy=Jy(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Qy=Jy(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),$y=Jy(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Xee=Jy(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Zee=Jy(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qee=Jy(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),$ee=Jy(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),ete=Jy(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),tte=Jy(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),eb=Jy(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),nte=Jy(`ellipsis-vertical`,[[`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`}]]),rte=Jy(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),ite=Jy(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),ate=Jy(`file-plus`,[[`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:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),tb=Jy(`file-text`,[[`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`}]]),nb=Jy(`folder-kanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),ote=Jy(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),ste=Jy(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),cte=Jy(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),lte=Jy(`heading-1`,[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`m17 12 3-2v8`,key:`1hhhft`}]]),ute=Jy(`heading-2`,[[`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`}]]),dte=Jy(`heading-3`,[[`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`}]]),rb=Jy(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),ib=Jy(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ab=Jy(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),ob=Jy(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),sb=Jy(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),cb=Jy(`list-ordered`,[[`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`}]]),lb=Jy(`list`,[[`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`}]]),ub=Jy(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),db=Jy(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),fb=Jy(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),pb=Jy(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),mb=Jy(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),hb=Jy(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),gb=Jy(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),_b=Jy(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),vb=Jy(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),yb=Jy(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),bb=Jy(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),xb=Jy(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Sb=Jy(`quote`,[[`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`}]]),Cb=Jy(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),wb=Jy(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Tb=Jy(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),Eb=Jy(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Db=Jy(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),Ob=Jy(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),kb=Jy(`table`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),Ab=Jy(`target`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),jb=Jy(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),Mb=Jy(`trash-2`,[[`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`}]]),Nb=Jy(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Pb=Jy(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),Fb=Jy(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Ib=Jy(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Lb=Jy(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Rb({...e}){return(0,U.jsx)(Qh,{"data-slot":`dropdown-menu`,...e})}function zb({...e}){return(0,U.jsx)($h,{"data-slot":`dropdown-menu-trigger`,...e})}function Bb({className:e,sideOffset:t=4,...n}){return(0,U.jsx)(eg,{children:(0,U.jsx)(tg,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:Y(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function Vb({className:e,inset:t,variant:n=`default`,...r}){return(0,U.jsx)(rg,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:Y(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function Hb({className:e,inset:t,...n}){return(0,U.jsx)(ng,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:Y(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function Ub({className:e,...t}){return(0,U.jsx)(ig,{"data-slot":`dropdown-menu-separator`,className:Y(`-mx-1 my-1 h-px bg-border`,e),...t})}function Wb({...e}){return(0,U.jsx)(ag,{"data-slot":`dropdown-menu-sub`,...e})}function Gb({className:e,inset:t,children:n,...r}){return(0,U.jsxs)(og,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:Y(`flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,U.jsx)($y,{className:`ml-auto size-4`})]})}function Kb({className:e,...t}){return(0,U.jsx)(sg,{"data-slot":`dropdown-menu-sub-content`,className:Y(`z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...t})}function qb(){let{data:e}=Yo(),t=Zo(),n=Qo(),r=$o();if(e==null)return null;let i=e.orgs??(e.org===null?[]:[{...e.org,role:e.role}]),a=e.org,o=e.workspaces??[],s=e.active_workspace??null;return(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a!==null&&i.length>1?(0,U.jsxs)(Rb,{children:[(0,U.jsx)(zb,{asChild:!0,children:(0,U.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":`Switch organization (current: ${a.name})`,disabled:n.isPending,children:[a.name,(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`⌄`})]})}),(0,U.jsxs)(Bb,{align:`end`,children:[(0,U.jsx)(Hb,{children:`Organizations`}),i.map(e=>(0,U.jsxs)(Vb,{disabled:e.id===a.id||n.isPending,onSelect:()=>{n.mutate(e.id)},children:[(0,U.jsx)(`span`,{children:e.name}),e.id===a.id?(0,U.jsx)(`span`,{"aria-label":`Current`,children:`✓`}):null]},e.id))]})]}):a===null?null:(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:a.name}),s!==null&&o.length>1?(0,U.jsxs)(Rb,{children:[(0,U.jsx)(zb,{asChild:!0,children:(0,U.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":`Switch workspace (current: ${s.name})`,disabled:r.isPending,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`▣`}),s.name,(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`⌄`})]})}),(0,U.jsxs)(Bb,{align:`end`,children:[(0,U.jsx)(Hb,{children:`Workspaces`}),o.map(e=>(0,U.jsxs)(Vb,{disabled:s!==null&&(e.id===s.id||r.isPending),onSelect:()=>{r.mutate(e.id)},children:[(0,U.jsx)(`span`,{children:e.name}),s!==null&&e.id===s.id?(0,U.jsx)(`span`,{"aria-label":`Current`,children:`✓`}):null]},e.id))]})]}):s===null?null:(0,U.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:s.name}),(0,U.jsx)(Wy,{variant:`secondary`,children:e.role}),e.kind===`session`?(0,U.jsx)(X,{variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>{t.mutate()},children:`Sign out`}):null]})}function Jb({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card`,className:Y(`flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm`,e),...t})}function Yb({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-header`,className:Y(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function Xb({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-title`,className:Y(`leading-none font-semibold`,e),...t})}function Zb({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-description`,className:Y(`text-sm text-muted-foreground`,e),...t})}function Qb({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`card-content`,className:Y(`px-6`,e),...t})}function $b(){return(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,U.jsxs)(`svg`,{width:`46`,height:`46`,viewBox:`0 0 32 32`,fill:`none`,role:`img`,"aria-label":`Plan Desk`,style:{color:`var(--primary)`},children:[(0,U.jsx)(`rect`,{x:`1.5`,y:`1.5`,width:`29`,height:`29`,rx:`7`,fill:`currentColor`}),(0,U.jsx)(`path`,{d:`M11.5 12.5 20.5 19.5`,stroke:`var(--primary-foreground)`,strokeWidth:`2`,strokeLinecap:`round`}),(0,U.jsx)(`circle`,{cx:`11`,cy:`12`,r:`3.4`,fill:`var(--primary-foreground)`}),(0,U.jsx)(`circle`,{cx:`21`,cy:`20`,r:`3.4`,fill:`var(--primary-foreground)`})]}),(0,U.jsx)(`span`,{className:`text-base font-semibold tracking-tight text-foreground`,children:`Plan Desk`})]})}function ex({children:e}){return(0,U.jsxs)(`div`,{className:`relative flex min-h-screen items-center justify-center overflow-hidden bg-background px-4 py-12`,children:[(0,U.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0`,style:{backgroundImage:`radial-gradient(circle, var(--border-strong) 1px, transparent 1px)`,backgroundSize:`24px 24px`,maskImage:`radial-gradient(ellipse 62% 52% at 50% 42%, #000 0%, transparent 76%)`,WebkitMaskImage:`radial-gradient(ellipse 62% 52% at 50% 42%, #000 0%, transparent 76%)`,opacity:.55}}),(0,U.jsxs)(`div`,{className:`relative z-10 flex w-full max-w-sm flex-col items-center gap-7`,children:[(0,U.jsx)($b,{}),e]})]})}function tx(){return(0,U.jsx)(`svg`,{width:`19`,height:`19`,viewBox:`0 0 24 24`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,"aria-hidden":!0,className:`shrink-0`,children:(0,U.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`})})}function nx(){let{data:e,isLoading:t,error:n,refetch:r}=Xo(),[i,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(!1);async function c(){a(null),s(!0);try{let{url:e}=await Go(`/`);window.location.assign(e)}catch(e){s(!1),a(e instanceof Error?e.message:`Could not start GitHub sign-in`)}}return(0,U.jsx)(ex,{children:(0,U.jsxs)(Jb,{className:`w-full space-y-5 p-6 text-center`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Welcome to Plan Desk`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The shared graph for planning and building — for your team and your coding agents.`})]}),t?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Checking sign-in options…`}):null,n===null?null:(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Couldn't load sign-in options.`}),(0,U.jsx)(X,{type:`button`,variant:`outline`,className:`w-full`,onClick:()=>{r()},children:`Retry`})]}),e?.githubEnabled===!0?(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(X,{type:`button`,className:`w-full gap-2`,disabled:o,onClick:()=>{c()},children:[(0,U.jsx)(tx,{}),o?`Redirecting…`:`Continue with GitHub`]}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`We only read your public profile and email.`})]}):null,i===null?null:(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:i}),e!==void 0&&!e.githubEnabled?(0,U.jsxs)(`div`,{className:`space-y-2 text-left text-sm text-muted-foreground`,children:[(0,U.jsx)(`p`,{children:`This workspace doesn't use GitHub sign-in.`}),(0,U.jsxs)(`p`,{children:[`To connect, create an access token from the server and run`,` `,(0,U.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-xs`,children:`plandesk connect`}),`, or run Plan Desk locally where no sign-in is needed.`]}),(0,U.jsx)(`p`,{children:(0,U.jsx)(`a`,{href:`https://plandesk.asyncdot.com/self-hosting/server-config/`,target:`_blank`,rel:`noreferrer`,className:`text-primary underline-offset-4 hover:underline`,children:`Learn how to set up server sign-in →`})})]}):null]})})}function rx({children:e}){let{data:t,isLoading:n,error:r}=Yo();return n?(0,U.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:`Loading…`}):r?(0,U.jsxs)(`p`,{role:`alert`,className:`p-6 text-sm text-destructive`,children:[`Could not reach the Plan Desk API: `,r.message]}):t==null?(0,U.jsx)(nx,{}):(0,U.jsx)(U.Fragment,{children:e})}var ix=1,ax=.9,ox=.8,sx=.17,cx=.1,lx=.999,ux=.9999,dx=.99,fx=/[\\\/_+.#"@\[\(\{&]/,px=/[\\\/_+.#"@\[\(\{&]/g,mx=/[\s-]/,hx=/[\s-]/g;function gx(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?ix:dx;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=gx(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=ix:fx.test(e.charAt(l-1))?(d*=ox,p=e.slice(i,l-1).match(px),p&&i>0&&(d*=lx**+p.length)):mx.test(e.charAt(l-1))?(d*=ax,m=e.slice(i,l-1).match(hx),m&&i>0&&(d*=lx**+m.length)):(d*=sx,i>0&&(d*=lx**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=ux)),(d<cx&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=gx(e,t,n,r,l+1,a+2,o),f*cx>d&&(d=f*cx)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function _x(e){return e.toLowerCase().replace(hx,` `)}function vx(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,gx(e,t,_x(e),_x(t),0,0,{})}var yx=`[cmdk-group=""]`,bx=`[cmdk-group-items=""]`,xx=`[cmdk-group-heading=""]`,Sx=`[cmdk-item=""]`,Cx=`${Sx}:not([aria-disabled="true"])`,wx=`cmdk-item-select`,Tx=`data-value`,Ex=(e,t,n)=>vx(e,t,n),Dx=H.createContext(void 0),Ox=()=>H.useContext(Dx),kx=H.createContext(void 0),Ax=()=>H.useContext(kx),jx=H.createContext(void 0),Mx=H.forwardRef((e,t)=>{let n=Kx(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Kx(()=>new Set),i=Kx(()=>new Map),a=Kx(()=>new Map),o=Kx(()=>new Set),s=Wx(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Gs(),y=Gs(),b=Gs(),x=H.useRef(null),S=Yx();Gx(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),Gx(()=>{S(6,k)},[]);let C=H.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=H.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??Ex;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(bx);t?t.appendChild(e.parentElement===t?e:e.closest(`${bx} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${bx} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${yx}[${Tx}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Tx);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(yx)?.querySelector(xx))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${Sx}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(Cx)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(Tx))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(Tx))}function P(e){let t=A()?.closest(yx),n;for(;t&&!n;)t=e>0?Hx(t,yx):Ux(t,yx),n=t?.querySelector(Cx);n?C.setState(`value`,n.getAttribute(Tx)):N(e)}let F=()=>M(j().length-1),I=e=>{e.preventDefault(),e.metaKey?F():e.altKey?P(1):N(1)},L=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return H.createElement(Cs.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&I(e);break;case`ArrowDown`:I(e);break;case`p`:case`k`:g&&e.ctrlKey&&L(e);break;case`ArrowUp`:L(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),F();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(wx);t.dispatchEvent(e)}}}}},H.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:Qx},c),Zx(e,e=>H.createElement(kx.Provider,{value:C},H.createElement(Dx.Provider,{value:w},e))))}),Nx=H.forwardRef((e,t)=>{let n=Gs(),r=H.useRef(null),i=H.useContext(jx),a=Ox(),o=Wx(e),s=o.current?.forceMount??i?.forceMount;Gx(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=Jx(n,r,[e.value,e.children,r],e.keywords),l=Ax(),u=qx(e=>e.value&&e.value===c.current),d=qx(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);H.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(wx,f),()=>t.removeEventListener(wx,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return H.createElement(Cs.div,{ref:cs(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Px=H.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Gs(),s=H.useRef(null),c=H.useRef(null),l=Gs(),u=Ox(),d=qx(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);Gx(()=>u.group(o),[]),Jx(o,s,[e.value,e.heading,c]);let f=H.useMemo(()=>({id:o,forceMount:i}),[i]);return H.createElement(Cs.div,{ref:cs(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&H.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),Zx(e,e=>H.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},H.createElement(jx.Provider,{value:f},e))))}),Fx=H.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=H.useRef(null),a=qx(e=>!e.search);return!n&&!a?null:H.createElement(Cs.div,{ref:cs(i,t),...r,"cmdk-separator":``,role:`separator`})}),Ix=H.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Ax(),o=qx(e=>e.search),s=qx(e=>e.selectedItemId),c=Ox();return H.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),H.createElement(Cs.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Lx=H.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=H.useRef(null),o=H.useRef(null),s=qx(e=>e.selectedItemId),c=Ox();return H.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),H.createElement(Cs.div,{ref:cs(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},Zx(e,e=>H.createElement(`div`,{ref:cs(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Rx=H.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return H.createElement(tu,{open:n,onOpenChange:r},H.createElement(su,{container:o},H.createElement(lu,{"cmdk-overlay":``,className:i}),H.createElement(pu,{"aria-label":e.label,"cmdk-dialog":``,className:a},H.createElement(Mx,{ref:t,...s}))))}),zx=H.forwardRef((e,t)=>qx(e=>e.filtered.count===0)?H.createElement(Cs.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Bx=H.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return H.createElement(Cs.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Zx(e,e=>H.createElement(`div`,{"aria-hidden":!0},e)))}),Vx=Object.assign(Mx,{List:Lx,Item:Nx,Input:Ix,Group:Px,Separator:Fx,Dialog:Rx,Empty:zx,Loading:Bx});function Hx(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Ux(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Wx(e){let t=H.useRef(e);return Gx(()=>{t.current=e}),t}var Gx=typeof window>`u`?H.useEffect:H.useLayoutEffect;function Kx(e){let t=H.useRef();return t.current===void 0&&(t.current=e()),t}function qx(e){let t=Ax(),n=()=>e(t.snapshot());return H.useSyncExternalStore(t.subscribe,n,n)}function Jx(e,t,n,r=[]){let i=H.useRef(),a=Ox();return Gx(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Tx,s),i.current=s}),i}var Yx=()=>{let[e,t]=H.useState(),n=Kx(()=>new Map);return Gx(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Xx(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function Zx({asChild:e,children:t},n){return e&&H.isValidElement(t)?H.cloneElement(Xx(t),{ref:t.ref},n(t.props.children)):n(t)}var Qx={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function $x({...e}){return(0,U.jsx)(tu,{"data-slot":`dialog`,...e})}function eS({...e}){return(0,U.jsx)(ru,{"data-slot":`dialog-trigger`,...e})}function tS({...e}){return(0,U.jsx)(su,{"data-slot":`dialog-portal`,...e})}function nS({...e}){return(0,U.jsx)(Su,{"data-slot":`dialog-close`,...e})}function rS({className:e,...t}){return(0,U.jsx)(lu,{"data-slot":`dialog-overlay`,className:Y(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function iS({className:e,children:t,showCloseButton:n=!0,...r}){return(0,U.jsxs)(tS,{"data-slot":`dialog-portal`,children:[(0,U.jsx)(rS,{}),(0,U.jsxs)(pu,{"data-slot":`dialog-content`,className:Y(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,U.jsxs)(Su,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,U.jsx)(Lb,{}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function aS({className:e,...t}){return(0,U.jsx)(`div`,{"data-slot":`dialog-header`,className:Y(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function oS({className:e,showCloseButton:t=!1,children:n,...r}){return(0,U.jsxs)(`div`,{"data-slot":`dialog-footer`,className:Y(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,U.jsx)(Su,{asChild:!0,children:(0,U.jsx)(X,{variant:`outline`,children:`Close`})})]})}function sS({className:e,...t}){return(0,U.jsx)(vu,{"data-slot":`dialog-title`,className:Y(`text-lg leading-none font-semibold`,e),...t})}function cS({className:e,...t}){return(0,U.jsx)(bu,{"data-slot":`dialog-description`,className:Y(`text-sm text-muted-foreground`,e),...t})}function lS({className:e,...t}){return(0,U.jsx)(Vx,{"data-slot":`command`,className:Y(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t})}function uS({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!0,...a}){return(0,U.jsxs)($x,{...a,children:[(0,U.jsxs)(aS,{className:`sr-only`,children:[(0,U.jsx)(sS,{children:e}),(0,U.jsx)(cS,{children:t})]}),(0,U.jsx)(iS,{className:Y(`overflow-hidden p-0`,r),showCloseButton:i,children:(0,U.jsx)(lS,{className:`**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})})]})}function dS({className:e,...t}){return(0,U.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,U.jsx)(Cb,{className:`size-4 shrink-0 opacity-50`}),(0,U.jsx)(Vx.Input,{"data-slot":`command-input`,className:Y(`flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]})}function fS({className:e,...t}){return(0,U.jsx)(Vx.List,{"data-slot":`command-list`,className:Y(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...t})}function pS({...e}){return(0,U.jsx)(Vx.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function mS({className:e,...t}){return(0,U.jsx)(Vx.Group,{"data-slot":`command-group`,className:Y(`overflow-hidden p-1 text-foreground [&_[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`,e),...t})}function hS({className:e,...t}){return(0,U.jsx)(Vx.Separator,{"data-slot":`command-separator`,className:Y(`-mx-1 h-px bg-border`,e),...t})}function gS({className:e,...t}){return(0,U.jsx)(Vx.Item,{"data-slot":`command-item`,className:Y(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...t})}var _S={refetchInterval:2500,refetchOnWindowFocus:!0},vS={projects:[`projects`],project:e=>[`projects`,e],tasksRoot:e=>[`projects`,e,`tasks`],tasks:(e,t)=>[`projects`,e,`tasks`,t??`all`],tags:e=>[`projects`,e,`tags`],canvas:e=>[`projects`,e,`canvas`],documents:e=>[`projects`,e,`documents`],document:e=>[`documents`,e],folders:e=>[`projects`,e,`folders`],notes:e=>[`projects`,e,`notes`],note:e=>[`notes`,e],comments:(e,t)=>[`${e}s`,t,`comments`],taskDocument:e=>[`tasks`,e,`document`],agentRuns:e=>[`projects`,e,`agent-runs`],submissions:(e,t)=>[`projects`,e,`submissions`,t??`pending`],goals:e=>[`projects`,e,`goals`],goal:e=>[`goals`,e],orgMembers:e=>[`orgs`,e,`members`],workspaceMembers:e=>[`workspaces`,e,`members`]};function yS(){return tt({queryKey:vS.projects,queryFn:Na})}function bS(){let e=W();return nt({mutationFn:e=>Pa(e),onSuccess:()=>{e.invalidateQueries({queryKey:vS.projects})}})}function xS(e){return tt({queryKey:vS.project(e),queryFn:()=>Fa(e),..._S})}function SS(e,t={}){return tt({queryKey:vS.tasks(e,t.status),queryFn:()=>Ia(e,t),..._S})}function CS(e,t){e.invalidateQueries({queryKey:vS.project(t)}),e.invalidateQueries({queryKey:vS.tasksRoot(t)}),e.invalidateQueries({queryKey:vS.tags(t)}),e.invalidateQueries({queryKey:vS.canvas(t)})}function wS(e){let t=W();return nt({mutationFn:t=>La(e,t),onSuccess:()=>{CS(t,e)}})}function TS(){let e=W();return nt({mutationFn:({id:e,input:t})=>Ra(e,t),onSuccess:t=>{CS(e,t.project_id)}})}function ES(){let e=W();return nt({mutationFn:({id:e})=>za(e),onSuccess:(t,{projectId:n})=>{CS(e,n)}})}function DS(e){return tt({queryKey:vS.tags(e),queryFn:()=>Ua(e),..._S})}function OS(){let e=W();return nt({mutationFn:({id:e,input:t})=>Wa(e,t),onSuccess:t=>{e.invalidateQueries({queryKey:vS.projects}),e.invalidateQueries({queryKey:vS.project(t.id)})}})}function kS(){let e=W();return nt({mutationFn:e=>Ga(e),onSuccess:()=>{e.invalidateQueries({queryKey:vS.projects})}})}function AS(e){return tt({queryKey:vS.canvas(e),queryFn:()=>Ka(e),..._S})}function jS(e){let t=W();return nt({mutationFn:t=>qa(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:vS.canvas(e)})}})}function MS(e){return tt({queryKey:vS.documents(e),queryFn:()=>Ja(e),..._S})}function NS(e){let t=W();return nt({mutationFn:t=>Ya(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:vS.documents(e)})}})}function PS(e){return tt({queryKey:vS.document(e),queryFn:()=>Xa(e),..._S})}function FS(){let e=W();return nt({mutationFn:({id:e,input:t})=>Za(e,t),onSuccess:t=>{e.invalidateQueries({queryKey:vS.document(t.id)}),e.invalidateQueries({queryKey:vS.documents(t.project_id)})}})}function IS(){let e=W();return nt({mutationFn:({id:e})=>Qa(e),onSuccess:(t,{projectId:n})=>{e.invalidateQueries({queryKey:vS.documents(n)})}})}function LS(e){return tt({queryKey:vS.folders(e),queryFn:()=>eo(e),..._S})}function RS(e,t){e.invalidateQueries({queryKey:vS.folders(t)}),e.invalidateQueries({queryKey:vS.documents(t)})}function zS(e){let t=W();return nt({mutationFn:t=>to(e,t),onSuccess:()=>{RS(t,e)}})}function BS(){let e=W();return nt({mutationFn:({id:e,input:t})=>no(e,t),onSuccess:t=>{RS(e,t.project_id)}})}function VS(){let e=W();return nt({mutationFn:({id:e})=>ro(e),onSuccess:(t,{projectId:n})=>{RS(e,n)}})}function HS(e){return tt({queryKey:vS.notes(e),queryFn:()=>io(e),..._S})}function US(e){let t=W();return nt({mutationFn:t=>ao(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:vS.notes(e)})}})}function WS(e){return tt({queryKey:vS.note(e),queryFn:()=>oo(e),..._S})}function GS(){let e=W();return nt({mutationFn:({id:e,input:t})=>so(e,t),onSuccess:t=>{e.invalidateQueries({queryKey:vS.note(t.id)}),e.invalidateQueries({queryKey:vS.notes(t.project_id)})}})}function KS(){let e=W();return nt({mutationFn:({id:e})=>co(e),onSuccess:(t,{projectId:n})=>{e.invalidateQueries({queryKey:vS.notes(n)})}})}function qS(e){return tt({queryKey:vS.comments(e.type,e.id),queryFn:()=>lo(e,{includeResolved:!0}),..._S})}function JS(e){let t=W();return nt({mutationFn:t=>uo(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:vS.comments(e.type,e.id)})}})}function YS(e){let t=W();return nt({mutationFn:({id:e,input:t})=>fo(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:vS.comments(e.type,e.id)})}})}function XS(e){let t=W();return nt({mutationFn:e=>po(e),onSuccess:()=>{t.invalidateQueries({queryKey:vS.comments(e.type,e.id)})}})}function ZS(e){let t=W();return nt({mutationFn:t=>mo(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:vS.canvas(e)})}})}function QS(){return nt({mutationFn:e=>ho(e)})}function $S(e){return tt({queryKey:vS.orgMembers(e??``),queryFn:()=>go(e),enabled:e!==void 0&&e.length>0})}function eC(e){let t=W();return nt({mutationFn:t=>e===void 0||e.length===0?Promise.reject(Error(`No active organization`)):_o(e,t),onSuccess:()=>{e!==void 0&&t.invalidateQueries({queryKey:vS.orgMembers(e)})}})}function tC(e){return tt({queryKey:vS.agentRuns(e),queryFn:()=>bo(e),..._S})}function nC(e,t=`pending`){return tt({queryKey:vS.submissions(e,t),queryFn:()=>xo(e,t)})}function rC(e){let t=W();return nt({mutationFn:({id:e,input:t})=>So(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:vS.submissions(e)}),CS(t,e)}})}function iC(e,t,n,r=!1){e.invalidateQueries({queryKey:vS.goals(t)}),e.invalidateQueries({queryKey:vS.goal(n)}),r&&CS(e,t)}function aC(e){return tt({queryKey:vS.goals(e),queryFn:()=>Co(e),..._S})}function oC(e){return tt({queryKey:vS.goal(e),queryFn:()=>wo(e),enabled:e!==``,..._S})}function sC(e){let t=W();return nt({mutationFn:t=>To(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:vS.goals(e)})}})}function cC(e){let t=W();return nt({mutationFn:e=>Eo(e),onSuccess:n=>{iC(t,e,n.id)}})}function lC(e){let t=W();return nt({mutationFn:e=>Do(e),onSuccess:n=>{iC(t,e,n.id)}})}function uC(e){let t=W();return nt({mutationFn:({goalId:e,evidence:t})=>Oo(e,t),onSuccess:n=>{iC(t,e,n.id,!0)}})}function dC(e){e.invalidateQueries({queryKey:Jo}),e.invalidateQueries({queryKey:Ko})}function fC(){let e=W();return nt({mutationFn:e=>Fo(e),onSuccess:()=>{dC(e)}})}function pC(){let e=W();return nt({mutationFn:({teamId:e,name:t})=>Io(e,t),onSuccess:()=>{dC(e)}})}function mC(){let e=W();return nt({mutationFn:e=>Lo(e),onSuccess:()=>{dC(e)}})}function hC(e){return tt({queryKey:vS.workspaceMembers(e??``),queryFn:()=>Ro(e),enabled:e!==void 0&&e.length>0})}function gC(e){let t=W();return nt({mutationFn:t=>e===void 0?Promise.reject(Error(`No active workspace`)):zo(e,t),onSuccess:()=>{e!==void 0&&t.invalidateQueries({queryKey:vS.workspaceMembers(e)})}})}function _C(e){let t=W();return nt({mutationFn:t=>e===void 0?Promise.reject(Error(`No active workspace`)):Bo(e,t),onSuccess:()=>{e!==void 0&&t.invalidateQueries({queryKey:vS.workspaceMembers(e)})}})}function vC(){let e=W();return nt({mutationFn:({projectId:e,workspaceId:t})=>Vo(e,t),onSuccess:t=>{e.invalidateQueries({queryKey:vS.projects}),e.invalidateQueries({queryKey:vS.project(t.id)})}})}var yC=(0,H.createContext)(null);function bC({children:e}){let[t,n]=(0,H.useState)(!1);return(0,U.jsx)(yC.Provider,{value:{open:t,setOpen:n},children:e})}function xC(){let e=(0,H.useContext)(yC);if(e===null)throw Error(`useCommandMenu must be used within CommandMenuProvider`);return e}var SC=[{label:`Overview`,to:`/projects/$id/overview`,icon:ab},{label:`Board`,to:`/projects/$id/board`,icon:ob},{label:`Flow`,to:`/projects/$id/flow`,icon:cte},{label:`Goals`,to:`/projects/$id/goals`,icon:Ab},{label:`Documents`,to:`/projects/$id/documents`,icon:tb},{label:`Notes`,to:`/projects/$id/notes`,icon:Db},{label:`Inbox`,to:`/projects/$id/inbox`,icon:rb}];function CC(){let{open:e,setOpen:t}=xC(),n=Ei(),r=wi({strict:!1}).id,{data:i=[]}=yS(),a=(0,H.useCallback)((e,r)=>{t(!1),n({to:e,params:r})},[n,t]);return(0,H.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key===`k`&&(e.preventDefault(),t(!0))}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[t]),(0,U.jsxs)(uS,{open:e,onOpenChange:t,children:[(0,U.jsx)(dS,{placeholder:`Search or run a command…`}),(0,U.jsxs)(fS,{children:[(0,U.jsx)(pS,{children:`No results found.`}),r===void 0?null:(0,U.jsx)(mS,{heading:`Navigate`,children:SC.map(e=>(0,U.jsxs)(gS,{value:e.label,onSelect:()=>{a(e.to,{id:r})},children:[(0,U.jsx)(e.icon,{}),e.label]},e.label))}),r===void 0?null:(0,U.jsx)(hS,{}),(0,U.jsxs)(mS,{heading:`Projects`,children:[(0,U.jsxs)(gS,{value:`All projects`,onSelect:()=>{a(`/`)},children:[(0,U.jsx)(nb,{}),`All projects`]}),i.map(e=>(0,U.jsxs)(gS,{value:e.name,onSelect:()=>{a(`/projects/$id/overview`,{id:e.id})},children:[(0,U.jsx)(Qee,{}),e.name]},e.id))]}),(0,U.jsx)(hS,{}),(0,U.jsxs)(mS,{heading:`Settings`,children:[(0,U.jsxs)(gS,{value:`Members`,onSelect:()=>{a(`/settings/members`)},children:[(0,U.jsx)(wb,{}),`Members`]}),(0,U.jsxs)(gS,{value:`MCP Settings`,onSelect:()=>{a(`/settings/mcp`)},children:[(0,U.jsx)(wb,{}),`MCP Settings`]})]})]})]})}function wC({activeProjectId:e,onNavigate:t}){let{data:n}=Yo(),{data:r}=yS(),i=n?.active_workspace?.id,a=r===void 0||i===void 0?r??[]:r.filter(e=>e.workspace_id===i),o=e===void 0?null:a.find(t=>t.id===e)??null,s=o?.name??`Projects`;return(0,U.jsxs)(Rb,{children:[(0,U.jsx)(zb,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`switcher`,"aria-label":`Switch project${o===null?``:` (current: ${o.name})`}`,children:[(0,U.jsx)(`span`,{className:`proj-dot`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`switcher-name`,children:s}),(0,U.jsx)(`span`,{className:`switcher-chev`,"aria-hidden":`true`,children:`⌄`})]})}),(0,U.jsxs)(Bb,{align:`start`,children:[(0,U.jsx)(Hb,{children:`Projects`}),a.length===0?(0,U.jsx)(Vb,{disabled:!0,children:`No projects yet`}):a.map(n=>{let r=e===n.id;return(0,U.jsxs)(Vb,{disabled:r,onSelect:()=>{t(n.id)},children:[(0,U.jsx)(`span`,{className:`switcher-name`,children:n.name}),r?(0,U.jsx)(`span`,{"aria-label":`Current`,className:`switcher-mark`,children:`✓`}):null]},n.id)})]})]})}function TC({className:e}){let{resolvedTheme:t,setTheme:n}=ya(),[r,i]=(0,H.useState)(!1);(0,H.useEffect)(()=>{i(!0)},[]);let a=t===`dark`;return(0,U.jsx)(`button`,{type:`button`,"aria-label":a?`Switch to light theme`:`Switch to dark theme`,title:a?`Light theme`:`Dark theme`,onClick:()=>{n(a?`light`:`dark`)},className:Y(`inline-flex size-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,e),children:r&&a?(0,U.jsx)(hb,{className:`size-4`}):(0,U.jsx)(Ob,{className:`size-4`})})}function EC(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var DC=e=>{switch(e){case`success`:return AC;case`info`:return MC;case`warning`:return jC;case`error`:return NC;default:return null}},OC=Array(12).fill(0),kC=({visible:e,className:t})=>H.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},H.createElement(`div`,{className:`sonner-spinner`},OC.map((e,t)=>H.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),AC=H.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},H.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),jC=H.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},H.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),MC=H.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},H.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),NC=H.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},H.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),PC=H.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},H.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),H.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),FC=()=>{let[e,t]=H.useState(document.hidden);return H.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},IC=1,LC=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:IC++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],H.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(zC(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!H.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||IC++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},RC=(e,t)=>{let n=t?.id||IC++;return LC.addToast({title:e,...t,id:n}),n},zC=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,BC=Object.assign(RC,{success:LC.success,info:LC.info,warning:LC.warning,error:LC.error,custom:LC.custom,message:LC.message,promise:LC.promise,dismiss:LC.dismiss,loading:LC.loading},{getHistory:()=>LC.toasts,getToasts:()=>LC.getActiveToasts()});EC(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function VC(e){return e.label!==void 0}var HC=3,UC=`24px`,WC=`16px`,GC=4e3,KC=356,qC=14,JC=45,YC=200;function XC(...e){return e.filter(Boolean).join(` `)}function ZC(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var QC=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=H.useState(null),[O,k]=H.useState(null),[A,j]=H.useState(!1),[M,N]=H.useState(!1),[P,F]=H.useState(!1),[I,L]=H.useState(!1),[ee,te]=H.useState(!1),[ne,R]=H.useState(0),[z,B]=H.useState(0),re=H.useRef(n.duration||y||GC),V=H.useRef(null),ie=H.useRef(null),ae=c===0,oe=c+1<=o,se=n.type,ce=n.dismissible!==!1,le=n.className||``,ue=n.descriptionClassName||``,de=H.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),fe=H.useMemo(()=>n.closeButton??p,[n.closeButton,p]),pe=H.useMemo(()=>n.duration||y||GC,[n.duration,y]),me=H.useRef(0),he=H.useRef(0),ge=H.useRef(0),_e=H.useRef(null),[ve,ye]=b.split(`-`),be=H.useMemo(()=>s.reduce((e,t,n)=>n>=de?e:e+t.height,0),[s,de]),xe=FC(),Se=n.invert||t,Ce=se===`loading`;he.current=H.useMemo(()=>de*x+be,[de,be]),H.useEffect(()=>{re.current=pe},[pe]),H.useEffect(()=>{j(!0)},[]),H.useEffect(()=>{let e=ie.current;if(e){let t=e.getBoundingClientRect().height;return B(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),H.useLayoutEffect(()=>{if(!A)return;let e=ie.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,B(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[A,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let we=H.useCallback(()=>{N(!0),R(he.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},YC)},[n,d,a,he]);H.useEffect(()=>{if(n.promise&&se===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||xe?(()=>{if(ge.current<me.current){let e=new Date().getTime()-me.current;re.current-=e}ge.current=new Date().getTime()})():re.current!==1/0&&(me.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),we()},re.current)),()=>clearTimeout(e)},[u,i,n,se,xe,we]),H.useEffect(()=>{n.delete&&(we(),n.onDismiss==null||n.onDismiss.call(n,n))},[we,n.delete]);function Te(){return w?.loading?H.createElement(`div`,{className:XC(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":se===`loading`},w.loading):H.createElement(kC,{className:XC(C?.loader,n?.classNames?.loader),visible:se===`loading`})}let Ee=n.icon||w?.[se]||DC(se);return H.createElement(`li`,{tabIndex:0,ref:ie,className:XC(_,le,C?.toast,n?.classNames?.toast,C?.default,C?.[se],n?.classNames?.[se]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":A,"data-promise":!!n.promise,"data-swiped":ee,"data-removed":M,"data-visible":oe,"data-y-position":ve,"data-x-position":ye,"data-index":c,"data-front":ae,"data-swiping":P,"data-dismissible":ce,"data-type":se,"data-invert":Se,"data-swipe-out":I,"data-swipe-direction":O,"data-expanded":!!(u||S&&A),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${M?ne:he.current}px`,"--initial-height":S?`auto`:`${z}px`,...m,...n.style},onDragEnd:()=>{F(!1),D(null),_e.current=null},onPointerDown:e=>{e.button!==2&&(Ce||!ce||(V.current=new Date,R(he.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(F(!0),_e.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(I||!ce)return;_e.current=null;let e=Number(ie.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(ie.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-V.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=JC||a>.11){R(he.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),we(),L(!0);return}else{var o,s;(o=ie.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=ie.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}te(!1),F(!1),D(null)},onPointerMove:t=>{var n,r;if(!_e.current||!ce||window.getSelection()?.toString().length>0)return;let i=t.clientY-_e.current.y,a=t.clientX-_e.current.x,o=e.swipeDirections??ZC(b);!E&&(Math.abs(a)>1||Math.abs(i)>1)&&D(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(E===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&te(!0),(n=ie.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=ie.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},fe&&!n.jsx&&se!==`loading`?H.createElement(`button`,{"aria-label":T,"data-disabled":Ce,"data-close-button":!0,onClick:Ce||!ce?()=>{}:()=>{we(),n.onDismiss==null||n.onDismiss.call(n,n)},className:XC(C?.closeButton,n?.classNames?.closeButton)},w?.close??PC):null,(se||n.icon||n.promise)&&n.icon!==null&&(w?.[se]!==null||n.icon)?H.createElement(`div`,{"data-icon":``,className:XC(C?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Te():null,n.type===`loading`?null:Ee):null,H.createElement(`div`,{"data-content":``,className:XC(C?.content,n?.classNames?.content)},H.createElement(`div`,{"data-title":``,className:XC(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?H.createElement(`div`,{"data-description":``,className:XC(v,ue,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),H.isValidElement(n.cancel)?n.cancel:n.cancel&&VC(n.cancel)?H.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{VC(n.cancel)&&ce&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),we())},className:XC(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,H.isValidElement(n.action)?n.action:n.action&&VC(n.action)?H.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{VC(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&we())},className:XC(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function $C(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function ew(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?WC:UC;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var tw=H.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=HC,toastOptions:g,dir:_=$C(),gap:v=qC,icons:y,containerAriaLabel:b=`Notifications`}=e,[x,S]=H.useState([]),C=H.useMemo(()=>n?x.filter(e=>e.toasterId===n):x.filter(e=>!e.toasterId),[x,n]),w=H.useMemo(()=>Array.from(new Set([i].concat(C.filter(e=>e.position).map(e=>e.position)))),[C,i]),[T,E]=H.useState([]),[D,O]=H.useState(!1),[k,A]=H.useState(!1),[j,M]=H.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),N=H.useRef(null),P=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),F=H.useRef(null),I=H.useRef(!1),L=H.useCallback(e=>{S(t=>(t.find(t=>t.id===e.id)?.delete||LC.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return H.useEffect(()=>LC.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{Oi.flushSync(()=>{S(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[x]),H.useEffect(()=>{if(d!==`system`){M(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?M(`dark`):M(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{M(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{M(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),H.useEffect(()=>{x.length<=1&&O(!1)},[x]),H.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;O(!0),(t=N.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===N.current||N.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),H.useEffect(()=>{if(N.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,I.current=!1)}},[N.current]),H.createElement(`section`,{ref:t,"aria-label":`${b} ${P}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},w.map((t,n)=>{let[i,a]=t.split(`-`);return C.length?H.createElement(`ol`,{key:t,dir:_===`auto`?$C():_,tabIndex:-1,ref:N,className:c,"data-sonner-toaster":!0,"data-sonner-theme":j,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${T[0]?.height||0}px`,"--width":`${KC}px`,"--gap":`${v}px`,...m,...ew(l,u)},onBlur:e=>{I.current&&!e.currentTarget.contains(e.relatedTarget)&&(I.current=!1,F.current&&=(F.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||I.current||(I.current=!0,F.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{k||O(!1)},onDragEnd:()=>O(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||A(!0)},onPointerUp:()=>A(!1)},C.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>H.createElement(QC,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:k,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:L,toasts:C.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:E,expandByDefault:o,gap:v,expanded:D,swipeDirections:e.swipeDirections}))):null}))});function nw({className:e,type:t,...n}){return(0,U.jsx)(`input`,{type:t,"data-slot":`input`,className:Y(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,e),...n})}function rw({className:e,...t}){return(0,U.jsx)(ug,{"data-slot":`label`,className:Y(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function iw(){let{data:e}=Yo(),t=es(),n=$o(),r=fC(),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(``),c=t.data??e?.workspaces??[],l=e?.active_workspace??null,u=e?.role===`owner`,d=l?.name??`Workspaces`,f=c.length>1;async function p(e){e.preventDefault();let t=o.trim();if(t!==``)try{let e=await r.mutateAsync(t);s(``),a(!1),await n.mutateAsync(e.id),BC(`Workspace created`)}catch(e){e instanceof ja&&e.status===403&&BC.error(`You don't have permission to create workspaces.`)}}return(0,U.jsxs)(`div`,{className:`switcher-row`,children:[f?(0,U.jsxs)(Rb,{children:[(0,U.jsx)(zb,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`switcher`,"aria-label":`Switch workspace (current: ${d})`,disabled:n.isPending,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`▣`}),(0,U.jsx)(`span`,{className:`switcher-name`,children:d}),(0,U.jsx)(`span`,{className:`switcher-chev`,"aria-hidden":`true`,children:`⌄`})]})}),(0,U.jsxs)(Bb,{align:`start`,children:[(0,U.jsx)(Hb,{children:`Workspaces`}),c.map(e=>{let t=l!==null&&e.id===l.id;return(0,U.jsxs)(Vb,{disabled:t||n.isPending,onSelect:()=>{n.mutate(e.id)},children:[(0,U.jsx)(`span`,{className:`switcher-name`,children:e.name}),t?(0,U.jsx)(`span`,{"aria-label":`Current`,className:`switcher-mark`,children:`✓`}):null]},e.id)})]})]}):(0,U.jsxs)(`div`,{className:`switcher`,"data-disabled":!0,"aria-label":`Active workspace: ${d}`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`▣`}),(0,U.jsx)(`span`,{className:`switcher-name`,children:d})]}),u?(0,U.jsx)(`button`,{type:`button`,className:`switcher-add`,"aria-label":`New workspace`,onClick:()=>{a(!0)},children:`+`}):null,(0,U.jsx)($x,{open:i,onOpenChange:a,children:(0,U.jsxs)(iS,{children:[(0,U.jsxs)(aS,{children:[(0,U.jsx)(sS,{children:`New workspace`}),(0,U.jsx)(cS,{children:`A new workspace starts empty. Invite members from its tab.`})]}),(0,U.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>void p(e),children:[(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(rw,{htmlFor:`new-workspace-name`,children:`Name`}),(0,U.jsx)(nw,{id:`new-workspace-name`,type:`text`,required:!0,value:o,onChange:e=>s(e.target.value),placeholder:`Fiji TV`,autoFocus:!0})]}),(0,U.jsxs)(oS,{children:[(0,U.jsx)(X,{type:`button`,variant:`ghost`,onClick:()=>a(!1),disabled:r.isPending,children:`Cancel`}),(0,U.jsx)(X,{type:`submit`,disabled:r.isPending||o.trim()===``,children:r.isPending?`Creating…`:`Create workspace`})]})]})]})})]})}var aw=[{label:`Overview`,to:`/projects/$id/overview`,icon:(0,U.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.7,children:[(0,U.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}),(0,U.jsx)(`path`,{d:`M8 8h8M8 12h8M8 16h5`})]})},{label:`Board`,to:`/projects/$id/board`,icon:(0,U.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.7,children:[(0,U.jsx)(`rect`,{x:`3.5`,y:`4`,width:`5`,height:`16`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`10`,y:`4`,width:`5`,height:`11`,rx:`1.5`}),(0,U.jsx)(`rect`,{x:`16.5`,y:`4`,width:`4.5`,height:`8`,rx:`1.5`})]})},{label:`Flow`,to:`/projects/$id/flow`,icon:(0,U.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.7,children:[(0,U.jsx)(`circle`,{cx:`6`,cy:`7`,r:`2.4`}),(0,U.jsx)(`circle`,{cx:`18`,cy:`12`,r:`2.4`}),(0,U.jsx)(`circle`,{cx:`6`,cy:`17`,r:`2.4`}),(0,U.jsx)(`path`,{d:`M8.3 7.6l7.4 3.6M8.2 16.2l7.5-3.4`})]})},{label:`Goals`,to:`/projects/$id/goals`,icon:(0,U.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.7,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3.4`})]})}],ow=[{label:`Documents`,to:`/projects/$id/documents`,icon:(0,U.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.7,children:[(0,U.jsx)(`path`,{d:`M6 3.5h8l4 4V20a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4.5a1 1 0 0 1 1-1z`}),(0,U.jsx)(`path`,{d:`M14 3.5V8h4`})]})},{label:`Notes`,to:`/projects/$id/notes`,icon:(0,U.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.7,children:(0,U.jsx)(`path`,{d:`M5 19l1-4L16 5l3 3L9 18l-4 1z`})})},{label:`Inbox`,to:`/projects/$id/inbox`,icon:(0,U.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.7,children:[(0,U.jsx)(`path`,{d:`M4 13l2.2-7.2A2 2 0 0 1 8.1 4.5h7.8a2 2 0 0 1 1.9 1.3L20 13v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z`}),(0,U.jsx)(`path`,{d:`M4 13h4l1.5 2.2h5L16 13h4`})]})}];function sw({entry:e,id:t}){return(0,U.jsxs)(Bi,{to:e.to,params:{id:t},className:`nav-item`,activeProps:{className:`active`},children:[e.icon,e.label]})}function cw(){let e=wi({strict:!1}).id,{setOpen:t}=xC(),n=Ei();return(0,U.jsxs)(`aside`,{className:`sidebar`,children:[(0,U.jsxs)(Bi,{to:`/`,className:`ws`,"aria-label":`Plan Desk home`,children:[(0,U.jsx)(`div`,{className:`ws-badge`,children:`P`}),(0,U.jsx)(`span`,{className:`ws-name`,children:`Plan Desk`})]}),(0,U.jsxs)(`div`,{className:`side-scroll`,children:[(0,U.jsx)(iw,{}),(0,U.jsx)(wC,{activeProjectId:e,onNavigate:e=>{n({to:`/projects/$id/overview`,params:{id:e}})}}),e===void 0?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`nav-label`,children:`Plan`}),aw.map(t=>(0,U.jsx)(sw,{entry:t,id:e},t.label)),(0,U.jsx)(`div`,{className:`nav-label`,children:`Workspace`}),ow.map(t=>(0,U.jsx)(sw,{entry:t,id:e},t.label))]})]}),(0,U.jsxs)(`div`,{className:`side-foot`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`cmdk`,"aria-label":`Search or run a command`,onClick:()=>{t(!0)},children:[(0,U.jsx)(Cb,{width:15,height:15}),(0,U.jsx)(`span`,{children:`Search…`}),(0,U.jsxs)(`span`,{className:`cmdk-keys`,children:[(0,U.jsx)(`kbd`,{children:`⌘`}),(0,U.jsx)(`kbd`,{children:`K`})]})]}),(0,U.jsx)(TC,{className:`icon-btn`}),(0,U.jsx)(Bi,{to:`/settings/members`,className:`icon-btn`,title:`Settings`,"aria-label":`Settings`,children:(0,U.jsx)(wb,{width:17,height:17})})]})]})}var lw=({...e})=>{let{theme:t=`system`}=ya();return(0,U.jsx)(tw,{theme:t,className:`toaster group`,icons:{success:(0,U.jsx)(Zee,{className:`size-4`}),info:(0,U.jsx)(ib,{className:`size-4`}),warning:(0,U.jsx)(Nb,{className:`size-4`}),error:(0,U.jsx)(gb,{className:`size-4`}),loading:(0,U.jsx)(ub,{className:`size-4 animate-spin`})},style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},...e})},uw={overview:`Overview`,board:`Board`,flow:`Flow`,goals:`Goals`,notes:`Notes`,inbox:`Inbox`,documents:`Documents`};function dw(e){let t=e.split(`/`).filter(e=>e.length>0);if(t[0]===`projects`&&t.length>=3){let e=t[2];return e===void 0?null:uw[e]??null}return t[0]===`settings`&&t[1]===`mcp`?`MCP Settings`:t[0]===`settings`&&t[1]===`members`?`Members`:null}function fw(){return(0,U.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.8,children:(0,U.jsx)(`path`,{d:`M9 6l6 6-6 6`})})}function pw({id:e,viewLabel:t}){let{data:n}=xS(e);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:n?.name??`…`}),t===null?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(fw,{}),(0,U.jsx)(`b`,{children:t})]})]})}function mw(){let e=wi({strict:!1}),t=dw(da().pathname),n=e.id;return n===void 0?(0,U.jsx)(`b`,{children:t??`Projects`}):(0,U.jsx)(pw,{id:n,viewLabel:t})}var hw=`/p/`,gw=`/invite/`,_w=[`/`];function vw(e){return _w.includes(e)}function yw({showAccount:e}){return(0,U.jsxs)(`div`,{className:`app`,children:[(0,U.jsx)(cw,{}),(0,U.jsxs)(`div`,{className:`main`,children:[(0,U.jsxs)(`header`,{className:`topbar`,children:[(0,U.jsx)(`nav`,{className:`crumb`,children:(0,U.jsx)(mw,{})}),(0,U.jsx)(`div`,{className:`spacer`}),e?(0,U.jsx)(qb,{}):null]}),(0,U.jsx)(`main`,{className:`content`,children:(0,U.jsx)(na,{})})]}),(0,U.jsx)(CC,{}),(0,U.jsx)(lw,{})]})}function bw(){let e=da(),t=e.pathname.startsWith(hw),n=e.pathname.startsWith(gw),r=vw(e.pathname),i=(0,U.jsx)(yw,{showAccount:!t});return n?(0,U.jsx)(bC,{children:(0,U.jsx)(na,{})}):t?(0,U.jsx)(bC,{children:i}):r?(0,U.jsxs)(bC,{children:[(0,U.jsx)(rx,{children:(0,U.jsx)(na,{})}),(0,U.jsx)(lw,{})]}):(0,U.jsx)(bC,{children:(0,U.jsx)(rx,{children:i})})}var xw=Gi({component:bw});function Sw(){let{data:e}=Yo(),t=es(),{data:n}=yS(),r=$o(),i=fC(),a=Ei(),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(``),u=t.data??e?.workspaces??[],d=e?.org?.name??`Your organization`,f=e?.role===`owner`,p=e?.active_workspace?.id,m=new Map;if(n!==void 0)for(let e of n)m.set(e.workspace_id,(m.get(e.workspace_id)??0)+1);function h(e){r.mutate(e,{onSuccess:()=>{a({to:`/projects`})}})}async function g(e){e.preventDefault();let t=c.trim();if(t!==``)try{let e=await i.mutateAsync(t);l(``),s(!1),await r.mutateAsync(e.id),BC(`Workspace created`),a({to:`/projects`})}catch(e){e instanceof ja&&e.status===403&&BC.error(`You don't have permission to create workspaces.`)}}return(0,U.jsxs)(`div`,{className:`relative flex min-h-screen flex-col items-center overflow-hidden bg-background px-4 py-12`,children:[(0,U.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0`,style:{backgroundImage:`radial-gradient(circle, var(--border-strong) 1px, transparent 1px)`,backgroundSize:`24px 24px`,maskImage:`radial-gradient(ellipse 62% 52% at 50% 42%, #000 0%, transparent 76%)`,WebkitMaskImage:`radial-gradient(ellipse 62% 52% at 50% 42%, #000 0%, transparent 76%)`,opacity:.55}}),(0,U.jsx)(`div`,{className:`absolute top-4 right-4 z-20`,children:(0,U.jsx)(TC,{})}),(0,U.jsxs)(`div`,{className:`relative z-10 flex w-full max-w-3xl flex-col items-center gap-10`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,U.jsx)($b,{}),(0,U.jsxs)(`div`,{className:`text-center`,children:[(0,U.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Plan Desk`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:d})]})]}),(0,U.jsxs)(`div`,{className:`w-full`,children:[(0,U.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,U.jsx)(`h2`,{className:`text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Workspaces`}),f?(0,U.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{s(!0)},children:[(0,U.jsx)(xb,{className:`size-3.5`}),` New workspace`]}):null]}),t.isLoading?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading workspaces…`}):t.error?(0,U.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load workspaces: `,t.error.message]}):u.length===0?(0,U.jsxs)(`p`,{className:`rounded-xl border border-dashed py-10 text-center text-sm text-muted-foreground`,children:[`No workspaces yet.`,f?` Create one to get started.`:``]}):(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:u.map(e=>{let t=m.get(e.id)??0,n=e.id===p;return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{h(e.id)},disabled:r.isPending,"aria-label":`Open workspace ${e.name}`,className:`group flex items-center gap-3 rounded-xl border bg-card p-4 text-left shadow-sm transition-all hover:-translate-y-px hover:border-[var(--border-strong)] hover:shadow-md focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,U.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-secondary text-foreground`,children:(0,U.jsx)(`span`,{"aria-hidden":!0,className:`text-sm font-semibold`,children:e.name.slice(0,1).toUpperCase()})}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:e.name}),(0,U.jsxs)(`span`,{className:`block text-xs text-muted-foreground tabular-nums`,children:[t,` `,t===1?`project`:`projects`]})]}),n?(0,U.jsx)(`span`,{className:`rounded-full border px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:`Active`}):null]},e.id)})})]})]}),(0,U.jsx)($x,{open:o,onOpenChange:s,children:(0,U.jsxs)(iS,{children:[(0,U.jsxs)(aS,{children:[(0,U.jsx)(sS,{children:`New workspace`}),(0,U.jsx)(cS,{children:`A new workspace starts empty. Pick it on the landing to add projects.`})]}),(0,U.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>void g(e),children:[(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(rw,{htmlFor:`new-workspace-name`,children:`Name`}),(0,U.jsx)(nw,{id:`new-workspace-name`,type:`text`,required:!0,value:c,onChange:e=>l(e.target.value),placeholder:`Fiji TV`,autoFocus:!0})]}),(0,U.jsxs)(oS,{children:[(0,U.jsx)(X,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:i.isPending,children:`Cancel`}),(0,U.jsx)(X,{type:`submit`,disabled:i.isPending||c.trim()===``,children:i.isPending?`Creating…`:`Create workspace`})]})]})]})})]})}var Cw=Ki(`/`)({component:Sw});function ww({...e}){return(0,U.jsx)($g,{"data-slot":`select`,...e})}function Tw({...e}){return(0,U.jsx)(r_,{"data-slot":`select-value`,...e})}function Ew({className:e,size:t=`default`,children:n,...r}){return(0,U.jsxs)(t_,{"data-slot":`select-trigger`,"data-size":t,className:Y(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,U.jsx)(a_,{asChild:!0,children:(0,U.jsx)(Qy,{className:`size-4 opacity-50`})})]})}function Dw({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,U.jsx)(l_,{children:(0,U.jsxs)(d_,{"data-slot":`select-content`,className:Y(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,U.jsx)(kw,{}),(0,U.jsx)(E_,{className:Y(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,U.jsx)(Aw,{})]})})}function Ow({className:e,children:t,...n}){return(0,U.jsxs)(I_,{"data-slot":`select-item`,className:Y(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,U.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,U.jsx)(B_,{children:(0,U.jsx)(Zy,{className:`size-4`})})}),(0,U.jsx)(R_,{children:t})]})}function kw({className:e,...t}){return(0,U.jsx)(H_,{"data-slot":`select-scroll-up-button`,className:Y(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(Xee,{className:`size-4`})})}function Aw({className:e,...t}){return(0,U.jsx)(W_,{"data-slot":`select-scroll-down-button`,className:Y(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(Qy,{className:`size-4`})})}function jw({project:e,workspaces:t}){let n=Yo().data?.role===`owner`,r=vC(),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(``),c=t.filter(t=>t.id!==e.workspace_id);if((0,H.useEffect)(()=>{i&&s(c[0]?.id??``)},[i]),!n||c.length===0)return null;async function l(){if(o!==``)try{await r.mutateAsync({projectId:e.id,workspaceId:o}),a(!1),BC(`Project moved`)}catch(e){e instanceof ja&&e.status===403&&BC.error(`You don't have permission to move this project.`)}}return(0,U.jsxs)($x,{open:i,onOpenChange:a,children:[(0,U.jsx)(eS,{asChild:!0,children:(0,U.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":`Move ${e.name} to another workspace`,onClick:e=>{e.preventDefault(),e.stopPropagation(),a(!0)},children:[(0,U.jsx)(Yee,{className:`size-3.5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Move`})]})}),(0,U.jsxs)(iS,{children:[(0,U.jsxs)(aS,{children:[(0,U.jsx)(sS,{children:`Move project`}),(0,U.jsxs)(cS,{children:[`Move `,(0,U.jsx)(`span`,{className:`font-medium`,children:e.name}),` to another workspace.`]})]}),(0,U.jsx)(`div`,{className:`grid gap-2 py-2`,children:(0,U.jsxs)(ww,{value:o,onValueChange:s,children:[(0,U.jsx)(Ew,{"aria-label":`Target workspace`,children:(0,U.jsx)(Tw,{placeholder:`Select a workspace`})}),(0,U.jsx)(Dw,{children:c.map(e=>(0,U.jsx)(Ow,{value:e.id,children:e.name},e.id))})]})}),(0,U.jsxs)(oS,{children:[(0,U.jsx)(nS,{asChild:!0,children:(0,U.jsx)(X,{variant:`outline`,children:`Cancel`})}),(0,U.jsx)(X,{onClick:()=>{l()},disabled:r.isPending||o===``,children:r.isPending?`Moving…`:`Move`})]})]})]})}function Mw(){let{data:e}=Yo(),t=e?.active_workspace?.id,n=e?.workspaces??[],{data:r,isLoading:i,error:a}=yS(),o=bS(),[s,c]=(0,H.useState)(``),l=r===void 0||t===void 0?r:r.filter(e=>e.workspace_id===t);function u(e){e.preventDefault();let n=s.trim();n!==``&&o.mutate({name:n,...t===void 0?{}:{workspace_id:t}},{onSuccess:()=>{c(``),BC(`Project created`)}})}return i?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading projects…`}):a?(0,U.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load projects: `,a.message]}):(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 py-5 pb-10`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-3xl`,children:[(0,U.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-baseline gap-2.5`,children:[(0,U.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight`,children:`Projects`}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?.active_workspace?.name??`Your workspaces`})]}),(0,U.jsxs)(`form`,{onSubmit:u,className:`mb-6 flex gap-2`,children:[(0,U.jsx)(nw,{type:`text`,value:s,onChange:e=>{c(e.target.value)},placeholder:`New project name`,"aria-label":`Project name`,className:`flex-1`}),(0,U.jsx)(X,{type:`submit`,disabled:o.isPending||s.trim()===``,children:o.isPending?`Creating…`:`Create project`})]}),o.isError?(0,U.jsxs)(`p`,{role:`alert`,className:`mb-4 text-sm text-destructive`,children:[`Failed to create project: `,o.error.message]}):null,l!==void 0&&l.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No projects yet. Create one above.`}):(0,U.jsx)(`div`,{className:`grid gap-2`,children:l?.map(e=>(0,U.jsx)(Bi,{to:`/projects/$id/overview`,params:{id:e.id},className:`block`,children:(0,U.jsxs)(Jb,{className:`flex items-start gap-3 border p-3.5 shadow-sm transition-colors hover:border-border hover:bg-muted/30`,children:[(0,U.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,U.jsx)(nb,{className:`size-4`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`p`,{className:`text-[13px] font-semibold leading-snug`,children:e.name}),e.description?(0,U.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-muted-foreground`,children:e.description}):null]}),(0,U.jsx)(jw,{project:e,workspaces:n})]})},e.id))})]})})}var Nw=Ki(`/projects/`)({component:Mw});function Pw({workspaceId:e,workspaceName:t}){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(!1),[f,p]=(0,H.useState)(null),[m,h]=(0,H.useState)(!1),g=()=>{a(``),s(!1),l(null),p(null),h(!1)};return(0,U.jsxs)($x,{open:n,onOpenChange:e=>{r(e),e||g()},children:[(0,U.jsx)(eS,{asChild:!0,children:(0,U.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":`Share ${t} with a client`,"data-workspace-share-trigger":e,children:[(0,U.jsx)(Tb,{className:`size-3.5`}),` Share`]})}),(0,U.jsxs)(iS,{className:`sm:max-w-md`,children:[(0,U.jsxs)(aS,{children:[(0,U.jsxs)(sS,{children:[`Share “`,t,`” with a client`]}),(0,U.jsxs)(cS,{children:[`Create a portal link showing every project in this workspace. Read-only`,o?` with issue submission.`:`.`]})]}),c===null?(0,U.jsxs)(`div`,{className:`grid gap-3`,children:[(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`workspace-share-audience`,children:`Audience name`}),(0,U.jsx)(nw,{id:`workspace-share-audience`,type:`text`,placeholder:`Client name`,value:i,onChange:e=>{a(e.target.value)}})]}),(0,U.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,U.jsx)(`span`,{children:`Allow the client to submit issues`}),(0,U.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>{s(e.target.checked)},className:`size-4 accent-[var(--primary)]`})]}),(0,U.jsx)(X,{type:`button`,onClick:async()=>{d(!0),p(null);try{l({url:(await Ha(e,{audience_name:i.trim(),mode:`public`,submit:o})).url})}catch(e){e instanceof ja&&e.status===404?p(`Workspace not found.`):p(`Couldn't create the share link. Please try again.`)}finally{d(!1)}},disabled:u||i.trim()===``,children:u?`Creating…`:`Create link`})]}):null,f===null?null:(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:f}),c===null?null:(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(nw,{readOnly:!0,value:c.url,className:`mono text-xs`,onFocus:e=>{e.currentTarget.select()}}),(0,U.jsx)(X,{type:`button`,variant:`secondary`,size:`icon-sm`,"aria-label":`Copy link`,onClick:async()=>{if(c!==null)try{await navigator.clipboard.writeText(c.url),h(!0),BC(`Link copied`),setTimeout(()=>{h(!1)},1500)}catch{BC.error(`Couldn't copy — copy it manually.`)}},children:m?(0,U.jsx)(Zy,{className:`size-3.5`}):(0,U.jsx)(eb,{className:`size-3.5`})})]}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Anyone with this link can view this workspace's projects. Read-only.`})]})]})]})}function Fw(){let e=Yo(),t=e.data?.role===`owner`,n=es(),r=fC(),i=pC(),a=mC(),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(null);async function u(e){if(e.preventDefault(),t)try{await r.mutateAsync(o.trim()),s(``),BC(`Workspace created`)}catch(e){e instanceof ja&&e.status===403&&BC.error(`You don't have permission to create workspaces.`)}}async function d(){if(!(c===null||c.name.trim()===``))try{await i.mutateAsync({teamId:c.id,name:c.name.trim()}),l(null),BC(`Workspace renamed`)}catch(e){e instanceof ja&&e.status===403&&BC.error(`You don't have permission to rename workspaces.`)}}async function f(e){if(t&&window.confirm(`Delete this workspace? Projects in it are not deleted but become orphaned.`))try{await a.mutateAsync(e),BC(`Workspace deleted`)}catch(e){e instanceof ja&&e.status===403&&BC.error(`You don't have permission to delete workspaces.`)}}return e.isLoading?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading session…`}):(0,U.jsxs)(`div`,{className:`grid max-w-3xl gap-6`,children:[(0,U.jsxs)(Jb,{children:[(0,U.jsxs)(Yb,{className:`border-b pb-4`,children:[(0,U.jsx)(Xb,{className:`text-sm font-semibold`,children:`Workspaces`}),(0,U.jsx)(Zb,{children:`Each workspace groups projects and members. New projects land in the active workspace.`})]}),(0,U.jsxs)(Qb,{className:`pt-4`,children:[n.isLoading?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading workspaces…`}):null,n.isError?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Failed to load workspaces.`}):null,n.data===void 0?null:n.data.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No workspaces yet.`}):(0,U.jsx)(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:n.data.map(n=>{let r=e.data?.active_workspace?.id===n.id;return(0,U.jsx)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 py-2.5 text-sm`,children:c!==null&&c.id===n.id?(0,U.jsxs)(`div`,{className:`flex flex-1 flex-wrap items-center gap-2`,children:[(0,U.jsx)(nw,{"aria-label":`Rename ${n.name}`,value:c.name,onChange:e=>l({id:n.id,name:e.target.value}),className:`max-w-xs`}),(0,U.jsx)(X,{size:`sm`,onClick:()=>{d()},disabled:i.isPending||c.name.trim()===``,children:`Save`}),(0,U.jsx)(X,{size:`sm`,variant:`ghost`,onClick:()=>{l(null)},children:`Cancel`})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`span`,{className:`truncate font-medium`,children:n.name}),r?(0,U.jsx)(`span`,{className:`ml-2 rounded-full bg-muted px-2 py-0.5 text-xs font-medium`,children:`Active`}):null]}),t?(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(Pw,{workspaceId:n.id,workspaceName:n.name}),(0,U.jsx)(X,{variant:`ghost`,size:`sm`,"aria-label":`Rename ${n.name}`,onClick:()=>{l({id:n.id,name:n.name})},children:`Rename`}),(0,U.jsx)(X,{variant:`ghost`,size:`sm`,"aria-label":`Delete ${n.name}`,disabled:a.isPending,onClick:()=>{f(n.id)},children:`Delete`})]}):null]})},n.id)})})]})]}),t?(0,U.jsxs)(Jb,{children:[(0,U.jsxs)(Yb,{className:`border-b pb-4`,children:[(0,U.jsx)(Xb,{className:`text-sm font-semibold`,children:`Create workspace`}),(0,U.jsx)(Zb,{children:`A new workspace starts empty. Invite members from its tab.`})]}),(0,U.jsx)(Qb,{className:`pt-4`,children:(0,U.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>void u(e),children:[(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(rw,{htmlFor:`workspace-name`,children:`Name`}),(0,U.jsx)(nw,{id:`workspace-name`,type:`text`,required:!0,value:o,onChange:e=>s(e.target.value),placeholder:`Fiji TV`})]}),(0,U.jsx)(X,{type:`submit`,disabled:r.isPending||o.trim()===``,children:r.isPending?`Creating…`:`Create workspace`})]})})]}):null]})}function Iw(){let e=Yo(),t=e.data?.role,n=t===`owner`,r=t===`owner`||t===`admin`,i=e.data?.org?.id,a=e.data?.active_workspace?.id,o=e.data?.active_workspace?.name,s=hC(a),c=$S(i),l=gC(a),u=_C(a),d=eC(i),[f,p]=(0,H.useState)(``),[m,h]=(0,H.useState)(`member`),[g,_]=(0,H.useState)(null),[v,y]=(0,H.useState)(!1),b=new Set(s.data?.map(e=>e.userId)),x=new Map((c.data?.members??[]).map(e=>[e.userId,{name:e.name,email:e.email,role:e.role}])),S=(c.data?.members??[]).filter(e=>!b.has(e.userId));async function C(e){e.preventDefault();let t=e.currentTarget,n=new FormData(t).get(`userId`);if(!(typeof n!=`string`||n.length===0))try{await l.mutateAsync(n),t.reset(),BC(`Member added`)}catch(e){e instanceof ja&&e.status===403&&BC.error(`You don't have permission to manage workspace members.`)}}async function w(e){if(n&&window.confirm(`Remove this member from the workspace?`))try{await u.mutateAsync(e),BC(`Member removed`)}catch(e){e instanceof ja&&e.status===403&&BC.error(`You don't have permission to manage workspace members.`)}}async function T(e){if(e.preventDefault(),!(!r||a===void 0))try{_((await d.mutateAsync({email:f.trim(),role:m,teamId:a})).claimUrl),y(!1),p(``),BC(`Invitation created`)}catch{}}async function E(){if(g!==null)try{await navigator.clipboard.writeText(g),y(!0),window.setTimeout(()=>{y(!1)},1500)}catch{BC.error(`Couldn't copy — copy it manually.`)}}return e.isLoading?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading session…`}):a===void 0?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-muted-foreground`,children:`Select a workspace to manage its members.`}):(0,U.jsxs)(`div`,{className:`grid max-w-3xl gap-6`,children:[(0,U.jsxs)(Jb,{children:[(0,U.jsxs)(Yb,{className:`border-b pb-4`,children:[(0,U.jsx)(Xb,{className:`text-sm font-semibold`,children:`Workspace members`}),(0,U.jsx)(Zb,{children:`People with access to the active workspace and its projects.`})]}),(0,U.jsxs)(Qb,{className:`pt-4`,children:[s.isLoading?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading members…`}):null,s.isError?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Failed to load workspace members.`}):null,s.data===void 0?null:s.data.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No members yet.`}):(0,U.jsx)(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:s.data.map(e=>{let t=x.get(e.userId);return(0,U.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 py-2.5 text-sm`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`truncate font-medium`,children:t?.name||t?.email||e.userId}),t?.email?(0,U.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:t.email}):null]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t?.role?(0,U.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-xs font-medium capitalize`,children:t.role}):null,n?(0,U.jsx)(X,{variant:`ghost`,size:`sm`,"aria-label":`Remove member ${t?.name??e.userId}`,disabled:u.isPending,onClick:()=>{w(e.userId)},children:`Remove`}):null]})]},e.id)})})]})]}),r?(0,U.jsxs)(Jb,{children:[(0,U.jsxs)(Yb,{className:`border-b pb-4`,children:[(0,U.jsx)(Xb,{className:`text-sm font-semibold`,children:`Invite to workspace`}),(0,U.jsxs)(Zb,{children:[o!==void 0&&o.length>0?`Invite a new person to ${o}. `:`Invite a new person to this workspace. `,`Plan Desk creates a claim link — it does not send email.`]})]}),(0,U.jsx)(Qb,{className:`pt-4`,children:(0,U.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>void T(e),children:[(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(rw,{htmlFor:`workspace-invite-email`,children:`Email`}),(0,U.jsx)(nw,{id:`workspace-invite-email`,type:`email`,autoComplete:`email`,required:!0,value:f,onChange:e=>p(e.target.value),placeholder:`teammate@example.com`})]}),(0,U.jsxs)(`div`,{className:`grid gap-2`,children:[(0,U.jsx)(rw,{htmlFor:`workspace-invite-role`,children:`Role`}),(0,U.jsxs)(ww,{value:m,onValueChange:e=>h(e),children:[(0,U.jsx)(Ew,{id:`workspace-invite-role`,className:`w-full`,children:(0,U.jsx)(Tw,{})}),(0,U.jsxs)(Dw,{children:[(0,U.jsx)(Ow,{value:`member`,children:`Member`}),(0,U.jsx)(Ow,{value:`admin`,children:`Admin`})]})]})]}),(0,U.jsx)(X,{type:`submit`,disabled:d.isPending||f.trim()===``,children:d.isPending?`Inviting…`:`Invite`}),d.isError?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:d.error instanceof ja&&d.error.status===403?`You do not have permission to invite members.`:`Failed to create invitation.`}):null]})})]}):null,g===null?null:(0,U.jsxs)(Jb,{className:`border-[var(--s-prog-dot)] bg-[var(--s-prog-bg)]`,children:[(0,U.jsxs)(Yb,{children:[(0,U.jsx)(Xb,{className:`text-sm font-semibold text-[var(--s-prog-fg)]`,children:`Claim link`}),(0,U.jsx)(Zb,{className:`text-[var(--s-prog-fg)]/80`,children:`Invites are link-only. Copy this URL and send it to the invitee yourself.`})]}),(0,U.jsxs)(Qb,{className:`grid gap-3`,children:[(0,U.jsx)(`code`,{className:`block break-all rounded-md border border-border bg-card px-3 py-2.5 font-mono text-xs`,children:g}),(0,U.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,className:`w-fit`,onClick:()=>{E()},children:v?`Copied`:`Copy claim link`})]})]}),n?(0,U.jsxs)(Jb,{children:[(0,U.jsxs)(Yb,{className:`border-b pb-4`,children:[(0,U.jsx)(Xb,{className:`text-sm font-semibold`,children:`Add member`}),(0,U.jsx)(Zb,{children:`Add an existing org member to this workspace.`})]}),(0,U.jsx)(Qb,{className:`pt-4`,children:(0,U.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>void C(e),children:[(0,U.jsxs)(ww,{name:`userId`,disabled:l.isPending||S.length===0,children:[(0,U.jsx)(Ew,{id:`workspace-add-member`,"aria-label":`Member to add`,children:(0,U.jsx)(Tw,{placeholder:S.length===0?`Everyone is already a member`:`Select a member`})}),(0,U.jsx)(Dw,{children:S.map(e=>(0,U.jsx)(Ow,{value:e.userId,children:e.name||e.email||e.userId},e.userId))})]}),(0,U.jsx)(X,{type:`submit`,disabled:l.isPending||S.length===0,children:l.isPending?`Adding…`:`Add to workspace`})]})})]}):null]})}function Lw(){return(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 py-5 pb-10`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-3xl`,children:[(0,U.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-baseline gap-2.5`,children:[(0,U.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight`,children:`Workspaces`}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Create workspaces and manage who belongs to the active one.`})]}),(0,U.jsxs)(`nav`,{className:`mb-6 flex flex-wrap gap-3 text-sm`,"aria-label":`Settings sections`,children:[(0,U.jsx)(Bi,{to:`/settings/members`,className:`text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:`Members`}),(0,U.jsx)(Bi,{to:`/settings/workspaces`,className:`font-medium text-foreground underline-offset-4`,children:`Workspaces`}),(0,U.jsx)(Bi,{to:`/settings/mcp`,className:`text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:`MCP / CLI token`})]}),(0,U.jsx)(`div`,{className:`mb-10`,children:(0,U.jsx)(Fw,{})}),(0,U.jsx)(`div`,{className:`mb-10`,children:(0,U.jsx)(Iw,{})})]})})}var Rw=Ki(`/settings/workspaces`)({component:Lw});function zw(){let e=Yo(),t=e.data?.org?.id,n=$S(t);return e.isLoading?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading session…`}):t===void 0?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-muted-foreground`,children:`Sign in to an organization to view members.`}):(0,U.jsx)(`div`,{className:`grid max-w-3xl gap-6`,children:(0,U.jsxs)(Jb,{children:[(0,U.jsxs)(Yb,{className:`border-b pb-4`,children:[(0,U.jsx)(Xb,{className:`text-sm font-semibold`,children:`Members`}),(0,U.jsx)(Zb,{children:`Everyone in this organization. Invite to a specific workspace from the Workspaces tab.`})]}),(0,U.jsxs)(Qb,{className:`pt-4`,children:[n.isLoading?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading members…`}):null,n.isError?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Failed to load members.`}):null,n.data===void 0?null:n.data.members.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No members yet.`}):(0,U.jsx)(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:n.data.members.map(e=>(0,U.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 py-2.5 text-sm`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`truncate font-medium`,children:e.name||e.email||e.userId}),e.email?(0,U.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.email}):null]}),(0,U.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-xs font-medium capitalize`,children:e.role})]},e.id))})]})]})})}function Bw(){return(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 py-5 pb-10`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-3xl`,children:[(0,U.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-baseline gap-2.5`,children:[(0,U.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight`,children:`Members`}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Invite teammates and review org membership.`})]}),(0,U.jsxs)(`nav`,{className:`mb-6 flex flex-wrap gap-3 text-sm`,"aria-label":`Settings sections`,children:[(0,U.jsx)(Bi,{to:`/settings/members`,className:`font-medium text-foreground underline-offset-4`,children:`Members`}),(0,U.jsx)(Bi,{to:`/settings/workspaces`,className:`text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:`Workspaces`}),(0,U.jsx)(Bi,{to:`/settings/mcp`,className:`text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:`MCP / CLI token`})]}),(0,U.jsx)(`div`,{className:`mb-10`,children:(0,U.jsx)(zw,{})})]})})}var Vw=Ki(`/settings/members`)({component:Bw});function Hw(){let e=QS(),[t,n]=(0,H.useState)(null),[r,i]=(0,H.useState)(!1);async function a(){n((await e.mutateAsync(void 0)).token),i(!1),BC(`CLI token created`)}async function o(){if(t!==null)try{await navigator.clipboard.writeText(t),i(!0),window.setTimeout(()=>{i(!1)},1500)}catch{BC.error(`Couldn't copy — copy it manually.`)}}return(0,U.jsxs)(`div`,{className:`grid max-w-3xl gap-6`,children:[(0,U.jsxs)(Jb,{children:[(0,U.jsxs)(Yb,{className:`border-b pb-4`,children:[(0,U.jsx)(Xb,{className:`text-sm font-semibold`,children:`CLI token`}),(0,U.jsxs)(Zb,{children:[`Generate an org-wide owner token for the Plan Desk CLI. Paste it into`,` `,(0,U.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-xs`,children:`plandesk login`}),`.`]})]}),(0,U.jsxs)(Qb,{className:`pt-4`,children:[(0,U.jsx)(X,{type:`button`,onClick:()=>{a()},disabled:e.isPending,children:e.isPending?`Generating…`:`Generate CLI token`}),e.isError?(0,U.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:`Failed to generate CLI token. You may need owner access.`}):null]})]}),t===null?null:(0,U.jsxs)(Jb,{className:`border-[var(--s-prog-dot)] bg-[var(--s-prog-bg)]`,children:[(0,U.jsxs)(Yb,{children:[(0,U.jsx)(Xb,{className:`text-sm font-semibold text-[var(--s-prog-fg)]`,children:`Copy your token now`}),(0,U.jsxs)(Zb,{className:`text-[var(--s-prog-fg)]/80`,children:[`You won't see this again. Store it securely, then run`,` `,(0,U.jsx)(`code`,{className:`rounded bg-card/50 px-1 py-0.5 text-xs`,children:`plandesk login`}),` and paste the token when prompted.`]})]}),(0,U.jsxs)(Qb,{className:`grid gap-3`,children:[(0,U.jsx)(`code`,{className:`block break-all rounded-md border border-border bg-card px-3 py-2.5 font-mono text-xs`,children:t}),(0,U.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,className:`w-fit`,onClick:()=>{o()},children:r?`Copied`:`Copy token`})]})]})]})}function Uw(){return`plandesk login --server ${typeof window<`u`?window.location.origin:``}\nplandesk connect --to <org>`}function Ww(){let[e,t]=(0,H.useState)(!1),n=Uw();async function r(){try{await navigator.clipboard.writeText(n),t(!0),window.setTimeout(()=>{t(!1)},1500)}catch{BC.error(`Couldn't copy — copy it manually.`)}}return(0,U.jsxs)(Jb,{className:`mb-6`,children:[(0,U.jsxs)(Yb,{className:`border-b pb-4`,children:[(0,U.jsx)(Xb,{className:`text-sm font-semibold`,children:`Connect an agent (MCP)`}),(0,U.jsx)(Zb,{children:`Point the Plan Desk CLI at this server, then connect it to your organization so agents can use the MCP tools.`})]}),(0,U.jsxs)(Qb,{className:`grid gap-3 pt-4`,children:[(0,U.jsx)(`code`,{className:`block whitespace-pre-wrap break-all rounded-md border border-border bg-muted/40 px-3 py-2.5 font-mono text-xs`,children:n}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,U.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,className:`w-fit`,onClick:()=>{r()},children:e?`Copied`:`Copy commands`}),(0,U.jsx)(`a`,{href:`https://plandesk.asyncdot.com/connecting-agents/mcp-setup/`,target:`_blank`,rel:`noreferrer`,className:`text-sm text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:`MCP setup docs`})]})]})]})}function Gw(){return(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 py-5 pb-10`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-3xl`,children:[(0,U.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-baseline gap-2.5`,children:[(0,U.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight`,children:`MCP Settings`}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:"Mint a CLI owner key for `plandesk login`, or connect agents with `plandesk connect`."})]}),(0,U.jsxs)(`nav`,{className:`mb-6 flex flex-wrap gap-3 text-sm`,"aria-label":`Settings sections`,children:[(0,U.jsx)(Bi,{to:`/settings/members`,className:`text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:`Members`}),(0,U.jsx)(Bi,{to:`/settings/workspaces`,className:`text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:`Workspaces`}),(0,U.jsx)(Bi,{to:`/settings/mcp`,className:`font-medium text-foreground underline-offset-4`,children:`MCP / CLI token`})]}),(0,U.jsx)(Ww,{}),(0,U.jsx)(`div`,{className:`mb-10`,children:(0,U.jsx)(Hw,{})})]})})}var Kw=Ki(`/settings/mcp`)({component:Gw}),qw=``;function Jw(e){return`plandesk_portal_session_${e}`}function Yw(){return typeof window<`u`&&window.localStorage!==void 0}var Xw=class extends Error{constructor(){super(`This share link is invalid, expired, or has been revoked.`),this.name=`PortalUnauthorizedError`}},Zw=class extends Error{constructor(){super(`This project has not been published to the portal yet.`),this.name=`PortalNotReadyError`}},Qw=class extends Error{constructor(e){super(e),this.name=`PortalJoinError`}},$w=class extends Error{constructor(){super(`That email isn't on the invite list for this share.`),this.name=`PortalEmailNotInvitedError`}},eT=class extends Error{constructor(){super(`This share does not allow submitting issues.`),this.name=`PortalSubmitForbiddenError`}},tT=class extends Error{constructor(){super(`You're sending these too fast — try again in a moment.`),this.name=`PortalRateLimitedError`}},nT=class extends Error{constructor(e){super(e),this.name=`PortalSubmitFieldError`}};function rT(e){return Yw()?window.localStorage.getItem(Jw(e)):null}function iT(e,t){Yw()&&window.localStorage.setItem(Jw(e),t)}function aT(e){Yw()&&window.localStorage.removeItem(Jw(e))}function oT(e){if(`kind`in e&&e.kind===`workspace`)return{kind:`workspace`,workspace:e.workspace,projects:e.projects,share:e.share};let t=e.audience_name??e.share.audience_name,n=e.permissions??e.share.permissions;return{project:e.project,tasks:e.tasks,edges:e.edges,documents:e.documents,progress:e.progress,share:{audience_name:t,permissions:n,expires_at:e.share.expires_at}}}async function sT(e){let t=await fetch(`${qw}/api/v1/share/${encodeURIComponent(e)}/meta`);if(t.status===401||t.status===404)throw new Xw;if(!t.ok)throw Error(`Portal error ${String(t.status)}: ${await t.text()}`);return await t.json()}async function cT(e,t){let n=await fetch(`${qw}/api/v1/share/${encodeURIComponent(e)}/join`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(n.status===401)throw new Xw;if(n.status===400)throw(await n.json()).error===`name_required`?new Qw(`Name is required.`):new Qw(`Unable to join. Please check your details and try again.`);if(n.status===403)throw(await n.json()).error===`email_not_invited`?new $w:new Qw(`Unable to join. Please check your details and try again.`);if(!n.ok)throw Error(`Portal error ${String(n.status)}: ${await n.text()}`);return await n.json()}async function lT(e,t){let n=await fetch(`${qw}/api/v1/share/${encodeURIComponent(e)}/view`,{headers:{Authorization:`Bearer ${t}`}});if(n.status===401)throw new Xw;if(n.status===404)throw new Zw;if(!n.ok)throw Error(`Portal error ${String(n.status)}: ${await n.text()}`);return oT(await n.json())}async function uT(e,t,n){let r=await fetch(`${qw}/api/v1/share/${encodeURIComponent(e)}/submissions`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify(n)});if(r.status===401)throw new Xw;if(r.status===403)throw new eT;if(r.status===429)throw new tT;if(r.status===400){let e=await r.json();throw e.error===`title_required`?new nT(`Title is required.`):e.error===`project_required`?new nT(`Please choose a project for this issue.`):new nT(`Unable to submit. Please check your details and try again.`)}if(!r.ok)throw Error(`Portal error ${String(r.status)}: ${await r.text()}`);return(await r.json()).submission}async function dT(e,t){let n=await fetch(`${qw}/api/v1/share/${encodeURIComponent(e)}/submissions`,{headers:{Authorization:`Bearer ${t}`}});if(n.status===401)throw new Xw;if(!n.ok)throw Error(`Portal error ${String(n.status)}: ${await n.text()}`);return await n.json()}function fT({shareToken:e,onJoined:t}){let[n,r]=(0,H.useState)(``),[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(!0),[f,p]=(0,H.useState)(null),[m,h]=(0,H.useState)(null);(0,H.useEffect)(()=>{let t=!1;async function n(){d(!0),p(null);try{let n=await sT(e);t||l(n)}catch(e){t||(e instanceof Xw?p(e.message):p(e instanceof Error?e.message:`Something went wrong. Please try again.`))}finally{t||d(!1)}}return n(),()=>{t=!0}},[e]);let g=n.trim(),_=i.trim(),v=c?.mode===`invite`,y=g.length>0&&(!v||_.length>0)&&!o&&!u;async function b(n){if(n.preventDefault(),y){s(!0),p(null),h(null);try{t((await cT(e,{name:g,email:_===``?void 0:_})).session_token)}catch(e){e instanceof Xw?p(e.message):e instanceof $w||e instanceof Qw?h(e.message):p(e instanceof Error?e.message:`Something went wrong. Please try again.`)}finally{s(!1)}}}return(0,U.jsx)(`section`,{"aria-label":`Join shared project`,className:`mx-auto max-w-md px-5 py-8`,children:(0,U.jsxs)(Jb,{className:`shadow-sm`,children:[(0,U.jsxs)(Yb,{children:[(0,U.jsx)(`p`,{className:`mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Plan Desk`}),(0,U.jsx)(`h1`,{className:`text-xl font-semibold leading-none`,children:c?.audience_name??`Join shared project`}),(0,U.jsx)(Zb,{children:u?`Loading share details…`:v?`Enter your name and invited email to view this read-only plan.`:`Enter your name to view this read-only plan.`})]}),(0,U.jsxs)(Qb,{children:[f===null?null:(0,U.jsx)(`p`,{role:`alert`,className:`mb-4 text-sm text-destructive`,children:f}),f!==null&&f.includes(`invalid, expired, or has been revoked`)?(0,U.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:`Ask whoever shared this link to send you a new one.`}):null,(0,U.jsxs)(`form`,{onSubmit:e=>{b(e)},className:`grid gap-4`,children:[(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`portal-name`,children:`Name`}),(0,U.jsx)(nw,{id:`portal-name`,type:`text`,name:`name`,value:n,onChange:e=>{r(e.target.value)},autoComplete:`name`,required:!0,disabled:u||f!==null}),m!==null&&!v?(0,U.jsx)(`span`,{role:`alert`,className:`text-xs text-destructive`,children:m}):null]}),(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsxs)(rw,{htmlFor:`portal-email`,children:[v?`Invited email`:`Email`,` `,v?null:(0,U.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,U.jsx)(nw,{id:`portal-email`,type:`email`,name:`email`,value:i,onChange:e=>{a(e.target.value)},autoComplete:`email`,required:v,disabled:u||f!==null}),v?(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Use the email your invite was sent to.`}):null,m!==null&&v?(0,U.jsx)(`span`,{role:`alert`,className:`text-xs text-destructive`,children:m}):null]}),(0,U.jsx)(X,{type:`submit`,disabled:!y||f!==null,children:o?`Joining…`:`Join`})]})]})]})})}function pT(e){let t=[];return e.read&&t.push(`read`),e.submit&&t.push(`submit`),t}function mT(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var hT=mT();function gT(e){hT=e}var _T={exec:()=>null};function vT(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function yT(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(xT.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var bT=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),xT={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,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,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:vT(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:vT(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:vT(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:vT(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:vT(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:vT(e=>RegExp(`^ {0,${e}}>`))},ST=/^(?:[ \t]*(?:\n|$))+/,CT=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,wT=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,TT=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ET=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,DT=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,OT=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,kT=yT(OT).replace(/bull/g,DT).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(),AT=yT(OT).replace(/bull/g,DT).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(),jT=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,MT=/^[^\n]+/,NT=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,PT=yT(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,NT).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),FT=yT(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,DT).getRegex(),IT=`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`,LT=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,RT=yT(`^ {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`,LT).replace(`tag`,IT).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),zT=yT(jT).replace(`hr`,TT).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[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,IT).getRegex(),BT={blockquote:yT(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,zT).getRegex(),code:CT,def:PT,fences:wT,heading:ET,hr:TT,html:RT,lheading:kT,list:FT,newline:ST,paragraph:zT,table:_T,text:MT},VT=yT(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,TT).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[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,IT).getRegex(),HT={...BT,lheading:AT,table:VT,paragraph:yT(jT).replace(`hr`,TT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,VT).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,IT).getRegex()},UT={...BT,html:yT(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,LT).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:_T,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:yT(jT).replace(`hr`,TT).replace(`heading`,` *#{1,6} *[^
|
|
50
|
+
]`).replace(`lheading`,kT).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},WT=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,GT=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,KT=/^( {2,}|\\)\n(?!\s*$)/,qT=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,JT=/[\p{P}\p{S}]/u,YT=/[\s\p{P}\p{S}]/u,XT=/[^\s\p{P}\p{S}]/u,ZT=yT(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,YT).getRegex(),QT=/(?!~)[\p{P}\p{S}]/u,fte=/(?!~)[\s\p{P}\p{S}]/u,pte=/(?:[^\s\p{P}\p{S}]|~)/u,mte=yT(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,bT?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),$T=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,hte=yT($T,`u`).replace(/punct/g,JT).getRegex(),gte=yT($T,`u`).replace(/punct/g,QT).getRegex(),eE=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,_te=yT(eE,`gu`).replace(/notPunctSpace/g,XT).replace(/punctSpace/g,YT).replace(/punct/g,JT).getRegex(),vte=yT(eE,`gu`).replace(/notPunctSpace/g,pte).replace(/punctSpace/g,fte).replace(/punct/g,QT).getRegex(),yte=yT(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,XT).replace(/punctSpace/g,YT).replace(/punct/g,JT).getRegex(),bte=yT(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,JT).getRegex(),xte=yT(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,XT).replace(/punctSpace/g,YT).replace(/punct/g,JT).getRegex(),Ste=yT(/\\(punct)/,`gu`).replace(/punct/g,JT).getRegex(),Cte=yT(/^<(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(),wte=yT(LT).replace(`(?:-->|$)`,`-->`).getRegex(),Tte=yT(`^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`,wte).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),tE=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ete=yT(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,tE).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nE=yT(/^!?\[(label)\]\[(ref)\]/).replace(`label`,tE).replace(`ref`,NT).getRegex(),rE=yT(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,NT).getRegex(),Dte=yT(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,nE).replace(`nolink`,rE).getRegex(),iE=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,aE={_backpedal:_T,anyPunctuation:Ste,autolink:Cte,blockSkip:mte,br:KT,code:GT,del:_T,delLDelim:_T,delRDelim:_T,emStrongLDelim:hte,emStrongRDelimAst:_te,emStrongRDelimUnd:yte,escape:WT,link:Ete,nolink:rE,punctuation:ZT,reflink:nE,reflinkSearch:Dte,tag:Tte,text:qT,url:_T},Ote={...aE,link:yT(/^!?\[(label)\]\((.*?)\)/).replace(`label`,tE).getRegex(),reflink:yT(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,tE).getRegex()},oE={...aE,emStrongRDelimAst:vte,emStrongLDelim:gte,delLDelim:bte,delRDelim:xte,url:yT(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,iE).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:yT(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,iE).getRegex()},kte={...oE,br:yT(KT).replace(`{2,}`,`*`).getRegex(),text:yT(oE.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},sE={normal:BT,gfm:HT,pedantic:UT},cE={normal:aE,gfm:oE,breaks:kte,pedantic:Ote},Ate={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},lE=e=>Ate[e];function uE(e,t){if(t){if(xT.escapeTest.test(e))return e.replace(xT.escapeReplace,lE)}else if(xT.escapeTestNoEncode.test(e))return e.replace(xT.escapeReplaceNoEncode,lE);return e}function dE(e){try{e=encodeURI(e).replace(xT.percentDecode,`%`)}catch{return null}return e}function fE(e,t){let n=e.replace(xT.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(xT.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(xT.slashPipe,`|`);return n}function pE(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function mE(e){let t=e.split(`
|
|
51
|
+
`),n=t.length-1;for(;n>=0&&xT.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
52
|
+
`)}function jte(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Mte(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function hE(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Nte(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
53
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
54
|
+
`)}var gE=class{options;rules;lexer;constructor(e){this.options=e||hT}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:mE(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Nte(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=pE(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:pE(t[0],`
|
|
55
|
+
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:pE(t[0],`
|
|
56
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=pE(t[0],`
|
|
57
|
+
`).split(`
|
|
58
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
59
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
60
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
61
|
+
${s}`:s,r=r?`${r}
|
|
62
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
63
|
+
`+e.join(`
|
|
64
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
65
|
+
`+e.join(`
|
|
66
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
67
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=Mte(t[2].split(`
|
|
68
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
69
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
70
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
71
|
+
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
72
|
+
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
73
|
+
`+l}u=!l.trim(),r+=p+`
|
|
74
|
+
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=mE(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:pE(t[0],`
|
|
75
|
+
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=fE(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
76
|
+
`):[],a={type:`table`,raw:pE(t[0],`
|
|
77
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(fE(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:pE(t[0],`
|
|
78
|
+
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
79
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=pE(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=jte(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),hE(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return hE(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},_E=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||hT,this.options.tokenizer=this.options.tokenizer||new gE,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 t={other:xT,block:sE.normal,inline:cE.normal};this.options.pedantic?(t.block=sE.pedantic,t.inline=cE.pedantic):this.options.gfm&&(t.block=sE.gfm,this.options.breaks?t.inline=cE.breaks:t.inline=cE.gfm),this.tokenizer.rules=t}static get rules(){return{block:sE,inline:cE}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(xT.carriageReturn,`
|
|
80
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(xT.tabCharGlobal,` `).replace(xT.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
81
|
+
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
82
|
+
`)?``:`
|
|
83
|
+
`)+i.raw,n.text+=`
|
|
84
|
+
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
85
|
+
`)?``:`
|
|
86
|
+
`)+i.raw,n.text+=`
|
|
87
|
+
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
88
|
+
`)?``:`
|
|
89
|
+
`)+i.raw,r.text+=`
|
|
90
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
91
|
+
`)?``:`
|
|
92
|
+
`)+i.raw,n.text+=`
|
|
93
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},vE=class{options;parser;constructor(e){this.options=e||hT}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(xT.notSpaceStart)?.[0],i=e.replace(xT.endingNewline,``)+`
|
|
94
|
+
`;return r?`<pre><code class="language-`+uE(r)+`">`+(n?i:uE(i,!0))+`</code></pre>
|
|
95
|
+
`:`<pre><code>`+(n?i:uE(i,!0))+`</code></pre>
|
|
96
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
97
|
+
${this.parser.parse(e)}</blockquote>
|
|
98
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
99
|
+
`}hr(e){return`<hr>
|
|
100
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
101
|
+
`+r+`</`+i+`>
|
|
102
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
103
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
104
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
105
|
+
<thead>
|
|
106
|
+
`+t+`</thead>
|
|
107
|
+
`+r+`</table>
|
|
108
|
+
`}tablerow({text:e}){return`<tr>
|
|
109
|
+
${e}</tr>
|
|
110
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
111
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${uE(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=dE(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+uE(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=dE(e);if(i===null)return uE(n);e=i;let a=`<img src="${e}" alt="${uE(n)}"`;return t&&(a+=` title="${uE(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:uE(e.text)}},yE=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},bE=class e{options;renderer;textRenderer;constructor(e){this.options=e||hT,this.options.renderer=this.options.renderer||new vE,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new yE}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},xE=class{options;block;constructor(e){this.options=e||hT}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?_E.lex:_E.lexInline}provideParser(e=this.block){return e?bE.parse:bE.parseInline}},SE=new class{defaults=mT();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=bE;Renderer=vE;TextRenderer=yE;Lexer=_E;Tokenizer=gE;Hooks=xE;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new vE(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new gE(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new xE;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];xE.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&xE.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return _E.lex(e,t??this.defaults)}parser(e,t){return bE.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(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 t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?_E.lex:_E.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?bE.parse:bE.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?_E.lex:_E.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?bE.parse:bE.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
112
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+uE(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function CE(e,t){return SE.parse(e,t)}CE.options=CE.setOptions=function(e){return SE.setOptions(e),CE.defaults=SE.defaults,gT(CE.defaults),CE},CE.getDefaults=mT,CE.defaults=hT,CE.use=function(...e){return SE.use(...e),CE.defaults=SE.defaults,gT(CE.defaults),CE},CE.walkTokens=function(e,t){return SE.walkTokens(e,t)},CE.parseInline=SE.parseInline,CE.Parser=bE,CE.parser=bE.parse,CE.Renderer=vE,CE.TextRenderer=yE,CE.Lexer=_E,CE.lexer=_E.lex,CE.Tokenizer=gE,CE.Hooks=xE,CE.parse=CE,CE.options,CE.setOptions,CE.use,CE.walkTokens,CE.parseInline,bE.parse,_E.lex;var Pte=/^\s*<(?:[a-z][\w-]*)(?:\s|>|\/)/i;function wE(e){return e.trim()===``||Pte.test(e)?e:CE.parse(e,{async:!1,gfm:!0})}function TE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Fte(e){if(Array.isArray(e))return e}function Ite(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Lte(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
113
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rte(e,t){return Fte(e)||Ite(e,t)||zte(e,t)||Lte()}function zte(e,t){if(e){if(typeof e==`string`)return TE(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?TE(e,t):void 0}}var EE=Object.entries,DE=Object.setPrototypeOf,Bte=Object.isFrozen,Vte=Object.getPrototypeOf,Hte=Object.getOwnPropertyDescriptor,OE=Object.freeze,kE=Object.seal,AE=Object.create,jE=typeof Reflect<`u`&&Reflect,ME=jE.apply,NE=jE.construct;OE||=function(e){return e},kE||=function(e){return e},ME||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},NE||=function(e){return new e(...[...arguments].slice(1))};var PE=YE(Array.prototype.forEach),Ute=YE(Array.prototype.lastIndexOf),FE=YE(Array.prototype.pop),IE=YE(Array.prototype.push),Wte=YE(Array.prototype.splice),LE=Array.isArray,RE=YE(String.prototype.toLowerCase),zE=YE(String.prototype.toString),BE=YE(String.prototype.match),VE=YE(String.prototype.replace),HE=YE(String.prototype.indexOf),Gte=YE(String.prototype.trim),Kte=YE(Number.prototype.toString),qte=YE(Boolean.prototype.toString),UE=typeof BigInt>`u`?null:YE(BigInt.prototype.toString),WE=typeof Symbol>`u`?null:YE(Symbol.prototype.toString),GE=YE(Object.prototype.hasOwnProperty),KE=YE(Object.prototype.toString),qE=YE(RegExp.prototype.test),JE=Jte(TypeError);function YE(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return ME(e,t,n)}}function Jte(e){return function(){return NE(e,[...arguments])}}function XE(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:RE;if(DE&&DE(e,null),!LE(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Bte(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Yte(e){for(let t=0;t<e.length;t++)GE(e,t)||(e[t]=null);return e}function ZE(e){let t=AE(null);for(let r of EE(e)){var n=Rte(r,2);let i=n[0],a=n[1];GE(e,i)&&(LE(a)?t[i]=Yte(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=ZE(a):t[i]=a)}return t}function Xte(e){switch(typeof e){case`string`:return e;case`number`:return Kte(e);case`boolean`:return qte(e);case`bigint`:return UE?UE(e):`0`;case`symbol`:return WE?WE(e):`Symbol()`;case`undefined`:return KE(e);case`function`:case`object`:{if(e===null)return KE(e);let t=e,n=QE(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:KE(e)}return KE(e)}default:return KE(e)}}function QE(e,t){for(;e!==null;){let n=Hte(e,t);if(n){if(n.get)return YE(n.get);if(typeof n.value==`function`)return YE(n.value)}e=Vte(e)}function n(){return null}return n}function Zte(e){try{return qE(e,``),!0}catch{return!1}}var $E=OE(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),eD=OE(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),tD=OE([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Qte=OE([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),nD=OE(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),$te=OE([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),rD=OE([`#text`]),iD=OE(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),aD=OE(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),oD=OE(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),sD=OE([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ene=kE(/{{[\w\W]*|^[\w\W]*}}/g),tne=kE(/<%[\w\W]*|^[\w\W]*%>/g),nne=kE(/\${[\w\W]*/g),cD=kE(/^data-[\-\w.\u00B7-\uFFFF]+$/),lD=kE(/^aria-[\-\w]+$/),uD=kE(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),dD=kE(/^(?:\w+script|data):/i),fD=kE(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),pD=kE(/^html$/i),mD=kE(/^[a-z][.\w]*(-[.\w]+)+$/i),hD={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},gD=function(){return typeof window>`u`?null:window},_D=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},vD=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function yD(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gD(),t=e=>yD(e);if(t.version=`3.4.8`,t.removed=[],!e||!e.document||e.document.nodeType!==hD.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=QE(d,`cloneNode`),p=QE(d,`remove`),m=QE(d,`nextSibling`),h=QE(d,`childNodes`),g=QE(d,`parentNode`),_=QE(d,`shadowRoot`),v=QE(d,`attributes`),y=o&&o.prototype?QE(o.prototype,`nodeType`):null,b=o&&o.prototype?QE(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C=0,w=function(e){if(C>0)throw JE(`The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`);C++;try{return x.createHTML(e)}finally{C--}},T=n,E=T.implementation,D=T.createNodeIterator,O=T.createDocumentFragment,k=T.getElementsByTagName,A=r.importNode,j=vD();t.isSupported=typeof EE==`function`&&typeof g==`function`&&E&&E.createHTMLDocument!==void 0;let M=ene,N=tne,P=nne,F=cD,I=lD,L=dD,ee=fD,te=mD,ne=uD,R=null,z=XE({},[...$E,...eD,...tD,...nD,...rD]),B=null,re=XE({},[...iD,...aD,...oD,...sD]),V=Object.seal(AE(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ie=null,ae=null,oe=Object.seal(AE(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),se=!0,ce=!0,le=!1,ue=!0,de=!1,fe=!0,pe=!1,me=!1,he=!1,ge=!1,_e=!1,ve=!1,ye=!0,be=!1,xe=`user-content-`,Se=!0,Ce=!1,we={},Te=null,Ee=XE({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),De=null,Oe=XE({},[`audio`,`video`,`img`,`source`,`image`,`track`]),ke=null,Ae=XE({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),je=`http://www.w3.org/1998/Math/MathML`,Me=`http://www.w3.org/2000/svg`,Ne=`http://www.w3.org/1999/xhtml`,Pe=Ne,Fe=!1,Ie=null,Le=XE({},[je,Me,Ne],zE),Re=XE({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),ze=XE({},[`annotation-xml`]),H=XE({},[`title`,`style`,`font`,`a`,`script`]),U=null,Be=[`application/xhtml+xml`,`text/html`],W=null,Ve=null,He=n.createElement(`form`),Ue=function(e){return e instanceof RegExp||e instanceof Function},We=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ve&&Ve===e)return;(!e||typeof e!=`object`)&&(e={}),e=ZE(e),U=Be.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,W=U===`application/xhtml+xml`?zE:RE,R=GE(e,`ALLOWED_TAGS`)&&LE(e.ALLOWED_TAGS)?XE({},e.ALLOWED_TAGS,W):z,B=GE(e,`ALLOWED_ATTR`)&&LE(e.ALLOWED_ATTR)?XE({},e.ALLOWED_ATTR,W):re,Ie=GE(e,`ALLOWED_NAMESPACES`)&&LE(e.ALLOWED_NAMESPACES)?XE({},e.ALLOWED_NAMESPACES,zE):Le,ke=GE(e,`ADD_URI_SAFE_ATTR`)&&LE(e.ADD_URI_SAFE_ATTR)?XE(ZE(Ae),e.ADD_URI_SAFE_ATTR,W):Ae,De=GE(e,`ADD_DATA_URI_TAGS`)&&LE(e.ADD_DATA_URI_TAGS)?XE(ZE(Oe),e.ADD_DATA_URI_TAGS,W):Oe,Te=GE(e,`FORBID_CONTENTS`)&&LE(e.FORBID_CONTENTS)?XE({},e.FORBID_CONTENTS,W):Ee,ie=GE(e,`FORBID_TAGS`)&&LE(e.FORBID_TAGS)?XE({},e.FORBID_TAGS,W):ZE({}),ae=GE(e,`FORBID_ATTR`)&&LE(e.FORBID_ATTR)?XE({},e.FORBID_ATTR,W):ZE({}),we=GE(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?ZE(e.USE_PROFILES):e.USE_PROFILES:!1,se=e.ALLOW_ARIA_ATTR!==!1,ce=e.ALLOW_DATA_ATTR!==!1,le=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ue=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,de=e.SAFE_FOR_TEMPLATES||!1,fe=e.SAFE_FOR_XML!==!1,pe=e.WHOLE_DOCUMENT||!1,ge=e.RETURN_DOM||!1,_e=e.RETURN_DOM_FRAGMENT||!1,ve=e.RETURN_TRUSTED_TYPE||!1,he=e.FORCE_BODY||!1,ye=e.SANITIZE_DOM!==!1,be=e.SANITIZE_NAMED_PROPS||!1,Se=e.KEEP_CONTENT!==!1,Ce=e.IN_PLACE||!1,ne=Zte(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:uD,Pe=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ne,Re=GE(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?ZE(e.MATHML_TEXT_INTEGRATION_POINTS):XE({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),ze=GE(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?ZE(e.HTML_INTEGRATION_POINTS):XE({},[`annotation-xml`]);let t=GE(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?ZE(e.CUSTOM_ELEMENT_HANDLING):AE(null);if(V=AE(null),GE(t,`tagNameCheck`)&&Ue(t.tagNameCheck)&&(V.tagNameCheck=t.tagNameCheck),GE(t,`attributeNameCheck`)&&Ue(t.attributeNameCheck)&&(V.attributeNameCheck=t.attributeNameCheck),GE(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(V.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),de&&(ce=!1),_e&&(ge=!0),we&&(R=XE({},rD),B=AE(null),we.html===!0&&(XE(R,$E),XE(B,iD)),we.svg===!0&&(XE(R,eD),XE(B,aD),XE(B,sD)),we.svgFilters===!0&&(XE(R,tD),XE(B,aD),XE(B,sD)),we.mathMl===!0&&(XE(R,nD),XE(B,oD),XE(B,sD))),oe.tagCheck=null,oe.attributeCheck=null,GE(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?oe.tagCheck=e.ADD_TAGS:LE(e.ADD_TAGS)&&(R===z&&(R=ZE(R)),XE(R,e.ADD_TAGS,W))),GE(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?oe.attributeCheck=e.ADD_ATTR:LE(e.ADD_ATTR)&&(B===re&&(B=ZE(B)),XE(B,e.ADD_ATTR,W))),GE(e,`ADD_URI_SAFE_ATTR`)&&LE(e.ADD_URI_SAFE_ATTR)&&XE(ke,e.ADD_URI_SAFE_ATTR,W),GE(e,`FORBID_CONTENTS`)&&LE(e.FORBID_CONTENTS)&&(Te===Ee&&(Te=ZE(Te)),XE(Te,e.FORBID_CONTENTS,W)),GE(e,`ADD_FORBID_CONTENTS`)&&LE(e.ADD_FORBID_CONTENTS)&&(Te===Ee&&(Te=ZE(Te)),XE(Te,e.ADD_FORBID_CONTENTS,W)),Se&&(R[`#text`]=!0),pe&&XE(R,[`html`,`head`,`body`]),R.table&&(XE(R,[`tbody`]),delete ie.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw JE(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw JE(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=w(``)}catch(e){throw x=t,e}}else x===void 0&&e.TRUSTED_TYPES_POLICY!==null&&(x=_D(u,i)),x&&typeof S==`string`&&(S=w(``));(j.uponSanitizeElement.length>0||j.uponSanitizeAttribute.length>0)&&R===z&&(R=ZE(R)),j.uponSanitizeAttribute.length>0&&B===re&&(B=ZE(B)),OE&&OE(e),Ve=e},Ge=XE({},[...eD,...tD,...Qte]),Ke=XE({},[...nD,...$te]),qe=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Pe,tagName:`template`});let n=RE(e.tagName),r=RE(t.tagName);return Ie[e.namespaceURI]?e.namespaceURI===Me?t.namespaceURI===Ne?n===`svg`:t.namespaceURI===je?n===`svg`&&(r===`annotation-xml`||Re[r]):!!Ge[n]:e.namespaceURI===je?t.namespaceURI===Ne?n===`math`:t.namespaceURI===Me?n===`math`&&ze[r]:!!Ke[n]:e.namespaceURI===Ne?t.namespaceURI===Me&&!ze[r]||t.namespaceURI===je&&!Re[r]?!1:!Ke[n]&&(H[n]||!Ge[n]):!!(U===`application/xhtml+xml`&&Ie[e.namespaceURI]):!1},Je=function(e){IE(t.removed,{element:e});try{g(e).removeChild(e)}catch{p(e)}},Ye=function(e,n){try{IE(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{IE(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(ge||_e)try{Je(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Xe=function(e){let t=null,r=null;if(he)e=`<remove></remove>`+e;else{let t=BE(e,/^[\r\n\t ]+/);r=t&&t[0]}U===`application/xhtml+xml`&&Pe===Ne&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?w(e):e;if(Pe===Ne)try{t=new l().parseFromString(i,U)}catch{}if(!t||!t.documentElement){t=E.createDocument(Pe,`template`,null);try{t.documentElement.innerHTML=Fe?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Pe===Ne?k.call(t,pe?`html`:`body`)[0]:pe?t.documentElement:a},Ze=function(e){return D.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Qe=function(e){e.normalize();let t=D.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;){let e=n.data;PE([M,N,P],t=>{e=VE(e,t,` `)}),n.data=e,n=t.nextNode()}let r=e.querySelectorAll?.call(e,`template`)??[];PE(Array.from(r),e=>{et(e.content)&&Qe(e.content)})},$e=function(e){let t=b?b(e):null;return typeof t!=`string`||W(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},et=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===hD.documentFragment}catch{return!1}},tt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function nt(e,n,r){PE(e,e=>{e.call(t,n,r,Ve)})}let rt=function(e){let n=null;if(nt(j.beforeSanitizeElements,e,null),$e(e))return Je(e),!0;let r=W(b?b(e):e.nodeName);if(nt(j.uponSanitizeElement,e,{tagName:r,allowedTags:R}),fe&&e.hasChildNodes()&&!tt(e.firstElementChild)&&qE(/<[/\w!]/g,e.innerHTML)&&qE(/<[/\w!]/g,e.textContent)||fe&&e.namespaceURI===Ne&&r===`style`&&tt(e.firstElementChild)||e.nodeType===hD.progressingInstruction||fe&&e.nodeType===hD.comment&&qE(/<[/\w]/g,e.data))return Je(e),!0;if(ie[r]||!(oe.tagCheck instanceof Function&&oe.tagCheck(r))&&!R[r]){if(!ie[r]&&ot(r)&&(V.tagNameCheck instanceof RegExp&&qE(V.tagNameCheck,r)||V.tagNameCheck instanceof Function&&V.tagNameCheck(r)))return!1;if(Se&&!Te[r]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=f(n[i],!0);t.insertBefore(r,m(e))}}}return Je(e),!0}return(y?y(e):e.nodeType)===hD.element&&!qe(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&qE(/<\/no(script|embed|frames)/i,e.innerHTML)?(Je(e),!0):(de&&e.nodeType===hD.text&&(n=e.textContent,PE([M,N,P],e=>{n=VE(n,e,` `)}),e.textContent!==n&&(IE(t.removed,{element:e.cloneNode()}),e.textContent=n)),nt(j.afterSanitizeElements,e,null),!1)},it=function(e,t,r){if(ae[t]||ye&&(t===`id`||t===`name`)&&(r in n||r in He))return!1;let i=B[t]||oe.attributeCheck instanceof Function&&oe.attributeCheck(t,e);if(!(ce&&!ae[t]&&qE(F,t))&&!(se&&qE(I,t))){if(!i||ae[t]){if(!(ot(e)&&(V.tagNameCheck instanceof RegExp&&qE(V.tagNameCheck,e)||V.tagNameCheck instanceof Function&&V.tagNameCheck(e))&&(V.attributeNameCheck instanceof RegExp&&qE(V.attributeNameCheck,t)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(t,e))||t===`is`&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&qE(V.tagNameCheck,r)||V.tagNameCheck instanceof Function&&V.tagNameCheck(r))))return!1}else if(!ke[t]&&!qE(ne,VE(r,ee,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&HE(r,`data:`)===0&&De[e])&&!(le&&!qE(L,VE(r,ee,``)))&&r)return!1}return!0},at=XE({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),ot=function(e){return!at[RE(e)]&&qE(te,e)},st=function(e){nt(j.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||$e(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:B,forceKeepAttr:void 0},i=n.length;for(;i--;){let a=n[i],o=a.name,s=a.namespaceURI,c=a.value,l=W(o),d=c,f=o===`value`?d:Gte(d);if(r.attrName=l,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,nt(j.uponSanitizeAttribute,e,r),f=r.attrValue,be&&(l===`id`||l===`name`)&&HE(f,xe)!==0&&(Ye(o,e),f=xe+f),fe&&qE(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){Ye(o,e);continue}if(l===`attributename`&&BE(f,`href`)){Ye(o,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Ye(o,e);continue}if(!ue&&qE(/\/>/i,f)){Ye(o,e);continue}de&&PE([M,N,P],e=>{f=VE(f,e,` `)});let p=W(e.nodeName);if(!it(p,l,f)){Ye(o,e);continue}if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!s)switch(u.getAttributeType(p,l)){case`TrustedHTML`:f=w(f);break;case`TrustedScriptURL`:f=x.createScriptURL(f);break}if(f!==d)try{s?e.setAttributeNS(s,o,f):e.setAttribute(o,f),$e(e)?Je(e):FE(t.removed)}catch{Ye(o,e)}}nt(j.afterSanitizeAttributes,e,null)},ct=function(e){let t=null,n=Ze(e);for(nt(j.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(nt(j.uponSanitizeShadowNode,t,null),rt(t),st(t),et(t.content)&&ct(t.content),(y?y(t):t.nodeType)===hD.element){let e=_?_(t):t.shadowRoot;et(e)&&(lt(e),ct(e))}nt(j.afterSanitizeShadowDOM,e,null)},lt=function(e){let t=y?y(e):e.nodeType;if(t===hD.element){let t=_?_(e):e.shadowRoot;et(t)&&(lt(t),ct(t))}let n=h?h(e):e.childNodes;if(!n)return;let r=[];PE(n,e=>{IE(r,e)});for(let e of r)lt(e);if(t===hD.element){let t=b?b(e):null;if(typeof t==`string`&&W(t)===`template`){let t=e.content;et(t)&<(t)}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Fe=!e,Fe&&(e=`<!-->`),typeof e!=`string`&&!tt(e)&&(e=Xte(e),typeof e!=`string`))throw JE(`dirty is not a string, aborting`);if(!t.isSupported)return e;if(me||We(n),t.removed=[],typeof e==`string`&&(Ce=!1),Ce){let t=b?b(e):e.nodeName;if(typeof t==`string`){let e=W(t);if(!R[e]||ie[e])throw JE(`root node is forbidden and cannot be sanitized in-place`)}if($e(e))throw JE(`root node is clobbered and cannot be sanitized in-place`);lt(e)}else if(tt(e))i=Xe(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===hD.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),lt(a);else{if(!ge&&!de&&!pe&&e.indexOf(`<`)===-1)return x&&ve?w(e):e;if(i=Xe(e),!i)return ge?null:ve?S:``}i&&he&&Je(i.firstChild);let c=Ze(Ce?e:i);for(;o=c.nextNode();)rt(o),st(o),et(o.content)&&ct(o.content);if(Ce)return de&&Qe(e),e;if(ge){if(de&&Qe(i),_e)for(s=O.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(B.shadowroot||B.shadowrootmode)&&(s=A.call(r,s,!0)),s}let l=pe?i.outerHTML:i.innerHTML;return pe&&R[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&qE(pD,i.ownerDocument.doctype.name)&&(l=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
114
|
+
`+l),de&&PE([M,N,P],e=>{l=VE(l,e,` `)}),x&&ve?w(l):l},t.setConfig=function(){We(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),me=!0},t.clearConfig=function(){Ve=null,me=!1},t.isValidAttribute=function(e,t,n){return Ve||We({}),it(W(e),W(t),n)},t.addHook=function(e,t){typeof t==`function`&&IE(j[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=Ute(j[e],t);return n===-1?void 0:Wte(j[e],n,1)[0]}return FE(j[e])},t.removeHooks=function(e){j[e]=[]},t.removeAllHooks=function(){j=vD()},t}var bD=yD(),xD=bD;bD.sanitize.bind(bD),bD.isSupported,bD.addHook.bind(bD),bD.removeHook.bind(bD),bD.removeHooks.bind(bD),bD.removeAllHooks.bind(bD),bD.setConfig.bind(bD),bD.clearConfig.bind(bD),bD.isValidAttribute.bind(bD),bD.version,bD.removed;function SD(e){return xD.sanitize(e,{USE_PROFILES:{html:!0}})}var CD=[`scope`,`todo`,`in_progress`,`done`,`backlog`],wD={scope:`Scope`,todo:`Todo`,in_progress:`In Progress`,done:`Done`,backlog:`Backlog`};function TD(e){let t=Object.fromEntries(Da.map(e=>[e,[]]));for(let n of e)t[n.status].push(n);return t}var ED=`lane:`;function DD(e){for(let t of e??[])if(t.name.startsWith(`lane:`))return t.name.slice(5)}function OD(e,t){if(t.length===0)return e;let n=new Set(t);return e.filter(e=>(e.tags??[]).some(e=>n.has(e.id)))}function kD(e,t){if(e===void 0)return;let n=String(e);return Da.includes(n)?n:t.get(n)?.status}var AD={scope:{bg:`var(--s-scope-bg)`,fg:`var(--s-scope-fg)`,dot:`var(--s-scope-dot)`},todo:{bg:`var(--s-todo-bg)`,fg:`var(--s-todo-fg)`,dot:`var(--s-todo-dot)`},in_progress:{bg:`var(--s-prog-bg)`,fg:`var(--s-prog-fg)`,dot:`var(--s-prog-dot)`},done:{bg:`var(--s-done-bg)`,fg:`var(--s-done-fg)`,dot:`var(--s-done-dot)`},backlog:{bg:`var(--s-back-bg)`,fg:`var(--s-back-fg)`,dot:`var(--s-back-dot)`}},jD=Y(Uy({variant:`secondary`}),`border-transparent gap-1.5 px-2 py-0.5 text-[10.5px] font-medium leading-none`);function MD({status:e,className:t,...n}){let r=AD[e];return(0,U.jsxs)(`button`,{type:`button`,"data-slot":`badge`,"data-status":e,className:Y(jD,t),style:{backgroundColor:r.bg,color:r.fg},...n,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full`,style:{backgroundColor:r.dot}}),wD[e]]})}function ND({status:e,onChange:t,align:n=`start`,className:r}){return(0,U.jsxs)(Rb,{children:[(0,U.jsx)(zb,{asChild:!0,children:(0,U.jsx)(MD,{status:e,className:r,onClick:e=>{e.stopPropagation()},onPointerDown:e=>{e.stopPropagation()}})}),(0,U.jsx)(Bb,{align:n,children:Da.map(e=>(0,U.jsxs)(Vb,{className:`gap-2`,"data-status":e,onSelect:()=>{t(e)},children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`size-2 rounded-full`,style:{backgroundColor:AD[e].dot}}),wD[e]]},e))})]})}function PD(e){return Da.includes(e)}function FD(e){return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function ID({task:e}){return(0,U.jsxs)(Jb,{"data-task-id":e.id,"data-task-status":e.status,className:`gap-0 p-3 shadow-sm`,children:[(0,U.jsx)(`div`,{className:`mb-2`,children:PD(e.status)?(0,U.jsx)(MD,{status:e.status,className:`pointer-events-none`,tabIndex:-1}):(0,U.jsx)(Wy,{variant:`secondary`,className:`text-[10.5px]`,children:e.status.replace(/_/g,` `)})}),(0,U.jsx)(`div`,{className:`text-[13px] font-semibold leading-snug`,children:e.label}),e.due_date===null?null:(0,U.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Due `,FD(e.due_date)]}),e.assignee!==void 0&&e.assignee!==null?(0,U.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:e.assignee}):null,e.description!==void 0&&e.description!==null&&e.description!==``?(0,U.jsx)(`p`,{className:`mt-1.5 text-xs leading-relaxed text-muted-foreground`,children:e.description}):null]})}function LD(e){let t=new Map;for(let e of CD)t.set(e,[]);for(let n of e){let e=t.get(n.status);if(e!==void 0){e.push(n);continue}let r=t.get(n.status)??[];r.push(n),t.set(n.status,r)}return t}function RD(e){let t=new Set,n=[];for(let r of CD)e.has(r)&&(n.push(r),t.add(r));for(let r of e.keys())t.has(r)||n.push(r);return n}function zD(e){return e in wD?wD[e]:e.replace(/_/g,` `)}function BD(e){return e in AD?AD[e].dot:`var(--muted-foreground)`}function VD({tasks:e}){let t=(0,H.useMemo)(()=>LD(e),[e]),n=(0,H.useMemo)(()=>RD(t),[t]);return e.length===0?(0,U.jsx)(`p`,{className:`rounded-lg border border-dashed border-border py-8 text-center text-sm text-muted-foreground`,children:`Nothing here yet.`}):(0,U.jsx)(`div`,{className:`flex items-start gap-3 overflow-x-auto`,"data-portal-board":!0,children:n.map(e=>{let n=t.get(e)??[];return(0,U.jsxs)(`div`,{"data-portal-column":e,className:`flex min-w-[180px] flex-1 flex-col rounded-lg border border-border bg-muted/40`,children:[(0,U.jsxs)(`header`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2.5`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold`,children:[(0,U.jsx)(`span`,{className:`size-2 rounded-full`,style:{backgroundColor:BD(e)}}),zD(e)]}),(0,U.jsx)(Wy,{variant:`secondary`,className:`h-5 px-2 text-[11px] font-medium`,children:n.length})]}),(0,U.jsx)(`div`,{className:`flex min-h-[120px] flex-1 flex-col gap-2 p-2`,children:n.map(e=>(0,U.jsx)(ID,{task:e},e.id))})]},e)})})}function HD(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function UD(e){switch(e){case`accepted`:return{backgroundColor:`var(--s-done-bg)`,color:`var(--s-done-fg)`};case`rejected`:return{backgroundColor:`var(--destructive)`,color:`var(--destructive-foreground)`};default:return{backgroundColor:`var(--s-prog-bg)`,color:`var(--s-prog-fg)`}}}function WD({status:e}){return(0,U.jsx)(Wy,{variant:`secondary`,className:`border-transparent text-xs font-semibold capitalize`,style:UD(e),children:e.replace(/_/g,` `)})}function GD(e,t){return[`portal`,e,t,`submissions`]}function KD({shareToken:e,sessionToken:t,onUnauthorized:n}){let{data:r,isLoading:i,error:a}=tt({queryKey:GD(e,t),queryFn:()=>dT(e,t),retry:!1}),o=a instanceof Xw;if((0,H.useEffect)(()=>{o&&n()},[o,n]),o)return null;if(a)return(0,U.jsxs)(`section`,{"aria-label":`Your reported issues`,className:`mb-6`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-semibold`,children:`Your reported issues`}),(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a instanceof Error?a.message:`Failed to load your submissions.`})]});let s=r??[];return(0,U.jsxs)(`section`,{"aria-label":`Your reported issues`,className:`mb-6`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-semibold`,children:`Your reported issues`}),i?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):s.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`You haven't reported anything yet.`}):(0,U.jsx)(`ul`,{className:`m-0 grid list-none gap-2 p-0`,children:s.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(Jb,{className:`gap-0 p-3 shadow-sm`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,U.jsx)(`strong`,{className:`text-sm`,children:e.title}),(0,U.jsx)(WD,{status:e.status})]}),(0,U.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-3 text-xs text-muted-foreground`,children:[e.severity===null?null:(0,U.jsxs)(`span`,{children:[`Severity: `,e.severity]}),(0,U.jsx)(`span`,{children:HD(e.created_at)})]})]})},e.id))})]})}function qD({className:e,...t}){return(0,U.jsx)(`textarea`,{"data-slot":`textarea`,className:Y(`flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40`,e),...t})}var JD=[`low`,`medium`,`high`];function YD({shareToken:e,sessionToken:t,tasks:n,projectId:r,onSubmitted:i,onUnauthorized:a}){let[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(``),[f,p]=(0,H.useState)(``),[m,h]=(0,H.useState)(``),[g,_]=(0,H.useState)(!1),[v,y]=(0,H.useState)(null),[b,x]=(0,H.useState)(null),[S,C]=(0,H.useState)(null),[w,T]=(0,H.useState)(null),E=c.trim(),D=E.length>0&&!g&&w===null;async function O(n){if(n.preventDefault(),D){_(!0),y(null),x(null),C(null);try{let n=await uT(e,t,{title:E,body:u.trim()===``?void 0:u.trim(),severity:f===``?void 0:f,task_ref:m.trim()===``?void 0:m.trim(),...r===void 0?{}:{project_id:r}});l(``),d(``),p(``),h(``),s(!1),C(`Reported ✓`),i(n)}catch(e){if(e instanceof Xw){a();return}if(e instanceof eT){T(`You don't have permission to submit to this share.`);return}if(e instanceof tT){x(e.message);return}if(e instanceof nT){y(e.message);return}y(e instanceof Error?e.message:`Something went wrong. Please try again.`)}finally{_(!1)}}}return(0,U.jsx)(`section`,{"aria-label":`Report an issue`,className:`mb-6`,children:(0,U.jsxs)(Jb,{className:`shadow-sm`,children:[(0,U.jsxs)(Yb,{className:`flex flex-row items-center justify-between gap-3 space-y-0`,children:[(0,U.jsx)(Xb,{className:`text-sm font-semibold`,children:`Report an issue`}),o?null:(0,U.jsx)(X,{type:`button`,size:`sm`,onClick:()=>{s(!0)},children:`Report an issue`})]}),S===null?null:(0,U.jsx)(Qb,{className:`pt-0`,children:(0,U.jsx)(`p`,{role:`status`,className:`text-sm font-semibold text-[var(--s-done-fg)]`,children:S})}),w===null?null:(0,U.jsx)(Qb,{className:`pt-0`,children:(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:w})}),b===null?null:(0,U.jsx)(Qb,{className:`pt-0`,children:(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:b})}),o?(0,U.jsx)(Qb,{children:(0,U.jsxs)(`form`,{onSubmit:e=>{O(e)},className:`grid gap-3.5`,children:[(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`issue-title`,children:`Title`}),(0,U.jsx)(nw,{id:`issue-title`,type:`text`,name:`title`,value:c,onChange:e=>{l(e.target.value)},required:!0,disabled:g}),v===null?null:(0,U.jsx)(`span`,{role:`alert`,className:`text-xs text-destructive`,children:v})]}),(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`issue-body`,children:`Description`}),(0,U.jsx)(qD,{id:`issue-body`,name:`body`,value:u,onChange:e=>{d(e.target.value)},rows:4,disabled:g})]}),(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsxs)(rw,{htmlFor:`issue-severity`,children:[`Severity `,(0,U.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,U.jsxs)(`select`,{id:`issue-severity`,name:`severity`,value:f,onChange:e=>{p(e.target.value)},disabled:g,className:Y(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,U.jsx)(`option`,{value:``,children:`—`}),JD.map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))]})]}),n.length>0?(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsxs)(rw,{htmlFor:`issue-task-ref`,children:[`Which part is this about?`,` `,(0,U.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,U.jsxs)(ww,{value:m,onValueChange:h,disabled:g||w!==null,children:[(0,U.jsx)(Ew,{id:`issue-task-ref`,children:(0,U.jsx)(Tw,{placeholder:`Select a task`})}),(0,U.jsx)(Dw,{children:n.map(e=>(0,U.jsx)(Ow,{value:e.id,children:e.label},e.id))})]})]}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(X,{type:`submit`,disabled:!D||w!==null,children:g?`Submitting…`:`Submit`}),(0,U.jsx)(X,{type:`button`,variant:`outline`,disabled:g,onClick:()=>{s(!1),y(null),x(null)},children:`Cancel`})]})]})}):null]})})}function XD(e){return e.replace(/_/g,` `)}function ZD(e){if(e in AD){let t=AD[e];return{backgroundColor:t.bg,color:t.fg}}return{backgroundColor:`var(--muted)`,color:`var(--muted-foreground)`}}function QD({view:e,shareToken:t,sessionToken:n,projectId:r,onUnauthorized:i}){let a=W(),o=pT(e.share.permissions).includes(`submit`),s=new Map(e.tasks.map(e=>[e.id,e.label])),c=Object.entries(e.progress);function l(e){let r=GD(t,n);a.setQueryData(r,t=>[e,...t??[]]),a.invalidateQueries({queryKey:r})}return(0,U.jsxs)(`article`,{"data-portal-view":!0,className:`mx-auto max-w-5xl px-5 py-6 pb-16`,children:[(0,U.jsxs)(`header`,{className:`mb-6`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-start gap-3`,children:[(0,U.jsx)(`h1`,{className:`flex-1 text-2xl font-bold tracking-tight`,children:e.project.name}),(0,U.jsx)(Wy,{variant:`secondary`,className:`shrink-0 text-[11px] font-semibold`,children:`shared, read-only`})]}),(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Shared with `,e.share.audience_name]}),e.project.description?(0,U.jsx)(`p`,{className:`mt-3 text-sm leading-relaxed text-foreground/80`,children:e.project.description}):null]}),c.length>0?(0,U.jsxs)(`section`,{className:`mb-6`,"aria-label":`Progress`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-semibold`,children:`Progress`}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:c.map(([e,t])=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs font-medium`,style:ZD(e),children:[XD(e),`: `,(0,U.jsx)(`strong`,{children:t})]},e))})]}):null,(0,U.jsxs)(`section`,{className:`mb-6`,"aria-label":`Board`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-semibold`,children:`Board`}),(0,U.jsx)(VD,{tasks:e.tasks})]}),e.edges.length>0?(0,U.jsxs)(`section`,{className:`mb-6`,"aria-label":`Dependencies`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-semibold`,children:`Dependencies`}),(0,U.jsx)(`ul`,{className:`m-0 grid list-none gap-2 p-0`,children:e.edges.map(e=>{let t=s.get(e.from)??e.from,n=s.get(e.to)??e.to,r;switch(e.label){case`depends_on`:r=`${n} must finish before ${t}`;break;case`blocks`:r=`${t} blocks ${n}`;break;case`feeds`:r=`${t} feeds into ${n}`;break;default:r=`${t} → ${n}`}return(0,U.jsx)(`li`,{children:(0,U.jsx)(Jb,{className:`px-3 py-2 text-sm shadow-sm`,children:r})},e.id)})})]}):null,e.documents.length>0?(0,U.jsxs)(`section`,{className:`mb-6`,"aria-label":`Documents`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-semibold`,children:`Documents`}),(0,U.jsx)(`div`,{className:`grid gap-5`,children:e.documents.map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`mb-2 text-sm font-semibold`,children:e.title}),e.body_html!==null&&e.body_html!==``?(0,U.jsx)(`div`,{className:`portal-document-content rounded-lg border border-border bg-card p-4 leading-relaxed`,dangerouslySetInnerHTML:{__html:SD(wE(e.body_html))}}):(0,U.jsx)(`p`,{className:`m-0 text-sm italic text-muted-foreground`,children:`No content`})]},e.id))})]}):null,o?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(YD,{shareToken:t,sessionToken:n,tasks:e.tasks,...r===void 0?{}:{projectId:r},onSubmitted:l,onUnauthorized:i}),(0,U.jsx)(KD,{shareToken:t,sessionToken:n,onUnauthorized:i})]}):null]})}function $D({view:e,shareToken:t,sessionToken:n,onUnauthorized:r}){let i=e.projects,[a,o]=(0,H.useState)(i[0]?.id??``),s=i.find(e=>e.id===a)??i[0];return s===void 0?(0,U.jsxs)(`section`,{className:`mx-auto max-w-5xl px-5 py-8`,children:[(0,U.jsx)(`h1`,{className:`mb-2 text-xl font-semibold`,children:e.workspace.name}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This workspace has no shared projects yet.`})]}):(0,U.jsxs)(`article`,{"data-portal-view":!0,"data-portal-workspace":!0,className:`mx-auto max-w-5xl px-5 py-6 pb-16`,children:[(0,U.jsxs)(`header`,{className:`mb-6`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-start gap-3`,children:[(0,U.jsx)(`h1`,{className:`flex-1 text-2xl font-bold tracking-tight`,children:e.workspace.name}),(0,U.jsx)(Wy,{variant:`secondary`,className:`shrink-0 text-[11px] font-semibold`,children:`workspace, read-only`})]}),(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Shared with `,e.share.audience_name,` · `,i.length,` `,i.length===1?`project`:`projects`]})]}),(0,U.jsx)(`nav`,{"aria-label":`Projects in this workspace`,className:`mb-6`,children:(0,U.jsx)(`ul`,{role:`tablist`,className:`m-0 flex flex-wrap gap-2 rounded-lg border border-border bg-card p-2`,children:i.map(e=>{let t=e.id===s.id;return(0,U.jsx)(`li`,{children:(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,"data-portal-project-tab":e.id,onClick:()=>{o(e.id)},className:Y(`rounded-md px-3 py-1.5 text-sm font-medium transition-colors`,t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:e.name})},e.id)})})}),(0,U.jsx)(`div`,{"data-portal-selected-project":s.id,children:(0,U.jsx)(QD,{view:s.view,shareToken:t,sessionToken:n,projectId:s.id,onUnauthorized:r})})]})}function eO(){let{shareToken:e}=tO.useParams(),[t,n]=(0,H.useState)(()=>rT(e)),{data:r,isLoading:i,error:a}=tt({queryKey:[`portal`,e,t],queryFn:()=>{if(t===null)throw Error(`Portal session is required`);return lT(e,t)},enabled:t!==null,retry:!1}),o=a instanceof Xw;return(0,H.useEffect)(()=>{o&&(aT(e),n(null))},[o,e]),!t||o?(0,U.jsx)(fT,{shareToken:e,onJoined:t=>{iT(e,t),n(t)}}):i?(0,U.jsx)(`p`,{className:`px-5 py-8 text-sm text-muted-foreground`,children:`Loading shared project…`}):a instanceof Zw?(0,U.jsxs)(`section`,{role:`status`,className:`mx-auto max-w-lg px-5 py-8`,children:[(0,U.jsx)(`h1`,{className:`mb-2 text-xl font-semibold`,children:`Not published yet`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a.message})]}):a?(0,U.jsxs)(`p`,{role:`alert`,className:`px-5 py-8 text-sm text-destructive`,children:[`Failed to load shared project: `,a instanceof Error?a.message:`Unknown error`]}):r===void 0?(0,U.jsx)(`p`,{className:`px-5 py-8 text-sm text-muted-foreground`,children:`Shared project not found.`}):r.kind===`workspace`?(0,U.jsx)($D,{view:r,shareToken:e,sessionToken:t,onUnauthorized:()=>{aT(e),n(null)}}):(0,U.jsx)(QD,{view:r,shareToken:e,sessionToken:t,onUnauthorized:()=>{aT(e),n(null)}})}var tO=Ki(`/p/$shareToken`)({component:eO});function nO({title:e,body:t}){return(0,U.jsxs)(`div`,{className:`space-y-1.5 text-center`,children:[(0,U.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:e}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]})}function rO({invitationId:e}){let t=Yo(),n=tt({queryKey:[`invitation`,e],queryFn:()=>vo(e),retry:!1}),[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(null),d=t.data!==null&&t.data!==void 0;async function f(){u(null),i(!0);try{let{url:t}=await Go(`/invite/${e}`);window.location.assign(t)}catch(e){i(!1),u(e instanceof Error?e.message:`Could not start GitHub sign-in`)}}async function p(){u(null),o(!0);try{await yo(e),c(!0),window.location.assign(`/`)}catch(e){if(o(!1),e instanceof ja){if(e.status===410){u(`This invitation has expired or was already used.`);return}if(e.status===403){u(`This invite was sent to ${n.data?.email??`a different address`}. Sign in with that account to accept.`);return}if(e.status===401){u(`Please sign in to accept this invitation.`);return}}u(e instanceof Error?e.message:`Could not accept the invitation.`)}}let m;if(n.isLoading||t.isLoading)m=(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading invitation…`});else if(n.error!==null)m=(0,U.jsx)(nO,{title:`Invitation not found`,body:`This invitation link is invalid or was withdrawn. Ask whoever invited you for a new link.`});else if(n.data!==void 0&&n.data.status!==`pending`)m=(0,U.jsx)(nO,{title:`Invitation already used`,body:`This invitation has already been accepted or was canceled. Ask an admin to send a new one.`});else if(n.data!==void 0){let e=n.data.organizationName||`a team`,t=n.data.workspaceName!==void 0&&n.data.workspaceName.length>0?n.data.workspaceName:null;m=(0,U.jsxs)(`div`,{className:`space-y-5 text-center`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`You’re invited`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t===null?(0,U.jsxs)(U.Fragment,{children:[`Join `,(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:e}),` on Plan Desk as`,` `,(0,U.jsx)(`span`,{className:`font-medium capitalize text-foreground`,children:n.data.role}),`.`]}):(0,U.jsxs)(U.Fragment,{children:[`Join `,(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),` on Plan Desk as`,` `,(0,U.jsx)(`span`,{className:`font-medium capitalize text-foreground`,children:n.data.role}),`.`]})})]}),s?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`You’re in — taking you to the workspace…`}):d?(0,U.jsx)(X,{type:`button`,className:`w-full`,disabled:a,onClick:()=>void p(),children:a?`Joining…`:`Accept invitation`}):(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(X,{type:`button`,className:`w-full gap-2`,disabled:r,onClick:()=>void f(),children:[(0,U.jsx)(tx,{}),r?`Redirecting…`:`Continue with GitHub`]}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Sign in with GitHub using `,n.data.email,` to accept.`]})]}),l===null?null:(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:l})]})}return(0,U.jsx)(ex,{children:(0,U.jsx)(Jb,{className:`w-full p-6`,children:m})})}function iO(){let{invitationId:e}=aO.useParams();return(0,U.jsx)(rO,{invitationId:e})}var aO=Ki(`/invite/$invitationId`)({component:iO});function oO({className:e,children:t,...n}){return(0,U.jsxs)(xee,{"data-slot":`scroll-area`,className:Y(`relative`,e),...n,children:[(0,U.jsx)(See,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,U.jsx)(sO,{}),(0,U.jsx)(Cee,{})]})}function sO({className:e,orientation:t=`vertical`,...n}){return(0,U.jsx)(Sg,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:Y(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,U.jsx)(Ng,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}var cO={running:{bg:`var(--s-prog-bg)`,fg:`var(--s-prog-fg)`},completed:{bg:`var(--s-done-bg)`,fg:`var(--s-done-fg)`},failed:{bg:`var(--destructive)`,fg:`#ffffff`}};function lO(e){return e===`running`?`Running`:e===`completed`?`Completed`:`Failed`}function uO(e){let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Math.round((Date.now()-t)/1e3);if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return String(r)+`m ago`;let i=Math.round(r/60);if(i<24)return String(i)+`h ago`;let a=Math.round(i/24);return String(a)+`d ago`}function dO(e){let t=cO[e.status];return{label:(e.label??`Agent run`).charAt(0).toUpperCase(),bg:t.bg,fg:t.fg}}function fO({projectId:e,className:t}){let{data:n,isLoading:r,error:i}=tC(e);return(0,U.jsxs)(`aside`,{"aria-label":`Agents activity`,className:Y(`absolute inset-0 flex flex-col overflow-hidden rounded-lg border border-border bg-card shadow-sm`,t),children:[(0,U.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border px-3.5 py-3`,children:[(0,U.jsx)(`h2`,{className:`text-[12.5px] font-semibold`,children:`Agents activity`}),n!==void 0&&n.length>0?(0,U.jsxs)(`span`,{className:`ml-auto text-[11px] text-muted-foreground`,children:[n.length,` runs`]}):null]}),(0,U.jsx)(oO,{className:`min-h-0 flex-1`,children:(0,U.jsxs)(`div`,{className:`px-3 pb-4`,children:[r?(0,U.jsx)(`p`,{className:`px-0.5 py-2.5 text-[12px] text-muted-foreground`,children:`Loading…`}):null,i===null?null:(0,U.jsx)(`p`,{role:`alert`,className:`px-0.5 py-2.5 text-[12px] text-destructive`,children:`Failed to load agent runs`}),!r&&i===null&&n!==void 0&&n.length===0?(0,U.jsx)(`p`,{className:`px-0.5 py-2.5 text-[12px] text-muted-foreground`,children:`No agent runs yet.`}):null,n?.map((e,t)=>{let n=dO(e);return(0,U.jsxs)(`article`,{className:Y(`flex gap-2.5 py-2.5`,t!==0&&`border-t border-border`),children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`mt-px flex size-[22px] shrink-0 select-none items-center justify-center rounded-md text-[10px] font-semibold`,style:{backgroundColor:n.bg,color:n.fg},children:n.label}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`mb-0.5 flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,U.jsx)(`span`,{className:`text-[12px] font-semibold`,children:e.label??`Agent run`}),(0,U.jsx)(Wy,{className:`rounded-full px-1.5 py-0 text-[9px] font-semibold uppercase tracking-[0.05em]`,style:{backgroundColor:cO[e.status].bg,color:cO[e.status].fg},children:lO(e.status)}),(0,U.jsx)(`span`,{className:`ml-auto text-[10.5px] text-muted-foreground`,children:uO(e.started_at)})]}),e.events.length>0?(0,U.jsx)(`ul`,{className:`space-y-0.5`,children:e.events.map(e=>(0,U.jsx)(`li`,{className:`text-[11.5px] leading-snug text-[var(--text-2)]`,children:e.message},e.id))}):null]})]},e.id)})]})})]})}function pO({open:e,onOpenChange:t,title:n,description:r,confirmLabel:i=`Delete`,cancelLabel:a=`Cancel`,busy:o=!1,onConfirm:s}){return(0,U.jsx)($x,{open:e,onOpenChange:e=>{t(e)},children:(0,U.jsxs)(iS,{className:`max-w-sm`,children:[(0,U.jsxs)(aS,{children:[(0,U.jsx)(sS,{children:n}),(0,U.jsx)(cS,{children:r})]}),(0,U.jsxs)(oS,{children:[(0,U.jsx)(X,{type:`button`,variant:`outline`,disabled:o,onClick:()=>{t(!1)},children:a}),(0,U.jsx)(X,{type:`button`,variant:`destructive`,disabled:o,onClick:()=>{s()},children:o?`Deleting…`:i})]})]})})}function mO(e){let t=[];function n(e){for(let r of e)t.push({id:r.id,title:r.title,folder_id:r.folder_id,status_line:r.status_line,linked_task_id:r.linked_task_id,updated_at:r.updated_at}),n(r.children)}return n(e),t}function hO(e,t){return e.filter(e=>e.parent_folder_id===t)}function gO(e,t,n){let r=new Map(e.map(e=>[e.id,e])),i=new Set,a=t;for(;a!==null;){if(a===n)return!0;if(i.has(a))return!1;i.add(a),a=r.get(a)?.parent_folder_id??null}return!1}function _O({open:e,onOpenChange:t,title:n,label:r,placeholder:i,initialValue:a=``,confirmLabel:o=`Create`,busy:s=!1,onSubmit:c}){let[l,u]=(0,H.useState)(a),d=l.trim();return(0,U.jsx)($x,{open:e,onOpenChange:e=>{e&&u(a),t(e)},children:(0,U.jsxs)(iS,{className:`max-w-sm`,children:[(0,U.jsx)(aS,{children:(0,U.jsx)(sS,{children:n})}),(0,U.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d!==``&&c(d)},className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`text-dialog-input`,className:`text-xs text-muted-foreground`,children:r}),(0,U.jsx)(nw,{id:`text-dialog-input`,autoFocus:!0,value:l,placeholder:i,onChange:e=>{u(e.target.value)}})]}),(0,U.jsxs)(oS,{children:[(0,U.jsx)(X,{type:`button`,variant:`outline`,onClick:()=>{t(!1)},children:`Cancel`}),(0,U.jsx)(X,{type:`submit`,disabled:s||d===``,children:o})]})]})]})})}var vO=`__root__`;function yO({open:e,onOpenChange:t,title:n,targets:r,currentId:i,busy:a=!1,onSubmit:o}){let[s,c]=(0,H.useState)(i??vO);return(0,U.jsx)($x,{open:e,onOpenChange:e=>{e&&c(i??vO),t(e)},children:(0,U.jsxs)(iS,{className:`max-w-sm`,children:[(0,U.jsx)(aS,{children:(0,U.jsx)(sS,{children:n})}),(0,U.jsxs)(ww,{value:s,onValueChange:c,children:[(0,U.jsx)(Ew,{children:(0,U.jsx)(Tw,{placeholder:`Choose a destination`})}),(0,U.jsxs)(Dw,{children:[(0,U.jsx)(Ow,{value:vO,children:`Root (no folder)`}),r.map(e=>(0,U.jsx)(Ow,{value:e.id,children:e.name},e.id))]})]}),(0,U.jsxs)(oS,{children:[(0,U.jsx)(X,{type:`button`,variant:`outline`,onClick:()=>{t(!1)},children:`Cancel`}),(0,U.jsx)(X,{type:`button`,disabled:a,onClick:()=>{o(s===vO?null:s)},children:`Move`})]})]})})}function bO({label:e,children:t}){return(0,U.jsxs)(Rb,{children:[(0,U.jsx)(zb,{asChild:!0,children:(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":e,className:`shrink-0 opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100 data-[state=open]:opacity-100`,children:(0,U.jsx)(nte,{})})}),(0,U.jsx)(Bb,{align:`end`,className:`w-40`,children:t})]})}function xO(e){if(e===null)return null;let t=e.replace(/^status:\s*/i,``).trim();return t===``?null:t}function SO({projectId:e,documents:t,folders:n,tasks:r=[]}){let[i,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(null),[m,h]=(0,H.useState)(null),[g,_]=(0,H.useState)(null),[v,y]=(0,H.useState)(null),[b,x]=(0,H.useState)(``),[S,C]=(0,H.useState)(vO),w=zS(e),T=NS(e),E=BS(),D=FS(),O=VS(),k=IS(),A=(0,H.useMemo)(()=>mO(t),[t]),j=(0,H.useMemo)(()=>new Map(n.map(e=>[e.id,e])),[n]),M=(0,H.useMemo)(()=>new Map(r.map(e=>[e.id,e.label])),[r]),N=(0,H.useMemo)(()=>{let e=[],t=i;for(;t!==null;){let n=j.get(t);if(n===void 0)break;e.unshift(n),t=n.parent_folder_id}return e},[i,j]),P=hO(n,i),F=A.filter(e=>i===null?!0:e.folder_id===i).sort((e,t)=>t.updated_at.localeCompare(e.updated_at)),I=(0,H.useMemo)(()=>[...A].sort((e,t)=>t.updated_at.localeCompare(e.updated_at)).slice(0,4),[A]),L=e=>A.filter(t=>t.folder_id===e).length,ee=e=>{w.mutate({name:e,parent_folder_id:i},{onSuccess:()=>{BC(`Folder created`),s(!1)}})},te=()=>{let e=b.trim();e!==``&&T.mutate({title:e,folder_id:i,linked_task_id:S===vO?null:S},{onSuccess:()=>{BC(`Document created`),l(!1),x(``),C(vO)}})},ne=e=>{u!==null&&E.mutate({id:u.id,input:{name:e}},{onSuccess:()=>{BC(`Folder renamed`),d(null)}})},R=e=>{if(f===null||e===f.parent_folder_id){p(null);return}E.mutate({id:f.id,input:{parent_folder_id:e}},{onSuccess:()=>{BC(`Folder moved`),p(null)}})},z=e=>{if(m===null||e===m.folder_id){h(null);return}D.mutate({id:m.id,input:{folder_id:e}},{onSuccess:()=>{BC(`Document moved`),h(null)}})},B=()=>{g!==null&&O.mutate({id:g.id,projectId:e},{onSuccess:()=>{BC(`Folder deleted`),_(null)}})},re=()=>{v!==null&&k.mutate({id:v.id,projectId:e},{onSuccess:()=>{BC(`Document deleted`),y(null)}})},V=f?n.filter(e=>e.id!==f.id&&!gO(n,e.id,f.id)):[],ie=P.length===0&&F.length===0;return(0,U.jsxs)(`section`,{"aria-label":`Documents`,children:[(0,U.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2`,children:[(0,U.jsxs)(`nav`,{"aria-label":`Folder path`,className:`flex items-center gap-1 text-[13px]`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>{a(null)},className:Y(`rounded px-1.5 py-0.5 transition-colors hover:text-foreground`,i===null?`font-medium text-foreground`:`text-muted-foreground`),children:`Documents`}),N.map((e,t)=>(0,U.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,U.jsx)($y,{className:`size-3.5 text-muted-foreground/60`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>{a(e.id)},className:Y(`rounded px-1.5 py-0.5 transition-colors hover:text-foreground`,t===N.length-1?`font-medium text-foreground`:`text-muted-foreground`),children:e.name})]},e.id))]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,disabled:w.isPending,onClick:()=>{s(!0)},children:[(0,U.jsx)(ote,{className:`size-3.5`}),` New folder`]}),(0,U.jsxs)(X,{type:`button`,size:`sm`,disabled:T.isPending,onClick:()=>{l(!0)},children:[(0,U.jsx)(ate,{className:`size-3.5`}),` New document`]})]})]}),i===null&&I.length>0?(0,U.jsxs)(`div`,{className:`mb-6`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,U.jsx)(ete,{className:`size-3.5`}),` Recent`]}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:I.map(t=>(0,U.jsxs)(Bi,{to:`/projects/$id/documents/$docId`,params:{id:e,docId:t.id},className:`group flex flex-col gap-1.5 rounded-lg border bg-card p-3 transition-colors hover:border-[var(--border-strong)] hover:bg-accent`,children:[(0,U.jsx)(tb,{className:`size-4 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`line-clamp-2 text-[13px] font-medium leading-snug`,children:t.title}),xO(t.status_line)===null?null:(0,U.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:xO(t.status_line)})]},t.id))})]}):null,P.length>0?(0,U.jsxs)(`div`,{className:`mb-6`,children:[(0,U.jsx)(`div`,{className:`mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Folders`}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:P.map(e=>{let t=L(e.id),r=hO(n,e.id).length;return(0,U.jsxs)(`div`,{className:`group flex items-center gap-3 rounded-lg border bg-card p-3 transition-colors hover:border-[var(--border-strong)] hover:bg-accent`,children:[(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Open folder ${e.name}`,onClick:()=>{a(e.id)},className:`flex min-w-0 flex-1 items-center gap-3 text-left`,children:[(0,U.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,U.jsx)(ste,{className:`size-5`})}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[13.5px] font-medium`,children:e.name}),(0,U.jsxs)(`span`,{className:`block text-[11.5px] text-muted-foreground`,children:[t,` `,t===1?`document`:`documents`,r>0?` · ${String(r)} ${r===1?`folder`:`folders`}`:``]})]})]}),(0,U.jsxs)(bO,{label:`Actions for folder ${e.name}`,children:[(0,U.jsx)(Vb,{onSelect:()=>{d(e)},children:`Rename`}),(0,U.jsx)(Vb,{onSelect:()=>{p(e)},children:`Move…`}),(0,U.jsx)(Ub,{}),(0,U.jsx)(Vb,{variant:`destructive`,onSelect:()=>{_(e)},children:`Delete`})]})]},e.id)})})]}):null,(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`mb-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:i===null?`All documents`:`Documents`}),ie?(0,U.jsx)(`p`,{className:`rounded-lg border border-dashed py-8 text-center text-[13px] text-muted-foreground`,children:i===null?`No documents yet. Create one to start a spec, design, or investigation.`:`This folder is empty.`}):F.length===0?(0,U.jsx)(`p`,{className:`py-2 text-[13px] text-muted-foreground`,children:`No documents at this level.`}):(0,U.jsx)(`ul`,{className:`divide-y rounded-lg border`,children:F.map(t=>(0,U.jsxs)(`li`,{className:`group flex items-center gap-3 px-3 py-2.5 transition-colors hover:bg-accent`,children:[(0,U.jsx)(tb,{className:`size-4 shrink-0 text-muted-foreground`}),(0,U.jsx)(Bi,{to:`/projects/$id/documents/$docId`,params:{id:e,docId:t.id},className:`min-w-0 flex-1 truncate text-[13.5px] hover:text-foreground`,children:t.title}),xO(t.status_line)===null?null:(0,U.jsx)(`span`,{className:`max-w-[120px] shrink-0 truncate text-[11.5px] text-muted-foreground`,children:xO(t.status_line)}),t.linked_task_id!==null&&M.has(t.linked_task_id)?(0,U.jsx)(Bi,{to:`/projects/$id/board`,params:{id:e},className:`hidden shrink-0 items-center gap-1 rounded-full border bg-muted/50 px-2 py-0.5 text-[11px] text-muted-foreground hover:text-foreground md:inline-flex`,children:M.get(t.linked_task_id)}):null,(0,U.jsxs)(bO,{label:`Actions for document ${t.title}`,children:[(0,U.jsx)(Vb,{onSelect:()=>{h(t)},children:`Move…`}),(0,U.jsx)(Ub,{}),(0,U.jsx)(Vb,{variant:`destructive`,onSelect:()=>{y(t)},children:`Delete`})]})]},t.id))})]}),(0,U.jsx)(_O,{open:o,onOpenChange:s,title:`New folder`,label:`Folder name`,placeholder:`e.g. Design specs`,confirmLabel:`Create folder`,busy:w.isPending,onSubmit:ee}),(0,U.jsx)($x,{open:c,onOpenChange:e=>{l(e),e||(x(``),C(vO))},children:(0,U.jsxs)(iS,{className:`max-w-md`,children:[(0,U.jsx)(aS,{children:(0,U.jsx)(sS,{children:`New document`})}),(0,U.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),te()},className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`new-doc-title`,className:`text-xs text-muted-foreground`,children:`Title`}),(0,U.jsx)(nw,{id:`new-doc-title`,autoFocus:!0,value:b,placeholder:`e.g. Design: caching layer`,onChange:e=>{x(e.target.value)}})]}),r.length>0?(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(rw,{className:`text-xs text-muted-foreground`,children:`Link to a task (optional)`}),(0,U.jsxs)(ww,{value:S,onValueChange:C,children:[(0,U.jsx)(Ew,{children:(0,U.jsx)(Tw,{placeholder:`No linked task`})}),(0,U.jsxs)(Dw,{children:[(0,U.jsx)(Ow,{value:vO,children:`No linked task`}),r.map(e=>(0,U.jsx)(Ow,{value:e.id,children:e.label},e.id))]})]})]}):null,(0,U.jsxs)(oS,{children:[(0,U.jsx)(X,{type:`button`,variant:`outline`,onClick:()=>{l(!1)},children:`Cancel`}),(0,U.jsx)(X,{type:`submit`,disabled:T.isPending||b.trim()===``,children:`Create document`})]})]})]})}),(0,U.jsx)(_O,{open:u!==null,onOpenChange:e=>{e||d(null)},title:`Rename folder`,label:`Folder name`,initialValue:u?.name??``,confirmLabel:`Rename`,busy:E.isPending,onSubmit:ne}),(0,U.jsx)(yO,{open:f!==null,onOpenChange:e=>{e||p(null)},title:f===null?``:`Move "${f.name}"`,targets:V,currentId:f?.parent_folder_id??null,busy:E.isPending,onSubmit:R}),(0,U.jsx)(yO,{open:m!==null,onOpenChange:e=>{e||h(null)},title:m===null?``:`Move "${m.title}"`,targets:n,currentId:m?.folder_id??null,busy:D.isPending,onSubmit:z}),(0,U.jsx)(pO,{open:g!==null,onOpenChange:e=>{e||_(null)},title:g===null?``:`Delete folder "${g.name}"?`,description:`Its documents and subfolders move up a level — nothing is orphaned.`,busy:O.isPending,onConfirm:B}),(0,U.jsx)(pO,{open:v!==null,onOpenChange:e=>{e||y(null)},title:v===null?``:`Delete "${v.title}"?`,description:`This document and its comments will be deleted. This cannot be undone.`,busy:k.isPending,onConfirm:re})]})}var CO={active:{bg:`var(--s-todo-bg)`,fg:`var(--s-todo-fg)`,dot:`var(--s-todo-dot)`},paused:{bg:`var(--s-prog-bg)`,fg:`var(--s-prog-fg)`,dot:`var(--s-prog-dot)`},complete:{bg:`var(--s-done-bg)`,fg:`var(--s-done-fg)`,dot:`var(--s-done-dot)`},blocked:{bg:`var(--destructive)`,fg:`var(--primary-foreground)`,dot:`var(--destructive)`}},wO={active:`Active`,paused:`Paused`,complete:`Complete`,blocked:`Blocked`};function TO({status:e,className:t}){let n=CO[e];return(0,U.jsxs)(`span`,{"data-slot":`badge`,"data-goal-status":e,className:Y(Uy({variant:`secondary`}),`border-transparent gap-1.5 px-2 py-0.5 text-[10.5px] font-semibold uppercase tracking-wide`,t),style:{backgroundColor:n.bg,color:n.fg},children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full`,style:{backgroundColor:n.dot}}),wO[e]]})}function EO({verification:e}){return e===null?(0,U.jsx)($ee,{className:`size-3.5 text-muted-foreground`,"aria-label":`acceptance unknown`}):e.green?(0,U.jsx)(Zy,{className:`size-3.5 text-[var(--s-done-fg)]`,"aria-label":`acceptance passed`}):(0,U.jsx)(Lb,{className:`size-3.5 text-destructive`,"aria-label":`acceptance failed`})}function DO({verification:e}){if(e===null)return(0,U.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-lg border border-border bg-muted px-3 py-2 text-sm text-muted-foreground`,"data-acceptance":`unknown`,children:[(0,U.jsx)(EO,{verification:e}),(0,U.jsx)(`span`,{children:`No verification recorded yet`})]});let t=e.green;return(0,U.jsxs)(`div`,{className:Y(`inline-flex items-center gap-2 rounded-lg border px-3 py-2 text-sm`,t?`border-[var(--s-done-dot)]/30 bg-[var(--s-done-bg)] text-[var(--s-done-fg)]`:`border-destructive/30 bg-destructive/10 text-destructive`),"data-acceptance":t?`passed`:`failed`,children:[(0,U.jsx)(EO,{verification:e}),(0,U.jsxs)(`span`,{children:[t?`Passed`:`Failed`,e.detail===void 0?``:` — ${e.detail}`,` `,(0,U.jsxs)(`span`,{className:`text-xs opacity-80`,children:[`(`,new Date(e.at).toLocaleString(),`)`]})]})]})}var OO=[{status:`scope`,label:`Scope`,dot:`var(--s-scope-dot)`},{status:`todo`,label:`To do`,dot:`var(--s-todo-dot)`},{status:`in_progress`,label:`In progress`,dot:`var(--s-prog-dot)`},{status:`done`,label:`Done`,dot:`var(--s-done-dot)`},{status:`backlog`,label:`Backlog`,dot:`var(--s-back-dot)`}];function kO(){let{id:e}=AO.useParams(),t=Ei(),{data:n,isLoading:r,error:i}=xS(e),{data:a,isLoading:o,isError:s}=aC(e),{data:c,isLoading:l,isError:u}=MS(e),d=OS(),f=kS(),[p,m]=(0,H.useState)(``),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(!1);(0,H.useEffect)(()=>{n!==void 0&&m(n.name)},[n?.name,n]);let y=()=>{let t=p.trim();if(n===void 0||t===``||t===n.name){m(n?.name??``),g(!1);return}d.mutate({id:e,input:{name:t}},{onSuccess:()=>{g(!1)}})};if(r)return(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading project…`});if(i)return(0,U.jsxs)(`p`,{role:`alert`,children:[`Failed to load project: `,i.message]});if(n===void 0)return(0,U.jsx)(`p`,{children:`Project not found.`});let b=Da.reduce((e,t)=>e+n.summary[t],0),x=b===0?0:Math.round(n.summary.done/b*100),S=[...a??[]].sort((e,t)=>(e.status===`complete`)-+(t.status===`complete`)).slice(0,5),C=mO(c??[]).sort((e,t)=>t.updated_at.localeCompare(e.updated_at)).slice(0,6);return(0,U.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-6`,children:[(0,U.jsxs)(`header`,{children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[h?(0,U.jsx)(nw,{type:`text`,value:p,autoFocus:!0,onChange:e=>{m(e.target.value)},onBlur:y,onKeyDown:e=>{e.key===`Enter`&&y(),e.key===`Escape`&&(m(n.name),g(!1))},"aria-label":`Project name`,className:`h-auto max-w-md flex-1 border-0 border-b border-border bg-transparent px-0 py-1 text-2xl font-semibold tracking-tight shadow-none focus-visible:border-ring focus-visible:ring-0`}):(0,U.jsxs)(`div`,{className:`group flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`h1`,{className:`truncate text-2xl font-semibold tracking-tight`,children:n.name}),(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Rename project`,className:`opacity-50 transition-opacity hover:opacity-100 focus-visible:opacity-100`,onClick:()=>{g(!0)},children:(0,U.jsx)(bb,{className:`size-3.5`})})]}),(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`shrink-0 text-muted-foreground hover:text-destructive`,disabled:f.isPending,onClick:()=>{v(!0)},children:`Delete project`})]}),n.description?(0,U.jsx)(`p`,{className:`mt-1.5 max-w-3xl text-sm text-muted-foreground`,children:n.description}):null]}),(0,U.jsxs)(`section`,{"aria-label":`Task status`,className:`rounded-xl border bg-card p-4 shadow-[var(--shadow)]`,children:[(0,U.jsxs)(`div`,{className:`mb-3 flex items-baseline justify-between`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-medium`,children:`Progress`}),(0,U.jsxs)(Bi,{to:`/projects/$id/board`,params:{id:e},className:`inline-flex items-center gap-1 text-[13px] text-muted-foreground hover:text-foreground`,children:[`Open board `,(0,U.jsx)(Xy,{className:`size-3.5`})]})]}),(0,U.jsxs)(`div`,{className:`mb-3 flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,U.jsx)(`div`,{className:`h-full rounded-full bg-[var(--s-done-dot)] transition-[width]`,style:{width:`${String(x)}%`}})}),(0,U.jsxs)(`span`,{className:`text-[13px] tabular-nums text-muted-foreground`,children:[n.summary.done,`/`,b,` done`]})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-5`,children:OO.map(e=>(0,U.jsxs)(`div`,{className:`rounded-lg border bg-background px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`size-2 shrink-0 rounded-full`,style:{backgroundColor:e.dot}}),(0,U.jsx)(`span`,{className:`truncate text-[11.5px] text-muted-foreground`,children:e.label})]}),(0,U.jsx)(`div`,{className:`mt-0.5 text-xl font-semibold tabular-nums`,children:n.summary[e.status]})]},e.status))})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,U.jsxs)(`section`,{"aria-label":`Goals`,className:`flex flex-col rounded-xl border bg-card p-4 shadow-[var(--shadow)]`,children:[(0,U.jsxs)(`div`,{className:`mb-3 flex items-baseline justify-between`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-medium`,children:`Goals`}),(0,U.jsxs)(Bi,{to:`/projects/$id/goals`,params:{id:e},className:`inline-flex items-center gap-1 text-[13px] text-muted-foreground hover:text-foreground`,children:[`All goals `,(0,U.jsx)(Xy,{className:`size-3.5`})]})]}),o?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):s?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Couldn't load goals`}):S.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No goals yet.`}):(0,U.jsx)(`ul`,{className:`m-0 flex flex-col gap-2 p-0`,children:S.map(t=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(Bi,{to:`/projects/$id/goals`,params:{id:e},className:`flex items-center gap-2.5 rounded-lg border px-3 py-2 transition-colors hover:bg-accent`,children:[(0,U.jsx)(EO,{verification:t.last_verification}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13.5px]`,children:t.objective}),(0,U.jsx)(TO,{status:t.status})]})},t.id))})]}),(0,U.jsx)(`section`,{"aria-label":`Agent activity`,className:`min-h-0`,children:(0,U.jsx)(`div`,{className:`relative h-[360px]`,children:(0,U.jsx)(fO,{projectId:e})})})]}),(0,U.jsxs)(`section`,{"aria-label":`Recent documents`,children:[(0,U.jsxs)(`div`,{className:`mb-2.5 flex items-baseline justify-between`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-medium`,children:`Recent documents`}),(0,U.jsxs)(Bi,{to:`/projects/$id/documents`,params:{id:e},className:`inline-flex items-center gap-1 text-[13px] text-muted-foreground hover:text-foreground`,children:[`All documents `,(0,U.jsx)(Xy,{className:`size-3.5`})]})]}),l?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):u?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Couldn't load documents`}):C.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No documents yet.`}):(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3`,children:C.map(t=>(0,U.jsxs)(Bi,{to:`/projects/$id/documents/$docId`,params:{id:e,docId:t.id},className:`group flex items-start gap-2.5 rounded-lg border bg-card p-3 transition-colors hover:border-[var(--border-strong)] hover:bg-accent`,children:[(0,U.jsx)(tb,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`line-clamp-2 text-[13px] font-medium leading-snug`,children:t.title})]},t.id))})]}),(0,U.jsx)(pO,{open:_,onOpenChange:v,title:`Delete "${n.name}"?`,description:`This deletes the project and all its tasks, documents, and edges. This cannot be undone.`,confirmLabel:`Delete project`,busy:f.isPending,onConfirm:()=>{f.mutate(e,{onSuccess:()=>{v(!1),t({to:`/`})}})}})]})}var AO=Ki(`/projects/$id/overview`)({component:kO}),jO=Ki(`/projects/$id/notes`)({component:na}),MO=[`low`,`medium`,`high`];function NO(e,t){let n=[e.trim()];t!==``&&n.push(`Severity: ${t}`);let r=n.filter(e=>e!==``).join(`
|
|
115
|
+
|
|
116
|
+
`);return r===``?void 0:r}function PO({projectId:e}){let[t,n]=(0,H.useState)(!1),[r,i]=(0,H.useState)(``),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(``),[l,u]=(0,H.useState)(null),d=wS(e),f=r.trim(),p=f.length>0&&!d.isPending;function m(e){e.preventDefault(),p&&(u(null),d.mutate({label:f,description:NO(a,s)??null,status:`backlog`},{onSuccess:()=>{i(``),o(``),c(``),n(!1),u(`Filed ✓`),BC.success(`Filed ✓`)}}))}return(0,U.jsxs)(`section`,{"aria-label":`File an issue`,className:`mb-6 rounded-lg border border-border bg-muted/40 p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold`,children:`File an issue`}),t?null:(0,U.jsx)(X,{type:`button`,size:`sm`,onClick:()=>{n(!0)},children:`New issue`})]}),l===null?null:(0,U.jsx)(`p`,{role:`status`,className:`sr-only`,children:l}),d.isError?(0,U.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:`Something went wrong. Please try again.`}):null,t?(0,U.jsxs)(`form`,{onSubmit:m,className:`mt-4 grid gap-3.5`,children:[(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`file-issue-title`,children:`Title`}),(0,U.jsx)(nw,{id:`file-issue-title`,type:`text`,name:`title`,value:r,onChange:e=>{i(e.target.value)},required:!0,disabled:d.isPending})]}),(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsxs)(rw,{htmlFor:`file-issue-body`,children:[`Description `,(0,U.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,U.jsx)(qD,{id:`file-issue-body`,name:`body`,value:a,onChange:e=>{o(e.target.value)},rows:4,disabled:d.isPending})]}),(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsxs)(rw,{htmlFor:`file-issue-severity`,children:[`Severity `,(0,U.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,U.jsxs)(ww,{value:s===``?`none`:s,onValueChange:e=>{c(e===`none`?``:e)},disabled:d.isPending,children:[(0,U.jsx)(Ew,{id:`file-issue-severity`,className:`w-full`,"aria-label":`Severity`,children:(0,U.jsx)(Tw,{placeholder:`—`})}),(0,U.jsxs)(Dw,{children:[(0,U.jsx)(Ow,{value:`none`,children:`—`}),MO.map(e=>(0,U.jsx)(Ow,{value:e,children:e},e))]})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(X,{type:`submit`,disabled:!p,children:d.isPending?`Filing…`:`File issue`}),(0,U.jsx)(X,{type:`button`,variant:`outline`,disabled:d.isPending,onClick:()=>{n(!1)},children:`Cancel`})]})]}):null]})}function FO({className:e,size:t=`default`,...n}){return(0,U.jsx)(Au,{"data-slot":`avatar`,"data-size":t,className:Y(`group/avatar relative flex size-8 shrink-0 overflow-hidden rounded-full select-none data-[size=lg]:size-10 data-[size=sm]:size-6`,e),...n})}function IO({className:e,...t}){return(0,U.jsx)(Pu,{"data-slot":`avatar-fallback`,className:Y(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}function LO(e){this.content=e}LO.prototype={constructor:LO,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new LO(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new LO(n)},addToStart:function(e,t){return new LO([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new LO(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new LO(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=LO.from(e),e.size?new LO(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=LO.from(e),e.size?new LO(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=LO.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},LO.from=function(e){if(e instanceof LO)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new LO(t)};function RO(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=RO(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function zO(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=zO(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var Z=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return RO(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return zO(this,e,t,n)}findIndex(e){if(e==0)return VO(0,e);if(e==this.size)return VO(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?VO(t+1,i):VO(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};Z.empty=new Z([],0);var BO={index:0,offset:0};function VO(e,t){return BO.index=e,BO.offset=t,BO}function HO(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!HO(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!HO(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var UO=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&HO(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};UO.none=[];var WO=class extends Error{},Q=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=KO(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(GO(this.content,t+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(Z.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};Q.empty=new Q(Z.empty,0,0);function GO(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(GO(a.content,t-i-1,n-i-1)))}function KO(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=KO(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function qO(e,t,n){if(n.openStart>e.depth)throw new WO(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new WO(`Inconsistent open depths`);return JO(e,t,n,0)}function JO(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=JO(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return $O(a,tk(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return $O(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=nk(n,e);return $O(a,ek(e,i,o,t,r))}}function YO(e,t){if(!t.type.compatibleContent(e.type))throw new WO(`Cannot join `+t.type.name+` onto `+e.type.name)}function XO(e,t,n){let r=e.node(n);return YO(r,t.node(n)),r}function ZO(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function QO(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(ZO(e.nodeAfter,r),a++));for(let e=a;e<o;e++)ZO(i.child(e),r);t&&t.depth==n&&t.textOffset&&ZO(t.nodeBefore,r)}function $O(e,t){return e.type.checkContent(t),e.copy(t)}function ek(e,t,n,r,i){let a=e.depth>i&&XO(e,t,i+1),o=r.depth>i&&XO(n,r,i+1),s=[];return QO(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(YO(a,o),ZO($O(a,ek(e,t,n,r,i+1)),s)):(a&&ZO($O(a,tk(e,t,i+1)),s),QO(t,n,i,s),o&&ZO($O(o,tk(n,r,i+1)),s)),QO(r,null,i,s),new Z(s)}function tk(e,t,n){let r=[];return QO(null,e,n,r),e.depth>n&&ZO($O(XO(e,t,n+1),tk(e,t,n+1)),r),QO(t,null,n,r),new Z(r)}function nk(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(Z.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var rk=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.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 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 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,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return UO.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new sk(this,e,n);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 t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=ok.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else ok.set(t,r=new ik);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%ak,i}},ik=class{constructor(){this.elts=[],this.i=0}},ak=12,ok=new WeakMap,sk=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}},ck=Object.create(null),lk=class e{constructor(e,t,n,r=UO.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||Z.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,t,n,r=0){this.content.nodesBetween(e,t,n,r,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,t,n,r){return this.content.textBetween(e,t,n,r)}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,t,n){return this.type==e&&HO(this.attrs,t||e.defaultAttrs||ck)&&UO.sameSet(this.marks,n||UO.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Q.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new Q(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return qO(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return rk.resolveCached(this,e)}resolveNoCache(e){return rk.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),dk(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=Z.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.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=UO.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!UO.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t 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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=Z.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};lk.prototype.text=void 0;var uk=class e extends lk{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):dk(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function dk(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var fk=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new pk(t,n);if(r.next==null)return e.empty;let i=mk(r);r.next&&r.err(`Unexpected trailing text`);let a=wk(xk(i));return Tk(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return Z.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
117
|
+
`)}};fk.empty=new fk(!0);var pk=class{constructor(e,t){this.string=e,this.nodeTypes=t,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 SyntaxError(e+` (in content expression '`+this.string+`')`)}};function mk(e){let t=[];do t.push(hk(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function hk(e){let t=[];do t.push(gk(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function gk(e){let t=bk(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=vk(e,t);else break;return t}function _k(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function vk(e,t){let n=_k(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:_k(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function yk(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function bk(e){if(e.eat(`(`)){let t=mk(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=yk(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function xk(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function Sk(e,t){return t-e}function Ck(e,t){let n=[];return r(t),n.sort(Sk);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function wk(e){let t=Object.create(null);return n(Ck(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Ck(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new fk(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(Sk);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Tk(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Ek(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Dk(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Ok(e,t,n,r){for(let r in t)if(!(r in e))throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function kk(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Mk(e,r,t[r]);return n}var Ak=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=kk(e,n.attrs),this.defaultAttrs=Ek(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==fk.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:Dk(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new lk(this,this.computeAttrs(e),Z.from(t),UO.setFrom(n))}createChecked(e=null,t,n){return t=Z.from(t),this.checkContent(t),new lk(this,this.computeAttrs(e),t,UO.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=Z.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(Z.empty,!0);return i?new lk(this,e,t.append(i),UO.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ok(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 t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:UO.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function jk(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var Mk=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?jk(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Nk=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=kk(e,r.attrs),this.excluded=null;let i=Ek(this.attrs);this.instance=i?new UO(this,i):null}create(e=null){return!e&&this.instance?this.instance:new UO(this,Dk(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ok(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Pk=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=LO.from(e.nodes),t.marks=LO.from(e.marks||{}),this.nodes=Ak.compile(this.spec.nodes,this),this.marks=Nk.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=fk.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Fk(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Fk(this,n.split(` `))}this.nodeFromJSON=e=>lk.fromJSON(this,e),this.markFromJSON=e=>UO.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Ak))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new uk(n,n.defaultAttrs,e,UO.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Fk(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Ik(e){return e.tag!=null}function Lk(e){return e.style!=null}var Rk=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Ik(e))this.tags.push(e);else if(Lk(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new qk(this,t,!1);return n.addAll(e,UO.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new qk(this,t,!0);return n.addAll(e,UO.none,t.from,t.to),Q.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(Yk(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Xk(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=Xk(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},zk={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},Bk={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Vk={ol:!0,ul:!0},Hk=1,Uk=2,Wk=4;function Gk(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Hk:0)|(t===`full`?Uk:0)}var Kk=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=UO.none,this.match=i||(a&Wk?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Z.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Hk)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=Z.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Z.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!zk.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},qk=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Gk(null,t.preserveWhitespace,0)|(n?Wk:0);i=r?new Kk(r.type,r.attrs,UO.none,!0,t.topMatch||r.type.contentMatch,a):n?new Kk(null,null,UO.none,!0,null,a):new Kk(e.schema.topNodeType,null,UO.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Uk?`full`:this.localPreserveWS||(r.options&Hk)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
|
|
118
|
+
`);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Vk.hasOwnProperty(a)&&this.parser.normalizeLists&&Jk(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:Bk.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(zk.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
119
|
+
`),t)}ignoreFallback(e,t){e.nodeName==`BR`&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text(`-`),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=UO.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):Zk(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=Gk(e,i,a.options);a.options&Wk&&a.content.length==0&&(o|=Wk);let s=UO.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):Zk(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new Kk(e,t,s,r,null,o)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].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 t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=Hk);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf(`|`)>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function Jk(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&Vk.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function Yk(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Xk(e){let t={};for(let n in e)t[n]=e[n];return t}function Zk(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var Qk=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=eA(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return eA(t).createTextNode(e.text);let{dom:n,contentDOM:r}=iA(eA(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&iA(eA(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:iA(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=$k(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return $k(e.marks)}};function $k(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function eA(e){return e.document||window.document}var tA=new WeakMap;function nA(e){let t=tA.get(e);return t===void 0&&tA.set(e,t=rA(e)),t}function rA(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function iA(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=nA(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=iA(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var aA=65535,oA=2**16;function sA(e,t){return e+t*oA}function cA(e){return e&aA}function lA(e){return(e-(e&aA))/oA}var uA=1,dA=2,fA=4,pA=8,mA=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&pA)>0}get deletedBefore(){return(this.delInfo&5)>0}get deletedAfter(){return(this.delInfo&6)>0}get deletedAcross(){return(this.delInfo&fA)>0}},hA=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=cA(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+lA(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:sA(o/3,e-s),f=e==s?dA:e==u?uA:fA;return(t<0?e!=s:e!=u)&&(f|=pA),new mA(a,f,d)}r+=l-c}return n?e+r:new mA(e+r,0,null)}touches(e,t){let n=0,r=cA(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};hA.empty=new hA([]);var gA=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||=[],this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new mA(e,r,null)}},_A=Object.create(null),vA=class{getMap(){return hA.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=_A[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in _A)throw RangeError(`Duplicate use of step JSON ID `+e);return _A[e]=t,t.prototype.jsonID=e,t}},yA=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof WO)return e.fail(t.message);throw t}}};function bA(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(bA(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return Z.fromArray(r)}var xA=class e extends vA{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new Q(bA(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return yA.fromReplace(e,this.from,this.to,i)}invert(){return new SA(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};vA.jsonID(`addMark`,xA);var SA=class e extends vA{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Q(bA(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return yA.fromReplace(e,this.from,this.to,n)}invert(){return new xA(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};vA.jsonID(`removeMark`,SA);var CA=class e extends vA{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return yA.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return yA.fromReplace(e,this.pos,this.pos+1,new Q(Z.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new wA(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};vA.jsonID(`addNodeMark`,CA);var wA=class e extends vA{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return yA.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return yA.fromReplace(e,this.pos,this.pos+1,new Q(Z.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new CA(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};vA.jsonID(`removeNodeMark`,wA);var TA=class e extends vA{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&DA(e,this.from,this.to)?yA.fail(`Structure replace would overwrite content`):yA.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new hA([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?Q.empty:new Q(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?Q.empty:new Q(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,Q.fromJSON(t,n.slice),!!n.structure)}};TA.MAP_BIAS=1,vA.jsonID(`replace`,TA);var EA=class e extends vA{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(DA(e,this.from,this.gapFrom)||DA(e,this.gapTo,this.to)))return yA.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return yA.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?yA.fromReplace(e,this.from,this.to,n):yA.fail(`Content does not fit in gap`)}getMap(){return new hA([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,Q.fromJSON(t,n.slice),n.insert,!!n.structure)}};vA.jsonID(`replaceAround`,EA);function DA(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function OA(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new SA(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new xA(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function kA(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof Nk){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new SA(t.from,t.to,t.style)))}function AA(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new TA(s,l,Q.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new SA(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new Q(Z.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new TA(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(Z.empty,!0);e.replace(s,s,new Q(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function jA(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function MA(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!jA(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function NA(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=Z.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=Z.from(r.node(e).copy(u)),d++):c--;let f=Z.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=Z.from(i.node(e).copy(f)),p++):l++;e.step(new EA(c,l,o,s,new Q(u.append(f),d,p),u.size-d,!0))}function PA(e,t,n=null,r=e){let i=IA(e,t),a=i&&LA(r,t);return a?i.map(FA).concat({type:t,attrs:n}).concat(a.map(FA)):null}function FA(e){return{type:e,attrs:null}}function IA(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function LA(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function RA(e,t,n){let r=Z.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=Z.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new EA(i,a,i,a,new Q(r,0,0),n.length,!0))}function zA(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&HA(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&VA(e,t,n,a),AA(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new EA(c,l,c+1,l-1,new Q(Z.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&BA(e,t,n,a),!1}})}function BA(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function VA(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
|
|
120
|
+
`))}})}function HA(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function UA(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw RangeError(`No node at given position`);n||=a.type;let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw RangeError(`Invalid content for node type `+n.name);e.step(new EA(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new Q(Z.from(o),0,0),1,!0))}function WA(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>a;e--,t--){let n=i.node(e),a=i.index(e);if(n.type.spec.isolating)return!1;let o=n.content.cutByIndex(a,n.childCount),s=r&&r[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let c=r&&r[t]||n;if(!n.canReplace(a+1,n.childCount)||!c.type.validContent(o))return!1}let s=i.indexAfter(a),c=r&&r[0];return i.node(a).canReplaceWith(s,s,c?c.type:i.node(a+1).type)}function GA(e,t,n=1,r){let i=e.doc.resolve(t),a=Z.empty,o=Z.empty;for(let e=i.depth,t=i.depth-n,s=n-1;e>t;e--,s--){a=Z.from(i.node(e).copy(a));let t=r&&r[s];o=Z.from(t?t.type.create(t.attrs,o):i.node(e).copy(o))}e.step(new TA(t,t,new Q(a.append(o),n,n),!0))}function KA(e,t){let n=e.resolve(t),r=n.index();return JA(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function qA(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let a=t.child(i),o=a.type==r?e.type.schema.nodes.text:a.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(a.marks))return!1}return n.validEnd}function JA(e,t){return!!(e&&t&&!e.isLeaf&&qA(e,t))}function YA(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,a,o=r.index(e);if(e==r.depth?(i=r.nodeBefore,a=r.nodeAfter):n>0?(i=r.node(e+1),o++,a=r.node(e).maybeChild(o)):(i=r.node(e).maybeChild(o-1),a=r.node(e+1)),i&&!i.isTextblock&&JA(i,a)&&r.node(e).canReplace(o,o+1))return t;if(e==0)break;t=n<0?r.before(e):r.after(e)}}function XA(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let e=o.whitespace==`pre`,t=!!o.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let s=e.steps.length;if(r===!1){let r=e.doc.resolve(t+n);VA(e,r.node(),r.before(),s)}o.inlineContent&&AA(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let c=e.mapping.slice(s),l=c.map(t-n);if(e.step(new TA(l,c.map(t+n,-1),Q.empty,!0)),r===!0){let t=e.doc.resolve(l);BA(e,t.node(),t.before(),e.steps.length)}return e}function ZA(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}function QA(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(n.openStart==0&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,a=r.index(t)+ +(n>0),o=r.node(t),s=!1;if(e==1)s=o.canReplace(a,a,i);else{let e=o.contentMatchAt(a).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(a,a,e[0])}if(s)return n==0?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function $A(e,t,n=t,r=Q.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return ej(i,a,r)?new TA(t,n,r):new tj(i,a,r).fit()}function ej(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var tj=class{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Z.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=Z.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,a=n.depth,o=r.depth;for(;a&&o&&i.childCount==1;)i=i.firstChild.content,a--,o--;let s=new Q(i,a,o);return e>-1?new EA(n.pos,e,this.$to.pos,this.$to.end(),s,t):s.size||n.pos!=this.$to.pos?new TA(n.pos,r.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=ij(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let{type:a,match:o}=this.frontier[e],s,c=null;if(t==1&&(i?o.matchType(i.type)||(c=o.fillBefore(Z.from(i),!1)):r&&a.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(t==2&&i&&(s=o.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:s};if(r&&o.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=ij(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new Q(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=ij(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new Q(nj(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new Q(nj(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let a=this.unplaced,o=n?n.content:a.content,s=a.openStart-e,c=0,l=[],{match:u,type:d}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)l.push(r.child(e));u=u.matchFragment(r)}let f=o.size+e-(a.content.size-a.openEnd);for(;c<o.childCount;){let e=o.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||s==0||e.content.size)&&(u=t,l.push(aj(e.mark(d.allowedMarks(e.marks)),c==1?s:0,c==o.childCount?f:-1)))}let p=c==o.childCount;p||(f=-1),this.placed=rj(this.placed,t,Z.from(l)),this.frontier[t].match=u,p&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=o;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?e==0?Q.empty:new Q(nj(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new Q(nj(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!oj(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){scan:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=oj(e,t,r,n,i);if(a){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=oj(e,n,r,t,!0);if(!i||i.childCount)continue scan}return{depth:t,fit:a,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=rj(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=rj(this.placed,this.depth,Z.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Z.empty,!0);e.childCount&&(this.placed=rj(this.placed,this.frontier.length,e))}};function nj(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(nj(e.firstChild.content,t-1,n)))}function rj(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(rj(e.lastChild.content,t-1,n)))}function ij(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function aj(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,aj(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Z.empty,!0)))),e.copy(r)}function oj(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!sj(n,a.content,o)?s:null}function sj(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function cj(e){return e.spec.defining||e.spec.definingForContent}function lj(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),a=e.doc.resolve(n);if(ej(i,a,r))return e.step(new TA(t,n,r));let o=pj(i,a);o[o.length-1]==0&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==t&&o.splice(1,0,-e)}let c=o.indexOf(s),l=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(l.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){let t=l[e],n=cj(t.type);if(n&&!t.sameMarkup(i.node(Math.abs(s)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let s=(t+u+1)%(r.openStart+1),d=l[s];if(d)for(let t=0;t<o.length;t++){let l=o[(t+c)%o.length],u=!0;l<0&&(u=!1,l=-l);let f=i.node(l-1),p=i.index(l-1);if(f.canReplaceWith(p,p,d.type,d.marks))return e.replace(i.before(l),u?a.after(l):n,new Q(uj(r.content,0,r.openStart,s),s,r.openEnd))}}let d=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(t,n,r),!(e.steps.length>d));s--){let e=o[s];e<0||(t=i.before(e),n=a.after(e))}}function uj(e,t,n,r,i){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(uj(i.content,t+1,n,r,i)))}if(t>r){let t=i.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Z.empty,!0))}return e}function dj(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=ZA(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new Q(Z.from(r),0,0))}function fj(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let a=r.sharedDepth(n),o=!1;for(let e=r.depth;e>a;e--)r.node(e).type.spec.isolating&&(o=!0);for(let e=i.depth;e>a;e--)i.node(e).type.spec.isolating&&(o=!0);if(!o){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=pj(r,i);for(let t=0;t<a.length;t++){let n=a[t],o=t==a.length-1;if(o&&n==0||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(o||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let a=1;a<=r.depth&&a<=i.depth;a++)if(t-r.start(a)==r.depth-a&&n>r.end(a)&&i.end(a)-n!=i.depth-a&&r.start(a-1)==i.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),i.index(a-1)))return e.delete(r.before(a),n);e.delete(t,n)}function pj(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}var mj=class e extends vA{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return yA.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return yA.fromReplace(e,this.pos,this.pos+1,new Q(Z.from(r),0,+!t.isLeaf))}getMap(){return hA.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};vA.jsonID(`attr`,mj);var hj=class e extends vA{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return yA.ok(n)}getMap(){return hA.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};vA.jsonID(`docAttr`,hj);var gj=class extends Error{};gj=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},gj.prototype=Object.create(Error.prototype),gj.prototype.constructor=gj,gj.prototype.name=`TransformError`;var _j=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new gA}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new gj(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,a)=>{e=Math.min(e,i),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=Q.empty){let r=$A(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new Q(Z.from(n),0,0))}delete(e,t){return this.replace(e,t,Q.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return lj(this,e,t,n),this}replaceRangeWith(e,t,n){return dj(this,e,t,n),this}deleteRange(e,t){return fj(this,e,t),this}lift(e,t){return NA(this,e,t),this}join(e,t=1){return XA(this,e,t),this}wrap(e,t){return RA(this,e,t),this}setBlockType(e,t=e,n,r=null){return zA(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return UA(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new mj(e,t,n)),this}setDocAttribute(e,t){return this.step(new hj(e,t)),this}addNodeMark(e,t){return this.step(new CA(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError(`No node at position `+e);if(t instanceof UO)t.isInSet(n.marks)&&this.step(new wA(e,t));else{let r=n.marks,i,a=[];for(;i=t.isInSet(r);)a.push(new wA(e,i)),r=i.removeFromSet(r);for(let e=a.length-1;e>=0;e--)this.step(a[e])}return this}split(e,t=1,n){return GA(this,e,t,n),this}addMark(e,t,n){return OA(this,e,t,n),this}removeMark(e,t,n){return kA(this,e,t,n),this}clearIncompatible(e,t,n){return AA(this,e,t,n),this}},vj=Object.create(null),yj=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new bj(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=Q.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?Q.empty:t),o==0&&Aj(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),Aj(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new Cj(e):kj(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?kj(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):kj(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Dj(e.node(0))}static atStart(e){return kj(e,e,0,0,1)||new Dj(e)}static atEnd(e){return kj(e,e,e.content.size,e.childCount,-1)||new Dj(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=vj[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in vj)throw RangeError(`Duplicate use of selection JSON ID `+e);return vj[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Cj.between(this.$anchor,this.$head).getBookmark()}};yj.prototype.visible=!0;var bj=class{constructor(e,t){this.$from=e,this.$to=t}},xj=!1;function Sj(e){!xj&&!e.parent.inlineContent&&(xj=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var Cj=class e extends yj{constructor(e,t=e){Sj(e),Sj(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return yj.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=Q.empty){if(super.replace(e,t),t==Q.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new wj(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=yj.findFrom(n,r,!0)||yj.findFrom(n,-r,!0);if(e)n=e.$head;else return yj.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(yj.findFrom(t,-r,!0)||yj.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};yj.jsonID(`text`,Cj);var wj=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return Cj.between(e.resolve(this.anchor),e.resolve(this.head))}},Tj=class e extends yj{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?yj.near(a):new e(a)}content(){return new Q(Z.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new Ej(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};Tj.prototype.visible=!1,yj.jsonID(`node`,Tj);var Ej=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new wj(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Tj.isSelectable(n)?new Tj(t):yj.near(t)}},Dj=class e extends yj{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Q.empty){if(t==Q.empty){e.delete(0,e.doc.content.size);let t=yj.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return Oj}};yj.jsonID(`all`,Dj);var Oj={map(){return this},resolve(e){return new Dj(e)}};function kj(e,t,n,r,i,a=!1){if(t.inlineContent)return Cj.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=kj(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&Tj.isSelectable(r))return Tj.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function Aj(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof TA||i instanceof EA))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(yj.near(e.doc.resolve(o),n))}var jj=1,Mj=2,Nj=4,Pj=class extends _j{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 RangeError(`Selection passed to setSelection must point at the current document`);return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|jj)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&jj)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Mj,this}ensureMarks(e){return UO.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&Mj)>0}addStep(e,t){super.addStep(e,t),this.updated&=-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||UO.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(n??=t,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(yj.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e==`string`?e:e.key]=t,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|=Nj,this}get scrolledIntoView(){return(this.updated&Nj)>0}};function Fj(e,t){return!t||!e?e:e.bind(t)}var Ij=class{constructor(e,t,n){this.name=e,this.init=Fj(t.init,n),this.apply=Fj(t.apply,n)}},Lj=[new Ij(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Ij(`selection`,{init(e,t){return e.selection||yj.atStart(t.doc)},apply(e){return e.selection}}),new Ij(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Ij(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],Rj=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Lj.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError(`Adding different instances of a keyed plugin (`+e.key+`)`);this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Ij(e.key,e.spec.state,e))})}},zj=class e{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,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let a=0;a<this.config.plugins.length;a++){let o=this.config.plugins[a];if(o.spec.appendTransaction){let s=r?r[a].n:0,c=r?r[a].state:this,l=s<t.length&&o.spec.appendTransaction.call(o,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,a)){if(l.setMeta(`appendedTransaction`,e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<a?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[a]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError(`Applying a mismatched transaction`);let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new Pj(this)}static create(t){let n=new Rj(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new Rj(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&typeof e==`object`)for(let n in e){if(n==`doc`||n==`selection`)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(t,n,r){if(!n)throw RangeError(`Invalid input for EditorState.fromJSON`);if(!t.schema)throw RangeError(`Required config field 'schema' missing`);let i=new Rj(t.schema,t.plugins),a=new e(i);return i.fields.forEach(e=>{if(e.name==`doc`)a.doc=lk.fromJSON(t.schema,n.doc);else if(e.name==`selection`)a.selection=yj.fromJSON(a.doc,n.selection);else if(e.name==`storedMarks`)n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let o=r[i],s=o.spec.state;if(o.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){a[e.name]=s.fromJSON.call(o,t,n[i],a);return}}a[e.name]=e.init(t,a)}}),a}};function Bj(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r==`handleDOMEvents`&&(i=Bj(i,t,{})),n[r]=i}return n}var Vj=class{constructor(e){this.spec=e,this.props={},e.props&&Bj(e.props,this,this.props),this.key=e.key?e.key.key:Uj(`plugin`)}getState(e){return e[this.key]}},Hj=Object.create(null);function Uj(e){return e in Hj?e+`$`+ ++Hj[e]:(Hj[e]=0,e+`$`)}var Wj=class{constructor(e=`key`){this.key=Uj(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},Gj=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Kj(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`backward`,e):n.parentOffset>0)?null:n}var qj=(e,t,n)=>{let r=Kj(e,n);if(!r)return!1;let i=$j(r);if(!i){let n=r.blockRange(),i=n&&MA(n);return i==null?!1:(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let a=i.nodeBefore;if(_M(e,i,t,-1))return!0;if(r.parent.content.size==0&&(Zj(a,`end`)||Tj.isSelectable(a)))for(let n=r.depth;;n--){let o=$A(e.doc,r.before(n),r.after(n),Q.empty);if(o&&o.slice.size<o.to-o.from){if(t){let n=e.tr.step(o);n.setSelection(Zj(a,`end`)?yj.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):Tj.create(n.doc,i.pos-a.nodeSize)),t(n.scrollIntoView())}return!0}if(n==1||r.node(n-1).childCount>1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},Jj=(e,t,n)=>{let r=Kj(e,n);if(!r)return!1;let i=$j(r);return i?Xj(e,i,t):!1},Yj=(e,t,n)=>{let r=eM(e,n);if(!r)return!1;let i=rM(r);return i?Xj(e,i,t):!1};function Xj(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let a=t.nodeAfter,o=t.pos+1;for(;!a.isTextblock;o++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let s=$A(e.doc,i,o,Q.empty);if(!s||s.from!=i||s instanceof TA&&s.slice.size>=o-i)return!1;if(n){let t=e.tr.step(s);t.setSelection(Cj.create(t.doc,i)),n(t.scrollIntoView())}return!0}function Zj(e,t,n=!1){for(let r=e;r;r=t==`start`?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var Qj=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`backward`,e):r.parentOffset>0)return!1;a=$j(r)}let o=a&&a.nodeBefore;return!o||!Tj.isSelectable(o)?!1:(t&&t(e.tr.setSelection(Tj.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function $j(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function eM(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock(`forward`,e):n.parentOffset<n.parent.content.size)?null:n}var tM=(e,t,n)=>{let r=eM(e,n);if(!r)return!1;let i=rM(r);if(!i)return!1;let a=i.nodeAfter;if(_M(e,i,t,1))return!0;if(r.parent.content.size==0&&(Zj(a,`start`)||Tj.isSelectable(a))){let n=$A(e.doc,r.before(),r.after(),Q.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(Zj(a,`start`)?yj.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):Tj.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos,i.pos+a.nodeSize).scrollIntoView()),!0):!1},nM=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock(`forward`,e):r.parentOffset<r.parent.content.size)return!1;a=rM(r)}let o=a&&a.nodeAfter;return!o||!Tj.isSelectable(o)?!1:(t&&t(e.tr.setSelection(Tj.create(e.doc,a.pos)).scrollIntoView()),!0)};function rM(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var iM=(e,t)=>{let n=e.selection,r=n instanceof Tj,i;if(r){if(n.node.isTextblock||!KA(e.doc,n.from))return!1;i=n.from}else if(i=YA(e.doc,n.from,-1),i==null)return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(Tj.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},aM=(e,t)=>{let n=e.selection,r;if(n instanceof Tj){if(n.node.isTextblock||!KA(e.doc,n.to))return!1;r=n.to}else if(r=YA(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},oM=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&MA(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},sM=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
|
|
121
|
+
`).scrollIntoView()),!0)};function cM(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var lM=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=cM(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,o.createAndFill());i.setSelection(yj.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},uM=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Dj||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=cM(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,o=e.tr.insert(n,a.createAndFill());o.setSelection(Cj.create(o.doc,n+1)),t(o.scrollIntoView())}return!0},dM=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(WA(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&MA(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function fM(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof Tj&&t.selection.node.isBlock)return!r.parentOffset||!WA(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,c=!1,l=!1;for(let t=r.depth;;t--)if(r.node(t).isBlock){c=r.end(t)==r.pos+(r.depth-t),l=r.start(t)==r.pos-(r.depth-t),s=cM(r.node(t-1).contentMatchAt(r.indexAfter(t-1)));let n=e&&e(i.parent,c,r);a.unshift(n||(c&&s?{type:s}:null)),o=t;break}else{if(t==1)return!1;a.unshift(null)}let u=t.tr;(t.selection instanceof Cj||t.selection instanceof Dj)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=WA(u.doc,d,a.length,a);if(f||=(a[0]=s?{type:s}:null,WA(u.doc,d,a.length,a)),!f)return!1;if(u.split(d,a.length,a),!c&&l&&r.node(o).type!=s){let e=u.mapping.map(r.before(o)),t=u.doc.resolve(e);s&&r.node(o-1).canReplaceWith(t.index(),t.index()+1,s)&&u.setNodeMarkup(u.mapping.map(r.before(o)),s)}return n&&n(u.scrollIntoView()),!0}}var pM=fM(),mM=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(Tj.create(e.doc,i))),!0)},hM=(e,t)=>(t&&t(e.tr.setSelection(new Dj(e.doc))),!0);function gM(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||KA(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function _M(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,c=i.type.spec.isolating||a.type.spec.isolating;if(!c&&gM(e,t,n))return!0;let l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,s=Z.empty;for(let e=o.length-1;e>=0;e--)s=Z.from(o[e].create(null,s));s=Z.from(i.copy(s));let c=e.tr.step(new EA(t.pos-1,r,t.pos,r,new Q(s,1,0),o.length,!0)),l=c.doc.resolve(r+2*o.length);l.nodeAfter&&l.nodeAfter.type==i.type&&KA(c.doc,l.pos)&&c.join(l.pos),n(c.scrollIntoView())}return!0}let u=a.type.spec.isolating||r>0&&c?null:yj.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&MA(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(l&&Zj(a,`start`,!0)&&Zj(i,`end`)){let r=i,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let s=a,c=1;for(;!s.isTextblock;s=s.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,s.content)){if(n){let r=Z.empty;for(let e=o.length-1;e>=0;e--)r=Z.from(o[e].copy(r));n(e.tr.step(new EA(t.pos-o.length,t.pos+a.nodeSize,t.pos+c,t.pos+a.nodeSize-c,new Q(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function vM(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(Cj.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var yM=vM(-1),bM=vM(1);function xM(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&PA(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function SM(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];n.doc.nodesBetween(a,o,(r,a)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(a),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:a},$to:{pos:o}}=n.selection.ranges[r];i.setBlockType(a,o,e,t)}r(i.scrollIntoView())}return!0}}function CM(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}var wM=CM(Gj,qj,Qj),TM=CM(Gj,tM,nM),EM={Enter:CM(sM,uM,dM,pM),"Mod-Enter":lM,Backspace:wM,"Mod-Backspace":wM,"Shift-Backspace":wM,Delete:TM,"Mod-Delete":TM,"Mod-a":hM},DM={"Ctrl-h":EM.Backspace,"Alt-Backspace":EM[`Mod-Backspace`],"Ctrl-d":EM.Delete,"Ctrl-Alt-Backspace":EM[`Mod-Delete`],"Alt-Delete":EM[`Mod-Delete`],"Alt-d":EM[`Mod-Delete`],"Ctrl-a":yM,"Ctrl-e":bM};for(let e in EM)DM[e]=EM[e];typeof navigator<`u`?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<`u`&&os.platform&&os.platform();function OM(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return kM(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function kM(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new sk(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new sk(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=PA(a,n,r,t);return s?(e&&AM(e,t,s,i,n),!0):!1}function AM(e,t,n,r,i){let a=Z.empty;for(let e=n.length-1;e>=0;e--)a=Z.from(n[e].type.create(n[e].attrs,a));e.step(new EA(t.start-(r?2:0),t.end,t.start,t.end,new Q(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&WA(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function jM(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?MM(t,n,e,a):NM(t,n,a):!0:!1}}function MM(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new EA(a-1,o,a,o,new Q(Z.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new sk(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=MA(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return KA(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function NM(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?Z.empty:Z.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new EA(d-+!!s,f+ +!!c,d+1,f-1,new Q((s?Z.empty:Z.from(i.copy(Z.empty))).append(c?Z.empty:Z.from(i.copy(Z.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function PM(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=Z.from(r?e.create():null),o=new Q(Z.from(e.create(null,Z.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new EA(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}var FM=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},IM=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},LM=null,RM=function(e,t,n){let r=LM||=document.createRange();return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},zM=function(){LM=null},BM=function(e,t,n,r){return n&&(HM(e,t,n,r,-1)||HM(e,t,n,r,1))},VM=/^(img|br|input|textarea|hr)$/i;function HM(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:UM(e))){let n=e.parentNode;if(!n||n.nodeType!=1||qM(e)||VM.test(e.nodeName)||e.contentEditable==`false`)return!1;t=FM(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if(n.pmViewDesc?.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?UM(e):0}else return!1}}function UM(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function WM(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=UM(e)}else if(e.parentNode&&!qM(e))t=FM(e),e=e.parentNode;else return null}}function GM(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!qM(e))t=FM(e)+1,e=e.parentNode;else return null}}function KM(e,t,n){for(let r=t==0,i=t==UM(e);r||i;){if(e==n)return!0;let t=FM(e);if(e=e.parentNode,!e)return!1;r&&=t==0,i&&=t==UM(e)}}function qM(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var JM=function(e){return e.focusNode&&BM(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function YM(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function XM(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function ZM(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(UM(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(UM(r.startContainer),r.startOffset)}}}var QM=typeof navigator<`u`?navigator:null,$M=typeof document<`u`?document:null,eN=QM&&QM.userAgent||``,tN=/Edge\/(\d+)/.exec(eN),nN=/MSIE \d/.exec(eN),rN=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(eN),iN=!!(nN||rN||tN),aN=nN?document.documentMode:rN?+rN[1]:tN?+tN[1]:0,oN=!iN&&/gecko\/(\d+)/i.test(eN);oN&&+(/Firefox\/(\d+)/.exec(eN)||[0,0])[1];var sN=!iN&&/Chrome\/(\d+)/.exec(eN),cN=!!sN,lN=sN?+sN[1]:0,uN=!iN&&!!QM&&/Apple Computer/.test(QM.vendor),dN=uN&&(/Mobile\/\w+/.test(eN)||!!QM&&QM.maxTouchPoints>2),fN=dN||(QM?/Mac/.test(QM.platform):!1),pN=QM?/Win/.test(QM.platform):!1,mN=/Android \d/.test(eN),hN=!!$M&&`webkitFontSmoothing`in $M.documentElement.style,gN=hN?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function _N(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function vN(e,t){return typeof e==`number`?e:e[t]}function yN(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function bN(e,t,n){let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=IM(o);continue}let e=o,n=e==a.body,s=n?_N(a):yN(e),c=0,l=0;if(t.top<s.top+vN(r,`top`)?l=-(s.top-t.top+vN(i,`top`)):t.bottom>s.bottom-vN(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+vN(i,`top`)-s.top:t.bottom-s.bottom+vN(i,`bottom`)),t.left<s.left+vN(r,`left`)?c=-(s.left-t.left+vN(i,`left`)):t.right>s.right-vN(r,`right`)&&(c=t.right-s.right+vN(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:IM(o)}}function xN(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:SN(e.dom)}}function SN(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=IM(r));return t}function CN({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;wN(n,r==0?0:r-t)}function wN(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}var TN=null;function EN(e){if(e.setActive)return e.setActive();if(TN)return e.focus(TN);let t=SN(e);e.focus(TN==null?{get preventScroll(){return TN={preventScroll:!0},!0}}:void 0),TN||(TN=!1,wN(t,0))}function DN(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=RM(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?ON(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:DN(n,i)}function ON(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=IN(r,1);if(n.top!=n.bottom&&kN(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function kN(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function AN(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function jN(e,t,n){let{node:r,offset:i}=DN(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function MN(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function NN(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(kN(t,i))return NN(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function PN(e,t){let n=e.dom.ownerDocument,r,i=0,a=ZM(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!kN(t,n)||(o=NN(e.dom,t,n),!o))return null}if(uN)for(let e=o;r&&e;e=IM(e))e.draggable&&(r=void 0);if(o=AN(o,t),r){if(oN&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;hN&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=MN(e,r,i,t))}s??=jN(e,o,t);let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function FN(e){return e.top<e.bottom||e.left<e.right}function IN(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(FN(e))return e}return Array.prototype.find.call(n,FN)||e.getBoundingClientRect()}var LN=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function RN(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=hN||oN;if(r.nodeType==3)if(o&&(LN.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=IN(RM(r,i,i),n);if(oN&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=IN(RM(r,i-1,i-1),-1);if(t.top==e.top){let n=IN(RM(r,i,i+1),-1);if(n.top!=e.top)return zN(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,zN(IN(RM(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==UM(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return BN(e.getBoundingClientRect(),!1)}if(a==null&&i<UM(r)){let e=r.childNodes[i];if(e.nodeType==1)return BN(e.getBoundingClientRect(),!0)}return BN(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==UM(r))){let e=r.childNodes[i-1],t=e.nodeType==3?RM(e,UM(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return zN(IN(t,1),!1)}if(a==null&&i<UM(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?RM(e,0,+!o):e.nodeType==1?e:null:null;if(t)return zN(IN(t,-1),!0)}return zN(IN(r.nodeType==3?RM(r):r,-n),n>=0)}function zN(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function BN(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function VN(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function HN(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return VN(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=RN(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=RM(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}var UN=/[\u0590-\u08ac]/;function WN(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!UN.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:VN(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch{}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}var GN=null,KN=null,qN=!1;function JN(e,t,n){return GN==t&&KN==n?qN:(GN=t,KN=n,qN=n==`up`||n==`down`?HN(e,t,n):WN(e,t,n))}var YN=0,XN=1,ZN=2,QN=3,$N=class{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=YN,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].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 t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.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,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>FM(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return r??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof oP){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof eP&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?FM(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?FM(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=FM(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=FM(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),u=!1;if((oN||uN)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(u=!!(t&&e.nodeValue[t-1]==`
|
|
122
|
+
`),u&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:FM(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];u=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(oN&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||u&&uN)&&BM(o.node,o.offset,l.anchorNode,l.anchorOffset)&&BM(s.node,s.offset,l.focusNode,l.focusOffset))return;let d=!1;if((c.extend||e==t)&&!(u&&oN)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),d=!0}catch{}}if(!d){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?ZN:XN,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=QN:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ZN:QN}n=a}this.dirty=ZN}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?ZN:XN;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},eP=class extends $N{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.contentEditable=`false`,a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==YN&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(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}},tP=class extends $N{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}},nP=class e extends $N{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=Qk.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&QN||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=QN&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=YN){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=YN}}slice(t,n,r){let i=e.create(this.parent,this.mark,!0,r),a=this.children,o=this.size;n<o&&(a=CP(a,n,o,r)),t>0&&(a=CP(a,0,t,r));for(let e=0;e<a.length;e++)a[e].parent=i;return i.children=a,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},rP=class e extends $N{constructor(e,t,n,r,i,a,o,s,c){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}static create(t,n,r,i,a,o){let s=a.nodeViews[n.type.name],c,l=s&&s(n,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=Qk.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);({dom:u,contentDOM:d}=e)}!d&&!n.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=mP(u,r,n),l?c=new sP(t,n,r,i,u,d||null,f,l,a,o+1):n.isText?new aP(t,n,r,i,u,f,a):new e(t,n,r,i,u,d||null,f,a,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 t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Z.empty)}return e}matchesNode(e,t,n){return this.dirty==YN&&e.eq(this.node)&&hP(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new _P(this,a&&a.node,e);bP(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?s.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&s.syncToMarks(i==this.node.childCount?UO.none:this.node.child(i).marks,n,e,i),s.placeWidget(t,e,r)},(t,a,c,l)=>{s.syncToMarks(t.marks,n,e,l);let u;s.findNodeMatch(t,a,c,l)||o&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(t,a,c,u,e)||s.updateNextNode(t,a,c,e,l,r)||s.addNode(t,a,c,e,r),r+=t.nodeSize}),s.syncToMarks([],n,e,0),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||this.dirty==ZN)&&(a&&this.protectLocalComposition(e,a),cP(this.contentDOM,this.children,e),dN&&xP(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof Cj)||n<t||r>t+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 e=i.nodeValue,a=SP(this.node.content,e,n-t,r-t);return a<0?null:{node:i,pos:a,text:e}}else return{node:i,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;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&&=void 0}let a=new tP(this,i,t,r);e.input.compositionNodes.push(a),this.children=CP(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==QN||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=YN}updateOuterDeco(e){if(hP(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=fP(this.dom,this.nodeDOM,dP(this.outerDeco,this.node,t),dP(e,this.node,t)),this.dom!=n&&(n.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 iP(e,t,n,r,i){mP(r,t,e);let a=new rP(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var aP=class e extends rP{constructor(e,t,n,r,i,a,o){super(e,t,n,r,i,null,a,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==QN||this.dirty!=YN&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=YN||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=YN,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=QN)}get domAtom(){return!1}isText(e){return this.node.text==e}},oP=class extends $N{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==YN&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}},sP=class extends rP{constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,c,l),this.spec=s}update(e,t,n,r){if(this.dirty==QN)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}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 cP(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=gP(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof nP){let t=r?r.previousSibling:e.lastChild;cP(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=gP(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var lP=function(e){e&&(this.nodeName=e)};lP.prototype=Object.create(null);var uP=[new lP];function dP(e,t,n){if(e.length==0)return uP;let r=n?uP[0]:new lP,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new lP(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new lP(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function fP(e,t,n,r){if(n==uP&&r==uP)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=uP[0],i=t)}pP(i,o||uP[0],a)}return i}function pP(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function mP(e,t,n){return fP(e,e,uP,dP(t,n,e.nodeType!=1))}function hP(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function gP(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var _P=class{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=vP(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=YN,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=nP.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==QN&&a.dom==a.contentDOM&&(a.dirty=ZN),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return-1}e=t}}updateNextNode(e,t,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof rP){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=QN&&hP(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=ZN,u.updateChildren(r,a+1),u.dirty=YN),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!hP(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=rP.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=rP.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new eP(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof nP;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof aP)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((uN||cN)&&e&&e.dom.contentEditable==`false`&&this.addHackNode(`IMG`,t),this.addHackNode(`BR`,this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new oP(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function vP(e,t){let n=t,r=n.children.length,i=e.childCount,a=new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof nP)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function yP(e,t){return e.type.side-t.type.side}function bP(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||=[u]).push(e):u=e)}if(u)if(d){d.sort(yP);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function xP(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function SP(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function CP(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&=(a.push(i),void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function wP(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),c,l;if(JM(n)){for(c=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&Tj.isSelectable(e)&&i.parent&&!(e.isInline&&KM(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;l=new Tj(o==e?s:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=o,i=o;for(let r=0;r<n.rangeCount;r++){let a=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[c,o]=i==e.state.selection.anchor?[i,t]:[t,i],s=r.resolve(o)}else c=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!l){let n=t==`pointer`||e.state.selection.head<s.pos&&!a?1:-1;l=FP(e,u,s,n)}return l}function TP(e){return e.editable?e.hasFocus():LP(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function EP(e,t=!1){let n=e.state.selection;if(NP(e,n),TP(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&cN){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&BM(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)MP(e);else{let{anchor:r,head:i}=n,a,o;DP&&!(n instanceof Cj)&&(n.$from.parent.inlineContent||(a=OP(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=OP(e,n.to))),e.docView.setSelection(r,i,e,t),DP&&(a&&AP(a),o&&AP(o)),n.visible?e.dom.classList.remove(`ProseMirror-hideselection`):(e.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&jP(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var DP=uN||cN&&lN<63;function OP(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(uN&&i&&i.contentEditable==`false`)return kP(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return kP(i);if(a)return kP(a)}}function kP(e){return e.contentEditable=`true`,uN&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function AP(e){e.contentEditable=`false`,e.wasDraggable&&=(e.draggable=!0,null)}function jP(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!TP(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function MP(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,FM(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&iN&&aN<=11&&(n.disabled=!0,n.disabled=!1)}function NP(e,t){if(t instanceof Tj){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(PP(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else PP(e)}function PP(e){e.lastSelectedViewDesc&&=(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),void 0)}function FP(e,t,n,r){return e.someProp(`createSelectionBetween`,r=>r(e,t,n))||Cj.between(t,n,r)}function IP(e){return e.editable&&!e.hasFocus()?!1:LP(e)}function LP(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function RP(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return BM(t.node,t.offset,n.anchorNode,n.anchorOffset)}function zP(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&yj.findFrom(a,t)}function BP(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function VP(e,t,n){let r=e.state.selection;if(r instanceof Cj){if(n.indexOf(`s`)>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let a=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return BP(e,new Cj(r.$anchor,a))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?`forward`:`backward`)){let n=zP(e.state,t);return n&&n instanceof Tj?BP(e,n):!1}else if(!(fN&&n.indexOf(`m`)>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,a;if(!i||i.isText)return!1;let o=t<0?n.pos-i.nodeSize:n.pos;return i.isAtom||(a=e.docView.descAt(o))&&!a.contentDOM?Tj.isSelectable(i)?BP(e,new Tj(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):hN?BP(e,new Cj(e.state.doc.resolve(t<0?o:o+i.nodeSize))):!1:!1}}else if(r instanceof Tj&&r.node.isInline)return BP(e,new Cj(t>0?r.$to:r.$from));else{let n=zP(e.state,t);return n?BP(e,n):!1}}function HP(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function UP(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`)}function WP(e,t){return t<0?GP(e):KP(e)}function GP(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(oN&&n.nodeType==1&&r<HP(n)&&UP(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(UP(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(qP(n))break;else{let t=n.previousSibling;for(;t&&UP(t,-1);)i=n.parentNode,a=FM(t),t=t.previousSibling;if(t)n=t,r=HP(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?XP(e,n,r):i&&XP(e,i,a)}function KP(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=HP(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(UP(e,1))a=n,o=++r;else break}else if(qP(n))break;else{let t=n.nextSibling;for(;t&&UP(t,1);)a=t.parentNode,o=FM(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=HP(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&XP(e,a,o)}function qP(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function JP(e,t){for(;e&&t==e.childNodes.length&&!qM(e);)t=FM(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function YP(e,t){for(;e&&!t&&!qM(e);)t=FM(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function XP(e,t,n){if(t.nodeType!=3){let e,r;(r=JP(t,n))?(t=r,n=0):(e=YP(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(JM(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&EP(e)},50)}function ZP(e,t){let n=e.state.doc.resolve(t);if(!(cN||pN)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function QP(e,t,n){let r=e.state.selection;if(r instanceof Cj&&!r.empty||n.indexOf(`s`)>-1||fN&&n.indexOf(`m`)>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?`up`:`down`)){let n=zP(e.state,t);if(n&&n instanceof Tj)return BP(e,n)}if(!i.parent.inlineContent){let n=t<0?i:a,o=r instanceof Dj?yj.near(n,t):yj.findFrom(n,t);return o?BP(e,o):!1}return!1}function $P(e,t){if(!(e.state.selection instanceof Cj))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?`forward`:`backward`))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let r=e.state.tr;return t<0?r.delete(n.pos-a.nodeSize,n.pos):r.delete(n.pos,n.pos+a.nodeSize),e.dispatch(r),!0}return!1}function eF(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function tF(e){if(!uN||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;eF(e,n,`true`),setTimeout(()=>eF(e,n,`false`),20)}return!1}function nF(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function rF(e,t){let n=t.keyCode,r=nF(t);if(n==8||fN&&n==72&&r==`c`)return $P(e,-1)||WP(e,-1);if(n==46&&!t.shiftKey||fN&&n==68&&r==`c`)return $P(e,1)||WP(e,1);if(n==13||n==27)return!0;if(n==37||fN&&n==66&&r==`c`){let t=n==37?ZP(e,e.state.selection.from)==`ltr`?-1:1:-1;return VP(e,t,r)||WP(e,t)}else if(n==39||fN&&n==70&&r==`c`){let t=n==39?ZP(e,e.state.selection.from)==`ltr`?1:-1:1;return VP(e,t,r)||WP(e,t)}else if(n==38||fN&&n==80&&r==`c`)return QP(e,-1,r)||WP(e,-1);else if(n==40||fN&&n==78&&r==`c`)return tF(e)||QP(e,1,r)||WP(e,1);else if(r==(fN?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function iF(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let o=e.someProp(`clipboardSerializer`)||Qk.fromSchema(e.state.schema),s=hF(),c=s.createElement(`div`);c.appendChild(o.serializeFragment(r,{document:s}));let l=c.firstChild,u,d=0;for(;l&&l.nodeType==1&&(u=pF[l.nodeName.toLowerCase()]);){for(let e=u.length-1;e>=0;e--){let t=s.createElement(u[e]);for(;c.firstChild;)t.appendChild(c.firstChild);c.appendChild(t),d++}l=c.firstChild}return l&&l.nodeType==1&&l.setAttribute(`data-pm-slice`,`${i} ${a}${d?` -${d}`:``} ${JSON.stringify(n)}`),{dom:c,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
|
|
123
|
+
|
|
124
|
+
`),slice:t}}function aF(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let c=!!t&&(r||a||!n);if(c){if(e.someProp(`transformPastedText`,n=>{t=n(t,a||r,e)}),a)return s=new Q(Z.from(e.state.schema.text(t.replace(/\r\n?/g,`
|
|
125
|
+
`))),0,0),e.someProp(`transformPasted`,t=>{s=t(s,e,!0)}),s;let n=e.someProp(`clipboardTextParser`,n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,a=Qk.fromSchema(r);o=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),o=vF(n),hN&&yF(o);let l=o&&o.querySelector(`[data-pm-slice]`),u=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute(`data-pm-slice`)||``);if(u&&u[3])for(let e=+u[3];e>0;e--){let e=o.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;o=e}if(s||=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||Rk.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||u),context:i,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!oF.test(e.parentNode.nodeName)?{ignore:!0}:null}}),u)s=bF(fF(s,+u[1],+u[2]),u[4]);else if(s=Q.maxOpen(sF(s.content,i),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=fF(s,e,t)}return e.someProp(`transformPasted`,t=>{s=t(s,e,c)}),s}var oF=/^(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 sF(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,a=[];if(e.forEach(e=>{if(!a)return;let t=r.findWrapping(e.type),n;if(!t)return a=null;if(n=a.length&&i.length&&lF(t,i,e,a[a.length-1],0))a[a.length-1]=n;else{a.length&&(a[a.length-1]=uF(a[a.length-1],i.length));let n=cF(e,t);a.push(n),r=r.matchType(n.type),i=t}}),a)return Z.from(a)}return e}function cF(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Z.from(e));return e}function lF(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let a=lF(e,t,n,r.lastChild,i+1);if(a)return r.copy(r.content.replaceChild(r.childCount-1,a));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(Z.from(cF(n,e,i+1))))}}function uF(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,uF(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Z.empty,!0);return e.copy(n.append(r))}function dF(e,t,n,r,i,a){let o=t<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(a=0),i<r-1&&(s=dF(s,t,n,r,i+1,a)),i>=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(Z.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function fF(e,t,n){return t<e.openStart&&(e=new Q(dF(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Q(dF(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var pF={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]},mF=null;function hF(){return mF||=document.implementation.createHTMLDocument(`title`)}var gF=null;function _F(e){let t=window.trustedTypes;return t?(gF||=t.defaultPolicy||t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e}),gF.createHTML(e)):e}function vF(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=hF().createElement(`div`),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&pF[r[1].toLowerCase()])&&(e=i.map(e=>`<`+e+`>`).join(``)+e+i.map(e=>`</`+e+`>`).reverse().join(``)),n.innerHTML=_F(e),i)for(let e=0;e<i.length;e++)n=n.querySelector(i[e])||n;return n}function yF(e){let t=e.querySelectorAll(cN?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function bF(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:i,openStart:a,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=Z.from(t.create(r[e+1],i)),a++,o++}return new Q(i,a,o)}var xF={},SF={},CF={touchstart:!0,touchmove:!0},wF=class{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 TF(e){for(let t in xF){let n=xF[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{AF(e,t)&&!kF(e,t)&&(e.editable||!(t.type in SF))&&n(e,t)},CF[t]?{passive:!0}:void 0)}uN&&e.dom.addEventListener(`input`,()=>null),OF(e)}function EF(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function DF(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function OF(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>kF(e,t))})}function kF(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function AF(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function jF(e,t){!kF(e,t)&&xF[t.type]&&(e.editable||!(t.type in SF))&&xF[t.type](e,t)}SF.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!GF(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(mN&&cN&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),dN&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,YM(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||rF(e,n)?n.preventDefault():EF(e,`key`)},SF.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},SF.keypress=(e,t)=>{let n=t;if(GF(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||fN&&n.metaKey)return;if(e.someProp(`handleKeyPress`,t=>t(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Cj)||!r.$from.sameParent(r.$to)){let t=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(t).scrollIntoView();!/[\r\n]/.test(t)&&!e.someProp(`handleTextInput`,n=>n(e,r.$from.pos,r.$to.pos,t,i))&&e.dispatch(i()),n.preventDefault()}};function MF(e){return{left:e.clientX,top:e.clientY}}function NF(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function PF(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function FF(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function IF(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&Tj.isSelectable(r)?(FF(e,new Tj(n),`pointer`),!0):!1}function LF(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof Tj&&(r=n.node);let a=e.state.doc.resolve(t);for(let e=a.depth+1;e>0;e--){let t=e>a.depth?a.nodeAfter:a.node(e);if(Tj.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?a.before(n.$from.depth):a.before(e);break}}return i==null?!1:(FF(e,Tj.create(e.state.doc,i),`pointer`),!0)}function RF(e,t,n,r,i){return PF(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?LF(e,n):IF(e,n))}function zF(e,t,n,r){return PF(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function BF(e,t,n,r){return PF(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||VF(e,n,r)}function VF(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(FF(e,Cj.create(r,0,r.content.size),`pointer`),!0):!1;let i=r.resolve(t);for(let t=i.depth+1;t>0;t--){let n=t>i.depth?i.nodeAfter:i.node(t),a=i.before(t);if(n.inlineContent)FF(e,Cj.create(r,a+1,a+1+n.content.size),`pointer`);else if(Tj.isSelectable(n))FF(e,Tj.create(r,a),`pointer`);else continue;return!0}}function HF(e){return QF(e)}var UF=fN?`metaKey`:`ctrlKey`;xF.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=HF(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&NF(n,e.input.lastClick)&&!n[UF]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button};let o=e.posAtCoords(MF(n));o&&(a==`singleClick`?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new WF(e,o,n,!!r)):(a==`doubleClick`?zF:BF)(e,o.pos,o.inside,n)?n.preventDefault():EF(e,`pointer`))};var WF=class{constructor(e,t,n,r){this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[UF],this.allowDefault=n.shiftKey;let i,a;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),a=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,a=n.depth?n.before():0}let o=r?null:n.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&s.nodeDOM.nodeType==1?s.nodeDOM:null;let{selection:c}=e.state;n.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof Tj&&c.from<=a&&c.to>a)&&(this.mightDrag={node:i,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&oN&&!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)),EF(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(()=>EP(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(MF(e))),this.updateAllowDefault(e),this.allowDefault||!t?EF(this.view,`pointer`):RF(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||uN&&this.mightDrag&&!this.mightDrag.node.isAtom||cN&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(FF(this.view,yj.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):EF(this.view,`pointer`)}move(e){this.updateAllowDefault(e),EF(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)}};xF.touchstart=e=>{e.input.lastTouch=Date.now(),HF(e),EF(e,`pointer`)},xF.touchmove=e=>{e.input.lastTouch=Date.now(),EF(e,`pointer`)},xF.contextmenu=e=>HF(e);function GF(e,t){return e.composing?!0:uN&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var KF=mN?5e3:-1;SF.compositionstart=SF.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Cj&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||cN&&pN&&qF(e)))e.markCursor=e.state.storedMarks||n.marks(),QF(e,!0),e.markCursor=null;else if(QF(e,!t.selection.empty),oN&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&n.nodeType==1&&r!=0;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(t.nodeType==3){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}else n=t,r=-1}}e.input.composing=!0}JF(e,KF)};function qF(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}SF.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,JF(e,20))};function JF(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>QF(e),t))}function YF(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=ZF());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function XF(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=WM(t.focusNode,t.focusOffset),r=GM(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function ZF(){let e=document.createEvent(`Event`);return e.initEvent(`event`,!0,!0),e.timeStamp}function QF(e,t=!1){if(!(mN&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),YF(e),t||e.docView&&e.docView.dirty){let n=wP(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function rne(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var $F=iN&&aN<15||dN&&gN<604;xF.copy=SF.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=$F?null:n.clipboardData,{dom:o,text:s}=iF(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):rne(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function eI(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function tI(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?nI(e,r.value,null,i,t):nI(e,r.textContent,r.innerHTML,i,t)},50)}function nI(e,t,n,r,i){let a=aF(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||Q.empty)))return!0;if(!a)return!1;let o=eI(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function rI(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}SF.paste=(e,t)=>{let n=t;if(e.composing&&!mN)return;let r=$F?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&nI(e,rI(r),r.getData(`text/html`),i,n)?n.preventDefault():tI(e,n)};var iI=class{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}},aI=fN?`altKey`:`ctrlKey`;function oI(e,t){let n;return e.someProp(`dragCopies`,e=>{n||=e(t)}),n==null?!t[aI]:!n}xF.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(MF(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof Tj?i.to-1:i.to))){if(r&&r.mightDrag)o=Tj.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=Tj.create(e.state.doc,t.posBefore))}}let{dom:s,text:c,slice:l}=iF(e,(o||e.state.selection).content());(!n.dataTransfer.files.length||!cN||lN>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData($F?`Text`:`text/html`,s.innerHTML),n.dataTransfer.effectAllowed=`copyMove`,$F||n.dataTransfer.setData(`text/plain`,c),e.dragging=new iI(l,oI(e,n),o)},xF.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},SF.dragover=SF.dragenter=(e,t)=>t.preventDefault(),SF.drop=(e,t)=>{try{sI(e,t,e.dragging)}finally{e.dragging=null}};function sI(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(MF(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp(`transformPasted`,t=>{a=t(a,e,!1)}):a=aF(e,rI(t.dataTransfer),$F?null:t.dataTransfer.getData(`text/html`),!1,i);let o=!!(n&&oI(e,t));if(e.someProp(`handleDrop`,n=>n(e,t,a||Q.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?QA(e.state.doc,i.pos,a):i.pos;s??=i.pos;let c=e.state.tr;if(o){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let l=c.mapping.map(s),u=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,d=c.doc;if(u?c.replaceRangeWith(l,l,a.content.firstChild):c.replaceRange(l,l,a),c.doc.eq(d))return;let f=c.doc.resolve(l);if(u&&Tj.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new Tj(f));else{let t=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),c.setSelection(FP(e,f,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta(`uiEvent`,`drop`))}xF.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add(`ProseMirror-focused`),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&EP(e)},20))},xF.blur=(e,t)=>{let n=t;e.focused&&=(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),!1)},xF.beforeinput=(e,t)=>{if(cN&&mN&&t.inputType==`deleteContentBackward`){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp(`handleKeyDown`,t=>t(e,YM(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in SF)xF[e]=SF[e];function cI(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var lI=class e{constructor(e,t){this.toDOM=e,this.spec=t||mI,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new fI(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&cI(this.spec,t.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},uI=class e{constructor(e,t){this.attrs=e,this.spec=t||mI}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new fI(i,a,this)}valid(e,t){return t.from<t.to}eq(t){return this==t||t instanceof e&&cI(this.attrs,t.attrs)&&cI(this.spec,t.spec)}static is(t){return t.type instanceof e}destroy(){}},dI=class e{constructor(e,t){this.attrs=e,this.spec=t||mI}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new fI(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(t){return this==t||t instanceof e&&cI(this.attrs,t.attrs)&&cI(this.spec,t.spec)}destroy(){}},fI=class e{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(t,n){return new e(t,n,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(t,n,r){return new e(t,t,new lI(n,r))}static inline(t,n,r,i){return new e(t,n,new uI(r,i))}static node(t,n,r,i){return new e(t,n,new dI(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof uI}get widget(){return this.type instanceof lI}},pI=[],mI={},hI=class e{constructor(e,t){this.local=e.length?e:pI,this.children=t.length?t:pI}static create(e,t){return t.length?CI(t,e,0,mI):gI}find(e,t,n){let r=[];return this.findInner(e??0,t??1e9,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==gI||e.maps.length==0?this:this.mapInner(e,t,0,0,n||mI)}mapInner(t,n,r,i,a){let o;for(let e=0;e<this.local.length;e++){let s=this.local[e].map(t,r,i);s&&s.type.valid(n,s)?(o||=[]).push(s):a.onRemove&&a.onRemove(this.local[e].spec)}return this.children.length?vI(this.children,o||[],t,n,r,i,a):o?new e(o.sort(wI),pI):gI}add(t,n){return n.length?this==gI?e.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let i,a=0;t.forEach((e,t)=>{let o=t+r,s;if(s=xI(n,e,o)){for(i||=this.children.slice();a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,o+1):i.splice(a,0,t,t+e.nodeSize,CI(s,e,o+1,mI)),a+=3}});let o=yI(a?SI(n):n,-r);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||o.splice(e--,1);return new e(o.length?this.local.concat(o).sort(wI):this.local,i||this.children)}remove(e){return e.length==0||this==gI?this:this.removeInner(e,0)}removeInner(t,n){let r=this.children,i=this.local;for(let e=0;e<r.length;e+=3){let i,a=r[e]+n,o=r[e+1]+n;for(let e=0,n;e<t.length;e++)(n=t[e])&&n.from>a&&n.to<o&&(t[e]=null,(i||=[]).push(n));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[e+2].removeInner(i,a+1);s==gI?(r.splice(e,3),e-=3):r[e+2]=s}if(i.length){for(let e=0,r;e<t.length;e++)if(r=t[e])for(let e=0;e<i.length;e++)i[e].eq(r,n)&&(i==this.local&&(i=this.local.slice()),i.splice(e--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):gI}forChild(t,n){if(this==gI)return this;if(n.isLeaf)return e.empty;let r,i;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(r=this.children[e+2]);break}let a=t+1,o=a+n.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>a&&t.type instanceof uI){let e=Math.max(a,t.from)-a,n=Math.min(o,t.to)-a;e<n&&(i||=[]).push(t.copy(e,n))}}if(i){let t=new e(i.sort(wI),pI);return r?new _I([t,r]):t}return r||gI}eq(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(e){return TI(this.localsInner(e))}localsInner(e){if(this==gI)return pI;if(e.inlineContent||!this.local.some(uI.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof uI||t.push(this.local[e]);return t}forEachSet(e){e(this)}};hI.empty=new hI([],[]),hI.removeOverlap=TI;var gI=hI.empty,_I=class e{constructor(e){this.members=e}map(t,n){let r=this.members.map(e=>e.map(t,n,mI));return e.from(r)}forChild(t,n){if(n.isLeaf)return hI.empty;let r=[];for(let i=0;i<this.members.length;i++){let a=this.members[i].forChild(t,n);a!=gI&&(a instanceof e?r=r.concat(a.members):r.push(a))}return e.from(r)}eq(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&=(t=t.slice(),!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?TI(n?t:t.sort(wI)):pI}static from(t){switch(t.length){case 0:return gI;case 1:return t[0];default:return new e(t.every(e=>e instanceof hI)?t:t.reduce((e,t)=>e.concat(t instanceof hI?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function vI(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==gI?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=CI(bI(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new hI(t.sort(wI),s)}function yI(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new fI(i.from+t,i.to+t,i.type))}return n}function bI(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function xI(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||=[]).push(a),e[t]=null);return i}function SI(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function CI(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=xI(e,t,o+n);if(s){a=!0;let e=CI(s,t,n+o+1,r);e!=gI&&i.push(o,o+t.nodeSize,e)}});let o=yI(a?SI(e):e,-n).sort(wI);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new hI(o,i):gI}function wI(e,t){return e.from-t.from||e.to-t.to}function TI(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),EI(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),EI(t,i,r.copy(a.from,r.to)));break}}}return t}function EI(e,t,n){for(;t<e.length&&wI(n,e[t])>0;)t++;e.splice(t,0,n)}function DI(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=gI&&t.push(r)}),e.cursorWrapper&&t.push(hI.create(e.state.doc,[e.cursorWrapper.deco])),_I.from(t)}var OI={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},kI=iN&&aN<=11,AI=class{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}},jI=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new AI,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);iN&&aN<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():uN&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),kI&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.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,OI)),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 t=0;t<e.length;t++)this.queue.push(e[t]);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(IP(this.view)){if(this.suppressingSelectionUpdates)return EP(this.view);if(iN&&aN<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&BM(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 t=new Set,n;for(let n=e.focusNode;n;n=IM(n))t.add(n);for(let r=e.anchorNode;r;r=IM(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))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 t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&IP(e)&&!this.ignoreSelectionChange(n),i=-1,a=-1,o=!1,s=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],s);n&&(i=i<0?n.from:Math.min(n.from,i),a=a<0?n.to:Math.max(n.to,a),n.typeOver&&(o=!0))}if(s.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let e of s)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(oN&&s.length){let t=s.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||LI(e,n)!=t)&&r.remove()}}}let c=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&JM(n)&&(c=wP(e))&&c.eq(yj.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,EP(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,a),PI(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,RI(e,s)),this.handleDOMChange(i,a,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||EP(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(iN&&aN<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?FM(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?FM(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}},MI=new WeakMap,NI=!1;function PI(e){if(!MI.has(e)&&(MI.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=oN,NI)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.`),NI=!0}}function FI(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return BM(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function II(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return FI(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?FI(e,n):null}function LI(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function RI(e,t){let{focusNode:n,focusOffset:r}=e.domSelectionRange();for(let i of t)if(i.parentNode?.nodeName==`TR`){let t=i.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let a=t;for(;;){let e=a.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;a=e}a.insertBefore(i,a.firstChild),n==i&&e.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function zI(e,t,n){let{node:r,fromOffset:i,toOffset:a,from:o,to:s}=e.docView.parseRange(t,n),c=e.domSelectionRange(),l,u=c.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(l=[{node:u,offset:c.anchorOffset}],JM(c)||l.push({node:c.focusNode,offset:c.focusOffset})),cN&&e.input.lastKeyCode===8)for(let e=a;e>i;e--){let t=r.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){a=e;break}if(!n||n.size)break}let d=e.state.doc,f=e.someProp(`domParser`)||Rk.fromSchema(e.state.schema),p=d.resolve(o),m=null,h=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:a,preserveWhitespace:p.parent.type.whitespace==`pre`?`full`:!0,findPositions:l,ruleFromNode:BI,context:p});if(l&&l[0].pos!=null){let e=l[0].pos,t=l[1]&&l[1].pos;t??=e,m={anchor:e+o,head:t+o}}return{doc:h,sel:m,from:o,to:s}}function BI(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName==`BR`&&e.parentNode){if(uN&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(e.parentNode.lastChild==e||uN&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName==`IMG`&&e.getAttribute(`mark-placeholder`))return{ignore:!0};return null}var VI=/^(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 HI(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=wP(e,t);if(n&&!e.state.selection.eq(n)){if(cN&&mN&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp(`handleKeyDown`,t=>t(e,YM(13,`Enter`))))return;let r=e.state.tr.setSelection(n);t==`pointer`?r.setMeta(`pointer`,!0):t==`key`&&r.scrollIntoView(),a&&r.setMeta(`composition`,a),e.dispatch(r)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let c=e.state.selection,l=zI(e,t,n),u=e.state.doc,d=u.slice(l.from,l.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p=`end`):(f=e.state.selection.from,p=`start`),e.input.lastKeyCode=null;let m=qI(d.content,l.doc.content,l.from,f,p);if(m&&e.input.domChangeCount++,(dN&&e.input.lastIOSEnter>Date.now()-225||mN)&&i.some(e=>e.nodeType==1&&!VI.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp(`handleKeyDown`,t=>t(e,YM(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof Cj&&!c.empty&&c.$head.sameParent(c.$anchor)&&!e.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(l.sel){let t=UI(e,e.state.doc,l.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta(`composition`,a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof Cj&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=l.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=l.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),iN&&aN<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>l.from&&l.doc.textBetween(m.start-l.from-1,m.start-l.from+1)==` \xA0`&&(m.start--,m.endA--,m.endB--);let h=l.doc.resolveNoCache(m.start-l.from),g=l.doc.resolveNoCache(m.endB-l.from),_=u.resolve(m.start),v=h.sameParent(g)&&h.parent.inlineContent&&_.end()>=m.endA;if((dN&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!v&&h.pos<l.doc.content.size&&(!h.sameParent(g)||!h.parent.inlineContent)&&h.pos<g.pos&&!/\S/.test(l.doc.textBetween(h.pos,g.pos,``,``)))&&e.someProp(`handleKeyDown`,t=>t(e,YM(13,`Enter`)))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&GI(u,m.start,m.endA,h,g)&&e.someProp(`handleKeyDown`,t=>t(e,YM(8,`Backspace`)))){mN&&cN&&e.domObserver.suppressSelectionUpdates();return}cN&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),mN&&!v&&h.start()!=g.start()&&g.parentOffset==0&&h.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==m.endA&&(m.endB-=2,g=l.doc.resolveNoCache(m.endB-l.from),setTimeout(()=>{e.someProp(`handleKeyDown`,function(t){return t(e,YM(13,`Enter`))})},20));let y=m.start,b=m.endA,x=t=>{let n=t||e.state.tr.replace(y,b,l.doc.slice(m.start-l.from,m.endB-l.from));if(l.sel){let t=UI(e,n.doc,l.sel);t&&!(cN&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==y||t.head==n.mapping.map(b)-1)||iN&&t.empty&&t.head==y)&&n.setSelection(t)}return a&&n.setMeta(`composition`,a),n.scrollIntoView()},S;if(v)if(h.pos==g.pos){iN&&aN<=11&&h.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>EP(e),20));let t=x(e.state.tr.delete(y,b)),n=u.resolve(m.start).marksAcross(u.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(S=WI(h.parent.content.cut(h.parentOffset,g.parentOffset),_.parent.content.cut(_.parentOffset,m.endA-_.start())))){let t=x(e.state.tr);S.type==`add`?t.addMark(y,b,S.mark):t.removeMark(y,b,S.mark),e.dispatch(t)}else if(h.parent.child(h.index()).isText&&h.index()==g.index()-+!g.textOffset){let t=h.parent.textBetween(h.parentOffset,g.parentOffset),n=()=>x(e.state.tr.insertText(t,y,b));e.someProp(`handleTextInput`,r=>r(e,y,b,t,n))||e.dispatch(n())}else e.dispatch(x());else e.dispatch(x())}function UI(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:FP(e,t.resolve(n.anchor),t.resolve(n.head))}function WI(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,c;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)a=n[e].removeFromSet(a);if(i.length==1&&a.length==0)s=i[0],o=`add`,c=e=>e.mark(s.addToSet(e.marks));else if(i.length==0&&a.length==1)s=a[0],o=`remove`,c=e=>e.mark(s.removeFromSet(e.marks));else return null;let l=[];for(let e=0;e<t.childCount;e++)l.push(c(t.child(e)));if(Z.from(l).eq(e))return{mark:s,type:o}}function GI(e,t,n,r,i){if(n-t<=i.pos-r.pos||KI(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(KI(a,!0,!0));return!o.parent.isTextblock||o.pos>n||KI(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function KI(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function qI(e,t,n,r,i){let a=e.findDiffStart(t,n);if(a==null)return null;let{a:o,b:s}=e.findDiffEnd(t,n+e.size,n+t.size);if(i==`end`){let e=Math.max(0,a-Math.min(o,s));r-=o+e-a}if(o<a&&e.size<t.size){let e=r<=a&&r>=o?a-r:0;a-=e,a&&a<t.size&&JI(t.textBetween(a-1,a+1))&&(a+=e?1:-1),s=a+(s-o),o=a}else if(s<a){let t=r<=a&&r>=s?a-r:0;a-=t,a&&a<e.size&&JI(e.textBetween(a-1,a+1))&&(a+=t?1:-1),o=a+(o-s),s=a}return{start:a,endA:o,endB:s}}function JI(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var YI=class{constructor(e,t){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 wF,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(eL),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=QI(this),ZI(this),this.nodeViews=$I(this),this.docView=iP(this.state.doc,XI(this),DI(this),this.dom,this),this.domObserver=new jI(this,(e,t,n,r)=>HI(this,e,t,n,r)),this.domObserver.start(),TF(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 t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&OF(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(eL),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){let n=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(YF(this),i=!0),this.state=e;let a=n.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=$I(this);ane(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&OF(this),this.editable=QI(this),ZI(this);let o=DI(this),s=XI(this),c=n.plugins!=e.plugins&&!n.doc.eq(e.doc)?`reset`:e.scrollToSelection>n.scrollToSelection?`to selection`:`preserve`,l=r||!this.docView.matchesNode(e.doc,s,o);(l||!e.selection.eq(n.selection))&&(i=!0);let u=c==`preserve`&&i&&this.dom.style.overflowAnchor==null&&xN(this);if(i){this.domObserver.stop();let t=l&&(iN||cN)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&ine(n.selection,e.selection);if(l){let n=cN?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=XF(this)),(r||!this.docView.update(e.doc,s,o,this))&&(this.docView.updateOuterDeco(s),this.docView.destroy(),this.docView=iP(e.doc,s,o,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&RP(this))?EP(this,t):(NP(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),this.dragging?.node&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),c==`reset`?this.dom.scrollTop=0:c==`to selection`?this.scrollToSelection():u&&CN(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof Tj){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&bN(this,t.getBoundingClientRect(),e)}else bN(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 e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new iI(e.slice,e.move,r<0?void 0:Tj.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(iN){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&&EN(this.dom),EP(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return PN(this,e)}coordsAtPos(e,t=1){return RN(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return JN(this,t||this.state,e)}pasteHTML(e,t){return nI(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return nI(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return iF(this,e)}destroy(){this.docView&&(DF(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],DI(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,zM())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return jF(this,e)}domSelectionRange(){let e=this.domSelection();return e?uN&&this.root.nodeType===11&&XM(this.dom.ownerDocument)==this.dom&&II(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};YI.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function XI(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||=`no`,[fI.node(0,e.state.doc.content.size,t)]}function ZI(e){if(e.markCursor){let t=document.createElement(`img`);t.className=`ProseMirror-separator`,t.setAttribute(`mark-placeholder`,`true`),t.setAttribute(`alt`,``),e.cursorWrapper={dom:t,deco:fI.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function QI(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function ine(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function $I(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function ane(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function eL(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError(`Plugins passed directly to the view must not have a state component`)}for(var tL={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:`'`},nL={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},one=typeof navigator<`u`&&/Mac/.test(navigator.platform),sne=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),rL=0;rL<10;rL++)tL[48+rL]=tL[96+rL]=String(rL);for(var rL=1;rL<=24;rL++)tL[rL+111]=`F`+rL;for(var rL=65;rL<=90;rL++)tL[rL]=String.fromCharCode(rL+32),nL[rL]=String.fromCharCode(rL);for(var iL in tL)nL.hasOwnProperty(iL)||(nL[iL]=tL[iL]);function cne(e){var t=!(one&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||sne&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?nL:tL)[e.keyCode]||e.key||`Unidentified`;return t==`Esc`&&(t=`Escape`),t==`Del`&&(t=`Delete`),t==`Left`&&(t=`ArrowLeft`),t==`Up`&&(t=`ArrowUp`),t==`Right`&&(t=`ArrowRight`),t==`Down`&&(t=`ArrowDown`),t}var lne=typeof navigator<`u`&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),une=typeof navigator<`u`&&/Win/.test(navigator.platform);function dne(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e++){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))lne?o=!0:i=!0;else throw Error(`Unrecognized modifier name: `+n)}return r&&(n=`Alt-`+n),i&&(n=`Ctrl-`+n),o&&(n=`Meta-`+n),a&&(n=`Shift-`+n),n}function fne(e){let t=Object.create(null);for(let n in e)t[dne(n)]=e[n];return t}function aL(e,t,n=!0){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n&&t.shiftKey&&(e=`Shift-`+e),e}function pne(e){return new Vj({props:{handleKeyDown:oL(e)}})}function oL(e){let t=fne(e);return function(e,n){let r=cne(n),i,a=t[aL(r,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(r.length==1&&r!=` `){if(n.shiftKey){let i=t[aL(r,n,!1)];if(i&&i(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(une&&n.ctrlKey&&n.altKey)&&(i=tL[n.keyCode])&&i!=r){let r=t[aL(i,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var mne=Object.defineProperty,sL=(e,t)=>{for(var n in t)mne(e,n,{get:t[n],enumerable:!0})};function cL(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var lL=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:cL({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},uL={};sL(uL,{blur:()=>hne,clearContent:()=>gne,clearNodes:()=>_ne,command:()=>vne,createParagraphNear:()=>yne,cut:()=>bne,deleteCurrentNode:()=>xne,deleteNode:()=>Sne,deleteRange:()=>Cne,deleteSelection:()=>Ene,enter:()=>Dne,exitCode:()=>One,extendMarkRange:()=>kne,first:()=>Ane,focus:()=>Mne,forEach:()=>Nne,insertContent:()=>Pne,insertContentAt:()=>Lne,joinBackward:()=>Bne,joinDown:()=>zne,joinForward:()=>Vne,joinItemBackward:()=>Hne,joinItemForward:()=>Une,joinTextblockBackward:()=>Wne,joinTextblockForward:()=>Gne,joinUp:()=>Rne,keyboardShortcut:()=>qne,lift:()=>Jne,liftEmptyBlock:()=>Yne,liftListItem:()=>Xne,newlineInCode:()=>Zne,resetAttributes:()=>Qne,scrollIntoView:()=>$ne,selectAll:()=>ere,selectNodeBackward:()=>tre,selectNodeForward:()=>nre,selectParentNode:()=>rre,selectTextblockEnd:()=>ire,selectTextblockStart:()=>are,setContent:()=>ore,setMark:()=>Dre,setMeta:()=>Ore,setNode:()=>kre,setNodeSelection:()=>Are,setTextDirection:()=>jre,setTextSelection:()=>Mre,sinkListItem:()=>Nre,splitBlock:()=>Pre,splitListItem:()=>Fre,toggleList:()=>Lre,toggleMark:()=>Rre,toggleNode:()=>zre,toggleWrap:()=>Bre,undoInputRule:()=>Vre,unsetAllMarks:()=>Hre,unsetMark:()=>Ure,unsetTextDirection:()=>Wre,updateAttributes:()=>Gre,wrapIn:()=>Kre,wrapInList:()=>qre});var hne=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),gne=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),_ne=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=MA(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},vne=e=>t=>e(t),yne=()=>({state:e,dispatch:t})=>uM(e,t),bne=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new Cj(r.doc.resolve(Math.max(o-1,0)))),!0},xne=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function dL(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var Sne=e=>({tr:t,state:n,dispatch:r})=>{let i=dL(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},Cne=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},wne=e=>e.content?/^text(\*|\+)/.test(e.content):!1,fL=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return wne(r)?n===`left`?e.start()-1:e.end()+1:e.pos},Tne=(e,t,n)=>({from:fL(e,n,`left`),to:fL(t,n,`right`)}),Ene=()=>({state:e,dispatch:t})=>{let{$from:n,$to:r}=e.selection;if(e.selection.empty)return!1;let{from:i,to:a}=Tne(n,r,e.schema);return t&&(e.tr.deleteRange(i,a).scrollIntoView(),t(e.tr)),!0},Dne=()=>({commands:e})=>e.keyboardShortcut(`Enter`),One=()=>({state:e,dispatch:t})=>lM(e,t);function pL(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function mL(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:pL(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function hL(e,t,n={}){return e.find(e=>e.type===t&&mL(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function gL(e,t,n={}){return!!hL(e,t,n)}function _L(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(e=>e.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!hL([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&gL([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&gL([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function vL(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var kne=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=vL(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=_L(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=Cj.create(o,e.from,e.to);n.setSelection(t)}}return!0},Ane=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function yL(e){return e instanceof Cj}function bL(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function xL(e,t=null){if(!t)return null;let n=yj.atStart(e),r=yj.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?Cj.create(e,bL(0,i,a),bL(e.content.size,i,a)):Cj.create(e,bL(t,i,a),bL(t,i,a))}function SL(){return navigator.platform===`Android`||/android/i.test(navigator.userAgent)}function CL(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function jne(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Mne=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(CL()||SL())&&r.dom.focus(),jne()&&!CL()&&!SL()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!yL(n.state.selection))return o(),!0;let s=xL(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Nne=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Pne=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),wL=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&wL(r)}return e};function TL(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return wL(n)}function EL(e,t,n){if(e instanceof lk||e instanceof Z)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e==`object`&&!!e,i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return Z.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),EL(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new Pk({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?Rk.fromSchema(a).parseSlice(TL(e),n.parseOptions):Rk.fromSchema(a).parse(TL(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Rk.fromSchema(t);return n.slice?r.parseSlice(TL(e),n.parseOptions).content:r.parse(TL(e),n.parseOptions)}return EL(``,t,n)}function Fne(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof TA||i instanceof EA))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(yj.near(e.doc.resolve(o),n))}var Ine=e=>!(`type`in e),Lne=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{EL(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=EL(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((Ine(i)?i:[i]).forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let f;if(u){if(Array.isArray(t))f=t.map(e=>e.text||``).join(``);else if(t instanceof Z){let e=``;t.forEach(t=>{t.text&&(e+=t.text)}),f=e}else f=typeof t==`object`&&t&&t.text?t.text:t;r.insertText(f,c,l)}else{f=i;let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,a=t.isText||t.isTextblock,o=t.content.size>0;n&&a&&o&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&Fne(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:f}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:f})}return!0},Rne=()=>({state:e,dispatch:t})=>iM(e,t),zne=()=>({state:e,dispatch:t})=>aM(e,t),Bne=()=>({state:e,dispatch:t})=>qj(e,t),Vne=()=>({state:e,dispatch:t})=>tM(e,t),Hne=()=>({state:e,dispatch:t,tr:n})=>{try{let r=YA(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Une=()=>({state:e,dispatch:t,tr:n})=>{try{let r=YA(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Wne=()=>({state:e,dispatch:t})=>Jj(e,t),Gne=()=>({state:e,dispatch:t})=>Yj(e,t);function DL(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function Kne(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))CL()||DL()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var qne=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=Kne(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function OL(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?dL(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>mL(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var Jne=(e,t={})=>({state:n,dispatch:r})=>OL(n,dL(e,n.schema),t)?oM(n,r):!1,Yne=()=>({state:e,dispatch:t})=>dM(e,t),Xne=e=>({state:t,dispatch:n})=>jM(dL(e,t.schema))(t,n),Zne=()=>({state:e,dispatch:t})=>sM(e,t);function kL(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function AL(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var Qne=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=kL(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=dL(e,r.schema)),s===`mark`&&(o=vL(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,AL(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(AL(a.attrs,t))))})})}),c},$ne=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),ere=()=>({tr:e,dispatch:t})=>{if(t){let t=new Dj(e.doc);e.setSelection(t)}return!0},tre=()=>({state:e,dispatch:t})=>Qj(e,t),nre=()=>({state:e,dispatch:t})=>nM(e,t),rre=()=>({state:e,dispatch:t})=>mM(e,t),ire=()=>({state:e,dispatch:t})=>bM(e,t),are=()=>({state:e,dispatch:t})=>yM(e,t);function jL(e,t,n={},r={}){return EL(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var ore=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=jL(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,c.content.size,s).setMeta(`preventUpdate`,!n),!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function ML(e,t){let n=vL(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function NL(e,t){let n=new _j(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function sre(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function cre(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function PL(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function FL(e){return t=>PL(t.$from,e)}function IL(e,t,n){return e.config[t]===void 0&&e.parent?IL(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?IL(e.parent,t,n):null}):e.config[t]}function LL(e){return e.map(e=>{let t=IL(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...LL(t())]:e}).flat(10)}function RL(e,t){let n=Qk.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function zL(e){return typeof e==`function`}function BL(e,t=void 0,...n){return zL(e)?t?e.bind(t)(...n):e(...n):e}function lre(e={}){return Object.keys(e).length===0&&e.constructor===Object}function VL(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function HL(e){let t=[],{nodeExtensions:n,markExtensions:r}=VL(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=IL(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=IL(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function ure(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function UL(e){let t=[],n=ure(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function WL(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...UL(n[e]),...UL(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function GL(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>WL(e,t),{})}function dre(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function KL(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):dre(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function qL(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&lre(t)?!1:t!=null))}function JL(e){let t={};return!e?.attribute?.isRequired&&`default`in(e?.attribute||{})&&(t.default=e.attribute.default),e?.attribute?.validate!==void 0&&(t.validate=e.attribute.validate),[e.name,t]}function fre(e,t){let n=HL(e),{nodeExtensions:r,markExtensions:i}=VL(e);return new Pk({topNode:r.find(e=>IL(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=qL({...e.reduce((e,t)=>{let n=IL(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:BL(IL(r,`content`,a)),marks:BL(IL(r,`marks`,a)),group:BL(IL(r,`group`,a)),inline:BL(IL(r,`inline`,a)),atom:BL(IL(r,`atom`,a)),selectable:BL(IL(r,`selectable`,a)),draggable:BL(IL(r,`draggable`,a)),code:BL(IL(r,`code`,a)),whitespace:BL(IL(r,`whitespace`,a)),linebreakReplacement:BL(IL(r,`linebreakReplacement`,a)),defining:BL(IL(r,`defining`,a)),isolating:BL(IL(r,`isolating`,a)),attrs:Object.fromEntries(i.map(JL))}),s=BL(IL(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>KL(e,i)));let c=IL(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:GL(e,i)}));let l=IL(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=qL({...e.reduce((e,t)=>{let n=IL(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:BL(IL(r,`inclusive`,a)),excludes:BL(IL(r,`excludes`,a)),group:BL(IL(r,`group`,a)),spanning:BL(IL(r,`spanning`,a)),code:BL(IL(r,`code`,a)),attrs:Object.fromEntries(i.map(JL))}),s=BL(IL(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>KL(e,i)));let c=IL(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:GL(e,i)})),[r.name,o]}))})}function pre(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function YL(e){return e.sort((e,t)=>{let n=IL(e,`priority`)||100,r=IL(t,`priority`)||100;return n>r?-1:+(n<r)})}function XL(e){let t=YL(LL(e)),n=pre(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function ZL(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
|
|
126
|
+
|
|
127
|
+
`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;e.isText&&(s+=(e?.text)?.slice(Math.max(r,n)-n,i-n))}),s}function mre(e,t){return ZL(e,{from:0,to:e.content.size},t)}function QL(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function hre(e,t){let n=dL(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function $L(e,t){let n=kL(typeof t==`string`?t:t.name,e.schema);return n===`node`?hre(e,t):n===`mark`?ML(e,t):{}}function gre(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function _re(e){let t=gre(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function eR(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),_re(r)}function tR(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=_L(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||e?.nodeSize===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var vre=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]};function nR(e,t){return t.nodes[e]||t.marks[e]||null}function rR(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var yre=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function iR(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?vL(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>mL(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>mL(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function bre(e,t,n={}){if(!t)return OL(e,null,n)||iR(e,null,n);let r=kL(t,e.schema);return r===`node`?OL(e,t,n):r===`mark`?iR(e,t,n):!1}var xre=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=FL(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Sre=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function aR(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function oR(e,t){let{nodeExtensions:n}=VL(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=BL(IL(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function sR(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(sR(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function cR(e){return e instanceof Tj}function Cre({selection:e,pos:t,nodeSize:n,selectedOnTextSelection:r=!1}){let{from:i,to:a}=e;return!!(i<=t&&a>=t+n||r&&yL(e)&&i>t&&a<t+n)}var lR=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function wre(e,t){let n=t.mapping.mapResult(e.position);return{position:new lR(n.pos),mapResult:n}}function Tre(e){return new lR(e)}function Ere(e,t,n){let{selection:r}=t,i=null;if(yL(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var Dre=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=vL(e,r.schema);if(i)if(o){let e=ML(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return Ere(r,n,c)},Ore=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),kre=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=dL(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>SM(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>SM(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},Are=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=bL(e,0,n.content.size),i=Tj.create(n,r);t.setSelection(i)}return!0},jre=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},Mre=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=Cj.atStart(n).from,o=Cj.atEnd(n).to,s=bL(r,a,o),c=bL(i,a,o),l=Cj.create(n,s,c);t.setSelection(l)}return!0},Nre=e=>({state:t,dispatch:n})=>PM(dL(e,t.schema))(t,n);function uR(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var Pre=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=rR(l,s.node().type.name,s.node().attrs);if(a instanceof Tj&&a.node.isBlock)return!s.parentOffset||!WA(o,s.pos)?!1:(r&&(e&&uR(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:sre(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=WA(t.doc,t.mapping.map(s.pos),1,p);if(!p&&!m&&WA(t.doc,t.mapping.map(s.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(a instanceof Cj&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f)){let e=t.mapping.map(s.before()),n=t.doc.resolve(e);s.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(s.before()),f)}e&&uR(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},Fre=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=dL(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=Z.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=Z.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...rR(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(Z.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new Q(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(Cj.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...rR(d,u.type.name,u.attrs),...t},m={...rR(d,s.node().type.name,s.node().attrs),...t};n.delete(s.pos,c.pos);let h=f?[{type:o,attrs:p},{type:f,attrs:m}]:[{type:o,attrs:p}];if(!WA(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,h).scrollIntoView(),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0},dR=(e,t)=>{let n=FL(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&KA(e.doc,n.pos)&&e.join(n.pos),!0},fR=(e,t)=>{let n=FL(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&KA(e.doc,r)&&e.join(r),!0};function Ire(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return Cj.between(r,i)}var Lre=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=dL(e,o.schema),m=dL(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let x=FL(e=>oR(e.type.name,d))(h),S=h.from===0&&h.to===o.doc.content.size,C=o.doc.content.content,w=C.length===1?C[0]:null,T=S&&w&&oR(w.type.name,d)?{node:w,pos:0,depth:0}:null,E=x??T,D=!!x&&y.depth>=1&&y.depth-x.depth<=1,O=!!T;if((D||O)&&E){if(E.node.type===p)return S&&O?c().command(({tr:e,dispatch:t})=>{let n=Ire(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(oR(E.node.type.name,d)&&p.validContent(E.node.content))return c().command(()=>(a.setNodeMarkup(E.pos,p),!0)).command(()=>dR(a,p)).command(()=>fR(a,p)).run()}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>dR(a,p)).command(()=>fR(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>dR(a,p)).command(()=>fR(a,p)).run()},Rre=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=vL(e,r.schema);return iR(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},zre=(e,t,n={})=>({state:r,commands:i})=>{let a=dL(e,r.schema),o=dL(t,r.schema),s=OL(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},Bre=(e,t={})=>({state:n,commands:r})=>{let i=dL(e,n.schema);return OL(n,i,t)?r.lift(i):r.wrapIn(i,t)},Vre=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},Hre=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},Ure=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=vL(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=_L(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},Wre=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},Gre=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=kL(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=dL(e,r.schema)),s===`mark`&&(o=vL(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},Kre=(e,t={})=>({state:n,dispatch:r})=>xM(dL(e,n.schema),t)(n,r),qre=(e,t={})=>({state:n,dispatch:r})=>OM(dL(e,n.schema),t)(n,r),Jre=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},pR=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},Yre=(e,t)=>{if(pL(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,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 mR(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o}=e,{view:s}=t;if(s.composing)return!1;let c=s.state.doc.resolve(n);if(c.parent.type.spec.code||(c.nodeBefore||c.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let l=!1,u=yre(c)+i;return a.forEach(e=>{if(l)return;let a=Yre(u,e.find);if(!a)return;let c=s.state.tr,d=cL({state:s.state,transaction:c}),f={from:n-(a[0].length-i.length),to:r},{commands:p,chain:m,can:h}=new lL({editor:t,state:d});e.handler({state:d,range:f,match:a,commands:p,chain:m,can:h})===null||!c.steps.length||(e.undoable&&c.setMeta(o,{transform:c,from:n,to:r,text:i}),s.dispatch(c),l=!0)}),l}function Xre(e){let{editor:t,rules:n}=e,r=new Vj({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:RL(Z.from(e),a.schema);let{from:i}=s;mR({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return mR({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&mR({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?mR({editor:t,from:a.pos,to:a.pos,text:`
|
|
128
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Zre(e){return Object.prototype.toString.call(e).slice(8,-1)}function hR(e){return Zre(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function gR(e,t){let n={...e};return hR(e)&&hR(t)&&Object.keys(t).forEach(r=>{hR(t[r])&&hR(e[r])?n[r]=gR(e[r],t[r]):n[r]=t[r]}),n}var _R=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...BL(IL(this,`addOptions`,{name:this.name}))}}get storage(){return{...BL(IL(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>gR(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},vR=class e extends _R{constructor(){super(...arguments),this.type=`mark`}static create(t={}){return new e(typeof t==`function`?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function Qre(e){return typeof e==`number`}var $re=class{constructor(e){this.find=e.find,this.handler=e.handler}},eie=(e,t,n)=>{if(pL(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function tie(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new lL({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{if(e.type?.spec?.code||!(e.isText||e.isTextblock||e.isInline))return;let f=e.content?.size??e.nodeSize??0,p=Math.max(r,t),m=Math.min(i,t+f);p>=m||eie(e.isText?e.text||``:e.textBetween(p-t,m-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var yR=null,nie=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function rie(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!tie({editor:t,state:cL({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new Vj({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(yR=t)},i=()=>{yR&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=yR;e?.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:RL(Z.from(t),r.schema);let{from:n}=d,i=n+t.length,a=nie(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!Qre(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var bR=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=XL(e),this.schema=fre(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=IL(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:nR(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this;return YL([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:nR(t.name,this.schema)},r=[],i=IL(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&IL(t,`exitable`,n)&&(a.ArrowRight=()=>vR.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=pne(a);r.push(o);let s=IL(t,`addInputRules`,n);if(aR(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=Xre({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=IL(t,`addPasteRules`,n);if(aR(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=rie({editor:e,rules:t});r.push(...n)}}let l=IL(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r})}get attributes(){return HL(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=VL(this.extensions);return Object.fromEntries(t.filter(e=>!!IL(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=IL(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:dL(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:GL(r,n)})]:[]}))}dispatchTransaction(e){let{editor:t}=this;return YL([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:nR(n.name,this.schema)},i=IL(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return YL([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:nR(n.name,this.schema)},i=IL(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=VL(this.extensions);return Object.fromEntries(t.filter(e=>!!IL(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=IL(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:vL(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=GL(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{gie(i,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:nR(e.name,this.schema)};e.type===`mark`&&((BL(IL(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name),(BL(IL(e,`clearable`,t))??!0)||this.nonClearableMarks.push(e.name));let n=IL(e,`onBeforeCreate`,t),r=IL(e,`onCreate`,t),i=IL(e,`onUpdate`,t),a=IL(e,`onSelectionUpdate`,t),o=IL(e,`onTransaction`,t),s=IL(e,`onFocus`,t),c=IL(e,`onBlur`,t),l=IL(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};bR.resolve=XL,bR.sort=YL,bR.flatten=LL,sL({},{ClipboardTextSerializer:()=>SR,Commands:()=>CR,Delete:()=>wR,Drop:()=>TR,Editable:()=>ER,FocusEvents:()=>OR,Keymap:()=>kR,Paste:()=>AR,Tabindex:()=>jR,TextDirection:()=>MR,focusEventsPluginKey:()=>DR});var xR=class e extends _R{constructor(){super(...arguments),this.type=`extension`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},SR=xR.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Vj({key:new Wj(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=QL(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>ZL(r,{from:e.pos,to:t.pos},s)).join(o??`
|
|
129
|
+
|
|
130
|
+
`)}}})]}}),CR=xR.create({name:`commands`,addCommands(){return{...uL}}}),wR=xR.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){let n=()=>{var n;if(((n=this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n,e)??e.getMeta(`y-sync$`))return;let r=NL(e.before,[e,...t]);eR(r).forEach(t=>{r.mapping.mapResult(t.oldRange.from).deletedAfter&&r.mapping.mapResult(t.oldRange.to).deletedBefore&&r.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,i)=>{let a=i+n.nodeSize-2,o=t.oldRange.from<=i&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:i,to:a,newFrom:r.mapping.map(i),newTo:r.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:r})})});let i=r.mapping;r.steps.forEach((t,n)=>{if(t instanceof SA){let a=i.slice(n).map(t.from,-1),o=i.slice(n).map(t.to),s=i.invert().map(a,-1),c=i.invert().map(o),l=a>0?r.doc.nodeAt(a-1)?.marks.some(e=>e.eq(t.mark)):!1,u=r.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:a,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:r})}})};this.editor.options.coreExtensionOptions?.delete?.async??!0?setTimeout(n,0):n()}}),TR=xR.create({name:`drop`,addProseMirrorPlugins(){return[new Vj({key:new Wj(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),ER=xR.create({name:`editable`,addProseMirrorPlugins(){return[new Vj({key:new Wj(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),DR=new Wj(`focusEvents`),OR=xR.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new Vj({key:DR,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),kR=xR.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:yj.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return CL()||DL()?i:r},addProseMirrorPlugins(){return[new Vj({key:new Wj(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=yj.atStart(t.doc).from,l=yj.atEnd(t.doc).to;if(a||!(o===c&&s===l)||!sR(n.doc))return;let u=n.tr,d=cL({state:n,transaction:u}),{commands:f}=new lL({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),AR=xR.create({name:`paste`,addProseMirrorPlugins(){return[new Vj({key:new Wj(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),jR=xR.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Vj({key:new Wj(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),MR=xR.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=VL(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Vj({key:new Wj(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),iie=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}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(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},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}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},aie=`.ProseMirror {
|
|
131
|
+
position: relative;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.ProseMirror {
|
|
135
|
+
word-wrap: break-word;
|
|
136
|
+
white-space: pre-wrap;
|
|
137
|
+
white-space: break-spaces;
|
|
138
|
+
-webkit-font-variant-ligatures: none;
|
|
139
|
+
font-variant-ligatures: none;
|
|
140
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.ProseMirror [contenteditable="false"] {
|
|
144
|
+
white-space: normal;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
148
|
+
white-space: pre-wrap;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.ProseMirror pre {
|
|
152
|
+
white-space: pre-wrap;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
img.ProseMirror-separator {
|
|
156
|
+
display: inline !important;
|
|
157
|
+
border: none !important;
|
|
158
|
+
margin: 0 !important;
|
|
159
|
+
width: 0 !important;
|
|
160
|
+
height: 0 !important;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.ProseMirror-gapcursor {
|
|
164
|
+
display: none;
|
|
165
|
+
pointer-events: none;
|
|
166
|
+
position: absolute;
|
|
167
|
+
margin: 0;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.ProseMirror-gapcursor:after {
|
|
171
|
+
content: "";
|
|
172
|
+
display: block;
|
|
173
|
+
position: absolute;
|
|
174
|
+
top: -2px;
|
|
175
|
+
width: 20px;
|
|
176
|
+
border-top: 1px solid black;
|
|
177
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@keyframes ProseMirror-cursor-blink {
|
|
181
|
+
to {
|
|
182
|
+
visibility: hidden;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.ProseMirror-hideselection *::selection {
|
|
187
|
+
background: transparent;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
191
|
+
background: transparent;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.ProseMirror-hideselection * {
|
|
195
|
+
caret-color: transparent;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
199
|
+
display: block;
|
|
200
|
+
}`;function NR(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}var oie=class extends Jre{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!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:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:wre,createMappablePosition:Tre},this.setOptions(e),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:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc(),n=xL(t,this.options.autofocus);this.editorState=zj.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),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){let e=this.editorView.dom;e?.editor&&delete e.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(e){console.warn(`Failed to remove CSS element:`,e)}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=NR(aie,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&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:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=zL(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){let e=[...this.options.enableCoreExtensions?[ER,SR.configure({blockSeparator:this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator}),CR,OR,kR,jR.configure({value:this.options.coreExtensionOptions?.tabindex?.value}),TR,AR,wR,MR.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new bR(e,this)}createCommandManager(){this.commandManager=new lL({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=jL(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(t.message))throw t;this.emit(`contentError`,{editor:this,error:t,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(e=>e.name!==`collaboration`),this.createExtensionManager()}}),e=jL(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new YI(e,{...t,attributes:{role:`textbox`,...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.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(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return $L(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return bre(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return RL(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
|
|
201
|
+
|
|
202
|
+
`,textSerializers:n={}}=e||{};return mre(this.state.doc,{blockSeparator:t,textSerializers:{...QL(this.schema),...n}})}get isEmpty(){return sR(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new iie(t,this,!1,n)}get $doc(){return this.$pos(0)}};function PR(e){return new pR({find:e.find,handler:({state:t,range:n,match:r})=>{let i=BL(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(tR(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function FR(e){return new pR({find:e.find,handler:({state:t,range:n,match:r})=>{let i=BL(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function IR(e){return new pR({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=BL(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function LR(e){return new pR({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=BL(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&PA(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&KA(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var sie=e=>`touches`in e,cie=class{constructor(e){this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.element.draggable=!1,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min&&(this.minSize={...this.minSize,...e.options.min}),e.options?.max&&(this.maxSize=e.options.max),e?.options?.directions&&(this.directions=e.options.directions),e.options?.preserveAspectRatio&&(this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className&&(this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resizing||``}),e.options?.createCustomHandle&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on(`update`,this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){return this.contentElement??null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type?(this.node=e,this.onUpdate?this.onUpdate(e,t,n):!0):!1}destroy(){this.isResizing&&(this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off(`update`,this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement(`div`);return e.dataset.resizeContainer=``,e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?`inline-flex`:`flex`,this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement(`div`);return e.style.position=`relative`,e.style.display=`block`,e.dataset.resizeWrapper=``,this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement(`div`);return t.dataset.resizeHandle=e,t.style.position=`absolute`,this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes(`top`),r=t.includes(`bottom`),i=t.includes(`left`),a=t.includes(`right`);n&&(e.style.top=`0`),r&&(e.style.bottom=`0`),i&&(e.style.left=`0`),a&&(e.style.right=`0`),(t===`top`||t===`bottom`)&&(e.style.left=`0`,e.style.right=`0`),(t===`left`||t===`right`)&&(e.style.top=`0`,e.style.bottom=`0`)}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener(`mousedown`,t=>this.handleResizeStart(t,e)),t.addEventListener(`touchstart`,t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,sie(e)?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState=`true`,this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener(`mousemove`,this.handleMouseMove),document.addEventListener(`touchmove`,this.handleTouchMove),document.addEventListener(`mouseup`,this.handleMouseUp),document.addEventListener(`keydown`,this.handleKeyDown),document.addEventListener(`keyup`,this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),a=this.applyConstraints(r,i,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,a=e.includes(`right`),o=e.includes(`left`),s=e.includes(`bottom`),c=e.includes(`top`);return a?r=this.startWidth+t:o&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),(e===`right`||e===`left`)&&(r=this.startWidth+(a?t:-t)),(e===`top`||e===`bottom`)&&(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return this.maxSize?.width&&(n=Math.min(this.maxSize.width,n)),this.maxSize?.height&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let r=e,i=t;return r<this.minSize.width&&(r=this.minSize.width,i=r/this.aspectRatio),i<this.minSize.height&&(i=this.minSize.height,r=i*this.aspectRatio),this.maxSize?.width&&r>this.maxSize.width&&(r=this.maxSize.width,i=r/this.aspectRatio),this.maxSize?.height&&i>this.maxSize.height&&(i=this.maxSize.height,r=i*this.aspectRatio),{width:r,height:i}}applyAspectRatio(e,t,n){return n===`left`||n===`right`?{width:e,height:e/this.aspectRatio}:n===`top`||n===`bottom`?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function lie(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof Tj){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function uie(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}sL({},{createAtomBlockMarkdownSpec:()=>die,createBlockMarkdownSpec:()=>fie,createInlineMarkdownSpec:()=>hie,parseAttributes:()=>RR,parseIndentedBlocks:()=>BR,renderNestedMarkdownContent:()=>VR,serializeAttributes:()=>zR});function RR(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(` `));let a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{let i=n[parseInt(r.match(/__QUOTED_(\d+)__/)?.[1]||`0`,10)];i&&(t[e]=i.slice(1,-1))});let o=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 o&&o.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function zR(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function die(e){let{nodeName:t,name:n,parseAttributes:r=RR,serializeAttributes:i=zR,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${c}(?:\\s|$)`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function fie(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=RR,serializeAttributes:a=zR,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){let t=RegExp(`^:::${l}`,`m`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!n[2]?.endsWith(`:::`)){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``}
|
|
203
|
+
|
|
204
|
+
${t.renderChildren(e.content||[],`
|
|
205
|
+
|
|
206
|
+
`)}
|
|
207
|
+
|
|
208
|
+
:::`}}}function pie(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i]=a||o,r=n.exec(e)}return t}function mie(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function hie(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=pie,serializeAttributes:a=mie,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{let r=typeof n==`string`?n:n.name,i=typeof n==`string`?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(i!==void 0&&n===i)return;t[r]=n}}),t},d=l.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return{parseMarkdown:(e,n)=>{let i={...o,...e.attributes};if(s)return n.createNode(t,i);let a=r?r(e):e.content||``;return a?n.createNode(t,i,[n.createTextNode(a)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:`inline`,start(e){let t=RegExp(s?`\\[${d}\\s*[^\\]]*\\]`:`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t)?.index;return n===void 0?-1:n},tokenize(e,n,r){let a=RegExp(s?`^\\[${d}\\s*([^\\]]*)\\]`:`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),o=e.match(a);if(!o)return;let c=``,l=``;if(s){let[,e]=o;l=e}else{let[,e,t]=o;l=e,c=t||``}let u=i(l.trim());return{type:t,raw:o[0],content:c.trim(),attributes:u}}},renderMarkdown:e=>{let t=``;r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``));let n=a(u(e.attrs||{})),i=n?` ${n}`:``;return s?`[${l}${i}]`:`[${l}${i}]${t}[/${l}]`}}}function BR(e,t,n){let r=e.split(`
|
|
209
|
+
`),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],c=e.match(t.itemPattern);if(!c){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}
|
|
210
|
+
`;continue}else return}let l=t.extractItemData(c),{indentLevel:u,mainContent:d}=l;a=`${a}${e}
|
|
211
|
+
`;let f=[d];for(o+=1;o<r.length;){let e=r[o];if(e.trim()===``){let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((r[o+1+t].match(/^(\s*)/)?.[1]?.length||0)>u){f.push(e),a=`${a}${e}
|
|
212
|
+
`,o+=1;continue}else break}if((e.match(/^(\s*)/)?.[1]?.length||0)>u)f.push(e),a=`${a}${e}
|
|
213
|
+
`,o+=1;else break}let p,m=f.slice(1);if(m.length>0){let e=m.map(e=>e.slice(u+s)).join(`
|
|
214
|
+
`);e.trim()&&(p=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let h=t.createToken(l,p);i.push(h)}if(i.length!==0)return{items:i,raw:a}}function VR(e,t,n,r){if(!e||!Array.isArray(e.content))return``;let i=typeof n==`function`?n(r):n,[a,...o]=e.content,s=`${i}${t.renderChildren([a])}`;return o&&o.length>0&&o.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=r.split(`
|
|
215
|
+
`).map(e=>e?t.indent(e):t.indent(``)).join(`
|
|
216
|
+
`);s+=e.type===`paragraph`?`
|
|
217
|
+
|
|
218
|
+
${n}`:`
|
|
219
|
+
${n}`}}),s}function gie(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var HR=class e extends _R{constructor(){super(...arguments),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},_ie=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t;let{view:n}=this.editor,r=e.target,i=r.nodeType===3?r.parentElement?.closest(`[data-drag-handle]`):r.closest(`[data-drag-handle]`);if(!this.dom||this.contentDOM?.contains(r)||!i)return;let a=0,o=0;if(this.dom!==i){let t=this.dom.getBoundingClientRect(),n=i.getBoundingClientRect(),r=e.offsetX??e.nativeEvent?.offsetX,s=e.offsetY??e.nativeEvent?.offsetY;a=n.x-t.x+r,o=n.y-t.y+s}let s=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();s.style.width=`${Math.round(e.width)}px`,s.style.height=`${Math.round(e.height)}px`,s.style.boxSizing=`border-box`,s.style.pointerEvents=`none`}catch{}let c=null;try{c=document.createElement(`div`),c.style.position=`absolute`,c.style.top=`-9999px`,c.style.left=`-9999px`,c.style.pointerEvents=`none`,c.appendChild(s),document.body.appendChild(c),(t=e.dataTransfer)==null||t.setDragImage(s,a,o)}finally{c&&setTimeout(()=>{try{c?.remove()}catch{}},0)}let l=this.getPos();if(typeof l!=`number`)return;let u=Tj.create(n.state.doc,l),d=n.state.tr.setSelection(u);n.dispatch(d)}stopEvent(e){if(!this.dom)return!1;if(typeof this.options.stopEvent==`function`)return this.options.stopEvent({event:e});let t=e.target;if(!(this.dom.contains(t)&&!this.contentDOM?.contains(t)))return!1;let n=e.type.startsWith(`drag`),r=e.type===`dragover`||e.type===`dragenter`,i=e.type===`drop`;if(([`INPUT`,`BUTTON`,`SELECT`,`TEXTAREA`].includes(t.tagName)||t.isContentEditable)&&!i&&!n)return!0;let{isEditable:a}=this.editor,{isDragging:o}=this,s=!!this.node.type.spec.draggable,c=Tj.isSelectable(this.node),l=e.type===`copy`,u=e.type===`paste`,d=e.type===`cut`,f=e.type===`mousedown`;if(!s&&c&&n&&e.target===this.dom&&e.preventDefault(),s&&n&&!o&&e.target===this.dom)return e.preventDefault(),!1;if(s&&a&&!o&&f){let e=t.closest(`[data-drag-handle]`);e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener(`dragend`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`drop`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`mouseup`,()=>{this.isDragging=!1},{once:!0}))}return!(o||r||i||l||u||d||f&&c)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation==`function`?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type===`selection`||this.dom.contains(e.target)&&e.type===`childList`&&(CL()||SL())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===e.target&&e.type===`attributes`?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return typeof n==`number`?(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0):!1})}deleteNode(){let e=this.getPos();if(typeof e!=`number`)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function UR(e){return new $re({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=BL(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(tR(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var vie=({key:e,editor:t,onPaste:n,onDrop:r,allowedMimeTypes:i,consumePasteEvent:a})=>new Vj({key:e||new Wj(`fileHandler`),props:{handleDrop(e,n){if(!r||n.dataTransfer?.types.includes(`application/x-prosemirror-slice`)||!n.dataTransfer?.files.length)return!1;let a=e.posAtCoords({left:n.clientX,top:n.clientY}),o=Array.from(n.dataTransfer.files);return i&&(o=o.filter(e=>i.includes(e.type))),o.length===0?!1:(n.preventDefault(),n.stopPropagation(),r(t,o,a?.pos||0),!0)},handlePaste(e,r){if(!n||!r.clipboardData?.files.length)return!1;let o=Array.from(r.clipboardData.files),s=r.clipboardData.getData(`text/html`);return i&&(o=o.filter(e=>i.includes(e.type))),!(o.length===0||(r.preventDefault(),r.stopPropagation(),n(t,o,s),s.length>0&&!a))}}}),yie=xR.create({name:`fileHandler`,addOptions(){return{onPaste:void 0,onDrop:void 0,allowedMimeTypes:void 0,consumePasteEvent:!1}},addProseMirrorPlugins(){return[vie({key:new Wj(this.name),editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onDrop:this.options.onDrop,onPaste:this.options.onPaste,consumePasteEvent:this.options.consumePasteEvent})]}}),bie=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,xie=HR.create({name:`image`,addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?`inline`:`block`},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?`img[src]`:`img[src]:not([src^="data:"])`}]},renderHTML({HTMLAttributes:e}){return[`img`,WL(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode(`image`,{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{let t=e.attrs?.src??``,n=e.attrs?.alt??``,r=e.attrs?.title??``;return r?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>`u`)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:i,getPos:a,HTMLAttributes:o,editor:s})=>{let c=document.createElement(`img`);c.draggable=!1;let l=WL(this.options.HTMLAttributes,o);Object.entries(l).forEach(([e,t])=>{if(t!=null)switch(e){case`width`:case`height`:break;default:c.setAttribute(e,t);break}}),l.src!==null&&(c.src=l.src);let u=new cie({element:c,editor:s,node:i,getPos:a,onResize:(e,t)=>{c.style.width=`${e}px`,c.style.height=`${t}px`},onCommit:(e,t)=>{let n=a();n!==void 0&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===i.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:r===!0}}),d=u.dom;return d.style.visibility=`hidden`,d.style.pointerEvents=`none`,c.onload=()=>{d.style.visibility=``,d.style.pointerEvents=``},u}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[FR({find:bie,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),{getOwnPropertyNames:Sie,getOwnPropertySymbols:Cie}=Object,{hasOwnProperty:wie}=Object.prototype;function WR(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function GR(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function Tie(e){return e?.[Symbol.toStringTag]}function KR(e){return Sie(e).concat(Cie(e))}var Eie=Object.hasOwn||((e,t)=>wie.call(e,t));function qR(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var Die=`__v`,Oie=`__o`,kie=`_owner`,{getOwnPropertyDescriptor:JR,keys:YR}=Object;function Aie(e,t){return e.byteLength===t.byteLength&&$R(new Uint8Array(e),new Uint8Array(t))}function jie(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Mie(e,t){return e.byteLength===t.byteLength&&$R(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Nie(e,t){return qR(e.getTime(),t.getTime())}function Pie(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Fie(e,t){return e===t}function XR(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var Iie=qR;function Lie(e,t,n){let r=YR(e),i=r.length;if(YR(t).length!==i)return!1;for(;i-- >0;)if(!tz(e,t,n,r[i]))return!1;return!0}function ZR(e,t,n){let r=KR(e),i=r.length;if(KR(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!tz(e,t,n,a)||(o=JR(e,a),s=JR(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Rie(e,t){return qR(e.valueOf(),t.valueOf())}function zie(e,t){return e.source===t.source&&e.flags===t.flags}function QR(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function $R(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function ez(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function tz(e,t,n,r){return(r===kie||r===Oie||r===Die)&&(e.$$typeof||t.$$typeof)?!0:Eie(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var nz=`[object ArrayBuffer]`,rz=`[object Arguments]`,iz=`[object Boolean]`,az=`[object DataView]`,oz=`[object Date]`,sz=`[object Error]`,cz=`[object Map]`,lz=`[object Number]`,uz=`[object Object]`,dz=`[object RegExp]`,fz=`[object Set]`,pz=`[object String]`,mz={"[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},hz=`[object URL]`,gz=Object.prototype.toString;function _z({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=gz.call(h);if(b===oz)return r(h,g,_);if(b===dz)return u(h,g,_);if(b===cz)return o(h,g,_);if(b===fz)return d(h,g,_);if(b===uz)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===hz)return p(h,g,_);if(b===sz)return i(h,g,_);if(b===rz)return c(h,g,_);if(mz[b])return f(h,g,_);if(b===nz)return e(h,g,_);if(b===az)return n(h,g,_);if(b===iz||b===lz||b===pz)return l(h,g,_);if(m){let e=m[b];if(!e){let t=Tie(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function vz({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Aie,areArraysEqual:n?ZR:jie,areDataViewsEqual:Mie,areDatesEqual:Nie,areErrorsEqual:Pie,areFunctionsEqual:Fie,areMapsEqual:n?WR(XR,ZR):XR,areNumbersEqual:Iie,areObjectsEqual:n?ZR:Lie,arePrimitiveWrappersEqual:Rie,areRegExpsEqual:zie,areSetsEqual:n?WR(QR,ZR):QR,areTypedArraysEqual:n?WR($R,ZR):$R,areUrlsEqual:ez,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=GR(r.areArraysEqual),t=GR(r.areMapsEqual),n=GR(r.areObjectsEqual),i=GR(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function yz(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function bz({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var xz=Sz();Sz({strict:!0}),Sz({circular:!0}),Sz({circular:!0,strict:!0}),Sz({createInternalComparator:()=>qR}),Sz({strict:!0,createInternalComparator:()=>qR}),Sz({circular:!0,createInternalComparator:()=>qR}),Sz({circular:!0,createInternalComparator:()=>qR,strict:!0});function Sz(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=_z(vz(e));return bz({circular:t,comparator:a,createState:r,equals:n?n(a):yz(a),strict:i})}var Cz=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},wz=({contentComponent:e})=>{let t=(0,Vu.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,U.jsx)(U.Fragment,{children:Object.values(t)})};function Tz(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Oi.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var Ez=class extends H.Component{constructor(e){super(e),this.editorContentRef=H.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=Tz(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{ref:Cz(t,this.editorContentRef),...n}),e?.contentComponent&&(0,U.jsx)(wz,{contentComponent:e.contentComponent})]})}},Dz=(0,H.forwardRef)((e,t)=>{let n=H.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return H.createElement(Ez,{key:n,innerRef:t,...e})}),Oz=H.memo(Dz),kz=typeof window<`u`?H.useLayoutEffect:H.useEffect,Az=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function jz(e){let[t]=(0,H.useState)(()=>new Az(e.editor)),n=(0,_i.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??xz);return kz(()=>t.watch(e.editor),[e.editor,t]),(0,H.useDebugValue)(n),n}var Mz=!1,Nz=typeof window>`u`,Pz=Nz||!!(typeof window<`u`&&window.next),Fz=class e{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(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return Nz?(t&&Mz&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),t=!1):Pz&&e===void 0&&(t=!1,Mz&&console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")),t?this.createEditor():null}createEditor(){return new oie({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{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((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Iz(e={},t=[]){let n=(0,H.useRef)(e);n.current=e;let[r]=(0,H.useState)(()=>new Fz(n)),i=(0,Vu.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,H.useDebugValue)(i),(0,H.useEffect)(r.onRender(t)),jz({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var Lz=(0,H.createContext)({editor:null});Lz.Consumer;var Rz=(0,H.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),zz=()=>(0,H.useContext)(Rz),Bz=H.forwardRef((e,t)=>{let{onDragStart:n}=zz();return(0,U.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function Vz(e){return!!(typeof e==`function`&&e.prototype&&e.prototype.isReactComponent)}function Hz(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.forward_ref)`||e.$$typeof.description===`react.forward_ref`))}function Uz(e){return!!(typeof e==`object`&&e.$$typeof&&(e.$$typeof.toString()===`Symbol(react.memo)`||e.$$typeof.description===`react.memo`))}function Wz(e){if(Vz(e)||Hz(e))return!0;if(Uz(e)){let t=e.type;if(t)return Vz(t)||Hz(t)}return!1}function Gz(){try{if(H.version)return parseInt(H.version.split(`.`)[0],10)>=19}catch{}return!1}var Kz=class{constructor(e,{editor:t,props:n={},as:r=`div`,className:i=``}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add(`react-renderer`),i&&this.element.classList.add(...i.split(` `)),this.editor.isEditorContentInitialized?(0,Oi.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=Gz(),a=Wz(t),o={...n};o.ref&&!(i||a)&&delete o.ref,!o.ref&&(i||a)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,U.jsx)(t,{...o}),(e=r?.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0,(e=this.editor?.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};H.createContext({markViewContentRef:()=>{}});var qz=class extends _ie{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.handlePositionUpdate=()=>{let e=this.getPos();typeof e!=`number`||e===this.currentPos||(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs==`function`&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?`span`:`div`),this.contentDOMElement.dataset.nodeViewContentReact=``,this.contentDOMElement.dataset.nodeViewWrapper=``,this.contentDOMElement.style.whiteSpace=`inherit`;let e=this.dom.querySelector(`[data-node-view-content]`);if(!e)return;e.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on(`update`,this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){return r===`storage`?e.storage[t.name]??{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,H.createRef)()};if(!this.component.displayName){let e=e=>e.charAt(0).toUpperCase()+e.substring(1);this.component.displayName=e(this.extension.name)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute(`data-node-view-wrapper`)&&e.removeAttribute(`data-node-view-wrapper`),e.appendChild(this.contentDOMElement))}},n=this.component,r=(0,H.memo)(e=>(0,U.jsx)(Rz.Provider,{value:t,children:(0,H.createElement)(n,e)}));r.displayName=`ReactNodeView`;let i=this.node.isInline?`span`:`div`;this.options.as&&(i=this.options.as);let{className:a=``}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new Kz(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on(`selectionUpdate`,this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){if(this.renderer.element.firstElementChild&&!this.renderer.element.firstElementChild?.hasAttribute(`data-node-view-wrapper`))throw Error(`Please use the NodeViewWrapper component for your node view.`);return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&=(cancelAnimationFrame(this.selectionRafId),null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;let e=this.currentPos;if(typeof e==`number`)if(Cre({selection:this.editor.state.selection,pos:e,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,n){let r=e=>{this.renderer.updateProps(e),typeof this.options.attrs==`function`&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update==`function`){let i=this.node,a=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:a,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,!0;let i=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i;let a={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(a.getPos=()=>this.getPos()),r(a),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add(`ProseMirror-selectednode`)}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove(`ProseMirror-selectednode`)}destroy(){this.renderer.destroy(),this.editor.off(`selectionUpdate`,this.handleSelectionUpdate),this.options.trackNodeViewPosition&&this.editor.off(`update`,this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&=(cancelAnimationFrame(this.selectionRafId),null)}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs==`function`){let t=this.editor.extensionManager.attributes,n=GL(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function Jz(e,t){return n=>n.editor.contentComponent?new qz(e,n,t):{}}var Yz=(0,H.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});Yz.displayName=`TiptapContext`;var Xz=()=>(0,H.useContext)(Yz);function Zz({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,H.useMemo)(()=>({editor:r}),[r]),a=(0,H.useMemo)(()=>({editor:r}),[r]);return(0,U.jsx)(Lz.Provider,{value:a,children:(0,U.jsx)(Yz.Provider,{value:i,children:n})})}Zz.displayName=`Tiptap`;function Qz({...e}){let{editor:t}=Xz();return(0,U.jsx)(Oz,{editor:t,...e})}Qz.displayName=`Tiptap.Content`,Object.assign(Zz,{Content:Qz});var $z=[`var(--primary)`,`var(--destructive)`,`var(--s-done-dot)`,`var(--muted-foreground)`];function eB(e){if(e===``||e===`[]`)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(tB):[]}catch{return[]}}function tB(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&(t.type===`arrow`||t.type===`rect`||t.type===`text`||t.type===`blur`)&&typeof t.x==`number`&&typeof t.y==`number`&&typeof t.w==`number`&&typeof t.h==`number`&&typeof t.color==`string`&&(t.text===void 0||typeof t.text==`string`)}function nB(e){return JSON.stringify(e)}function rB(e){return{x1:e.x,y1:e.y,x2:e.x+e.w,y2:e.y+e.h}}function iB(e,t=`#000000`){if(typeof document>`u`)return t;if(!e.startsWith(`var(`))return e;let n=document.createElement(`span`);n.style.color=e,document.body.appendChild(n);let r=getComputedStyle(n).color;return n.remove(),r||t}function aB(e){return new Promise((t,n)=>{let r=new Image;r.crossOrigin=`anonymous`,r.onload=()=>{t(r)},r.onerror=()=>{n(Error(`Failed to load image`))},r.src=e})}function oB(e,t,n,r,i,a){let o=Math.min(18,Math.hypot(r-t,i-n)*.25),s=Math.atan2(i-n,r-t);e.strokeStyle=a,e.fillStyle=a,e.lineWidth=3,e.lineCap=`round`,e.beginPath(),e.moveTo(t,n),e.lineTo(r,i),e.stroke(),e.beginPath(),e.moveTo(r,i),e.lineTo(r-o*Math.cos(s-Math.PI/6),i-o*Math.sin(s-Math.PI/6)),e.lineTo(r-o*Math.cos(s+Math.PI/6),i-o*Math.sin(s+Math.PI/6)),e.closePath(),e.fill()}function sB(e,t,n,r,i){if(r<1||i<1)return;let a=e.getImageData(t,n,r,i),{data:o,width:s,height:c}=a;for(let e=0;e<c;e+=12)for(let t=0;t<s;t+=12){let n=0,r=0,i=0,a=0;for(let l=e;l<Math.min(e+12,c);l++)for(let e=t;e<Math.min(t+12,s);e++){let t=(l*s+e)*4;n+=o[t]??0,r+=o[t+1]??0,i+=o[t+2]??0,a++}n=Math.round(n/a),r=Math.round(r/a),i=Math.round(i/a);for(let a=e;a<Math.min(e+12,c);a++)for(let e=t;e<Math.min(t+12,s);e++){let t=(a*s+e)*4;o[t]=n,o[t+1]=r,o[t+2]=i,o[t+3]=255}}e.putImageData(a,t,n)}function cB(e,t){let n=iB(t.color);if(t.type===`arrow`){let{x1:r,y1:i,x2:a,y2:o}=rB(t);oB(e,r,i,a,o,n);return}if(t.type===`rect`){e.strokeStyle=n,e.lineWidth=3,e.strokeRect(t.x,t.y,t.w,t.h);return}if(t.type===`text`){let r=Math.max(14,t.h||18);e.font=`600 ${String(r)}px ui-sans-serif, system-ui, sans-serif`,e.fillStyle=n,e.fillText(t.text??``,t.x,t.y+r);return}sB(e,Math.round(t.x),Math.round(t.y),Math.round(t.w),Math.round(t.h))}async function lB(e,t,n,r){if(t.length===0||typeof document>`u`)return e;let i=document.createElement(`canvas`);i.width=n,i.height=r;let a=i.getContext(`2d`);if(a===null||typeof i.toDataURL!=`function`)return e;try{let o=await aB(e);a.drawImage(o,0,0,n,r);for(let e of t)cB(a,e);return i.toDataURL(`image/png`)}catch{return e}}var uB={"image/png":`png`,"image/jpeg":`jpg`,"image/gif":`gif`,"image/webp":`webp`,"image/svg+xml":`svg`};function dB(e){return async t=>{let n=/^data:([^;,]+);base64,(.*)$/s.exec(t);if(n===null)return t;let r=n[1]??`image/png`,i=n[2]??``;try{return(await $a(e,{filename:`image.${uB[r]??`bin`}`,mime:r,content_base64:i})).url}catch{return t}}}var fB=xR.create({name:`imageUpload`,addStorage(){return{uploader:null}}});function pB(){return`ann-${String(Date.now())}-${Math.random().toString(36).slice(2,8)}`}function mB(e,t,n,r){let i=t.getBoundingClientRect(),a=(e.clientX-i.left)/i.width*n,o=(e.clientY-i.top)/i.height*r;return{x:Math.max(0,Math.min(n,a)),y:Math.max(0,Math.min(r,o))}}function hB({node:e,updateAttributes:t,selected:n,editor:r}){let i=e.attrs.src,a=e.attrs.alt,o=e.attrs.originalSrc,s=e.attrs.annotations,[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(!1),[f,p]=(0,H.useState)(()=>eB(s)),[m,h]=(0,H.useState)(`arrow`),[g,_]=(0,H.useState)($z[0]),[v,y]=(0,H.useState)({w:0,h:0}),[b,x]=(0,H.useState)(null),[S,C]=(0,H.useState)(null),[w,T]=(0,H.useState)(!1),E=(0,H.useRef)(null),D=(0,H.useRef)(null);(0,H.useEffect)(()=>{u||p(eB(s))},[s,u]);let O=o??i,k=(0,H.useCallback)(async()=>{if(w)return;let e=f.filter(e=>e.type===`blur`);if(!(e.length>=1&&!window.confirm(`Blur redaction is permanent — redacted pixels are removed and can't be recovered. Save?`))){T(!0);try{let{w:n,h:i}=v,a=n>0&&i>0,o=f.filter(e=>e.type!==`blur`),s=a&&e.length>0?await lB(O,e,n,i):O,c=a&&o.length>0?await lB(s,o,n,i):s,l=r.storage.imageUpload?.uploader??(e=>Promise.resolve(e)),u=await l(s);t({src:c===s?u:await l(c),originalSrc:u,annotations:nB(o)})}finally{T(!1),d(!1),x(null),C(null),D.current=null}}},[O,r,v,w,f,t]);(0,H.useEffect)(()=>{if(!u)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),k())};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[u,k]);let A=()=>{if(S===null)return;let e=S.value.trim();e!==``&&p(t=>[...t,{id:pB(),type:`text`,x:S.x,y:S.y,w:0,h:18,text:e,color:g}]),C(null)},j=e=>{if(!u||v.w===0)return;e.preventDefault(),e.stopPropagation();let t=E.current;if(t===null)return;let n=mB(e,t,v.w,v.h);if(m===`text`){A(),C({x:n.x,y:n.y,value:``});return}D.current=n,x({id:pB(),type:m,x:n.x,y:n.y,w:0,h:0,color:g}),t.setPointerCapture(e.pointerId)},M=e=>{if(!u||D.current===null||m===`text`)return;e.preventDefault(),e.stopPropagation();let t=E.current;if(t===null)return;let n=mB(e,t,v.w,v.h),r=D.current;if(m===`arrow`){x({id:b?.id??pB(),type:`arrow`,x:r.x,y:r.y,w:n.x-r.x,h:n.y-r.y,color:g});return}let i=Math.min(r.x,n.x),a=Math.min(r.y,n.y);x({id:b?.id??pB(),type:m,x:i,y:a,w:Math.abs(n.x-r.x),h:Math.abs(n.y-r.y),color:g})},N=e=>{if(!u||D.current===null||m===`text`)return;e.preventDefault(),e.stopPropagation();let t=E.current;if(t!==null)try{t.releasePointerCapture(e.pointerId)}catch{}b!==null&&(Math.abs(b.w)>4||Math.abs(b.h)>4)&&p(e=>[...e,b]),x(null),D.current=null},P=(e,t)=>{if(e.type===`arrow`){let n=e.x+e.w,r=e.y+e.h,i=Math.atan2(r-e.y,n-e.x),a=Math.min(14,Math.hypot(e.w,e.h)*.25),o=n-a*Math.cos(i-Math.PI/6),s=r-a*Math.sin(i-Math.PI/6),c=n-a*Math.cos(i+Math.PI/6),l=r-a*Math.sin(i+Math.PI/6);return(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`line`,{x1:e.x,y1:e.y,x2:n,y2:r,stroke:e.color,strokeWidth:3,strokeLinecap:`round`}),(0,U.jsx)(`polygon`,{points:[n,r,o,s,c,l].map(e=>String(e)).join(` `),fill:e.color})]},t)}return e.type===`rect`?(0,U.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,fill:`none`,stroke:e.color,strokeWidth:3},t):e.type===`text`?(0,U.jsx)(`text`,{x:e.x,y:e.y+18,fill:e.color,fontSize:18,fontWeight:600,fontFamily:`ui-sans-serif, system-ui, sans-serif`,children:e.text},t):(0,U.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,fill:`var(--muted)`,stroke:`var(--border-strong)`,strokeWidth:2,strokeDasharray:`6 4`,opacity:.85},t)},F=b===null?f:[...f,b];return(0,U.jsx)(Bz,{as:`div`,className:`annotatable-image-wrapper`,"data-selected":n?`true`:void 0,contentEditable:!1,draggable:!u,onMouseEnter:()=>{l(!0)},onMouseLeave:()=>{u||l(!1)},children:(0,U.jsxs)(`div`,{className:`annotatable-image-frame`,children:[(0,U.jsx)(`img`,{src:i,alt:a,className:`annotatable-image-img`,draggable:!1,onLoad:e=>{let t=e.currentTarget;t.naturalWidth>0&&t.naturalHeight>0&&y({w:t.naturalWidth,h:t.naturalHeight})}}),u?null:(0,U.jsx)(`div`,{className:`annotatable-image-hover`,children:(0,U.jsxs)(X,{type:`button`,size:`sm`,className:`shadow-md`,"aria-label":`Annotate image`,onMouseDown:e=>{e.preventDefault()},onClick:()=>{d(!0),l(!1)},children:[(0,U.jsx)(yb,{className:`size-3.5`}),`Annotate`]})}),u&&v.w>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`svg`,{ref:E,className:`annotatable-image-overlay`,viewBox:`0 0 ${String(v.w)} ${String(v.h)}`,preserveAspectRatio:`xMidYMid meet`,onPointerDown:j,onPointerMove:M,onPointerUp:N,children:F.map(e=>P(e,e.id))}),S===null?null:(0,U.jsx)(`input`,{type:`text`,className:`annotatable-image-text-input`,autoFocus:!0,value:S.value,placeholder:`Label…`,style:{left:`${String(S.x/v.w*100)}%`,top:`${String(S.y/v.h*100)}%`,color:g},onChange:e=>{C(t=>t===null?t:{...t,value:e.target.value})},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),A()),e.key===`Escape`&&(e.preventDefault(),C(null))},onBlur:A,onMouseDown:e=>{e.stopPropagation()}}),(0,U.jsxs)(`div`,{className:`annotatable-image-toolbar`,role:`toolbar`,"aria-label":`Image annotation tools`,onMouseDown:e=>{e.preventDefault()},children:[(0,U.jsx)(X,{type:`button`,size:`icon-xs`,variant:m===`arrow`?`default`:`ghost`,"aria-pressed":m===`arrow`,"aria-label":`Arrow`,onClick:()=>{h(`arrow`)},children:(0,U.jsx)(Xy,{})}),(0,U.jsx)(X,{type:`button`,size:`icon-xs`,variant:m===`rect`?`default`:`ghost`,"aria-pressed":m===`rect`,"aria-label":`Box`,onClick:()=>{h(`rect`)},children:(0,U.jsx)(Eb,{})}),(0,U.jsx)(X,{type:`button`,size:`icon-xs`,variant:m===`text`?`default`:`ghost`,"aria-pressed":m===`text`,"aria-label":`Text label`,onClick:()=>{h(`text`)},children:(0,U.jsx)(Pb,{})}),(0,U.jsx)(X,{type:`button`,size:`icon-xs`,variant:m===`blur`?`default`:`ghost`,"aria-pressed":m===`blur`,"aria-label":`Blur redact`,onClick:()=>{h(`blur`)},children:(0,U.jsx)(ite,{})}),(0,U.jsx)(`span`,{className:`annotatable-image-toolbar-divider`,"aria-hidden":!0}),$z.map(e=>(0,U.jsx)(`button`,{type:`button`,className:`annotatable-image-color-swatch`,"aria-label":`Color ${e}`,"aria-pressed":g===e,style:{background:e},onClick:()=>{_(e)}},e)),(0,U.jsx)(`span`,{className:`annotatable-image-toolbar-divider`,"aria-hidden":!0}),(0,U.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":`Undo`,disabled:f.length===0,onClick:()=>{p(e=>e.slice(0,-1))},children:(0,U.jsx)(Fb,{})}),(0,U.jsxs)(X,{type:`button`,size:`sm`,disabled:w,onClick:()=>void k(),children:[(0,U.jsx)(Zy,{className:`size-3.5`}),`Done`]})]})]}):null]})})}var gB=xie.extend({addAttributes(){return{...this.parent?.(),annotations:{default:`[]`,parseHTML:e=>e.getAttribute(`data-annotations`)??`[]`,renderHTML:e=>{let t=e.annotations;return t===void 0||t===`[]`?{}:{"data-annotations":t}}},originalSrc:{default:null,parseHTML:e=>e.getAttribute(`data-original`),renderHTML:e=>{let t=e.originalSrc;return t==null||t===``?{}:{"data-original":t}}}}},addNodeView(){return Jz(hB)}}).configure({allowBase64:!0}),_B,vB;if(typeof WeakMap<`u`){let e=new WeakMap;_B=t=>e.get(t),vB=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;_B=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},vB=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var yB=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return _B(e)||vB(e,bB(e))}};function bB(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=xB(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new yB(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&SB(s,o,e),s}function xB(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function SB(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=CB(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function CB(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function wB(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var TB=new Wj(`selectingCells`);function EB(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function DB(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function OB(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function kB(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=EB(t.$head)||AB(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function AB(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function jB(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function MB(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function NB(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function PB(e,t,n){let r=e.node(-1),i=yB.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function FB(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function IB(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function LB(e,t,n){let r=wB(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var RB=class e extends yj{constructor(e,t=e){let n=e.node(-1),r=yB.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new bj(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(jB(r)&&jB(i)&&NB(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return Cj.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=yB.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=FB(e,0,l)),u>0&&(e=FB(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(Z.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new Q(Z.from(o),1,1)}replace(e,t=Q.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?Q.empty:t)}let i=yj.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new Q(Z.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=yB.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=yB.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=yB.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=yB.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new zB(this.$anchorCell.pos,this.$headCell.pos)}};RB.prototype.visible=!1,yj.jsonID(`cell`,RB);var zB=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&NB(t,n)?new RB(t,n):yj.near(n,1)}};function BB(e){if(!(e.selection instanceof RB))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(fI.node(n,n+e.nodeSize,{class:`selectedCell`}))}),hI.create(e.doc,t)}function VB({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function HB({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function UB(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof Tj&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=RB.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=RB.rowSelection(e,e)}else if(!n){let e=yB.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=RB.create(i,t+1,n)}}else r instanceof Cj&&VB(r)?a=Cj.create(i,r.from):r instanceof Cj&&HB(r)&&(a=Cj.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var WB=new Wj(`fix-tables`);function GB(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?GB(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function KB(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=qB(e,t,r,n))};return t?t.doc!=e.doc&&GB(t.doc,e.doc,0,r):e.doc.descendants(r),n}function qB(e,t,n,r){let i=yB.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,FB(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=wB(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(WB,{fixTables:!0})}function JB(e){let t=e.selection,n=kB(e),r=n.node(-1),i=n.start(-1),a=yB.get(r);return{...t instanceof RB?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function YB(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;LB(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,IB(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?wB(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function XB(e,t){if(!OB(e))return!1;if(t){let n=JB(e);t(YB(e.tr,n,n.left))}return!0}function ZB(e,t){if(!OB(e))return!1;if(t){let n=JB(e);t(YB(e.tr,n,n.right))}return!0}function QB(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,FB(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function $B(e,t){if(!OB(e))return!1;if(t){let n=JB(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;QB(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=yB.get(e)}t(r)}return!0}function eV(e,t,n){let r=wB(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function tV(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;eV(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?wB(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,wB(r.type.schema).row.create(null,o)),e}function nV(e,t){if(!OB(e))return!1;if(t){let n=JB(e);t(tV(e.tr,n,n.top))}return!0}function rV(e,t){if(!OB(e))return!1;if(t){let n=JB(e);t(tV(e.tr,n,n.bottom))}return!0}function iV(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function aV(e,t){if(!OB(e))return!1;if(t){let n=JB(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;iV(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=yB.get(n.table)}t(r)}return!0}function oV(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function sV({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function cV(e,t){let n=e.selection;if(!(n instanceof RB)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=JB(e),{map:i}=r;if(sV(i,r))return!1;if(t){let n=e.tr,a={},o=Z.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!(a[l]||!u))if(a[l]=!0,s==null)s=l,c=u;else{oV(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...IB(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=oV(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new RB(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function lV(e,t){let n=wB(e.schema);return uV(({node:e})=>n[e.type.spec.tableRole])(e,t)}function uV(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof RB){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=DB(r.$from),!i)return!1;a=EB(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=JB(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)r==l.left&&t==l.top||u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof RB&&u.setSelection(new RB(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function dV(e,t){return function(n,r){if(!OB(n))return!1;let i=kB(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof RB?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function fV(e){return function(t,n){if(!OB(t))return!1;if(n){let r=wB(t.schema),i=JB(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function pV(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function mV(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?fV(e):function(t,n){if(!OB(t))return!1;if(n){let r=wB(t.schema),i=JB(t),a=t.tr,o=pV(`row`,i,r),s=pV(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}mV(`row`,{useDeprecatedLogic:!0}),mV(`column`,{useDeprecatedLogic:!0});var hV=mV(`cell`,{useDeprecatedLogic:!0});function gV(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function _V(e){return function(t,n){if(!OB(t))return!1;let r=gV(kB(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(Cj.between(e,MB(e))).scrollIntoView())}return!0}}function vV(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function yV(e,t){let n=e.selection;if(!(n instanceof RB))return!1;if(t){let r=e.tr,i=wB(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new Q(i,0,0))}),r.docChanged&&t(r)}return!0}function bV(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=SV(wB(o).row,new Q(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?SV(wB(o).row,new Q(t,n,r)).content:t);else return null;return xV(o,s)}function xV(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(Z.empty),n[i]<r){let a=wB(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(Z.from(o))}return{height:t.length,width:r,rows:t}}function SV(e,t){let n=e.createAndFill();return new _j(n).replace(0,n.content.size,t).doc}function CV({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(FB(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(Z.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(Z.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function wV(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=wB(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,Z.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function TV(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function EV(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,FB(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(FB(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function DV(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=yB.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=yB.get(a),f=d.mapping.maps.length}wV(d,o,a,n,l,u,f)&&p(),TV(d,o,a,n,c,l,s,f)&&p(),TV(d,o,a,n,c,l,u,f)&&p(),EV(d,o,a,n,s,u,c,f)&&p(),EV(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new Q(i.rows[e-s],0,0))}p(),d.setSelection(new RB(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var OV=oL({ArrowLeft:AV(`horiz`,-1),ArrowRight:AV(`horiz`,1),ArrowUp:AV(`vert`,-1),ArrowDown:AV(`vert`,1),"Shift-ArrowLeft":jV(`horiz`,-1),"Shift-ArrowRight":jV(`horiz`,1),"Shift-ArrowUp":jV(`vert`,-1),"Shift-ArrowDown":jV(`vert`,1),Backspace:yV,"Mod-Backspace":yV,Delete:yV,"Mod-Delete":yV});function kV(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function AV(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof RB)return kV(n,r,yj.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=FV(i,e,t);if(o==null)return!1;if(e==`horiz`)return kV(n,r,yj.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=PB(i,e,t),s;return s=a?yj.near(a,1):t<0?yj.near(n.doc.resolve(i.before(-1)),-1):yj.near(n.doc.resolve(i.after(-1)),1),kV(n,r,s)}}}function jV(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof RB)o=a;else{let r=FV(i,e,t);if(r==null)return!1;o=new RB(n.doc.resolve(r))}let s=PB(o.$headCell,e,t);return s?kV(n,r,new RB(o.$anchorCell,s)):!1}}function MV(e,t){let n=e.state.doc,r=EB(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new RB(r))),!0):!1}function NV(e,t,n){if(!OB(e.state))return!1;let r=bV(n),i=e.state.selection;if(i instanceof RB){r||={width:1,height:1,rows:[Z.from(SV(wB(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=yB.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=CV(r,o.right-o.left,o.bottom-o.top),DV(e.state,e.dispatch,a,o,r),!0}else if(r){let t=kB(e.state),n=t.start(-1);return DV(e.state,e.dispatch,n,yB.get(t.node(-1)).findCell(t.pos-n),r),!0}else return!1}function PV(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=IV(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof RB)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=EB(e.state.selection.$anchor))!=null&&LV(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=LV(e,n),i=TB.getState(e.state)==null;if(!r||!NB(t,r))if(i)r=t;else return;let a=new RB(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(TB,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),TB.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(TB,-1))}function o(r){let o=r,s=TB.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(IV(e,o.target)!=n&&(c=LV(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function FV(e,t,n){if(!(e.state.selection instanceof Cj))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function IV(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function LV(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&EB(e.state.doc.resolve(r))||EB(e.state.doc.resolve(i))}var RV=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),zV(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,zV(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function zV(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var BV=new Wj(`tableColumnResizing`);function VV({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=RV,lastColumnResizable:i=!0}={}){let a=new Vj({key:BV,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=wB(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new HV(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=BV.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{UV(t,n,e,i)},mouseleave:e=>{WV(e)},mousedown:(e,r)=>{GV(e,r,t,n)}},decorations:e=>{let t=BV.getState(e);if(t&&t.activeHandle>-1)return eH(e,t.activeHandle)},nodeViews:{}}});return a}var HV=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta(BV);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return jB(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function UV(e,t,n,r){if(!e.editable)return;let i=BV.getState(e.state);if(i&&!i.dragging){let a=qV(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=JV(e,t,`left`,n):i-t.clientX<=n&&(o=JV(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=yB.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}XV(e,o)}}}function WV(e){if(!e.editable)return;let t=BV.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&XV(e,-1)}function GV(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=BV.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=KV(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta(BV,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=BV.getState(e.state);r?.dragging&&(ZV(e,r.activeHandle,YV(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(BV,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=BV.getState(e.state);if(i&&i.dragging){let a=YV(i.dragging,t,n);QV(e,i.activeHandle,a,r)}}return QV(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function KV(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function qV(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function JV(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=EB(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=yB.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function YV(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function XV(e,t){e.dispatch(e.state.tr.setMeta(BV,{setHandle:t}))}function ZV(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=yB.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():$V(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function QV(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=yB.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&zV(a,c.firstChild,c,r,s,n)}function $V(e){return Array(e).fill(0)}function eH(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return hI.empty;let a=yB.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,BV.getState(e)?.dragging&&n.push(fI.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(fI.widget(s,c))}}return hI.create(e.doc,n)}function tH({allowTableNodeSelection:e=!1}={}){return new Vj({key:TB,state:{init(){return null},apply(e,t){let n=e.getMeta(TB);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:BB,handleDOMEvents:{mousedown:PV},createSelectionBetween(e){return TB.getState(e.state)==null?null:e.state.selection},handleTripleClick:MV,handleKeyDown:OV,handlePaste:NV},appendTransaction(t,n,r){return UB(r,KB(r,n),e)}})}function nH(e){return e===`left`||e===`right`||e===`center`?e:null}function rH(e){let t=(e.style.textAlign||``).trim().toLowerCase(),n=(e.getAttribute(`align`)||``).trim().toLowerCase();return nH(t||n)}function iH(e){return nH(e?.align)}function aH(){return{default:null,parseHTML:e=>rH(e),renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}var oH=HR.create({name:`tableCell`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`),n=t?t.split(`,`).map(e=>parseInt(e,10)):null;if(!n){let t=e.closest(`table`)?.querySelectorAll(`colgroup > col`),n=Array.from(e.parentElement?.children||[]).indexOf(e);if(n&&n>-1&&t&&t[n]){let e=t[n].getAttribute(`width`);return e?[parseInt(e,10)]:null}}return n}},align:aH()}},tableRole:`cell`,isolating:!0,parseHTML(){return[{tag:`td`}]},renderHTML({HTMLAttributes:e}){return[`td`,WL(this.options.HTMLAttributes,e),0]}}),sH=HR.create({name:`tableHeader`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute(`colwidth`);return t?t.split(`,`).map(e=>parseInt(e,10)):null}},align:aH()}},tableRole:`header_cell`,isolating:!0,parseHTML(){return[{tag:`th`}]},renderHTML({HTMLAttributes:e}){return[`th`,WL(this.options.HTMLAttributes,e),0]}}),cH=HR.create({name:`tableRow`,addOptions(){return{HTMLAttributes:{}}},content:`(tableCell | tableHeader)*`,tableRole:`row`,parseHTML(){return[{tag:`tr`}]},renderHTML({HTMLAttributes:e}){return[`tr`,WL(this.options.HTMLAttributes,e),0]}});function lH(e,t){return t?[`width`,`${Math.max(t,e)}px`]:[`min-width`,`${e}px`]}function uH(e,t,n,r,i,a){var o;let s=0,c=!0,l=t.firstChild,u=e.firstChild;if(u!==null)for(let e=0,n=0;e<u.childCount;e+=1){let{colspan:o,colwidth:d}=u.child(e).attrs;for(let e=0;e<o;e+=1,n+=1){let o=i===n?a:d&&d[e],u=o?`${o}px`:``;if(s+=o||r,o||(c=!1),l){if(l.style.width!==u){let[e,t]=lH(r,o);l.style.setProperty(e,t)}l=l.nextSibling}else{let e=document.createElement(`col`),[n,i]=lH(r,o);e.style.setProperty(n,i),t.appendChild(e)}}}for(;l;){let e=l.nextSibling;(o=l.parentNode)==null||o.removeChild(l),l=e}let d=e.attrs.style&&typeof e.attrs.style==`string`&&/\bwidth\s*:/i.test(e.attrs.style);c&&!d?(n.style.width=`${s}px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=`${s}px`)}var dH=class{constructor(e,t,n,r={}){this.node=e,this.cellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`));for(let[e,t]of Object.entries(r))t!=null&&(e===`style`?this.table.style.cssText=String(t):this.table.setAttribute(e,String(t)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),uH(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type===this.node.type?(this.node=e,uH(e,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!(n&&!r&&(e.type===`attributes`||e.type===`childList`||e.type===`characterData`))}};function fH(e,t,n,r){let i=0,a=!0,o=[],s=e.firstChild;if(!s)return{};for(let e=0,c=0;e<s.childCount;e+=1){let{colspan:l,colwidth:u}=s.child(e).attrs;for(let e=0;e<l;e+=1,c+=1){let s=n===c?r:u&&u[e];i+=s||t,s||(a=!1);let[l,d]=lH(t,s);o.push([`col`,{style:`${l}: ${d}`}])}}let c=a?`${i}px`:``,l=a?``:`${i}px`;return{colgroup:[`colgroup`,{},...o],tableWidth:c,tableMinWidth:l}}function pH(e,t){return t?e.createChecked(null,t):e.createAndFill()}function mH(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function hH(e,t,n,r,i){let a=mH(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=pH(a.cell,i);if(e&&s.push(e),r){let e=pH(a.header_cell,i);e&&o.push(e)}}let c=[];for(let e=0;e<t;e+=1)c.push(a.row.createChecked(null,r&&e===0?o:s));return a.table.createChecked(null,c)}function gH(e){return e instanceof RB}var _H=({editor:e})=>{let{selection:t}=e.state;if(!gH(t))return!1;let n=0;return PL(t.ranges[0].$from,e=>e.type.name===`table`)?.node.descendants(e=>{if(e.type.name===`table`)return!1;[`tableCell`,`tableHeader`].includes(e.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1};function vH(e){return(e||``).replace(/\s+/g,` `).trim()}function yH(e,t,n={}){let r=n.cellLineSeparator??``;if(!e||!e.content||e.content.length===0)return``;let i=[];e.content.forEach(e=>{let n=[];e.content&&e.content.forEach(e=>{let i=``;i=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(r):e.content?t.renderChildren(e.content):``;let a=vH(i),o=e.type===`tableHeader`,s=iH(e.attrs);n.push({text:a,isHeader:o,align:s})}),i.push(n)});let a=i.reduce((e,t)=>Math.max(e,t.length),0);if(a===0)return``;let o=Array.from({length:a}).fill(0);i.forEach(e=>{for(let t=0;t<a;t+=1){let n=(e[t]?.text||``).length;n>o[t]&&(o[t]=n),o[t]<3&&(o[t]=3)}});let s=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),c=i[0],l=c.some(e=>e.isHeader),u=Array.from({length:a}).fill(null);i.forEach(e=>{for(let t=0;t<a;t+=1)!u[t]&&e[t]?.align&&(u[t]=e[t].align)});let d=`
|
|
220
|
+
`,f=Array.from({length:a}).map((e,t)=>l&&c[t]&&c[t].text||``);return d+=`| ${f.map((e,t)=>s(e,o[t])).join(` | `)} |
|
|
221
|
+
`,d+=`| ${o.map((e,t)=>{let n=Math.max(3,e),r=u[t];return r===`left`?`:${`-`.repeat(n)}`:r===`right`?`${`-`.repeat(n)}:`:r===`center`?`:${`-`.repeat(n)}:`:`-`.repeat(n)}).join(` | `)} |
|
|
222
|
+
`,(l?i.slice(1):i).forEach(e=>{d+=`| ${Array.from({length:a}).fill(0).map((t,n)=>s(e[n]&&e[n].text||``,o[n])).join(` | `)} |
|
|
223
|
+
`}),d}var bH=yH,xH=HR.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:dH,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=fH(e,this.options.cellMinWidth),a=t.style;function o(){return a||(r?`width: ${r}`:`min-width: ${i}`)}let s=[`table`,WL(this.options.HTMLAttributes,t,{style:o()}),n,[`tbody`,0]];return this.options.renderWrapper?[`div`,{class:`tableWrapper`},s]:s},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{let a=nH(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableHeader`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{let a=nH(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableCell`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}),t.createNode(`table`,void 0,n)},renderMarkdown:(e,t)=>bH(e,t),addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=hH(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Cj.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>XB(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>ZB(e,t),deleteColumn:()=>({state:e,dispatch:t})=>$B(e,t),addRowBefore:()=>({state:e,dispatch:t})=>nV(e,t),addRowAfter:()=>({state:e,dispatch:t})=>rV(e,t),deleteRow:()=>({state:e,dispatch:t})=>aV(e,t),deleteTable:()=>({state:e,dispatch:t})=>vV(e,t),mergeCells:()=>({state:e,dispatch:t})=>cV(e,t),splitCell:()=>({state:e,dispatch:t})=>lV(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>mV(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>mV(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>hV(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>cV(e,t)?!0:lV(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>dV(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>_V(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>_V(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&KB(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=RB.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:_H,"Mod-Backspace":_H,Delete:_H,"Mod-Delete":_H}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[VV({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],tH({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n,HTMLAttributes:r})=>{let i=WL(this.options.HTMLAttributes,r);return new t(e,this.options.cellMinWidth,n,i)}},extendNodeSchema(e){return{tableRole:BL(IL(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}}),SH=xR.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(xH.configure(this.options.table)),this.options.tableCell!==!1&&e.push(oH.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(sH.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(cH.configure(this.options.tableRow)),e}}),CH=Object.defineProperty,wH=(e,t)=>{for(var n in t)CH(e,n,{get:t[n],enumerable:!0})},TH=`listItem`,EH=`textStyle`,DH=/^\s*([-+*])\s$/,OH=HR.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:e}){return[`ul`,WL(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
224
|
+
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(TH,this.editor.getAttributes(EH)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=LR({find:DH,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=LR({find:DH,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(EH),editor:this.editor})),[e]}}),kH=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},AH=(e,t,n,r)=>{let i=kH(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,Z.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},jH=(e,t,n)=>AH(e.state,e.view.dispatch,t,n),MH=(e,t)=>xR.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>jH(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}});function NH(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function PH(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var FH=HR.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,WL(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(NH(e))return{type:`listItem`,content:[{type:`paragraph`,content:PH(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>VR(e,t,e=>e.parentType===`bulletList`?`- `:e.parentType===`orderedList`?`${(e.meta?.parentAttrs?.start||1)+e.index}. `:`- `,n),addExtensions(){return[MH(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});wH({},{findListItemPos:()=>IH,getNextListDepth:()=>LH,handleBackspace:()=>zH,handleDelete:()=>HH,hasListBefore:()=>RH,hasListItemAfter:()=>UH,hasListItemBefore:()=>WH,listItemHasSubList:()=>GH,nextListIsDeeper:()=>BH,nextListIsHigher:()=>VH});var IH=(e,t)=>{let{$from:n}=t.selection,r=dL(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},LH=(e,t)=>{let n=IH(e,t);if(!n)return!1;let[,r]=vre(t,e,n.$pos.pos+4);return r},RH=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},zH=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!OL(e.state,t)&&RH(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}return!OL(e.state,t)||!Sre(e.state)?!1:e.chain().liftListItem(t).run()},BH=(e,t)=>{let n=LH(e,t),r=IH(e,t);return!r||!n?!1:n>r.depth},VH=(e,t)=>{let n=LH(e,t),r=IH(e,t);return!r||!n?!1:n<r.depth},HH=(e,t)=>{if(!OL(e.state,t)||!xre(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:BH(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():VH(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},UH=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-n.parentOffset-2);return!(r.index()===r.parent.childCount-1||r.nodeAfter?.type.name!==e)},WH=(e,t)=>{let{$anchor:n}=t.selection,r=t.doc.resolve(n.pos-2);return!(r.index()===0||r.nodeBefore?.type.name!==e)},GH=(e,t,n)=>{if(!n)return!1;let r=dL(e,t.schema),i=!1;return n.descendants(e=>{e.type===r&&(i=!0)}),i},KH=xR.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&HH(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&HH(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&zH(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&zH(e,n,r)&&(t=!0)}),t}}}}),qH=/^(\s*)(\d+)\.\s+(.*)$/,JH=/^\s/;function YH(e){let t=e.trimStart();return/^[-+*]\s+/.test(t)||/^\d+\.\s+/.test(t)||/^>\s?/.test(t)||/^```/.test(t)||/^~~~/.test(t)}function XH(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&YH(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function ZH(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(qH);if(!a)break;let[,o,s,c]=a,l=o.length,u=[c],d=n+1,f=[i],p=!1;for(;d<e.length;){let t=e[d];if(t.match(qH))break;if(t.trim()===``)f.push(t),u.push(``),p=!0,d+=1;else if(t.match(JH))f.push(t),u.push(t.slice(l+2)),d+=1;else{if(p)break;f.push(t),u.push(t),d+=1}}t.push({indent:l,number:parseInt(s,10),content:u.join(`
|
|
225
|
+
`).trim(),contentLines:u,raw:f.join(`
|
|
226
|
+
`)}),r=d,n=d}return[t,r]}function QH(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=XH(a.contentLines),c=o.join(`
|
|
227
|
+
`).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
|
|
228
|
+
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=QH(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,items:e,raw:f.map(e=>e.raw).join(`
|
|
229
|
+
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function $H(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var eU=`listItem`,tU=`textStyle`,nU=/^(\d+)\.\s$/,rU=HR.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:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>e.getAttribute(`type`)}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,...n}=e;return t===1?[`ol`,WL(this.options.HTMLAttributes,n),0]:[`ol`,WL(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.items?$H(e.items,t):[];return n===1?{type:`orderedList`,content:r}:{type:`orderedList`,attrs:{start:n},content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
230
|
+
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:e=>{let t=e.match(/^(\s*)(\d+)\.\s+/)?.index;return t===void 0?-1:t},tokenize:(e,t,n)=>{let r=e.split(`
|
|
231
|
+
`),[i,a]=ZH(r);if(i.length===0)return;let o=QH(i,0,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,items:o,raw:r.slice(0,a).join(`
|
|
232
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(eU,this.editor.getAttributes(tU)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=LR({find:nU,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=LR({find:nU,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(tU)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),iU=/^\s*(\[([( |x])?\])\s$/,aU=HR.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:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,WL(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>VR(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[MH(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`),l=e=>{var t;s.ariaLabel=((t=this.options.a11y)?.checkboxLabel)?.call(t,e,s.checked)||`Task item checkbox for ${e.textContent||`empty task item`}`};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=GL(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[LR({find:iU,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),oU=HR.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:e}){return[`ul`,WL(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
233
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=BR(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:`taskList`,raw:t.raw,items:t.items}]:n.blockTokens(e)},i=BR(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});xR.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(OH.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(FH.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(KH.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(rU.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(aU.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(oU.configure(this.options.taskList)),e}});var sU=aU,cU=oU,lU=(e,t)=>{if(e===`slot`)return 0;if(e instanceof Function)return e(t);let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);return[e,r,n]};function uU(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){for(let e=0;i.text[e]==a.text[e];e++)n++;return n}if(i.content.size||a.content.size){let e=uU(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function dU(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=0,t=Math.min(o.text.length,s.text.length);for(;e<t&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(o.content.size||s.content.size){let e=dU(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}var fU=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))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 t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return uU(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return dU(this,e,t,n)}findIndex(e){if(e==0)return mU(0,e);if(e==this.size)return mU(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?mU(t+1,i):mU(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};fU.empty=new fU([],0);var pU={index:0,offset:0};function mU(e,t){return pU.index=e,pU.offset=t,pU}function hU(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!hU(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!hU(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var gU=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&hU(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};gU.none=[];var _U=class extends Error{},vU=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=bU(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(yU(this.content,t+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(fU.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};vU.empty=new vU(fU.empty,0,0);function yU(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(yU(a.content,t-i-1,n-i-1)))}function bU(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=bU(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function xU(e,t,n){if(n.openStart>e.depth)throw new _U(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new _U(`Inconsistent open depths`);return SU(e,t,n,0)}function SU(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=SU(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return DU(a,kU(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return DU(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=AU(n,e);return DU(a,OU(e,i,o,t,r))}}function CU(e,t){if(!t.type.compatibleContent(e.type))throw new _U(`Cannot join `+t.type.name+` onto `+e.type.name)}function wU(e,t,n){let r=e.node(n);return CU(r,t.node(n)),r}function TU(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function EU(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(TU(e.nodeAfter,r),a++));for(let e=a;e<o;e++)TU(i.child(e),r);t&&t.depth==n&&t.textOffset&&TU(t.nodeBefore,r)}function DU(e,t){return e.type.checkContent(t),e.copy(t)}function OU(e,t,n,r,i){let a=e.depth>i&&wU(e,t,i+1),o=r.depth>i&&wU(n,r,i+1),s=[];return EU(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(CU(a,o),TU(DU(a,OU(e,t,n,r,i+1)),s)):(a&&TU(DU(a,kU(e,t,i+1)),s),EU(t,n,i,s),o&&TU(DU(o,kU(n,r,i+1)),s)),EU(r,null,i,s),new fU(s)}function kU(e,t,n){let r=[];return EU(null,e,n,r),e.depth>n&&TU(DU(wU(e,t,n+1),kU(e,t,n+1)),r),EU(t,null,n,r),new fU(r)}function AU(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(fU.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var jU=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.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 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 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,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return gU.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new FU(this,e,n);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 t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=PU.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else PU.set(t,r=new MU);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%NU,i}},MU=class{constructor(){this.elts=[],this.i=0}},NU=12,PU=new WeakMap,FU=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}},IU=Object.create(null),LU=class e{constructor(e,t,n,r=gU.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||fU.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,t,n,r=0){this.content.nodesBetween(e,t,n,r,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,t,n,r){return this.content.textBetween(e,t,n,r)}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,t,n){return this.type==e&&hU(this.attrs,t||e.defaultAttrs||IU)&&gU.sameSet(this.marks,n||gU.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return vU.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new vU(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return xU(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return jU.resolveCached(this,e)}resolveNoCache(e){return jU.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),RU(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=fU.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.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=gU.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!gU.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t 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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=fU.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};LU.prototype.text=void 0;function RU(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var zU=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new BU(t,n);if(r.next==null)return e.empty;let i=VU(r);r.next&&r.err(`Unexpected trailing text`);let a=ZU(JU(i));return QU(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return fU.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
|
|
234
|
+
`)}};zU.empty=new zU(!0);var BU=class{constructor(e,t){this.string=e,this.nodeTypes=t,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 SyntaxError(e+` (in content expression '`+this.string+`')`)}};function VU(e){let t=[];do t.push(HU(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function HU(e){let t=[];do t.push(UU(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function UU(e){let t=qU(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=GU(e,t);else break;return t}function WU(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function GU(e,t){let n=WU(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:WU(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function KU(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function qU(e){if(e.eat(`(`)){let t=VU(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=KU(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function JU(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function YU(e,t){return t-e}function XU(e,t){let n=[];return r(t),n.sort(YU);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function ZU(e){let t=Object.create(null);return n(XU(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);XU(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new zU(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(YU);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function QU(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}var $U=65535,eW=2**16;function tW(e,t){return e+t*eW}function nW(e){return e&$U}function rW(e){return(e-(e&$U))/eW}var iW=1,aW=2,oW=4,sW=8,cW=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&sW)>0}get deletedBefore(){return(this.delInfo&(iW|oW))>0}get deletedAfter(){return(this.delInfo&(aW|oW))>0}get deletedAcross(){return(this.delInfo&oW)>0}},lW=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=nW(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+rW(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:tW(o/3,e-s),f=e==s?aW:e==u?iW:oW;return(t<0?e!=s:e!=u)&&(f|=sW),new cW(a,f,d)}r+=l-c}return n?e+r:new cW(e+r,0,null)}touches(e,t){let n=0,r=nW(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};lW.empty=new lW([]);var uW=Object.create(null),dW=class{getMap(){return lW.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=uW[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in uW)throw RangeError(`Duplicate use of step JSON ID `+e);return uW[e]=t,t.prototype.jsonID=e,t}},fW=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof _U)return e.fail(t.message);throw t}}};function pW(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(pW(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return fU.fromArray(r)}var mW=class e extends dW{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new vU(pW(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return fW.fromReplace(e,this.from,this.to,i)}invert(){return new hW(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};dW.jsonID(`addMark`,mW);var hW=class e extends dW{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new vU(pW(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return fW.fromReplace(e,this.from,this.to,n)}invert(){return new mW(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};dW.jsonID(`removeMark`,hW);var gW=class e extends dW{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return fW.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return fW.fromReplace(e,this.pos,this.pos+1,new vU(fU.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new _W(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};dW.jsonID(`addNodeMark`,gW);var _W=class e extends dW{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return fW.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return fW.fromReplace(e,this.pos,this.pos+1,new vU(fU.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new gW(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};dW.jsonID(`removeNodeMark`,_W);var vW=class e extends dW{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&bW(e,this.from,this.to)?fW.fail(`Structure replace would overwrite content`):fW.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new lW([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?vU.empty:new vU(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?vU.empty:new vU(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,vU.fromJSON(t,n.slice),!!n.structure)}};vW.MAP_BIAS=1,dW.jsonID(`replace`,vW);var yW=class e extends dW{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(bW(e,this.from,this.gapFrom)||bW(e,this.gapTo,this.to)))return fW.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return fW.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?fW.fromReplace(e,this.from,this.to,n):fW.fail(`Content does not fit in gap`)}getMap(){return new lW([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,vU.fromJSON(t,n.slice),n.insert,!!n.structure)}};dW.jsonID(`replaceAround`,yW);function bW(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}var xW=class e extends dW{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return fW.fail(`No node at attribute step's position`);let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return fW.fromReplace(e,this.pos,this.pos+1,new vU(fU.from(r),0,+!t.isLeaf))}getMap(){return lW.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:`attr`,pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!=`number`||typeof n.attr!=`string`)throw RangeError(`Invalid input for AttrStep.fromJSON`);return new e(n.pos,n.attr,n.value)}};dW.jsonID(`attr`,xW);var SW=class e extends dW{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return fW.ok(n)}getMap(){return lW.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:`docAttr`,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!=`string`)throw RangeError(`Invalid input for DocAttrStep.fromJSON`);return new e(n.attr,n.value)}};dW.jsonID(`docAttr`,SW);var CW=class extends Error{};CW=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},CW.prototype=Object.create(Error.prototype),CW.prototype.constructor=CW,CW.prototype.name=`TransformError`;var wW=Object.create(null),TW=class{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new EW(e.min(t),e.max(t))]}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 t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=vU.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,a=this.ranges;for(let o=0;o<a.length;o++){let{$from:s,$to:c}=a[o],l=e.mapping.slice(i);e.replaceRange(l.map(s.pos),l.map(c.pos),o?vU.empty:t),o==0&&IW(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n),c=s.map(a.pos),l=s.map(o.pos);i?e.deleteRange(c,l):(e.replaceRangeWith(c,l,t),IW(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new kW(e):FW(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?FW(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):FW(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new NW(e.node(0))}static atStart(e){return FW(e,e,0,0,1)||new NW(e)}static atEnd(e){return FW(e,e,e.content.size,e.childCount,-1)||new NW(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError(`Invalid input for Selection.fromJSON`);let n=wW[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in wW)throw RangeError(`Duplicate use of selection JSON ID `+e);return wW[e]=t,t.prototype.jsonID=e,t}getBookmark(){return kW.between(this.$anchor,this.$head).getBookmark()}};TW.prototype.visible=!0;var EW=class{constructor(e,t){this.$from=e,this.$to=t}},DW=!1;function OW(e){!DW&&!e.parent.inlineContent&&(DW=!0,console.warn(`TextSelection endpoint not pointing into a node with inline content (`+e.parent.type.name+`)`))}var kW=class e extends TW{constructor(e,t=e){OW(e),OW(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return TW.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(e,t=vU.empty){if(super.replace(e,t),t==vU.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new AW(this.anchor,this.head)}toJSON(){return{type:`text`,anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!=`number`||typeof n.head!=`number`)throw RangeError(`Invalid input for TextSelection.fromJSON`);return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let e=TW.findFrom(n,r,!0)||TW.findFrom(n,-r,!0);if(e)n=e.$head;else return TW.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(TW.findFrom(t,-r,!0)||TW.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=i<0&&(t=n))),new e(t,n)}};TW.jsonID(`text`,kW);var AW=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){return kW.between(e.resolve(this.anchor),e.resolve(this.head))}},jW=class e extends TW{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),a=t.resolve(i);return r?TW.near(a):new e(a)}content(){return new vU(fU.from(this.node),0,0)}eq(t){return t instanceof e&&t.anchor==this.anchor}toJSON(){return{type:`node`,anchor:this.anchor}}getBookmark(){return new MW(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!=`number`)throw RangeError(`Invalid input for NodeSelection.fromJSON`);return new e(t.resolve(n.anchor))}static create(t,n){return new e(t.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};jW.prototype.visible=!1,TW.jsonID(`node`,jW);var MW=class e{constructor(e){this.anchor=e}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new AW(r,r):new e(r)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&jW.isSelectable(n)?new jW(t):TW.near(t)}},NW=class e extends TW{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=vU.empty){if(t==vU.empty){e.delete(0,e.doc.content.size);let t=TW.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:`all`}}static fromJSON(t){return new e(t)}map(t){return new e(t)}eq(t){return t instanceof e}getBookmark(){return PW}};TW.jsonID(`all`,NW);var PW={map(){return this},resolve(e){return new NW(e)}};function FW(e,t,n,r,i,a=!1){if(t.inlineContent)return kW.create(e,n);for(let o=r-(i>0?0:1);i>0?o<t.childCount:o>=0;o+=i){let r=t.child(o);if(!r.isAtom){let t=FW(e,r,n+i,i<0?r.childCount:0,i,a);if(t)return t}else if(!a&&jW.isSelectable(r))return jW.create(e,n-(i<0?r.nodeSize:0));n+=r.nodeSize*i}return null}function IW(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof vW||i instanceof yW))return;let a=e.mapping.maps[r],o;a.forEach((e,t,n,r)=>{o??=r}),e.setSelection(TW.near(e.doc.resolve(o),n))}function LW(e,t){return!t||!e?e:e.bind(t)}var RW=class{constructor(e,t,n){this.name=e,this.init=LW(t.init,n),this.apply=LW(t.apply,n)}};new RW(`doc`,{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new RW(`selection`,{init(e,t){return e.selection||TW.atStart(t.doc)},apply(e){return e.selection}}),new RW(`storedMarks`,{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new RW(`scrollToSelection`,{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});var zW=(e,t)=>{let{state:n,view:r}=e,{selection:i}=n;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0)return!1;let o=a.depth-1,s=a.node(o),c=a.index(o);if(c===0)return!1;if(s.type===t)return e.commands.lift(t.name);let l=s.child(c-1);if(l.type!==t||!l.lastChild?.isTextblock)return!1;let u=a.before(),d=u-1-1,{tr:f}=n;return f.delete(u,a.after()).insert(d,a.parent.content),f.setSelection(kW.create(f.doc,d)),r.dispatch(f.scrollIntoView()),!0},BW=/^\s*>\s$/,VW=HR.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return lU(`blockquote`,{...WL(this.options.HTMLAttributes,e),children:lU(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
|
|
235
|
+
`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
|
|
236
|
+
`))}),n.join(`
|
|
237
|
+
>
|
|
238
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>zW(this.editor,this.type)}},addInputRules(){return[LR({find:BW,type:this.type})]}}),HW=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,UW=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,WW=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,GW=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,KW=vR.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return lU(`strong`,{...WL(this.options.HTMLAttributes,e),children:lU(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[PR({find:HW,type:this.type}),PR({find:WW,type:this.type})]},addPasteRules(){return[UR({find:UW,type:this.type}),UR({find:GW,type:this.type})]}}),qW=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},JW=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},YW=vR.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,WL(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[PR({find:qW,type:this.type})]},addPasteRules(){return[UR({find:JW,type:this.type})]}}),XW=4,ZW=/^```([a-z]+)?[\s\n]$/,QW=/^~~~([a-z]+)?[\s\n]$/,$W=HR.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:XW,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,WL(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
|
|
239
|
+
`):`\`\`\`${r}
|
|
240
|
+
|
|
241
|
+
\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??XW,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
|
|
242
|
+
`,`
|
|
243
|
+
`).split(`
|
|
244
|
+
`).map(e=>o+e).join(`
|
|
245
|
+
`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??XW,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
|
|
246
|
+
`,`
|
|
247
|
+
`).split(`
|
|
248
|
+
`),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(Cj.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
|
|
249
|
+
`,`
|
|
250
|
+
`).split(`
|
|
251
|
+
`).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
|
|
252
|
+
`);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
253
|
+
|
|
254
|
+
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(yj.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[IR({find:ZW,type:this.type,getAttributes:e=>({language:e[1]})}),IR({find:QW,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Vj({key:new Wj(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
|
|
255
|
+
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(Cj.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),eG=HR.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
256
|
+
|
|
257
|
+
`):``}),tG=HR.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,WL(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
258
|
+
`},renderMarkdown:()=>`
|
|
259
|
+
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),nG=HR.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(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,WL(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>IR({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),rG=HR.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,WL(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!lie(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return cR(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(Cj.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(Tj.create(t.doc,n.pos)):t.setSelection(Cj.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(Cj.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[FR({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),iG=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,aG=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,oG=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,sG=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,cG=vR.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,WL(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[PR({find:iG,type:this.type}),PR({find:oG,type:this.type})]},addPasteRules(){return[UR({find:aG,type:this.type}),UR({find:sG,type:this.type})]}}),lG=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,uG=`ελ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`,dG=`numeric`,fG=`ascii`,pG=`alpha`,mG=`asciinumeric`,hG=`alphanumeric`,gG=`domain`,_G=`emoji`,vG=`scheme`,yG=`slashscheme`,bG=`whitespace`;function xG(e,t){return e in t||(t[e]=[]),t[e]}function SG(e,t,n){t[dG]&&(t[mG]=!0,t[hG]=!0),t[fG]&&(t[mG]=!0,t[pG]=!0),t[mG]&&(t[hG]=!0),t[pG]&&(t[hG]=!0),t[hG]&&(t[gG]=!0),t[_G]&&(t[gG]=!0);for(let r in t){let t=xG(r,n);t.indexOf(e)<0&&t.push(e)}}function CG(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function wG(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}wG.groups={},wG.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=wG.groups;let i;return t&&t.j?i=t:(i=new wG(t),n&&r&&SG(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=wG.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new wG,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new wG,a&&(r&&(o.t&&typeof o.t==`string`?SG(a,Object.assign(CG(o.t,r),n),r):n&&SG(a,n,r)),o.t=a),i.j[e]=o,o}};var TG=(e,t,n,r,i)=>e.ta(t,n,r,i),EG=(e,t,n,r,i)=>e.tr(t,n,r,i),DG=(e,t,n,r,i)=>e.ts(t,n,r,i),$=(e,t,n,r,i)=>e.tt(t,n,r,i),OG=`WORD`,kG=`UWORD`,AG=`ASCIINUMERICAL`,jG=`ALPHANUMERICAL`,MG=`LOCALHOST`,NG=`TLD`,PG=`UTLD`,FG=`SCHEME`,IG=`SLASH_SCHEME`,LG=`NUM`,RG=`WS`,zG=`NL`,BG=`OPENBRACE`,VG=`CLOSEBRACE`,HG=`OPENBRACKET`,UG=`CLOSEBRACKET`,WG=`OPENPAREN`,GG=`CLOSEPAREN`,KG=`OPENANGLEBRACKET`,qG=`CLOSEANGLEBRACKET`,JG=`FULLWIDTHLEFTPAREN`,YG=`FULLWIDTHRIGHTPAREN`,XG=`LEFTCORNERBRACKET`,ZG=`RIGHTCORNERBRACKET`,QG=`LEFTWHITECORNERBRACKET`,$G=`RIGHTWHITECORNERBRACKET`,eK=`FULLWIDTHLESSTHAN`,tK=`FULLWIDTHGREATERTHAN`,nK=`AMPERSAND`,rK=`APOSTROPHE`,iK=`ASTERISK`,aK=`AT`,oK=`BACKSLASH`,sK=`BACKTICK`,cK=`CARET`,lK=`COLON`,uK=`COMMA`,dK=`DOLLAR`,fK=`DOT`,pK=`EQUALS`,mK=`EXCLAMATION`,hK=`HYPHEN`,gK=`PERCENT`,_K=`PIPE`,vK=`PLUS`,yK=`POUND`,bK=`QUERY`,xK=`QUOTE`,SK=`FULLWIDTHMIDDLEDOT`,CK=`SEMI`,wK=`SLASH`,TK=`TILDE`,EK=`UNDERSCORE`,DK=`EMOJI`,OK=`SYM`,kK=Object.freeze({__proto__:null,ALPHANUMERICAL:jG,AMPERSAND:nK,APOSTROPHE:rK,ASCIINUMERICAL:AG,ASTERISK:iK,AT:aK,BACKSLASH:oK,BACKTICK:sK,CARET:cK,CLOSEANGLEBRACKET:qG,CLOSEBRACE:VG,CLOSEBRACKET:UG,CLOSEPAREN:GG,COLON:lK,COMMA:uK,DOLLAR:dK,DOT:fK,EMOJI:DK,EQUALS:pK,EXCLAMATION:mK,FULLWIDTHGREATERTHAN:tK,FULLWIDTHLEFTPAREN:JG,FULLWIDTHLESSTHAN:eK,FULLWIDTHMIDDLEDOT:SK,FULLWIDTHRIGHTPAREN:YG,HYPHEN:hK,LEFTCORNERBRACKET:XG,LEFTWHITECORNERBRACKET:QG,LOCALHOST:MG,NL:zG,NUM:LG,OPENANGLEBRACKET:KG,OPENBRACE:BG,OPENBRACKET:HG,OPENPAREN:WG,PERCENT:gK,PIPE:_K,PLUS:vK,POUND:yK,QUERY:bK,QUOTE:xK,RIGHTCORNERBRACKET:ZG,RIGHTWHITECORNERBRACKET:$G,SCHEME:FG,SEMI:CK,SLASH:wK,SLASH_SCHEME:IG,SYM:OK,TILDE:TK,TLD:NG,UNDERSCORE:EK,UTLD:PG,UWORD:kG,WORD:OG,WS:RG}),AK=/[a-z]/,jK=/\p{L}/u,MK=/\p{Emoji}/u,NK=/\d/,PK=/\s/,FK=`\r`,IK=`
|
|
260
|
+
`,LK=`️`,RK=``,zK=``,BK=null,VK=null;function HK(e=[]){let t={};wG.groups=t;let n=new wG;BK??=KK(lG),VK??=KK(uG),$(n,`'`,rK),$(n,`{`,BG),$(n,`}`,VG),$(n,`[`,HG),$(n,`]`,UG),$(n,`(`,WG),$(n,`)`,GG),$(n,`<`,KG),$(n,`>`,qG),$(n,`(`,JG),$(n,`)`,YG),$(n,`「`,XG),$(n,`」`,ZG),$(n,`『`,QG),$(n,`』`,$G),$(n,`<`,eK),$(n,`>`,tK),$(n,`&`,nK),$(n,`*`,iK),$(n,`@`,aK),$(n,"`",sK),$(n,`^`,cK),$(n,`:`,lK),$(n,`,`,uK),$(n,`$`,dK),$(n,`.`,fK),$(n,`=`,pK),$(n,`!`,mK),$(n,`-`,hK),$(n,`%`,gK),$(n,`|`,_K),$(n,`+`,vK),$(n,`#`,yK),$(n,`?`,bK),$(n,`"`,xK),$(n,`/`,wK),$(n,`;`,CK),$(n,`~`,TK),$(n,`_`,EK),$(n,`\\`,oK),$(n,`・`,SK);let r=EG(n,NK,LG,{[dG]:!0});EG(r,NK,r);let i=EG(r,AK,AG,{[mG]:!0}),a=EG(r,jK,jG,{[hG]:!0}),o=EG(n,AK,OG,{[fG]:!0});EG(o,NK,i),EG(o,AK,o),EG(i,NK,i),EG(i,AK,i);let s=EG(n,jK,kG,{[pG]:!0});EG(s,AK),EG(s,NK,a),EG(s,jK,s),EG(a,NK,a),EG(a,AK),EG(a,jK,a);let c=$(n,IK,zG,{[bG]:!0}),l=$(n,FK,RG,{[bG]:!0}),u=EG(n,PK,RG,{[bG]:!0});$(n,zK,u),$(l,IK,c),$(l,zK,u),EG(l,PK,u),$(u,FK),$(u,IK),EG(u,PK,u),$(u,zK,u);let d=EG(n,MK,DK,{[_G]:!0});$(d,`#`),EG(d,MK,d),$(d,LK,d);let f=$(d,RK);$(f,`#`),EG(f,MK,d);let p=[[AK,o],[NK,i]],m=[[AK,null],[jK,s],[NK,a]];for(let e=0;e<BK.length;e++)GK(n,BK[e],NG,OG,p);for(let e=0;e<VK.length;e++)GK(n,VK[e],PG,kG,m);SG(NG,{tld:!0,ascii:!0},t),SG(PG,{utld:!0,alpha:!0},t),GK(n,`file`,FG,OG,p),GK(n,`mailto`,FG,OG,p),GK(n,`http`,IG,OG,p),GK(n,`https`,IG,OG,p),GK(n,`ftp`,IG,OG,p),GK(n,`ftps`,IG,OG,p),SG(FG,{scheme:!0,ascii:!0},t),SG(IG,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[vG]:!0}:{[yG]:!0};r.indexOf(`-`)>=0?i[gG]=!0:AK.test(r)?NK.test(r)?i[mG]=!0:i[fG]=!0:i[dG]=!0,DG(n,r,r,i)}return DG(n,`localhost`,MG,{ascii:!0}),n.jd=new wG(OK),{start:n,tokens:Object.assign({groups:t},kK)}}function UK(e,t){let n=WK(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function WK(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function GK(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new wG(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new wG(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function KK(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var qK={defaultProtocol:`http`,events:null,format:YK,formatHref:YK,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function JK(e,t=null){let n=Object.assign({},qK);e&&(n=Object.assign(n,e instanceof JK?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}JK.prototype={o:qK,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:qK[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function YK(e){return e}function XK(e,t){this.t=`token`,this.v=e,this.tk=t}XK.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=qK.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function ZK(e,t){class n extends XK{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var QK=ZK(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),$K=ZK(`text`),eq=ZK(`nl`),tq=ZK(`url`,{isLink:!0,toHref(e=qK.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==MG&&e[1].t===lK}}),nq=e=>new wG(e);function rq({groups:e}){let t=e.domain.concat([nK,iK,aK,oK,sK,cK,dK,pK,hK,LG,gK,_K,vK,yK,wK,OK,TK,EK]),n=[rK,lK,uK,fK,mK,gK,bK,xK,CK,KG,qG,BG,VG,UG,HG,WG,GG,JG,YG,XG,ZG,QG,$G,eK,tK],r=[nK,rK,iK,oK,sK,cK,dK,pK,hK,BG,VG,gK,_K,vK,yK,bK,wK,OK,TK,EK],i=nq(),a=$(i,TK);TG(a,r,a),TG(a,e.domain,a);let o=nq(),s=nq(),c=nq();TG(i,e.domain,o),TG(i,e.scheme,s),TG(i,e.slashscheme,c),TG(o,r,a),TG(o,e.domain,o);let l=$(o,aK);$(a,aK,l),$(s,aK,l),$(c,aK,l);let u=$(a,fK);TG(u,r,a),TG(u,e.domain,a);let d=nq();TG(l,e.domain,d),TG(d,e.domain,d);let f=$(d,fK);TG(f,e.domain,d);let p=nq(QK);TG(f,e.tld,p),TG(f,e.utld,p),$(l,MG,p);let m=$(d,hK);$(m,hK,m),TG(m,e.domain,d),TG(p,e.domain,d),$(p,fK,f),$(p,hK,m);let h=$(o,hK),g=$(o,fK);$(h,hK,h),TG(h,e.domain,o),TG(g,r,a),TG(g,e.domain,o);let _=nq(tq);TG(g,e.tld,_),TG(g,e.utld,_),TG(_,e.domain,o),TG(_,r,a),$(_,fK,g),$(_,hK,h),$(_,aK,l);let v=$(_,lK),y=nq(tq);TG(v,e.numeric,y);let b=nq(tq),x=nq();TG(b,t,b),TG(b,n,x),TG(x,t,b),TG(x,n,x),$(_,wK,b),$(y,wK,b);let S=$(s,lK),C=$($($(c,lK),wK),wK);TG(s,e.domain,o),$(s,fK,g),$(s,hK,h),TG(c,e.domain,o),$(c,fK,g),$(c,hK,h),TG(S,e.domain,b),$(S,wK,b),$(S,bK,b),TG(C,e.domain,b),TG(C,t,b),$(C,wK,b);let w=[[BG,VG],[HG,UG],[WG,GG],[KG,qG],[JG,YG],[XG,ZG],[QG,$G],[eK,tK]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=$(b,r);$(x,r,a);let o=nq(tq);TG(a,t,o);let s=nq();TG(a,n,s),$(a,i,b),TG(o,t,o),TG(o,n,s),TG(s,t,o),TG(s,n,s),$(o,i,b),$(s,i,b)}return $(i,MG,_),$(i,zG,eq),{start:i,tokens:kK}}function iq(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(aq($K,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(aq(e,t,r))}}return o.length>0&&a.push(aq($K,t,o)),a}function aq(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var oq=typeof console<`u`&&console&&console.warn||(()=>{}),sq=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,cq={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function lq(){return wG.groups={},cq.scanner=null,cq.parser=null,cq.tokenQueue=[],cq.pluginQueue=[],cq.customSchemes=[],cq.initialized=!1,cq}function uq(e,t=!1){if(cq.initialized&&oq(`linkifyjs: already initialized - will not register custom scheme "${e}" ${sq}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
|
|
261
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
262
|
+
2. Cannot start or end with "-"
|
|
263
|
+
3. "-" cannot repeat`);cq.customSchemes.push([e,t])}function dq(){cq.scanner=HK(cq.customSchemes);for(let e=0;e<cq.tokenQueue.length;e++)cq.tokenQueue[e][1]({scanner:cq.scanner});cq.parser=rq(cq.scanner.tokens);for(let e=0;e<cq.pluginQueue.length;e++)cq.pluginQueue[e][1]({scanner:cq.scanner,parser:cq.parser});return cq.initialized=!0,cq}function fq(e){return cq.initialized||dq(),iq(cq.parser.start,e,UK(cq.scanner.start,e))}fq.scan=UK;function pq(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new JK(n),i=fq(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var mq=`[\0- \xA0 -\u2029 ]`,hq=new RegExp(mq),gq=RegExp(`${mq}$`),_q=new RegExp(mq,`g`);function vq(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function yq(e){return new Vj({key:new Wj(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(eR(NL(n.doc,[...t])).forEach(({newRange:t})=>{let n=cre(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!gq.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(hq).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=fq(n).map(t=>t.toObject(e.defaultProtocol));if(!vq(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>r.schema.marks.code?!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code):!0).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{tR(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function bq(e){return new Vj({key:new Wj(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=$L(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}function xq(e){return new Vj({key:new Wj(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=pq(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function Sq(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(_q,``).match(RegExp(`^(?:(?:${n.join(`|`)}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,`i`))}var Cq=vR.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(e=>{if(typeof e==`string`){uq(e);return}uq(e.scheme,e.optionalSlashes)})},onDestroy(){lq()},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:(e,t)=>!!Sq(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Sq(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Sq(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,WL(this.options.HTMLAttributes,e),0]:[`a`,WL(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!Sq(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!Sq(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addPasteRules(){return[UR({find:e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options,i=pq(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Sq(e,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(yq({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Sq(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(bq({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(xq({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),wq=` `,Tq=`\xA0`,Eq=HR.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,WL(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===wq||n[0].text===wq||n[0].raw===Tq||n[0].text===Tq)&&r.length===1&&r[0].type===`text`&&(r[0].text===wq||r[0].text===Tq)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){let e=Array.isArray(n?.previousNode?.content)?n.previousNode.content:[];return n?.previousNode?.type===`paragraph`&&e.length===0?wq:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Dq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Oq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,kq=vR.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,WL(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[PR({find:Dq,type:this.type})]},addPasteRules(){return[UR({find:Oq,type:this.type})]}}),Aq=HR.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),jq=vR.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,WL(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Mq(e={}){return new Vj({view(t){return new Nq(t,e)}})}var Nq=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.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),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.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`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(t&&!i){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=QA(this.editorView.state.doc,e,this.editorView.dragging.slice);t!=null&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},Pq=class e extends yj{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):yj.near(r)}content(){return Q.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new Fq(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Lq(e)||!Rq(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!Tj.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};Pq.prototype.visible=!1,Pq.findFrom=Pq.findGapCursorFrom,yj.jsonID(`gapcursor`,Pq);var Fq=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Pq.valid(t)?new Pq(t):yj.near(t)}};function Iq(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Lq(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||Iq(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Rq(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||Iq(e.type))return!0;if(e.inlineContent)return!1}}return!0}function zq(){return new Vj({props:{decorations:Wq,createSelectionBetween(e,t,n){return t.pos==n.pos&&Pq.valid(n)?new Pq(n):null},handleClick:Hq,handleKeyDown:Bq,handleDOMEvents:{beforeinput:Uq}}})}var Bq=oL({ArrowLeft:Vq(`horiz`,-1),ArrowRight:Vq(`horiz`,1),ArrowUp:Vq(`vert`,-1),ArrowDown:Vq(`vert`,1)});function Vq(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof Cj){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=Pq.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new Pq(c))),!0):!1}}function Hq(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Pq.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Tj.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Pq(r))),!0)}function Uq(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof Pq))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=Z.empty;for(let e=r.length-1;e>=0;e--)i=Z.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new Q(i,0,0));return a.setSelection(Cj.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function Wq(e){if(!(e.selection instanceof Pq))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,hI.create(e.doc,[fI.widget(e.selection.head,t,{key:`gapcursor`})])}var Gq=200,Kq=function(){};Kq.prototype.append=function(e){return e.length?(e=Kq.from(e),!this.length&&e||e.length<Gq&&this.leafAppend(e)||this.length<Gq&&e.leafPrepend(this)||this.appendInner(e)):this},Kq.prototype.prepend=function(e){return e.length?Kq.from(e).append(this):this},Kq.prototype.appendInner=function(e){return new Jq(this,e)},Kq.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Kq.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Kq.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Kq.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Kq.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},Kq.from=function(e){return e instanceof Kq?e:e&&e.length?new qq(e):Kq.empty};var qq=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=Gq)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Gq)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Kq);Kq.empty=new qq([]);var Jq=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Kq),Yq=500,Xq=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new Qq(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new Qq(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new Qq(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>eJ&&(s=Zq(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new gA;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new Qq(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new Qq(i,o,l))}else r.push(new Qq(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new Qq(a.maps[e]));let u=new e(this.items.slice(0,i).append(l).append(r),s);return u.emptyItemCount()>Yq&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new Qq(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(Kq.from(i.reverse()),a)}};Xq.empty=new Xq(Kq.empty,0);function Zq(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var Qq=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},$q=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},eJ=20;function tJ(e,t,n,r){let i=n.getMeta(lJ),a;if(i)return i.historyState;n.getMeta(uJ)&&(e=new $q(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(lJ))return o.getMeta(lJ).redo?new $q(e.done.addTransform(n,void 0,r,cJ(t)),e.undone,rJ(n.mapping.maps),e.prevTime,e.prevComposition):new $q(e.done,e.undone.addTransform(n,void 0,r,cJ(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!nJ(n,e.prevRanges)),s=o?iJ(e.prevRanges,n.mapping):rJ(n.mapping.maps);return new $q(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,cJ(t)),Xq.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new $q(e.done.rebased(n,a),e.undone.rebased(n,a),iJ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new $q(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),iJ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function nJ(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function rJ(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function iJ(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function aJ(e,t,n){let r=cJ(t),i=lJ.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new $q(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(lJ,{redo:n,historyState:c})}var oJ=!1,sJ=null;function cJ(e){let t=e.plugins;if(sJ!=t){oJ=!1,sJ=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){oJ=!0;break}}return oJ}var lJ=new Wj(`history`),uJ=new Wj(`closeHistory`);function dJ(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Vj({key:lJ,state:{init(){return new $q(Xq.empty,Xq.empty,null,0,-1)},apply(t,n,r){return tJ(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?pJ:n==`historyRedo`?mJ:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function fJ(e,t){return(n,r)=>{let i=lJ.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=aJ(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var pJ=fJ(!1,!0),mJ=fJ(!0,!0);xR.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Vj({key:new Wj(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var hJ=xR.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[Mq(this.options)]}});xR.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new Vj({key:new Wj(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return hI.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(fI.node(t,t+e.nodeSize,{class:this.options.className}))}),hI.create(e,a)}}})]}});var gJ=xR.create({name:`gapCursor`,addProseMirrorPlugins(){return[zq()]},extendNodeSchema(e){return{allowGapCursor:BL(IL(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),_J=`placeholder`,vJ=new Wj(`tiptap__placeholder`),yJ=200;function bJ(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),fI.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function xJ(e,t){return typeof e==`function`?e(t):e}function SJ({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&sR(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(bJ({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:xJ(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else{let i=vJ.getState(e.state),c=i?.topPos??0,l=i?.bottomPos??r.content.size;r.nodesBetween(c,l,(r,i)=>{let c=a>=i&&a<=i+r.nodeSize,l=!r.isLeaf&&sR(r);return r.type.isTextblock&&(c||!t.showOnlyCurrent)&&l&&o.push(bJ({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:c,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:xJ(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:c})},node:r,pos:i})),t.includeChildren})}return hI.create(r,o)}function CJ(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function wJ(e){let t=getComputedStyle(e),n=`${t.overflow} ${t.overflowY} ${t.overflowX}`;return/auto|scroll|overlay/.test(n)}function TJ(e){let t=e;for(;t;){if(wJ(t))return t;let e=t.parentElement;if(!e){let e=t.getRootNode();if(e instanceof ShadowRoot){t=e.host;continue}return window}t=e}return window}function EJ(e){return e===window?{top:0,bottom:window.innerHeight}:e.getBoundingClientRect()}function DJ({doc:e,view:t,scrollContainer:n}){let r=t.dom.getBoundingClientRect(),i=n?EJ(n):{top:0,bottom:window.innerHeight},a=Math.max(r.top,i.top)-yJ,o=Math.min(r.bottom,i.bottom)+yJ;if(a>=o)return{top:0,bottom:e.content.size};let s=getComputedStyle(t.dom).direction===`rtl`?Math.max(r.right-2,r.left+2):r.left+2,c=t.posAtCoords({left:s,top:a+2}),l=t.posAtCoords({left:s,top:o-2});return{top:c?c.pos:0,bottom:l?l.pos:e.content.size}}var OJ={init(){return{topPos:null,bottomPos:null}},apply(e,t){let n=e.getMeta(vJ);return n?.positions?{topPos:n.positions.top,bottomPos:n.positions.bottom}:e.docChanged?{topPos:t.topPos===null?null:e.mapping.map(t.topPos),bottomPos:t.bottomPos===null?null:e.mapping.map(t.bottomPos)}:t}};function kJ(e){let t=TJ(e.dom),n=()=>{let n=DJ({view:e,doc:e.state.doc,scrollContainer:t}),r=vJ.getState(e.state);if(r?.topPos===n.top&&r?.bottomPos===n.bottom)return;let i=e.state.tr.setMeta(vJ,{positions:n});e.dispatch(i)},r=null,i=0,a=()=>{r===null&&(r=requestAnimationFrame(()=>{r=null;let e=performance.now();e-i>=150?(i=e,n()):a()}))};return t.addEventListener(`scroll`,a,{passive:!0}),n(),{update(t,n){e.state.doc.content.size!==n.doc.content.size&&a()},destroy:()=>{r!==null&&cancelAnimationFrame(r),t.removeEventListener(`scroll`,a)}}}function AJ({editor:e,options:t}){let n=t.dataAttribute?`data-${CJ(t.dataAttribute)}`:`data-${_J}`;return new Vj({key:vJ,state:OJ,view:kJ,props:{decorations:({doc:r,selection:i})=>SJ({editor:e,options:t,dataAttribute:n,doc:r,selection:i})}})}xR.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:_J,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[AJ({editor:this.editor,options:this.options})]}});var jJ=`.ProseMirror:not(.ProseMirror-focused) *::selection {
|
|
264
|
+
background: transparent;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {
|
|
268
|
+
background: transparent;
|
|
269
|
+
}`;xR.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return e.options.injectCSS&&typeof document<`u`&&NR(jJ,e.options.injectNonce,`selection`),[new Vj({key:new Wj(`selection`),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||cR(n.selection)||e.view.dragging?null:hI.create(n.doc,[fI.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function MJ({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var NJ=xR.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new Wj(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new Vj({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!MJ({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!MJ({node:r,types:n})}}})]}}),PJ=xR.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>pJ(e,t),redo:()=>({state:e,dispatch:t})=>mJ(e,t)}},addProseMirrorPlugins(){return[dJ(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()}}}),FJ=xR.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(KW.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(VW.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(OH.configure(this.options.bulletList)),this.options.code!==!1&&e.push(YW.configure(this.options.code)),this.options.codeBlock!==!1&&e.push($W.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(eG.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(hJ.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(gJ.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(tG.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(nG.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(PJ.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(rG.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(cG.configure(this.options.italic)),this.options.listItem!==!1&&e.push(FH.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(KH.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(Cq.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(rU.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Eq.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(kq.configure(this.options.strike)),this.options.text!==!1&&e.push(Aq.configure(this.options.text)),this.options.underline!==!1&&e.push(jq.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(NJ.configure(this.options?.trailingNode)),e}});function IJ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}function LJ(e,t){return Array(t+1).join(e)}function RJ(e){return e.replace(/^\n*/,``)}function zJ(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
270
|
+
`;)t--;return e.substring(0,t)}function BJ(e){return zJ(RJ(e))}var VJ=`ADDRESS.ARTICLE.ASIDE.AUDIO.BLOCKQUOTE.BODY.CANVAS.CENTER.DD.DIR.DIV.DL.DT.FIELDSET.FIGCAPTION.FIGURE.FOOTER.FORM.FRAMESET.H1.H2.H3.H4.H5.H6.HEADER.HGROUP.HR.HTML.ISINDEX.LI.MAIN.MENU.NAV.NOFRAMES.NOSCRIPT.OL.OUTPUT.P.PRE.SECTION.TABLE.TBODY.TD.TFOOT.TH.THEAD.TR.UL`.split(`.`);function HJ(e){return YJ(e,VJ)}var UJ=[`AREA`,`BASE`,`BR`,`COL`,`COMMAND`,`EMBED`,`HR`,`IMG`,`INPUT`,`KEYGEN`,`LINK`,`META`,`PARAM`,`SOURCE`,`TRACK`,`WBR`];function WJ(e){return YJ(e,UJ)}function GJ(e){return XJ(e,UJ)}var KJ=[`A`,`TABLE`,`THEAD`,`TBODY`,`TFOOT`,`TH`,`TD`,`IFRAME`,`SCRIPT`,`AUDIO`,`VIDEO`];function qJ(e){return YJ(e,KJ)}function JJ(e){return XJ(e,KJ)}function YJ(e,t){return t.indexOf(e.nodeName)>=0}function XJ(e,t){return e.getElementsByTagName&&t.some(function(t){return e.getElementsByTagName(t).length})}var ZJ=[[/\\/g,`\\\\`],[/\*/g,`\\*`],[/^-/g,`\\-`],[/^\+ /g,`\\+ `],[/^(=+)/g,`\\$1`],[/^(#{1,6}) /g,`\\$1 `],[/`/g,"\\`"],[/^~~~/g,`\\~~~`],[/\[/g,`\\[`],[/\]/g,`\\]`],[/^>/g,`\\>`],[/_/g,`\\_`],[/^(\d+)\. /g,`$1\\. `]];function QJ(e){return ZJ.reduce(function(e,t){return e.replace(t[0],t[1])},e)}var $J={};$J.paragraph={filter:`p`,replacement:function(e){return`
|
|
271
|
+
|
|
272
|
+
`+e+`
|
|
273
|
+
|
|
274
|
+
`}},$J.lineBreak={filter:`br`,replacement:function(e,t,n){return n.br+`
|
|
275
|
+
`}},$J.heading={filter:[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle===`setext`&&r<3){var i=LJ(r===1?`=`:`-`,e.length);return`
|
|
276
|
+
|
|
277
|
+
`+e+`
|
|
278
|
+
`+i+`
|
|
279
|
+
|
|
280
|
+
`}else return`
|
|
281
|
+
|
|
282
|
+
`+LJ(`#`,r)+` `+e+`
|
|
283
|
+
|
|
284
|
+
`}},$J.blockquote={filter:`blockquote`,replacement:function(e){return e=BJ(e).replace(/^/gm,`> `),`
|
|
285
|
+
|
|
286
|
+
`+e+`
|
|
287
|
+
|
|
288
|
+
`}},$J.list={filter:[`ul`,`ol`],replacement:function(e,t){var n=t.parentNode;return n.nodeName===`LI`&&n.lastElementChild===t?`
|
|
289
|
+
`+e:`
|
|
290
|
+
|
|
291
|
+
`+e+`
|
|
292
|
+
|
|
293
|
+
`}},$J.listItem={filter:`li`,replacement:function(e,t,n){var r=n.bulletListMarker+` `,i=t.parentNode;if(i.nodeName===`OL`){var a=i.getAttribute(`start`),o=Array.prototype.indexOf.call(i.children,t);r=(a?Number(a)+o:o+1)+`. `}var s=/\n$/.test(e);return e=BJ(e)+(s?`
|
|
294
|
+
`:``),e=e.replace(/\n/gm,`
|
|
295
|
+
`+` `.repeat(r.length)),r+e+(t.nextSibling?`
|
|
296
|
+
`:``)}},$J.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle===`indented`&&e.nodeName===`PRE`&&e.firstChild&&e.firstChild.nodeName===`CODE`},replacement:function(e,t,n){return`
|
|
297
|
+
|
|
298
|
+
`+t.firstChild.textContent.replace(/\n/g,`
|
|
299
|
+
`)+`
|
|
300
|
+
|
|
301
|
+
`}},$J.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle===`fenced`&&e.nodeName===`PRE`&&e.firstChild&&e.firstChild.nodeName===`CODE`},replacement:function(e,t,n){for(var r=((t.firstChild.getAttribute(`class`)||``).match(/language-(\S+)/)||[null,``])[1],i=t.firstChild.textContent,a=n.fence.charAt(0),o=3,s=RegExp(`^`+a+`{3,}`,`gm`),c;c=s.exec(i);)c[0].length>=o&&(o=c[0].length+1);var l=LJ(a,o);return`
|
|
302
|
+
|
|
303
|
+
`+l+r+`
|
|
304
|
+
`+i.replace(/\n$/,``)+`
|
|
305
|
+
`+l+`
|
|
306
|
+
|
|
307
|
+
`}},$J.horizontalRule={filter:`hr`,replacement:function(e,t,n){return`
|
|
308
|
+
|
|
309
|
+
`+n.hr+`
|
|
310
|
+
|
|
311
|
+
`}},$J.inlineLink={filter:function(e,t){return t.linkStyle===`inlined`&&e.nodeName===`A`&&e.getAttribute(`href`)},replacement:function(e,t){var n=tY(t.getAttribute(`href`)),r=nY(eY(t.getAttribute(`title`))),i=r?` "`+r+`"`:``;return`[`+e+`](`+n+i+`)`}},$J.referenceLink={filter:function(e,t){return t.linkStyle===`referenced`&&e.nodeName===`A`&&e.getAttribute(`href`)},replacement:function(e,t,n){var r=tY(t.getAttribute(`href`)),i=eY(t.getAttribute(`title`));i&&=` "`+nY(i)+`"`;var a,o;switch(n.linkReferenceStyle){case`collapsed`:a=`[`+e+`][]`,o=`[`+e+`]: `+r+i;break;case`shortcut`:a=`[`+e+`]`,o=`[`+e+`]: `+r+i;break;default:var s=this.references.length+1;a=`[`+e+`][`+s+`]`,o=`[`+s+`]: `+r+i}return this.references.push(o),a},references:[],append:function(e){var t=``;return this.references.length&&(t=`
|
|
312
|
+
|
|
313
|
+
`+this.references.join(`
|
|
314
|
+
`)+`
|
|
315
|
+
|
|
316
|
+
`,this.references=[]),t}},$J.emphasis={filter:[`em`,`i`],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:``}},$J.strong={filter:[`strong`,`b`],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:``}},$J.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName===`PRE`&&!t;return e.nodeName===`CODE`&&!n},replacement:function(e){if(!e)return``;e=e.replace(/\r?\n|\r/g,` `);for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?` `:``,n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n+="`";return n+t+e+t+n}},$J.image={filter:`img`,replacement:function(e,t){var n=QJ(eY(t.getAttribute(`alt`))),r=tY(t.getAttribute(`src`)||``),i=eY(t.getAttribute(`title`)),a=i?` "`+nY(i)+`"`:``;return r?``:``}};function eY(e){return e?e.replace(/(\n+\s*)+/g,`
|
|
317
|
+
`):``}function tY(e){var t=e.replace(/([<>()])/g,`\\$1`);return t.indexOf(` `)>=0?`<`+t+`>`:t}function nY(e){return e.replace(/"/g,`\\"`)}function rY(e){for(var t in this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[],e.rules)this.array.push(e.rules[t])}rY.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return``}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=iY(this.array,e,this.options))||(t=iY(this._keep,e,this.options))||(t=iY(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function iY(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(aY(i,t,n))return i}}function aY(e,t,n){var r=e.filter;if(typeof r==`string`){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r==`function`){if(r.call(e,t,n))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}function oY(e){var t=e.element,n=e.isBlock,r=e.isVoid,i=e.isPre||function(e){return e.nodeName===`PRE`};if(!(!t.firstChild||i(t))){for(var a=null,o=!1,s=null,c=cY(s,t,i);c!==t;){if(c.nodeType===3||c.nodeType===4){var l=c.data.replace(/[ \r\n\t]+/g,` `);if((!a||/ $/.test(a.data))&&!o&&l[0]===` `&&(l=l.substr(1)),!l){c=sY(c);continue}c.data=l,a=c}else if(c.nodeType===1)n(c)||c.nodeName===`BR`?(a&&(a.data=a.data.replace(/ $/,``)),a=null,o=!1):r(c)||i(c)?(a=null,o=!0):a&&(o=!1);else{c=sY(c);continue}var u=cY(s,c,i);s=c,c=u}a&&(a.data=a.data.replace(/ $/,``),a.data||sY(a))}}function sY(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function cY(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var lY=typeof window<`u`?window:{};function uY(){var e=lY.DOMParser,t=!1;try{new e().parseFromString(``,`text/html`)&&(t=!0)}catch{}return t}function dY(){var e=function(){};return fY()?e.prototype.parseFromString=function(e){var t=new window.ActiveXObject(`htmlfile`);return t.designMode=`on`,t.open(),t.write(e),t.close(),t}:e.prototype.parseFromString=function(e){var t=document.implementation.createHTMLDocument(``);return t.open(),t.write(e),t.close(),t},e}function fY(){var e=!1;try{document.implementation.createHTMLDocument(``).open()}catch{lY.ActiveXObject&&(e=!0)}return e}var pY=uY()?lY.DOMParser:dY();function mY(e,t){var n=typeof e==`string`?gY().parseFromString(`<x-turndown id="turndown-root">`+e+`</x-turndown>`,`text/html`).getElementById(`turndown-root`):e.cloneNode(!0);return oY({element:n,isBlock:HJ,isVoid:WJ,isPre:t.preformattedCode?_Y:null}),n}var hY;function gY(){return hY||=new pY,hY}function _Y(e){return e.nodeName===`PRE`||e.nodeName===`CODE`}function vY(e,t){return e.isBlock=HJ(e),e.isCode=e.nodeName===`CODE`||e.parentNode.isCode,e.isBlank=yY(e),e.flankingWhitespace=bY(e,t),e}function yY(e){return!WJ(e)&&!qJ(e)&&/^\s*$/i.test(e.textContent)&&!GJ(e)&&!JJ(e)}function bY(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:``,trailing:``};var n=xY(e.textContent);return n.leadingAscii&&SY(`left`,e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&SY(`right`,e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function xY(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function SY(e,t,n){var r,i,a;return e===`left`?(r=t.previousSibling,i=/ $/):(r=t.nextSibling,i=/^ /),r&&(r.nodeType===3?a=i.test(r.nodeValue):n.preformattedCode&&r.nodeName===`CODE`?a=!1:r.nodeType===1&&!HJ(r)&&(a=i.test(r.textContent))),a}var CY=Array.prototype.reduce;function wY(e){if(!(this instanceof wY))return new wY(e);var t={rules:$J,headingStyle:`setext`,hr:`* * *`,bulletListMarker:`*`,codeBlockStyle:`indented`,fence:"```",emDelimiter:`_`,strongDelimiter:`**`,linkStyle:`inlined`,linkReferenceStyle:`full`,br:` `,preformattedCode:!1,blankReplacement:function(e,t){return t.isBlock?`
|
|
318
|
+
|
|
319
|
+
`:``},keepReplacement:function(e,t){return t.isBlock?`
|
|
320
|
+
|
|
321
|
+
`+t.outerHTML+`
|
|
322
|
+
|
|
323
|
+
`:t.outerHTML},defaultReplacement:function(e,t){return t.isBlock?`
|
|
324
|
+
|
|
325
|
+
`+e+`
|
|
326
|
+
|
|
327
|
+
`:e}};this.options=IJ({},t,e),this.rules=new rY(this.options)}wY.prototype={turndown:function(e){if(!kY(e))throw TypeError(e+` is not a string, or an element/document/fragment node.`);if(e===``)return``;var t=TY.call(this,new mY(e,this.options));return EY.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e==`function`)e(this);else throw TypeError(`plugin must be a Function or an Array of Functions`);return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return QJ(e)}};function TY(e){var t=this;return CY.call(e.childNodes,function(e,n){n=new vY(n,t.options);var r=``;return n.nodeType===3?r=n.isCode?n.nodeValue:t.escape(n.nodeValue):n.nodeType===1&&(r=DY.call(t,n)),OY(e,r)},``)}function EY(e){var t=this;return this.rules.forEach(function(n){typeof n.append==`function`&&(e=OY(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,``).replace(/[\t\r\n\s]+$/,``)}function DY(e){var t=this.rules.forNode(e),n=TY.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function OY(e,t){var n=zJ(e),r=RJ(t),i=Math.max(e.length-n.length,t.length-r.length);return n+`
|
|
328
|
+
|
|
329
|
+
`.substring(0,i)+r}function kY(e){return e!=null&&(typeof e==`string`||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var AY=/highlight-(?:text|source)-([a-z0-9]+)/;function jY(e){e.addRule(`highlightedCodeBlock`,{filter:function(e){var t=e.firstChild;return e.nodeName===`DIV`&&AY.test(e.className)&&t&&t.nodeName===`PRE`},replacement:function(e,t,n){var r=((t.className||``).match(AY)||[null,``])[1];return`
|
|
330
|
+
|
|
331
|
+
`+n.fence+r+`
|
|
332
|
+
`+t.firstChild.textContent+`
|
|
333
|
+
`+n.fence+`
|
|
334
|
+
|
|
335
|
+
`}})}function MY(e){e.addRule(`strikethrough`,{filter:[`del`,`s`,`strike`],replacement:function(e){return`~`+e+`~`}})}var NY=Array.prototype.indexOf,PY=Array.prototype.every,FY={};FY.tableCell={filter:[`th`,`td`],replacement:function(e,t){return RY(e,t)}},FY.tableRow={filter:`tr`,replacement:function(e,t){var n=``,r={left:`:--`,right:`--:`,center:`:-:`};if(IY(t))for(var i=0;i<t.childNodes.length;i++){var a=`---`,o=(t.childNodes[i].getAttribute(`align`)||``).toLowerCase();o&&(a=r[o]||a),n+=RY(a,t.childNodes[i])}return`
|
|
336
|
+
`+e+(n?`
|
|
337
|
+
`+n:``)}},FY.table={filter:function(e){return e.nodeName===`TABLE`&&IY(e.rows[0])},replacement:function(e){return e=e.replace(`
|
|
338
|
+
|
|
339
|
+
`,`
|
|
340
|
+
`),`
|
|
341
|
+
|
|
342
|
+
`+e+`
|
|
343
|
+
|
|
344
|
+
`}},FY.tableSection={filter:[`thead`,`tbody`,`tfoot`],replacement:function(e){return e}};function IY(e){var t=e.parentNode;return t.nodeName===`THEAD`||t.firstChild===e&&(t.nodeName===`TABLE`||LY(t))&&PY.call(e.childNodes,function(e){return e.nodeName===`TH`})}function LY(e){var t=e.previousSibling;return e.nodeName===`TBODY`&&(!t||t.nodeName===`THEAD`&&/^\s*$/i.test(t.textContent))}function RY(e,t){var n=NY.call(t.parentNode.childNodes,t),r=` `;return n===0&&(r=`| `),r+e+` |`}function zY(e){for(var t in e.keep(function(e){return e.nodeName===`TABLE`&&!IY(e.rows[0])}),FY)e.addRule(t,FY[t])}function BY(e){e.addRule(`taskListItems`,{filter:function(e){return e.type===`checkbox`&&e.parentNode.nodeName===`LI`},replacement:function(e,t){return(t.checked?`[x]`:`[ ]`)+` `}})}function VY(e){e.use([jY,MY,zY,BY])}function HY(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=uie(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegExp(s?`${u}${c}.*?(?=\\s${d}|$)`:`${u}(?:^)?${c}[^\\s${d}]*`,`gm`),p=o.nodeBefore?.isText&&o.nodeBefore.text;if(!p)return null;let m=o.pos-p.length,h=Array.from(p.matchAll(f)).pop();if(!h||h.input===void 0||h.index===void 0)return null;let g=h.input.slice(Math.max(0,h.index-1),h.index),_=RegExp(`^[${i?.join(``)}\0]?$`).test(g);if(i!==null&&!_)return null;let v=m+h.index,y=v+h[0].length;return s&&l.test(p.slice(y-1,y+1))&&(h[0]+=` `,y+=1),v<o.pos&&y>=o.pos?{range:{from:v,to:y},query:h[0].slice(t.length),text:h[0]}:null}function UY(e){return e.docChanged?e.steps.some(e=>{let t=e.slice;if(!t?.content)return!1;let n=t.content.textBetween(0,t.content.size,`
|
|
345
|
+
`);return/\s/.test(n)}):!1}function WY(e){return()=>{let t=e.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=e.view.coordsAtPos(t);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}}}function GY(e,t,n,r){return n?()=>{let n=r.getState(e.state)?.decorationId;return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:WY(e)}function KY({match:e,dismissedRange:t,state:n,transaction:r,editor:i,shouldResetDismissed:a,effectiveAllowSpaces:o}){return a?.({editor:i,state:n,range:t,match:e,transaction:r,allowSpaces:o})?!1:o?e.range.from===t.from:e.range.from===t.from&&!UY(r)}function qY({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function JY({pluginKey:e,decorationTag:t,decorationClass:n,decorationContent:r,decorationEmptyClass:i,renderer:a,dispatchExit:o}){return{handleKeyDown(t,n){var r;let i=e.getState(t.state);return i.active?n.key===`Escape`||n.key===`Esc`?((r=a?.onKeyDown)==null||r.call(a,{view:t,event:n,range:i.range}),o(t),!0):(a?.onKeyDown)?.call(a,{view:t,event:n,range:i.range})||!1:!1},decorations(a){let{active:o,range:s,decorationId:c,query:l}=e.getState(a);if(!o)return null;let u=!l?.length,d=[n];return u&&d.push(i),hI.create(a.doc,[fI.inline(s.from,s.to,{nodeName:t,class:d.join(` `),"data-decoration-id":c||void 0,"data-decoration-content":r})])}}}function YY({editor:e,char:t,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,findSuggestionMatch:o,allow:s,shouldShow:c,shouldKeepDismissed:l,pluginKey:u}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(d,f,p,m){let{isEditable:h}=e,{composing:g}=e.view,{selection:_}=d,{empty:v,from:y}=_,b={...f},x=d.getMeta(u);if(x&&x.exit)return b.active=!1,b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null,b.dismissedRange=f.active?{...f.range}:f.dismissedRange,b;if(b.composing=g,d.docChanged&&b.dismissedRange!==null&&(b.dismissedRange={from:d.mapping.map(b.dismissedRange.from),to:d.mapping.map(b.dismissedRange.to)}),h&&(v||e.view.composing)){(y<f.range.from||y>f.range.to)&&!g&&!f.composing&&(b.active=!1);let u=o({char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:_.$from}),p=`id_${Math.floor(Math.random()*4294967295)}`;u&&s({editor:e,state:m,range:u.range,isActive:f.active})&&(!c||c({editor:e,range:u.range,query:u.query,text:u.text,transaction:d}))?(b.dismissedRange!==null&&!l({match:u,dismissedRange:b.dismissedRange,state:m,transaction:d})&&(b.dismissedRange=null),b.dismissedRange===null?(b.active=!0,b.decorationId=f.decorationId||p,b.range=u.range,b.query=u.query,b.text=u.text):b.active=!1):(u||(b.dismissedRange=null),b.active=!1)}else b.active=!1;return b.active||(b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null),b}}}function XY({editor:e,items:t}){let n=null,r=null,i=null,a=()=>{r!==null&&(clearTimeout(r),r=null),i?.(),i=null},o=e=>new Promise(t=>{i=t,r=setTimeout(()=>{r=null;let e=i;i=null,e?.()},e)}),s=()=>{n?.abort(),a(),n=null};return{abort:s,fetch:async(r,i)=>{s(),n=new AbortController;let a=n;if(i>0&&await o(i),n!==a||a.signal.aborted)return{status:`aborted`};try{let i=await t({editor:e,query:r,signal:a.signal});return n!==a||a.signal.aborted?{status:`aborted`}:{status:`resolved`,items:i}}catch{return n!==a||a.signal.aborted?{status:`aborted`}:{status:`error`}}}}}function ZY({placement:e,offset:t,flip:n,floatingUi:r}){let i=[Mf({mainAxis:t.mainAxis??4,crossAxis:t.crossAxis??0})];return n&&i.push(Pf()),r?.middleware?.length&&i.push(...r.middleware),{placement:e,strategy:r?.strategy??`absolute`,middleware:i}}function QY(e){if(e instanceof HTMLElement)return e;if(typeof e==`string`)try{let t=document.querySelector(e);if(t)return t}catch{return document.body}return document.body}function $Y({getReferenceRect:e,contextElement:t,config:n,container:r,dismissOnOutsideClick:i,dismiss:a}){return(o,s={})=>{let c={getBoundingClientRect:()=>e()??new DOMRect,contextElement:t},l=!1,u=!o.isConnected;u&&QY(r).appendChild(o),s.onPosition||(o.style.visibility=`hidden`,o.style.width=`max-content`);let d=jf(c,o,()=>{zf(c,o,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:e,y:t,placement:n,strategy:r})=>{if(s.onPosition){s.onPosition({x:e,y:t,placement:n,strategy:r});return}Object.assign(o.style,{position:r,left:`${e}px`,top:`${t}px`}),l||(l=!0,o.style.visibility=``)})},s.autoUpdate),f;return i&&(f=e=>{let n=e.target;!(n instanceof Node)||o.contains(n)||t.contains(n)||a()},document.addEventListener(`pointerdown`,f,!0)),()=>{d(),f&&document.removeEventListener(`pointerdown`,f,!0),u&&o.remove()}}}function eX({editor:e,pluginKey:t,items:n,renderer:r,minQueryLength:i,debounce:a,initialItems:o,placement:s,offset:c,container:l,flip:u,floatingUi:d,dismissOnOutsideClick:f,command:p,clientRectFor:m,dispatchExit:h}){let g,_=XY({editor:e,items:n}),v=ZY({placement:s,offset:c,flip:u,floatingUi:d});function y(e,t){var n,i,a;switch(e){case`started`:(n=r?.onStart)==null||n.call(r,t);break;case`updated`:(i=r?.onUpdate)==null||i.call(r,t);break;case`stopped`:(a=r?.onExit)==null||a.call(r,t);break;default:break}}return{update:async(n,d)=>{var b,x;let S=t.getState(d),C=t.getState(n.state);if(!S||!C)return;let w=null,T=S.query!==C.query,E=S.text!==C.text,D=S.range.from!==C.range.from||S.range.to!==C.range.to,O=T||E||D;if(!S.active&&C.active)w=`started`;else if(S.active&&!C.active)w=`stopped`;else if(C.active&&O)w=`updated`;else return;let k=w===`stopped`?S:C,A=n.dom.querySelector(`[data-decoration-id="${k.decorationId}"]`),j=m(n,A),M=i===0||(k.query?k.query.length>=i:!1),N=(w===`started`||w===`updated`)&&M;if(g={editor:e,range:k.range,query:k.query||``,text:k.text||``,items:o??[],command:t=>p({editor:e,range:k.range,props:t}),decorationNode:A,clientRect:j,loading:N,placement:s,offset:{mainAxis:c.mainAxis??4,crossAxis:c.crossAxis??0},container:l,flip:u,floatingUi:v,mount:$Y({getReferenceRect:j,contextElement:n.dom,config:v,container:l,dismissOnOutsideClick:f,dismiss:()=>h(e.view)})},w===`started`&&((b=r?.onBeforeStart)==null||b.call(r,g)),w===`updated`&&((x=r?.onBeforeUpdate)==null||x.call(r,g)),w===`started`&&y(w,g),w===`started`||w===`updated`)if(!N)_.abort(),g={...g,items:o??[],loading:!1};else{g={...g,items:o??[],loading:!0},w=`updated`,y(w,g);let e=await _.fetch(k.query||``,a);if(e.status===`aborted`)return;if(!t.getState(n.state)?.active){_.abort();return}g=e.status===`resolved`?{...g,items:e.items,loading:!1}:{...g,loading:!1}}if(w===`stopped`){_.abort(),y(w,g),g=void 0;return}w===`updated`&&y(w,g)},destroy:()=>{var e;_.abort(),g&&((e=r?.onExit)==null||e.call(r,g))}}}var tX=new Wj(`suggestion`);function nX({pluginKey:e=tX,editor:t,char:n=`@`,allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[` `],startOfLine:o=!1,decorationTag:s=`span`,decorationClass:c=`suggestion`,decorationContent:l=``,decorationEmptyClass:u=`is-empty`,command:d=()=>null,items:f=()=>[],minQueryLength:p=0,debounce:m=0,initialItems:h,placement:g=`bottom-start`,offset:_={},container:v,flip:y=!0,floatingUi:b,dismissOnOutsideClick:x=!0,render:S=()=>({}),allow:C=()=>!0,findSuggestionMatch:w=HY,shouldShow:T,shouldResetDismissed:E}){let D=S?.(),O=r&&!i,k=(n,r)=>GY(t,n,r,e);function A(e){return KY({...e,editor:t,shouldResetDismissed:E,effectiveAllowSpaces:O})}let j=t=>qY({view:t,pluginKeyRef:e});return new Vj({key:e,view:()=>eX({editor:t,pluginKey:e,items:f,renderer:D,minQueryLength:p,debounce:m,initialItems:h,placement:g,offset:_,container:v,flip:y,floatingUi:b,dismissOnOutsideClick:x,command:d,clientRectFor:k,dispatchExit:j}),state:YY({editor:t,char:n,effectiveAllowSpaces:O,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,findSuggestionMatch:w,allow:C,shouldShow:T,shouldKeepDismissed:A,pluginKey:e}),props:JY({pluginKey:e,decorationTag:s,decorationClass:c,decorationContent:l,decorationEmptyClass:u,renderer:D,dispatchExit:j})})}var rX=nX;function iX({items:e,selected:t,onHover:n}){return e.length===0?(0,U.jsx)(`div`,{className:`w-64 rounded-lg border bg-popover p-2 text-[12.5px] text-muted-foreground shadow-lg`,children:`No results`}):(0,U.jsx)(`div`,{className:`max-h-72 w-64 overflow-y-auto rounded-lg border bg-popover p-1 shadow-lg`,children:e.map((e,r)=>(0,U.jsxs)(`div`,{"data-suggestion-index":r,onMouseEnter:()=>{n(r)},className:Y(`flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left`,r===t?`bg-accent`:``),children:[e.icon===void 0?null:(0,U.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded border bg-card text-muted-foreground`,children:e.icon}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[13px] font-medium`,children:e.title}),e.subtitle===void 0?null:(0,U.jsx)(`span`,{className:`block truncate text-[11px] text-muted-foreground`,children:e.subtitle})]})]},`${e.title}-${String(r)}`))})}function aX(e){return xR.create({name:e.name,addProseMirrorPlugins(){return[rX({editor:this.editor,char:e.char,pluginKey:new Wj(e.name),command:({editor:e,range:t,props:n})=>{n.command({editor:e,range:t})},items:({query:t})=>e.getItems(t),render:()=>{let e=null,t=null,n={items:[],selected:0,command:null},r=()=>{e?.updateProps({items:n.items,selected:n.selected,onHover:e=>{n.selected=e,r()}})},i=e=>{let t=n.items[e];t!==void 0&&n.command!==null&&n.command(t)},a=e=>{if(t===null||e==null)return;let n=e.bottom+6,r=n+300>window.innerHeight;t.style.left=`${String(e.left)}px`,r?(t.style.top=`auto`,t.style.bottom=`${String(window.innerHeight-e.top+6)}px`):(t.style.bottom=`auto`,t.style.top=`${String(n)}px`)};return{onStart:o=>{n.items=o.items,n.selected=0,n.command=o.command,e=new Kz(iX,{props:{items:n.items,selected:0,onHover:e=>{n.selected=e,r()}},editor:o.editor}),t=document.createElement(`div`),t.style.position=`fixed`,t.style.zIndex=`70`,t.appendChild(e.element),t.addEventListener(`mousedown`,e=>{let t=e.target.closest(`[data-suggestion-index]`);t!==null&&(e.preventDefault(),i(Number(t.getAttribute(`data-suggestion-index`))))}),document.body.appendChild(t),a(o.clientRect?.())},onUpdate:e=>{n.items=e.items,n.command=e.command,n.selected>=e.items.length&&(n.selected=0),r(),a(e.clientRect?.())},onKeyDown:e=>{let a=e.event.key;return a===`Escape`?(t?.remove(),!0):n.items.length===0?!1:a===`ArrowUp`?(n.selected=(n.selected+n.items.length-1)%n.items.length,r(),!0):a===`ArrowDown`?(n.selected=(n.selected+1)%n.items.length,r(),!0):a===`Enter`?(i(n.selected),!0):!1},onExit:()=>{t?.remove(),e?.destroy(),t=null,e=null}}}})]}})}var oX=`size-4`,sX=[{title:`Text`,subtitle:`Plain paragraph`,icon:(0,U.jsx)(jb,{className:oX}),keywords:[`paragraph`,`p`,`body`],command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setParagraph().run()}},{title:`Heading 1`,icon:(0,U.jsx)(lte,{className:oX}),keywords:[`h1`,`title`,`big`],command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleHeading({level:1}).run()}},{title:`Heading 2`,icon:(0,U.jsx)(ute,{className:oX}),keywords:[`h2`,`subtitle`],command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleHeading({level:2}).run()}},{title:`Heading 3`,icon:(0,U.jsx)(dte,{className:oX}),keywords:[`h3`],command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleHeading({level:3}).run()}},{title:`Bullet list`,icon:(0,U.jsx)(lb,{className:oX}),keywords:[`ul`,`unordered`,`point`],command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleBulletList().run()}},{title:`Numbered list`,icon:(0,U.jsx)(cb,{className:oX}),keywords:[`ol`,`ordered`,`number`],command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleOrderedList().run()}},{title:`To-do list`,icon:(0,U.jsx)(sb,{className:oX}),keywords:[`task`,`todo`,`checkbox`,`check`],command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleTaskList().run()}},{title:`Quote`,icon:(0,U.jsx)(Sb,{className:oX}),keywords:[`blockquote`,`cite`],command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleBlockquote().run()}},{title:`Code block`,icon:(0,U.jsx)(tte,{className:oX}),keywords:[`code`,`snippet`,`pre`],command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleCodeBlock().run()}},{title:`Divider`,icon:(0,U.jsx)(mb,{className:oX}),keywords:[`hr`,`rule`,`separator`,`line`],command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setHorizontalRule().run()}},{title:`Table`,icon:(0,U.jsx)(kb,{className:oX}),keywords:[`grid`],command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()}}];function cX(e,t){let n=t.toLowerCase().trim();return n===``?e:e.filter(e=>e.title.toLowerCase().includes(n)||(e.keywords??[]).some(e=>e.includes(n)))}function lX(){return aX({name:`slashCommand`,char:`/`,getItems:e=>cX(sX,e)})}function uX(e){return aX({name:`docLink`,char:`[[`,getItems:t=>{let n=e.getProjectId();if(n===void 0)return[];let r=t.toLowerCase().trim();return e.getDocs().filter(e=>r===``||e.title.toLowerCase().includes(r)).slice(0,12).map(e=>({title:e.title,icon:(0,U.jsx)(tb,{className:oX}),command:({editor:t,range:r})=>{let i=`/projects/${n}/documents/${e.id}`;t.chain().focus().deleteRange(r).insertContent([{type:`text`,text:e.title,marks:[{type:`link`,attrs:{href:i}}]},{type:`text`,text:` `}]).run()}}))}})}var dX=`comment-draft`;function fX(e){let t=globalThis.CSS?.highlights,n=globalThis.Highlight;if(t!==void 0){if(e===null||n===void 0){t.delete(dX);return}t.set(dX,new n(e))}}var pX=new wY({headingStyle:`atx`,bulletListMarker:`-`,codeBlockStyle:`fenced`});pX.use(VY),pX.addRule(`annotatedImage`,{filter:e=>e.nodeName===`IMG`&&e.getAttribute(`data-annotations`)!==null,replacement:(e,t)=>t.outerHTML});function mX(e){let t=window.document.createElement(`template`);return t.innerHTML=e,t.content.querySelectorAll(`li`).forEach(e=>{let t=e.firstElementChild;if(t?.tagName!==`INPUT`||t.getAttribute(`type`)!==`checkbox`)return;let n=t.hasAttribute(`checked`);t.remove(),e.setAttribute(`data-type`,`taskItem`),e.setAttribute(`data-checked`,n?`true`:`false`);let r=e.firstChild;r?.nodeType===Node.TEXT_NODE&&(r.textContent=(r.textContent??``).replace(/^\s+/,``));let i=e.parentElement;(i?.tagName===`UL`||i?.tagName===`OL`)&&i.setAttribute(`data-type`,`taskList`)}),t.innerHTML}function hX(e){return mX(wE(e))}function gX(e){let t=window.document.createElement(`template`);return t.innerHTML=e,t.content.querySelectorAll(`colgroup`).forEach(e=>{e.remove()}),t.content.querySelectorAll(`th, td`).forEach(e=>{Array.from(e.children).forEach(e=>{e.tagName===`P`&&e.replaceWith(...Array.from(e.childNodes))})}),t.content.querySelectorAll(`li`).forEach(e=>{e.closest(`ul[data-type="taskList"], ol[data-type="taskList"]`)===null&&Array.from(e.children).forEach(e=>{e.tagName===`P`&&e.replaceWith(...Array.from(e.childNodes))})}),t.content.querySelectorAll(`ul[data-type="taskList"] > li[data-checked]`).forEach(e=>{let t=e.getAttribute(`data-checked`)===`true`;Array.from(e.children).forEach(e=>{e.tagName===`LABEL`&&e.remove()});let n=``,r=Array.from(e.children).find(e=>e.tagName===`DIV`);if(r!==void 0)Array.from(r.children).forEach(e=>{e.tagName===`P`&&e.replaceWith(...Array.from(e.childNodes))}),n=r.innerHTML,r.remove();else{let t=window.document.createElement(`span`);Array.from(e.childNodes).forEach(e=>t.appendChild(e.cloneNode(!0))),n=t.innerHTML}e.removeAttribute(`data-type`),e.removeAttribute(`data-checked`),e.innerHTML=`${t?`<input type="checkbox" checked>`:`<input type="checkbox">`}${n.trim()}`}),t.content.querySelectorAll(`ul[data-type="taskList"], ol[data-type="taskList"]`).forEach(e=>{e.removeAttribute(`data-type`)}),t.content.querySelectorAll(`p`).forEach(e=>{e.closest(`li, td, th`)===null&&e.textContent.trim()===``&&e.remove()}),t.innerHTML}function _X(e,t,n){let r=e.storage.imageUpload?.uploader??null,i=Array.from(t??[]).filter(e=>e.type.startsWith(`image/`));for(let t of i){let i=new FileReader;i.onload=()=>{if(typeof i.result!=`string`)return;let a=i.result;if(r!=null){let i=BC.loading(`Uploading image…`);r(a).then(r=>{BC.dismiss(i),e.chain().insertContentAt(n??e.state.selection.from,{type:`image`,attrs:{src:r,alt:t.name,originalSrc:r,annotations:`[]`}}).run()}).catch(()=>{BC.dismiss(i),BC.error(`Couldn't upload the image — embedded it inline instead.`),e.chain().insertContentAt(n??e.state.selection.from,{type:`image`,attrs:{src:a,alt:t.name,originalSrc:a,annotations:`[]`}}).run()})}else e.chain().insertContentAt(n??e.state.selection.from,{type:`image`,attrs:{src:a,alt:t.name,originalSrc:a,annotations:`[]`}}).run()},i.readAsDataURL(t)}return i.length>0}var vX=(0,H.forwardRef)(function({value:e,mode:t,minHeight:n=`12rem`,bare:r=!1,seamless:i,ariaLabel:a,onChange:o,onCommentOnSelection:s,onCreateComment:c,projectId:l,docLinks:u},d){let f=Kr(),p=(0,H.useRef)(null),m=(0,H.useRef)(!1),h=(0,H.useRef)(o);h.current=o;let g=(0,H.useRef)(u??[]),_=(0,H.useRef)(l),v=(0,H.useMemo)(()=>l===void 0?null:dB(l),[l]);(0,H.useEffect)(()=>{g.current=u??[],_.current=l},[u,l]);let[y,b]=(0,H.useState)(null),x=(0,H.useRef)(null),[S,C]=(0,H.useState)(null),[w,T]=(0,H.useState)(``),[E,D]=(0,H.useState)(!1),O=()=>{x.current=null,fX(null),C(null),T(``),D(!1)},k=()=>{let e=window.getSelection();if(e===null||e.rangeCount===0)return;let t=e.toString().trim();if(t===``)return;let n=e.getRangeAt(0).cloneRange();x.current=n,fX(n);let r=y?.top??0,i=y?.left??0;try{let e=n.getBoundingClientRect();r=e.bottom,i=e.left}catch{}C({passage:t,top:r,left:i}),T(``),b(null),e.removeAllRanges()},A=async()=>{if(c===void 0||S===null)return;let e=w.trim();if(e!==``){D(!0);try{await c({passage:S.passage,body:e}),O()}catch{D(!1)}}},j=(0,H.useMemo)(()=>{let e=[FJ.configure({link:{openOnClick:!1}}),gB,fB,yie.configure({allowedMimeTypes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`],onPaste:(e,t)=>{_X(e,t)},onDrop:(e,t,n)=>{_X(e,t,n)}}),SH,cU,sU.configure({nested:!0})];return l!==void 0&&(e.push(lX()),e.push(uX({getDocs:()=>g.current,getProjectId:()=>_.current}))),e},[l]),[M,N]=(0,H.useState)(()=>{let t=hX(e).trim();return t===``||t===`<p></p>`}),P=Iz({extensions:j,content:hX(e),editable:t===`editor`,onUpdate:({editor:e})=>{m.current=!0,N(e.isEmpty),h.current?.(e.getHTML())},editorProps:{attributes:{class:`document-editor-content`,...a===void 0?{}:{"aria-label":a}}}});(0,H.useEffect)(()=>{P.storage.imageUpload!==void 0&&(P.storage.imageUpload.uploader=v)},[P,v]),(0,H.useImperativeHandle)(d,()=>({getHTML:()=>P.getHTML(),getMarkdown:()=>pX.turndown(gX(P.getHTML())),isDirty:()=>m.current,focus:()=>P.commands.focus()}),[P]),(0,H.useEffect)(()=>{P.setEditable(t===`editor`),m.current=!1},[P,t]),(0,H.useEffect)(()=>{m.current=!1;let t=P.getHTML(),n=hX(e);t!==n&&!P.isFocused&&(P.commands.setContent(n,{emitUpdate:!1}),N(P.isEmpty))},[P,e]),(0,H.useEffect)(()=>{if(s===void 0&&c===void 0)return;let e=p.current;if(e===null)return;let t=()=>{let t=window.getSelection(),n=t?.toString().trim()??``;if(t===null||t.rangeCount===0||n===``){b(null);return}let r=t.anchorNode;if(r!==null&&!e.contains(r)){b(null);return}let i=0,a=0;try{let e=t.getRangeAt(0).getBoundingClientRect();i=e.top,a=e.left+e.width/2}catch{}b({top:i,left:a,text:n})},n=()=>{b(null)};return e.addEventListener(`mouseup`,t),e.addEventListener(`mousedown`,n),()=>{e.removeEventListener(`mouseup`,t),e.removeEventListener(`mousedown`,n)}},[s,c]),(0,H.useEffect)(()=>{if(S===null)return;let e=()=>{let e=x.current;if(e!==null)try{let t=e.getBoundingClientRect();C(e=>e===null?e:{...e,top:t.bottom,left:t.left})}catch{}};return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[S]),(0,H.useEffect)(()=>()=>{fX(null)},[]);let F=i??l!==void 0;return(0,U.jsxs)(`div`,{children:[t===`editor`?(0,U.jsx)(yX,{editor:P}):null,(0,U.jsx)(`div`,{ref:p,children:t===`reader`?(0,U.jsx)(`div`,{className:`document-reader-content`,"aria-label":a,onClick:e=>{let t=e.target.closest(`a`)?.getAttribute(`href`);t!=null&&t.startsWith(`/`)&&(e.preventDefault(),f.navigate({to:t}))},dangerouslySetInnerHTML:{__html:SD(hX(e))},style:F?{padding:`0.25rem 0`,minHeight:`calc(100vh - 16rem)`}:{lineHeight:1.6,padding:`1rem`,border:`1px solid var(--border)`,borderRadius:8,minHeight:n}}):(0,U.jsxs)(`div`,{style:{position:`relative`,...F?{padding:`0.25rem 0`,minHeight:`calc(100vh - 16rem)`}:r?{padding:`0.25rem`,minHeight:n}:{border:`1px solid var(--border)`,borderRadius:8,padding:`0.75rem 1rem`,minHeight:n}},children:[l!==void 0&&M?(0,U.jsx)(`p`,{className:`pointer-events-none absolute left-0 top-0 m-0 text-sm text-muted-foreground`,"aria-hidden":!0,children:`Write, or press / for blocks and [[ to link a doc`}):null,(0,U.jsx)(Oz,{editor:P})]})}),y!==null&&S===null&&(c!==void 0||s!==void 0)?(0,U.jsx)(`div`,{style:{position:`fixed`,top:Math.max(y.top-46,8),left:y.left,transform:`translateX(-50%)`,zIndex:50},children:(0,U.jsxs)(X,{type:`button`,size:`sm`,className:`shadow-md`,onMouseDown:e=>{e.preventDefault()},onClick:()=>{if(c!==void 0){k();return}s?.(y.text),b(null),window.getSelection()?.removeAllRanges()},children:[(0,U.jsx)(pb,{className:`size-3.5`}),` Add comment`]})}):null,S!==null&&c!==void 0?(0,U.jsxs)(`div`,{role:`dialog`,"aria-label":`Add comment`,className:`w-80 rounded-lg border bg-popover p-2.5 text-popover-foreground shadow-lg`,style:{position:`fixed`,top:S.top+8,left:S.left,maxWidth:`calc(100vw - 2rem)`,zIndex:60},children:[(0,U.jsxs)(`p`,{className:`mb-2 line-clamp-2 border-l-2 border-primary/50 pl-2 text-[12px] italic text-muted-foreground`,children:[`“`,S.passage,`”`]}),(0,U.jsx)(qD,{autoFocus:!0,value:w,onChange:e=>{T(e.target.value)},onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),O()),e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),A())},placeholder:`Add a comment…`,rows:3,className:`mb-2 text-[12.5px]`}),(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:O,children:`Cancel`}),(0,U.jsx)(X,{type:`button`,size:`sm`,disabled:w.trim()===``||E,onClick:()=>void A(),children:E?`Adding…`:`Comment`})]})]}):null]})});function yX({editor:e}){let t=(0,H.useRef)(null),n=e=>Y(`rounded border px-2 py-1 text-sm`,e?`border-border bg-muted font-semibold text-foreground`:`border-border bg-background text-foreground hover:bg-muted`);return(0,U.jsxs)(`div`,{role:`toolbar`,"aria-label":`Formatting`,className:`mb-2 flex flex-wrap gap-2`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>e.chain().focus().toggleBold().run(),"aria-pressed":e.isActive(`bold`),className:n(e.isActive(`bold`)),children:`Bold`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>e.chain().focus().toggleItalic().run(),"aria-pressed":e.isActive(`italic`),className:n(e.isActive(`italic`)),children:`Italic`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>e.chain().focus().toggleHeading({level:2}).run(),"aria-pressed":e.isActive(`heading`,{level:2}),className:n(e.isActive(`heading`,{level:2})),children:`H2`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>e.chain().focus().toggleBulletList().run(),"aria-pressed":e.isActive(`bulletList`),className:n(e.isActive(`bulletList`)),children:`List`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),className:n(e.isActive(`table`)),children:`Table`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>t.current?.click(),className:n(!1),children:`Image`}),(0,U.jsx)(`input`,{ref:t,type:`file`,accept:`image/*`,"aria-label":`Insert image`,className:`hidden`,onChange:t=>{_X(e,t.target.files),t.target.value=``}})]})}function bX(e){return e.replace(/<[^>]*>/g,``).replace(/ /g,` `).trim()!==``||e.includes(`<img`)}function xX(e){return new Date(e).toLocaleString()}function SX(){let e=window.getSelection()?.toString().trim()??``;return e===``?null:e}function CX({comment:e,onResolve:t,onDeleteRequest:n,isResolving:r,isDeleting:i}){return(0,U.jsxs)(`div`,{className:Y(`flex gap-2.5 rounded-lg border p-2.5`,e.resolved?`border-border bg-muted/40`:`border-border bg-card`),children:[(0,U.jsx)(FO,{className:`mt-0.5 size-5`,children:(0,U.jsx)(IO,{className:`rounded-md`,children:(0,U.jsx)(Ib,{className:`size-3`})})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[e.passage===null?null:(0,U.jsxs)(`p`,{className:`mb-1 text-[12px] italic text-muted-foreground`,children:[`“`,e.passage,`”`]}),(0,U.jsx)(`div`,{className:`comment-body text-[12.5px] leading-relaxed [&_a]:text-primary [&_a]:underline [&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:text-[11px] [&_li]:list-disc [&_ol]:my-1 [&_ol]:pl-4 [&_p]:my-0 [&_p+p]:mt-1.5 [&_pre]:overflow-x-auto [&_pre]:rounded [&_pre]:bg-muted [&_pre]:p-2 [&_ul]:my-1 [&_ul]:pl-4`,dangerouslySetInnerHTML:{__html:SD(wE(e.body))}}),(0,U.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-1.5`,children:[(0,U.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[xX(e.created_at),e.resolved?` · Resolved`:``]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`xs`,disabled:r||i,onClick:t,children:r?`…`:e.resolved?`Reopen`:`Resolve`}),(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Delete comment`,disabled:r||i,onClick:n,children:(0,U.jsx)(Mb,{})})]})]})]})]})}function wX({target:e,attachPassage:t=null,onPassageConsumed:n,embedded:r=!1}){let{data:i,isLoading:a,error:o}=qS(e),s=JS(e),c=YS(e),l=XS(e),[u,d]=(0,H.useState)(``),[f,p]=(0,H.useState)(0),[m,h]=(0,H.useState)(null),g=(0,H.useRef)(null),[_,v]=(0,H.useState)(!1),[y,b]=(0,H.useState)(null),[x,S]=(0,H.useState)(null);(0,H.useEffect)(()=>{t!==null&&(h(t),g.current?.focus(),n?.())},[t,n]);let C=i??[],w=C.filter(e=>!e.resolved),T=C.filter(e=>e.resolved),E=()=>{let e=SX();e===null?BC(`Select some text in the document first, then attach it.`):h(e)},D=()=>{let e=u;if(!bX(e))return;let t=m??SX();s.mutate(t===null?{body:e}:{body:e,passage:t},{onSuccess:()=>{BC(`Comment added`),d(``),p(e=>e+1),h(null)}})},O=e=>{b(e.id),c.mutate({id:e.id,input:{resolved:!e.resolved}},{onSuccess:()=>{BC(e.resolved?`Comment reopened`:`Comment resolved`)},onSettled:()=>{b(null)}})};return(0,U.jsxs)(`aside`,{className:Y(`flex flex-col gap-3`,r?`mt-3 w-full border-t pt-3`:`h-full w-72 border-l pl-4`),children:[(0,U.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,U.jsx)(`h2`,{className:`text-[12.5px] font-semibold`,children:`Comments`}),(0,U.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[w.length,` open`]})]}),(0,U.jsxs)(`div`,{className:`rounded-lg border bg-muted/30 p-2.5`,children:[m===null?null:(0,U.jsxs)(`div`,{className:`mb-2 flex items-start gap-1.5 rounded-md border bg-card p-1.5`,children:[(0,U.jsxs)(`p`,{className:`flex-1 text-[12px] italic text-muted-foreground`,children:[`“`,m,`”`]}),(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`xs`,onClick:()=>{h(null)},children:`Clear`})]}),(0,U.jsx)(vX,{ref:g,value:``,mode:`editor`,bare:!0,minHeight:`3rem`,ariaLabel:`Comment`,onChange:d},f),(0,U.jsxs)(`div`,{className:`mt-2 flex items-center justify-end gap-1.5`,children:[(0,U.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:E,children:[(0,U.jsx)(_b,{className:`size-3.5`}),` Attach selection`]}),(0,U.jsxs)(X,{type:`button`,size:`sm`,disabled:!bX(u)||s.isPending,onClick:D,children:[(0,U.jsx)(Zy,{className:`size-3.5`}),` Comment`]})]}),s.error===null?null:(0,U.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-[12px] text-destructive`,children:s.error.message})]}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto`,children:[a?(0,U.jsx)(`p`,{className:`text-[12.5px] text-muted-foreground`,children:`Loading comments…`}):null,o===null?null:(0,U.jsxs)(`p`,{role:`alert`,className:`text-[12.5px] text-destructive`,children:[`Failed to load comments: `,o.message]}),!a&&o===null&&C.length===0?(0,U.jsx)(`p`,{className:`text-[12.5px] text-muted-foreground`,children:`No comments yet — add one to leave feedback for teammates or an agent.`}):null,!a&&o===null&&w.length>0?(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(`h3`,{className:`text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Open`}),w.map(e=>(0,U.jsx)(CX,{comment:e,onResolve:()=>{O(e)},onDeleteRequest:()=>{S(e)},isResolving:c.isPending&&y===e.id,isDeleting:l.isPending&&y===e.id},e.id))]}):null,!a&&o===null&&T.length>0?(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(X,{type:`button`,variant:`link`,size:`sm`,className:`h-auto justify-start p-0 text-[12.5px]`,onClick:()=>{v(e=>!e)},children:_?`Hide resolved`:`Show resolved (${String(T.length)})`}),_?T.map(e=>(0,U.jsx)(CX,{comment:e,onResolve:()=>{O(e)},onDeleteRequest:()=>{S(e)},isResolving:c.isPending&&y===e.id,isDeleting:l.isPending&&y===e.id},e.id)):null]}):null]}),(0,U.jsx)(pO,{open:x!==null,onOpenChange:e=>{e||S(null)},title:`Delete this comment?`,description:`This cannot be undone.`,busy:l.isPending&&x!==null,onConfirm:()=>{if(x===null)return;let e=x.id;b(e),l.mutate(e,{onSuccess:()=>{BC(`Comment deleted`),S(null)},onSettled:()=>{b(null)}})}})]})}var TX=140;function EX(e){if(e===null||e.trim()===``)return null;let t=e.trim();return t.length>TX?`${t.slice(0,TX)}…`:t}function DX(e){return e===null?null:e.split(`
|
|
346
|
+
`).find(e=>e.includes(`Provenance:`))?.trim()??null}var OX={medium:{bg:`var(--s-prog-bg)`,fg:`var(--s-prog-fg)`},low:{bg:`var(--s-done-bg)`,fg:`var(--s-done-fg)`}};function kX({severity:e}){if(e===`high`)return(0,U.jsx)(`span`,{className:Y(Uy({variant:`destructive`}),`text-[10.5px] font-semibold uppercase tracking-wide`),children:e});let t=e in OX?OX[e]:{bg:`var(--muted)`,fg:`var(--muted-foreground)`};return(0,U.jsx)(`span`,{className:Y(Uy({variant:`secondary`}),`border-transparent px-2 py-0.5 text-[10.5px] font-semibold uppercase tracking-wide`),style:{backgroundColor:t.bg,color:t.fg},children:e})}function AX({title:e,count:t}){return(0,U.jsxs)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:[(0,U.jsx)(`h2`,{className:`text-[13px] font-semibold`,children:e}),t!==void 0&&t>0?(0,U.jsx)(Wy,{variant:`secondary`,className:`h-[18px] rounded-full px-2 text-[11px] font-normal text-muted-foreground`,children:t}):null]})}function jX({submission:e,projectId:t,tasks:n}){let r=rC(t),[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),u={type:`submission`,id:e.id},{data:d}=qS(u),f=(d??[]).filter(e=>!e.resolved).length;return(0,U.jsxs)(Jb,{className:`gap-0 rounded-[10px] py-0 shadow-sm`,children:[(0,U.jsxs)(Qb,{className:`flex flex-col gap-2 px-3.5 py-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-semibold`,children:e.title}),(0,U.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[e.severity===null?null:(0,U.jsx)(kX,{severity:e.severity}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.participant_name})]})]}),EX(e.body)===null?null:(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:EX(e.body)}),r.isError?(0,U.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:`Something went wrong. Please try again.`}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(X,{type:`button`,size:`sm`,disabled:r.isPending,onClick:()=>{r.mutate({id:e.id,input:{action:`accept`}},{onSuccess:()=>BC.success(`Submission approved`)})},children:r.isPending?`Approving…`:`Approve`}),(0,U.jsx)(X,{type:`button`,size:`sm`,variant:`destructive`,disabled:r.isPending,onClick:()=>{l(!0)},children:`Reject`}),(0,U.jsxs)(ww,{value:i,onValueChange:a,disabled:r.isPending,children:[(0,U.jsx)(Ew,{className:`h-8 w-44 text-xs`,children:(0,U.jsx)(Tw,{placeholder:`Select a task`})}),(0,U.jsx)(Dw,{children:n.map(e=>(0,U.jsx)(Ow,{value:e.id,children:e.label},e.id))})]}),(0,U.jsx)(X,{type:`button`,size:`sm`,variant:`outline`,disabled:r.isPending||i===``,onClick:()=>{r.mutate({id:e.id,input:{action:`accept`,link_task_id:i}},{onSuccess:()=>BC.success(`Merged into existing task`)})},children:`Merge into`})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(X,{type:`button`,variant:`link`,size:`sm`,className:`h-auto px-0 text-xs`,onClick:()=>{s(e=>!e)},"aria-expanded":o,children:o?`Hide comments`:f>0?`Comments (${String(f)} open)`:`Comments`}),o?(0,U.jsx)(wX,{target:u,embedded:!0}):null]})]}),(0,U.jsx)(pO,{open:c,onOpenChange:l,title:`Reject submission?`,description:`Reject this submission? The client isn't notified and this can't be undone.`,confirmLabel:`Reject`,busy:r.isPending,onConfirm:()=>{r.mutate({id:e.id,input:{action:`reject`}},{onSuccess:()=>{l(!1),BC.success(`Submission rejected`)}})}})]})}function MX({projectId:e,tasks:t}){let{data:n,isLoading:r,error:i}=nC(e,`pending`);return(0,U.jsxs)(`section`,{"aria-label":`Pending submissions`,className:`mb-5`,children:[(0,U.jsx)(AX,{title:`Pending submissions`,count:n?.length}),r?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):null,i?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Failed to load submissions.`}):null,!r&&!i&&(n===void 0||n.length===0)?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No pending submissions — this project has no share configured, or nothing new has come in.`}):null,n!==void 0&&n.length>0?(0,U.jsx)(`ul`,{className:`m-0 grid list-none gap-2 p-0`,children:n.map(n=>(0,U.jsx)(`li`,{children:(0,U.jsx)(jX,{submission:n,projectId:e,tasks:t})},n.id))}):null]})}function NX({projectId:e}){let{data:t,isLoading:n,error:r}=SS(e,{status:`backlog`}),i=TS();return(0,U.jsxs)(`section`,{"aria-label":`Un-triaged backlog`,className:`mb-5`,children:[(0,U.jsx)(AX,{title:`Un-triaged backlog`,count:t?.length}),n?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):null,r?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Failed to load backlog tasks.`}):null,!n&&!r&&(t===void 0||t.length===0)?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing in the backlog right now.`}):null,t!==void 0&&t.length>0?(0,U.jsx)(`ul`,{className:`m-0 grid list-none gap-2 p-0`,children:t.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(Jb,{className:`gap-0 rounded-[10px] py-0 shadow-sm`,children:(0,U.jsxs)(Qb,{className:`flex items-start justify-between gap-3 px-3.5 py-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`text-sm font-semibold`,children:e.label}),EX(e.description)===null?null:(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:EX(e.description)})]}),(0,U.jsx)(X,{type:`button`,size:`sm`,variant:`outline`,className:`shrink-0`,disabled:i.isPending,title:`Moves this backlog item into the Scope column for design and sizing.`,onClick:()=>{i.mutate({id:e.id,input:{status:`scope`}},{onSuccess:()=>BC.success(`Sent to planning`)})},children:`Send to planning`})]})})},e.id))}):null]})}function PX({projectId:e}){let{data:t,isLoading:n,error:r}=SS(e,{status:`scope`}),i=(t??[]).filter(e=>DX(e.description)!==null);return(0,U.jsxs)(`section`,{"aria-label":`Curator proposals awaiting approval`,className:`mb-5`,children:[(0,U.jsx)(AX,{title:`Curator proposals awaiting approval`,count:i.length}),n?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):null,r?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Failed to load proposals.`}):null,!n&&!r&&i.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No Curator proposals waiting right now.`}):null,i.length>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:["These are `scope` tasks the Curator proposed. Releasing a task from ",(0,U.jsx)(`code`,{children:`scope`}),` `,`to `,(0,U.jsx)(`code`,{children:`todo`}),` on the`,` `,(0,U.jsx)(Bi,{to:`/projects/$id/board`,params:{id:e},className:`font-medium text-foreground underline-offset-4 hover:underline`,children:`Board`}),` `,`is the actual approval — nothing here does that for you.`]}),(0,U.jsx)(`ul`,{className:`m-0 grid list-none gap-2 p-0`,children:i.map(t=>(0,U.jsx)(`li`,{children:(0,U.jsx)(Jb,{className:`gap-0 rounded-[10px] py-0 shadow-sm`,children:(0,U.jsxs)(Qb,{className:`flex items-start justify-between gap-3 px-3.5 py-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`text-sm font-semibold`,children:t.label}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:DX(t.description)})]}),(0,U.jsx)(Bi,{to:`/projects/$id/board`,params:{id:e},className:`shrink-0 text-xs font-medium text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:`Open Board`})]})})},t.id))})]}):null]})}function FX({projectId:e}){let{data:t}=SS(e);return(0,U.jsxs)(`div`,{children:[(0,U.jsx)(MX,{projectId:e,tasks:(t??[]).map(e=>({id:e.id,label:e.label}))}),(0,U.jsx)(NX,{projectId:e}),(0,U.jsx)(PX,{projectId:e})]})}function IX(){let{id:e}=LX.useParams(),{data:t,isLoading:n,error:r}=xS(e);return n?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading project…`}):r?(0,U.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load project: `,r.message]}):t===void 0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Project not found.`}):(0,U.jsxs)(`div`,{className:`flex h-full flex-col gap-6`,children:[(0,U.jsx)(PO,{projectId:e}),(0,U.jsx)(FX,{projectId:e}),(0,U.jsx)(`div`,{className:`relative min-h-72`,children:(0,U.jsx)(fO,{projectId:e})})]})}var LX=Ki(`/projects/$id/inbox`)({component:IX});function RX({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,U.jsx)(cv,{"data-slot":`separator`,decorative:n,orientation:t,className:Y(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px`,e),...r})}function zX(e){if(e===null)return null;try{let t=JSON.parse(e);return typeof t.kind==`string`?t.kind:null}catch{return null}}function BX(e){if(e===null)return`None`;try{let t=JSON.parse(e);if(typeof t.kind!=`string`)return e;switch(t.kind){case`gate_command`:return`Gate command: ${typeof t.command==`string`?t.command:`(missing command)`}`;case`acceptance_checklist`:{let e=(Array.isArray(t.items)?t.items:[]).map(e=>typeof e==`object`&&e&&`criterion`in e?`• ${String(e.criterion)}`:null).filter(e=>e!==null);return e.length>0?`Acceptance checklist:\n${e.join(`
|
|
347
|
+
`)}`:`Acceptance checklist (empty)`}case`human_sign_off`:return`Human sign-off required`;default:return e}}catch{return e}}function VX(e){if(!(e instanceof ja))return e instanceof Error?e.message:`Request failed`;try{let t=JSON.parse(e.body);if(t.error===`blocked_by_incomplete_tasks`){let e=t.incomplete_task_ids?.length??0;return`Cannot complete: ${String(e)} cycle task(s) still incomplete. Edit them on the Board.`}return t.error===`verification_required`?`Verification required (${t.required_kind??`unknown`}). Completion is handled by the runner, not this UI.`:e.message}catch{return e.message}}function HX({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,140px)_1fr] gap-x-4 gap-y-1 text-sm`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,U.jsx)(`dd`,{className:`m-0 text-foreground`,children:t})]})}function UX({projectId:e,goal:t}){let n=cC(e),r=lC(e),i=uC(e),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(`human`),p=zX(t.verification_surface),m=p===`human_sign_off`&&t.status!==`complete`,h=t.verification_surface===null&&t.status!==`complete`&&t.status!==`blocked`,g=()=>{o(null),i.mutate({goalId:t.id},{onSuccess:()=>{u(!1),BC(`Goal completed`)},onError:e=>{o(VX(e))}})},_=()=>{let e=d.trim();e!==``&&(o(null),i.mutate({goalId:t.id,evidence:{kind:`human_sign_off`,approved_by:e}},{onSuccess:()=>{c(!1),BC(`Goal completed`)},onError:e=>{o(VX(e))}}))},v=n.isPending||r.isPending||i.isPending,y=BX(t.verification_surface),b=y.includes(`
|
|
348
|
+
`);return(0,U.jsxs)(`div`,{className:`space-y-5`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`h2`,{className:`text-xl font-semibold leading-snug tracking-tight`,children:t.objective}),(0,U.jsx)(TO,{status:t.status})]}),(0,U.jsxs)(Jb,{children:[(0,U.jsx)(Yb,{className:`pb-2`,children:(0,U.jsx)(Xb,{className:`text-sm font-medium`,children:`Verification surface`})}),(0,U.jsx)(Qb,{children:b?(0,U.jsx)(`pre`,{className:`m-0 whitespace-pre-wrap font-sans text-sm text-foreground`,children:y}):(0,U.jsx)(`p`,{className:`m-0 text-sm text-foreground`,children:y})})]}),(t.stop_condition!==null||t.constraints!==null||t.boundaries!==null||t.iteration_policy!==null||t.budget!==null)&&(0,U.jsxs)(`dl`,{className:`space-y-3 rounded-[10px] border border-border bg-card p-4 shadow-[var(--shadow)]`,children:[t.stop_condition===null?null:(0,U.jsx)(HX,{label:`Stop condition`,value:t.stop_condition}),t.constraints===null?null:(0,U.jsx)(HX,{label:`Constraints`,value:t.constraints}),t.boundaries===null?null:(0,U.jsx)(HX,{label:`Boundaries`,value:t.boundaries}),t.iteration_policy===null?null:(0,U.jsx)(HX,{label:`Iteration policy`,value:t.iteration_policy}),t.budget===null?null:(0,U.jsx)(HX,{label:`Budget`,value:t.budget})]}),(0,U.jsxs)(`section`,{className:`space-y-2`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:`Acceptance status`}),(0,U.jsx)(DO,{verification:t.last_verification})]}),(0,U.jsxs)(`section`,{className:`space-y-3`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:`Cycle tasks`}),t.cycle_tasks.length===0?(0,U.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:`No cycle tasks.`}):(0,U.jsx)(`ul`,{className:`m-0 divide-y divide-border list-none overflow-hidden rounded-[10px] border border-border bg-card p-0 shadow-[var(--shadow)]`,children:t.cycle_tasks.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 text-sm`,children:e.label}),(0,U.jsx)(MD,{status:e.status,disabled:!0,tabIndex:-1,className:`pointer-events-none shrink-0`})]},e.id))}),(0,U.jsx)(Bi,{to:`/projects/$id/board`,params:{id:e},className:`text-sm text-primary underline-offset-4 hover:underline`,children:`Edit tasks on Board →`})]}),(0,U.jsx)(RX,{}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.status===`active`?(0,U.jsx)(X,{type:`button`,variant:`outline`,disabled:v,onClick:()=>{o(null),n.mutate(t.id,{onSuccess:()=>{BC(`Goal paused`)},onError:e=>{o(VX(e))}})},children:`Pause`}):null,t.status===`paused`?(0,U.jsx)(X,{type:`button`,variant:`outline`,disabled:v,onClick:()=>{o(null),r.mutate(t.id,{onSuccess:()=>{BC(`Goal resumed`)},onError:e=>{o(VX(e))}})},children:`Resume`}):null,m?(0,U.jsx)(X,{type:`button`,disabled:v,onClick:()=>{f(`human`),c(!0)},children:`Sign off & complete`}):null,h?(0,U.jsx)(X,{type:`button`,disabled:v,onClick:()=>{u(!0)},children:`Mark complete`}):null,p===`gate_command`||p===`acceptance_checklist`?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Completion is handled automatically by the agent runner when this goal's gate passes — there's nothing to click here.`}):null]}),a===null?null:(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}),(0,U.jsx)($x,{open:s,onOpenChange:e=>{e&&f(`human`),c(e)},children:(0,U.jsxs)(iS,{className:`max-w-sm`,children:[(0,U.jsxs)(aS,{children:[(0,U.jsx)(sS,{children:`Sign off & complete`}),(0,U.jsx)(cS,{children:`Enter the approver name to record human sign-off evidence. This action is irreversible.`})]}),(0,U.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),_()},children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`approver-name`,className:`text-xs text-muted-foreground`,children:`Approver name`}),(0,U.jsx)(nw,{id:`approver-name`,autoFocus:!0,value:d,onChange:e=>{f(e.target.value)}})]}),(0,U.jsxs)(oS,{children:[(0,U.jsx)(X,{type:`button`,variant:`outline`,onClick:()=>{c(!1)},children:`Cancel`}),(0,U.jsx)(X,{type:`submit`,disabled:v||d.trim()===``,children:`Sign off & complete`})]})]})]})}),(0,U.jsx)(pO,{open:l,onOpenChange:u,title:`Mark this goal complete?`,description:`This action is irreversible. The goal will be marked complete without additional verification.`,confirmLabel:`Mark complete`,cancelLabel:`Cancel`,busy:v,onConfirm:g})]})}function WX({projectId:e}){let{data:t,isLoading:n,error:r}=aC(e),i=sC(e),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(``),[d,f]=(0,H.useState)(``),[p,m]=(0,H.useState)(null),h=a??t?.[0]?.id??null,{data:g,isLoading:_}=oC(h??``),v=()=>{let e=l.trim();if(e===``){m(`Objective is required`);return}m(null);let t=null,n=d.trim();if(n!==``)try{JSON.parse(n),t=n}catch{m(`verification_surface must be valid JSON`);return}i.mutate({objective:e,...t===null?{}:{verification_surface:t}},{onSuccess:e=>{u(``),f(``),c(!1),o(e.id),BC(`Goal created`)},onError:e=>{m(e instanceof Error?e.message:`Failed to create goal`)}})};if(n)return(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading goals…`});if(r!==null)return(0,U.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load goals: `,r.message]});let y=t??[];return(0,U.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,U.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-baseline justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2.5`,children:[(0,U.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight`,children:`Goals`}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Durable contracts you hand to agents. Open one to watch it get built and act where a gate needs you.`})]}),(0,U.jsxs)(X,{type:`button`,size:`sm`,onClick:()=>{m(null),c(!0)},children:[(0,U.jsx)(xb,{className:`size-3.5`}),`New goal`]})]}),(0,U.jsx)($x,{open:s,onOpenChange:e=>{e&&m(null),c(e)},children:(0,U.jsxs)(iS,{className:`max-w-md`,children:[(0,U.jsx)(aS,{children:(0,U.jsx)(sS,{children:`New goal`})}),(0,U.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),v()},children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`new-goal-objective`,className:`text-xs text-muted-foreground`,children:`Objective`}),(0,U.jsx)(nw,{id:`new-goal-objective`,autoFocus:!0,value:l,onChange:e=>{u(e.target.value)}})]}),(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`new-goal-surface`,className:`text-xs text-muted-foreground`,children:`verification_surface (optional JSON)`}),(0,U.jsx)(qD,{id:`new-goal-surface`,value:d,rows:3,placeholder:`{"kind":"human_sign_off"} or {"kind":"gate_command","command":"pnpm test"}`,className:`font-mono text-xs`,onChange:e=>{f(e.target.value)}})]}),p===null?null:(0,U.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:p}),(0,U.jsxs)(oS,{children:[(0,U.jsx)(X,{type:`button`,variant:`outline`,onClick:()=>{c(!1)},children:`Cancel`}),(0,U.jsx)(X,{type:`submit`,disabled:i.isPending,children:`Create goal`})]})]})]})}),y.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No goals yet. Create one above.`}):(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-6`,children:[(0,U.jsx)(`ul`,{className:`m-0 w-64 shrink-0 list-none space-y-2.5 p-0`,children:y.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{o(e.id)},className:Y(`w-full cursor-pointer rounded-[10px] border bg-card p-3.5 text-left shadow-[var(--shadow)] transition-colors`,h===e.id?`border-[var(--border-strong)] bg-muted ring-1 ring-[var(--border-strong)]`:`border-border hover:bg-muted/50`),children:[(0,U.jsx)(`p`,{className:`mb-2 text-sm font-semibold leading-snug`,children:e.objective}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(TO,{status:e.status}),(0,U.jsx)(EO,{verification:e.last_verification})]})]})},e.id))}),(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:h===null?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a goal.`}):_?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading goal…`}):g===void 0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Goal not found.`}):(0,U.jsx)(UX,{projectId:e,goal:g})})]})]})}function GX(){let{id:e}=KX.useParams(),{data:t,isLoading:n,error:r}=xS(e);return n?(0,U.jsx)(`p`,{children:`Loading project…`}):r?(0,U.jsxs)(`p`,{role:`alert`,children:[`Failed to load project: `,r.message]}):t===void 0?(0,U.jsx)(`p`,{children:`Project not found.`}):(0,U.jsx)(WX,{projectId:e})}var KX=Ki(`/projects/$id/goals`)({component:GX});function qX(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=qX(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var JX={value:()=>{}};function YX(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new XX(n)}function XX(e){this._=e}function ZX(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}XX.prototype=YX.prototype={constructor:XX,on:function(e,t){var n=this._,r=ZX(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=QX(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=$X(n[i],e.name,t);else if(t==null)for(i in n)n[i]=$X(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new XX(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function QX(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function $X(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=JX,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var eZ={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function tZ(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),eZ.hasOwnProperty(t)?{space:eZ[t],local:e}:e}function nZ(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function rZ(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function iZ(e){var t=tZ(e);return(t.local?rZ:nZ)(t)}function aZ(){}function oZ(e){return e==null?aZ:function(){return this.querySelector(e)}}function sZ(e){typeof e!=`function`&&(e=oZ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new YQ(r,this._parents)}function cZ(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function lZ(){return[]}function uZ(e){return e==null?lZ:function(){return this.querySelectorAll(e)}}function dZ(e){return function(){return cZ(e.apply(this,arguments))}}function fZ(e){e=typeof e==`function`?dZ(e):uZ(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new YQ(r,i)}function pZ(e){return function(){return this.matches(e)}}function mZ(e){return function(t){return t.matches(e)}}var hZ=Array.prototype.find;function gZ(e){return function(){return hZ.call(this.children,e)}}function _Z(){return this.firstElementChild}function vZ(e){return this.select(e==null?_Z:gZ(typeof e==`function`?e:mZ(e)))}var yZ=Array.prototype.filter;function bZ(){return Array.from(this.children)}function xZ(e){return function(){return yZ.call(this.children,e)}}function SZ(e){return this.selectAll(e==null?bZ:xZ(typeof e==`function`?e:mZ(e)))}function CZ(e){typeof e!=`function`&&(e=pZ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new YQ(r,this._parents)}function wZ(e){return Array(e.length)}function TZ(){return new YQ(this._enter||this._groups.map(wZ),this._parents)}function EZ(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}EZ.prototype={constructor:EZ,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function DZ(e){return function(){return e}}function OZ(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new EZ(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function kZ(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new EZ(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function AZ(e){return e.__data__}function jZ(e,t){if(!arguments.length)return Array.from(this,AZ);var n=t?kZ:OZ,r=this._parents,i=this._groups;typeof e!=`function`&&(e=DZ(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=MZ(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new YQ(o,r),o._enter=s,o._exit=c,o}function MZ(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function NZ(){return new YQ(this._exit||this._groups.map(wZ),this._parents)}function PZ(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function FZ(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new YQ(s,this._parents)}function IZ(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function LZ(e){e||=RZ;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new YQ(i,this._parents).order()}function RZ(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function zZ(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function BZ(){return Array.from(this)}function VZ(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function HZ(){let e=0;for(let t of this)++e;return e}function UZ(){return!this.node()}function WZ(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function GZ(e){return function(){this.removeAttribute(e)}}function KZ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qZ(e,t){return function(){this.setAttribute(e,t)}}function JZ(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function YZ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function XZ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ZZ(e,t){var n=tZ(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?KZ:GZ:typeof t==`function`?n.local?XZ:YZ:n.local?JZ:qZ)(n,t))}function QZ(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function $Z(e){return function(){this.style.removeProperty(e)}}function eQ(e,t,n){return function(){this.style.setProperty(e,t,n)}}function tQ(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function nQ(e,t,n){return arguments.length>1?this.each((t==null?$Z:typeof t==`function`?tQ:eQ)(e,t,n??``)):rQ(this.node(),e)}function rQ(e,t){return e.style.getPropertyValue(t)||QZ(e).getComputedStyle(e,null).getPropertyValue(t)}function iQ(e){return function(){delete this[e]}}function aQ(e,t){return function(){this[e]=t}}function oQ(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function sQ(e,t){return arguments.length>1?this.each((t==null?iQ:typeof t==`function`?oQ:aQ)(e,t)):this.node()[e]}function cQ(e){return e.trim().split(/^|\s+/)}function lQ(e){return e.classList||new uQ(e)}function uQ(e){this._node=e,this._names=cQ(e.getAttribute(`class`)||``)}uQ.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function dQ(e,t){for(var n=lQ(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function fQ(e,t){for(var n=lQ(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function pQ(e){return function(){dQ(this,e)}}function mQ(e){return function(){fQ(this,e)}}function hQ(e,t){return function(){(t.apply(this,arguments)?dQ:fQ)(this,e)}}function gQ(e,t){var n=cQ(e+``);if(arguments.length<2){for(var r=lQ(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?hQ:t?pQ:mQ)(n,t))}function _Q(){this.textContent=``}function vQ(e){return function(){this.textContent=e}}function yQ(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function bQ(e){return arguments.length?this.each(e==null?_Q:(typeof e==`function`?yQ:vQ)(e)):this.node().textContent}function xQ(){this.innerHTML=``}function SQ(e){return function(){this.innerHTML=e}}function CQ(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function wQ(e){return arguments.length?this.each(e==null?xQ:(typeof e==`function`?CQ:SQ)(e)):this.node().innerHTML}function TQ(){this.nextSibling&&this.parentNode.appendChild(this)}function EQ(){return this.each(TQ)}function DQ(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function OQ(){return this.each(DQ)}function kQ(e){var t=typeof e==`function`?e:iZ(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function AQ(){return null}function jQ(e,t){var n=typeof e==`function`?e:iZ(e),r=t==null?AQ:typeof t==`function`?t:oZ(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function MQ(){var e=this.parentNode;e&&e.removeChild(this)}function NQ(){return this.each(MQ)}function PQ(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function FQ(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function IQ(e){return this.select(e?FQ:PQ)}function LQ(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function RQ(e){return function(t){e.call(this,t,this.__data__)}}function zQ(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function BQ(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function VQ(e,t,n){return function(){var r=this.__on,i,a=RQ(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function HQ(e,t,n){var r=zQ(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?VQ:BQ,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function UQ(e,t,n){var r=QZ(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function WQ(e,t){return function(){return UQ(this,e,t)}}function GQ(e,t){return function(){return UQ(this,e,t.apply(this,arguments))}}function KQ(e,t){return this.each((typeof t==`function`?GQ:WQ)(e,t))}function*qQ(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var JQ=[null];function YQ(e,t){this._groups=e,this._parents=t}function XQ(){return new YQ([[document.documentElement]],JQ)}function ZQ(){return this}YQ.prototype=XQ.prototype={constructor:YQ,select:sZ,selectAll:fZ,selectChild:vZ,selectChildren:SZ,filter:CZ,data:jZ,enter:TZ,exit:NZ,join:PZ,merge:FZ,selection:ZQ,order:IZ,sort:LZ,call:zZ,nodes:BZ,node:VZ,size:HZ,empty:UZ,each:WZ,attr:ZZ,style:nQ,property:sQ,classed:gQ,text:bQ,html:wQ,raise:EQ,lower:OQ,append:kQ,insert:jQ,remove:NQ,clone:IQ,datum:LQ,on:HQ,dispatch:KQ,[Symbol.iterator]:qQ};function QQ(e){return typeof e==`string`?new YQ([[document.querySelector(e)]],[document.documentElement]):new YQ([[e]],JQ)}function $Q(e){let t;for(;t=e.sourceEvent;)e=t;return e}function e$(e,t){if(e=$Q(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var t$={passive:!1},n$={capture:!0,passive:!1};function r$(e){e.stopImmediatePropagation()}function i$(e){e.preventDefault(),e.stopImmediatePropagation()}function a$(e){var t=e.document.documentElement,n=QQ(e).on(`dragstart.drag`,i$,n$);`onselectstart`in t?n.on(`selectstart.drag`,i$,n$):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function o$(e,t){var n=e.document.documentElement,r=QQ(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,i$,n$),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var s$=e=>()=>e;function c$(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}c$.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function l$(e){return!e.ctrlKey&&!e.button}function u$(){return this.parentNode}function d$(e,t){return t??{x:e.x,y:e.y}}function f$(){return navigator.maxTouchPoints||`ontouchstart`in this}function p$(){var e=l$,t=u$,n=d$,r=f$,i={},a=YX(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,t$).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(QQ(n.view).on(`mousemove.drag`,m,n$).on(`mouseup.drag`,h,n$),a$(n.view),r$(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(i$(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){QQ(e.view).on(`mousemove.drag mouseup.drag`,null),o$(e.view,l),i$(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(r$(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(i$(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(r$(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=e$(l||r,t),p,m,h;if((h=n.call(e,new c$(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=e$(l||a,t),_=o;break}u.call(r,e,new c$(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:s$(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:s$(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:s$(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:s$(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function m$(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function h$(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function g$(){}var _$=.7,v$=1/_$,y$=`\\s*([+-]?\\d+)\\s*`,b$=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,x$=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,S$=/^#([0-9a-f]{3,8})$/,C$=RegExp(`^rgb\\(${y$},${y$},${y$}\\)$`),w$=RegExp(`^rgb\\(${x$},${x$},${x$}\\)$`),T$=RegExp(`^rgba\\(${y$},${y$},${y$},${b$}\\)$`),E$=RegExp(`^rgba\\(${x$},${x$},${x$},${b$}\\)$`),D$=RegExp(`^hsl\\(${b$},${x$},${x$}\\)$`),O$=RegExp(`^hsla\\(${b$},${x$},${x$},${b$}\\)$`),k$={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};m$(g$,P$,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:A$,formatHex:A$,formatHex8:j$,formatHsl:M$,formatRgb:N$,toString:N$});function A$(){return this.rgb().formatHex()}function j$(){return this.rgb().formatHex8()}function M$(){return q$(this).formatHsl()}function N$(){return this.rgb().formatRgb()}function P$(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=S$.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?F$(t):n===3?new z$(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?I$(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?I$(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=C$.exec(e))?new z$(t[1],t[2],t[3],1):(t=w$.exec(e))?new z$(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=T$.exec(e))?I$(t[1],t[2],t[3],t[4]):(t=E$.exec(e))?I$(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=D$.exec(e))?K$(t[1],t[2]/100,t[3]/100,1):(t=O$.exec(e))?K$(t[1],t[2]/100,t[3]/100,t[4]):k$.hasOwnProperty(e)?F$(k$[e]):e===`transparent`?new z$(NaN,NaN,NaN,0):null}function F$(e){return new z$(e>>16&255,e>>8&255,e&255,1)}function I$(e,t,n,r){return r<=0&&(e=t=n=NaN),new z$(e,t,n,r)}function L$(e){return e instanceof g$||(e=P$(e)),e?(e=e.rgb(),new z$(e.r,e.g,e.b,e.opacity)):new z$}function R$(e,t,n,r){return arguments.length===1?L$(e):new z$(e,t,n,r??1)}function z$(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}m$(z$,R$,h$(g$,{brighter(e){return e=e==null?v$:v$**+e,new z$(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?_$:_$**+e,new z$(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new z$(W$(this.r),W$(this.g),W$(this.b),U$(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:B$,formatHex:B$,formatHex8:V$,formatRgb:H$,toString:H$}));function B$(){return`#${G$(this.r)}${G$(this.g)}${G$(this.b)}`}function V$(){return`#${G$(this.r)}${G$(this.g)}${G$(this.b)}${G$((isNaN(this.opacity)?1:this.opacity)*255)}`}function H$(){let e=U$(this.opacity);return`${e===1?`rgb(`:`rgba(`}${W$(this.r)}, ${W$(this.g)}, ${W$(this.b)}${e===1?`)`:`, ${e})`}`}function U$(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function W$(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function G$(e){return e=W$(e),(e<16?`0`:``)+e.toString(16)}function K$(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Y$(e,t,n,r)}function q$(e){if(e instanceof Y$)return new Y$(e.h,e.s,e.l,e.opacity);if(e instanceof g$||(e=P$(e)),!e)return new Y$;if(e instanceof Y$)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new Y$(o,s,c,e.opacity)}function J$(e,t,n,r){return arguments.length===1?q$(e):new Y$(e,t,n,r??1)}function Y$(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}m$(Y$,J$,h$(g$,{brighter(e){return e=e==null?v$:v$**+e,new Y$(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?_$:_$**+e,new Y$(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new z$(Q$(e>=240?e-240:e+120,i,r),Q$(e,i,r),Q$(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Y$(X$(this.h),Z$(this.s),Z$(this.l),U$(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=U$(this.opacity);return`${e===1?`hsl(`:`hsla(`}${X$(this.h)}, ${Z$(this.s)*100}%, ${Z$(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function X$(e){return e=(e||0)%360,e<0?e+360:e}function Z$(e){return Math.max(0,Math.min(1,e||0))}function Q$(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var $$=e=>()=>e;function e1(e,t){return function(n){return e+n*t}}function t1(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function n1(e){return(e=+e)==1?r1:function(t,n){return n-t?t1(t,n,e):$$(isNaN(t)?n:t)}}function r1(e,t){var n=t-e;return n?e1(e,n):$$(isNaN(e)?t:e)}var i1=(function e(t){var n=n1(t);function r(e,t){var r=n((e=R$(e)).r,(t=R$(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=r1(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function a1(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function o1(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function s1(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=g1(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function c1(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function l1(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function u1(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=g1(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var d1=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,f1=new RegExp(d1.source,`g`);function p1(e){return function(){return e}}function m1(e){return function(t){return e(t)+``}}function h1(e,t){var n=d1.lastIndex=f1.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=d1.exec(e))&&(i=f1.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:l1(r,i)})),n=f1.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?m1(c[0].x):p1(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function g1(e,t){var n=typeof t,r;return t==null||n===`boolean`?$$(t):(n===`number`?l1:n===`string`?(r=P$(t))?(t=r,i1):h1:t instanceof P$?i1:t instanceof Date?c1:o1(t)?a1:Array.isArray(t)?s1:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?u1:l1)(e,t)}var _1=180/Math.PI,v1={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function y1(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*_1,skewX:Math.atan(c)*_1,scaleX:o,scaleY:s}}var b1;function x1(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?v1:y1(t.a,t.b,t.c,t.d,t.e,t.f)}function S1(e){return e==null||(b1||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),b1.setAttribute(`transform`,e),!(e=b1.transform.baseVal.consolidate()))?v1:(e=e.matrix,y1(e.a,e.b,e.c,e.d,e.e,e.f))}function C1(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:l1(e,i)},{i:c-2,x:l1(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:l1(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:l1(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:l1(e,n)},{i:s-2,x:l1(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var w1=C1(x1,`px, `,`px)`,`deg)`),T1=C1(S1,`, `,`)`,`)`),E1=1e-12;function D1(e){return((e=Math.exp(e))+1/e)/2}function O1(e){return((e=Math.exp(e))-1/e)/2}function k1(e){return((e=Math.exp(2*e))-1)/(e+1)}var A1=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<E1)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=D1(y),c=s/(n*g)*(i*k1(t*r+y)-O1(y));return[a+c*d,o+c*f,s*i/D1(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),j1=0,M1=0,N1=0,P1=1e3,F1,I1,L1=0,R1=0,z1=0,B1=typeof performance==`object`&&performance.now?performance:Date,V1=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function H1(){return R1||=(V1(U1),B1.now()+z1)}function U1(){R1=0}function W1(){this._call=this._time=this._next=null}W1.prototype=G1.prototype={constructor:W1,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?H1():+n)+(t==null?0:+t),!this._next&&I1!==this&&(I1?I1._next=this:F1=this,I1=this),this._call=e,this._time=n,X1()},stop:function(){this._call&&(this._call=null,this._time=1/0,X1())}};function G1(e,t,n){var r=new W1;return r.restart(e,t,n),r}function K1(){H1(),++j1;for(var e=F1,t;e;)(t=R1-e._time)>=0&&e._call.call(void 0,t),e=e._next;--j1}function q1(){R1=(L1=B1.now())+z1,j1=M1=0;try{K1()}finally{j1=0,Y1(),R1=0}}function J1(){var e=B1.now(),t=e-L1;t>P1&&(z1-=t,L1=e)}function Y1(){for(var e,t=F1,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:F1=n);I1=e,X1(r)}function X1(e){j1||(M1&&=clearTimeout(M1),e-R1>24?(e<1/0&&(M1=setTimeout(q1,e-B1.now()-z1)),N1&&=clearInterval(N1)):(N1||=(L1=B1.now(),setInterval(J1,P1)),j1=1,V1(q1)))}function Z1(e,t,n){var r=new W1;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Q1=YX(`start`,`end`,`cancel`,`interrupt`),$1=[];function e0(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;i0(e,n,{name:t,index:r,group:i,on:Q1,tween:$1,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function t0(e,t){var n=r0(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function n0(e,t){var n=r0(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function r0(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function i0(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=G1(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Z1(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(Z1(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function a0(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function o0(e){return this.each(function(){a0(this,e)})}function s0(e,t){var n,r;return function(){var i=n0(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function c0(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=n0(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function l0(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=r0(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?s0:c0)(n,e,t))}function u0(e,t,n){var r=e._id;return e.each(function(){var e=n0(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return r0(e,r).value[t]}}function d0(e,t){var n;return(typeof t==`number`?l1:t instanceof P$?i1:(n=P$(t))?(t=n,i1):h1)(e,t)}function f0(e){return function(){this.removeAttribute(e)}}function p0(e){return function(){this.removeAttributeNS(e.space,e.local)}}function m0(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function h0(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function g0(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function _0(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function v0(e,t){var n=tZ(e),r=n===`transform`?T1:d0;return this.attrTween(e,typeof t==`function`?(n.local?_0:g0)(n,r,u0(this,`attr.`+e,t)):t==null?(n.local?p0:f0)(n):(n.local?h0:m0)(n,r,t))}function y0(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function b0(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function x0(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&b0(e,i)),n}return i._value=t,i}function S0(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&y0(e,i)),n}return i._value=t,i}function C0(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=tZ(e);return this.tween(n,(r.local?x0:S0)(r,t))}function w0(e,t){return function(){t0(this,e).delay=+t.apply(this,arguments)}}function T0(e,t){return t=+t,function(){t0(this,e).delay=t}}function E0(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?w0:T0)(t,e)):r0(this.node(),t).delay}function D0(e,t){return function(){n0(this,e).duration=+t.apply(this,arguments)}}function O0(e,t){return t=+t,function(){n0(this,e).duration=t}}function k0(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?D0:O0)(t,e)):r0(this.node(),t).duration}function A0(e,t){if(typeof t!=`function`)throw Error();return function(){n0(this,e).ease=t}}function j0(e){var t=this._id;return arguments.length?this.each(A0(t,e)):r0(this.node(),t).ease}function M0(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();n0(this,e).ease=n}}function N0(e){if(typeof e!=`function`)throw Error();return this.each(M0(this._id,e))}function P0(e){typeof e!=`function`&&(e=pZ(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new l2(r,this._parents,this._name,this._id)}function F0(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new l2(o,this._parents,this._name,this._id)}function I0(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function L0(e,t,n){var r,i,a=I0(t)?t0:n0;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function R0(e,t){var n=this._id;return arguments.length<2?r0(this.node(),n).on.on(e):this.each(L0(n,e,t))}function z0(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function B0(){return this.on(`end.remove`,z0(this._id))}function V0(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=oZ(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,e0(l[f],t,n,f,l,r0(u,n)));return new l2(a,this._parents,t,n)}function H0(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=uZ(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=r0(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&e0(p,t,n,h,f,m);a.push(f),o.push(u)}return new l2(a,o,t,n)}var U0=XQ.prototype.constructor;function W0(){return new U0(this._groups,this._parents)}function G0(e,t){var n,r,i;return function(){var a=rQ(this,e),o=(this.style.removeProperty(e),rQ(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function K0(e){return function(){this.style.removeProperty(e)}}function q0(e,t,n){var r,i=n+``,a;return function(){var o=rQ(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function J0(e,t,n){var r,i,a;return function(){var o=rQ(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),rQ(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Y0(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=n0(this,e),l=c.on,u=c.value[a]==null?s||=K0(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function X0(e,t,n){var r=(e+=``)==`transform`?w1:d0;return t==null?this.styleTween(e,G0(e,r)).on(`end.style.`+e,K0(e)):typeof t==`function`?this.styleTween(e,J0(e,r,u0(this,`style.`+e,t))).each(Y0(this._id,e)):this.styleTween(e,q0(e,r,t),n).on(`end.style.`+e,null)}function Z0(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Q0(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Z0(e,a,n)),r}return a._value=t,a}function $0(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,Q0(e,t,n??``))}function e2(e){return function(){this.textContent=e}}function t2(e){return function(){var t=e(this);this.textContent=t??``}}function n2(e){return this.tween(`text`,typeof e==`function`?t2(u0(this,`text`,e)):e2(e==null?``:e+``))}function r2(e){return function(t){this.textContent=e.call(this,t)}}function i2(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&r2(r)),t}return r._value=e,r}function a2(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,i2(e))}function o2(){for(var e=this._name,t=this._id,n=d2(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=r0(c,t);e0(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new l2(r,this._parents,e,n)}function s2(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=n0(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var c2=0;function l2(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function u2(e){return XQ().transition(e)}function d2(){return++c2}var f2=XQ.prototype;l2.prototype=u2.prototype={constructor:l2,select:V0,selectAll:H0,selectChild:f2.selectChild,selectChildren:f2.selectChildren,filter:P0,merge:F0,selection:W0,transition:o2,call:f2.call,nodes:f2.nodes,node:f2.node,size:f2.size,empty:f2.empty,each:f2.each,on:R0,attr:v0,attrTween:C0,style:X0,styleTween:$0,text:n2,textTween:a2,remove:B0,tween:l0,delay:E0,duration:k0,ease:j0,easeVarying:N0,end:s2,[Symbol.iterator]:f2[Symbol.iterator]};function p2(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var m2={time:null,delay:0,duration:250,ease:p2};function h2(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function g2(e){var t,n;e instanceof l2?(t=e._id,e=e._name):(t=d2(),(n=m2).time=H1(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&e0(c,e,t,l,o,n||h2(c,t));return new l2(r,this._parents,e,t)}XQ.prototype.interrupt=o0,XQ.prototype.transition=g2;var _2=e=>()=>e;function v2(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function y2(e,t,n){this.k=e,this.x=t,this.y=n}y2.prototype={constructor:y2,scale:function(e){return e===1?this:new y2(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new y2(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var b2=new y2(1,0,0);x2.prototype=y2.prototype;function x2(e){for(;!e.__zoom;)if(!(e=e.parentNode))return b2;return e.__zoom}function S2(e){e.stopImmediatePropagation()}function C2(e){e.preventDefault(),e.stopImmediatePropagation()}function w2(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function T2(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function E2(){return this.__zoom||b2}function D2(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function O2(){return navigator.maxTouchPoints||`ontouchstart`in this}function k2(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function A2(){var e=w2,t=T2,n=k2,r=D2,i=O2,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=A1,l=YX(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,E2).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,E2),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(b2.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new y2(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new y2(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new y2(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=QQ(this.that).datum();l.call(e,this.that,new v2(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=e$(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],a0(this),s.start();C2(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=QQ(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=e$(t,i),l=t.clientX,u=t.clientY;a$(t.view),S2(t),a.mouse=[c,this.__zoom.invert(c)],a0(this),a.start();function d(e){if(C2(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=e$(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),o$(e.view,a.moved),C2(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=e$(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);C2(r),s>0?QQ(this).transition().duration(s).call(x,d,c,r):QQ(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(S2(t),s=0;s<i;++s)c=r[s],l=e$(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),a0(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(C2(e),s=0;s<a;++s)c=i[s],l=e$(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(S2(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=e$(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=QQ(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:_2(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:_2(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:_2(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:_2([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var j2={error001:(e=`react`)=>`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},M2=[[-1/0,-1/0],[1/0,1/0]],N2=[`Enter`,` `,`Escape`],P2={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},F2;(function(e){e.Strict=`strict`,e.Loose=`loose`})(F2||={});var I2;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(I2||={});var L2;(function(e){e.Partial=`partial`,e.Full=`full`})(L2||={});var R2={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},z2;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(z2||={});var B2;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(B2||={});var V2;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(V2||={});var H2={[V2.Left]:V2.Right,[V2.Right]:V2.Left,[V2.Top]:V2.Bottom,[V2.Bottom]:V2.Top};function U2(e){return e===null?null:e?`valid`:`invalid`}var W2=e=>`id`in e&&`source`in e&&`target`in e,G2=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),K2=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),q2=(e,t=[0,0])=>{let{width:n,height:r}=E4(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},J2=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:l4(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):K2(n)?n:t.nodeLookup.get(n.id)),s4(e,i?d4(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Y2=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=s4(n,d4(e)),r=!0)}),r?l4(n):{x:0,y:0,width:0,height:0}},X2=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s={...v4(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??null,l=e.height??t.height??t.initialHeight??null,u=p4(s,u4(t)),d=(i??0)*(l??0),f=a&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&c.push(t)}return c},Z2=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Q2(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function $2({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=C4(Y2(Q2(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function e4({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,j2.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&T4(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=T4(d)?r4(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,j2.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function t4({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=Z2(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var n4=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),r4=(e={x:0,y:0},t,n)=>({x:n4(e.x,t[0][0],t[1][0]-(n?.width??0)),y:n4(e.y,t[0][1],t[1][1]-(n?.height??0))});function i4(e,t,n){let{width:r,height:i}=E4(n),{x:a,y:o}=n.internals.positionAbsolute;return r4(e,[[a,o],[a+r,o+i]],t)}var a4=(e,t,n)=>e<t?n4(Math.abs(e-t),1,t)/t:e>n?-n4(Math.abs(e-n),1,t)/t:0,o4=(e,t,n=15,r=40)=>[a4(e.x,r,t.width-r)*n,a4(e.y,r,t.height-r)*n],s4=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),c4=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),l4=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),u4=(e,t=[0,0])=>{let{x:n,y:r}=K2(e)?e.internals.positionAbsolute:q2(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},d4=(e,t=[0,0])=>{let{x:n,y:r}=K2(e)?e.internals.positionAbsolute:q2(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},f4=(e,t)=>l4(s4(c4(e),c4(t))),p4=(e,t)=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},m4=e=>h4(e.width)&&h4(e.height)&&h4(e.x)&&h4(e.y),h4=e=>!isNaN(e)&&isFinite(e),g4=(e,t)=>(e,t)=>{},_4=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),v4=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?_4(s,o):s},y4=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function b4(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function x4(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=b4(e,n),i=b4(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=b4(e.top??e.y??0,n),i=b4(e.bottom??e.y??0,n),a=b4(e.left??e.x??0,t),o=b4(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function S4(e,t,n,r,i,a){let{x:o,y:s}=y4(e,[t,n,r]),{x:c,y:l}=y4({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var C4=(e,t,n,r,i,a)=>{let o=x4(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=n4(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=S4(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},w4=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function T4(e){return e!=null&&e!==`parent`}function E4(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function D4(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function O4(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function k4(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function A4(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function j4(e){return{...P2,...e||{}}}function M4(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=R4(e),s=v4({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?_4(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var N4=e=>({width:e.offsetWidth,height:e.offsetHeight}),P4=e=>e?.getRootNode?.()||window?.document,F4=[`INPUT`,`SELECT`,`TEXTAREA`];function I4(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?F4.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var L4=e=>`clientX`in e,R4=(e,t)=>{let n=L4(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},z4=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...N4(t)}})};function B4({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function V4(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function H4({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case V2.Left:return[t-V4(t-r,a),n];case V2.Right:return[t+V4(r-t,a),n];case V2.Top:return[t,n-V4(n-i,a)];case V2.Bottom:return[t,n+V4(i-n,a)]}}function U4({sourceX:e,sourceY:t,sourcePosition:n=V2.Bottom,targetX:r,targetY:i,targetPosition:a=V2.Top,curvature:o=.25}){let[s,c]=H4({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=H4({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=B4({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function W4({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function G4({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function K4({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=s4(d4(e),d4(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),p4({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},l4(a))>0}var q4=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,J4=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Y4=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,j2.error006()),t;let r=n.getEdgeId||q4,i;return i=W2(e)?{...e}:{...e,id:r(e)},J4(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function X4({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=W4({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var Z4={[V2.Left]:{x:-1,y:0},[V2.Right]:{x:1,y:0},[V2.Top]:{x:0,y:-1},[V2.Bottom]:{x:0,y:1}},Q4=({source:e,sourcePosition:t=V2.Bottom,target:n})=>t===V2.Left||t===V2.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},$4=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function e3({source:e,sourcePosition:t=V2.Bottom,target:n,targetPosition:r=V2.Top,center:i,offset:a,stepPosition:o}){let s=Z4[t],c=Z4[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=Q4({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=W4({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function t3(e,t,n,r){let i=Math.min($4(e,t)/2,$4(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function n3({sourceX:e,sourceY:t,sourcePosition:n=V2.Bottom,targetX:r,targetY:i,targetPosition:a=V2.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=e3({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=t3(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function r3(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function i3(e){let{sourceNode:t,targetNode:n}=e;if(!r3(t)||!r3(n))return null;let r=t.internals.handleBounds||a3(t.handles),i=n.internals.handleBounds||a3(n.handles),a=s3(r?.source??[],e.sourceHandle),o=s3(e.connectionMode===F2.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,j2.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||V2.Bottom,c=o?.position||V2.Top,l=o3(t,a,s),u=o3(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function a3(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function o3(e,t,n=V2.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??E4(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case V2.Top:return{x:i+o/2,y:a};case V2.Right:return{x:i+o,y:a+s/2};case V2.Bottom:return{x:i+o/2,y:a+s};case V2.Left:return{x:i,y:a+s/2}}}function s3(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function c3(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function l3(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=c3(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var u3=1e3,d3=10,f3={nodeOrigin:[0,0],nodeExtent:M2,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},p3={...f3,checkEquality:!0};function m3(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function h3(e,t,n){let r=m3(f3,n);for(let n of e.values())if(n.parentId)b3(n,e,t,r);else{let e=r4(q2(n,r.nodeOrigin),T4(n.extent)?n.extent:r.nodeExtent,E4(n));n.internals.positionAbsolute=e}}function g3(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function _3(e){return e===`manual`}function v3(e,t,n,r={}){let i=m3(p3,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!_3(i.zIndexMode)?u3:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=r4(q2(u,i.nodeOrigin),T4(u.extent)?u.extent:i.nodeExtent,E4(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:g3(u,e),z:x3(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&b3(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function y3(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function b3(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=m3(f3,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}y3(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*d3),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=S3(e,u,o,s,a&&!_3(c)?u3:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function x3(e,t,n){let r=h4(e.zIndex)?e.zIndex:0;return _3(n)?r:r+(e.selected?t:0)}function S3(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=E4(e),l=q2(e,n),u=T4(e.extent)?r4(l,e.extent,c):l,d=r4({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=i4(d,c,t));let f=x3(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function C3(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=f4(a.get(n.parentId)?.expandedRect??u4(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=E4(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function w3(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=N4(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=T4(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;e.parentId&&e.extent===`parent`?h=i4(h,s,t.get(e.parentId)):m&&(h=r4(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:z4(`source`,r.nodeElement,p,d,e.id),target:z4(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&b3(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:u4(g,i)}))}}if(f.length>0){let e=C3(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function T3({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function E3(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function D3(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;E3(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),E3(`target`,s,c,e,i,o),t.set(r.id,r)}}function O3(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:O3(n,t):!1}function k3(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function A3(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!O3(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function j3({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function M3({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=_4(a,t);return{x:o.x-a.x,y:o.y-a.y}}function N3({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=QQ(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?c4(Y2(s)):null,x=v&&l?M3({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:_4(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=e4({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=j3({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=o4(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=M4(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=A3(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=j3({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=p$().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=M4(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=R4(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=M4(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=R4(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=R4(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=j3({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!k3(t,`.${g}`,v))&&(!_||k3(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function P3(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())p4(i,u4(e))>0&&r.push(e);return r}var F3=250;function I3(e,t,n,r){let i=[],a=1/0,o=P3(e,n,t+F3);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=o3(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function L3(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...o3(o,c,c.position,!0)}:c}function R3(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function z3(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var B3=()=>!0;function V3(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=B3,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=P4(e.target),E=0,D,{x:O,y:k}=R4(e),A=R3(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=L3(i,A,r,c,t);if(!N)return;let P=R4(e,j),F=!1,I=null,L=!1,ee=null;function te(){if(!u||!j)return;let[e,t]=o4(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(te)}let ne={...N,nodeId:i,type:A,position:N.position},R=c.get(i),z={inProgress:!0,isValid:null,from:o3(R,ne,V2.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:R,to:P,toHandle:null,toPosition:H2[ne.position],toNode:null,pointer:P};function B(){M=!0,y(z),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&B();function re(e){if(!M){let{x:t,y:n}=R4(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;B()}if(!x()||!ne){V(e);return}let a=b();P=R4(e,j),D=I3(v4(P,a,!1,[1,1]),n,c,ne),F||=(te(),!0);let s=H3(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});ee=s.handleDomNode,I=s.connection,L=z3(!!D,s.isValid);let u=c.get(i),f=u?o3(u,ne,V2.Left,!0):z.from,p={...z,from:f,isValid:L,to:s.toHandle&&L?y4({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:H2[ne.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),z=p}function V(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||ee)&&I&&L&&h?.(I);let{inProgress:t,...n}=z,r={...n,toPosition:z.toHandle?z.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),F=!1,L=!1,I=null,ee=null,T.removeEventListener(`mousemove`,re),T.removeEventListener(`mouseup`,V),T.removeEventListener(`touchmove`,re),T.removeEventListener(`touchend`,V)}}T.addEventListener(`mousemove`,re),T.addEventListener(`mouseup`,V),T.addEventListener(`touchmove`,re),T.addEventListener(`touchend`,V)}function H3(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=B3,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=R4(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=R3(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===F2.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=L3(t,e,a,u,n,!0)}return _}var U3={onPointerDown:V3,isValid:H3};function W3({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=QQ(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&w4()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=A2().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:e$}}var G3=e=>({x:e.x,y:e.y,zoom:e.k}),K3=({x:e,y:t,zoom:n})=>b2.translate(e,t).scale(n),q3=(e,t)=>e.target.closest(`.${t}`),J3=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Y3=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,X3=(e,t=0,n=Y3,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},Z3=e=>{let t=e.ctrlKey&&w4()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Q3({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(q3(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=e$(u),t=d*2**Z3(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===I2.Vertical?0:u.deltaX*f,m=i===I2.Horizontal?0:u.deltaY*f;!w4()&&u.shiftKey&&i!==I2.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=G3(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s?.(u,h))}}function $3({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=q3(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function e6({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=G3(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function t6({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&J3(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,G3(a.transform))}}function n6({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&J3(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=G3(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function r6({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(q3(d,`${l}-flow__node`)||q3(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||q3(d,s)&&m||q3(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function i6({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=A2().scaleExtent([t,n]).translateExtent(r),f=QQ(e).call(d);v({x:i.x,y:i.y,zoom:n4(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let p=f.on(`wheel.zoom`),m=f.on(`dblclick.zoom`);d.wheelDelta(Z3);async function h(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?g1:A1).transform(X3(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function g({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:h,panOnScrollSpeed:g,preventScrolling:v,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&_();let O=i&&!S&&!r;d.clickDistance(D?1/0:!h4(E)||E<0?0:E);let k=O?Q3({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:h,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):$3({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});f.on(`wheel.zoom`,k,{passive:!1});let A=e6({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});d.on(`start`,A);let j=t6({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});d.on(`zoom`,j);let M=n6({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});d.on(`end`,M);let N=r6({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});d.filter(N),x?f.on(`dblclick.zoom`,m):f.on(`dblclick.zoom`,null)}function _(){d.on(`zoom`,null)}async function v(e,t,n){let r=K3(e),i=d?.constrain()(r,t,n);return i&&await h(i),i}async function y(e,t){let n=K3(e);return await h(n,t),n}function b(e){if(f){let t=K3(e),n=f.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&d?.transform(f,t,null,{sync:!0})}}function x(){let e=f?x2(f.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function S(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?g1:A1).scaleTo(X3(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function C(e,t){return f?new Promise(n=>{d?.interpolate(t?.interpolate===`linear`?g1:A1).scaleBy(X3(f,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function w(e){d?.scaleExtent(e)}function T(e){d?.translateExtent(e)}function E(e){let t=!h4(e)||e<0?0:e;d?.clickDistance(t)}return{update:g,destroy:_,setViewport:y,setViewportConstrained:v,getViewport:x,scaleTo:S,scaleBy:C,setScaleExtent:w,setTranslateExtent:T,syncViewport:b,setClickDistance:E}}var a6;(function(e){e.Line=`line`,e.Handle=`handle`})(a6||={});function o6({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function s6(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function c6(e,t){return Math.max(0,t-e)}function l6(e,t){return Math.max(0,e-t)}function u6(e,t,n){return Math.max(0,t-e,e-n)}function d6(e,t){return e?!t:t}function f6(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=u6(E,h,g),j=u6(D,_,v);if(o){let e=0,t=0;c&&w<0?e=c6(y+w+O,o[0][0]):!c&&w>0&&(e=l6(y+E+O,o[1][0])),l&&T<0?t=c6(b+T+k,o[0][1]):!l&&T>0&&(t=l6(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=l6(y+w,s[0][0]):!c&&w<0&&(e=c6(y+E,s[1][0])),l&&T>0?t=l6(b+T,s[0][1]):!l&&T<0&&(t=c6(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=u6(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?l6(b+k+E/C,o[1][1])*C:c6(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?c6(b+E/C,s[1][1])*C:l6(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=u6(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?l6(y+D*C+O,o[1][0])/C:c6(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?c6(y+D*C,s[1][0])/C:l6(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(d6(c,l)?-w:w)/C:w=(d6(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var p6={width:0,height:0,x:0,y:0},m6={...p6,pointerX:0,pointerY:0,aspectRatio:1};function h6(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function g6({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=QQ(e),o={controlDirection:s6(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...p6},h={...m6};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:s6(e)};let g,_=null,v=[],y,b,x,S=!1,C=p$().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=M4(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=T4(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=h6(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=M4(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=f6(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let F=o6({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),I={...m,direction:F};p?.(e,I)!==!1&&(S=!0,d?.(e,I),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var _6=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},Bie=e=>e?_6(e):_6,{useDebugValue:Vie}=H.default,{useSyncExternalStoreWithSelector:Hie}=_i.default,Uie=e=>e;function v6(e,t=Uie,n){let r=Hie(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Vie(r),r}var y6=(e,t)=>{let n=Bie(e),r=(e,r=t)=>v6(n,e,r);return Object.assign(r,n),r},Wie=(e,t)=>e?y6(e,t):y6;function b6(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var x6=(0,H.createContext)(null),Gie=x6.Provider,S6=j2.error001(`react`);function C6(e,t){let n=(0,H.useContext)(x6);if(n===null)throw Error(S6);return v6(n,e,t)}function w6(){let e=(0,H.useContext)(x6);if(e===null)throw Error(S6);return(0,H.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var T6={display:`none`},Kie={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},E6=`react-flow__node-desc`,D6=`react-flow__edge-desc`,qie=`react-flow__aria-live`,Jie=e=>e.ariaLiveMessage,Yie=e=>e.ariaLabelConfig;function Xie({rfId:e}){let t=C6(Jie);return(0,U.jsx)(`div`,{id:`${qie}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:Kie,children:t})}function Zie({rfId:e,disableKeyboardA11y:t}){let n=C6(Yie);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{id:`${E6}-${e}`,style:T6,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,U.jsx)(`div`,{id:`${D6}-${e}`,style:T6,children:n[`edge.a11yDescription.default`]}),!t&&(0,U.jsx)(Xie,{rfId:e})]})}var O6=(0,H.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,U.jsx)(`div`,{className:qX([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));O6.displayName=`Panel`;function Qie({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,U.jsx)(O6,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev`,children:(0,U.jsx)(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var $ie=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},k6=e=>e.id;function eae(e,t){return b6(e.selectedNodes.map(k6),t.selectedNodes.map(k6))&&b6(e.selectedEdges.map(k6),t.selectedEdges.map(k6))}function tae({onSelectionChange:e}){let t=w6(),{selectedNodes:n,selectedEdges:r}=C6($ie,eae);return(0,H.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var nae=e=>!!e.onSelectionChangeHandlers;function rae({onSelectionChange:e}){let t=C6(nae);return e||t?(0,U.jsx)(tae,{onSelectionChange:e}):null}var A6=[0,0],iae={x:0,y:0,zoom:1},j6=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],aae=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),M6={translateExtent:M2,nodeOrigin:A6,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function oae(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=C6(aae,b6),l=w6();(0,H.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=M6,s()}),[]);let u=(0,H.useRef)(M6);return(0,H.useEffect)(()=>{for(let s of j6){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:j4(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},j6.map(t=>e[t])),null}function N6(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function sae(e){let[t,n]=(0,H.useState)(e===`system`?null:e);return(0,H.useEffect)(()=>{if(e!==`system`){n(e);return}let t=N6(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?N6()?.matches?`dark`:`light`:t}var P6=typeof document<`u`?document:null;function F6(e=null,t={target:P6,actInsideInputWithModifier:!0}){let[n,r]=(0,H.useState)(!1),i=(0,H.useRef)(!1),a=(0,H.useRef)(new Set([])),[o,s]=(0,H.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
|
|
349
|
+
`).replace(`
|
|
350
|
+
|
|
351
|
+
`,`
|
|
352
|
+
+`).split(`
|
|
353
|
+
`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,H.useEffect)(()=>{let n=t?.target??P6,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&I4(e))return!1;let n=L6(e.code,s);if(a.current.add(e[n]),I6(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=L6(e.code,s);I6(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function I6(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function L6(e,t){return t.includes(e)?`code`:`key`}var cae=()=>{let e=w6();return(0,H.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=C4(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return v4(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=y4(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function R6(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)lae(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function lae(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing);break}}function z6(e,t){return R6(e,t)}function B6(e,t){return R6(e,t)}function V6(e,t){return{id:e,type:`select`,selected:t}}function H6(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(V6(a.id,e)))}return r}function U6({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function W6(e){return{id:e.id,type:`remove`}}var uae=g4(`React Flow`,`https://reactflow.dev/`);function G6(e,t,n={}){return Y4(e,t,{...n,onError:n.onError??uae})}var K6=e=>G2(e),dae=e=>W2(e);function q6(e){return(0,H.forwardRef)(e)}var fae=typeof window<`u`?H.useLayoutEffect:H.useEffect;function J6(e){let[t,n]=(0,H.useState)(BigInt(0)),[r]=(0,H.useState)(()=>pae(()=>n(e=>e+BigInt(1))));return fae(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function pae(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var Y6=(0,H.createContext)(null);function mae({children:e}){let t=w6(),n=J6((0,H.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=U6({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=J6((0,H.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(U6({items:s,lookup:o}))},[])),i=(0,H.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,U.jsx)(Y6.Provider,{value:i,children:e})}function hae(){let e=(0,H.useContext)(Y6);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var gae=e=>!!e.panZoom;function X6(){let e=cae(),t=w6(),n=hae(),r=C6(gae),i=(0,H.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=K6(e)?e:n.get(e.id),a=i.parentId?O4(i.position,i.measured,i.parentId,n,r):i.position;return u4({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&K6(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&dae(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await t4({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(W6);o?.(f),c(e)}if(m){let e=d.map(W6);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=m4(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=u4(s?r:a),l=p4(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=m4(e)?e:a(e);if(!r)return!1;let i=p4(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return J2(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??A4();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,H.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var Z6=e=>e.selected,_ae=typeof window<`u`?window:void 0;function vae({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=w6(),{deleteElements:r}=X6(),i=F6(e,{actInsideInputWithModifier:!1}),a=F6(t,{target:_ae});(0,H.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(Z6),edges:e.filter(Z6)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,H.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function yae(e){let t=w6();(0,H.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=N4(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,j2.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var Q6={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},bae=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function xae({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=I2.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=w6(),S=(0,H.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=C6(bae,b6),E=F6(f),D=(0,H.useRef)();yae(S);let O=(0,H.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,H.useEffect)(()=>{if(S.current){D.current=i6({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,H.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,U.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:Q6,children:m})}var Sae=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Cae(){let{userSelectionActive:e,userSelectionRect:t}=C6(Sae,b6);return e&&t?(0,U.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var $6=(e,t)=>n=>{n.target===t.current&&e?.(n)},wae=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Tae({isSelecting:e,selectionKeyPressed:t,selectionMode:n=L2.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,H.useRef)(0),_=w6(),{userSelectionActive:v,elementsSelectable:y,dragging:b,connectionInProgress:x,panBy:S,autoPanSpeed:C}=C6(wae,b6),w=y&&(e||v),T=(0,H.useRef)(null),E=(0,H.useRef)(),D=(0,H.useRef)(new Set),O=(0,H.useRef)(new Set),k=(0,H.useRef)(!1),A=(0,H.useRef)({x:0,y:0}),j=(0,H.useRef)(!1),M=e=>{if(k.current||x){k.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,F=e=>{k.current&&=(e.stopPropagation(),!1)},I=n=>{let{domNode:r,transform:i}=_.getState();if(E.current=r?.getBoundingClientRect(),!E.current)return;let a=n.target===T.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=R4(n.nativeEvent,E.current),l=v4({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function L(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=y4(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=D.current,g=O.current;D.current=new Set(X2(a,m,i,n===L2.Partial,!0).map(e=>e.id)),O.current=new Set;let v=u?.selectable??!0;for(let e of D.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&O.current.add(e)}}k4(h,D.current)||c(H6(a,D.current,!0)),k4(g,O.current)||l(H6(o,O.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function ee(){if(!i||!E.current)return;let[e,t]=o4(A.current,E.current,C);S({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(ee);return}let{x:t,y:n}=A.current;L(t,n),g.current=requestAnimationFrame(ee)})}let te=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};return(0,H.useEffect)(()=>()=>te(),[]),(0,U.jsxs)(`div`,{className:qX([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:b,selection:e}]),onClick:w?void 0:$6(M,T),onContextMenu:$6(N,T),onWheel:$6(P,T),onPointerEnter:w?void 0:f,onPointerMove:w?e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!E.current||!n)return;let{x:o,y:c}=R4(e.nativeEvent,E.current);A.current={x:o,y:c};let l=y4({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(ee(),!0),L(o,c)}:p,onPointerUp:w?e=>{e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===T.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:D.current.size>0})),te())}:void 0,onPointerCancel:w?e=>{e.target?.releasePointerCapture?.(e.pointerId),te()}:void 0,onPointerDownCapture:w?I:void 0,onClickCapture:w?F:void 0,onPointerLeave:m,ref:T,style:Q6,children:[h,(0,U.jsx)(Cae,{})]})}function e8({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,j2.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function t8({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=w6(),[c,l]=(0,H.useState)(!1),u=(0,H.useRef)();return(0,H.useEffect)(()=>{u.current=N3({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{e8({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,H.useEffect)(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i,o]),c}var Eae=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function n8(){let e=w6();return(0,H.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=Eae(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=_4(t,i));let{position:a,positionAbsolute:s}=e4({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var r8=(0,H.createContext)(null),Dae=r8.Provider;r8.Consumer;var i8=()=>(0,H.useContext)(r8),Oae=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),kae=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o,u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===F2.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function Aae({type:e=`source`,position:t=V2.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=w6(),_=i8(),{connectOnClick:v,noPanClassName:y,rfId:b}=C6(Oae,b6),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=C6(kae(_,m,e),b6);_||g.getState().onError?.(`010`,j2.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(G6(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=L4(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();U3.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,U.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:qX([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=P4(t.target),h=n||c,{connection:v,isValid:y}=U3.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var a8=(0,H.memo)(q6(Aae));function jae({data:e,isConnectable:t,sourcePosition:n=V2.Bottom}){return(0,U.jsxs)(U.Fragment,{children:[e?.label,(0,U.jsx)(a8,{type:`source`,position:n,isConnectable:t})]})}function Mae({data:e,isConnectable:t,targetPosition:n=V2.Top,sourcePosition:r=V2.Bottom}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a8,{type:`target`,position:n,isConnectable:t}),e?.label,(0,U.jsx)(a8,{type:`source`,position:r,isConnectable:t})]})}function Nae(){return null}function Pae({data:e,isConnectable:t,targetPosition:n=V2.Top}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a8,{type:`target`,position:n,isConnectable:t}),e?.label]})}var o8={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},s8={input:jae,default:Mae,output:Pae,group:Nae};function Fae(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var Iae=e=>{let{width:t,height:n,x:r,y:i}=Y2(e.nodeLookup,{filter:e=>!!e.selected});return{width:h4(t)?t:null,height:h4(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function Lae({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=w6(),{width:i,height:a,transformString:o,userSelectionActive:s}=C6(Iae,b6),c=n8(),l=(0,H.useRef)(null);(0,H.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(t8({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,U.jsx)(`div`,{className:qX([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,U.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(o8,e.key)&&(e.preventDefault(),c({direction:o8[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var c8=typeof window<`u`?window:void 0,Rae=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function l8({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:F,isControlledViewport:I}){let{nodesSelectionActive:L,userSelectionActive:ee}=C6(Rae,b6),te=F6(l,{target:c8}),ne=F6(h,{target:c8}),R=ne||w,z=ne||b,B=u&&R!==!0,re=te||ee||B;return vae({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,U.jsx)(xae,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:z,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!te&&R,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:F,isControlledViewport:I,paneClickDistance:s,selectionOnDrag:B,children:(0,U.jsxs)(Tae,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:R,autoPanOnSelection:T,isSelecting:!!re,selectionMode:d,selectionKeyPressed:te,paneClickDistance:s,selectionOnDrag:B,children:[e,L&&(0,U.jsx)(Lae,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}l8.displayName=`FlowRenderer`;var zae=(0,H.memo)(l8),Bae=e=>t=>e?X2(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function Vae(e){return C6((0,H.useCallback)(Bae(e),[e]),b6)}var Hae=e=>e.updateNodeInternals;function Uae(){let e=C6(Hae),[t]=(0,H.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,H.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function Wae({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=w6(),a=(0,H.useRef)(null),o=(0,H.useRef)(null),s=(0,H.useRef)(e.sourcePosition),c=(0,H.useRef)(e.targetPosition),l=(0,H.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,H.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,H.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,H.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Gae({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=C6(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},b6),S=y.type||`default`,C=g?.[S]||s8[S];C===void 0&&(v?.(`003`,j2.error003(S)),S=`default`,C=g?.default||s8.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=w6(),k=D4(y),A=Wae({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=t8({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=n8();if(y.hidden)return null;let N=E4(y),P=Fae(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,L=r?e=>r(e,{...b.userNode}):void 0,ee=i?e=>i(e,{...b.userNode}):void 0,te=a?e=>a(e,{...b.userNode}):void 0,ne=o?e=>o(e,{...b.userNode}):void 0,R=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&e8({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},z=t=>{if(!(I4(t.nativeEvent)||m)){if(N2.includes(t.key)&&T)e8({id:e,store:O,unselect:t.key===`Escape`,nodeRef:A});else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(o8,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:o8[t.key],factor:t.shiftKey?4:1})}}},B=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(X2(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,U.jsx)(`div`,{className:qX([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:L,onMouseLeave:ee,onContextMenu:te,onClick:R,onDoubleClick:ne,onKeyDown:D?z:void 0,tabIndex:D?0:void 0,onFocus:D?B:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${E6}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,U.jsx)(Dae,{value:e,children:(0,U.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var Kae=(0,H.memo)(Gae),qae=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function u8(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=C6(qae,b6),o=Vae(e.onlyRenderVisibleElements),s=Uae();return(0,U.jsx)(`div`,{className:`react-flow__nodes`,style:Q6,children:o.map(o=>(0,U.jsx)(Kae,{id:o,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}u8.displayName=`NodeRenderer`;var Jae=(0,H.memo)(u8);function Yae(e){return C6((0,H.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&K4({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),b6)}var Xae=({color:e=`none`,strokeWidth:t=1})=>(0,U.jsx)(`polyline`,{className:`arrow`,style:{strokeWidth:t,...e&&{stroke:e}},strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`}),Zae=({color:e=`none`,strokeWidth:t=1})=>(0,U.jsx)(`polyline`,{className:`arrowclosed`,style:{strokeWidth:t,...e&&{stroke:e,fill:e}},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),d8={[B2.Arrow]:Xae,[B2.ArrowClosed]:Zae};function Qae(e){let t=w6();return(0,H.useMemo)(()=>Object.prototype.hasOwnProperty.call(d8,e)?d8[e]:(t.getState().onError?.(`009`,j2.error009(e)),null),[e])}var $ae=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Qae(t);return c?(0,U.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,U.jsx)(c,{color:n,strokeWidth:o})}):null},f8=({defaultColor:e,rfId:t})=>{let n=C6(e=>e.edges),r=C6(e=>e.defaultEdgeOptions),i=(0,H.useMemo)(()=>l3(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,U.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,U.jsx)(`defs`,{children:i.map(e=>(0,U.jsx)($ae,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};f8.displayName=`MarkerDefinitions`;var eoe=(0,H.memo)(f8);function p8({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,H.useState)({x:1,y:0,width:0,height:0}),p=qX([`react-flow__edge-textwrapper`,l]),m=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,U.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,U.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,U.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}p8.displayName=`EdgeText`;var toe=(0,H.memo)(p8);function m8({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{...u,d:e,fill:`none`,className:qX([`react-flow__edge-path`,u.className])}),l?(0,U.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&h4(t)&&h4(n)?(0,U.jsx)(toe,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function h8({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===V2.Left||e===V2.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function g8({sourceX:e,sourceY:t,sourcePosition:n=V2.Bottom,targetX:r,targetY:i,targetPosition:a=V2.Top}){let[o,s]=h8({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=h8({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=B4({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function _8(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=g8({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,U.jsx)(m8,{id:e.isInternal?void 0:t,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var noe=_8({isInternal:!1}),v8=_8({isInternal:!0});noe.displayName=`SimpleBezierEdge`,v8.displayName=`SimpleBezierEdgeInternal`;function y8(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=V2.Bottom,targetPosition:m=V2.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=n3({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,U.jsx)(m8,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var b8=y8({isInternal:!1}),x8=y8({isInternal:!0});b8.displayName=`SmoothStepEdge`,x8.displayName=`SmoothStepEdgeInternal`;function S8(e){return(0,H.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,U.jsx)(b8,{...n,id:r,pathOptions:(0,H.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var roe=S8({isInternal:!1}),C8=S8({isInternal:!0});roe.displayName=`StepEdge`,C8.displayName=`StepEdgeInternal`;function w8(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=X4({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,U.jsx)(m8,{id:e.isInternal?void 0:t,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var ioe=w8({isInternal:!1}),T8=w8({isInternal:!0});ioe.displayName=`StraightEdge`,T8.displayName=`StraightEdgeInternal`;function E8(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=V2.Bottom,targetPosition:s=V2.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=U4({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,U.jsx)(m8,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var aoe=E8({isInternal:!1}),D8=E8({isInternal:!0});aoe.displayName=`BezierEdge`,D8.displayName=`BezierEdgeInternal`;var O8={default:D8,straight:T8,step:C8,smoothstep:x8,simplebezier:v8},k8={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},ooe=(e,t,n)=>n===V2.Left?e-t:n===V2.Right?e+t:e,soe=(e,t,n)=>n===V2.Top?e-t:n===V2.Bottom?e+t:e,A8=`react-flow__edgeupdater`;function j8({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,U.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:qX([A8,`${A8}-${s}`]),cx:ooe(t,r,e),cy:soe(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function coe({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=w6(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;U3.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,U.jsxs)(U.Fragment,{children:[(e===!0||e===`source`)&&(0,U.jsx)(j8,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,U.jsx)(j8,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function loe({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=C6(t=>t.edgeLookup.get(e)),b=C6(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||O8[x];S===void 0&&(_?.(`011`,j2.error011(x)),x=`default`,S=h?.default||O8.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,H.useRef)(null),[D,O]=(0,H.useState)(!1),[k,A]=(0,H.useState)(!1),j=w6(),{zIndex:M,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:ee}=C6((0,H.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return{zIndex:y.zIndex,...k8};let i=i3({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_});return{zIndex:G4({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode}),...i||k8}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),b6),te=(0,H.useMemo)(()=>y.markerStart?`url('#${c3(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ne=(0,H.useMemo)(()=>y.markerEnd?`url('#${c3(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===null)return null;let R=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},z=a?e=>{a(e,{...y})}:void 0,B=o?e=>{o(e,{...y})}:void 0,re=s?e=>{s(e,{...y})}:void 0,V=c?e=>{c(e,{...y})}:void 0,ie=l?e=>{l(e,{...y})}:void 0;return(0,U.jsx)(`svg`,{style:{zIndex:M},children:(0,U.jsxs)(`g`,{className:qX([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:R,onDoubleClick:z,onContextMenu:B,onMouseEnter:re,onMouseMove:V,onMouseLeave:ie,onKeyDown:C?t=>{if(!v&&N2.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${D6}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,U.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:ee,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:te,markerEnd:ne,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,U.jsx)(coe,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:ee,setUpdateHover:O,setReconnecting:A})]})})}var uoe=(0,H.memo)(loe),doe=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function M8({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=C6(doe,b6),b=Yae(t);return(0,U.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,U.jsx)(eoe,{defaultColor:e,rfId:n}),b.map(e=>(0,U.jsx)(uoe,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}M8.displayName=`EdgeRenderer`;var foe=(0,H.memo)(M8),poe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function moe({children:e}){return(0,U.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:C6(poe)},children:e})}function hoe(e){let t=X6(),n=(0,H.useRef)(!1);(0,H.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var goe=e=>e.panZoom?.syncViewport;function _oe(e){let t=C6(goe),n=w6();return(0,H.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function N8(e){return e.connection.inProgress?{...e.connection,to:v4(e.connection.to,e.transform)}:{...e.connection}}function voe(e){return e?t=>e(N8(t)):N8}function yoe(e){return C6(voe(e),b6)}var boe=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function xoe({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=C6(boe,b6);return a&&i&&c?(0,U.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,U.jsx)(`g`,{className:qX([`react-flow__connection`,U2(s)]),children:(0,U.jsx)(P8,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var P8=({style:e,type:t=z2.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=yoe();if(!i)return;if(n)return(0,U.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:U2(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case z2.Bezier:[m]=U4(h);break;case z2.SimpleBezier:[m]=g8(h);break;case z2.Step:[m]=n3({...h,borderRadius:0});break;case z2.SmoothStep:[m]=n3(h);break;default:[m]=X4(h)}return(0,U.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};P8.displayName=`ConnectionLine`;var Soe={};function F8(e=Soe){(0,H.useRef)(e),w6(),(0,H.useEffect)(()=>{},[e])}function Coe(){w6(),(0,H.useRef)(!1),(0,H.useEffect)(()=>{},[])}function I8({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:ee,panOnDrag:te,autoPanOnSelection:ne,onPaneClick:R,onPaneMouseEnter:z,onPaneMouseMove:B,onPaneMouseLeave:re,onPaneScroll:V,onPaneContextMenu:ie,paneClickDistance:ae,nodeClickDistance:oe,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:de,onReconnect:fe,onReconnectStart:pe,onReconnectEnd:me,noDragClassName:he,noWheelClassName:ge,noPanClassName:_e,disableKeyboardA11y:ve,nodeExtent:ye,rfId:be,viewport:xe,onViewportChange:Se}){return F8(e),F8(t),Coe(),hoe(n),_oe(xe),(0,U.jsx)(zae,{onPaneClick:R,onPaneMouseEnter:z,onPaneMouseMove:B,onPaneMouseLeave:re,onPaneContextMenu:ie,onPaneScroll:V,paneClickDistance:ae,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:ee,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:te,autoPanOnSelection:ne,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:he,noWheelClassName:ge,noPanClassName:_e,disableKeyboardA11y:ve,onViewportChange:Se,isControlledViewport:!!xe,children:(0,U.jsxs)(moe,{children:[(0,U.jsx)(foe,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:fe,onReconnectStart:pe,onReconnectEnd:me,onlyRenderVisibleElements:T,onEdgeContextMenu:se,onEdgeMouseEnter:ce,onEdgeMouseMove:le,onEdgeMouseLeave:ue,reconnectRadius:de,defaultMarkerColor:M,noPanClassName:_e,disableKeyboardA11y:ve,rfId:be}),(0,U.jsx)(xoe,{style:h,type:m,component:g,containerStyle:_}),(0,U.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,U.jsx)(Jae,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:oe,onlyRenderVisibleElements:T,noPanClassName:_e,noDragClassName:he,disableKeyboardA11y:ve,nodeExtent:ye,rfId:be}),(0,U.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}I8.displayName=`GraphView`;var woe=(0,H.memo)(I8),Toe=g4(`React Flow`,`https://reactflow.dev/`),L8=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??M2;D3(h,g,_);let{nodesInitialized:x}=v3(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=C4(Y2(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:M2,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:F2.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...R2},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Toe,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:P2,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Eoe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>Wie((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await $2({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...L8({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=v3(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();D3(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=w3(e,n,r,i,a,o,l);d&&(h3(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=o3(e,o.fromHandle,V2.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=C3(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(z6(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(B6(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>V6(e,!0)));return}i(H6(r,new Set([...e]),!0)),a(H6(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>V6(e,!0)));return}a(H6(n,new Set([...e]))),i(H6(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(V6(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(V6(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,V6(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,V6(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(v3(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return T3({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...R2}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...L8()})}},Object.is);function Doe({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,H.useState)(()=>Eoe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,U.jsx)(Gie,{value:m,children:(0,U.jsx)(mae,{children:p})})}function Ooe({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,H.useContext)(x6)?(0,U.jsx)(U.Fragment,{children:e}):(0,U.jsx)(Doe,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var koe={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function Aoe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:I,connectionMode:L,connectionLineType:ee=z2.Bezier,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:R,deleteKeyCode:z=`Backspace`,selectionKeyCode:B=`Shift`,selectionOnDrag:re=!1,selectionMode:V=L2.Full,panActivationKeyCode:ie=`Space`,multiSelectionKeyCode:ae=w4()?`Meta`:`Control`,zoomActivationKeyCode:oe=w4()?`Meta`:`Control`,snapToGrid:se,snapGrid:ce,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:ue,nodesDraggable:de,autoPanOnNodeFocus:fe,nodesConnectable:pe,nodesFocusable:me,nodeOrigin:he=A6,edgesFocusable:ge,edgesReconnectable:_e,elementsSelectable:ve=!0,defaultViewport:ye=iae,minZoom:be=.5,maxZoom:xe=2,translateExtent:Se=M2,preventScrolling:Ce=!0,nodeExtent:we,defaultMarkerColor:Te=`#b1b1b7`,zoomOnScroll:Ee=!0,zoomOnPinch:De=!0,panOnScroll:Oe=!1,panOnScrollSpeed:ke=.5,panOnScrollMode:Ae=I2.Free,zoomOnDoubleClick:je=!0,panOnDrag:Me=!0,onPaneClick:Ne,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze=1,nodeClickDistance:Be=0,children:W,onReconnect:Ve,onReconnectStart:He,onReconnectEnd:Ue,onEdgeContextMenu:We,onEdgeDoubleClick:Ge,onEdgeMouseEnter:Ke,onEdgeMouseMove:qe,onEdgeMouseLeave:Je,reconnectRadius:Ye=10,onNodesChange:Xe,onEdgesChange:Ze,noDragClassName:Qe=`nodrag`,noWheelClassName:$e=`nowheel`,noPanClassName:et=`nopan`,fitView:tt,fitViewOptions:nt,connectOnClick:rt,attributionPosition:it,proOptions:at,defaultEdgeOptions:ot,elevateNodesOnSelect:st=!0,elevateEdgesOnSelect:ct=!1,disableKeyboardA11y:lt=!1,autoPanOnConnect:ut,autoPanOnNodeDrag:dt,autoPanOnSelection:ft=!0,autoPanSpeed:pt,connectionRadius:mt,isValidConnection:ht,onError:gt,style:_t,id:vt,nodeDragThreshold:yt,connectionDragThreshold:bt,viewport:xt,onViewportChange:St,width:Ct,height:wt,colorMode:Tt=`light`,debug:Et,onScroll:Dt,ariaLabelConfig:Ot,zIndexMode:kt=`basic`,...At},jt){let Mt=vt||`1`,Nt=sae(Tt),Pt=(0,H.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Dt?.(e)},[Dt]);return(0,U.jsx)(`div`,{"data-testid":`rf__wrapper`,...At,onScroll:Pt,style:{..._t,...koe},ref:jt,className:qX([`react-flow`,i,Nt]),id:vt,role:`application`,children:(0,U.jsxs)(Ooe,{nodes:e,edges:t,width:Ct,height:wt,fitView:tt,fitViewOptions:nt,minZoom:be,maxZoom:xe,nodeOrigin:he,nodeExtent:we,zIndexMode:kt,children:[(0,U.jsx)(oae,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:de,autoPanOnNodeFocus:fe,nodesConnectable:pe,nodesFocusable:me,edgesFocusable:ge,edgesReconnectable:_e,elementsSelectable:ve,elevateNodesOnSelect:st,elevateEdgesOnSelect:ct,minZoom:be,maxZoom:xe,nodeExtent:we,onNodesChange:Xe,onEdgesChange:Ze,snapToGrid:se,snapGrid:ce,connectionMode:L,translateExtent:Se,connectOnClick:rt,defaultEdgeOptions:ot,fitView:tt,fitViewOptions:nt,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:et,nodeOrigin:he,rfId:Mt,autoPanOnConnect:ut,autoPanOnNodeDrag:dt,autoPanSpeed:pt,onError:gt,connectionRadius:mt,isValidConnection:ht,selectNodesOnDrag:ue,nodeDragThreshold:yt,connectionDragThreshold:bt,onBeforeDelete:I,debug:Et,ariaLabelConfig:Ot,zIndexMode:kt}),(0,U.jsx)(woe,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:ee,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:R,selectionKeyCode:B,selectionOnDrag:re,selectionMode:V,deleteKeyCode:z,multiSelectionKeyCode:ae,panActivationKeyCode:ie,zoomActivationKeyCode:oe,onlyRenderVisibleElements:le,defaultViewport:ye,translateExtent:Se,minZoom:be,maxZoom:xe,preventScrolling:Ce,zoomOnScroll:Ee,zoomOnPinch:De,zoomOnDoubleClick:je,panOnScroll:Oe,panOnScrollSpeed:ke,panOnScrollMode:Ae,panOnDrag:Me,autoPanOnSelection:ft,onPaneClick:Ne,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze,nodeClickDistance:Be,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Ve,onReconnectStart:He,onReconnectEnd:Ue,onEdgeContextMenu:We,onEdgeDoubleClick:Ge,onEdgeMouseEnter:Ke,onEdgeMouseMove:qe,onEdgeMouseLeave:Je,reconnectRadius:Ye,defaultMarkerColor:Te,noDragClassName:Qe,noWheelClassName:$e,noPanClassName:et,rfId:Mt,disableKeyboardA11y:lt,nodeExtent:we,viewport:xt,onViewportChange:St}),(0,U.jsx)(rae,{onSelectionChange:k}),W,(0,U.jsx)(Qie,{proOptions:at,position:it}),(0,U.jsx)(Zie,{rfId:Mt,disableKeyboardA11y:lt})]})})}var joe=q6(Aoe),Moe=e=>e.domNode?.querySelector(`.react-flow__edgelabel-renderer`);function Noe({children:e}){let t=C6(Moe);return t?(0,Oi.createPortal)(e,t):null}function Poe(e){let[t,n]=(0,H.useState)(e);return[t,n,(0,H.useCallback)(e=>n(t=>z6(e,t)),[])]}function Foe(e){let[t,n]=(0,H.useState)(e);return[t,n,(0,H.useCallback)(e=>n(t=>B6(e,t)),[])]}j2.error014();function Ioe({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,U.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:qX([`react-flow__background-pattern`,n,r])})}function Loe({radius:e,className:t}){return(0,U.jsx)(`circle`,{cx:e,cy:e,r:e,className:qX([`react-flow__background-pattern`,`dots`,t])})}var R8;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(R8||={});var Roe={[R8.Dots]:1,[R8.Lines]:1,[R8.Cross]:6},zoe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function z8({id:e,variant:t=R8.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,H.useRef)(null),{transform:f,patternId:p}=C6(zoe,b6),m=r||Roe[t],h=t===R8.Dots,g=t===R8.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,U.jsxs)(`svg`,{className:qX([`react-flow__background`,l]),style:{...c,...Q6,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,U.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,U.jsx)(Loe,{radius:y/2,className:u}):(0,U.jsx)(Ioe,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,U.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}z8.displayName=`Background`;var Boe=(0,H.memo)(z8);function Voe(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,U.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function Hoe(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,U.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function Uoe(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,U.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function Woe(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,U.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function Goe(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,U.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function B8({children:e,className:t,...n}){return(0,U.jsx)(`button`,{type:`button`,className:qX([`react-flow__controls-button`,t]),...n,children:e})}var Koe=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function V8({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=w6(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=C6(Koe,b6),{zoomIn:y,zoomOut:b,fitView:x}=X6();return(0,U.jsxs)(O6,{className:qX([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(B8,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,U.jsx)(Voe,{})}),(0,U.jsx)(B8,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,U.jsx)(Hoe,{})})]}),n&&(0,U.jsx)(B8,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,U.jsx)(Uoe,{})}),r&&(0,U.jsx)(B8,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,U.jsx)(Goe,{}):(0,U.jsx)(Woe,{})}),u]})}V8.displayName=`Controls`,(0,H.memo)(V8);function qoe({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,U.jsx)(`rect`,{className:qX([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var Joe=(0,H.memo)(qoe),Yoe=e=>e.nodes.map(e=>e.id),H8=e=>e instanceof Function?e:()=>e;function Xoe({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=Joe,onClick:o}){let s=C6(Yoe,b6),c=H8(t),l=H8(e),u=H8(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,U.jsx)(U.Fragment,{children:s.map(e=>(0,U.jsx)(Qoe,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function Zoe({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=C6(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=E4(r);return{node:r,x:i,y:a,width:o,height:s}},b6);return!l||l.hidden||!D4(l)?null:(0,U.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var Qoe=(0,H.memo)(Zoe),$oe=(0,H.memo)(Xoe),ese=200,tse=150,nse=e=>!e.hidden,rse=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?f4(Y2(e.nodeLookup,{filter:nse}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},ise=`react-flow__minimap-desc`;function U8({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=w6(),S=(0,H.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=C6(rse,b6),j=e?.width??ese,M=e?.height??tse,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,ee=b*F,te=C.x-(I-C.width)/2-ee,ne=C.y-(L-C.height)/2-ee,R=I+ee*2,z=L+ee*2,B=`${ise}-${T}`,re=(0,H.useRef)(0),V=(0,H.useRef)();re.current=F,(0,H.useEffect)(()=>{if(S.current&&E)return V.current=W3({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>re.current}),()=>{V.current?.destroy()}},[E]),(0,H.useEffect)(()=>{V.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let ie=p?e=>{let[t,n]=V.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ae=m?(0,H.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,oe=_??A[`minimap.ariaLabel`];return(0,U.jsx)(O6,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:qX([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,U.jsxs)(`svg`,{width:j,height:M,viewBox:`${te} ${ne} ${R} ${z}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":B,ref:S,onClick:ie,children:[oe&&(0,U.jsx)(`title`,{id:B,children:oe}),(0,U.jsx)($oe,{onClick:ae,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,U.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${te-ee},${ne-ee}h${R+ee*2}v${z+ee*2}h${-R-ee*2}z
|
|
354
|
+
M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}U8.displayName=`MiniMap`,(0,H.memo)(U8);var ase=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,ose={[a6.Line]:`right`,[a6.Handle]:`bottom-right`};function sse({nodeId:e,position:t,variant:n=a6.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=i8(),y=typeof e==`string`?e:v,b=w6(),x=(0,H.useRef)(null),S=n===a6.Handle,C=C6((0,H.useCallback)(ase(S&&p),[S,p]),b6),w=(0,H.useRef)(null),T=t??ose[n];return(0,H.useEffect)(()=>{if(!(!x.current||!y))return w.current||=g6({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=C3([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...O4({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,U.jsx)(`div`,{className:qX([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,H.memo)(sse);var cse=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function lse(e){let t=new Map;function n(e){for(let r of e)r.linked_task_id!==null&&t.set(r.linked_task_id,r.id),n(r.children)}return n(e),t}function use(e,t={}){return e.map(e=>({id:e.id,type:`taskCard`,position:{x:e.x,y:e.y},data:{label:e.label,status:e.status,projectId:e.project_id,documentId:t.taskDocumentMap?.get(e.id),description:e.description,assignee:e.assignee,dueDate:e.due_date}}))}function dse(e){return e.map(e=>({id:e.id,type:`labeled`,source:e.from_task_id,target:e.to_task_id,data:{label:e.label??`depends_on`}}))}function fse(e,t){return{nodes:e.map(e=>({id:e.id,x:e.position.x,y:e.position.y})),edges:t.map(e=>{let t={from_task_id:e.source,to_task_id:e.target,label:e.data?.label??`depends_on`};return cse.test(e.id)&&(t.id=e.id),t})}}var W8={blocks:`blocks`,depends_on:`depends on`,unblocks:`unblocks`,feeds:`feeds into`,clarifies:`clarifies`,enables:`enables`,supports:`supports`,relates:`relates to`};function pse({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,data:s}){let[c,l,u]=U4({sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o}),[d,f]=(0,H.useState)(!1),p=s?.label??`depends_on`,m=s?.onLabelChange!==void 0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(m8,{id:e,path:c,style:{stroke:`var(--border-strong)`,strokeWidth:1.5}}),(0,U.jsx)(Noe,{children:(0,U.jsx)(`div`,{className:`nodrag nopan`,style:{position:`absolute`,transform:`translate(-50%, -50%) translate(${String(l)}px,${String(u)}px)`,pointerEvents:`all`},children:d&&m?(0,U.jsxs)(ww,{value:p,onValueChange:e=>{s?.onLabelChange?.(e),f(!1)},open:!0,onOpenChange:e=>{e||f(!1)},children:[(0,U.jsx)(Ew,{className:`h-auto w-auto border-border bg-card px-2 py-0.5 text-[10px]`,children:(0,U.jsx)(Tw,{})}),(0,U.jsx)(Dw,{children:Oa.map(e=>(0,U.jsx)(Ow,{value:e,className:`text-xs`,children:W8[e]},e))})]}):(0,U.jsx)(`button`,{type:`button`,className:`rounded-full border border-border bg-card px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,onClick:()=>{m&&f(!0)},children:W8[p]})})})]})}var G8=Object.defineProperty,mse=(e,t,n)=>t in e?G8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hse=(e,t)=>{for(var n in t)G8(e,n,{get:t[n],enumerable:!0})},gse=(e,t,n)=>mse(e,typeof t==`symbol`?t:t+``,n),K8={};hse(K8,{Graph:()=>J8,alg:()=>e5,json:()=>$8,version:()=>yse});var _se=Object.defineProperty,q8=(e,t)=>{for(var n in t)_se(e,n,{get:t[n],enumerable:!0})},J8=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e?e.multigraph:!1,this._isCompound=`compound`in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e==`function`?this._defaultNodeLabelFn=e:this._defaultNodeLabelFn=()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let t of this.successors(e))n.add(t);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return typeof e==`function`?this._defaultEdgeLabelFn=e:this._defaultEdgeLabelFn=()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=Z8(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=vse(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,Y8(this._preds[a],i),Y8(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?Q8(this._isDirected,e):Z8(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r==`object`?r:{label:r}}hasEdge(e,t,n){return(arguments.length===1?Q8(this._isDirected,e):Z8(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?Q8(this._isDirected,e):Z8(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],X8(this._preds[t],e),X8(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function Y8(e,t){e[t]?e[t]++:e[t]=1}function X8(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Z8(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function vse(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function Q8(e,t){return Z8(e,t.v,t.w,t.name)}var yse=`4.0.1`,$8={};q8($8,{read:()=>Cse,write:()=>bse});function bse(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:xse(e),edges:Sse(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function xse(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function Sse(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Cse(e){let t=new J8(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var e5={};q8(e5,{CycleException:()=>a5,bellmanFord:()=>t5,components:()=>Ese,dijkstra:()=>r5,dijkstraAll:()=>kse,findCycles:()=>Ase,floydWarshall:()=>Mse,isAcyclic:()=>Pse,postorder:()=>Ise,preorder:()=>Lse,prim:()=>Rse,shortestPaths:()=>zse,tarjan:()=>i5,topsort:()=>o5});var wse=()=>1;function t5(e,t,n,r){return Tse(e,String(t),n||wse,r||function(t){return e.outEdges(t)})}function Tse(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=n(e);i[e.v].distance+t<i[e.w].distance&&(i[e.w]={distance:i[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w;c({v:n,w:n===t.v?t.w:t.v})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0,predecessor:``}});let u=s.length;for(let e=1;e<u&&(a=!1,o++,l(),a);e++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}function Ese(e){let t={},n=[],r;function i(n){n in t||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}var n5=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},Dse=()=>1;function r5(e,t,n,r){return Ose(e,String(t),n||Dse,r||function(t){return e.outEdges(t)})}function Ose(e,t,n,r){let i={},a=new n5,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t],c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l<r.distance&&(r.distance=l,r.predecessor=o,a.decrease(t,l))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;i[e]={distance:n,predecessor:``},a.add(e,n)});a.size()>0&&(o=a.removeMin(),s=i[o],s.distance!==1/0);)r(o).forEach(c);return i}function kse(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=r5(e,i,t,n),r},{})}function i5(e){let t=0,n=[],r={},i=[];function a(o){let s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){e in r?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){let e=[],t;do t=n.pop(),r[t].onStack=!1,e.push(t);while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function Ase(e){return i5(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var jse=()=>1;function Mse(e,t,n){return Nse(e,t||jse,n||function(t){return e.outEdges(t)})}function Nse(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){let t=r[e];i.forEach(function(n){let a=r[n];i.forEach(function(n){let r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}var a5=class extends Error{constructor(...e){super(...e)}};function o5(e){let t={},n={},r=[];function i(a){if(a in n)throw new a5;a in t||(n[a]=!0,t[a]=!0,e.predecessors(a).forEach(i),delete n[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new a5;return r}function Pse(e){try{o5(e)}catch(e){if(e instanceof a5)return!1;throw e}return!0}function Fse(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=(t=>(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=s5(e,t,n===`post`,o,a,r,i)}),i}function s5(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=s5(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function c5(e,t,n){return Fse(e,t,n,function(e,t){return e.push(t),e},[])}function Ise(e,t){return c5(e,t,`post`)}function Lse(e,t){return c5(e,t,`pre`)}function Rse(e,t){let n=new J8,r={},i=new n5,a;function o(e){let n=e.v===a?e.w:e.v,o=i.priority(n);if(o!==void 0){let s=t(e);s<o&&(r[n]=a,i.decrease(n,s))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(e){i.add(e,1/0),n.setNode(e)}),i.decrease(e.nodes()[0],0);let s=!1;for(;i.size()>0;){if(a=i.removeMin(),a in r)n.setEdge(a,r[a]);else{if(s)throw Error(`Input graph is not connected: `+e);s=!0}e.nodeEdges(a).forEach(o)}return n}function zse(e,t,n,r){return Bse(e,t,n,r??(t=>e.outEdges(t)??[]))}function Bse(e,t,n,r){if(n===void 0)return r5(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=r(a[o]);for(let e=0;e<s.length;e++){let t=s[e],r=t.v===a[o]?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return t5(e,t,n,r)}return r5(e,t,n,r)}function l5(e,t,n,r){let i=r;for(;e.hasNode(i);)i=y5(r);return n.dummy=t,e.setNode(i,n),i}function Vse(e){let t=new J8().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function u5(e){let t=new J8({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function d5(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function f5(e){let t=b5(g5(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function Hse(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=h5(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function Use(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=h5(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function p5(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),l5(e,`border`,i,t)}function Wse(e,t=m5){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var m5=65535;function h5(e,t){return t.length>m5?e(...Wse(t).map(t=>e(...t))):e(...t)}function g5(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return h5(Math.max,t)}function Gse(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function _5(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function v5(e,t){return t()}var Kse=0;function y5(e){return e+(``+ ++Kse)}function b5(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function x5(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function S5(e,t){let n;return n=typeof t==`string`?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function qse(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var C5=`\0`,Jse=`3.0.0`,Yse=class{constructor(){gse(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return w5(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&w5(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,Xse)),n=n._prev;return`[`+e.join(`, `)+`]`}};function w5(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Xse(e,t){if(e!==`_next`&&e!==`_prev`)return t}var Zse=Yse,Qse=()=>1;function $se(e,t){if(e.nodeCount()<=1)return[];let n=tce(e,t||Qse);return ece(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function ece(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)T5(e,t,n,o);for(;o=i.dequeue();)T5(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(T5(e,t,n,o,!0)||[]);break}}}return r}function T5(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,E5(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,E5(t,n,o)}),e.removeNode(r.v),o}function tce(e,t){let n=new J8,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=nce(i+r+3).map(()=>new Zse),o=r+1;return n.nodes().forEach(e=>{E5(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function E5(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function nce(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function rce(e){(e.graph().acyclicer===`greedy`?$se(e,t(e)):ice(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,y5(`rev`))});function t(e){return t=>e.edge(t).weight}}function ice(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function ace(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function oce(e){e.graph().dummyChains=[],e.edges().forEach(t=>sce(e,t))}function sce(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=l5(e,`edge`,u,`_d`),r===c&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},o)}function cce(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function D5(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=h5(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function O5(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var k5=lce;function lce(e){let t=new J8({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;uce(t,e)<i&&(a=dce(t,e),a);)o=t.hasNode(a.v)?O5(e,a):-O5(e,a),fce(t,e,o);return t}function uce(e,t){function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!O5(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function dce(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=O5(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function fce(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:pce,postorder:mce}=e5,hce=A5;A5.initLowLimValues=N5,A5.initCutValues=j5,A5.calcCutValue=M5,A5.leaveEdge=F5,A5.enterEdge=I5,A5.exchangeEdges=L5;function A5(e){e=Vse(e),D5(e);let t=k5(e);N5(t),j5(t,e);let n,r;for(;n=F5(t);)r=I5(t,e,n),L5(t,e,n,r)}function j5(e,t){let n=mce(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>gce(e,t,n))}function gce(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=M5(e,t,n)}function M5(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,vce(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function N5(e,t){arguments.length<2&&(t=e.nodes()[0]),P5(e,{},1,t)}function P5(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=P5(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function F5(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function I5(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===R5(e,e.node(t.v),s)&&c!==R5(e,e.node(t.w),s)).reduce((e,n)=>O5(t,n)<O5(t,e)?n:e)}function L5(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),N5(e),j5(e,t),_ce(e,t)}function _ce(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=pce(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function vce(e,t,n){return e.hasEdge(t,n)}function R5(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var yce=bce;function bce(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:z5(e);break;case`tight-tree`:Sce(e);break;case`longest-path`:xce(e);break;case`none`:break;default:z5(e)}}var xce=D5;function Sce(e){D5(e),k5(e)}function z5(e){hce(e)}var Cce=wce;function wce(e){let t=Ece(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=Tce(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(o[c+1]).minRank<=r.rank;)c++;l=o[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function Tce(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function Ece(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(C5).forEach(r),t}function Dce(e){let t=l5(e,`root`,{},`_root`),n=Oce(e),r=Object.values(n),i=h5(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=kce(e)+1;e.children(C5).forEach(r=>B5(e,t,a,o,i,n,r)),e.graph().nodeRankFactor=a}function B5(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=p5(e,`_bt`),l=p5(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{B5(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function Oce(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(C5).forEach(e=>n(e,1)),t}function kce(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Ace(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var jce=Mce;function Mce(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)V5(e,`borderLeft`,`_bl`,n,i,t),V5(e,`borderRight`,`_br`,n,i,t)}}e.children(C5).forEach(t)}function V5(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=l5(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Nce(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&H5(e)}function Pce(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&Fce(e),(t===`lr`||t===`rl`)&&(Ice(e),H5(e))}function H5(e){e.nodes().forEach(t=>U5(e.node(t))),e.edges().forEach(t=>U5(e.edge(t)))}function U5(e){let t=e.width;e.width=e.height,e.height=t}function Fce(e){e.nodes().forEach(t=>W5(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(W5),Object.hasOwn(r,`y`)&&W5(r)})}function W5(e){e.y=-e.y}function Ice(e){e.nodes().forEach(t=>G5(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(G5),Object.hasOwn(r,`x`)&&G5(r)})}function G5(e){let t=e.x;e.x=e.y,e.y=t}function Lce(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),r=n.map(t=>e.node(t).rank),i=b5(h5(Math.max,r)+1).map(()=>[]);function a(n){if(t[n])return;t[n]=!0,i[e.node(n).rank].push(n);let r=e.successors(n);r&&r.forEach(a)}return n.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(a),i}function Rce(e,t){let n=0;for(let r=1;r<t.length;++r)n+=zce(e,t[r-1],t[r]);return n}function zce(e,t,n){let r=qse(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;--a;let s=Array(o).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function Bce(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function Vce(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),Hce(Object.values(n).filter(e=>!e.indegree))}function Hce(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&Uce(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>x5(e,[`vs`,`i`,`barycenter`,`weight`]))}function Uce(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function Wce(e,t){let n=Gse(e,e=>Object.hasOwn(e,`barycenter`)),r=n.lhs,i=n.rhs.sort((e,t)=>t.i-e.i),a=[],o=0,s=0,c=0;r.sort(Gce(!!t)),c=K5(a,i,c),r.forEach(e=>{c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=K5(a,i,c)});let l={vs:a.flat(1)};return s&&(l.barycenter=o/s,l.weight=s),l}function K5(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Gce(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function q5(e,t,n,r){let i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=i.filter(e=>e!==o&&e!==s));let l=Bce(e,i);l.forEach(t=>{if(e.children(t.v).length){let i=q5(e,t.v,n,r);c[t.v]=i,Object.hasOwn(i,`barycenter`)&&qce(t,i)}});let u=Vce(l,n);Kce(u,c);let d=Wce(u,r);if(o&&s){d.vs=[o,d.vs,s].flat(1);let t=e.predecessors(o);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(s),i=e.node(r[0]);Object.hasOwn(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+n.order+i.order)/(d.weight+2),d.weight+=2}}return d}function Kce(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function qce(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function Jce(e,t,n,r){r||=e.nodes();let i=Yce(e),a=new J8({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function Yce(e){let t;for(;e.hasNode(t=y5(`_root`)););return t}function Xce(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function J5(e,t={}){if(typeof t.customOrder==`function`){t.customOrder(e,J5);return}let n=g5(e),r=Y5(e,b5(1,n+1),`inEdges`),i=Y5(e,b5(n-1,-1,-1),`outEdges`),a=Lce(e);if(X5(e,a),t.disableOptimalOrderHeuristic)return;let o=1/0,s,c=t.constraints||[];for(let t=0,n=0;n<4;++t,++n){Zce(t%2?r:i,t%4>=2,c),a=f5(e);let l=Rce(e,a);l<o?(n=0,s=Object.assign({},a),o=l):l===o&&(s=structuredClone(a))}X5(e,s)}function Y5(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return Jce(e,t,n,r.get(t)||[])})}function Zce(e,t,n){let r=new J8;e.forEach(function(e){n.forEach(e=>r.setEdge(e.left,e.right));let i=e.graph().root,a=q5(e,i,r,t);a.vs.forEach((t,n)=>e.node(t).order=n),Xce(e,r,a.vs)})}function X5(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function Qce(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=ele(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Z5(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function $ce(e,t){let n={};function r(t,r,i,a,o){b5(r,i).forEach(r=>{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Z5(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function ele(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function Z5(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function tle(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function nle(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s&&s.length){let r=s.sort((e,t)=>{let n=o[e],r=o[t];return(n===void 0?0:n)-(r===void 0?0:r)}),c=(r.length-1)/2;for(let s=Math.floor(c),l=Math.ceil(c);s<=l;++s){let c=r[s];if(c===void 0)continue;let l=o[c];if(l!==void 0&&a[e]===e&&t<l&&!tle(n,e,c)){let n=i[c];n!==void 0&&(a[c]=e,a[e]=i[e]=n,t=l)}}}})}),{root:i,align:a}}function rle(e,t,n,r,i=!1){let a={},o=ile(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){let t=o.inEdges(e);t?a[e]=t.reduce((e,t)=>{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function ile(e,t,n,r){let i=new J8,a=e.graph(),o=lle(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function ale(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=ule(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function ole(e,t){let n=Object.values(t),r=h5(Math.min,n),i=h5(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-h5(Math.min,c);a!==`l`&&(l=i-h5(Math.max,c)),l&&(e[o]=S5(s,e=>e+l))})})}function sle(e,t=void 0){let n=e.ul;return n?S5(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function cle(e){let t=f5(e),n=Object.assign(Qce(e,t),$ce(e,t)),r={},i;return[`u`,`d`].forEach(a=>{i=a===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(i=i.map(e=>Object.values(e).reverse()));let o=nle(e,i,n,t=>(a===`u`?e.predecessors(t):e.successors(t))||[]),s=rle(e,i,o.root,o.align,t===`r`);t===`r`&&(s=S5(s,e=>-e)),r[a+t]=s})}),ole(r,ale(e,r)),sle(r,e.graph().align)}function lle(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),c}}function ule(e,t){return e.node(t).width}function dle(e){e=u5(e),fle(e),Object.entries(cle(e)).forEach(([t,n])=>e.node(t).x=n)}function fle(e){let t=f5(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);i===`top`?r.y=a+r.height/2:i===`bottom`?r.y=a+n-r.height/2:r.y=a+n/2}),a+=n+r})}function ple(e,t={}){let n=t.debugTiming?_5:v5;return n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>Cle(e));return n(` runLayout`,()=>mle(r,n,t)),n(` updateInputGraph`,()=>hle(e,r)),r})}function mle(e,t,n){t(` makeSpaceForEdgeLabels`,()=>wle(e)),t(` removeSelfEdges`,()=>Nle(e)),t(` acyclic`,()=>rce(e)),t(` nestingGraph.run`,()=>Dce(e)),t(` rank`,()=>yce(u5(e))),t(` injectEdgeLabelProxies`,()=>Tle(e)),t(` removeEmptyRanks`,()=>Use(e)),t(` nestingGraph.cleanup`,()=>Ace(e)),t(` normalizeRanks`,()=>Hse(e)),t(` assignRankMinMax`,()=>Ele(e)),t(` removeEdgeLabelProxies`,()=>Dle(e)),t(` normalize.run`,()=>oce(e)),t(` parentDummyChains`,()=>Cce(e)),t(` addBorderSegments`,()=>jce(e)),t(` order`,()=>J5(e,n)),t(` insertSelfEdges`,()=>Ple(e)),t(` adjustCoordinateSystem`,()=>Nce(e)),t(` position`,()=>dle(e)),t(` positionSelfEdges`,()=>Fle(e)),t(` removeBorderNodes`,()=>Mle(e)),t(` normalize.undo`,()=>cce(e)),t(` fixupEdgeLabelCoords`,()=>Ale(e)),t(` undoCoordinateSystem`,()=>Pce(e)),t(` translateGraph`,()=>Ole(e)),t(` assignNodeIntersects`,()=>kle(e)),t(` reversePoints`,()=>jle(e)),t(` acyclic.undo`,()=>ace(e))}function hle(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var gle=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],_le={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},vle=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],yle=[`width`,`height`,`rank`],Q5={width:0,height:0},ble=[`minlen`,`weight`,`width`,`height`,`labeloffset`],xle={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Sle=[`labelpos`];function Cle(e){let t=new J8({multigraph:!0,compound:!0}),n=e7(e.graph());return t.setGraph(Object.assign({},_le,$5(n,gle),x5(n,vle))),e.nodes().forEach(n=>{let r=$5(e7(e.node(n)),yle);Object.keys(Q5).forEach(e=>{r[e]===void 0&&(r[e]=Q5[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=e7(e.edge(n));t.setEdge(n,Object.assign({},xle,$5(r,ble),x5(r,Sle)))}),t}function wle(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Tle(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);l5(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function Ele(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Dle(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Ole(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function kle(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(d5(r,a)),n.points.push(d5(i,o))})}function Ale(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function jle(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Mle(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function Nle(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Ple(e){f5(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{l5(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function Fle(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`selfedge`){let r=n,i=e.node(r.e.v),a=i.x+i.width/2,o=i.y,s=n.x-a,c=i.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:a+2*s/3,y:o-c},{x:a+5*s/6,y:o-c},{x:a+s,y:o},{x:a+5*s/6,y:o+c},{x:a+2*s/3,y:o+c}],r.label.x=n.x,r.label.y=n.y}})}function $5(e,t){return S5(x5(e,t),Number)}function e7(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}function Ile(e){let t=f5(e),n=new J8({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r=`layer`+t;n.setNode(r,{rank:`same`}),e.reduce((e,t)=>(n.setEdge(e,t,{style:`invis`}),t))}),n}var t7={graphlib:K8,version:Jse,layout:ple,debug:Ile,util:{time:_5,notime:v5}},Lle=200,Rle=120,zle=40,n7=40,r7=e=>e.measured?.width??Lle,i7=e=>e.measured?.height??Rle;function Ble(e,t){let n=new Set;for(let e of t)n.add(e.source),n.add(e.target);let r=e.filter(e=>n.has(e.id)),i=e.filter(e=>!n.has(e.id)),a=new Map,o=0,s=0;if(r.length>0){let e=new t7.graphlib.Graph().setDefaultEdgeLabel(()=>({}));e.setGraph({rankdir:`TB`,nodesep:60,ranksep:80});for(let t of r)e.setNode(t.id,{width:r7(t),height:i7(t)});for(let n of t)e.setEdge(n.source,n.target);t7.layout(e);let n=1/0,i=-1/0;for(let t of r){let r=e.node(t.id);if(r.x===void 0||r.y===void 0)continue;let o=r.x-r7(t)/2,s=r.y-i7(t)/2;a.set(t.id,{x:o,y:s}),n=Math.min(n,o),i=Math.max(i,s+i7(t))}o=Number.isFinite(n)?n:0,s=Number.isFinite(i)?i:0}if(i.length>0){let e=Math.max(...i.map(r7))+zle,t=Math.max(...i.map(i7))+n7,n=Math.max(1,Math.ceil(Math.sqrt(i.length))),c=r.length>0?o:0,l=r.length>0?s+n7*2:0;i.forEach((r,i)=>{let o=i%n,s=Math.floor(i/n);a.set(r.id,{x:c+o*e,y:l+s*t})})}return e.map(e=>{let t=a.get(e.id);return t===void 0?e:{...e,position:t}})}function a7({projectId:e,documentId:t}){return(0,U.jsxs)(Bi,{to:`/projects/$id/documents/$docId`,params:{id:e,docId:t},"aria-label":`Open doc`,className:`inline-flex items-center gap-1 text-[11px] font-medium text-[var(--text-2)] hover:text-foreground`,onClick:e=>{e.stopPropagation()},children:[(0,U.jsx)(tb,{className:`size-[13px]`}),`Doc`]})}function Vle({taskId:e,data:t,onPatch:n,onDelete:r,onClose:i,isSaving:a=!1,tags:o,tagSuggestions:s=[],onAddTag:c,onRemoveTag:l}){let[u,d]=(0,H.useState)(t.label),[f,p]=(0,H.useState)(t.assignee??``),[m,h]=(0,H.useState)(t.dueDate===null?``:t.dueDate.slice(0,10)),[g,_]=(0,H.useState)(``),[v,y]=(0,H.useState)(!1),[b,x]=(0,H.useState)(null),S=(0,H.useRef)(null),{data:C}=MS(t.projectId),w=mO(C??[]).map(e=>({id:e.id,title:e.title}));(0,H.useEffect)(()=>{d(t.label),p(t.assignee??``),h(t.dueDate===null?``:t.dueDate.slice(0,10)),_(``),x(null),y(!1)},[e,t.label,t.assignee,t.dueDate]);let T=()=>{let e=u.trim(),r=S.current,i={};if(r!==null&&r.isDirty()){let e=r.getMarkdown().trim();i={description:e===``?null:e}}n({...e!==``&&e!==t.label?{label:e}:{},...i,assignee:f.trim()===``?null:f.trim(),due_date:m===``?null:`${m}T00:00:00.000Z`}),y(!1)},E=()=>{confirm(`Delete this task? Connected edges will be removed.`)&&r()},D=c!==void 0&&l!==void 0,O=o??[];return(0,U.jsxs)(`aside`,{"aria-label":`Task details`,className:`absolute right-2 top-2 z-30 flex max-h-[calc(100%-1rem)] w-[340px] flex-col overflow-hidden rounded-lg border border-border bg-card shadow-[var(--shadow-pop)]`,children:[(0,U.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border px-3 py-2.5`,children:[(0,U.jsx)(ND,{status:t.status,onChange:e=>{n({status:e})}}),(0,U.jsx)(`span`,{className:`ml-auto`}),(0,U.jsx)(X,{type:`button`,variant:v?`secondary`:`ghost`,size:`sm`,"aria-label":v?`Stop editing`:`Edit task`,onClick:()=>{y(e=>!e)},children:v?`Done`:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(bb,{className:`size-3.5`}),` Edit`]})}),(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Delete task`,title:`Delete task`,className:`text-muted-foreground hover:text-destructive`,onClick:E,children:(0,U.jsx)(Lb,{})}),i===void 0?null:(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close task details`,onClick:i,children:(0,U.jsx)(Lb,{})})]}),(0,U.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-3 py-3`,children:[v?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(rw,{htmlFor:`task-label-${e}`,className:`mb-1 text-muted-foreground`,children:`Label`}),(0,U.jsx)(nw,{id:`task-label-${e}`,type:`text`,value:u,onChange:e=>{d(e.target.value)},className:`mb-3 font-semibold`})]}):(0,U.jsx)(`h3`,{className:`mb-3 text-[15px] font-semibold leading-snug`,children:t.label}),(0,U.jsxs)(`dl`,{className:`grid grid-cols-[80px_1fr] gap-y-2 py-1 text-[12.5px]`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(ND,{status:t.status,onChange:e=>{n({status:e})}})}),(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:`Assignee`}),(0,U.jsx)(`dd`,{children:v?null:(0,U.jsx)(`span`,{className:`text-[var(--text-2)]`,children:t.assignee??`Unassigned`})}),(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:`Due`}),(0,U.jsx)(`dd`,{children:v?null:(0,U.jsx)(`span`,{className:`text-[var(--text-2)]`,children:t.dueDate===null?`—`:t.dueDate.slice(0,10)})}),t.documentId===void 0?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:`Doc`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(a7,{projectId:t.projectId,documentId:t.documentId})})]})]}),v?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(rw,{htmlFor:`task-assignee-${e}`,className:`mt-3 mb-1 block text-muted-foreground`,children:`Assignee`}),(0,U.jsx)(nw,{id:`task-assignee-${e}`,type:`text`,value:f,onChange:e=>{p(e.target.value)},placeholder:`Unassigned`,className:`mb-3`}),(0,U.jsx)(rw,{htmlFor:`task-due-${e}`,className:`mb-1 block text-muted-foreground`,children:`Due date`}),(0,U.jsx)(nw,{id:`task-due-${e}`,type:`date`,value:m,onChange:e=>{h(e.target.value)},className:`mb-3`})]}):null,(0,U.jsx)(`div`,{className:`mb-1 mt-3 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Description`}),(0,U.jsx)(vX,{ref:S,value:t.description??``,mode:v?`editor`:`reader`,minHeight:`5rem`,ariaLabel:`Description`,projectId:t.projectId,seamless:!1,docLinks:w,onCommentOnSelection:e=>{x(e)}}),D?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mb-1 mt-4 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Tags`}),O.length>0?(0,U.jsx)(`div`,{className:`mb-1.5 flex flex-wrap gap-1`,children:O.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border bg-secondary px-2 py-0.5 text-xs font-medium`,children:[e.color===null?null:(0,U.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full`,style:{backgroundColor:e.color}}),e.name,v?(0,U.jsx)(`button`,{type:`button`,"aria-label":`Remove tag ${e.name}`,onClick:()=>{l(e.name)},className:`text-muted-foreground hover:text-foreground`,children:(0,U.jsx)(Lb,{className:`size-3`})}):null]},e.id))}):null,v?(0,U.jsxs)(`form`,{className:`flex gap-1.5`,onSubmit:e=>{e.preventDefault();let t=g.trim();t!==``&&(c(t),_(``))},children:[(0,U.jsx)(nw,{id:`task-tag-input-${e}`,type:`text`,value:g,onChange:e=>{_(e.target.value)},placeholder:`Add tag`,list:`task-tag-options-${e}`,"aria-label":`Add tag`}),(0,U.jsx)(`datalist`,{id:`task-tag-options-${e}`,children:s.map(e=>(0,U.jsx)(`option`,{value:e},e))}),(0,U.jsx)(X,{type:`submit`,variant:`outline`,size:`sm`,disabled:g.trim()===``,children:`Add tag`})]}):null]}):null,(0,U.jsx)(wX,{target:{type:`task`,id:e},attachPassage:b,onPassageConsumed:()=>{x(null)},embedded:!0})]}),v?(0,U.jsx)(`footer`,{className:`border-t border-border p-3`,children:(0,U.jsx)(X,{type:`button`,className:`w-full`,disabled:a,onClick:T,children:a?`Saving…`:`Save details`})}):null]})}var o7=null;function s7(e){o7=e}function Hle({id:e,data:t,selected:n}){let[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(t.label);(0,H.useEffect)(()=>{o(t.label)},[t.label]);let s=()=>{let n=a.trim();if(n===``||n===t.label){o(t.label),i(!1);return}o7?.onPatchLabel(e,n),i(!1)};return(0,U.jsxs)(`div`,{className:Y(`group relative w-[212px] cursor-grab rounded-lg border border-border bg-card p-2.5 shadow-sm transition-[border-color,box-shadow] hover:border-[var(--border-strong)] hover:shadow-[var(--shadow-pop)]`,n&&`border-foreground shadow-[0_0_0_1px_var(--foreground)]`),children:[(0,U.jsx)(a8,{type:`target`,position:V2.Top,className:`!bg-[var(--border-strong)]`}),(0,U.jsxs)(`div`,{className:`mb-2 flex items-start gap-1`,children:[r?(0,U.jsx)(`input`,{className:`nodrag flex-1 rounded border border-[var(--border-strong)] px-1.5 py-0.5 text-[12.5px] font-semibold leading-tight outline-none focus-visible:ring-2 focus-visible:ring-ring`,type:`text`,value:a,autoFocus:!0,onChange:e=>{o(e.target.value)},onBlur:s,onKeyDown:e=>{e.key===`Enter`&&s(),e.key===`Escape`&&(o(t.label),i(!1))},"aria-label":`Task label`}):(0,U.jsx)(`button`,{className:`nodrag flex-1 text-left text-[12.5px] font-semibold leading-snug`,type:`button`,onClick:()=>{i(!0)},title:`Edit label`,children:t.label}),(0,U.jsx)(X,{className:`nodrag -mr-1 -mt-1 size-5 text-muted-foreground hover:text-destructive`,variant:`ghost`,size:`icon-xs`,type:`button`,onClick:t=>{t.stopPropagation(),confirm(`Delete this task? Connected edges will be removed.`)&&o7?.onDelete(e)},"aria-label":`Delete task`,title:`Delete task`,children:(0,U.jsx)(Lb,{})})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`nodrag`,children:(0,U.jsx)(ND,{status:t.status,onChange:t=>{o7?.onPatchStatus(e,t)}})}),t.documentId===void 0?null:(0,U.jsx)(`span`,{className:`nodrag ml-auto`,children:(0,U.jsx)(a7,{projectId:t.projectId,documentId:t.documentId})})]}),(0,U.jsx)(a8,{type:`source`,position:V2.Bottom,className:`!bg-[var(--border-strong)]`})]})}var Ule=400;function Wle(e){let t=jS(e),n=(0,H.useRef)([]),r=(0,H.useRef)([]),i=(0,H.useRef)(void 0),a=(0,H.useCallback)(()=>{t.mutate(fse(n.current,r.current))},[t]),o=(0,H.useCallback)(()=>{clearTimeout(i.current),i.current=setTimeout(()=>{a()},Ule)},[a]);return(0,H.useEffect)(()=>()=>{clearTimeout(i.current)},[]),{bindFlowState:(0,H.useCallback)((e,t)=>{n.current=e,r.current=t},[]),onNodeDragStop:(0,H.useCallback)(()=>{o()},[o]),saveWithState:(0,H.useCallback)((e,t)=>{n.current=e,r.current=t,clearTimeout(i.current),a()},[a]),isSaving:t.isPending,saveError:t.error}}var Gle={taskCard:Hle},Kle={labeled:pse},qle=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Jle({projectId:e}){let{screenToFlowPosition:t}=X6(),n=wS(e),[r,i]=(0,H.useState)(``);return(0,U.jsx)(O6,{position:`top-left`,children:(0,U.jsxs)(`form`,{className:`flex items-center gap-1.5 rounded-lg border border-border bg-card p-1 shadow-sm`,onSubmit:e=>{e.preventDefault();let a=r.trim();if(a===``)return;let o=t({x:window.innerWidth/2,y:window.innerHeight/2});n.mutate({label:a,status:`todo`,x:o.x,y:o.y},{onSuccess:()=>{i(``)}})},children:[(0,U.jsx)(nw,{type:`text`,value:r,onChange:e=>{i(e.target.value)},placeholder:`New task name`,"aria-label":`New task name`,className:`h-7 w-40 border-transparent bg-transparent text-[12.5px] shadow-none focus-visible:border-[var(--border-strong)]`}),(0,U.jsx)(X,{type:`submit`,size:`sm`,disabled:n.isPending||r.trim()===``,children:n.isPending?`Adding…`:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(xb,{}),` Add`]})})]})})}function Yle({onArrange:e}){let{fitView:t}=X6(),[n,r]=(0,H.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(O6,{position:`top-right`,children:(0,U.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{r(!0)},children:[(0,U.jsx)(ab,{}),` Auto layout`]})}),(0,U.jsx)(pO,{open:n,onOpenChange:r,title:`Auto layout?`,description:`Auto-layout repositions every node. Your manual arrangement will be replaced. Continue?`,confirmLabel:`Continue`,onConfirm:()=>{e(),t({padding:.2,duration:300}),r(!1)}})]})}function Xle(){let{zoomIn:e,zoomOut:t,fitView:n}=X6();return(0,U.jsx)(O6,{position:`bottom-left`,children:(0,U.jsxs)(`div`,{className:`flex flex-col divide-y divide-border overflow-hidden rounded-lg border border-border bg-card shadow-sm`,children:[(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Zoom in`,onClick:()=>{e({duration:200})},children:(0,U.jsx)(xb,{})}),(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Zoom out`,onClick:()=>{t({duration:200})},children:(0,U.jsx)(mb,{})}),(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Fit view`,onClick:()=>{n({padding:.2,duration:300})},children:(0,U.jsx)(fb,{})})]})})}function Zle({projectId:e}){let{data:t,isLoading:n,error:r}=AS(e),{data:i}=MS(e),{data:a}=DS(e),[o,s,c]=Poe([]),[l,u,d]=Foe([]),[f,p]=(0,H.useState)(null),[m,h]=(0,H.useState)([]),{bindFlowState:g,onNodeDragStop:_,saveWithState:v,isSaving:y,saveError:b}=Wle(e),x=TS(),S=ES(),C=ZS(e),w=(0,H.useRef)(()=>{}),T=(0,H.useCallback)((e,t)=>{w.current(e,t)},[]);(0,H.useEffect)(()=>{if(t===void 0)return;let e=i===void 0?void 0:lse(i);s(use(t.nodes,{taskDocumentMap:e})),u(dse(t.edges).map(e=>({...e,data:{...e.data,onLabelChange:T}})))},[t,i,s,u,T]),(0,H.useEffect)(()=>{g(o,l)},[o,l,g]),(0,H.useEffect)(()=>(s7({onPatchLabel:(e,t)=>{x.mutate({id:e,input:{label:t}}),s(n=>n.map(n=>n.id===e?{...n,data:{...n.data,label:t}}:n))},onPatchStatus:(e,t)=>{x.mutate({id:e,input:{status:t}}),s(n=>n.map(n=>n.id===e?{...n,data:{...n.data,status:t}}:n))},onDelete:t=>{S.mutate({id:t,projectId:e},{onSuccess:()=>{p(null)}})}}),()=>{s7(null)}),[x,S,e,s]),w.current=(0,H.useCallback)((e,t)=>{u(n=>{let r=n.map(n=>n.id===e?{...n,data:{...n.data,label:t}}:n);return v(o,r),r})},[u,o,v]);let E=(0,H.useCallback)(e=>{u(t=>{let n=G6({...e,type:`labeled`,data:{label:ka,onLabelChange:T}},t);return v(o,n),n})},[u,o,v,T]),D=(0,H.useCallback)(()=>{_()},[_]),O=(0,H.useCallback)(()=>{s(e=>{let t=Ble(e,l);return v(t,l),t})},[s,l,v]),k=(0,H.useCallback)(e=>{p(e.nodes[0]?.id??null),h(e.edges.map(e=>e.id))},[]),A=(0,H.useCallback)(e=>{u(t=>{let n=t.filter(t=>t.id!==e);return v(o,n),n})},[u,o,v]),j=(0,H.useCallback)(()=>{if(m.length!==0&&confirm(`Delete ${String(m.length)} selected edge(s)?`)){for(let e of m)qle.test(e)?C.mutate(e,{onSuccess:()=>{A(e)}}):A(e);h([])}},[m,C,A]),M=(0,H.useCallback)(t=>{if(t.key===`Delete`||t.key===`Backspace`){let n=t.target;if(n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.tagName===`SELECT`)return;if(m.length>0){t.preventDefault(),j();return}f!==null&&(t.preventDefault(),confirm(`Delete this task? Connected edges will be removed.`)&&S.mutate({id:f,projectId:e},{onSuccess:()=>{p(null)}}))}},[m,j,f,S,e]),N=f===null?void 0:o.find(e=>e.id===f);if(n)return(0,U.jsx)(`p`,{children:`Loading canvas…`});if(r!==null)return(0,U.jsxs)(`p`,{role:`alert`,children:[`Failed to load canvas: `,r.message]});if(t===void 0)return(0,U.jsx)(`p`,{children:`Canvas not found.`});let P=o.filter(e=>e.type===`taskCard`),F=f!==null&&t!==void 0?t.nodes.find(e=>e.id===f):void 0;return(0,U.jsxs)(`div`,{className:`relative h-full min-w-0 flex-1 focus:outline-none`,onKeyDown:M,tabIndex:0,children:[P.length===0?(0,U.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-20 flex items-center justify-center`,children:(0,U.jsx)(`p`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-sm text-muted-foreground shadow-sm`,children:`No tasks yet — add one in the box above to start your plan.`})}):null,y?(0,U.jsx)(`span`,{className:`pointer-events-none absolute left-1/2 top-2 z-20 -translate-x-1/2 rounded-full border border-border bg-card px-2.5 py-1 text-[11px] text-muted-foreground shadow-sm`,children:`Saving…`}):null,b===null?null:(0,U.jsxs)(`p`,{role:`alert`,className:`pointer-events-none absolute left-1/2 top-10 z-20 -translate-x-1/2 rounded-full border border-destructive/40 bg-card px-2.5 py-1 text-[11px] text-destructive shadow-sm`,children:[`Save failed: `,b.message]}),m.length>0?(0,U.jsx)(O6,{position:`top-center`,children:(0,U.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,className:`border-destructive/40 bg-card text-destructive hover:bg-destructive/10`,onClick:j,children:[(0,U.jsx)(Mb,{}),` Delete edge`]})}):null,N===void 0?null:(0,U.jsx)(Vle,{taskId:N.id,data:N.data,isSaving:x.isPending,tags:F?.tags??[],tagSuggestions:a?.map(e=>e.name)??[],onAddTag:e=>{if(F===void 0)return;let t=(F.tags??[]).map(e=>e.name);t.includes(e)||x.mutate({id:F.id,input:{tags:[...t,e]}})},onRemoveTag:e=>{if(F===void 0)return;let t=(F.tags??[]).map(e=>e.name).filter(t=>t!==e);x.mutate({id:F.id,input:{tags:t}})},onPatch:e=>{x.mutate({id:N.id,input:e})},onClose:()=>{p(null)},onDelete:()=>{S.mutate({id:N.id,projectId:e},{onSuccess:()=>{p(null)}})}}),(0,U.jsx)(`div`,{className:`h-full w-full bg-[var(--canvas)]`,children:(0,U.jsxs)(joe,{nodes:o,edges:l,onNodesChange:c,onEdgesChange:d,onConnect:E,onNodeDragStop:D,onSelectionChange:k,nodeTypes:Gle,edgeTypes:Kle,fitView:!0,children:[(0,U.jsx)(Boe,{variant:R8.Dots,gap:20,size:1.2,color:`var(--border-strong)`}),(0,U.jsx)(Jle,{projectId:e}),(0,U.jsx)(Yle,{onArrange:O}),(0,U.jsx)(Xle,{})]})})]})}function c7(e){let t=e.status;return typeof t==`string`&&Da.includes(t)?{status:t}:{}}function Qle(){let{id:e}=l7.useParams(),{data:t,isLoading:n,error:r}=xS(e);return n?(0,U.jsx)(`p`,{children:`Loading project…`}):r?(0,U.jsxs)(`p`,{role:`alert`,children:[`Failed to load project: `,r.message]}):t===void 0?(0,U.jsx)(`p`,{children:`Project not found.`}):(0,U.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,U.jsx)(Zle,{projectId:e}),(0,U.jsx)(`div`,{className:`relative h-full w-[300px] shrink-0 border-l border-border bg-card`,children:(0,U.jsx)(fO,{projectId:e,className:`rounded-none border-0 shadow-none`})})]})}var l7=Ki(`/projects/$id/flow`)({validateSearch:c7,component:Qle}),u7=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function d7(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function f7(e){return`nodeType`in e}function p7(e){return e?d7(e)?e:f7(e)?e.ownerDocument?.defaultView??window:window:window}function m7(e){let{Document:t}=p7(e);return e instanceof t}function h7(e){return d7(e)?!1:e instanceof p7(e).HTMLElement}function g7(e){return e instanceof p7(e).SVGElement}function _7(e){return e?d7(e)?e.document:f7(e)?m7(e)?e:h7(e)||g7(e)?e.ownerDocument:document:document:document}var v7=u7?H.useLayoutEffect:H.useEffect;function y7(e){let t=(0,H.useRef)(e);return v7(()=>{t.current=e}),(0,H.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function $le(){let e=(0,H.useRef)(null);return[(0,H.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,H.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function b7(e,t){t===void 0&&(t=[e]);let n=(0,H.useRef)(e);return v7(()=>{n.current!==e&&(n.current=e)},t),n}function x7(e,t){let n=(0,H.useRef)();return(0,H.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function S7(e){let t=y7(e),n=(0,H.useRef)(null);return[n,(0,H.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function C7(e){let t=(0,H.useRef)();return(0,H.useEffect)(()=>{t.current=e},[e]),t.current}var w7={};function T7(e,t){return(0,H.useMemo)(()=>{if(t)return t;let n=w7[e]==null?0:w7[e]+1;return w7[e]=n,e+`-`+n},[e,t])}function E7(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var D7=E7(1),O7=E7(-1);function eue(e){return`clientX`in e&&`clientY`in e}function k7(e){if(!e)return!1;let{KeyboardEvent:t}=p7(e.target);return t&&e instanceof t}function tue(e){if(!e)return!1;let{TouchEvent:t}=p7(e.target);return t&&e instanceof t}function A7(e){if(tue(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return eue(e)?{x:e.clientX,y:e.clientY}:null}var j7=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[j7.Translate.toString(e),j7.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),M7=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function nue(e){return e.matches(M7)?e:e.querySelector(M7)}var rue={display:`none`};function iue(e){let{id:t,value:n}=e;return H.createElement(`div`,{id:t,style:rue},n)}function aue(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return H.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function oue(){let[e,t]=(0,H.useState)(``);return{announce:(0,H.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var N7=(0,H.createContext)(null);function sue(e){let t=(0,H.useContext)(N7);(0,H.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function cue(){let[e]=(0,H.useState)(()=>new Set),t=(0,H.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,H.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var P7={draggable:`
|
|
355
|
+
To pick up a draggable item, press the space bar.
|
|
356
|
+
While dragging, use the arrow keys to move the item.
|
|
357
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
358
|
+
`},lue={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function uue(e){let{announcements:t=lue,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=P7}=e,{announce:a,announcement:o}=oue(),s=T7(`DndLiveRegion`),[c,l]=(0,H.useState)(!1);if((0,H.useEffect)(()=>{l(!0)},[]),sue((0,H.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=H.createElement(H.Fragment,null,H.createElement(iue,{id:r,value:i.draggable}),H.createElement(aue,{id:s,announcement:o}));return n?(0,Oi.createPortal)(u,n):u}var F7;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(F7||={});function I7(){}function L7(e,t){return(0,H.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function due(){var e=[...arguments];return(0,H.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var R7=Object.freeze({x:0,y:0});function fue(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function pue(e,t){let n=A7(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function mue(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function hue(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function z7(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function gue(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}var _ue=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=z7(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=z7(r),o=i.reduce((e,t,r)=>e+fue(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(mue)};function vue(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var yue=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=vue(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(hue)};function bue(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function B7(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:R7}function xue(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var Sue=xue(1);function V7(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Cue(e,t,n){let r=V7(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var wue={ignoreTransform:!1};function H7(e,t){t===void 0&&(t=wue);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=p7(e).getComputedStyle(e);t&&(n=Cue(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function U7(e){return H7(e,{ignoreTransform:!0})}function Tue(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Eue(e,t){return t===void 0&&(t=p7(e).getComputedStyle(e)),t.position===`fixed`}function Due(e,t){t===void 0&&(t=p7(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function W7(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(m7(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!h7(i)||g7(i)||n.includes(i))return n;let a=p7(e).getComputedStyle(i);return i!==e&&Due(i,a)&&n.push(i),Eue(i,a)?n:r(i.parentNode)}return e?r(e):n}function G7(e){let[t]=W7(e,1);return t??null}function K7(e){return!u7||!e?null:d7(e)?e:f7(e)?m7(e)||e===_7(e).scrollingElement?window:h7(e)?e:null:null}function q7(e){return d7(e)?e.scrollX:e.scrollLeft}function J7(e){return d7(e)?e.scrollY:e.scrollTop}function Y7(e){return{x:q7(e),y:J7(e)}}var X7;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(X7||={});function Z7(e){return!u7||!e?!1:e===document.scrollingElement}function Q7(e){let t={x:0,y:0},n=Z7(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Oue={x:.2,y:.2};function kue(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Oue);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Q7(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=X7.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=X7.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=X7.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=X7.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Aue(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function $7(e){return e.reduce((e,t)=>D7(e,Y7(t)),R7)}function jue(e){return e.reduce((e,t)=>e+q7(t),0)}function Mue(e){return e.reduce((e,t)=>e+J7(t),0)}function e9(e,t){if(t===void 0&&(t=H7),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);G7(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Nue=[[`x`,[`left`,`right`],jue],[`y`,[`top`,`bottom`],Mue]],t9=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=W7(t),r=$7(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Nue)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},n9=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Pue(e){let{EventTarget:t}=p7(e);return e instanceof t?e:_7(e)}function r9(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var i9;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(i9||={});function a9(e){e.preventDefault()}function Fue(e){e.stopPropagation()}var o9;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(o9||={});var s9={start:[o9.Space,o9.Enter],cancel:[o9.Esc],end:[o9.Space,o9.Enter,o9.Tab]},Iue=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case o9.Right:return{...n,x:n.x+25};case o9.Left:return{...n,x:n.x-25};case o9.Down:return{...n,y:n.y+25};case o9.Up:return{...n,y:n.y-25}}},c9=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new n9(_7(t)),this.windowListeners=new n9(p7(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(i9.Resize,this.handleCancel),this.windowListeners.add(i9.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(i9.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&e9(n),t(R7)}handleKeyDown(e){if(k7(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=s9,coordinateGetter:a=Iue,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:R7;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=O7(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Q7(n),p=Aue(n),m={x:Math.min(i===o9.Right?p.right-p.width/2:p.right,Math.max(i===o9.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===o9.Down?p.bottom-p.height/2:p.bottom,Math.max(i===o9.Down?p.top:p.top+p.height/2,u.y))},h=i===o9.Right&&!s||i===o9.Left&&!c,g=i===o9.Down&&!l||i===o9.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===o9.Right&&e<=d.x||i===o9.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===o9.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===o9.Down&&e<=d.y||i===o9.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===o9.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,D7(O7(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};c9.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=s9,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function l9(e){return!!(e&&`distance`in e)}function u9(e){return!!(e&&`delay`in e)}var d9=class{constructor(e,t,n){n===void 0&&(n=Pue(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=_7(i),this.documentListeners=new n9(this.document),this.listeners=new n9(n),this.windowListeners=new n9(p7(i)),this.initialCoordinates=A7(r)??R7,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(i9.Resize,this.handleCancel),this.windowListeners.add(i9.DragStart,a9),this.windowListeners.add(i9.VisibilityChange,this.handleCancel),this.windowListeners.add(i9.ContextMenu,a9),this.documentListeners.add(i9.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(u9(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(l9(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(i9.Click,Fue,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(i9.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=A7(e)??R7,s=O7(n,o);if(!t&&a){if(l9(a)){if(a.tolerance!=null&&r9(s,a.tolerance))return this.handleCancel();if(r9(s,a.distance))return this.handleStart()}if(u9(a)&&r9(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===o9.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Lue={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},f9=class extends d9{constructor(e){let{event:t}=e,n=_7(t.target);super(e,Lue,n)}};f9.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Rue={move:{name:`mousemove`},end:{name:`mouseup`}},p9;(function(e){e[e.RightClick=2]=`RightClick`})(p9||={});var zue=class extends d9{constructor(e){super(e,Rue,_7(e.event.target))}};zue.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===p9.RightClick?!1:(r?.({event:n}),!0)}}];var m9={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Bue=class extends d9{constructor(e){super(e,m9)}static setup(){return window.addEventListener(m9.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(m9.move.name,e)};function e(){}}};Bue.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var h9;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(h9||={});var g9;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(g9||={});function Vue(e){let{acceleration:t,activator:n=h9.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=g9.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Uue({delta:d,disabled:!a}),[m,h]=$le(),g=(0,H.useRef)({x:0,y:0}),_=(0,H.useRef)({x:0,y:0}),v=(0,H.useMemo)(()=>{switch(n){case h9.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case h9.DraggableRect:return i}},[n,i,c]),y=(0,H.useRef)(null),b=(0,H.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,H.useMemo)(()=>s===g9.TreeOrder?[...l].reverse():l,[s,l]);(0,H.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=kue(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var Hue={x:{[X7.Backward]:!1,[X7.Forward]:!1},y:{[X7.Backward]:!1,[X7.Forward]:!1}};function Uue(e){let{delta:t,disabled:n}=e,r=C7(t);return x7(e=>{if(n||!r||!e)return Hue;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[X7.Backward]:e.x[X7.Backward]||i.x===-1,[X7.Forward]:e.x[X7.Forward]||i.x===1},y:{[X7.Backward]:e.y[X7.Backward]||i.y===-1,[X7.Forward]:e.y[X7.Forward]||i.y===1}}},[n,t,r])}function Wue(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return x7(e=>t==null?null:r??e??null,[r,t])}function Gue(e,t){return(0,H.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var _9;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(_9||={});var v9;(function(e){e.Optimized=`optimized`})(v9||={});var y9=new Map;function Kue(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,H.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,H.useRef)(e),d=g(),f=b7(d),p=(0,H.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,H.useRef)(null),h=x7(t=>{if(d&&!n)return y9;if(!t||t===y9||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new t9(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,H.useEffect)(()=>{u.current=e},[e]),(0,H.useEffect)(()=>{d||p()},[n,d]),(0,H.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,H.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case _9.Always:return!1;case _9.BeforeDragging:return n;default:return!n}}}function b9(e,t){return x7(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function que(e,t){return b9(e,t)}function Jue(e){let{callback:t,disabled:n}=e,r=y7(t),i=(0,H.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,H.useEffect)(()=>()=>i?.disconnect(),[i]),i}function x9(e){let{callback:t,disabled:n}=e,r=y7(t),i=(0,H.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,H.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Yue(e){return new t9(H7(e),e)}function S9(e,t,n){t===void 0&&(t=Yue);let[r,i]=(0,H.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=Jue({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=x9({callback:a});return v7(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Xue(e){return B7(e,b9(e))}var C9=[];function Zue(e){let t=(0,H.useRef)(e),n=x7(n=>e?n&&n!==C9&&e&&t.current&&e.parentNode===t.current.parentNode?n:W7(e):C9,[e]);return(0,H.useEffect)(()=>{t.current=e},[e]),n}function Que(e){let[t,n]=(0,H.useState)(null),r=(0,H.useRef)(e),i=(0,H.useCallback)(e=>{let t=K7(e.target);t&&n(e=>e?(e.set(t,Y7(t)),new Map(e)):null)},[]);return(0,H.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=K7(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Y7(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{K7(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,H.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>D7(e,t),R7):$7(e):R7,[e,t])}function w9(e,t){t===void 0&&(t=[]);let n=(0,H.useRef)(null);return(0,H.useEffect)(()=>{n.current=null},t),(0,H.useEffect)(()=>{let t=e!==R7;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?O7(e,n.current):R7}function $ue(e){(0,H.useEffect)(()=>{if(!u7)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function ede(e,t){return(0,H.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function T9(e){return(0,H.useMemo)(()=>e?Tue(e):null,[e])}var E9=[];function tde(e,t){t===void 0&&(t=H7);let[n]=e,r=T9(n?p7(n):null),[i,a]=(0,H.useState)(E9);function o(){a(()=>e.length?e.map(e=>Z7(e)?r:new t9(t(e),e)):E9)}let s=x9({callback:o});return v7(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function D9(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return h7(t)?t:e}function nde(e){let{measure:t}=e,[n,r]=(0,H.useState)(null),i=x9({callback:(0,H.useCallback)(e=>{for(let{target:n}of e)if(h7(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=S7((0,H.useCallback)(e=>{let n=D9(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,H.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var rde=[{sensor:f9,options:{}},{sensor:c9,options:{}}],ide={current:{}},O9={draggable:{measure:U7},droppable:{measure:U7,strategy:_9.WhileDragging,frequency:v9.Optimized},dragOverlay:{measure:H7}},k9=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},ade={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new k9,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:I7},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:O9,measureDroppableContainers:I7,windowRect:null,measuringScheduled:!1},A9={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:I7,draggableNodes:new Map,over:null,measureDroppableContainers:I7},j9=(0,H.createContext)(A9),M9=(0,H.createContext)(ade);function ode(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new k9}}}function sde(e,t){switch(t.type){case F7.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case F7.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case F7.DragEnd:case F7.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case F7.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new k9(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case F7.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new k9(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case F7.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new k9(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function cde(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,H.useContext)(j9),a=C7(r),o=C7(n?.id);return(0,H.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!k7(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=nue(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function N9(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function lde(e){return(0,H.useMemo)(()=>({draggable:{...O9.draggable,...e?.draggable},droppable:{...O9.droppable,...e?.droppable},dragOverlay:{...O9.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function ude(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,H.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;v7(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=B7(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=G7(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var P9=(0,H.createContext)({...R7,scaleX:1,scaleY:1}),F9;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(F9||={});var dde=(0,H.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=rde,collisionDetection:o=yue,measuring:s,modifiers:c,...l}=e,[u,d]=(0,H.useReducer)(sde,void 0,ode),[f,p]=cue(),[m,h]=(0,H.useState)(F9.Uninitialized),g=m===F9.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,H.useRef)({initial:null,translated:null}),C=(0,H.useMemo)(()=>_==null?null:{id:_,data:x?.data??ide,rect:S},[_,x]),w=(0,H.useRef)(null),[T,E]=(0,H.useState)(null),[D,O]=(0,H.useState)(null),k=b7(l,Object.values(l)),A=T7(`DndDescribedBy`,t),j=(0,H.useMemo)(()=>b.getEnabled(),[b]),M=lde(s),{droppableRects:N,measureDroppableContainers:P,measuringScheduled:F}=Kue(j,{dragging:g,dependencies:[y.x,y.y],config:M.droppable}),I=Wue(v,_),L=(0,H.useMemo)(()=>D?A7(D):null,[D]),ee=De(),te=que(I,M.draggable.measure);ude({activeNode:_==null?null:v.get(_),config:ee.layoutShiftCompensation,initialRect:te,measure:M.draggable.measure});let ne=S9(I,M.draggable.measure,te),R=S9(I?I.parentElement:null),z=(0,H.useRef)({activatorEvent:null,active:null,activeNode:I,collisionRect:null,collisions:null,droppableRects:N,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),B=b.getNodeFor(z.current.over?.id),re=nde({measure:M.dragOverlay.measure}),V=re.nodeRef.current??I,ie=g?re.rect??ne:null,ae=!!(re.nodeRef.current&&re.rect),oe=Xue(ae?null:ne),se=T9(V?p7(V):null),ce=Zue(g?B??I:null),le=tde(ce),ue=N9(c,{transform:{x:y.x-oe.x,y:y.y-oe.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:ne,containerNodeRect:R,draggingNodeRect:ie,over:z.current.over,overlayNodeRect:re.rect,scrollableAncestors:ce,scrollableAncestorRects:le,windowRect:se}),de=L?D7(L,y):null,fe=Que(ce),pe=w9(fe),me=w9(fe,[ne]),he=D7(ue,pe),ge=ie?Sue(ie,ue):null,_e=C&&ge?o({active:C,collisionRect:ge,droppableRects:N,droppableContainers:j,pointerCoordinates:de}):null,ve=gue(_e,`id`),[ye,be]=(0,H.useState)(null),xe=bue(ae?ue:D7(ue,me),ye?.rect??null,ne),Se=(0,H.useRef)(null),Ce=(0,H.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;Se.current=new n({active:w.current,activeNode:i,event:a,options:r,context:z,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Oi.unstable_batchedUpdates)(()=>{r?.(i),h(F9.Initializing),d({type:F7.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(Se.current),O(a)})},onMove(e){d({type:F7.DragMove,coordinates:e})},onEnd:o(F7.DragEnd),onCancel:o(F7.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=z.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===F7.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=F7.DragCancel)}w.current=null,(0,Oi.unstable_batchedUpdates)(()=>{d({type:e}),h(F9.Uninitialized),be(null),E(null),O(null),Se.current=null;let t=e===F7.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),we=Gue(a,(0,H.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Ce(n,t))},[v,Ce]));$ue(a),v7(()=>{ne&&m===F9.Initializing&&h(F9.Initialized)},[ne,m]),(0,H.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=z.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:he.x,y:he.y},over:i};(0,Oi.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[he.x,he.y]),(0,H.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=z.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(ve),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Oi.unstable_batchedUpdates)(()=>{be(s),a?.(c),f({type:`onDragOver`,event:c})})},[ve]),v7(()=>{z.current={activatorEvent:D,active:C,activeNode:I,collisionRect:ge,collisions:_e,droppableRects:N,draggableNodes:v,draggingNode:V,draggingNodeRect:ie,droppableContainers:b,over:ye,scrollableAncestors:ce,scrollAdjustedTranslate:he},S.current={initial:ie,translated:ge}},[C,I,_e,ge,v,V,ie,N,b,ye,ce,he]),Vue({...ee,delta:y,draggingRect:ge,pointerCoordinates:de,scrollableAncestors:ce,scrollableAncestorRects:le});let Te=(0,H.useMemo)(()=>({active:C,activeNode:I,activeNodeRect:ne,activatorEvent:D,collisions:_e,containerNodeRect:R,dragOverlay:re,draggableNodes:v,droppableContainers:b,droppableRects:N,over:ye,measureDroppableContainers:P,scrollableAncestors:ce,scrollableAncestorRects:le,measuringConfiguration:M,measuringScheduled:F,windowRect:se}),[C,I,ne,D,_e,R,re,v,b,N,ye,P,ce,le,M,F,se]),Ee=(0,H.useMemo)(()=>({activatorEvent:D,activators:we,active:C,activeNodeRect:ne,ariaDescribedById:{draggable:A},dispatch:d,draggableNodes:v,over:ye,measureDroppableContainers:P}),[D,we,C,ne,d,A,v,ye,P]);return H.createElement(N7.Provider,{value:p},H.createElement(j9.Provider,{value:Ee},H.createElement(M9.Provider,{value:Te},H.createElement(P9.Provider,{value:xe},i)),H.createElement(cde,{disabled:n?.restoreFocus===!1})),H.createElement(uue,{...n,hiddenTextDescribedById:A}));function De(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),fde=(0,H.createContext)(null),I9=`button`,pde=`Draggable`;function mde(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=T7(pde),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,H.useContext)(j9),{role:p=I9,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,H.useContext)(g?P9:fde),[v,y]=S7(),[b,x]=S7(),S=ede(o,t),C=b7(n);return v7(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,H.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===I9?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function L9(){return(0,H.useContext)(M9)}var hde=`Droppable`,gde={timeout:25};function _de(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=T7(hde),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,H.useContext)(j9),u=(0,H.useRef)({disabled:n}),d=(0,H.useRef)(!1),f=(0,H.useRef)(null),p=(0,H.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...gde,...i},_=b7(h??r),v=x9({callback:(0,H.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=S7((0,H.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=b7(t);return(0,H.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,H.useEffect)(()=>(s({type:F7.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:F7.UnregisterDroppable,key:a,id:r})),[r]),(0,H.useEffect)(()=>{n!==u.current.disabled&&(s({type:F7.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function vde(e){let{animation:t,children:n}=e,[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(null),s=C7(n);return!n&&!r&&s&&i(s),v7(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),H.createElement(H.Fragment,null,n,r?(0,H.cloneElement)(r,{ref:o}):null)}var yde={x:0,y:0,scaleX:1,scaleY:1};function bde(e){let{children:t}=e;return H.createElement(j9.Provider,{value:A9},H.createElement(P9.Provider,{value:yde},t))}var xde={position:`fixed`,touchAction:`none`},Sde=e=>k7(e)?`transform 250ms ease`:void 0,Cde=(0,H.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Sde}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...xde,width:s.width,height:s.height,top:s.top,left:s.left,transform:j7.Transform.toString(d),transformOrigin:i&&r?pue(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return H.createElement(n,{className:o,style:f,ref:t},a)}),wde={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:j7.Transform.toString(t)},{transform:j7.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function Tde(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return y7((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=D9(a);if(!c)return;let{transform:l}=p7(a).getComputedStyle(a),u=V7(l);if(!u)return;let d=typeof t==`function`?t:Ede(t);return e9(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function Ede(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...wde,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var R9=0;function Dde(e){return(0,H.useMemo)(()=>{if(e!=null)return R9++,R9},[e])}var Ode=H.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=L9(),S=(0,H.useContext)(P9),C=Dde(d?.id),w=N9(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=b9(f),E=Tde({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return H.createElement(bde,null,H.createElement(vde,{animation:E},d&&C?H.createElement(Cde,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))}),z9=6;function kde({task:e,hasLinkedDoc:t,onOpen:n,onChangeStatus:r,onRequestDelete:i}){let a=DD(e.tags),o=(e.tags??[]).filter(e=>!e.name.startsWith(ED)),{attributes:s,listeners:c,setNodeRef:l,isDragging:u}=mde({id:e.id,data:{status:e.status}}),d=(0,H.useRef)(null);return(0,U.jsxs)(Jb,{ref:l,"data-task-id":e.id,"data-task-status":e.status,onClick:e=>{let t=d.current;d.current=null,!(t!==null&&(Math.abs(e.clientX-t.x)>z9||Math.abs(e.clientY-t.y)>z9))&&n()},onPointerDown:e=>{d.current={x:e.clientX,y:e.clientY},c?.onPointerDown?.(e)},onKeyDown:e=>{c?.onKeyDown?.(e)},...s,style:{touchAction:`none`},className:Y(`group relative w-full cursor-pointer gap-0 rounded-lg px-2.5 py-2.5 shadow-[var(--shadow)] transition`,`hover:border-[var(--border-strong)] hover:shadow-[var(--shadow-pop)]`,u&&`opacity-40`),children:[(0,U.jsx)(`div`,{className:`absolute right-1.5 top-1.5 opacity-100 transition`,children:(0,U.jsxs)(Rb,{children:[(0,U.jsx)(zb,{asChild:!0,children:(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Task actions`,onPointerDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation()},children:(0,U.jsx)(rte,{})})}),(0,U.jsxs)(Bb,{align:`end`,children:[(0,U.jsx)(Vb,{onSelect:()=>{n()},children:`Open`}),(0,U.jsxs)(Wb,{children:[(0,U.jsx)(Gb,{children:`Move to`}),(0,U.jsx)(Kb,{children:Da.map(t=>(0,U.jsx)(Vb,{disabled:t===e.status,onSelect:()=>{r(t)},children:wD[t]},t))})]}),(0,U.jsx)(Ub,{}),(0,U.jsx)(Vb,{variant:`destructive`,onSelect:()=>{i()},children:`Delete`})]})]})}),(0,U.jsx)(`p`,{className:`mb-2 mr-6 text-[13px] font-medium leading-snug`,children:e.label}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,U.jsx)(ND,{status:e.status,onChange:r}),a===void 0?null:(0,U.jsx)(`span`,{className:`text-[10.5px] font-medium uppercase tracking-wide text-muted-foreground`,title:`Review gate — auto: ships without review · approve: needs a human OK · full: independent review + human`,children:a}),t?(0,U.jsx)(tb,{className:`size-3.5 text-muted-foreground`,"aria-label":`Has linked document`}):null,(0,U.jsx)(`span`,{className:`mono ml-auto text-[10.5px] text-muted-foreground`,title:`Short ID — last 4 characters of this task's ID, for quick reference`,children:B9(e.id)})]}),o.length>0?(0,U.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:o.map(e=>(0,U.jsxs)(`span`,{"data-tag-chip":e.name,className:`inline-flex items-center gap-1 rounded-full border bg-secondary px-2 py-0.5 text-[11px] font-medium text-secondary-foreground`,children:[e.color===null?null:(0,U.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full`,style:{backgroundColor:e.color}}),e.name]},e.id))}):null]})}function Ade({task:e,hasLinkedDoc:t}){let n=DD(e.tags);return(0,U.jsxs)(Jb,{className:`w-[258px] gap-0 rounded-lg px-2.5 py-2.5 shadow-[var(--shadow-pop)]`,children:[(0,U.jsx)(`p`,{className:`mb-2 mr-6 text-[13px] font-medium leading-snug`,children:e.label}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,U.jsx)(MD,{status:e.status,tabIndex:-1}),n===void 0?null:(0,U.jsx)(`span`,{className:`text-[10.5px] font-medium uppercase tracking-wide text-muted-foreground`,children:n}),t?(0,U.jsx)(tb,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}):null,(0,U.jsx)(`span`,{className:`mono ml-auto text-[10.5px] text-muted-foreground`,children:B9(e.id)})]})]})}function B9(e){return e.length<=4?e:e.slice(-4).toUpperCase()}var jde={scope:{title:`Nothing in scope`,body:`Ideas awaiting sizing land here before a human releases them.`},todo:{title:`No todos`,body:`Tasks waiting to start show up here.`},in_progress:{title:`Quiet for now`,body:`Nothing actively in progress.`},done:{title:`Nothing done yet`,body:`Completed tasks collect here.`},backlog:{title:`Backlog is clear`,body:`Unshaped requests wait here until triage sorts them.`}};function Mde({status:e,tasks:t,linkedDocTaskIds:n,onOpenTask:r,onChangeStatus:i,onRequestDelete:a,onAddTask:o}){let s=wD[e],c=jde[e],{setNodeRef:l,isOver:u}=_de({id:e}),{active:d}=L9(),f=d?.data.current?.status;return(0,U.jsxs)(`section`,{ref:l,"data-board-column":e,className:Y(`flex w-[274px] flex-shrink-0 flex-col rounded-lg transition-colors`,u&&f!==void 0&&f!==e&&`bg-muted/50 ring-2 ring-ring/30`),children:[(0,U.jsxs)(`header`,{className:`flex items-center gap-2 px-1 pb-2.5`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`size-2 flex-shrink-0 rounded-full`,style:{backgroundColor:AD[e].dot}}),(0,U.jsx)(`span`,{className:`text-[12.5px] font-semibold`,children:s}),(0,U.jsx)(`span`,{className:`mono rounded-full bg-secondary px-1.5 text-[11.5px] text-muted-foreground`,children:t.length}),(0,U.jsx)(`span`,{className:`ml-auto`}),(0,U.jsx)(X,{type:`button`,"data-add-task":!0,variant:`ghost`,size:`icon-xs`,"aria-label":`Add task to ${s}`,onClick:()=>{o(e)},children:(0,U.jsx)(xb,{})})]}),(0,U.jsx)(`div`,{className:`flex min-h-0 flex-col gap-2 overflow-y-auto px-0.5 pb-2`,children:t.length===0?(0,U.jsxs)(`div`,{className:`rounded-lg border border-dashed border-[var(--border-strong)] px-2.5 py-4 text-center text-xs text-muted-foreground`,children:[(0,U.jsx)(`p`,{className:`font-semibold text-[var(--text-2)]`,children:c.title}),(0,U.jsx)(`p`,{className:`mt-0.5 leading-snug`,children:c.body})]}):(0,U.jsxs)(U.Fragment,{children:[t.map(e=>(0,U.jsx)(kde,{task:e,hasLinkedDoc:n.has(e.id),onOpen:()=>{r(e.id)},onChangeStatus:t=>{i(e.id,t)},onRequestDelete:()=>{a(e.id)}},e.id)),(0,U.jsxs)(`button`,{type:`button`,"data-add-task":!0,onClick:()=>{o(e)},className:Y(`flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12.5px] text-muted-foreground`,`hover:bg-secondary hover:text-foreground`),children:[(0,U.jsx)(xb,{className:`size-3.5`}),`Add task`]})]})})]})}function V9({resource:e}){let[t,n]=(0,H.useState)(!1),[r,i]=(0,H.useState)(`24h`),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(null),[d,f]=(0,H.useState)(!1),p=()=>{o(null),u(null),f(!1)},m=async()=>{c(!0),u(null);try{o(e.kind===`task`?await Ba(e.id,r):await Va(e.id,r))}catch{u(`Couldn't create the share link. Please try again.`)}finally{c(!1)}},h=a===null?``:a.url||a.markdown_url;return(0,U.jsxs)($x,{open:t,onOpenChange:e=>{n(e),e||p()},children:[(0,U.jsx)(eS,{asChild:!0,children:(0,U.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":`Share ${e.kind}`,children:[(0,U.jsx)(Tb,{className:`size-3.5`}),` Share`]})}),(0,U.jsxs)(iS,{className:`sm:max-w-md`,children:[(0,U.jsxs)(aS,{children:[(0,U.jsxs)(sS,{children:[`Share `,e.kind]}),(0,U.jsxs)(cS,{children:[`Create a public, read-only link that renders this `,e.kind,` as agent-ready Markdown`,e.kind===`task`?` — with its linked documents and images inlined.`:`.`]})]}),a===null?(0,U.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex-1`,children:[(0,U.jsx)(`span`,{className:`mb-1 block text-xs text-muted-foreground`,children:`Expires`}),(0,U.jsxs)(ww,{value:r,onValueChange:e=>i(e),children:[(0,U.jsx)(Ew,{className:`w-full`,children:(0,U.jsx)(Tw,{})}),(0,U.jsxs)(Dw,{children:[(0,U.jsx)(Ow,{value:`24h`,children:`In 24 hours`}),(0,U.jsx)(Ow,{value:`7d`,children:`In 7 days`}),(0,U.jsx)(Ow,{value:`never`,children:`Never`})]})]})]}),(0,U.jsx)(X,{type:`button`,onClick:m,disabled:s,children:s?`Creating…`:`Create link`})]}):null,l===null?null:(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:l}),a===null?null:(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(nw,{readOnly:!0,value:h,className:`mono text-xs`,onFocus:e=>{e.currentTarget.select()}}),(0,U.jsx)(X,{type:`button`,variant:`secondary`,size:`icon-sm`,"aria-label":`Copy link`,onClick:async()=>{if(a===null)return;let e=a.url||a.markdown_url;try{await navigator.clipboard.writeText(e),f(!0),BC(`Link copied`),setTimeout(()=>{f(!1)},1500)}catch{BC.error(`Couldn't copy — copy it manually.`)}},children:d?(0,U.jsx)(Zy,{className:`size-3.5`}):(0,U.jsx)(eb,{className:`size-3.5`})})]}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Anyone with this link can view it`,a.expires_at===null?` (no expiry)`:` until ${new Date(a.expires_at).toLocaleString()}`,`. Read-only.`]})]})]})]})}function Nde({...e}){return(0,U.jsx)(tu,{"data-slot":`sheet`,...e})}function Pde({...e}){return(0,U.jsx)(su,{"data-slot":`sheet-portal`,...e})}function Fde({className:e,...t}){return(0,U.jsx)(lu,{"data-slot":`sheet-overlay`,className:Y(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Ide({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,U.jsxs)(Pde,{children:[(0,U.jsx)(Fde,{}),(0,U.jsxs)(pu,{"data-slot":`sheet-content`,className:Y(`fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...i,children:[t,r&&(0,U.jsxs)(Su,{className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,U.jsx)(Lb,{className:`size-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Lde({className:e,...t}){return(0,U.jsx)(vu,{"data-slot":`sheet-title`,className:Y(`font-semibold text-foreground`,e),...t})}function Rde({className:e,...t}){return(0,U.jsx)(bu,{"data-slot":`sheet-description`,className:Y(`text-sm text-muted-foreground`,e),...t})}function zde({task:e,linkedDoc:t,tagSuggestions:n,open:r,isSaving:i=!1,onOpenChange:a,onPatch:o,onChangeStatus:s,onAddTag:c,onRemoveTag:l}){return(0,U.jsx)(Nde,{open:r,onOpenChange:a,children:(0,U.jsxs)(Ide,{side:`right`,"aria-label":`Task details`,showCloseButton:!1,className:`w-[75vw] gap-0 p-0 sm:max-w-[75vw]`,children:[(0,U.jsx)(Lde,{className:`sr-only`,children:`Task details`}),(0,U.jsx)(Rde,{className:`sr-only`,children:`View and edit the task.`}),e===null?null:(0,U.jsx)(Bde,{task:e,linkedDoc:t,tagSuggestions:n,isSaving:i,onPatch:o,onChangeStatus:s,onAddTag:c,onRemoveTag:l,onClose:()=>{a(!1)}})]})})}function Bde({task:e,linkedDoc:t,tagSuggestions:n,isSaving:r,onPatch:i,onChangeStatus:a,onAddTag:o,onRemoveTag:s,onClose:c}){let[l,u]=(0,H.useState)(e.label),[d,f]=(0,H.useState)(``),[p,m]=(0,H.useState)(!1),[h,g]=(0,H.useState)(null),_=(0,H.useRef)(null),{data:v}=MS(e.project_id),y=mO(v??[]).map(e=>({id:e.id,title:e.title}));(0,H.useEffect)(()=>{u(e.label),f(``),m(!1)},[e.id,e.label]);let b=DD(e.tags),x=()=>{let t=l.trim(),n={},r=_.current;if(r!==null&&r.isDirty()){let e=r.getMarkdown().trim();n={description:e===``?null:e}}i({...t!==``&&t!==e.label?{label:t}:{},...n}),m(!1)},S=e.tags??[];return(0,U.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,U.jsxs)(`header`,{className:`flex items-center gap-2 border-b px-4 py-3`,children:[(0,U.jsx)(ND,{status:e.status,onChange:a}),(0,U.jsx)(`span`,{className:`mono text-xs text-muted-foreground`,title:`Short ID — last 4 characters of this task's ID, for quick reference`,children:Hde(e.id)}),(0,U.jsx)(`span`,{className:`ml-auto`}),(0,U.jsx)(V9,{resource:{kind:`task`,id:e.id}}),(0,U.jsx)(X,{type:`button`,variant:p?`secondary`:`ghost`,size:`sm`,"aria-label":p?`Stop editing`:`Edit task`,onClick:()=>{m(e=>!e)},children:p?`Done`:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(bb,{className:`size-3.5`}),` Edit`]})}),(0,U.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close task details`,onClick:c,children:(0,U.jsx)(Lb,{})})]}),(0,U.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:[p?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(rw,{htmlFor:`task-drawer-label`,className:`mb-1 text-muted-foreground`,children:`Label`}),(0,U.jsx)(nw,{id:`task-drawer-label`,"aria-label":`Label`,value:l,onChange:e=>{u(e.target.value)},className:`mb-3 font-semibold`})]}):(0,U.jsx)(`h2`,{className:`mb-3 text-[15px] font-semibold leading-snug`,children:e.label}),(0,U.jsxs)(`dl`,{className:`grid grid-cols-[92px_1fr] gap-y-2 py-1 text-[12.5px]`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,U.jsx)(`dd`,{children:(0,U.jsx)(ND,{status:e.status,onChange:a})}),(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:`Lane`}),(0,U.jsx)(`dd`,{children:p?(0,U.jsxs)(ww,{value:b??`none`,onValueChange:t=>{let n=(e.tags??[]).map(e=>e.name).filter(e=>!e.startsWith(ED));i(t===`none`?{tags:n}:{tags:[...n,`${ED}${t}`]})},children:[(0,U.jsx)(Ew,{className:`w-40 text-xs`,children:(0,U.jsx)(Tw,{})}),(0,U.jsxs)(Dw,{children:[(0,U.jsx)(Ow,{value:`none`,children:`None`}),(0,U.jsx)(Ow,{value:`auto`,children:`auto`}),(0,U.jsx)(Ow,{value:`approve`,children:`approve`}),(0,U.jsx)(Ow,{value:`full`,children:`full`})]})]}):(0,U.jsx)(`span`,{className:`text-[var(--text-2)]`,title:`Review gate — auto: ships without review · approve: needs a human OK · full: independent review + human`,children:b?.toUpperCase()??`—`})}),t===void 0?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:`Linked doc`}),(0,U.jsx)(`dd`,{children:(0,U.jsxs)(Bi,{to:`/projects/$id/documents/$docId`,params:{id:t.project_id,docId:t.id},onClick:c,className:`inline-flex items-center gap-1.5 font-medium text-foreground hover:underline`,children:[(0,U.jsx)(tb,{className:`size-3.5 text-muted-foreground`}),t.title]})})]})]}),(0,U.jsx)(`div`,{className:`mb-1 mt-4 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Description`}),(0,U.jsx)(vX,{ref:_,value:e.description??``,mode:p?`editor`:`reader`,minHeight:`5rem`,ariaLabel:`Description`,projectId:e.project_id,seamless:!1,docLinks:y,onCommentOnSelection:e=>{g(e)}}),p||S.length>0?(0,U.jsx)(`div`,{className:`mb-1 mt-4 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground`,children:`Tags`}):null,(0,U.jsx)(Vde,{tags:S,tagSuggestions:n,newTag:d,editing:p,onNewTagChange:f,onAddTag:o,onRemoveTag:s}),(0,U.jsx)(wX,{target:{type:`task`,id:e.id},attachPassage:h,onPassageConsumed:()=>{g(null)},embedded:!0})]}),p?(0,U.jsx)(`footer`,{className:`border-t p-3`,children:(0,U.jsx)(X,{type:`button`,className:`w-full`,disabled:r,onClick:x,children:r?`Saving…`:`Save details`})}):null]})}function Vde({tags:e,tagSuggestions:t,newTag:n,editing:r,onNewTagChange:i,onAddTag:a,onRemoveTag:o}){return(0,U.jsxs)(U.Fragment,{children:[e.length>0?(0,U.jsx)(`div`,{className:`mb-1.5 flex flex-wrap gap-1`,children:e.map(e=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border bg-secondary px-2 py-0.5 text-xs font-medium`,children:[e.color===null?null:(0,U.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full`,style:{backgroundColor:e.color}}),e.name,r?(0,U.jsx)(`button`,{type:`button`,"aria-label":`Remove tag ${e.name}`,onClick:()=>{o(e.name)},className:`text-muted-foreground hover:text-foreground`,children:(0,U.jsx)(Lb,{className:`size-3`})}):null]},e.id))}):null,r?(0,U.jsxs)(`form`,{className:`flex gap-1.5`,onSubmit:e=>{e.preventDefault();let t=n.trim();t!==``&&(a(t),i(``))},children:[(0,U.jsx)(nw,{id:`task-drawer-tags`,"aria-label":`Tags`,list:`task-drawer-tag-options`,value:n,placeholder:`Add tag`,onChange:e=>{i(e.target.value)}}),(0,U.jsx)(`datalist`,{id:`task-drawer-tag-options`,children:t.map(e=>(0,U.jsx)(`option`,{value:e},e))}),(0,U.jsx)(X,{type:`submit`,variant:`outline`,size:`sm`,disabled:n.trim()===``,children:`Add tag`})]}):null]})}function Hde(e){return e.length<=4?e:e.slice(-4).toUpperCase()}function Ude({projectId:e,tasks:t}){let n=W(),r=TS(),i=(0,H.useMemo)(()=>new Map(t.map(e=>[e.id,e])),[t]);return{handleDragEnd:(0,H.useCallback)(t=>{let{active:a,over:o}=t;if(o===null)return;let s=String(a.id),c=i.get(s);if(c===void 0)return;let l=kD(o.id,i);if(l===void 0||l===c.status)return;let u=n.getQueryData(vS.tasks(e));n.setQueryData(vS.tasks(e),e=>e?.map(e=>e.id===s?{...e,status:l}:e)),n.setQueryData(vS.canvas(e),e=>{if(e===void 0||typeof e!=`object`||!e)return e;let t=e;return{...t,nodes:t.nodes.map(e=>e.id===s?{...e,status:l}:e)}}),r.mutate({id:s,input:{status:l}},{onSuccess:()=>{BC(`Status → ${wD[l]}`)},onError:()=>{u!==void 0&&n.setQueryData(vS.tasks(e),u),n.invalidateQueries({queryKey:vS.canvas(e)})}})},[r,e,n,i]),isUpdating:r.isPending,updateError:r.error}}var Wde=[`none`,`auto`,`approve`,`full`];function Gde({projectId:e,tasks:t}){let{data:n}=DS(e),{data:r}=MS(e),i=(0,H.useMemo)(()=>Yde(r),[r]),a=(0,H.useMemo)(()=>Xde(r),[r]),[o,s]=(0,H.useState)([]),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(null),m=(0,H.useMemo)(()=>OD(t,o),[t,o]),h=(0,H.useMemo)(()=>TD(m),[m]),g=wS(e),_=TS(),v=ES(),{handleDragEnd:y}=Ude({projectId:e,tasks:t}),[b,x]=(0,H.useState)(null),S=due(L7(f9,{activationConstraint:{distance:6}}),L7(c9)),C=b===null?void 0:t.find(e=>e.id===b),w=c===null?void 0:t.find(e=>e.id===c),T=(n??[]).map(e=>e.name),E=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},D=(e,t)=>{_.mutate({id:e,input:{status:t}},{onSuccess:()=>BC(`Status → ${wD[t]}`)})},O=e=>{p(e)};return(0,U.jsxs)(`div`,{className:`flex h-full flex-col`,children:[n!==void 0&&n.length>0?(0,U.jsxs)(`div`,{role:`group`,"aria-label":`Filter by tag`,className:`mb-3 flex flex-wrap items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Filter:`}),n.map(e=>(0,U.jsx)(Kde,{tag:e,selected:o.includes(e.id),onClick:()=>{E(e.id)}},e.id)),o.length>0?(0,U.jsx)(X,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>{s([])},children:`Clear filter`}):null]}):null,(0,U.jsxs)(dde,{sensors:S,collisionDetection:_ue,onDragStart:e=>{x(String(e.active.id))},onDragEnd:e=>{y(e),x(null)},onDragCancel:()=>{x(null)},children:[(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-auto pb-2`,children:(0,U.jsx)(`div`,{className:`flex h-full items-start gap-3.5`,children:CD.map(e=>(0,U.jsx)(Mde,{status:e,tasks:h[e],linkedDocTaskIds:i,onOpenTask:l,onChangeStatus:D,onRequestDelete:O,onAddTask:d},e))})}),(0,U.jsx)(Ode,{dropAnimation:null,children:C===void 0?null:(0,U.jsx)(Ade,{task:C,hasLinkedDoc:i.has(C.id)})})]}),(0,U.jsx)(zde,{open:w!==void 0,task:w??null,linkedDoc:w===void 0?void 0:a.get(w.id),tagSuggestions:T,isSaving:_.isPending,onOpenChange:e=>{e||l(null)},onPatch:e=>{w!==void 0&&_.mutate({id:w.id,input:e})},onChangeStatus:e=>{w!==void 0&&D(w.id,e)},onAddTag:e=>{if(w===void 0)return;let t=(w.tags??[]).map(e=>e.name);t.includes(e)||_.mutate({id:w.id,input:{tags:[...t,e]}})},onRemoveTag:e=>{if(w===void 0)return;let t=(w.tags??[]).map(e=>e.name).filter(t=>t!==e);_.mutate({id:w.id,input:{tags:t}})}}),(0,U.jsx)(qde,{open:u!==null,status:u??`todo`,isCreating:g.isPending,onClose:()=>{d(null)},onCreate:e=>{let t=e.lane===`none`?void 0:[`${ED}${e.lane}`];g.mutate({label:e.label,status:e.status,tags:t},{onSuccess:()=>{BC(`Task created in ${wD[e.status]}`),d(null)}})}}),(0,U.jsx)(Jde,{open:f!==null,isDeleting:v.isPending,onClose:()=>{p(null)},onConfirm:()=>{if(f===null)return;let t=f;v.mutate({id:t,projectId:e},{onSuccess:()=>{BC(`Task deleted`),c===t&&l(null),p(null)}})}})]})}function Kde({tag:e,selected:t,onClick:n}){return(0,U.jsxs)(X,{type:`button`,size:`xs`,variant:t?`default`:`outline`,"aria-pressed":t,onClick:n,children:[e.color===null?null:(0,U.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full`,style:{backgroundColor:e.color}}),e.name]})}function qde({open:e,status:t,isCreating:n,onClose:r,onCreate:i}){let[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(t),[l,u]=(0,H.useState)(`none`);return(0,H.useEffect)(()=>{e&&(o(``),c(t),u(`none`))},[e,t]),(0,U.jsx)($x,{open:e,onOpenChange:e=>{e||r()},children:(0,U.jsxs)(iS,{children:[(0,U.jsxs)(aS,{children:[(0,U.jsx)(sS,{children:`New task`}),(0,U.jsx)(cS,{children:`Lands on the board — a human releases scope → todo.`})]}),(0,U.jsxs)(`div`,{className:`grid gap-3`,children:[(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`new-task-title`,children:`Task`}),(0,U.jsx)(nw,{id:`new-task-title`,value:a,placeholder:`Verb Noun in Location…`,onChange:e=>{o(e.target.value)}})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`new-task-status`,children:`Status`}),(0,U.jsxs)(ww,{value:s,onValueChange:e=>{c(e)},children:[(0,U.jsx)(Ew,{id:`new-task-status`,className:`w-full`,children:(0,U.jsx)(Tw,{})}),(0,U.jsx)(Dw,{children:Da.map(e=>(0,U.jsx)(Ow,{value:e,children:wD[e]},e))})]})]}),(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`new-task-lane`,children:`Lane`}),(0,U.jsxs)(ww,{value:l,onValueChange:e=>{u(e)},children:[(0,U.jsx)(Ew,{id:`new-task-lane`,className:`w-full`,children:(0,U.jsx)(Tw,{})}),(0,U.jsx)(Dw,{children:Wde.map(e=>(0,U.jsx)(Ow,{value:e,children:e},e))})]})]})]})]}),(0,U.jsxs)(oS,{children:[(0,U.jsx)(X,{type:`button`,variant:`outline`,onClick:r,children:`Cancel`}),(0,U.jsx)(X,{type:`button`,disabled:a.trim()===``||n,onClick:()=>{i({label:a.trim(),status:s,lane:l})},children:n?`Creating…`:`Create task`})]})]})})}function Jde({open:e,isDeleting:t,onClose:n,onConfirm:r}){return(0,U.jsx)($x,{open:e,onOpenChange:e=>{e||n()},children:(0,U.jsxs)(iS,{className:`max-w-sm`,children:[(0,U.jsxs)(aS,{children:[(0,U.jsx)(sS,{children:`Delete task?`}),(0,U.jsx)(cS,{children:`This cannot be undone.`})]}),(0,U.jsxs)(oS,{children:[(0,U.jsx)(X,{type:`button`,variant:`outline`,onClick:n,children:`Cancel`}),(0,U.jsx)(X,{type:`button`,variant:`destructive`,disabled:t,onClick:r,children:t?`Deleting…`:`Delete`})]})]})})}function Yde(e){let t=new Set;if(e===void 0)return t;let n=e=>{for(let r of e)r.linked_task_id!==null&&t.add(r.linked_task_id),r.children.length>0&&n(r.children)};return n(e),t}function Xde(e){let t=new Map;if(e===void 0)return t;let n=e=>{for(let r of e)r.linked_task_id!==null&&t.set(r.linked_task_id,r),r.children.length>0&&n(r.children)};return n(e),t}function Zde(){return(0,U.jsx)(`div`,{className:`flex h-full gap-3 overflow-x-auto px-1 py-1`,children:Array.from({length:5}).map((e,t)=>(0,U.jsxs)(`div`,{className:`flex min-w-[220px] flex-1 flex-col gap-2 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,U.jsx)(`div`,{className:`mb-1 h-4 w-20 rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-24 rounded bg-muted`})]},t))})}function Qde(){let{id:e}=H9.useParams(),{status:t}=H9.useSearch(),{data:n,isLoading:r,error:i}=xS(e),{data:a,isLoading:o,error:s,refetch:c}=SS(e,t===void 0?{}:{status:t});return r||o?(0,U.jsx)(Zde,{}):i===null?s===null?n===void 0?(0,U.jsx)(`p`,{children:`Project not found.`}):(0,U.jsx)(`section`,{className:`flex h-full flex-col`,children:(0,U.jsx)(Gde,{projectId:e,tasks:a??[]})}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-8`,children:[(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Couldn't load this board.`}),(0,U.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>c(),children:`Retry`})]}):(0,U.jsx)(`div`,{className:`flex flex-col items-center gap-3 p-8`,children:(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Couldn't load this board.`})})}var H9=Ki(`/projects/$id/board`)({validateSearch:c7,component:Qde});function $de(e){let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Math.round((Date.now()-t)/1e3);if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return String(r)+`m ago`;let i=Math.round(r/60);if(i<24)return String(i)+`h ago`;let a=Math.round(i/24);if(a<7)return String(a)+`d ago`;let o=Math.round(a/7);return String(o)+`w ago`}function efe(e){if(e===null||e.trim()===``)return`No body yet — start writing.`;let t=e.replace(/<[^>]+>/g,` `).replace(/\s+/g,` `).trim();return t===``?`No body yet — start writing.`:t}function tfe(){let{id:e}=U9.useParams(),t=Ei(),{data:n,isLoading:r,error:i}=xS(e),{data:a,isLoading:o,error:s}=HS(e),c=US(e),[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(``),p=()=>{let n=d.trim();n!==``&&c.mutate({title:n},{onSuccess:n=>{f(``),u(!1),BC(`Note created`),t({to:`/projects/$id/notes/$noteId`,params:{id:e,noteId:n.id}})}})};return r||o?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading notes…`}):i===null?s===null?n===void 0?(0,U.jsx)(`p`,{children:`Project not found.`}):(0,U.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,U.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-baseline justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2.5`,children:[(0,U.jsx)(`h2`,{className:`text-[15px] font-semibold tracking-tight`,children:`Notes`}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Your working memory for this project — findings and scratch context, kept out of the formal plan. Open one to read or edit.`})]}),(0,U.jsxs)(X,{type:`button`,size:`sm`,onClick:()=>{u(!0)},children:[(0,U.jsx)(xb,{className:`size-3.5`}),`New note`]})]}),(0,U.jsx)($x,{open:l,onOpenChange:e=>{u(e),e||f(``)},children:(0,U.jsxs)(iS,{className:`max-w-sm`,children:[(0,U.jsx)(aS,{children:(0,U.jsx)(sS,{children:`New note`})}),(0,U.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`new-note-title`,className:`text-xs text-muted-foreground`,children:`Title`}),(0,U.jsx)(nw,{id:`new-note-title`,autoFocus:!0,value:d,placeholder:`Note title`,onChange:e=>{f(e.target.value)}})]}),c.error===null?null:(0,U.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:[`Failed to create note: `,c.error.message]}),(0,U.jsxs)(oS,{children:[(0,U.jsx)(X,{type:`button`,variant:`outline`,onClick:()=>{u(!1)},children:`Cancel`}),(0,U.jsx)(X,{type:`submit`,disabled:c.isPending||d.trim()===``,children:c.isPending?`Creating…`:`Create note`})]})]})]})}),a!==void 0&&a.length>0?(0,U.jsx)(`ul`,{className:`m-0 list-none space-y-2.5 p-0`,children:a.map(t=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(Bi,{to:`/projects/$id/notes/$noteId`,params:{id:e,noteId:t.id},className:`flex items-start gap-3 rounded-[10px] border border-border bg-card p-3.5 shadow-[var(--shadow)] transition-colors hover:border-[var(--border-strong)]`,children:[(0,U.jsx)(`div`,{className:`grid size-[30px] shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground`,children:(0,U.jsx)(vb,{className:`size-3.5`,strokeWidth:1.7})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`p`,{className:`mb-0.5 text-[13px] font-semibold leading-snug`,children:t.title}),(0,U.jsx)(`p`,{className:`m-0 line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:efe(t.body)})]}),(0,U.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:$de(t.updated_at)})]})},t.id))}):(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No notes yet. Create one to capture working notes.`})]}):(0,U.jsxs)(`p`,{role:`alert`,children:[`Failed to load notes: `,s.message]}):(0,U.jsxs)(`p`,{role:`alert`,children:[`Failed to load project: `,i.message]})}var U9=Ki(`/projects/$id/notes/`)({component:tfe});function nfe(){let{id:e}=W9.useParams(),{data:t,isLoading:n,error:r}=xS(e),{data:i,isLoading:a,isError:o}=MS(e),{data:s,isLoading:c,isError:l}=LS(e),{data:u}=SS(e);return n||a||c?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading documents…`}):r?(0,U.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Failed to load project: `,r.message]}):o||l?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Couldn't load documents`}):t===void 0?(0,U.jsx)(`p`,{children:`Project not found.`}):(0,U.jsx)(`div`,{className:`mx-auto max-w-5xl`,children:(0,U.jsx)(SO,{projectId:e,documents:i??[],folders:s??[],tasks:u??[]})})}var W9=Ki(`/projects/$id/documents/`)({component:nfe});function G9({status:e}){return e===`saving`?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12.5px] text-muted-foreground`,children:[(0,U.jsx)(db,{className:`size-3.5 animate-spin`}),` Saving…`]}):e===`unsaved`?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12.5px] text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/60`}),` Unsaved changes`]}):e===`error`?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12.5px] text-destructive`,children:[(0,U.jsx)(Nb,{className:`size-3.5`}),` Couldn’t save — retrying`]}):(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12.5px] text-muted-foreground`,children:[(0,U.jsx)(Zy,{className:`size-3.5`}),` Saved`]})}function K9({buildInput:e,onSave:t,delay:n=1e3,maxWait:r=5e3}){let[i,a]=(0,H.useState)(`saved`),o=(0,H.useRef)(!1),s=(0,H.useRef)(0),c=(0,H.useRef)(null),l=(0,H.useRef)(null),u=(0,H.useRef)(e),d=(0,H.useRef)(t);u.current=e,d.current=t;let f=()=>{l.current!==null&&(clearTimeout(l.current),l.current=null)},p=(0,H.useCallback)(async()=>{if(f(),!o.current)return;let e=u.current(),t=s.current;o.current=!1,c.current=null,a(`saving`);try{await d.current(e),s.current===t&&a(`saved`)}catch{o.current=!0,a(`error`)}},[]),m=(0,H.useCallback)(()=>{o.current=!0,s.current+=1,a(`unsaved`);let e=Date.now();c.current??=e;let t=e-c.current;f(),t>=r?p():l.current=setTimeout(()=>void p(),Math.min(n,r-t))},[n,r,p]),h=(0,H.useCallback)(()=>{f(),o.current=!1,c.current=null,a(`saved`)},[]);return(0,H.useEffect)(()=>{let e=()=>{o.current&&p()},t=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),p())};return window.addEventListener(`beforeunload`,e),window.addEventListener(`keydown`,t),()=>{if(window.removeEventListener(`beforeunload`,e),window.removeEventListener(`keydown`,t),f(),o.current){let e=u.current();o.current=!1,Promise.resolve(d.current(e)).catch(()=>void 0)}}},[p]),{status:i,notifyChange:m,flushNow:p,reset:h}}function rfe({note:e,mode:t,onSave:n,onDelete:r,isSaving:i=!1,isDeleting:a=!1,onCommentOnSelection:o,onCreateComment:s,projectId:c,docLinks:l}){let[u,d]=(0,H.useState)(e.title),[f,p]=(0,H.useState)(!1),m=(0,H.useRef)(e.body??``),h=K9({buildInput:()=>({title:u,body:m.current}),onSave:n}),g=i?`saving`:h.status;return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-2`,children:[t===`editor`?(0,U.jsx)(nw,{type:`text`,value:u,onChange:e=>{d(e.target.value),h.notifyChange()},"aria-label":`Note title`,className:`h-auto flex-1 border-0 border-b border-border bg-transparent px-0 py-1 text-2xl font-semibold tracking-tight shadow-none focus-visible:border-ring focus-visible:ring-0`}):(0,U.jsx)(`h1`,{className:`flex-1 text-2xl font-semibold tracking-tight`,children:u}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 pt-1.5`,children:[t===`editor`?(0,U.jsx)(G9,{status:g}):null,r===void 0?null:(0,U.jsx)(X,{type:`button`,variant:`outline`,className:`text-destructive`,"aria-label":`Delete note`,onClick:()=>{p(!0)},children:`Delete`})]})]}),(0,U.jsx)(vX,{value:e.body??``,mode:t,onChange:e=>{m.current=e,h.notifyChange()},onCommentOnSelection:o,onCreateComment:s,projectId:c,docLinks:l}),r===void 0?null:(0,U.jsx)(pO,{open:f,onOpenChange:p,title:`Delete this note?`,description:`This note and its comments will be deleted. This cannot be undone.`,busy:a,onConfirm:()=>{p(!1),r()}})]})}function q9({className:e,orientation:t=`horizontal`,...n}){return(0,U.jsx)(Cv,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:Y(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var ife=as(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function J9({className:e,variant:t=`default`,...n}){return(0,U.jsx)(wv,{"data-slot":`tabs-list`,"data-variant":t,className:Y(ife({variant:t}),e),...n})}function Y9({className:e,...t}){return(0,U.jsx)(Tv,{"data-slot":`tabs-trigger`,className:Y(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function afe(){let{id:e,noteId:t}=X9.useParams(),n=Ei(),{data:r,isLoading:i,error:a}=xS(e),{data:o,isLoading:s,error:c}=WS(t),{data:l}=MS(e),u=GS(),d=KS(),f=JS({type:`note`,id:t}),[p,m]=(0,H.useState)(`reader`),h=(0,H.useRef)(!1);(0,H.useEffect)(()=>{!h.current&&o!==void 0&&(h.current=!0,(o.body??``).replace(/<[^>]*>/g,``).trim()===``&&m(`editor`))},[o]);let g=mO(l??[]).map(e=>({id:e.id,title:e.title}));return i||s?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading note…`}):a===null?c===null?r===void 0?(0,U.jsx)(`p`,{children:`Project not found.`}):o===void 0?(0,U.jsx)(`p`,{children:`Note not found.`}):o.project_id===e?(0,U.jsxs)(`div`,{className:`flex h-[calc(100vh-6rem)] min-h-0 gap-6`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto pr-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsxs)(Bi,{to:`/projects/$id/notes`,params:{id:e},className:`inline-flex items-center gap-1.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground`,children:[(0,U.jsx)(Yy,{className:`size-3.5`}),`Notes`]}),(0,U.jsx)(q9,{value:p,onValueChange:e=>{m(e)},children:(0,U.jsxs)(J9,{children:[(0,U.jsx)(Y9,{value:`reader`,children:`Reader`}),(0,U.jsx)(Y9,{value:`editor`,children:`Edit`})]})})]}),u.error===null?null:(0,U.jsxs)(`p`,{role:`alert`,className:`text-[13px] text-destructive`,children:[`Save failed: `,u.error.message]}),(0,U.jsx)(rfe,{note:o,mode:p,projectId:e,docLinks:g,isSaving:u.isPending,isDeleting:d.isPending,onCreateComment:async({passage:e,body:t})=>{await f.mutateAsync({body:t,passage:e}),BC(`Comment added`)},onSave:e=>u.mutateAsync({id:t,input:e}).then(()=>void 0),onDelete:()=>{d.mutate({id:t,projectId:e},{onSuccess:()=>{BC(`Note deleted`),n({to:`/projects/$id/notes`,params:{id:e}})}})}},t)]}),(0,U.jsx)(wX,{target:{type:`note`,id:t}})]}):(0,U.jsx)(`p`,{role:`alert`,children:`Note does not belong to this project.`}):(0,U.jsxs)(`p`,{role:`alert`,children:[`Failed to load note: `,c.message]}):(0,U.jsxs)(`p`,{role:`alert`,children:[`Failed to load project: `,a.message]})}var X9=Ki(`/projects/$id/notes/$noteId`)({component:afe});function ofe({document:e,mode:t,onSave:n,onDelete:r,isSaving:i=!1,isDeleting:a=!1,onCommentOnSelection:o,onCreateComment:s,projectId:c,docLinks:l}){let[u,d]=(0,H.useState)(e.title),[f,p]=(0,H.useState)(e.status_line??``),[m,h]=(0,H.useState)(!1),g=(0,H.useRef)(e.body??``),_=K9({buildInput:()=>({title:u,body:g.current,status_line:f.trim()===``?null:f}),onSave:n}),v=i?`saving`:_.status;return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-2`,children:[t===`editor`?(0,U.jsx)(nw,{type:`text`,value:u,onChange:e=>{d(e.target.value),_.notifyChange()},"aria-label":`Document title`,className:`h-auto flex-1 border-0 border-b border-border bg-transparent px-0 py-1 text-2xl font-semibold tracking-tight shadow-none focus-visible:border-ring focus-visible:ring-0`}):(0,U.jsx)(`h1`,{className:`flex-1 text-2xl font-semibold tracking-tight`,children:u}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 pt-1.5`,children:[t===`editor`?(0,U.jsx)(G9,{status:v}):null,(0,U.jsx)(V9,{resource:{kind:`document`,id:e.id}}),t===`editor`&&r!==void 0?(0,U.jsx)(X,{type:`button`,variant:`outline`,className:`text-destructive`,"aria-label":`Delete document`,onClick:()=>{h(!0)},children:`Delete`}):null]})]}),t===`editor`?(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsx)(rw,{htmlFor:`document-status-line`,className:`text-xs text-muted-foreground`,children:`Status`}),(0,U.jsx)(nw,{id:`document-status-line`,type:`text`,value:f,onChange:e=>{p(e.target.value),_.notifyChange()},placeholder:`Status: draft`})]}):f===``?null:(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:f}),(0,U.jsx)(vX,{value:e.body??``,mode:t,onChange:e=>{g.current=e,_.notifyChange()},onCommentOnSelection:o,onCreateComment:s,projectId:c,docLinks:l}),r===void 0?null:(0,U.jsx)(pO,{open:m,onOpenChange:h,title:`Delete this document?`,description:`This document and its comments will be deleted. This cannot be undone.`,busy:a,onConfirm:()=>{h(!1),r()}})]})}function sfe(){let{id:e,docId:t}=Z9.useParams(),n=Ei(),{data:r,isLoading:i,error:a}=xS(e),{data:o,isLoading:s,error:c}=PS(t),{data:l}=MS(e),u=FS(),d=IS(),f=JS({type:`document`,id:t}),[p,m]=(0,H.useState)(`reader`),h=(0,H.useRef)(!1);(0,H.useEffect)(()=>{!h.current&&o!==void 0&&(h.current=!0,(o.body??``).replace(/<[^>]*>/g,``).trim()===``&&m(`editor`))},[o]);let g=mO(l??[]).filter(e=>e.id!==t).map(e=>({id:e.id,title:e.title}));return i||s?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading document…`}):a===null?c===null?r===void 0?(0,U.jsx)(`p`,{children:`Project not found.`}):o===void 0?(0,U.jsx)(`p`,{children:`Document not found.`}):o.project_id===e?(0,U.jsxs)(`div`,{className:`flex h-[calc(100vh-6rem)] min-h-0 gap-6`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4 overflow-y-auto pr-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsxs)(Bi,{to:`/projects/$id/documents`,params:{id:e},className:`inline-flex items-center gap-1.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground`,children:[(0,U.jsx)(Yy,{className:`size-3.5`}),`Documents`]}),(0,U.jsx)(q9,{value:p,onValueChange:e=>{m(e)},children:(0,U.jsxs)(J9,{children:[(0,U.jsx)(Y9,{value:`reader`,children:`Reader`}),(0,U.jsx)(Y9,{value:`editor`,children:`Edit`})]})})]}),u.error===null?null:(0,U.jsxs)(`p`,{role:`alert`,className:`text-[13px] text-destructive`,children:[`Save failed: `,u.error.message]}),(0,U.jsx)(ofe,{document:o,mode:p,projectId:e,docLinks:g,isSaving:u.isPending,isDeleting:d.isPending,onCreateComment:async({passage:e,body:t})=>{await f.mutateAsync({body:t,passage:e}),BC(`Comment added`)},onSave:e=>u.mutateAsync({id:t,input:e}).then(()=>void 0),onDelete:()=>{d.mutate({id:t,projectId:e},{onSuccess:()=>{n({to:`/projects/$id/documents`,params:{id:e}})}})}},t)]}),(0,U.jsx)(wX,{target:{type:`document`,id:t}})]}):(0,U.jsx)(`p`,{role:`alert`,children:`Document does not belong to this project.`}):(0,U.jsxs)(`p`,{role:`alert`,children:[`Failed to load document: `,c.message]}):(0,U.jsxs)(`p`,{role:`alert`,children:[`Failed to load project: `,a.message]})}var Z9=Ki(`/projects/$id/documents/$docId`)({component:sfe}),cfe=Cw.update({id:`/`,path:`/`,getParentRoute:()=>xw}),lfe=Nw.update({id:`/projects/`,path:`/projects/`,getParentRoute:()=>xw}),ufe=Rw.update({id:`/settings/workspaces`,path:`/settings/workspaces`,getParentRoute:()=>xw}),dfe=Vw.update({id:`/settings/members`,path:`/settings/members`,getParentRoute:()=>xw}),ffe=Kw.update({id:`/settings/mcp`,path:`/settings/mcp`,getParentRoute:()=>xw}),pfe=tO.update({id:`/p/$shareToken`,path:`/p/$shareToken`,getParentRoute:()=>xw}),mfe=aO.update({id:`/invite/$invitationId`,path:`/invite/$invitationId`,getParentRoute:()=>xw}),hfe=AO.update({id:`/projects/$id/overview`,path:`/projects/$id/overview`,getParentRoute:()=>xw}),Q9=jO.update({id:`/projects/$id/notes`,path:`/projects/$id/notes`,getParentRoute:()=>xw}),gfe=LX.update({id:`/projects/$id/inbox`,path:`/projects/$id/inbox`,getParentRoute:()=>xw}),_fe=KX.update({id:`/projects/$id/goals`,path:`/projects/$id/goals`,getParentRoute:()=>xw}),vfe=l7.update({id:`/projects/$id/flow`,path:`/projects/$id/flow`,getParentRoute:()=>xw}),yfe=H9.update({id:`/projects/$id/board`,path:`/projects/$id/board`,getParentRoute:()=>xw}),bfe=U9.update({id:`/`,path:`/`,getParentRoute:()=>Q9}),xfe=W9.update({id:`/projects/$id/documents/`,path:`/projects/$id/documents/`,getParentRoute:()=>xw}),Sfe=X9.update({id:`/$noteId`,path:`/$noteId`,getParentRoute:()=>Q9}),Cfe=Z9.update({id:`/projects/$id/documents/$docId`,path:`/projects/$id/documents/$docId`,getParentRoute:()=>xw}),wfe={ProjectsIdNotesNoteIdRoute:Sfe,ProjectsIdNotesIndexRoute:bfe},Tfe={IndexRoute:cfe,InviteInvitationIdRoute:mfe,PShareTokenRoute:pfe,SettingsMcpRoute:ffe,SettingsMembersRoute:dfe,SettingsWorkspacesRoute:ufe,ProjectsIndexRoute:lfe,ProjectsIdBoardRoute:yfe,ProjectsIdFlowRoute:vfe,ProjectsIdGoalsRoute:_fe,ProjectsIdInboxRoute:gfe,ProjectsIdNotesRoute:Q9._addFileChildren(wfe),ProjectsIdOverviewRoute:hfe,ProjectsIdDocumentsDocIdRoute:Cfe,ProjectsIdDocumentsIndexRoute:xfe},Efe=xw._addFileChildren(Tfe)._addFileTypes();function Dfe(){return new Le({mutationCache:new Ne({onError:(e,t,n,r)=>{if(r.options.onError!==void 0)return;let i=e instanceof ja&&e.status===403?`You don't have permission to do that.`:`Something went wrong. Please try again.`;BC.error(i)}})})}var Ofe=Dfe(),kfe=sa({routeTree:Efe}),$9=document.getElementById(`root`);$9!==null&&(0,fa.createRoot)($9).render((0,U.jsx)(H.StrictMode,{children:(0,U.jsx)(ba,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,children:(0,U.jsx)(Ve,{client:Ofe,children:(0,U.jsx)(ua,{router:kfe})})})}));
|