@goondocks/myco 0.27.19 → 1.0.2
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/README.md +9 -6
- package/dist/ui/assets/index-CcUWflwm.js +415 -0
- package/dist/ui/assets/index-DE6oYYru.css +2 -0
- package/dist/ui/index.html +2 -2
- package/package.json +13 -13
- package/scripts/select-binary.mjs +23 -0
- package/skills/myco/SKILL.md +27 -48
- package/skills/myco/references/cli-usage.md +30 -30
- package/skills/myco/references/reconfiguration.md +20 -20
- package/skills/myco/references/vault-status.md +13 -13
- package/skills/myco/references/wisdom.md +2 -2
- package/dist/ui/assets/index-D80qRqAU.css +0 -2
- package/dist/ui/assets/index-GRKrkWAI.js +0 -415
|
@@ -1,415 +0,0 @@
|
|
|
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,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(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},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(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 u=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.6`})),d=o(((e,t)=>{t.exports=u()})),f=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}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();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.6`})),h=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=m()})),g=o((e=>{var t=p(),n=d(),r=h();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 u(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 f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=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,R={pending:!1,data:null,method:null,action:null},ee=[],z=-1;function B(e){return{current:e}}function V(e){0>z||(e.current=ee[z],ee[z]=null,z--)}function H(e,t){z++,ee[z]=e.current,e.current=t}var te=B(null),ne=B(null),U=B(null),re=B(null);function ie(e,t){switch(H(U,t),H(ne,e),H(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}V(te),H(te,e)}function ae(){V(te),V(ne),V(U)}function oe(e){e.memoizedState!==null&&H(re,e);var t=te.current,n=Kd(t,e.type);t!==n&&(H(ne,e),H(te,n))}function se(e){ne.current===e&&(V(te),V(ne)),re.current===e&&(V(re),np._currentValue=R)}var ce,le;function ue(e){if(ce===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ce=t&&t[1]||``,le=-1<e.stack.indexOf(`
|
|
2
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
-
`+ce+e+le}var de=!1;function fe(e,t){if(!e||de)return``;de=!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{de=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ue(n):``}function pe(e,t){switch(e.tag){case 26:case 27:case 5:return ue(e.type);case 16:return ue(`Lazy`);case 13:return e.child!==t&&t!==null?ue(`Suspense Fallback`):ue(`Suspense`);case 19:return ue(`SuspenseList`);case 0:case 15:return fe(e.type,!1);case 11:return fe(e.type.render,!1);case 1:return fe(e.type,!0);case 31:return ue(`Activity`);default:return``}}function me(e){try{var t=``,n=null;do t+=pe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
-
Error generating stack: `+e.message+`
|
|
8
|
-
`+e.stack}}var he=Object.prototype.hasOwnProperty,ge=t.unstable_scheduleCallback,_e=t.unstable_cancelCallback,ve=t.unstable_shouldYield,ye=t.unstable_requestPaint,be=t.unstable_now,xe=t.unstable_getCurrentPriorityLevel,Se=t.unstable_ImmediatePriority,Ce=t.unstable_UserBlockingPriority,we=t.unstable_NormalPriority,Te=t.unstable_LowPriority,Ee=t.unstable_IdlePriority,De=t.log,Oe=t.unstable_setDisableYieldValue,ke=null,Ae=null;function je(e){if(typeof De==`function`&&Oe(e),Ae&&typeof Ae.setStrictMode==`function`)try{Ae.setStrictMode(ke,e)}catch{}}var Me=Math.clz32?Math.clz32:Fe,Ne=Math.log,Pe=Math.LN2;function Fe(e){return e>>>=0,e===0?32:31-(Ne(e)/Pe|0)|0}var Ie=256,Le=262144,Re=4194304;function ze(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=ze(n))):i=ze(o):i=ze(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ze(n))):i=ze(o)):i=ze(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 Ve(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function He(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 W(){var e=Re;return Re<<=1,!(Re&62914560)&&(Re=4194304),e}function G(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ue(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function We(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-Me(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&&Ge(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ge(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Me(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ke(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Me(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function qe(e,t){var n=t&-t;return n=n&42?1:Je(n),(n&(e.suspendedLanes|t))===0?n:0}function Je(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 Ye(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Xe(){var e=L.p;return e===0?(e=window.event,e===void 0?32:vp(e.type)):e}function Ze(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var Qe=Math.random().toString(36).slice(2),$e=`__reactFiber$`+Qe,et=`__reactProps$`+Qe,tt=`__reactContainer$`+Qe,nt=`__reactEvents$`+Qe,rt=`__reactListeners$`+Qe,it=`__reactHandles$`+Qe,at=`__reactResources$`+Qe,ot=`__reactMarker$`+Qe;function st(e){delete e[$e],delete e[et],delete e[nt],delete e[rt],delete e[it]}function ct(e){var t=e[$e];if(t)return t;for(var n=e.parentNode;n;){if(t=n[tt]||n[$e]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hf(e);e!==null;){if(n=e[$e])return n;e=hf(e)}return t}e=n,n=e.parentNode}return null}function lt(e){if(e=e[$e]||e[tt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ut(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function dt(e){var t=e[at];return t||=e[at]={hoistableStyles:new Map,hoistableScripts:new Map},t}function ft(e){e[ot]=!0}var pt=new Set,mt={};function ht(e,t){gt(e,t),gt(e+`Capture`,t)}function gt(e,t){for(mt[e]=t,e=0;e<t.length;e++)pt.add(t[e])}var _t=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]*$`),vt={},yt={};function bt(e){return he.call(yt,e)?!0:he.call(vt,e)?!1:_t.test(e)?yt[e]=!0:(vt[e]=!0,!1)}function xt(e,t,n){if(bt(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 St(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 Ct(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 wt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Tt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Et(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 Dt(e){if(!e._valueTracker){var t=Tt(e)?`checked`:`value`;e._valueTracker=Et(e,t,``+e[t])}}function Ot(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Tt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function kt(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 At=/[\n"\\]/g;function jt(e){return e.replace(At,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Mt(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=``+wt(t)):e.value!==``+wt(t)&&(e.value=``+wt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Pt(e,o,wt(n)):Pt(e,o,wt(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=``+wt(s):e.removeAttribute(`name`)}function Nt(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)){Dt(e);return}n=n==null?``:``+wt(n),t=t==null?n:``+wt(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),Dt(e)}function Pt(e,t,n){t===`number`&&kt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ft(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=``+wt(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 It(e,t,n){if(t!=null&&(t=``+wt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+wt(n)}function Lt(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=wt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Dt(e)}function Rt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var zt=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 Bt(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||zt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Vt(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&&Bt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Bt(e,o,t[o])}function Ht(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 Ut=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`]]),Wt=/^[\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 Gt(e){return Wt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Kt(){}var qt=null;function Jt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yt=null,Xt=null;function Zt(e){var t=lt(e);if(t&&(e=t.stateNode)){var n=e[et]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Mt(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="`+jt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[et]||null;if(!a)throw Error(i(90));Mt(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&&Ot(r)}break a;case`textarea`:It(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ft(e,!!n.multiple,t,!1)}}}var Qt=!1;function $t(e,t,n){if(Qt)return e(t,n);Qt=!0;try{return e(t)}finally{if(Qt=!1,(Yt!==null||Xt!==null)&&(xu(),Yt&&(t=Yt,e=Xt,Xt=Yt=null,Zt(t),e)))for(t=0;t<e.length;t++)Zt(e[t])}}function en(e,t){var n=e.stateNode;if(n===null)return null;var r=n[et]||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 tn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),nn=!1;if(tn)try{var rn={};Object.defineProperty(rn,`passive`,{get:function(){nn=!0}}),window.addEventListener(`test`,rn,rn),window.removeEventListener(`test`,rn,rn)}catch{nn=!1}var an=null,on=null,sn=null;function cn(){if(sn)return sn;var e,t=on,n=t.length,r,i=`value`in an?an.value:an.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 sn=i.slice(e,1<r?1-r:void 0)}function ln(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 un(){return!0}function dn(){return!1}function fn(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)?un:dn,this.isPropagationStopped=dn,this}return m(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=un)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=un)},persist:function(){},isPersistent:un}),t}var pn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},mn=fn(pn),hn=m({},pn,{view:0,detail:0}),gn=fn(hn),_n,vn,yn,bn=m({},hn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jn,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!==yn&&(yn&&e.type===`mousemove`?(_n=e.screenX-yn.screenX,vn=e.screenY-yn.screenY):vn=_n=0,yn=e),_n)},movementY:function(e){return`movementY`in e?e.movementY:vn}}),xn=fn(bn),Sn=fn(m({},bn,{dataTransfer:0})),Cn=fn(m({},hn,{relatedTarget:0})),wn=fn(m({},pn,{animationName:0,elapsedTime:0,pseudoElement:0})),Tn=fn(m({},pn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),En=fn(m({},pn,{data:0})),Dn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},On={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`},kn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function An(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=kn[e])?!!t[e]:!1}function jn(){return An}var Mn=fn(m({},hn,{key:function(e){if(e.key){var t=Dn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=ln(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?On[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jn,charCode:function(e){return e.type===`keypress`?ln(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?ln(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Nn=fn(m({},bn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Pn=fn(m({},hn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jn})),Fn=fn(m({},pn,{propertyName:0,elapsedTime:0,pseudoElement:0})),In=fn(m({},bn,{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})),Ln=fn(m({},pn,{newState:0,oldState:0})),Rn=[9,13,27,32],zn=tn&&`CompositionEvent`in window,Bn=null;tn&&`documentMode`in document&&(Bn=document.documentMode);var Vn=tn&&`TextEvent`in window&&!Bn,Hn=tn&&(!zn||Bn&&8<Bn&&11>=Bn),Un=` `,Wn=!1;function Gn(e,t){switch(e){case`keyup`:return Rn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Kn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var qn=!1;function Jn(e,t){switch(e){case`compositionend`:return Kn(t);case`keypress`:return t.which===32?(Wn=!0,Un):null;case`textInput`:return e=t.data,e===Un&&Wn?null:e;default:return null}}function Yn(e,t){if(qn)return e===`compositionend`||!zn&&Gn(e,t)?(e=cn(),sn=on=an=null,qn=!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 Hn&&t.locale!==`ko`?null:t.data;default:return null}}var Xn={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 Zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Xn[e.type]:t===`textarea`}function Qn(e,t,n,r){Yt?Xt?Xt.push(r):Xt=[r]:Yt=r,t=kd(t,`onChange`),0<t.length&&(n=new mn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var $n=null,er=null;function tr(e){xd(e,0)}function nr(e){if(Ot(ut(e)))return e}function rr(e,t){if(e===`change`)return t}var ir=!1;if(tn){var ar;if(tn){var or=`oninput`in document;if(!or){var sr=document.createElement(`div`);sr.setAttribute(`oninput`,`return;`),or=typeof sr.oninput==`function`}ar=or}else ar=!1;ir=ar&&(!document.documentMode||9<document.documentMode)}function cr(){$n&&($n.detachEvent(`onpropertychange`,lr),er=$n=null)}function lr(e){if(e.propertyName===`value`&&nr(er)){var t=[];Qn(t,er,e,Jt(e)),$t(tr,t)}}function ur(e,t,n){e===`focusin`?(cr(),$n=t,er=n,$n.attachEvent(`onpropertychange`,lr)):e===`focusout`&&cr()}function dr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return nr(er)}function fr(e,t){if(e===`click`)return nr(t)}function pr(e,t){if(e===`input`||e===`change`)return nr(t)}function mr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var hr=typeof Object.is==`function`?Object.is:mr;function gr(e,t){if(hr(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(!he.call(t,i)||!hr(e[i],t[i]))return!1}return!0}function _r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vr(e,t){var n=_r(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=_r(n)}}function yr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function br(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=kt(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=kt(e.document)}return t}function xr(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 Sr=tn&&`documentMode`in document&&11>=document.documentMode,Cr=null,wr=null,Tr=null,Er=!1;function Dr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Er||Cr==null||Cr!==kt(r)||(r=Cr,`selectionStart`in r&&xr(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}),Tr&&gr(Tr,r)||(Tr=r,r=kd(wr,`onSelect`),0<r.length&&(t=new mn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Cr)))}function Or(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var kr={animationend:Or(`Animation`,`AnimationEnd`),animationiteration:Or(`Animation`,`AnimationIteration`),animationstart:Or(`Animation`,`AnimationStart`),transitionrun:Or(`Transition`,`TransitionRun`),transitionstart:Or(`Transition`,`TransitionStart`),transitioncancel:Or(`Transition`,`TransitionCancel`),transitionend:Or(`Transition`,`TransitionEnd`)},Ar={},jr={};tn&&(jr=document.createElement(`div`).style,`AnimationEvent`in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),`TransitionEvent`in window||delete kr.transitionend.transition);function Mr(e){if(Ar[e])return Ar[e];if(!kr[e])return e;var t=kr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jr)return Ar[e]=t[n];return e}var Nr=Mr(`animationend`),Pr=Mr(`animationiteration`),Fr=Mr(`animationstart`),Ir=Mr(`transitionrun`),Lr=Mr(`transitionstart`),Rr=Mr(`transitioncancel`),zr=Mr(`transitionend`),Br=new Map,Vr=`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(` `);Vr.push(`scrollEnd`);function Hr(e,t){Br.set(e,t),ht(t,[e])}var Ur=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)},Wr=[],Gr=0,Kr=0;function qr(){for(var e=Gr,t=Kr=Gr=0;t<e;){var n=Wr[t];Wr[t++]=null;var r=Wr[t];Wr[t++]=null;var i=Wr[t];Wr[t++]=null;var a=Wr[t];if(Wr[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&&Zr(n,i,a)}}function Jr(e,t,n,r){Wr[Gr++]=e,Wr[Gr++]=t,Wr[Gr++]=n,Wr[Gr++]=r,Kr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Yr(e,t,n,r){return Jr(e,t,n,r),Qr(e)}function Xr(e,t){return Jr(e,null,null,t),Qr(e)}function Zr(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-Me(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Qr(e){if(50<fu)throw fu=0,pu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var $r={};function ei(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 ti(e,t,n,r){return new ei(e,t,n,r)}function ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ri(e,t){var n=e.alternate;return n===null?(n=ti(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 ii(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 ai(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ni(e)&&(s=1);else if(typeof e==`string`)s=qf(e,n,te.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ti(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return oi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ti(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ti(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ti(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=ti(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function oi(e,t,n,r){return e=ti(7,e,r,t),e.lanes=n,e}function si(e,t,n){return e=ti(6,e,null,t),e.lanes=n,e}function ci(e){var t=ti(18,null,null,0);return t.stateNode=e,t}function li(e,t,n){return t=ti(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ui=new WeakMap;function di(e,t){if(typeof e==`object`&&e){var n=ui.get(e);return n===void 0?(t={value:e,source:t,stack:me(t)},ui.set(e,t),t):n}return{value:e,source:t,stack:me(t)}}var fi=[],pi=0,mi=null,hi=0,gi=[],_i=0,vi=null,yi=1,bi=``;function xi(e,t){fi[pi++]=hi,fi[pi++]=mi,mi=e,hi=t}function Si(e,t,n){gi[_i++]=yi,gi[_i++]=bi,gi[_i++]=vi,vi=e;var r=yi;e=bi;var i=32-Me(r)-1;r&=~(1<<i),n+=1;var a=32-Me(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,yi=1<<32-Me(t)+i|n<<i|r,bi=a+e}else yi=1<<a|n<<i|r,bi=e}function Ci(e){e.return!==null&&(xi(e,1),Si(e,1,0))}function wi(e){for(;e===mi;)mi=fi[--pi],fi[pi]=null,hi=fi[--pi],fi[pi]=null;for(;e===vi;)vi=gi[--_i],gi[_i]=null,bi=gi[--_i],gi[_i]=null,yi=gi[--_i],gi[_i]=null}function Ti(e,t){gi[_i++]=yi,gi[_i++]=bi,gi[_i++]=vi,yi=t.id,bi=t.overflow,vi=e}var Ei=null,Di=null,Oi=!1,ki=null,Ai=!1,ji=Error(i(519));function Mi(e){throw Ri(di(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ji}function Ni(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[$e]=e,t[et]=r,n){case`dialog`:Sd(`cancel`,t),Sd(`close`,t);break;case`iframe`:case`object`:case`embed`:Sd(`load`,t);break;case`video`:case`audio`:for(n=0;n<yd.length;n++)Sd(yd[n],t);break;case`source`:Sd(`error`,t);break;case`img`:case`image`:case`link`:Sd(`error`,t),Sd(`load`,t);break;case`details`:Sd(`toggle`,t);break;case`input`:Sd(`invalid`,t),Nt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Sd(`invalid`,t);break;case`textarea`:Sd(`invalid`,t),Lt(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||Fd(t.textContent,n)?(r.popover!=null&&(Sd(`beforetoggle`,t),Sd(`toggle`,t)),r.onScroll!=null&&Sd(`scroll`,t),r.onScrollEnd!=null&&Sd(`scrollend`,t),r.onClick!=null&&(t.onclick=Kt),t=!0):t=!1,t||Mi(e,!0)}function Pi(e){for(Ei=e.return;Ei;)switch(Ei.tag){case 5:case 31:case 13:Ai=!1;return;case 27:case 3:Ai=!0;return;default:Ei=Ei.return}}function Fi(e){if(e!==Ei)return!1;if(!Oi)return Pi(e),Oi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||qd(e.type,e.memoizedProps)),n=!n),n&&Di&&Mi(e),Pi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Di=mf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Di=mf(e)}else t===27?(t=Di,tf(e.type)?(e=pf,pf=null,Di=e):Di=t):Di=Ei?ff(e.stateNode.nextSibling):null;return!0}function Ii(){Di=Ei=null,Oi=!1}function Li(){var e=ki;return e!==null&&(Ql===null?Ql=e:Ql.push.apply(Ql,e),ki=null),e}function Ri(e){ki===null?ki=[e]:ki.push(e)}var zi=B(null),Bi=null,Vi=null;function Hi(e,t,n){H(zi,t._currentValue),t._currentValue=n}function Ui(e){e._currentValue=zi.current,V(zi)}function Wi(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 Gi(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),Wi(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),Wi(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 Ki(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;hr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===re.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[np]:e.push(np))}a=a.return}e!==null&&Gi(t,e,n,r),t.flags|=262144}function qi(e){for(e=e.firstContext;e!==null;){if(!hr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ji(e){Bi=e,Vi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yi(e){return Zi(Bi,e)}function Xi(e,t){return Bi===null&&Ji(e),Zi(e,t)}function Zi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Vi===null){if(e===null)throw Error(i(308));Vi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Vi=Vi.next=t;return n}var Qi=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()})}},$i=t.unstable_scheduleCallback,ea=t.unstable_NormalPriority,ta={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function na(){return{controller:new Qi,data:new Map,refCount:0}}function ra(e){e.refCount--,e.refCount===0&&$i(ea,function(){e.controller.abort()})}var ia=null,aa=0,oa=0,sa=null;function ca(e,t){if(ia===null){var n=ia=[];aa=0,oa=pd(),sa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return aa++,t.then(la,la),t}function la(){if(--aa===0&&ia!==null){sa!==null&&(sa.status=`fulfilled`);var e=ia;ia=null,oa=0,sa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ua(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 da=I.S;I.S=function(e,t){tu=be(),typeof t==`object`&&t&&typeof t.then==`function`&&ca(e,t),da!==null&&da(e,t)};var fa=B(null);function pa(){var e=fa.current;return e===null?Il.pooledCache:e}function ma(e,t){t===null?H(fa,fa.current):H(fa,t.pool)}function ha(){var e=pa();return e===null?null:{parent:ta._currentValue,pool:e}}var ga=Error(i(460)),_a=Error(i(474)),va=Error(i(542)),ya={then:function(){}};function ba(e){return e=e.status,e===`fulfilled`||e===`rejected`}function xa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Kt,Kt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ta(e),e;default:if(typeof t.status==`string`)t.then(Kt,Kt);else{if(e=Il,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,Ta(e),e}throw Ca=t,ga}}function Sa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ca=e,ga):e}}var Ca=null;function wa(){if(Ca===null)throw Error(i(459));var e=Ca;return Ca=null,e}function Ta(e){if(e===ga||e===va)throw Error(i(483))}var Ea=null,Da=0;function Oa(e){var t=Da;return Da+=1,Ea===null&&(Ea=[]),xa(Ea,e,t)}function ka(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Aa(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 ja(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=ri(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=si(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&&Sa(i)===t.type)?(t=a(t,n.props),ka(t,n),t.return=e,t):(t=ai(n.type,n.key,n.props,null,e.mode,r),ka(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=li(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=oi(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=si(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ai(t.type,t.key,t.props,null,e.mode,n),ka(n,t),n.return=e,n;case v:return t=li(t,e.mode,n),t.return=e,t;case O:return t=Sa(t),f(e,t,n)}if(F(t)||M(t))return t=oi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Oa(t),n);if(t.$$typeof===C)return f(e,Xi(e,t),n);Aa(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=Sa(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,Oa(n),r);if(n.$$typeof===C)return p(e,t,Xi(e,n),r);Aa(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=Sa(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,Oa(r),i);if(r.$$typeof===C)return m(e,t,n,Xi(t,r),i);Aa(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),Oi&&xi(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 Oi&&xi(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)}),Oi&&xi(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),Oi&&xi(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 Oi&&xi(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)}),Oi&&xi(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&&Sa(l)===r.type){n(e,r.sibling),c=a(r,o.props),ka(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=oi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ai(o.type,o.key,o.props,null,e.mode,c),ka(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=li(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Sa(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,Oa(o),c);if(o.$$typeof===C)return b(e,r,Xi(e,o),c);Aa(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=si(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Da=0;var i=b(e,t,n,r);return Ea=null,i}catch(t){if(t===ga||t===va)throw t;var a=ti(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ma=ja(!0),Na=ja(!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,Fl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Qr(e),Zr(e,null,n),t}return Jr(e,r,t,n),Qr(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,Ke(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=sa;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?(Rl&f)===f:(r&f)===f){f!==0&&f===oa&&(Va=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},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),Kl|=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=B(null),qa=B(0);function Ja(e,t){e=Wl,H(qa,e),H(Ka,t),Wl=e|t.baseLanes}function Ya(){H(qa,Wl),H(Ka,Ka.current)}function Xa(){Wl=qa.current,V(Ka),V(qa)}var Za=B(null),Qa=null;function $a(e){var t=e.alternate;H(io,io.current&1),H(Za,e),Qa===null&&(t===null||Ka.current!==null||t.memoizedState!==null)&&(Qa=e)}function eo(e){H(io,io.current),H(Za,e),Qa===null&&(Qa=e)}function to(e){e.tag===22?(H(io,io.current),H(Za,e),Qa===null&&(Qa=e)):no(e)}function no(){H(io,io.current),H(Za,Za.current)}function ro(e){V(Za),Qa===e&&(Qa=null),V(io)}var io=B(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||lf(n)||uf(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 K=0,oo=null,so=null,co=null,lo=!1,uo=!1,fo=!1,po=0,mo=0,ho=null,go=0;function _o(){throw Error(i(321))}function vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!hr(e[n],t[n]))return!1;return!0}function yo(e,t,n,r,i,a){return K=a,oo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Is:Ls,fo=!1,a=n(r,i),fo=!1,uo&&(a=xo(t,n,r,i)),bo(e),a}function bo(e){I.H=Fs;var t=so!==null&&so.next!==null;if(K=0,co=so=oo=null,lo=!1,mo=0,ho=null,t)throw Error(i(300));e===null||ec||(e=e.dependencies,e!==null&&qi(e)&&(ec=!0))}function xo(e,t,n,r){oo=e;var a=0;do{if(uo&&(ho=null),mo=0,uo=!1,25<=a)throw Error(i(301));if(a+=1,co=so=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=Rs,o=t(n,r)}while(uo);return o}function So(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?ko(t):t,e=e.useState()[0],(so===null?null:so.memoizedState)!==e&&(oo.flags|=1024),t}function Co(){var e=po!==0;return po=0,e}function wo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function To(e){if(lo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}lo=!1}K=0,co=so=oo=null,uo=!1,mo=po=0,ho=null}function Eo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return co===null?oo.memoizedState=co=e:co=co.next=e,co}function Do(){if(so===null){var e=oo.alternate;e=e===null?null:e.memoizedState}else e=so.next;var t=co===null?oo.memoizedState:co.next;if(t!==null)co=t,so=e;else{if(e===null)throw oo.alternate===null?Error(i(467)):Error(i(310));so=e,e={memoizedState:so.memoizedState,baseState:so.baseState,baseQueue:so.baseQueue,queue:so.queue,next:null},co===null?oo.memoizedState=co=e:co=co.next=e}return co}function Oo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ko(e){var t=mo;return mo+=1,ho===null&&(ho=[]),e=xa(ho,e,t),t=oo,(co===null?t.memoizedState:co.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Is:Ls),e}function Ao(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ko(e);if(e.$$typeof===C)return Yi(e)}throw Error(i(438,String(e)))}function jo(e){var t=null,n=oo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=oo.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=Oo(),oo.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 Mo(e,t){return typeof t==`function`?t(e):t}function No(e){return Po(Do(),so,e)}function Po(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?(K&f)===f:(Rl&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===oa&&(d=!0);else if((K&p)===p){u=u.next,p===oa&&(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,oo.lanes|=p,Kl|=p;f=u.action,fo&&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,oo.lanes|=f,Kl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!hr(o,e.memoizedState)&&(ec=!0,d&&(n=sa,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 Fo(e){var t=Do(),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);hr(o,t.memoizedState)||(ec=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Io(e,t,n){var r=oo,a=Do(),o=Oi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!hr((so||a).memoizedState,n);if(s&&(a.memoizedState=n,ec=!0),a=a.queue,ss(zo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||co!==null&&co.memoizedState.tag&1){if(r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,a,n,t),null),Il===null)throw Error(i(349));o||K&127||Lo(r,t,n)}return n}function Lo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=oo.updateQueue,t===null?(t=Oo(),oo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ro(e,t,n,r){t.value=n,t.getSnapshot=r,Bo(t)&&Vo(e)}function zo(e,t,n){return n(function(){Bo(t)&&Vo(e)})}function Bo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!hr(e,n)}catch{return!0}}function Vo(e){var t=Xr(e,2);t!==null&&gu(t,e,2)}function Ho(e){var t=Eo();if(typeof e==`function`){var n=e;if(e=n(),fo){je(!0);try{n()}finally{je(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:e},t}function Uo(e,t,n,r){return e.baseState=n,Po(e,so,typeof r==`function`?r:Mo)}function Wo(e,t,n,r,a){if(Ms(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,Go(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Go(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),Ko(e,t,s)}catch(n){Jo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Ko(e,t,a)}catch(n){Jo(e,t,n)}}function Ko(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){qo(e,t,n)},function(n){return Jo(e,t,n)}):qo(e,t,n)}function qo(e,t,n){t.status=`fulfilled`,t.value=n,Yo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Go(e,n)))}function Jo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Yo(t),t=t.next;while(t!==r)}e.action=null}function Yo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xo(e,t){return t}function Zo(e,t){if(Oi){var n=Il.formState;if(n!==null){a:{var r=oo;if(Oi){if(Di){b:{for(var i=Di,a=Ai;i.nodeType!==8;){if(!a){i=null;break b}if(i=ff(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Di=ff(i.nextSibling),r=i.data===`F!`;break a}}Mi(r)}r=!1}r&&(t=n[0])}}return n=Eo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:t},n.queue=r,n=ks.bind(null,oo,r),r.dispatch=n,r=Ho(!1),a=js.bind(null,oo,!1,r.queue),r=Eo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Wo.bind(null,oo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Qo(e){return $o(Do(),so,e)}function $o(e,t,n){if(t=Po(e,t,Xo)[0],e=No(Mo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ko(t)}catch(e){throw e===ga?va:e}else r=t;t=Do();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(oo.flags|=2048,ns(9,{destroy:void 0},es.bind(null,i,n),null)),[r,a,e]}function es(e,t){e.action=t}function ts(e){var t=Do(),n=so;if(n!==null)return $o(t,n,e);Do(),t=t.memoizedState,n=Do();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ns(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=oo.updateQueue,t===null&&(t=Oo(),oo.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 rs(){return Do().memoizedState}function is(e,t,n,r){var i=Eo();oo.flags|=e,i.memoizedState=ns(1|t,{destroy:void 0},n,r===void 0?null:r)}function as(e,t,n,r){var i=Do();r=r===void 0?null:r;var a=i.memoizedState.inst;so!==null&&r!==null&&vo(r,so.memoizedState.deps)?i.memoizedState=ns(t,a,n,r):(oo.flags|=e,i.memoizedState=ns(1|t,a,n,r))}function os(e,t){is(8390656,8,e,t)}function ss(e,t){as(2048,8,e,t)}function cs(e){oo.flags|=4;var t=oo.updateQueue;if(t===null)t=Oo(),oo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ls(e){var t=Do().memoizedState;return cs({ref:t,nextImpl:e}),function(){if(Fl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function us(e,t){return as(4,2,e,t)}function ds(e,t){return as(4,4,e,t)}function fs(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 ps(e,t,n){n=n==null?null:n.concat([e]),as(4,4,fs.bind(null,t,e),n)}function ms(){}function hs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&vo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function gs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&vo(t,r[1]))return r[0];if(r=e(),fo){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r}function _s(e,t,n){return n===void 0||K&1073741824&&!(Rl&261930)?e.memoizedState=t:(e.memoizedState=n,e=hu(),oo.lanes|=e,Kl|=e,n)}function vs(e,t,n,r){return hr(n,t)?n:Ka.current===null?!(K&42)||K&1073741824&&!(Rl&261930)?(ec=!0,e.memoizedState=n):(e=hu(),oo.lanes|=e,Kl|=e,t):(e=_s(e,n,r),hr(e,t)||(ec=!0),e)}function ys(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,js(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?As(e,t,ua(c,r),mu(e)):As(e,t,r,mu(e))}catch(n){As(e,t,{then:function(){},status:`rejected`,reason:n},mu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function bs(){}function xs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ss(e).queue;ys(e,a,t,R,n===null?bs:function(){return Cs(e),n(r)})}function Ss(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Cs(e){var t=Ss(e);t.next===null&&(t=e.alternate.memoizedState),As(e,t.next.queue,{},mu())}function ws(){return Yi(np)}function Ts(){return Do().memoizedState}function Es(){return Do().memoizedState}function Ds(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mu();e=La(n);var r=Ra(t,e,n);r!==null&&(gu(r,t,n),za(r,t,n)),t={cache:na()},e.payload=t;return}t=t.return}}function Os(e,t,n){var r=mu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ms(e)?Ns(t,n):(n=Yr(e,t,n,r),n!==null&&(gu(n,e,r),Ps(n,t,r)))}function ks(e,t,n){As(e,t,n,mu())}function As(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ms(e))Ns(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,hr(s,o))return Jr(e,t,i,0),Il===null&&qr(),!1}catch{}if(n=Yr(e,t,i,r),n!==null)return gu(n,e,r),Ps(n,t,r),!0}return!1}function js(e,t,n,r){if(r={lane:2,revertLane:pd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ms(e)){if(t)throw Error(i(479))}else t=Yr(e,n,r,2),t!==null&&gu(t,e,2)}function Ms(e){var t=e.alternate;return e===oo||t!==null&&t===oo}function Ns(e,t){uo=lo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ps(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ke(e,n)}}var Fs={readContext:Yi,use:Ao,useCallback:_o,useContext:_o,useEffect:_o,useImperativeHandle:_o,useLayoutEffect:_o,useInsertionEffect:_o,useMemo:_o,useReducer:_o,useRef:_o,useState:_o,useDebugValue:_o,useDeferredValue:_o,useTransition:_o,useSyncExternalStore:_o,useId:_o,useHostTransitionStatus:_o,useFormState:_o,useActionState:_o,useOptimistic:_o,useMemoCache:_o,useCacheRefresh:_o};Fs.useEffectEvent=_o;var Is={readContext:Yi,use:Ao,useCallback:function(e,t){return Eo().memoizedState=[e,t===void 0?null:t],e},useContext:Yi,useEffect:os,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),is(4194308,4,fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){is(4,2,e,t)},useMemo:function(e,t){var n=Eo();t=t===void 0?null:t;var r=e();if(fo){je(!0);try{e()}finally{je(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Eo();if(n!==void 0){var i=n(t);if(fo){je(!0);try{n(t)}finally{je(!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=Os.bind(null,oo,e),[r.memoizedState,e]},useRef:function(e){var t=Eo();return e={current:e},t.memoizedState=e},useState:function(e){e=Ho(e);var t=e.queue,n=ks.bind(null,oo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ms,useDeferredValue:function(e,t){return _s(Eo(),e,t)},useTransition:function(){var e=Ho(!1);return e=ys.bind(null,oo,e.queue,!0,!1),Eo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=oo,a=Eo();if(Oi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Il===null)throw Error(i(349));Rl&127||Lo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,os(zo.bind(null,r,o,e),[e]),r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,o,n,t),null),n},useId:function(){var e=Eo(),t=Il.identifierPrefix;if(Oi){var n=bi,r=yi;n=(r&~(1<<32-Me(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=po++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=go++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ws,useFormState:Zo,useActionState:Zo,useOptimistic:function(e){var t=Eo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=js.bind(null,oo,!0,n),n.dispatch=t,[e,t]},useMemoCache:jo,useCacheRefresh:function(){return Eo().memoizedState=Ds.bind(null,oo)},useEffectEvent:function(e){var t=Eo(),n={impl:e};return t.memoizedState=n,function(){if(Fl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ls={readContext:Yi,use:Ao,useCallback:hs,useContext:Yi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:No,useRef:rs,useState:function(){return No(Mo)},useDebugValue:ms,useDeferredValue:function(e,t){return vs(Do(),so.memoizedState,e,t)},useTransition:function(){var e=No(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Ts,useHostTransitionStatus:ws,useFormState:Qo,useActionState:Qo,useOptimistic:function(e,t){return Uo(Do(),so,e,t)},useMemoCache:jo,useCacheRefresh:Es};Ls.useEffectEvent=ls;var Rs={readContext:Yi,use:Ao,useCallback:hs,useContext:Yi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:Fo,useRef:rs,useState:function(){return Fo(Mo)},useDebugValue:ms,useDeferredValue:function(e,t){var n=Do();return so===null?_s(n,e,t):vs(n,so.memoizedState,e,t)},useTransition:function(){var e=Fo(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Ts,useHostTransitionStatus:ws,useFormState:ts,useActionState:ts,useOptimistic:function(e,t){var n=Do();return so===null?(n.baseState=e,[e,n.queue.dispatch]):Uo(n,so,e,t)},useMemoCache:jo,useCacheRefresh:Es};Rs.useEffectEvent=ls;function zs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Bs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=mu(),i=La(r);i.payload=t,n!=null&&(i.callback=n),t=Ra(e,i,r),t!==null&&(gu(t,e,r),za(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=mu(),i=La(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ra(e,i,r),t!==null&&(gu(t,e,r),za(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=mu(),r=La(n);r.tag=2,t!=null&&(r.callback=t),t=Ra(e,r,n),t!==null&&(gu(t,e,n),za(t,e,n))}};function Vs(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?!gr(n,r)||!gr(i,a):!0}function Hs(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&&Bs.enqueueReplaceState(t,t.state,null)}function Us(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=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ws(e){Ur(e)}function Gs(e){console.error(e)}function Ks(e){Ur(e)}function qs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Js(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 Ys(e,t,n){return n=La(n),n.tag=3,n.payload={element:null},n.callback=function(){qs(e,t)},n}function Xs(e){return e=La(e),e.tag=3,e}function Zs(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(){Js(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Js(t,n,r),typeof i!=`function`&&(iu===null?iu=new Set([this]):iu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Qs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ki(t,n,a,!0),n=Za.current,n!==null){switch(n.tag){case 31:case 13:return Qa===null?Ou():n.alternate===null&&Gl===0&&(Gl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ya?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),qu(e,r,a)),!1;case 22:return n.flags|=65536,r===ya?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)),qu(e,r,a)),!1}throw Error(i(435,n.tag))}return qu(e,r,a),Ou(),!1}if(Oi)return t=Za.current,t===null?(r!==ji&&(t=Error(i(423),{cause:r}),Ri(di(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=di(r,n),a=Ys(e.stateNode,r,a),Ba(e,a),Gl!==4&&(Gl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ji&&(e=Error(i(422),{cause:r}),Ri(di(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=di(o,n),Zl===null?Zl=[o]:Zl.push(o),Gl!==4&&(Gl=2),t===null)return!0;r=di(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Ys(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`&&(iu===null||!iu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Xs(a),Zs(a,e,n,r),Ba(n,a),!1}n=n.return}while(n!==null);return!1}var $s=Error(i(461)),ec=!1;function tc(e,t,n,r){t.child=e===null?Na(t,null,n,r):Ma(t,e.child,n,r)}function nc(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 Ji(t),r=yo(e,t,n,o,a,i),s=Co(),e!==null&&!ec?(wo(e,t,i),Ec(e,t,i)):(Oi&&s&&Ci(t),t.flags|=1,tc(e,t,r,i),t.child)}function rc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ni(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ic(e,t,a,r,i)):(e=ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Dc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?gr:n,n(o,r)&&e.ref===t.ref)return Ec(e,t,i)}return t.flags|=1,e=ri(a,r),e.ref=t.ref,e.return=t,t.child=e}function ic(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(gr(a,r)&&e.ref===t.ref)if(ec=!1,t.pendingProps=r=a,Dc(e,i))e.flags&131072&&(ec=!0);else return t.lanes=e.lanes,Ec(e,t,i)}return fc(e,t,n,r,i)}function ac(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 sc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ma(t,a===null?null:a.cachePool),a===null?Ya():Ja(t,a),to(t);else return r=t.lanes=536870912,sc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ma(t,null),Ya(),no(t)):(ma(t,a.cachePool),Ja(t,a),no(t),t.memoizedState=null);return tc(e,t,i,n),t.child}function oc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sc(e,t,n,r,i){var a=pa();return a=a===null?null:{parent:ta._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ma(t,null),Ya(),to(t),e!==null&&Ki(e,t,r,!0),t.childLanes=i,null}function cc(e,t){return t=xc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function lc(e,t,n){return Ma(t,e.child,null,n),e=cc(t,t.pendingProps),e.flags|=2,ro(t),t.memoizedState=null,e}function uc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Oi){if(r.mode===`hidden`)return e=cc(t,r),t.lanes=536870912,oc(null,e);if(eo(t),(e=Di)?(e=cf(e,Ai),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vi===null?null:{id:yi,overflow:bi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,Ei=t,Di=null)):e=null,e===null)throw Mi(t);return t.lanes=536870912,null}return cc(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=lc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(ec||Ki(e,t,n,!1),a=(n&e.childLanes)!==0,ec||a){if(r=Il,r!==null&&(s=qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Xr(e,s),gu(r,e,s),$s;Ou(),t=lc(e,t,n)}else e=o.treeContext,Di=ff(s.nextSibling),Ei=t,Oi=!0,ki=null,Ai=!1,e!==null&&Ti(t,e),t=cc(t,r),t.flags|=4096;return t}return e=ri(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function dc(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 fc(e,t,n,r,i){return Ji(t),n=yo(e,t,n,r,void 0,i),r=Co(),e!==null&&!ec?(wo(e,t,i),Ec(e,t,i)):(Oi&&r&&Ci(t),t.flags|=1,tc(e,t,n,i),t.child)}function pc(e,t,n,r,i,a){return Ji(t),t.updateQueue=null,n=xo(t,r,n,i),bo(e),r=Co(),e!==null&&!ec?(wo(e,t,a),Ec(e,t,a)):(Oi&&r&&Ci(t),t.flags|=1,tc(e,t,n,a),t.child)}function mc(e,t,n,r,i){if(Ji(t),t.stateNode===null){var a=$r,o=n.contextType;typeof o==`object`&&o&&(a=Yi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Bs,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?Yi(o):$r,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(zs(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&&Bs.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=Us(n,s);a.props=c;var l=a.context,u=n.contextType;o=$r,typeof u==`object`&&u&&(o=Yi(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)&&Hs(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`&&(zs(t,n,d,r),l=t.memoizedState),(c=Pa||Vs(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=Us(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=$r,typeof l==`object`&&l&&(c=Yi(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)&&Hs(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&&qi(e.dependencies)?(typeof s==`function`&&(zs(t,n,s,r),p=t.memoizedState),(u=Pa||Vs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&qi(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,dc(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=Ma(t,e.child,null,i),t.child=Ma(t,null,n,i)):tc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ec(e,t,i),e}function hc(e,t,n,r){return Ii(),t.flags|=256,tc(e,t,n,r),t.child}var gc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _c(e){return{baseLanes:e,cachePool:ha()}}function vc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Yl),e}function yc(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(Oi){if(a?$a(t):no(t),(e=Di)?(e=cf(e,Ai),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vi===null?null:{id:yi,overflow:bi},retryLane:536870912,hydrationErrors:null},n=ci(e),n.return=t,t.child=n,Ei=t,Di=null)):e=null,e===null)throw Mi(t);return uf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(no(t),a=t.mode,c=xc({mode:`hidden`,children:c},a),r=oi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=_c(n),r.childLanes=vc(e,s,n),t.memoizedState=gc,oc(null,r)):($a(t),bc(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=Sc(e,t,n)):t.memoizedState===null?(no(t),c=r.fallback,a=t.mode,r=xc({mode:`visible`,children:r.children},a),c=oi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ma(t,e.child,null,n),r=t.child,r.memoizedState=_c(n),r.childLanes=vc(e,s,n),t.memoizedState=gc,t=oc(null,r)):(no(t),t.child=e.child,t.flags|=128,t=null);else if($a(t),uf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Ri({value:r,source:null,stack:null}),t=Sc(e,t,n)}else if(ec||Ki(e,t,n,!1),s=(n&e.childLanes)!==0,ec||s){if(s=Il,s!==null&&(r=qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Xr(e,r),gu(s,e,r),$s;lf(c)||Ou(),t=Sc(e,t,n)}else lf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Di=ff(c.nextSibling),Ei=t,Oi=!0,ki=null,Ai=!1,e!==null&&Ti(t,e),t=bc(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=ri(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=oi(c,a,n,null),c.flags|=2):c=ri(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,oc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=_c(n):(a=c.cachePool,a===null?a=ha():(l=ta._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=vc(e,s,n),t.memoizedState=gc,oc(e.child,r)):($a(t),n=e.child,e=n.sibling,n=ri(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 bc(e,t){return t=xc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function xc(e,t){return e=ti(22,e,null,t),e.lanes=0,e}function Sc(e,t,n){return Ma(t,e.child,null,n),e=bc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Cc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wi(e.return,t,n)}function wc(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 Tc(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,H(io,o),tc(e,t,r,n),r=Oi?hi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cc(e,n,t);else if(e.tag===19)Cc(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),wc(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}wc(t,!0,n,null,a,r);break;case`together`:wc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ec(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Kl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ki(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=ri(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ri(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Dc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&qi(e))):!0}function Oc(e,t,n){switch(t.tag){case 3:ie(t,t.stateNode.containerInfo),Hi(t,ta,e.memoizedState.cache),Ii();break;case 27:case 5:oe(t);break;case 4:ie(t,t.stateNode.containerInfo);break;case 10:Hi(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=Ec(e,t,n),e===null?null:e.sibling):yc(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||=(Ki(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Tc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),H(io,io.current),r)break;return null;case 22:return t.lanes=0,ac(e,t,n,t.pendingProps);case 24:Hi(t,ta,e.memoizedState.cache)}return Ec(e,t,n)}function kc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ec=!0;else{if(!Dc(e,n)&&!(t.flags&128))return ec=!1,Oc(e,t,n);ec=!!(e.flags&131072)}else ec=!1,Oi&&t.flags&1048576&&Si(t,hi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Sa(t.elementType),t.type=e,typeof e==`function`)ni(e)?(r=Us(e,r),t.tag=1,t=mc(null,t,e,r,n)):(t.tag=0,t=fc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=nc(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=rc(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return fc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Us(r,t.pendingProps),mc(e,t,r,a,n);case 3:a:{if(ie(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,Hi(t,ta,r),r!==o.cache&&Gi(t,[ta],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=hc(e,t,r,n);break a}else if(r!==a){a=di(Error(i(424)),t),Ri(a),t=hc(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(Di=ff(e.firstChild),Ei=t,Oi=!0,ki=null,Ai=!0,n=Na(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ii(),r===a){t=Ec(e,t,n);break a}tc(e,t,r,n)}t=t.child}return t;case 26:return dc(e,t),e===null?(n=Nf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Oi||(n=t.type,e=t.pendingProps,r=Wd(U.current).createElement(n),r[$e]=t,r[et]=e,Rd(r,n,e),ft(r),t.stateNode=r):t.memoizedState=Nf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return oe(t),e===null&&Oi&&(r=t.stateNode=gf(t.type,t.pendingProps,U.current),Ei=t,Ai=!0,a=Di,tf(t.type)?(pf=a,Di=ff(r.firstChild)):Di=a),tc(e,t,t.pendingProps.children,n),dc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Oi&&((a=r=Di)&&(r=of(r,t.type,t.pendingProps,Ai),r===null?a=!1:(t.stateNode=r,Ei=t,Di=ff(r.firstChild),Ai=!1,a=!0)),a||Mi(t)),oe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,qd(a,o)?r=null:s!==null&&qd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=yo(e,t,So,null,null,n),np._currentValue=a),dc(e,t),tc(e,t,r,n),t.child;case 6:return e===null&&Oi&&((e=n=Di)&&(n=sf(n,t.pendingProps,Ai),n===null?e=!1:(t.stateNode=n,Ei=t,Di=null,e=!0)),e||Mi(t)),null;case 13:return yc(e,t,n);case 4:return ie(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ma(t,null,r,n):tc(e,t,r,n),t.child;case 11:return nc(e,t,t.type,t.pendingProps,n);case 7:return tc(e,t,t.pendingProps,n),t.child;case 8:return tc(e,t,t.pendingProps.children,n),t.child;case 12:return tc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Hi(t,t.type,r.value),tc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Ji(t),a=Yi(a),r=r(a),t.flags|=1,tc(e,t,r,n),t.child;case 14:return rc(e,t,t.type,t.pendingProps,n);case 15:return ic(e,t,t.type,t.pendingProps,n);case 19:return Tc(e,t,n);case 31:return uc(e,t,n);case 22:return ac(e,t,n,t.pendingProps);case 24:return Ji(t),r=Yi(ta),e===null?(a=pa(),a===null&&(a=Il,o=na(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Fa(t),Hi(t,ta,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,Hi(t,ta,r),r!==a.cache&&Gi(t,[ta],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Hi(t,ta,r))),tc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Ac(e){e.flags|=4}function jc(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(Tu())e.flags|=8192;else throw Ca=ya,_a}else e.flags&=-16777217}function Mc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Jf(t))if(Tu())e.flags|=8192;else throw Ca=ya,_a}function Nc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:W(),e.lanes|=t,Xl|=t)}function Pc(e,t){if(!Oi)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 Fc(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 Ic(e,t,n){var r=t.pendingProps;switch(wi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fc(t),null;case 1:return Fc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ui(ta),ae(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Fi(t)?Ac(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Li())),Fc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Ac(t),o===null?(Fc(t),jc(t,a,null,r,n)):(Fc(t),Mc(t,o))):o?o===e.memoizedState?(Fc(t),t.flags&=-16777217):(Ac(t),Fc(t),Mc(t,o)):(e=e.memoizedProps,e!==r&&Ac(t),Fc(t),jc(t,a,e,r,n)),null;case 27:if(se(t),n=U.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Fc(t),null}e=te.current,Fi(t)?Ni(t,e):(e=gf(a,r,n),t.stateNode=e,Ac(t))}return Fc(t),null;case 5:if(se(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Fc(t),null}if(o=te.current,Fi(t))Ni(t,o);else{var s=Wd(U.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[$e]=t,o[et]=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(Rd(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&&Ac(t)}}return Fc(t),jc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=U.current,Fi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ei,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[$e]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Fd(e.nodeValue,n)),e||Mi(t,!0)}else e=Wd(e).createTextNode(r),e[$e]=t,t.stateNode=e}return Fc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Fi(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[$e]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),e=!1}else n=Li(),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 Fc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Fi(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[$e]=t}else Ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),a=!1}else a=Li(),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),Nc(t,t.updateQueue),Fc(t),null);case 4:return ae(),e===null&&Td(t.stateNode.containerInfo),Fc(t),null;case 10:return Ui(t.type),Fc(t),null;case 19:if(V(io),r=t.memoizedState,r===null)return Fc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Pc(r,!1);else{if(Gl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ao(e),o!==null){for(t.flags|=128,Pc(r,!1),e=o.updateQueue,t.updateQueue=e,Nc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ii(n,e),n=n.sibling;return H(io,io.current&1|2),Oi&&xi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&be()>nu&&(t.flags|=128,a=!0,Pc(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,Nc(t,e),Pc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Oi)return Fc(t),null}else 2*be()-r.renderingStartTime>nu&&n!==536870912&&(t.flags|=128,a=!0,Pc(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?(Fc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=be(),e.sibling=null,n=io.current,H(io,a?n&1|2:n&1),Oi&&xi(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)&&(Fc(t),t.subtreeFlags&6&&(t.flags|=8192)):Fc(t),n=t.updateQueue,n!==null&&Nc(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&&V(fa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ui(ta),Fc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Lc(e,t){switch(wi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ui(ta),ae(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return se(t),null;case 31:if(t.memoizedState!==null){if(ro(t),t.alternate===null)throw Error(i(340));Ii()}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));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(io),null;case 4:return ae(),null;case 10:return Ui(t.type),null;case 22:case 23:return ro(t),Xa(),e!==null&&V(fa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ui(ta),null;case 25:return null;default:return null}}function Rc(e,t){switch(wi(t),t.tag){case 3:Ui(ta),ae();break;case 26:case 27:case 5:se(t);break;case 4:ae();break;case 31:t.memoizedState!==null&&ro(t);break;case 13:ro(t);break;case 19:V(io);break;case 10:Ui(t.type);break;case 22:case 23:ro(t),Xa(),e!==null&&V(fa);break;case 24:Ui(ta)}}function zc(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){Ku(t,t.return,e)}}function Bc(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){Ku(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ku(t,t.return,e)}}function Vc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ga(t,n)}catch(t){Ku(e,e.return,t)}}}function Hc(e,t,n){n.props=Us(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ku(e,t,n)}}function Uc(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){Ku(e,t,n)}}function Wc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Ku(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){Ku(e,t,n)}else n.current=null}function Gc(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){Ku(e,e.return,t)}}function Kc(e,t,n){try{var r=e.stateNode;zd(r,e.type,n,t),r[et]=t}catch(t){Ku(e,e.return,t)}}function qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tf(e.type)||e.tag===4}function Jc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||qc(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&&tf(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 Yc(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=Kt));else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(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&&tf(e.type)&&(n=e.stateNode),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){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Rd(t,r,n),t[$e]=e,t[et]=n}catch(t){Ku(e,e.return,t)}}var Qc=!1,$c=!1,el=!1,tl=typeof WeakSet==`function`?WeakSet:Set,nl=null;function rl(e,t){if(e=e.containerInfo,Hd=dp,e=br(e),xr(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(Ud={focusedElem:e,selectionRange:n},dp=!1,nl=t;nl!==null;)if(t=nl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,nl=e;else for(;nl!==null;){switch(t=nl,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=Us(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ku(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)af(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:af(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,nl=e;break}nl=t.return}}function il(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:vl(e,n),r&4&&zc(5,n);break;case 1:if(vl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ku(n,n.return,e)}else{var i=Us(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ku(n,n.return,e)}}r&64&&Vc(n),r&512&&Uc(n,n.return);break;case 3:if(vl(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){Ku(n,n.return,e)}}break;case 27:t===null&&r&4&&Zc(n);case 26:case 5:vl(e,n),t===null&&r&4&&Gc(n),r&512&&Uc(n,n.return);break;case 12:vl(e,n);break;case 31:vl(e,n),r&4&&ll(e,n);break;case 13:vl(e,n),r&4&&ul(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Xu.bind(null,n),df(e,n))));break;case 22:if(r=n.memoizedState!==null||Qc,!r){t=t!==null&&t.memoizedState!==null||$c,i=Qc;var a=$c;Qc=r,($c=t)&&!a?bl(e,n,(n.subtreeFlags&8772)!=0):vl(e,n),Qc=i,$c=a}break;case 30:break;default:vl(e,n)}}function al(e){var t=e.alternate;t!==null&&(e.alternate=null,al(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&st(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 ol=null,sl=!1;function q(e,t,n){for(n=n.child;n!==null;)cl(e,t,n),n=n.sibling}function cl(e,t,n){if(Ae&&typeof Ae.onCommitFiberUnmount==`function`)try{Ae.onCommitFiberUnmount(ke,n)}catch{}switch(n.tag){case 26:$c||Wc(n,t),q(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:$c||Wc(n,t);var r=ol,i=sl;tf(n.type)&&(ol=n.stateNode,sl=!1),q(e,t,n),_f(n.stateNode),ol=r,sl=i;break;case 5:$c||Wc(n,t);case 6:if(r=ol,i=sl,ol=null,q(e,t,n),ol=r,sl=i,ol!==null)if(sl)try{(ol.nodeType===9?ol.body:ol.nodeName===`HTML`?ol.ownerDocument.body:ol).removeChild(n.stateNode)}catch(e){Ku(n,t,e)}else try{ol.removeChild(n.stateNode)}catch(e){Ku(n,t,e)}break;case 18:ol!==null&&(sl?(e=ol,nf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Lp(e)):nf(ol,n.stateNode));break;case 4:r=ol,i=sl,ol=n.stateNode.containerInfo,sl=!0,q(e,t,n),ol=r,sl=i;break;case 0:case 11:case 14:case 15:Bc(2,n,t),$c||Bc(4,n,t),q(e,t,n);break;case 1:$c||(Wc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Hc(n,t,r)),q(e,t,n);break;case 21:q(e,t,n);break;case 22:$c=(r=$c)||n.memoizedState!==null,q(e,t,n),$c=r;break;default:q(e,t,n)}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Lp(e)}catch(e){Ku(t,t.return,e)}}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Lp(e)}catch(e){Ku(t,t.return,e)}}function dl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new tl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new tl),t;default:throw Error(i(435,e.tag))}}function fl(e,t){var n=dl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Zu.bind(null,e,t);t.then(r,r)}})}function pl(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(tf(c.type)){ol=c.stateNode,sl=!1;break a}break;case 5:ol=c.stateNode,sl=!1;break a;case 3:case 4:ol=c.stateNode.containerInfo,sl=!0;break a}c=c.return}if(ol===null)throw Error(i(160));cl(o,s,a),ol=null,sl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)hl(t,e),t=t.sibling}var ml=null;function hl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:pl(t,e),gl(e),r&4&&(Bc(3,e,e.return),zc(3,e),Bc(5,e,e.return));break;case 1:pl(t,e),gl(e),r&512&&($c||n===null||Wc(n,n.return)),r&64&&Qc&&(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=ml;if(pl(t,e),gl(e),r&512&&($c||n===null||Wc(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[ot]||o[$e]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Rd(o,r,n),o[$e]=e,ft(o),r=o;break a;case`link`:var s=Gf(`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),Rd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Gf(`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),Rd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[$e]=e,ft(o),r=o}e.stateNode=r}else Kf(a,e.type,e.stateNode);else e.stateNode=Bf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Kc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Kf(a,e.type,e.stateNode):Bf(a,r,e.memoizedProps))}break;case 27:pl(t,e),gl(e),r&512&&($c||n===null||Wc(n,n.return)),n!==null&&r&4&&Kc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(pl(t,e),gl(e),r&512&&($c||n===null||Wc(n,n.return)),e.flags&32){a=e.stateNode;try{Rt(a,``)}catch(t){Ku(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Kc(e,a,n===null?a:n.memoizedProps)),r&1024&&(el=!0);break;case 6:if(pl(t,e),gl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ku(e,e.return,t)}}break;case 3:if(Wf=null,a=ml,ml=bf(t.containerInfo),pl(t,e),ml=a,gl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Lp(t.containerInfo)}catch(t){Ku(e,e.return,t)}el&&(el=!1,_l(e));break;case 4:r=ml,ml=bf(e.stateNode.containerInfo),pl(t,e),gl(e),ml=r;break;case 12:pl(t,e),gl(e);break;case 31:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 13:pl(t,e),gl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(eu=be()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Qc,d=$c;if(Qc=u||a,$c=d||l,pl(t,e),$c=d,Qc=u,gl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Qc||$c||yl(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){Ku(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ku(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?rf(m,!0):rf(l.stateNode,!1)}catch(e){Ku(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,fl(e,n))));break;case 19:pl(t,e),gl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,fl(e,r)));break;case 30:break;case 21:break;default:pl(t,e),gl(e)}}function gl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(qc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Xc(e,Jc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Rt(o,``),n.flags&=-33),Xc(e,Jc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Yc(e,Jc(e),s);break;default:throw Error(i(161))}}catch(t){Ku(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function _l(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;_l(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function vl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)il(e,t.alternate,t),t=t.sibling}function yl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Bc(4,t,t.return),yl(t);break;case 1:Wc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Hc(t,t.return,n),yl(t);break;case 27:_f(t.stateNode);case 26:case 5:Wc(t,t.return),yl(t);break;case 22:t.memoizedState===null&&yl(t);break;case 30:yl(t);break;default:yl(t)}e=e.sibling}}function bl(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:bl(i,a,n),zc(4,a);break;case 1:if(bl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ku(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){Ku(r,r.return,e)}}n&&o&64&&Vc(a),Uc(a,a.return);break;case 27:Zc(a);case 26:case 5:bl(i,a,n),n&&r===null&&o&4&&Gc(a),Uc(a,a.return);break;case 12:bl(i,a,n);break;case 31:bl(i,a,n),n&&o&4&&ll(i,a);break;case 13:bl(i,a,n),n&&o&4&&ul(i,a);break;case 22:a.memoizedState===null&&bl(i,a,n),Uc(a,a.return);break;case 30:break;default:bl(i,a,n)}t=t.sibling}}function xl(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&&ra(n))}function Sl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ra(e))}function Cl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)wl(e,t,n,r),t=t.sibling}function wl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Cl(e,t,n,r),i&2048&&zc(9,t);break;case 1:Cl(e,t,n,r);break;case 3:Cl(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&&ra(e)));break;case 12:if(i&2048){Cl(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){Ku(t,t.return,e)}}else Cl(e,t,n,r);break;case 31:Cl(e,t,n,r);break;case 13:Cl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Cl(e,t,n,r):(a._visibility|=2,Tl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Cl(e,t,n,r):El(e,t),i&2048&&xl(o,t);break;case 24:Cl(e,t,n,r),i&2048&&Sl(t.alternate,t);break;default:Cl(e,t,n,r)}}function Tl(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:Tl(a,o,s,c,i),zc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Tl(a,o,s,c,i)):u._visibility&2?Tl(a,o,s,c,i):El(a,o),i&&l&2048&&xl(o.alternate,o);break;case 24:Tl(a,o,s,c,i),i&&l&2048&&Sl(o.alternate,o);break;default:Tl(a,o,s,c,i)}t=t.sibling}}function El(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:El(n,r),i&2048&&xl(r.alternate,r);break;case 24:El(n,r),i&2048&&Sl(r.alternate,r);break;default:El(n,r)}t=t.sibling}}var Dl=8192;function Ol(e,t,n){if(e.subtreeFlags&Dl)for(e=e.child;e!==null;)kl(e,t,n),e=e.sibling}function kl(e,t,n){switch(e.tag){case 26:Ol(e,t,n),e.flags&Dl&&e.memoizedState!==null&&Yf(n,ml,e.memoizedState,e.memoizedProps);break;case 5:Ol(e,t,n);break;case 3:case 4:var r=ml;ml=bf(e.stateNode.containerInfo),Ol(e,t,n),ml=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Dl,Dl=16777216,Ol(e,t,n),Dl=r):Ol(e,t,n));break;default:Ol(e,t,n)}}function Al(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 jl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];nl=r,J(r,e)}Al(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ml(e),e=e.sibling}function Ml(e){switch(e.tag){case 0:case 11:case 15:jl(e),e.flags&2048&&Bc(9,e,e.return);break;case 3:jl(e);break;case 12:jl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Nl(e)):jl(e);break;default:jl(e)}}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];nl=r,J(r,e)}Al(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Bc(8,t,t.return),Nl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Nl(t));break;default:Nl(t)}e=e.sibling}}function J(e,t){for(;nl!==null;){var n=nl;switch(n.tag){case 0:case 11:case 15:Bc(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:ra(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,nl=r;else a:for(n=e;nl!==null;){r=nl;var i=r.sibling,a=r.return;if(al(r),r===n){nl=null;break a}if(i!==null){i.return=a,nl=i;break a}nl=a}}}var Pl={getCacheForType:function(e){var t=Yi(ta),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Yi(ta).controller.signal}},Y=typeof WeakMap==`function`?WeakMap:Map,Fl=0,Il=null,Ll=null,Rl=0,zl=0,Bl=null,Vl=!1,Hl=!1,Ul=!1,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=null,Ql=null,$l=!1,eu=0,tu=0,nu=1/0,ru=null,iu=null,au=0,ou=null,su=null,cu=0,lu=0,uu=null,du=null,fu=0,pu=null;function mu(){return Fl&2&&Rl!==0?Rl&-Rl:I.T===null?Xe():pd()}function hu(){if(Yl===0)if(!(Rl&536870912)||Oi){var e=Le;Le<<=1,!(Le&3932160)&&(Le=262144),Yl=e}else Yl=536870912;return e=Za.current,e!==null&&(e.flags|=32),Yl}function gu(e,t,n){(e===Il&&(zl===2||zl===9)||e.cancelPendingCommit!==null)&&(Cu(e,0),bu(e,Rl,Yl,!1)),Ue(e,n),(!(Fl&2)||e!==Il)&&(e===Il&&(!(Fl&2)&&(ql|=n),Gl===4&&bu(e,Rl,Yl,!1)),ad(e))}function _u(e,t,n){if(Fl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ve(e,t),a=r?ju(e,t):ku(e,t,!0),o=r;do{if(a===0){Hl&&!r&&bu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!yu(n)){a=ku(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=Zl;var l=c.current.memoizedState.isDehydrated;if(l&&(Cu(c,s).flags|=256),s=ku(c,s,!1),s!==2){if(Ul&&!l){c.errorRecoveryDisabledLanes|=o,ql|=o,a=4;break a}o=Ql,Ql=a,o!==null&&(Ql===null?Ql=o:Ql.push.apply(Ql,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Cu(e,0),bu(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:bu(r,t,Yl,!Vl);break a;case 2:Ql=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=eu+300-be(),10<a)){if(bu(r,t,Yl,!Vl),Be(r,0,!0)!==0)break a;cu=t,r.timeoutHandle=Xd(vu.bind(null,r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,`Throttled`,-0,0),a);break a}vu(r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,null,-0,0)}}break}while(1);ad(e)}function vu(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:Kt},kl(t,a,d);var m=(a&62914560)===a?eu-be():(a&4194048)===a?tu-be():0;if(m=Zf(d,m),m!==null){cu=a,e.cancelPendingCommit=m(Ru.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),bu(e,a,o,!l);return}}Ru(e,t,a,n,r,i,o,s,c)}function yu(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(!hr(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 bu(e,t,n,r){t&=~Jl,t&=~ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Me(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ge(e,n,t)}function xu(){return Fl&6?!0:(od(0,!1),!1)}function Su(){if(Ll!==null){if(zl===0)var e=Ll.return;else e=Ll,Vi=Bi=null,To(e),Ea=null,Da=0,e=Ll;for(;e!==null;)Rc(e.alternate,e),e=e.return;Ll=null}}function Cu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Zd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),cu=0,Su(),Il=e,Ll=n=ri(e.current,null),Rl=t,zl=0,Bl=null,Vl=!1,Hl=Ve(e,t),Ul=!1,Xl=Yl=Jl=ql=Kl=Gl=0,Ql=Zl=null,$l=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Me(r),a=1<<i;t|=e[i],r&=~a}return Wl=t,qr(),n}function wu(e,t){oo=null,I.H=Fs,t===ga||t===va?(t=wa(),zl=3):t===_a?(t=wa(),zl=4):zl=t===$s?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Bl=t,Ll===null&&(Gl=1,qs(e,di(t,e.current)))}function Tu(){var e=Za.current;return e===null?!0:(Rl&4194048)===Rl?Qa===null:(Rl&62914560)===Rl||Rl&536870912?e===Qa:!1}function Eu(){var e=I.H;return I.H=Fs,e===null?Fs:e}function Du(){var e=I.A;return I.A=Pl,e}function Ou(){Gl=4,Vl||(Rl&4194048)!==Rl&&Za.current!==null||(Hl=!0),!(Kl&134217727)&&!(ql&134217727)||Il===null||bu(Il,Rl,Yl,!1)}function ku(e,t,n){var r=Fl;Fl|=2;var i=Eu(),a=Du();(Il!==e||Rl!==t)&&(ru=null,Cu(e,t)),t=!1;var o=Gl;a:do try{if(zl!==0&&Ll!==null){var s=Ll,c=Bl;switch(zl){case 8:Su(),o=6;break a;case 3:case 2:case 9:case 6:Za.current===null&&(t=!0);var l=zl;if(zl=0,Bl=null,Fu(e,s,c,l),n&&Hl){o=0;break a}break;default:l=zl,zl=0,Bl=null,Fu(e,s,c,l)}}Au(),o=Gl;break}catch(t){wu(e,t)}while(1);return t&&e.shellSuspendCounter++,Vi=Bi=null,Fl=r,I.H=i,I.A=a,Ll===null&&(Il=null,Rl=0,qr()),o}function Au(){for(;Ll!==null;)Nu(Ll)}function ju(e,t){var n=Fl;Fl|=2;var r=Eu(),a=Du();Il!==e||Rl!==t?(ru=null,nu=be()+500,Cu(e,t)):Hl=Ve(e,t);a:do try{if(zl!==0&&Ll!==null){t=Ll;var o=Bl;b:switch(zl){case 1:zl=0,Bl=null,Fu(e,t,o,1);break;case 2:case 9:if(ba(o)){zl=0,Bl=null,Pu(t);break}t=function(){zl!==2&&zl!==9||Il!==e||(zl=7),ad(e)},o.then(t,t);break a;case 3:zl=7;break a;case 4:zl=5;break a;case 7:ba(o)?(zl=0,Bl=null,Pu(t)):(zl=0,Bl=null,Fu(e,t,o,7));break;case 5:var s=null;switch(Ll.tag){case 26:s=Ll.memoizedState;case 5:case 27:var c=Ll;if(s?Jf(s):c.stateNode.complete){zl=0,Bl=null;var l=c.sibling;if(l!==null)Ll=l;else{var u=c.return;u===null?Ll=null:(Ll=u,Iu(u))}break b}}zl=0,Bl=null,Fu(e,t,o,5);break;case 6:zl=0,Bl=null,Fu(e,t,o,6);break;case 8:Su(),Gl=6;break a;default:throw Error(i(462))}}Mu();break}catch(t){wu(e,t)}while(1);return Vi=Bi=null,I.H=r,I.A=a,Fl=n,Ll===null?(Il=null,Rl=0,qr(),Gl):0}function Mu(){for(;Ll!==null&&!ve();)Nu(Ll)}function Nu(e){var t=kc(e.alternate,e,Wl);e.memoizedProps=e.pendingProps,t===null?Iu(e):Ll=t}function Pu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=pc(n,t,t.pendingProps,t.type,void 0,Rl);break;case 11:t=pc(n,t,t.pendingProps,t.type.render,t.ref,Rl);break;case 5:To(t);default:Rc(n,t),t=Ll=ii(t,Wl),t=kc(n,t,Wl)}e.memoizedProps=e.pendingProps,t===null?Iu(e):Ll=t}function Fu(e,t,n,r){Vi=Bi=null,To(t),Ea=null,Da=0;var i=t.return;try{if(Qs(e,i,t,n,Rl)){Gl=1,qs(e,di(n,e.current)),Ll=null;return}}catch(t){if(i!==null)throw Ll=i,t;Gl=1,qs(e,di(n,e.current)),Ll=null;return}t.flags&32768?(Oi||r===1?e=!0:Hl||Rl&536870912?e=!1:(Vl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Za.current,r!==null&&r.tag===13&&(r.flags|=16384))),Lu(t,e)):Iu(t)}function Iu(e){var t=e;do{if(t.flags&32768){Lu(t,Vl);return}e=t.return;var n=Ic(t.alternate,t,Wl);if(n!==null){Ll=n;return}if(t=t.sibling,t!==null){Ll=t;return}Ll=t=e}while(t!==null);Gl===0&&(Gl=5)}function Lu(e,t){do{var n=Lc(e.alternate,e);if(n!==null){n.flags&=32767,Ll=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ll=e;return}Ll=e=n}while(e!==null);Gl=6,Ll=null}function Ru(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Uu();while(au!==0);if(Fl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Kr,We(e,n,o,s,c,l),e===Il&&(Ll=Il=null,Rl=0),su=t,ou=e,cu=n,lu=o,uu=a,du=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Qu(we,function(){return Wu(),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=Fl,Fl|=4;try{rl(e,t,n)}finally{Fl=s,L.p=a,I.T=r}}au=1,zu(),Bu(),Vu()}}function zu(){if(au===1){au=0;var e=ou,t=su,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=Fl;Fl|=4;try{hl(t,e);var a=Ud,o=br(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&yr(s.ownerDocument.documentElement,s)){if(c!==null&&xr(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 _=vr(s,h),v=vr(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}}dp=!!Hd,Ud=Hd=null}finally{Fl=i,L.p=r,I.T=n}}e.current=t,au=2}}function Bu(){if(au===2){au=0;var e=ou,t=su,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=Fl;Fl|=4;try{il(e,t.alternate,t)}finally{Fl=i,L.p=r,I.T=n}}au=3}}function Vu(){if(au===4||au===3){au=0,ye();var e=ou,t=su,n=cu,r=du;t.subtreeFlags&10256||t.flags&10256?au=5:(au=0,su=ou=null,Hu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(iu=null),Ye(n),t=t.stateNode,Ae&&typeof Ae.onCommitFiberRoot==`function`)try{Ae.onCommitFiberRoot(ke,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}}cu&3&&Uu(),ad(e),i=e.pendingLanes,n&261930&&i&42?e===pu?fu++:(fu=0,pu=e):fu=0,od(0,!1)}}function Hu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ra(t)))}function Uu(){return zu(),Bu(),Vu(),Wu()}function Wu(){if(au!==5)return!1;var e=ou,t=lu;lu=0;var n=Ye(cu),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=uu,uu=null;var o=ou,s=cu;if(au=0,su=ou=null,cu=0,Fl&6)throw Error(i(331));var c=Fl;if(Fl|=4,Ml(o.current),wl(o,o.current,s,n),Fl=c,od(0,!1),Ae&&typeof Ae.onPostCommitFiberRoot==`function`)try{Ae.onPostCommitFiberRoot(ke,o)}catch{}return!0}finally{L.p=a,I.T=r,Hu(e,t)}}function Gu(e,t,n){t=di(n,t),t=Ys(e.stateNode,t,2),e=Ra(e,t,2),e!==null&&(Ue(e,2),ad(e))}function Ku(e,t,n){if(e.tag===3)Gu(e,e,n);else for(;t!==null;){if(t.tag===3){Gu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(iu===null||!iu.has(r))){e=di(n,e),n=Xs(2),r=Ra(t,n,2),r!==null&&(Zs(n,r,t,e),Ue(r,2),ad(r));break}}t=t.return}}function qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Y;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)||(Ul=!0,i.add(n),e=Ju.bind(null,e,t,n),t.then(e,e))}function Ju(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Il===e&&(Rl&n)===n&&(Gl===4||Gl===3&&(Rl&62914560)===Rl&&300>be()-eu?!(Fl&2)&&Cu(e,0):Jl|=n,Xl===Rl&&(Xl=0)),ad(e)}function Yu(e,t){t===0&&(t=W()),e=Xr(e,t),e!==null&&(Ue(e,t),ad(e))}function Xu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yu(e,n)}function Zu(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),Yu(e,n)}function Qu(e,t){return ge(e,t)}var $u=null,ed=null,td=!1,nd=!1,rd=!1,id=0;function ad(e){e!==ed&&e.next===null&&(ed===null?$u=ed=e:ed=ed.next=e),nd=!0,td||(td=!0,fd())}function od(e,t){if(!rd&&nd){rd=!0;do for(var n=!1,r=$u;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-Me(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,dd(r,a))}else a=Rl,a=Be(r,r===Il?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ve(r,a)||(n=!0,dd(r,a));r=r.next}while(n);rd=!1}}function sd(){cd()}function cd(){nd=td=!1;var e=0;id!==0&&Yd()&&(e=id);for(var t=be(),n=null,r=$u;r!==null;){var i=r.next,a=ld(r,t);a===0?(r.next=null,n===null?$u=i:n.next=i,i===null&&(ed=n)):(n=r,(e!==0||a&3)&&(nd=!0)),r=i}au!==0&&au!==5||od(e,!1),id!==0&&(id=0)}function ld(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Me(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=He(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Il,n=Rl,n=Be(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(zl===2||zl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&_e(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ve(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&_e(r),Ye(n)){case 2:case 8:n=Ce;break;case 32:n=we;break;case 268435456:n=Ee;break;default:n=we}return r=ud.bind(null,e),n=ge(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&_e(r),e.callbackPriority=2,e.callbackNode=null,2}function ud(e,t){if(au!==0&&au!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Uu()&&e.callbackNode!==n)return null;var r=Rl;return r=Be(e,e===Il?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(_u(e,r,t),ld(e,be()),e.callbackNode!=null&&e.callbackNode===n?ud.bind(null,e):null)}function dd(e,t){if(Uu())return null;_u(e,t,!0)}function fd(){$d(function(){Fl&6?ge(Se,sd):cd()})}function pd(){if(id===0){var e=oa;e===0&&(e=Ie,Ie<<=1,!(Ie&261888)&&(Ie=256)),id=e}return id}function md(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Gt(``+e)}function hd(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 gd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=md((i[et]||null).action),o=r.submitter;o&&(t=(t=o[et]||null)?md(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new mn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(id!==0){var e=o?hd(i,o):new FormData(i);xs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?hd(i,o):new FormData(i),xs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var _d=0;_d<Vr.length;_d++){var vd=Vr[_d];Hr(vd.toLowerCase(),`on`+(vd[0].toUpperCase()+vd.slice(1)))}Hr(Nr,`onAnimationEnd`),Hr(Pr,`onAnimationIteration`),Hr(Fr,`onAnimationStart`),Hr(`dblclick`,`onDoubleClick`),Hr(`focusin`,`onFocus`),Hr(`focusout`,`onBlur`),Hr(Ir,`onTransitionRun`),Hr(Lr,`onTransitionStart`),Hr(Rr,`onTransitionCancel`),Hr(zr,`onTransitionEnd`),gt(`onMouseEnter`,[`mouseout`,`mouseover`]),gt(`onMouseLeave`,[`mouseout`,`mouseover`]),gt(`onPointerEnter`,[`pointerout`,`pointerover`]),gt(`onPointerLeave`,[`pointerout`,`pointerover`]),ht(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),ht(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),ht(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),ht(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),ht(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),ht(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var yd=`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(` `),bd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(yd));function xd(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){Ur(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){Ur(e)}i.currentTarget=null,a=c}}}}function Sd(e,t){var n=t[nt];n===void 0&&(n=t[nt]=new Set);var r=e+`__bubble`;n.has(r)||(Ed(t,e,2,!1),n.add(r))}function Cd(e,t,n){var r=0;t&&(r|=4),Ed(n,e,r,t)}var wd=`_reactListening`+Math.random().toString(36).slice(2);function Td(e){if(!e[wd]){e[wd]=!0,pt.forEach(function(t){t!==`selectionchange`&&(bd.has(t)||Cd(t,!1,e),Cd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wd]||(t[wd]=!0,Cd(`selectionchange`,!1,t))}}function Ed(e,t,n,r){switch(vp(t)){case 2:var i=fp;break;case 8:i=pp;break;default:i=mp}n=i.bind(null,t,n,e),i=void 0,!nn||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 Dd(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=ct(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}$t(function(){var r=a,i=Jt(n),s=[];a:{var c=Br.get(e);if(c!==void 0){var l=mn,u=e;switch(e){case`keypress`:if(ln(n)===0)break a;case`keydown`:case`keyup`:l=Mn;break;case`focusin`:u=`focus`,l=Cn;break;case`focusout`:u=`blur`,l=Cn;break;case`beforeblur`:case`afterblur`:l=Cn;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=xn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Sn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Pn;break;case Nr:case Pr:case Fr:l=wn;break;case zr:l=Fn;break;case`scroll`:case`scrollend`:l=gn;break;case`wheel`:l=In;break;case`copy`:case`cut`:case`paste`:l=Tn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Nn;break;case`toggle`:case`beforetoggle`:l=Ln}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=en(m,p),g!=null&&d.push(Od(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!==qt&&(u=n.relatedTarget||n.fromElement)&&(ct(u)||u[tt]))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?ct(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=xn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Nn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:ut(l),h=u==null?c:ut(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ct(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=Ad,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&&jd(s,c,l,d,!1),u!==null&&f!==null&&jd(s,f,u,d,!0)}}a:{if(c=r?ut(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=rr;else if(Zn(c))if(ir)v=pr;else{v=dr;var y=ur}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Ht(r.elementType)&&(v=rr):v=fr;if(v&&=v(e,r)){Qn(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Pt(c,`number`,c.value)}switch(y=r?ut(r):window,e){case`focusin`:(Zn(y)||y.contentEditable===`true`)&&(Cr=y,wr=r,Tr=null);break;case`focusout`:Tr=wr=Cr=null;break;case`mousedown`:Er=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Er=!1,Dr(s,n,i);break;case`selectionchange`:if(Sr)break;case`keydown`:case`keyup`:Dr(s,n,i)}var b;if(zn)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 qn?Gn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Hn&&n.locale!==`ko`&&(qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&qn&&(b=cn()):(an=i,on=`value`in an?an.value:an.textContent,qn=!0)),y=kd(r,x),0<y.length&&(x=new En(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Kn(n),b!==null&&(x.data=b)))),(b=Vn?Jn(e,n):Yn(e,n))&&(x=kd(r,`onBeforeInput`),0<x.length&&(y=new En(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),gd(s,e,r,n,i)}xd(s,t)})}function Od(e,t,n){return{instance:e,listener:t,currentTarget:n}}function kd(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=en(e,n),i!=null&&r.unshift(Od(e,i,a)),i=en(e,t),i!=null&&r.push(Od(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ad(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function jd(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=en(n,a),l!=null&&o.unshift(Od(n,l,c))):i||(l=en(n,a),l!=null&&o.push(Od(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Md=/\r\n?/g,Nd=/\u0000|\uFFFD/g;function Pd(e){return(typeof e==`string`?e:``+e).replace(Md,`
|
|
9
|
-
`).replace(Nd,``)}function Fd(e,t){return t=Pd(t),Pd(e)===t}function Id(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Rt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Rt(e,``+r);break;case`className`:St(e,`class`,r);break;case`tabIndex`:St(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:St(e,n,r);break;case`style`:Vt(e,r,o);break;case`data`:if(t!==`object`){St(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=Gt(``+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`&&Id(e,t,`name`,a.name,a,null),Id(e,t,`formEncType`,a.formEncType,a,null),Id(e,t,`formMethod`,a.formMethod,a,null),Id(e,t,`formTarget`,a.formTarget,a,null)):(Id(e,t,`encType`,a.encType,a,null),Id(e,t,`method`,a.method,a,null),Id(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Gt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Kt);break;case`onScroll`:r!=null&&Sd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Sd(`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=Gt(``+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`:Sd(`beforetoggle`,e),Sd(`toggle`,e),xt(e,`popover`,r);break;case`xlinkActuate`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Ct(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Ct(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Ct(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Ct(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:xt(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=Ut.get(n)||n,xt(e,n,r))}}function Ld(e,t,n,r,a,o){switch(n){case`style`:Vt(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`?Rt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Rt(e,``+r);break;case`onScroll`:r!=null&&Sd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Sd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Kt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!mt.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[et]||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,``):xt(e,n,r)}}}function Rd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Sd(`error`,e),Sd(`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:Id(e,t,o,s,n,null)}}a&&Id(e,t,`srcSet`,n.srcSet,n,null),r&&Id(e,t,`src`,n.src,n,null);return;case`input`:Sd(`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:Id(e,t,r,d,n,null)}}Nt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Sd(`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:Id(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Ft(e,!!r,n,!0):Ft(e,!!r,t,!1);return;case`textarea`:for(s in Sd(`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:Id(e,t,s,c,n,null)}Lt(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:Id(e,t,l,r,n,null)}return;case`dialog`:Sd(`beforetoggle`,e),Sd(`toggle`,e),Sd(`cancel`,e),Sd(`close`,e);break;case`iframe`:case`object`:Sd(`load`,e);break;case`video`:case`audio`:for(r=0;r<yd.length;r++)Sd(yd[r],e);break;case`image`:Sd(`error`,e),Sd(`load`,e);break;case`details`:Sd(`toggle`,e);break;case`embed`:case`source`:case`link`:Sd(`error`,e),Sd(`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:Id(e,t,u,r,n,null)}return;default:if(Ht(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Ld(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Id(e,t,c,r,n,null))}function zd(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)||Id(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&&Id(e,t,p,m,r,f)}}Mt(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)||Id(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&&Id(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ft(e,!!n,n?[]:``,!1):Ft(e,!!n,t,!0)):Ft(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:Id(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&&Id(e,t,s,a,r,o)}It(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:Id(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:Id(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)&&Id(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:Id(e,t,u,p,r,m)}return;default:if(Ht(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Ld(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||Ld(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Id(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||Id(e,t,f,p,r,m)}function Bd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Vd(){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&&Bd(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&&Bd(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 Hd=null,Ud=null;function Wd(e){return e.nodeType===9?e:e.ownerDocument}function Gd(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 Kd(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 qd(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 Jd=null;function Yd(){var e=window.event;return e&&e.type===`popstate`?e===Jd?!1:(Jd=e,!0):(Jd=null,!1)}var Xd=typeof setTimeout==`function`?setTimeout:void 0,Zd=typeof clearTimeout==`function`?clearTimeout:void 0,Qd=typeof Promise==`function`?Promise:void 0,$d=typeof queueMicrotask==`function`?queueMicrotask:Qd===void 0?Xd:function(e){return Qd.resolve(null).then(e).catch(ef)};function ef(e){setTimeout(function(){throw e})}function tf(e){return e===`head`}function nf(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),Lp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_f(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_f(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ot]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_f(e.ownerDocument.body);n=i}while(n);Lp(t)}function rf(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 af(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`:af(n),st(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function of(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[ot])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=ff(e.nextSibling),e===null)break}return null}function sf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=ff(e.nextSibling),e===null))return null;return e}function cf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=ff(e.nextSibling),e===null))return null;return e}function lf(e){return e.data===`$?`||e.data===`$~`}function uf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function df(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 ff(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 pf=null;function mf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return ff(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hf(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 gf(e,t,n){switch(t=Wd(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 _f(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);st(e)}var vf=new Map,yf=new Set;function bf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xf=L.d;L.d={f:Sf,r:Cf,D:Ef,C:Df,L:Of,m:kf,X:jf,S:Af,M:Mf};function Sf(){var e=xf.f(),t=xu();return e||t}function Cf(e){var t=lt(e);t!==null&&t.tag===5&&t.type===`form`?Cs(t):xf.r(e)}var wf=typeof document>`u`?null:document;function Tf(e,t,n){var r=wf;if(r&&typeof t==`string`&&t){var i=jt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),yf.has(i)||(yf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Rd(t,`link`,e),ft(t),r.head.appendChild(t)))}}function Ef(e){xf.D(e),Tf(`dns-prefetch`,e,null)}function Df(e,t){xf.C(e,t),Tf(`preconnect`,e,t)}function Of(e,t,n){xf.L(e,t,n);var r=wf;if(r&&e&&t){var i=`link[rel="preload"][as="`+jt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+jt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+jt(n.imageSizes)+`"]`)):i+=`[href="`+jt(e)+`"]`;var a=i;switch(t){case`style`:a=Pf(e);break;case`script`:a=Rf(e)}vf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Ff(a))||t===`script`&&r.querySelector(zf(a))||(t=r.createElement(`link`),Rd(t,`link`,e),ft(t),r.head.appendChild(t)))}}function kf(e,t){xf.m(e,t);var n=wf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+jt(r)+`"][href="`+jt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rf(e)}if(!vf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),vf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zf(a)))return}r=n.createElement(`link`),Rd(r,`link`,e),ft(r),n.head.appendChild(r)}}}function Af(e,t,n){xf.S(e,t,n);var r=wf;if(r&&e){var i=dt(r).hoistableStyles,a=Pf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Ff(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vf.get(a))&&Hf(e,n);var c=o=r.createElement(`link`);ft(c),Rd(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,Vf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jf(e,t){xf.X(e,t);var n=wf;if(n&&e){var r=dt(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=m({src:e,async:!0},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),ft(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t){xf.M(e,t);var n=wf;if(n&&e){var r=dt(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),ft(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nf(e,t,n,r){var a=(a=U.current)?bf(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=Pf(n.href),n=dt(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=Pf(n.href);var o=dt(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(Ff(e)))&&!o._p&&(s.instance=o,s.state.loading=5),vf.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},vf.set(e,n),o||Lf(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=Rf(n),n=dt(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 Pf(e){return`href="`+jt(e)+`"`}function Ff(e){return`link[rel="stylesheet"][`+e+`]`}function If(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Lf(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}),Rd(t,`link`,n),ft(t),e.head.appendChild(t))}function Rf(e){return`[src="`+jt(e)+`"]`}function zf(e){return`script[async]`+e}function Bf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+jt(n.href)+`"]`);if(r)return t.instance=r,ft(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ft(r),Rd(r,`style`,a),Vf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pf(n.href);var o=e.querySelector(Ff(a));if(o)return t.state.loading|=4,t.instance=o,ft(o),o;r=If(n),(a=vf.get(a))&&Hf(r,a),o=(e.ownerDocument||e).createElement(`link`),ft(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Rd(o,`link`,r),t.state.loading|=4,Vf(o,n.precedence,e),t.instance=o;case`script`:return o=Rf(n.src),(a=e.querySelector(zf(o)))?(t.instance=a,ft(a),a):(r=n,(a=vf.get(o))&&(r=m({},n),Uf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),ft(a),Rd(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,Vf(r,n.precedence,e));return t.instance}function Vf(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 Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wf=null;function Gf(e,t,n){if(Wf===null){var r=new Map,i=Wf=new Map;i.set(n,r)}else i=Wf,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[ot]||a[$e]||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 Kf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qf(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 Jf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Yf(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=Pf(r.href),a=t.querySelector(Ff(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Qf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ft(a);return}a=t.ownerDocument||t,r=If(r),(i=vf.get(i))&&Hf(r,i),a=a.createElement(`link`),ft(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Rd(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=Qf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Xf=0;function Zf(e,t){return e.stylesheets&&e.count===0&&ep(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Xf===0&&(Xf=62500*Vd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Xf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Qf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ep(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var $f=null;function ep(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$f=new Map,t.forEach(tp,e),$f=null,Qf.call(e))}function tp(e,t){if(!(t.state.loading&4)){var n=$f.get(e);if(n)var r=n.get(null);else{n=new Map,$f.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=Qf.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 np={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function rp(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=G(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=G(0),this.hiddenUpdates=G(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 ip(e,t,n,r,i,a,o,s,c,l,u,d){return e=new rp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ti(3,null,null,t),e.current=a,a.stateNode=e,t=na(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Fa(a),e}function ap(e){return e?(e=$r,e):$r}function op(e,t,n,r,i,a){i=ap(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&&(gu(n,e,t),za(n,e,t))}function sp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cp(e,t){sp(e,t),(e=e.alternate)&&sp(e,t)}function lp(e){if(e.tag===13||e.tag===31){var t=Xr(e,67108864);t!==null&&gu(t,e,67108864),cp(e,67108864)}}function up(e){if(e.tag===13||e.tag===31){var t=mu();t=Je(t);var n=Xr(e,t);n!==null&&gu(n,e,t),cp(e,t)}}var dp=!0;function fp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,mp(e,t,n,r)}finally{L.p=a,I.T=i}}function pp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,mp(e,t,n,r)}finally{L.p=a,I.T=i}}function mp(e,t,n,r){if(dp){var i=hp(r);if(i===null)Dd(e,t,r,gp,n),Dp(e,r);else if(kp(i,e,t,n,r))r.stopPropagation();else if(Dp(e,r),t&4&&-1<Ep.indexOf(e)){for(;i!==null;){var a=lt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=ze(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Me(o);s.entanglements[1]|=c,o&=~c}ad(a),!(Fl&6)&&(nu=be()+500,od(0,!1))}}break;case 31:case 13:s=Xr(a,2),s!==null&&gu(s,a,2),xu(),cp(a,2)}if(a=hp(r),a===null&&Dd(e,t,r,gp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Dd(e,t,r,null,n)}}function hp(e){return e=Jt(e),_p(e)}var gp=null;function _p(e){if(gp=null,e=ct(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 gp=e,null}function vp(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(xe()){case Se:return 2;case Ce:return 8;case we:case Te:return 32;case Ee:return 268435456;default:return 32}default:return 32}}var yp=!1,bp=null,xp=null,Sp=null,Cp=new Map,wp=new Map,Tp=[],Ep=`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 Dp(e,t){switch(e){case`focusin`:case`focusout`:bp=null;break;case`dragenter`:case`dragleave`:xp=null;break;case`mouseover`:case`mouseout`:Sp=null;break;case`pointerover`:case`pointerout`:Cp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:wp.delete(t.pointerId)}}function Op(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=lt(t),t!==null&&lp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function kp(e,t,n,r,i){switch(t){case`focusin`:return bp=Op(bp,e,t,n,r,i),!0;case`dragenter`:return xp=Op(xp,e,t,n,r,i),!0;case`mouseover`:return Sp=Op(Sp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Cp.set(a,Op(Cp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,wp.set(a,Op(wp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ap(e){var t=ct(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,Ze(e.priority,function(){up(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Ze(e.priority,function(){up(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 jp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);qt=r,n.target.dispatchEvent(r),qt=null}else return t=lt(n),t!==null&&lp(t),e.blockedOn=n,!1;t.shift()}return!0}function Mp(e,t,n){jp(e)&&n.delete(t)}function Np(){yp=!1,bp!==null&&jp(bp)&&(bp=null),xp!==null&&jp(xp)&&(xp=null),Sp!==null&&jp(Sp)&&(Sp=null),Cp.forEach(Mp),wp.forEach(Mp)}function Pp(e,n){e.blockedOn===n&&(e.blockedOn=null,yp||(yp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Np)))}var Fp=null;function Ip(e){Fp!==e&&(Fp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Fp===e&&(Fp=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(_p(r||n)===null)continue;break}var a=lt(n);a!==null&&(e.splice(t,3),t-=3,xs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Lp(e){function t(t){return Pp(t,e)}bp!==null&&Pp(bp,e),xp!==null&&Pp(xp,e),Sp!==null&&Pp(Sp,e),Cp.forEach(t),wp.forEach(t);for(var n=0;n<Tp.length;n++){var r=Tp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Tp.length&&(n=Tp[0],n.blockedOn===null);)Ap(n),n.blockedOn===null&&Tp.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[et]||null;if(typeof a==`function`)o||Ip(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[et]||null)s=o.formAction;else if(_p(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Ip(n)}}}function Rp(){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 zp(e){this._internalRoot=e}Bp.prototype.render=zp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;op(n,mu(),e,t,null,null)},Bp.prototype.unmount=zp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;op(e.current,2,null,e,null,null),xu(),t[tt]=null}};function Bp(e){this._internalRoot=e}Bp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Xe();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Tp.length&&t!==0&&t<Tp[n].priority;n++);Tp.splice(n,0,e),n===0&&Ap(e)}};var Vp=n.version;if(Vp!==`19.2.6`)throw Error(i(527,Vp,`19.2.6`));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=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Hp={bundleType:0,version:`19.2.6`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.6`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Up=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Up.isDisabled&&Up.supportsFiber)try{ke=Up.inject(Hp),Ae=Up}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ws,s=Gs,c=Ks;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=ip(e,1,!1,null,null,n,r,null,o,s,c,Rp),e[tt]=t.current,Td(e),new zp(t)}})),_=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=g()})),v=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(){}},y=new class extends v{#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`}},b={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},x=new class{#e=b;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 S(e){setTimeout(e,0)}var C=typeof window>`u`||`Deno`in globalThis;function w(){}function T(e,t){return typeof e==`function`?e(t):e}function E(e){return typeof e==`number`&&e>=0&&e!==1/0}function D(e,t){return Math.max(e+(t||0)-Date.now(),0)}function O(e,t){return typeof e==`function`?e(t):e}function k(e,t){return typeof e==`function`?e(t):e}function A(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==M(o,t.options))return!1}else if(!P(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 j(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(N(t.options.mutationKey)!==N(a))return!1}else if(!P(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function M(e,t){return(t?.queryKeyHashFn||N)(e)}function N(e){return JSON.stringify(e,(e,t)=>ee(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function P(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>P(e[n],t[n])):!1}var F=Object.prototype.hasOwnProperty;function I(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=R(e)&&R(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:F.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=I(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function L(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 R(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ee(e){if(!z(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!z(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function z(e){return Object.prototype.toString.call(e)===`[object Object]`}function B(e){return new Promise(t=>{x.setTimeout(t,e)})}function V(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:I(e,t)}function H(e){return e}function te(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ne(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var U=Symbol();function re(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===U?()=>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=()=>C;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=S;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 v{#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=()=>y.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),B(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(),E(this.gcTime)&&(this.#e=x.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&&(x.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=re(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?ne:te;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=V(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(w).catch(w):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=>k(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===U||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>O(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:!D(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=re(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 v{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 k(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&&!L(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||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||O(this.options.staleTime,this.#t)!==O(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(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(w)),t}#g(){this.#b();let e=O(this.options.staleTime,this.#t);if(oe.isServer()||this.#r.isStale||!E(e))return;let t=D(this.#r.dataUpdatedAt,e)+1;this.#d=x.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()||k(this.options.enabled,this.#t)===!1||!E(this.#p)||this.#p===0)&&(this.#f=x.setInterval(()=>{(this.options.refetchIntervalInBackground||y.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(x.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(x.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=V(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=V(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:k(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),!L(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 k(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&k(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(k(t.enabled,e)!==!1&&O(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||k(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&ke(e,n)}function ke(e,t){return k(t.enabled,e)!==!1&&e.isStaleByTime(O(t.staleTime,e))}function Ae(e,t){return!L(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 v{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=>j(t,e))}findAll(e={}){return this.getAll().filter(t=>j(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(w))))}};function Pe(e){return e.options.scope?.id}var Fe=class extends v{#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),L(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&N(t.mutationKey)!==N(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)})})}};function Ie(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Le(e,t,n){let r=e.slice(0);return r[t]=n,r}var Re=class extends v{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,ue.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!L(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ie(e,n).forEach(e=>{e.destroy()}),Ie(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=I(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new we(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Le(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&ue.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},ze=class extends v{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??M(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=>A(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>A(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()})})}},Be=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ze,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=y.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(O(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=T(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(w).catch(w)}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(w)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(w)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(O(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(w).catch(w)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(w).catch(w)}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(N(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{P(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(N(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{P(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||=M(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===U&&(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()}},Ve=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})),He=o(((e,t)=>{t.exports=Ve()})),W=l(d(),1),G=He(),Ue=W.createContext(void 0),We=e=>{let t=W.useContext(Ue);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ge=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,G.jsx)(Ue.Provider,{value:e,children:t})),Ke=W.createContext(!1),qe=()=>W.useContext(Ke);Ke.Provider;function Je(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ye=W.createContext(Je()),Xe=()=>W.useContext(Ye),Ze=(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))},Qe=e=>{W.useEffect(()=>{e.clearReset()},[e])},$e=({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])),et=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))}},tt=(e,t)=>e.isLoading&&e.isFetching&&!t,nt=(e,t)=>e?.suspense&&t.isPending,rt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function it({queries:e,...t},n){let r=We(n),i=qe(),a=Xe(),o=W.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{et(e),Ze(e,a,r.getQueryCache().get(e.queryHash))}),Qe(a);let[s]=W.useState(()=>new Re(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;W.useSyncExternalStore(W.useCallback(e=>d?s.subscribe(ue.batchCalls(e)):w,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),W.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>nt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&nt(n,e)?rt(n,new we(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&$e({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function at(e,t,n){let r=qe(),i=Xe(),a=We(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,et(o),Ze(o,i,s),Qe(i);let c=!a.getQueryCache().get(o.queryHash),[l]=W.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(W.useSyncExternalStore(W.useCallback(e=>{let t=d?l.subscribe(ue.batchCalls(e)):w;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),W.useEffect(()=>{l.setOptions(o)},[o,l]),nt(o,u))throw rt(o,l,i);if($e({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!oe.isServer()&&tt(u,r)&&(c?rt(o,l,i):s?.promise)?.catch(w).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function ot(e,t){return at(e,we,t)}function st(e,t){let n=We(t),[r]=W.useState(()=>new Fe(n,e));W.useEffect(()=>{r.setOptions(e)},[r,e]);let i=W.useSyncExternalStore(W.useCallback(e=>r.subscribe(ue.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=W.useCallback((e,t)=>{r.mutate(e,t).catch(w)},[r]);if(i.error&&ie(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var ct=`modulepreload`,lt=function(e){return`/`+e},ut={},dt=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=lt(t,n),t in ut)return;ut[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:ct,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},ft=`popstate`;function pt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function mt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return yt(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:bt(t)}return St(t,n,null,e)}function ht(e,t){if(e===!1||e==null)throw Error(t)}function gt(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function _t(){return Math.random().toString(36).substring(2,10)}function vt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function yt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?xt(t):t,state:n,key:t&&t.key||r||_t(),mask:i}}function bt({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function xt(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function St(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=pt(e)?e:yt(h.location,e,t);n&&n(r,e),l=u()+1;let d=vt(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=pt(e)?e:yt(h.location,e,t);n&&n(r,e),l=u();let i=vt(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Ct(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(ft,d),c=e,()=>{i.removeEventListener(ft,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Ct(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),ht(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:bt(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function wt(e,t,n=`/`){return Tt(e,t,n,!1)}function Tt(e,t,n,r,i){let a=Wt((typeof t==`string`?xt(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Dt(e),s=null,c=Ut(a);for(let e=0;s==null&&e<o.length;++e)s=Bt(o[e],c,r);return s}function Et(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Dt(e){let t=Ot(e);return At(t),t}function Ot(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;ht(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=$t([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(ht(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Ot(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Rt(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of kt(e.path))a(e,t,!0,n)}),t}function kt(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=kt(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function At(e){e.sort((e,t)=>e.score===t.score?zt(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var jt=/^:[\w-]+$/,Mt=3,Nt=2,Pt=1,Ft=10,It=-2,Lt=e=>e===`*`;function Rt(e,t){let n=e.split(`/`),r=n.length;return n.some(Lt)&&(r+=It),t&&(r+=Nt),n.filter(e=>!Lt(e)).reduce((e,t)=>e+(jt.test(t)?Mt:t===``?Pt:Ft),r)}function zt(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Bt(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=Vt({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=Vt({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:$t([a,u.pathname]),pathnameBase:tn($t([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=$t([a,u.pathnameBase]))}return o}function Vt(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Ht(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Ht(e,t=!1,n=!0){gt(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Ut(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return gt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Wt(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var Gt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Kt(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?xt(e):e,a;return n?(n=Qt(n),a=n.startsWith(`/`)?qt(n.substring(1),`/`):qt(n,t)):a=t,{pathname:a,search:nn(r),hash:rn(i)}}function qt(e,t){let n=en(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function Jt(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Yt(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Xt(e){let t=Yt(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Zt(e,t,n,r=!1){let i;typeof e==`string`?i=xt(e):(i={...e},ht(!i.pathname||!i.pathname.includes(`?`),Jt(`?`,`pathname`,`search`,i)),ht(!i.pathname||!i.pathname.includes(`#`),Jt(`#`,`pathname`,`hash`,i)),ht(!i.search||!i.search.includes(`#`),Jt(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Kt(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Qt=e=>e.replace(/\/\/+/g,`/`),$t=e=>Qt(e.join(`/`)),en=e=>e.replace(/\/+$/,``),tn=e=>en(e).replace(/^\/*/,`/`),nn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,rn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,an=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function on(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function sn(e){return $t(e.map(e=>e.route.path).filter(Boolean))||`/`}var cn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function ln(e,t){let n=e;if(typeof n!=`string`||!Gt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(cn)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=Wt(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{gt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var un=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(un);var dn=[`GET`,...un];new Set(dn);var fn=W.createContext(null);fn.displayName=`DataRouter`;var pn=W.createContext(null);pn.displayName=`DataRouterState`;var mn=W.createContext(!1);function hn(){return W.useContext(mn)}var gn=W.createContext({isTransitioning:!1});gn.displayName=`ViewTransition`;var _n=W.createContext(new Map);_n.displayName=`Fetchers`;var vn=W.createContext(null);vn.displayName=`Await`;var yn=W.createContext(null);yn.displayName=`Navigation`;var bn=W.createContext(null);bn.displayName=`Location`;var xn=W.createContext({outlet:null,matches:[],isDataRoute:!1});xn.displayName=`Route`;var Sn=W.createContext(null);Sn.displayName=`RouteError`;var Cn=`REACT_ROUTER_ERROR`,wn=`REDIRECT`,Tn=`ROUTE_ERROR_RESPONSE`;function En(e){if(e.startsWith(`${Cn}:${wn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Dn(e){if(e.startsWith(`${Cn}:${Tn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new an(t.status,t.statusText,t.data)}catch{}}function On(e,{relative:t}={}){ht(kn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=W.useContext(yn),{hash:i,pathname:a,search:o}=Rn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:$t([n,a])),r.createHref({pathname:s,search:o,hash:i})}function kn(){return W.useContext(bn)!=null}function An(){return ht(kn(),`useLocation() may be used only in the context of a <Router> component.`),W.useContext(bn).location}var jn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Mn(e){W.useContext(yn).static||W.useLayoutEffect(e)}function Nn(){let{isDataRoute:e}=W.useContext(xn);return e?rr():Pn()}function Pn(){ht(kn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=W.useContext(fn),{basename:t,navigator:n}=W.useContext(yn),{matches:r}=W.useContext(xn),{pathname:i}=An(),a=JSON.stringify(Xt(r)),o=W.useRef(!1);return Mn(()=>{o.current=!0}),W.useCallback((r,s={})=>{if(gt(o.current,jn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Zt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:$t([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Fn=W.createContext(null);function In(e){let t=W.useContext(xn).outlet;return W.useMemo(()=>t&&W.createElement(Fn.Provider,{value:e},t),[t,e])}function Ln(){let{matches:e}=W.useContext(xn);return e[e.length-1]?.params??{}}function Rn(e,{relative:t}={}){let{matches:n}=W.useContext(xn),{pathname:r}=An(),i=JSON.stringify(Xt(n));return W.useMemo(()=>Zt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function zn(e,t){return Bn(e,t)}function Bn(e,t,n){ht(kn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=W.useContext(yn),{matches:i}=W.useContext(xn),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;ar(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
10
|
-
|
|
11
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=An(),d;if(t){let e=typeof t==`string`?xt(t):t;ht(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):wt(e,{pathname:p});gt(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),gt(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=qn(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:$t([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:$t([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?W.createElement(bn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Vn(){let e=nr(),t=on(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=W.createElement(W.Fragment,null,W.createElement(`p`,null,`💿 Hey developer 👋`),W.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,W.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,W.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),W.createElement(W.Fragment,null,W.createElement(`h2`,null,`Unexpected Application Error!`),W.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?W.createElement(`pre`,{style:i},n):null,o)}var Hn=W.createElement(Vn,null),Un=class extends W.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Dn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:W.createElement(xn.Provider,{value:this.props.routeContext},W.createElement(Sn.Provider,{value:e,children:this.props.component}));return this.context?W.createElement(Gn,{error:e},t):t}};Un.contextType=mn;var Wn=new WeakMap;function Gn({children:e,error:t}){let{basename:n}=W.useContext(yn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=En(t.digest);if(e){let r=Wn.get(t);if(r)throw r;let i=ln(e.location,n);if(cn&&!Wn.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw Wn.set(t,n),n}return W.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function Kn({routeContext:e,match:t,children:n}){let r=W.useContext(fn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),W.createElement(xn.Provider,{value:e},n)}function qn(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);ht(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:sn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Hn,o&&(s<0&&c===0?(ar(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?W.createElement(n.route.Component,null):n.route.element?n.route.element:e,W.createElement(Kn,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?W.createElement(Un,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Jn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Yn(e){let t=W.useContext(fn);return ht(t,Jn(e)),t}function Xn(e){let t=W.useContext(pn);return ht(t,Jn(e)),t}function Zn(e){let t=W.useContext(xn);return ht(t,Jn(e)),t}function Qn(e){let t=Zn(e),n=t.matches[t.matches.length-1];return ht(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function $n(){return Qn(`useRouteId`)}function er(){let e=Xn(`useNavigation`);return W.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function tr(){let{matches:e,loaderData:t}=Xn(`useMatches`);return W.useMemo(()=>e.map(e=>Et(e,t)),[e,t])}function nr(){let e=W.useContext(Sn),t=Xn(`useRouteError`),n=Qn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function rr(){let{router:e}=Yn(`useNavigate`),t=Qn(`useNavigate`),n=W.useRef(!1);return Mn(()=>{n.current=!0}),W.useCallback(async(r,i={})=>{gt(n.current,jn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var ir={};function ar(e,t,n){!t&&!ir[e]&&(ir[e]=!0,gt(!1,n))}W.memo(or);function or({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Bn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function sr({to:e,replace:t,state:n,relative:r}){ht(kn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=W.useContext(yn);gt(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=W.useContext(xn),{pathname:o}=An(),s=Nn(),c=Zt(e,Xt(a),o,r===`path`),l=JSON.stringify(c);return W.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function cr(e){return In(e.context)}function lr(e){ht(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function ur({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){ht(!kn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=W.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=xt(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=W.useMemo(()=>{let e=Wt(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return gt(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:W.createElement(yn.Provider,{value:c},W.createElement(bn.Provider,{children:t,value:h}))}function dr({children:e,location:t}){return zn(fr(e),t)}W.Component;function fr(e,t=[]){let n=[];return W.Children.forEach(e,(e,r)=>{if(!W.isValidElement(e))return;let i=[...t,r];if(e.type===W.Fragment){n.push.apply(n,fr(e.props.children,i));return}ht(e.type===lr,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ht(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=fr(e.props.children,i)),n.push(a)}),n}var pr=`get`,mr=`application/x-www-form-urlencoded`;function hr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function gr(e){return hr(e)&&e.tagName.toLowerCase()===`button`}function _r(e){return hr(e)&&e.tagName.toLowerCase()===`form`}function vr(e){return hr(e)&&e.tagName.toLowerCase()===`input`}function yr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function br(e,t){return e.button===0&&(!t||t===`_self`)&&!yr(e)}function xr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Sr(e,t){let n=xr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Cr=null;function wr(){if(Cr===null)try{new FormData(document.createElement(`form`),0),Cr=!1}catch{Cr=!0}return Cr}var Tr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Er(e){return e!=null&&!Tr.has(e)?(gt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${mr}"`),null):e}function Dr(e,t){let n,r,i,a,o;if(_r(e)){let o=e.getAttribute(`action`);r=o?Wt(o,t):null,n=e.getAttribute(`method`)||pr,i=Er(e.getAttribute(`enctype`))||mr,a=new FormData(e)}else if(gr(e)||vr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?Wt(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||pr,i=Er(e.getAttribute(`formenctype`))||Er(o.getAttribute(`enctype`))||mr,a=new FormData(o,e),!wr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(hr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=pr,r=null,i=mr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Or={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},kr=/[&><\u2028\u2029]/g;function Ar(e){return e.replace(kr,e=>Or[e])}function jr(e,t){if(e===!1||e==null)throw Error(t)}function Mr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&Wt(i.pathname,t)===`/`?i.pathname=`${en(t)}/_root.${r}`:i.pathname=`${en(i.pathname)}.${r}`,i}async function Nr(e,t){if(e.id in t)return t[e.id];try{let n=await dt(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Pr(e){return e!=null&&typeof e.page==`string`}function Fr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Ir(e,t,n){return Vr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Nr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Fr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Lr(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Rr(e,t,{includeHydrateFallback:n}={}){return zr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function zr(e){return[...new Set(e)]}function Br(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Vr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Pr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Br(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Hr(){let e=W.useContext(fn);return jr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Ur(){let e=W.useContext(pn);return jr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Wr=W.createContext(void 0);Wr.displayName=`FrameworkContext`;function Gr(){let e=W.useContext(Wr);return jr(e,`You must render this element inside a <HydratedRouter> element`),e}function Kr(e,t){let n=W.useContext(Wr),[r,i]=W.useState(!1),[a,o]=W.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=W.useRef(null);W.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),W.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:qr(s,p),onBlur:qr(c,m),onMouseEnter:qr(l,p),onMouseLeave:qr(u,m),onTouchStart:qr(d,p)}]:[a,f,{}]:[!1,f,{}]}function qr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Jr({page:e,...t}){let n=hn(),{router:r}=Hr(),i=W.useMemo(()=>wt(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?W.createElement(Xr,{page:e,matches:i,...t}):W.createElement(Zr,{page:e,matches:i,...t}):null}function Yr(e){let{manifest:t,routeModules:n}=Gr(),[r,i]=W.useState([]);return W.useEffect(()=>{let r=!1;return Ir(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Xr({page:e,matches:t,...n}){let r=An(),{future:i}=Gr(),{basename:a}=Hr(),o=W.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Mr(e,a,i.unstable_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return W.createElement(W.Fragment,null,o.map(e=>W.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Zr({page:e,matches:t,...n}){let r=An(),{future:i,manifest:a,routeModules:o}=Gr(),{basename:s}=Hr(),{loaderData:c,matches:l}=Ur(),u=W.useMemo(()=>Lr(e,t,l,a,r,`data`),[e,t,l,a,r]),d=W.useMemo(()=>Lr(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=W.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Mr(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=W.useMemo(()=>Rr(d,a),[d,a]),m=Yr(d);return W.createElement(W.Fragment,null,f.map(e=>W.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>W.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>W.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Qr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}W.Component;var $r=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{$r&&(window.__reactRouterVersion=`7.15.1`)}catch{}function ei({basename:e,children:t,useTransitions:n,window:r}){let i=W.useRef();i.current??=mt({window:r,v5Compat:!0});let a=i.current,[o,s]=W.useState({action:a.action,location:a.location}),c=W.useCallback(e=>{n===!1?s(e):W.startTransition(()=>s(e))},[n]);return W.useLayoutEffect(()=>a.listen(c),[a,c]),W.createElement(ur,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function ti({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=W.useState({action:n.action,location:n.location}),o=W.useCallback(e=>{r===!1?a(e):W.startTransition(()=>a(e))},[r]);return W.useLayoutEffect(()=>n.listen(o),[n,o]),W.createElement(ur,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}ti.displayName=`unstable_HistoryRouter`;var ni=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ri=W.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=W.useContext(yn),v=typeof l==`string`&&ni.test(l),y=ln(l,h);l=y.to;let b=On(l,{relative:r}),x=An(),S=null;if(o){let e=Zt(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:$t([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=Kr(n,p),E=ui(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=W.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:Qr(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?W.createElement(W.Fragment,null,k,W.createElement(Jr,{page:b})):k});ri.displayName=`Link`;var ii=W.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Rn(a,{relative:c.relative}),d=An(),f=W.useContext(pn),{navigator:p,basename:m}=W.useContext(yn),h=f!=null&&xi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=Wt(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return W.createElement(ri,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});ii.displayName=`NavLink`;var ai=W.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=pr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=W.useContext(yn),g=mi(),_=hi(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&ni.test(s);return W.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?W.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});ai.displayName=`Form`;function oi({getKey:e,storageKey:t,...n}){let r=W.useContext(Wr),{basename:i}=W.useContext(yn),a=An(),o=tr();yi({getKey:e,storageKey:t});let s=W.useMemo(()=>{if(!r||!e)return null;let t=vi(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return W.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Ar(JSON.stringify(t||gi))}, ${Ar(JSON.stringify(s))})`}})}oi.displayName=`ScrollRestoration`;function si(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ci(e){let t=W.useContext(fn);return ht(t,si(e)),t}function li(e){let t=W.useContext(pn);return ht(t,si(e)),t}function ui(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Nn(),d=An(),f=Rn(e,{relative:o});return W.useCallback(p=>{if(br(p,t)){p.preventDefault();let t=n===void 0?bt(d)===bt(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?W.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function di(e){gt(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=W.useRef(xr(e)),n=W.useRef(!1),r=An(),i=W.useMemo(()=>Sr(r.search,n.current?null:t.current),[r.search]),a=Nn();return[i,W.useCallback((e,t)=>{let r=xr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var fi=0,pi=()=>`__${String(++fi)}__`;function mi(){let{router:e}=ci(`useSubmit`),{basename:t}=W.useContext(yn),n=$n(),r=e.fetch,i=e.navigate;return W.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Dr(e,t);a.navigate===!1?await r(a.fetcherKey||pi(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function hi(e,{relative:t}={}){let{basename:n}=W.useContext(yn),r=W.useContext(xn);ht(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Rn(e||`.`,{relative:t})},o=An();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:$t([n,a.pathname])),bt(a)}var gi=`react-router-scroll-positions`,_i={};function vi(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:Wt(e.pathname,n)||e.pathname},t)),i??=e.key,i}function yi({getKey:e,storageKey:t}={}){let{router:n}=ci(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=li(`useScrollRestoration`),{basename:a}=W.useContext(yn),o=An(),s=tr(),c=er();W.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),bi(W.useCallback(()=>{if(c.state===`idle`){let t=vi(o,s,a,e);_i[t]=window.scrollY}try{sessionStorage.setItem(t||gi,JSON.stringify(_i))}catch(e){gt(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(W.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||gi);e&&(_i=JSON.parse(e))}catch{}},[t]),W.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(_i,()=>window.scrollY,e?(t,n)=>vi(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),W.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{gt(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function bi(e,t){let{capture:n}=t||{};W.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function xi(e,{relative:t}={}){let n=W.useContext(gn);ht(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ci(`useViewTransitionState`),i=Rn(e,{relative:t});if(!n.isTransitioning)return!1;let a=Wt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Wt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Vt(i.pathname,o)!=null||Vt(i.pathname,a)!=null}var Si=l(_(),1),Ci=6e4,wi=3e5,Ti=200,Ei={active:1,idle:2,deep_sleep:5,hidden:10},Di=[`mousemove`,`mousedown`,`keydown`,`scroll`,`touchstart`],Oi=(0,W.createContext)(void 0);function ki({children:e}){let[t,n]=(0,W.useState)(`active`),r=(0,W.useRef)(null),i=(0,W.useRef)(null),a=(0,W.useRef)(Date.now()),o=(0,W.useCallback)(()=>{r.current&&=(clearTimeout(r.current),null),i.current&&=(clearTimeout(i.current),null)},[]),s=(0,W.useCallback)(()=>{o(),r.current=setTimeout(()=>{n(`idle`),i.current=setTimeout(()=>{n(`deep_sleep`)},wi-Ci)},Ci)},[o]),c=(0,W.useCallback)(()=>{let e=Date.now();e-a.current<Ti||(a.current=e,n(`active`),s())},[s]),l=(0,W.useCallback)(()=>{document.hidden?(o(),n(`hidden`)):(n(`active`),a.current=Date.now(),s())},[o,s]);return(0,W.useEffect)(()=>{s();for(let e of Di)document.addEventListener(e,c,{passive:!0});return document.addEventListener(`visibilitychange`,l),()=>{o();for(let e of Di)document.removeEventListener(e,c);document.removeEventListener(`visibilitychange`,l)}},[c,l,s,o]),(0,G.jsx)(Oi.Provider,{value:{powerState:t},children:e})}function Ai(){let e=(0,W.useContext)(Oi);if(!e)throw Error(`usePowerState must be used within a PowerProvider`);return e.powerState}function ji(){return``}function Mi(e){return e.startsWith(`/`)?e:`/${e}`}var Ni=`myco.lastSelectedProject`,Pi=null;function Fi(e){Pi=e}function Ii(){return Pi}function Li(){let e=Ii();return e?{"x-myco-grove-id":e.grove.id,"x-myco-project-id":e.project.project_id}:{}}function Ri(e,t,n){if(!t||!n)return null;let r=e.find(e=>e.slug===t||e.id===t);if(!r)return null;let i=r.projects.find(e=>e.slug===n||e.project_id===n);return i?{grove:r,project:i}:null}function zi(e){let t=e.find(e=>e.is_default&&e.projects.length>0)??e.find(e=>e.projects.length>0);return t?{grove:t,project:t.projects[0]}:null}function Bi(e,t=``){let n=t&&t!==`/`?`/${t.replace(/^\/+/,``)}`:``;return`/g/${e.grove.slug}/p/${e.project.slug}${n}`}function Vi(e){let t=e.match(/^\/g\/[^/]+\/p\/[^/]+(?<suffix>\/.*)?$/)?.groups?.suffix??`/`;return/^\/sessions\/[^/]+/.test(t)?`/sessions`:t}function Hi(e){return e?`${e.grove.id}:${e.project.project_id}`:`none`}function Ui(){try{let e=window.localStorage.getItem(Ni);if(!e)return null;let t=JSON.parse(e);return typeof t.groveId!=`string`||typeof t.projectId!=`string`?null:{groveId:t.groveId,projectId:t.projectId}}catch{return null}}function Wi(e){try{window.localStorage.setItem(Ni,JSON.stringify({groveId:e.grove.id,projectId:e.project.project_id}))}catch{}}function Gi(e){let t=Ui();if(!t)return null;let n=e.find(e=>e.id===t.groveId),r=n?.projects.find(e=>e.project_id===t.projectId);return n&&r?{grove:n,project:r}:null}function Ki(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?`M`:(t.length===1?t[0].slice(0,2):`${t[0][0]}${t[1][0]}`).toUpperCase()}function qi(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return`hsl(${t%360} 58% 48%)`}var Ji=`/api`,Yi=[`/groves`,`/version`,`/logs`,`/logs/search`,`/logs/stream`],Xi=`0.27.19`,Zi=!1;function Qi(e){if(Zi)return;let t=e.headers.get(`X-Myco-Api-Version`);t&&t!==Xi&&(Zi=!0,console.warn(`[myco] UI version ${Xi} is talking to daemon ${t} — reload to pick up the new UI build.`))}async function $i(e,t){let n=t?.method?.toUpperCase(),r=n===`POST`||n===`PUT`,i=aa(e,t?.headers,r),a=await fetch(Mi(`${Ji}${e}`),{...t,headers:i});if(Qi(a),!a.ok){let e=await a.json().catch(()=>({}));throw ra(a.status,e),new ma(a.status,e)}return a.json()}var ea=`myco:auth-reload-ts`,ta=1e4,na=()=>{window.location.reload()};function ra(e,t){if(e===401&&(typeof t==`object`&&t&&`error`in t?t.error:null)===`unauthorized_context_switch`&&!(typeof window>`u`||window.sessionStorage===void 0)){try{let e=Number(window.sessionStorage.getItem(ea)??`0`);if(Number.isFinite(e)&&Date.now()-e<ta)return;window.sessionStorage.setItem(ea,String(Date.now()))}catch{return}na()}}function ia(){if(typeof window>`u`)return;let e=window.__MYCO_AUTH__;return typeof e==`string`&&e.length>0?e:void 0}function aa(e,t,n){let r=new Headers;if(!oa(e)){for(let[e,t]of Object.entries(Li()))r.set(e,t);let e=ia();e&&r.set(`x-myco-auth`,e)}return n&&r.set(`Content-Type`,`application/json`),t&&new Headers(t).forEach((e,t)=>r.set(t,e)),Array.from(r.keys()).length>0?r:void 0}function oa(e){return Yi.some(t=>e===t||e.startsWith(`${t}/`))}async function sa(e,t){return $i(e,{method:`POST`,body:t?JSON.stringify(t):void 0})}async function ca(e,t){return $i(e,{method:`PUT`,body:JSON.stringify(t)})}async function la(e){return $i(e,{method:`DELETE`})}function ua(e){return $i(`/config/merged`,{signal:e})}function da(e){return $i(`/config/local`,{signal:e})}function fa(e,t,n){let r={scope:e,patch:t};return n&&n.length>0&&(r.clear=n),ca(`/config/scoped`,r)}function pa(e){return ca(`/config/scoped`,{scope:`local`,patch:{},clear:e})}var ma=class extends Error{status;body;constructor(e,t){let n=typeof t==`object`&&t&&`error`in t?String(t.error):null;super(n?`${n} (API ${e})`:`API error ${e}`),this.status=e,this.body=t}};function ha(e){return Array.isArray(e)?e:e?e.replace(/\[(\d+)\]/g,`.$1`).split(`.`).filter(e=>e.length>0):[]}function ga(e,t){let n=ha(t),r=e;for(let e of n){if(r==null)return;if(Array.isArray(r)){let t=Number(e);if(!Number.isInteger(t))return;r=r[t];continue}if(typeof r!=`object`)return;r=r[e]}return r}function _a(e,t,n){let r=ha(t);if(r.length===0)return;let i=e;for(let e=0;e<r.length-1;e+=1){let t=r[e],n=i[t];(typeof n!=`object`||!n||Array.isArray(n))&&(i[t]={}),i=i[t]}i[r[r.length-1]]=n}var va=(0,W.createContext)(null);function ya({selection:e,children:t}){let n=We(),r=Hi(e),[i,a]=(0,W.useState)(null);return(0,W.useLayoutEffect)(()=>{Fi(e),Wi(e),n.removeQueries({predicate:e=>e.queryKey[0]!==`groves`}),a(r)},[r,n]),i===r?(0,G.jsx)(va.Provider,{value:e,children:t}):(0,G.jsx)(`div`,{className:`flex h-64 items-center justify-center text-sm text-on-surface-variant`,children:`Switching project...`})}function ba({children:e}){return(0,W.useLayoutEffect)(()=>{Fi(null)},[]),(0,G.jsx)(G.Fragment,{children:e})}function xa(){return(0,W.useContext)(va)}function Sa(e=``){let t=xa();return t?Bi(t,e):e||`/`}function Ca(){let e=xa();return(0,W.useCallback)((t=``)=>e?Bi(e,t):t||`/`,[e])}function wa(e,t){if(!e)return t;let[n,...r]=t;return[n,{projectSelection:Hi(e)},...r]}function Ta(e){return wa(xa(),e)}var Ea=[`grove-config`];function Da(e){return[...Ea,e??`none`]}function Oa(){let e=xa()?.grove.id??null;return ot({queryKey:Da(e),queryFn:({signal:e})=>$i(`/grove-config`,{signal:e}),enabled:e!==null})}function ka(){let e=We(),t=xa()?.grove.id??null;return st({mutationFn:e=>ca(`/grove-config`,{patch:e}),onSuccess:()=>{e.invalidateQueries({queryKey:Da(t)}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}var Aa=[`config`,`merged`],ja=[`config`,`local`],Ma=[`notifications`];function Na(){let e=We(),t=ka(),n=ot({queryKey:Aa,queryFn:({signal:e})=>ua(e)}),r=ot({queryKey:ja,queryFn:({signal:e})=>da(e)}),i=(0,W.useRef)(n.data);i.current=n.data;let a=(0,W.useRef)(r.data);a.current=r.data;let o=(0,W.useCallback)(()=>{e.invalidateQueries({queryKey:Ma})},[e]),s=(0,W.useCallback)(()=>{e.invalidateQueries({queryKey:ja}),e.invalidateQueries({queryKey:Aa}),o()},[o,e]),c=(0,W.useCallback)(()=>{e.invalidateQueries({queryKey:Aa}),o()},[o,e]),l=(0,W.useCallback)(e=>e===`local`?s():c(),[s,c]),u=(0,W.useCallback)(async(e,n,r)=>{let i={};_a(i,e,n),r===`grove`?(await t.mutateAsync(i),o()):(await fa(r,i),l(r))},[l,o,t]),d=(0,W.useCallback)(async(e,n,r)=>{let i={};for(let{path:t,value:n}of e)_a(i,t,n);n===`grove`?(await t.mutateAsync(i),o()):(await fa(n,i,r),l(n))},[l,o,t]),f=(0,W.useCallback)(async e=>{await pa([e]),s()},[s]),p=(0,W.useCallback)(async e=>{e.length!==0&&(await pa(e),s())},[s]),m=(0,W.useCallback)(async e=>{let t=ga(i.current??{},e),n={};_a(n,e,t),await fa(`project`,n),await pa([e]),s()},[s]),h=(0,W.useCallback)(e=>ga(a.current??{},e)!==void 0,[]);return{effective:n.data,local:r.data??{},isLoading:n.isLoading||r.isLoading,isLocalOverride:h,setField:u,setFields:d,resetField:f,resetFields:p,promoteField:m}}var Pa=`myco-appearance`,Fa={compact:.85,normal:1,comfy:1.15},Ia={default:{heading:`'Newsreader', Georgia, serif`,ui:`'Inter', system-ui, sans-serif`,data:`'JetBrains Mono', 'Fira Code', monospace`},"geist-mono":{heading:`'Geist Mono', 'SF Mono', 'Fira Code', monospace`,ui:`'Geist Mono', 'SF Mono', 'Fira Code', monospace`,data:`'Geist Mono', 'SF Mono', 'Fira Code', monospace`},system:{heading:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`,ui:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`,data:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`},"sf-mono":{heading:`'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace`,ui:`'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace`,data:`'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace`},"fira-code":{heading:`'Fira Code', 'Fira Mono', ui-monospace, monospace`,ui:`'Fira Code', 'Fira Mono', ui-monospace, monospace`,data:`'Fira Code', 'Fira Mono', ui-monospace, monospace`},"jetbrains-mono":{heading:`'JetBrains Mono', ui-monospace, monospace`,ui:`'JetBrains Mono', ui-monospace, monospace`,data:`'JetBrains Mono', ui-monospace, monospace`}},La=`(prefers-color-scheme: light)`;function Ra(e){let t=document.documentElement;t.setAttribute(`data-theme`,e.theme);let n=e.mode===`system`?window.matchMedia(La).matches?`light`:`dark`:e.mode;t.classList.toggle(`light`,n===`light`);let r=Ia[e.font];t.style.setProperty(`--font-heading`,r.heading),t.style.setProperty(`--font-ui`,r.ui),t.style.setProperty(`--font-data`,r.data);let i=Fa[e.density];t.style.setProperty(`--density`,String(i)),t.style.fontSize=`calc(14px * ${i})`;let a=document.querySelector(`link[rel="icon"]`);if(a){let t=`/favicon-${e.theme}.svg`;a.href.endsWith(t)||(a.href=t)}}function za(e){try{localStorage.setItem(Pa,JSON.stringify(e))}catch{}}function Ba(){let e=null;try{e=localStorage.getItem(Pa)}catch{return}if(e)try{Ra(JSON.parse(e))}catch{try{localStorage.removeItem(Pa)}catch{}}}var Va=(0,W.createContext)(null),Ha={theme:`sage`,mode:`dark`,font:`default`,density:`normal`},Ua=`(prefers-color-scheme: light)`;function Wa({children:e}){let{effective:t,local:n,setField:r,resetField:i,promoteField:a}=Na(),o=(0,W.useMemo)(()=>t?.appearance??Ha,[t?.appearance]),s=(0,W.useMemo)(()=>n.appearance??{},[n.appearance]);(0,W.useEffect)(()=>{t?.appearance&&(Ra(o),za(o))},[o,t?.appearance]),(0,W.useEffect)(()=>{if(o.mode!==`system`)return;let e=window.matchMedia(Ua),t=()=>Ra(o);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[o]);let c=(0,W.useCallback)((e,t,n)=>r(`appearance.${e}`,t,n),[r]),l=(0,W.useCallback)(e=>i(`appearance.${e}`),[i]),u=(0,W.useCallback)(()=>a(`appearance`),[a]),d=(0,W.useCallback)(()=>i(`appearance`),[i]),f=(0,W.useMemo)(()=>({effective:o,local:s,set:c,resetKey:l,saveAllAsProject:u,resetAll:d}),[o,s,c,l,u,d]);return(0,G.jsx)(Va.Provider,{value:f,children:e})}function Ga(){let e=(0,W.useContext)(Va);if(!e)throw Error(`useAppearance must be used inside AppearanceProvider`);return e}var Ka={enabled:`cortex.enabled`,instructions:{injectOnSessionStart:`cortex.instructions.inject_on_session_start`},digest:{tier:`cortex.digest.tier`,injectOnSessionStart:`cortex.digest.inject_on_session_start`},spores:{injectOnPromptSubmit:`cortex.spores.inject_on_prompt_submit`,maxPerPrompt:`cortex.spores.max_per_prompt`},canopy:{injectOnPreToolUse:`cortex.canopy.inject_on_pre_tool_use`,minFileBytes:`cortex.canopy.min_file_bytes`,refresh:{backgroundEnabled:`cortex.canopy.refresh.background_enabled`,backgroundPeriodMinutes:`cortex.canopy.refresh.background_period_minutes`},exclude:{defaultPatterns:`cortex.canopy.exclude.default_patterns`,patterns:`cortex.canopy.exclude.patterns`}}},qa={scheduledTasksEnabled:`agent.scheduled_tasks_enabled`,eventTasksEnabled:`agent.event_tasks_enabled`,summaryBatchInterval:`agent.summary_batch_interval`},Ja=`config-field-`,Ya={appearance:`config-section-appearance`,cortexInstructions:`config-section-cortex-instructions`,cortexBuilder:`config-section-cortex-builder`,cortexDigest:`config-section-cortex-digest`,settingsAgent:`config-section-settings-agent`,settingsEmbedding:`config-section-settings-embedding`,settingsNotifications:`config-section-settings-notifications`,settingsPlanCapture:`config-section-settings-plan-capture`,settingsProject:`config-section-settings-project`,agentOperations:`config-section-agent-operations`,operationsMaintenance:`config-section-operations-maintenance`,operationsBackup:`config-section-operations-backup`};Ya.appearance,Ya.settingsAgent,Ya.settingsEmbedding,Ya.cortexDigest,Ya.cortexInstructions,Ya.cortexInstructions,Ya.cortexInstructions,Ya.cortexInstructions,Ya.settingsNotifications,Ya.settingsPlanCapture,Ya.agentOperations,Ka.digest.tier,Ka.digest.injectOnSessionStart,Ka.instructions.injectOnSessionStart,Ka.spores.injectOnPromptSubmit,Ka.spores.maxPerPrompt,Ka.canopy.injectOnPreToolUse,Ka.canopy.minFileBytes,qa.scheduledTasksEnabled,qa.eventTasksEnabled,qa.summaryBatchInterval;function Xa(e){return`${Ja}${e.replace(/[^a-zA-Z0-9]+/g,`-`)}`}var Za=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Qa=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),$a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),eo=e=>{let t=$a(e);return t.charAt(0).toUpperCase()+t.slice(1)},to={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`},no=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ro=(0,W.createContext)({}),io=()=>(0,W.useContext)(ro),ao=(0,W.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=``}=io()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,W.createElement)(`svg`,{ref:c,...to,width:t??l??to.width,height:t??l??to.height,stroke:e??f,strokeWidth:m,className:Za(`lucide`,p,i),...!a&&!no(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,W.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),K=(e,t)=>{let n=(0,W.forwardRef)(({className:n,...r},i)=>(0,W.createElement)(ao,{ref:i,iconNode:t,className:Za(`lucide-${Qa(eo(e))}`,`lucide-${e}`,n),...r}));return n.displayName=eo(e),n},oo=K(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),so=K(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),co=K(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),lo=K(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),uo=K(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),fo=K(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),po=K(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),mo=K(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),ho=K(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),go=K(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),_o=K(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),vo=K(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),yo=K(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),bo=K(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),xo=K(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),So=K(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Co=K(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),wo=K(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),To=K(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),Eo=K(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Do=K(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Oo=K(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),ko=K(`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`}]]),Ao=K(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),jo=K(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Mo=K(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),No=K(`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`}]]),Po=K(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Fo=K(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Io=K(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Lo=K(`file-code`,[[`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 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Ro=K(`file-search`,[[`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`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]),zo=K(`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`}]]),Bo=K(`file-x`,[[`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:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),Vo=K(`file`,[[`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`}]]),Ho=K(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),Uo=K(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Wo=K(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Go=K(`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`}]]),Ko=K(`git-compare`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),qo=K(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),Jo=K(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Yo=K(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Xo=K(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Zo=K(`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`}]]),Qo=K(`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`}]]),$o=K(`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`}]]),es=K(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ts=K(`mail-check`,[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`m16 19 2 2 4-4`,key:`1b14m6`}]]),ns=K(`map`,[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),rs=K(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),is=K(`message-square`,[[`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`}]]),as=K(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),os=K(`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`}]]),ss=K(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),cs=K(`panels-top-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),ls=K(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),us=K(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),ds=K(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),fs=K(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),ps=K(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),ms=K(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),hs=K(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),gs=K(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),_s=K(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),vs=K(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),ys=K(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),bs=K(`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`}]]),xs=K(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ss=K(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Cs=K(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),ws=K(`sprout`,[[`path`,{d:`M14 9.536V7a4 4 0 0 1 4-4h1.5a.5.5 0 0 1 .5.5V5a4 4 0 0 1-4 4 4 4 0 0 0-4 4c0 2 1 3 1 5a5 5 0 0 1-1 3`,key:`139s4v`}],[`path`,{d:`M4 9a5 5 0 0 1 8 4 5 5 0 0 1-8-4`,key:`1dlkgp`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),Ts=K(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Es=K(`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`}]]),Ds=K(`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`}]]),Os=K(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ks=K(`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`}]]),As=K(`trees`,[[`path`,{d:`M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z`,key:`1l6gj6`}],[`path`,{d:`M7 16v6`,key:`1a82de`}],[`path`,{d:`M13 19v3`,key:`13sx9i`}],[`path`,{d:`M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5`,key:`1sj9kv`}]]),js=K(`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`}]]),Ms=K(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Ns=K(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Ps=K(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Fs=K(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Is=K(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ls=K(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Rs=6e4,zs=3e4;function Bs(e,t,n){if(t===`heartbeat`){let t=e*Ei[n];return n===`hidden`?Math.min(t,Rs):n===`deep_sleep`?Math.min(t,zs):t}return n===`deep_sleep`||n===`hidden`?!1:e*Ei[n]}function Vs(e){let t=Ai(),{pollCategory:n,refetchInterval:r,contextFree:i=!1,...a}=e,o=Ta(a.queryKey??[]),s=r===!1?!1:Bs(r,n,t);return ot({...a,queryKey:i?a.queryKey:o,refetchInterval:s})}var Hs={HEALTH:5e3,STATS:1e4,LOGS:3e3,PROGRESS:1e3,UPDATE:3e5,RUNS_ACTIVE:3e3,RUN_DETAIL:5e3,SESSIONS:8e3,SESSION_DETAIL:8e3,SPORES:3e4,CANOPY_ENTRIES:6e4,GIT_IDENTITY:5e3},Us=1e4,Ws=3e4,Gs=[`debug`,`info`,`warn`,`error`],Ks={debug:0,info:1,warn:2,error:3},qs=[`stable`,`beta`],Js=1e3;function Ys(e){switch(e){case`info`:return`default`;case`warn`:return`warning`;case`error`:return`destructive`;default:return`secondary`}}function Xs(e){switch(e){case`info`:return`bg-primary`;case`debug`:return`bg-outline`;case`warn`:return`bg-secondary`;case`error`:return`bg-tertiary`;default:return`bg-outline`}}function Zs(){return Vs({queryKey:[`daemon-stats`],queryFn:({signal:e})=>$i(`/stats`,{signal:e}),refetchInterval:Hs.STATS,pollCategory:`standard`})}var Qs=500,$s=3e4;function ec(){let[e,t]=(0,W.useState)(!1),n=(0,W.useRef)(null);return{restart:(0,W.useCallback)(async(e=!1)=>{t(!0);try{let r=await sa(`/restart`,{force:e});if(r.status===`busy`)return t(!1),r;let i=Date.now()+$s;n.current=new AbortController,await new Promise((e,t)=>{let r=async()=>{if(Date.now()>i){t(Error(`Restart timeout`));return}try{if((await fetch(Mi(`/health`),{signal:n.current.signal})).ok){e();return}setTimeout(r,Qs)}catch{setTimeout(r,Qs)}};setTimeout(r,Qs)}),window.location.reload()}catch(e){throw t(!1),e}},[]),isRestarting:e}}function tc(){return ot({queryKey:[`groves`],queryFn:({signal:e})=>$i(`/groves`,{signal:e}),staleTime:5e3})}function nc(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=nc(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function rc(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=nc(e))&&(r&&(r+=` `),r+=t);return r}var ic=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,ac=rc,oc=(e,t)=>n=>{if(t?.variants==null)return ac(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=ic(t)||ic(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 ac(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)},sc=(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},cc=(e,t)=>({classGroupId:e,validator:t}),lc=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),uc=`-`,dc=[],fc=`arbitrary..`,pc=e=>{let t=gc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return hc(e);let n=e.split(uc);return mc(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?sc(i,t):t:i||dc}return n[e]||dc}}},mc=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=mc(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(uc):e.slice(t).join(uc),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},hc=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?fc+r:void 0})(),gc=e=>{let{theme:t,classGroups:n}=e;return _c(n,t)},_c=(e,t)=>{let n=lc();for(let r in e){let i=e[r];vc(i,n,r,t)}return n},vc=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];yc(i,t,n,r)}},yc=(e,t,n,r)=>{if(typeof e==`string`){bc(e,t,n);return}if(typeof e==`function`){xc(e,t,n,r);return}Sc(e,t,n,r)},bc=(e,t,n)=>{let r=e===``?t:Cc(t,e);r.classGroupId=n},xc=(e,t,n,r)=>{if(wc(e)){vc(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(cc(n,e))},Sc=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];vc(o,Cc(t,a),n,r)}},Cc=(e,t)=>{let n=e,r=t.split(uc),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=lc(),n.nextPart.set(t,i)),n=i}return n},wc=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Tc=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)}}},Ec=`!`,Dc=`:`,Oc=[],kc=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Ac=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===Dc){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(Ec)?(c=s.slice(0,-1),l=!0):s.startsWith(Ec)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return kc(t,l,c,u)};if(t){let e=t+Dc,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):kc(Oc,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},jc=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}},Mc=e=>({cache:Tc(e.cacheSize),parseClassName:Ac(e),sortModifiers:jc(e),postfixLookupClassGroupIds:Nc(e),...pc(e)}),Nc=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},Pc=/\s+/,Fc=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Pc),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?_+Ec:_,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},Ic=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Lc(n))&&(i&&(i+=` `),i+=r);return i},Lc=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Lc(e[r]))&&(n&&(n+=` `),n+=t);return n},Rc=(e,...t)=>{let n,r,i,a,o=o=>(n=Mc(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=Fc(e,n);return i(e,a),a};return a=o,(...e)=>a(Ic(...e))},zc=[],Bc=e=>{let t=t=>t[e]||zc;return t.isThemeGetter=!0,t},Vc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Hc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Uc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Wc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Gc=/\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$/,Kc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,qc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Jc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Yc=e=>Uc.test(e),Xc=e=>!!e&&!Number.isNaN(Number(e)),Zc=e=>!!e&&Number.isInteger(Number(e)),Qc=e=>e.endsWith(`%`)&&Xc(e.slice(0,-1)),$c=e=>Wc.test(e),el=()=>!0,tl=e=>Gc.test(e)&&!Kc.test(e),nl=()=>!1,rl=e=>qc.test(e),il=e=>Jc.test(e),al=e=>!q(e)&&!hl(e),ol=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)),sl=e=>Cl(e,Dl,nl),q=e=>Vc.test(e),cl=e=>Cl(e,Ol,tl),ll=e=>Cl(e,kl,Xc),ul=e=>Cl(e,jl,el),dl=e=>Cl(e,Al,nl),fl=e=>Cl(e,Tl,nl),pl=e=>Cl(e,El,il),ml=e=>Cl(e,Ml,rl),hl=e=>Hc.test(e),gl=e=>wl(e,Ol),_l=e=>wl(e,Al),vl=e=>wl(e,Tl),yl=e=>wl(e,Dl),bl=e=>wl(e,El),xl=e=>wl(e,Ml,!0),Sl=e=>wl(e,jl,!0),Cl=(e,t,n)=>{let r=Vc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},wl=(e,t,n=!1)=>{let r=Hc.exec(e);return r?r[1]?t(r[1]):n:!1},Tl=e=>e===`position`||e===`percentage`,El=e=>e===`image`||e===`url`,Dl=e=>e===`length`||e===`size`||e===`bg-size`,Ol=e=>e===`length`,kl=e=>e===`number`,Al=e=>e===`family-name`,jl=e=>e===`number`||e===`weight`,Ml=e=>e===`shadow`,Nl=Rc(()=>{let e=Bc(`color`),t=Bc(`font`),n=Bc(`text`),r=Bc(`font-weight`),i=Bc(`tracking`),a=Bc(`leading`),o=Bc(`breakpoint`),s=Bc(`container`),c=Bc(`spacing`),l=Bc(`radius`),u=Bc(`shadow`),d=Bc(`inset-shadow`),f=Bc(`text-shadow`),p=Bc(`drop-shadow`),m=Bc(`blur`),h=Bc(`perspective`),g=Bc(`aspect`),_=Bc(`ease`),v=Bc(`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(),hl,q],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[hl,q,c],T=()=>[Yc,`full`,`auto`,...w()],E=()=>[Zc,`none`,`subgrid`,hl,q],D=()=>[`auto`,{span:[`full`,Zc,hl,q]},Zc,hl,q],O=()=>[Zc,`auto`,hl,q],k=()=>[`auto`,`min`,`max`,`fr`,hl,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=()=>[Yc,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Yc,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Yc,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,hl,q],L=()=>[...b(),vl,fl,{position:[hl,q]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ee=()=>[`auto`,`cover`,`contain`,yl,sl,{size:[hl,q]}],z=()=>[Qc,gl,cl],B=()=>[``,`none`,`full`,l,hl,q],V=()=>[``,Xc,gl,cl],H=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ne=()=>[Xc,Qc,vl,fl],U=()=>[``,`none`,m,hl,q],re=()=>[`none`,Xc,hl,q],ie=()=>[`none`,Xc,hl,q],ae=()=>[Xc,hl,q],oe=()=>[Yc,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[$c],breakpoint:[$c],color:[el],container:[$c],"drop-shadow":[$c],ease:[`in`,`out`,`in-out`],font:[al],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[$c],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[$c],shadow:[$c],spacing:[`px`,Xc],text:[$c],"text-shadow":[$c],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Yc,q,hl,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,hl,q]}],"container-named":[ol],columns:[{columns:[Xc,q,hl,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:[Zc,`auto`,hl,q]}],basis:[{basis:[Yc,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Xc,Yc,`auto`,`initial`,`none`,q]}],grow:[{grow:[``,Xc,hl,q]}],shrink:[{shrink:[``,Xc,hl,q]}],order:[{order:[Zc,`first`,`last`,`none`,hl,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,gl,cl]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Sl,ul]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Qc,q]}],"font-family":[{font:[_l,dl,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,hl,q]}],"line-clamp":[{"line-clamp":[Xc,`none`,hl,ll]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,hl,q]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,hl,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:[...H(),`wavy`]}],"text-decoration-thickness":[{decoration:[Xc,`from-font`,`auto`,hl,cl]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Xc,`auto`,hl,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:[Zc,hl,q]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,hl,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`,hl,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:R()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Zc,hl,q],radial:[``,hl,q],conic:[Zc,hl,q]},bl,pl]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:z()}],"gradient-via-pos":[{via:z()}],"gradient-to-pos":[{to:z()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-bs":[{"border-bs":V()}],"border-w-be":[{"border-be":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":V()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...H(),`hidden`,`none`]}],"divide-style":[{divide:[...H(),`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:[...H(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Xc,hl,q]}],"outline-w":[{outline:[``,Xc,gl,cl]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,xl,ml]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,xl,ml]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:V()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Xc,cl]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,xl,ml]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Xc,hl,q]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"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":[Xc]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"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":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"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":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"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":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"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":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"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":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"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":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[hl,q]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"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":[Xc]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"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:R()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,hl,q]}],filter:[{filter:[``,`none`,hl,q]}],blur:[{blur:U()}],brightness:[{brightness:[Xc,hl,q]}],contrast:[{contrast:[Xc,hl,q]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,xl,ml]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Xc,hl,q]}],"hue-rotate":[{"hue-rotate":[Xc,hl,q]}],invert:[{invert:[``,Xc,hl,q]}],saturate:[{saturate:[Xc,hl,q]}],sepia:[{sepia:[``,Xc,hl,q]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,hl,q]}],"backdrop-blur":[{"backdrop-blur":U()}],"backdrop-brightness":[{"backdrop-brightness":[Xc,hl,q]}],"backdrop-contrast":[{"backdrop-contrast":[Xc,hl,q]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Xc,hl,q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Xc,hl,q]}],"backdrop-invert":[{"backdrop-invert":[``,Xc,hl,q]}],"backdrop-opacity":[{"backdrop-opacity":[Xc,hl,q]}],"backdrop-saturate":[{"backdrop-saturate":[Xc,hl,q]}],"backdrop-sepia":[{"backdrop-sepia":[``,Xc,hl,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`,hl,q]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Xc,`initial`,hl,q]}],ease:[{ease:[`linear`,`initial`,_,hl,q]}],delay:[{delay:[Xc,hl,q]}],animate:[{animate:[`none`,v,hl,q]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,hl,q]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":[`scale-3d`],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[hl,q,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":[`translate-none`],zoom:[{zoom:[Zc,hl,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`,hl,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`,hl,q]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Xc,gl,cl,ll]}],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 J(...e){return Nl(rc(e))}var Pl=oc(`inline-flex items-center justify-center whitespace-nowrap rounded-md font-sans text-sm font-medium transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-surface disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-gradient-to-br from-primary to-primary-container text-on-primary shadow-xs hover:shadow-[0_0_0_1px_rgba(171,207,184,0.4)]`,destructive:`bg-gradient-to-br from-tertiary to-tertiary-container text-on-surface shadow-xs hover:shadow-[0_0_0_1px_rgba(255,180,161,0.4)]`,outline:`border border-[var(--ghost-border)] bg-transparent shadow-xs hover:bg-surface-container-high hover:text-on-surface`,secondary:`border border-outline-variant/20 bg-transparent hover:bg-surface-container-high text-on-surface`,ghost:`hover:bg-surface-container-high text-on-surface-variant hover:text-on-surface`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),Y=(0,W.forwardRef)(({className:e,variant:t,size:n,...r},i)=>(0,G.jsx)(`button`,{className:J(Pl({variant:t,size:n,className:e})),ref:i,...r}));Y.displayName=`Button`,typeof window<`u`&&window.document&&window.document.createElement;function Fl(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Il(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Ll(...e){return t=>{let n=!1,r=e.map(e=>{let r=Il(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():Il(e[t],null)}}}}function Rl(...e){return W.useCallback(Ll(...e),e)}function zl(e,t){let n=W.createContext(t),r=e=>{let{children:t,...r}=e,i=W.useMemo(()=>r,Object.values(r));return(0,G.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=W.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Bl(e,t=[]){let n=[];function r(t,r){let i=W.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=W.useMemo(()=>o,Object.values(o));return(0,G.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=W.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>W.createContext(e));return function(n){let r=n?.[e]||t;return W.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Vl(i,...t)]}function Vl(...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 W.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Hl=globalThis?.document?W.useLayoutEffect:()=>{},Ul=W.useId||(()=>void 0),Wl=0;function Gl(e){let[t,n]=W.useState(Ul());return Hl(()=>{e||n(e=>e??String(Wl++))},[e]),e||(t?`radix-${t}`:``)}var Kl=W.useInsertionEffect||Hl;function ql({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Jl({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=W.useRef(e!==void 0);W.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,W.useCallback(t=>{if(s){let n=Yl(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Jl({defaultProp:e,onChange:t}){let[n,r]=W.useState(e),i=W.useRef(n),a=W.useRef(t);return Kl(()=>{a.current=t},[t]),W.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Yl(e){return typeof e==`function`}var Xl=l(h(),1);function Zl(e){let t=Ql(e),n=W.forwardRef((e,n)=>{let{children:r,...i}=e,a=W.Children.toArray(r),o=a.find(eu);if(o){let e=o.props.children,r=a.map(t=>t===o?W.Children.count(e)>1?W.Children.only(null):W.isValidElement(e)?e.props.children:null:t);return(0,G.jsx)(t,{...i,ref:n,children:W.isValidElement(e)?W.cloneElement(e,void 0,r):null})}return(0,G.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Ql(e){let t=W.forwardRef((e,t)=>{let{children:n,...r}=e;if(W.isValidElement(n)){let e=nu(n),i=tu(r,n.props);return n.type!==W.Fragment&&(i.ref=t?Ll(t,e):e),W.cloneElement(n,i)}return W.Children.count(n)>1?W.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $l=Symbol(`radix.slottable`);function eu(e){return W.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===$l}function tu(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 nu(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 ru=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Zl(`Primitive.${t}`),r=W.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,G.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function iu(e,t){e&&Xl.flushSync(()=>e.dispatchEvent(t))}function au(e){let t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...e)=>t.current?.(...e),[])}function ou(e,t=globalThis?.document){let n=au(e);W.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var su=`DismissableLayer`,cu=`dismissableLayer.update`,lu=`dismissableLayer.pointerDownOutside`,uu=`dismissableLayer.focusOutside`,du,fu=W.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),pu=W.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=W.useContext(fu),[u,d]=W.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=W.useState({}),m=Rl(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=gu(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=_u(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return ou(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),W.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(du=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),vu(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=du)}},[u,f,n,l]),W.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),vu())},[u,l]),W.useEffect(()=>{let e=()=>p({});return document.addEventListener(cu,e),()=>document.removeEventListener(cu,e)},[]),(0,G.jsx)(ru.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:Fl(e.onFocusCapture,S.onFocusCapture),onBlurCapture:Fl(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:Fl(e.onPointerDownCapture,x.onPointerDownCapture)})});pu.displayName=su;var mu=`DismissableLayerBranch`,hu=W.forwardRef((e,t)=>{let n=W.useContext(fu),r=W.useRef(null),i=Rl(t,r);return W.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,G.jsx)(ru.div,{...e,ref:i})});hu.displayName=mu;function gu(e,t=globalThis?.document){let n=au(e),r=W.useRef(!1),i=W.useRef(()=>{});return W.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){yu(lu,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function _u(e,t=globalThis?.document){let n=au(e),r=W.useRef(!1);return W.useEffect(()=>{let e=e=>{e.target&&!r.current&&yu(uu,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 vu(){let e=new CustomEvent(cu);document.dispatchEvent(e)}function yu(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?iu(i,a):i.dispatchEvent(a)}var bu=`focusScope.autoFocusOnMount`,xu=`focusScope.autoFocusOnUnmount`,Su={bubbles:!1,cancelable:!0},Cu=`FocusScope`,wu=W.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=W.useState(null),l=au(i),u=au(a),d=W.useRef(null),f=Rl(t,e=>c(e)),p=W.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;W.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:ju(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||ju(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&ju(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]),W.useEffect(()=>{if(s){Mu.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(bu,Su);s.addEventListener(bu,l),s.dispatchEvent(t),t.defaultPrevented||(Tu(Fu(Du(s)),{select:!0}),document.activeElement===e&&ju(s))}return()=>{s.removeEventListener(bu,l),setTimeout(()=>{let t=new CustomEvent(xu,Su);s.addEventListener(xu,u),s.dispatchEvent(t),t.defaultPrevented||ju(e??document.body,{select:!0}),s.removeEventListener(xu,u),Mu.remove(p)},0)}}},[s,l,u,p]);let m=W.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]=Eu(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&ju(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&ju(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,G.jsx)(ru.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});wu.displayName=Cu;function Tu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(ju(r,{select:t}),document.activeElement!==n)return}function Eu(e){let t=Du(e);return[Ou(t,e),Ou(t.reverse(),e)]}function Du(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 Ou(e,t){for(let n of e)if(!ku(n,{upTo:t}))return n}function ku(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 Au(e){return e instanceof HTMLInputElement&&`select`in e}function ju(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Au(e)&&t&&e.select()}}var Mu=Nu();function Nu(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Pu(e,t),e.unshift(t)},remove(t){e=Pu(e,t),e[0]?.resume()}}}function Pu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Fu(e){return e.filter(e=>e.tagName!==`A`)}var Iu=`Portal`,Lu=W.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=W.useState(!1);Hl(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Xl.createPortal((0,G.jsx)(ru.div,{...r,ref:t}),o):null});Lu.displayName=Iu;function Ru(e,t){return W.useReducer((e,n)=>t[e][n]??e,e)}var zu=e=>{let{present:t,children:n}=e,r=Bu(t),i=typeof n==`function`?n({present:r.isPresent}):W.Children.only(n),a=Rl(r.ref,Hu(i));return typeof n==`function`||r.isPresent?W.cloneElement(i,{ref:a}):null};zu.displayName=`Presence`;function Bu(e){let[t,n]=W.useState(),r=W.useRef(null),i=W.useRef(e),a=W.useRef(`none`),[o,s]=Ru(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return W.useEffect(()=>{let e=Vu(r.current);a.current=o===`mounted`?e:`none`},[o]),Hl(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Vu(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Hl(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Vu(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Vu(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:W.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Vu(e){return e?.animationName||`none`}function Hu(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 Uu=0;function Wu(){W.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??Gu()),document.body.insertAdjacentElement(`beforeend`,e[1]??Gu()),Uu++,()=>{Uu===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Uu--}},[])}function Gu(){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 Ku=function(){return Ku=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},Ku.apply(this,arguments)};function qu(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 Ju(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 Yu=`right-scroll-bar-position`,Xu=`width-before-scroll-bar`,Zu=`with-scroll-bars-hidden`,Qu=`--removed-body-scroll-bar-size`;function $u(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function ed(e,t){var n=(0,W.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 td=typeof window<`u`?W.useLayoutEffect:W.useEffect,nd=new WeakMap;function rd(e,t){var n=ed(t||null,function(t){return e.forEach(function(e){return $u(e,t)})});return td(function(){var t=nd.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||$u(e,null)}),i.forEach(function(e){r.has(e)||$u(e,a)})}nd.set(n,e)},[e]),n}function id(e){return e}function ad(e,t){t===void 0&&(t=id);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 od(e){e===void 0&&(e={});var t=ad(null);return t.options=Ku({async:!0,ssr:!1},e),t}var sd=function(e){var t=e.sideCar,n=qu(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 W.createElement(r,Ku({},n))};sd.isSideCarExport=!0;function cd(e,t){return e.useMedium(t),sd}var ld=od(),ud=function(){},dd=W.forwardRef(function(e,t){var n=W.useRef(null),r=W.useState({onScrollCapture:ud,onWheelCapture:ud,onTouchMoveCapture:ud}),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=qu(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=rd([n,t]),C=Ku(Ku({},b),i);return W.createElement(W.Fragment,null,u&&W.createElement(x,{sideCar:ld,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?W.cloneElement(W.Children.only(s),Ku(Ku({},C),{ref:S})):W.createElement(v,Ku({},C,{className:c,ref:S}),s))});dd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},dd.classNames={fullWidth:Xu,zeroRight:Yu};var fd,pd=function(){if(fd)return fd;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function md(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=pd();return t&&e.setAttribute(`nonce`,t),e}function hd(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function gd(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var _d=function(){var e=0,t=null;return{add:function(n){e==0&&(t=md())&&(hd(t,n),gd(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},vd=function(){var e=_d();return function(t,n){W.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},yd=function(){var e=vd();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},bd={left:0,top:0,right:0,gap:0},xd=function(e){return parseInt(e||``,10)||0},Sd=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[xd(n),xd(r),xd(i)]},Cd=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return bd;var t=Sd(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])}},wd=yd(),Td=`data-scroll-locked`,Ed=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
12
|
-
.${Zu} {
|
|
13
|
-
overflow: hidden ${r};
|
|
14
|
-
padding-right: ${s}px ${r};
|
|
15
|
-
}
|
|
16
|
-
body[${Td}] {
|
|
17
|
-
overflow: hidden ${r};
|
|
18
|
-
overscroll-behavior: contain;
|
|
19
|
-
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
20
|
-
padding-left: ${i}px;
|
|
21
|
-
padding-top: ${a}px;
|
|
22
|
-
padding-right: ${o}px;
|
|
23
|
-
margin-left:0;
|
|
24
|
-
margin-top:0;
|
|
25
|
-
margin-right: ${s}px ${r};
|
|
26
|
-
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.${Yu} {
|
|
30
|
-
right: ${s}px ${r};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.${Xu} {
|
|
34
|
-
margin-right: ${s}px ${r};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.${Yu} .${Yu} {
|
|
38
|
-
right: 0 ${r};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.${Xu} .${Xu} {
|
|
42
|
-
margin-right: 0 ${r};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
body[${Td}] {
|
|
46
|
-
${Qu}: ${s}px;
|
|
47
|
-
}
|
|
48
|
-
`},Dd=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Od=function(){W.useEffect(function(){return document.body.setAttribute(Td,(Dd()+1).toString()),function(){var e=Dd()-1;e<=0?document.body.removeAttribute(Td):document.body.setAttribute(Td,e.toString())}},[])},kd=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Od();var a=W.useMemo(function(){return Cd(i)},[i]);return W.createElement(wd,{styles:Ed(a,!t,i,n?``:`!important`)})},Ad=!1;if(typeof window<`u`)try{var jd=Object.defineProperty({},`passive`,{get:function(){return Ad=!0,!0}});window.addEventListener(`test`,jd,jd),window.removeEventListener(`test`,jd,jd)}catch{Ad=!1}var Md=Ad?{passive:!1}:!1,Nd=function(e){return e.tagName===`TEXTAREA`},Pd=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Nd(e)&&n[t]===`visible`)},Fd=function(e){return Pd(e,`overflowY`)},Id=function(e){return Pd(e,`overflowX`)},Ld=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Bd(e,r)){var i=Vd(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Rd=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},zd=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Bd=function(e,t){return e===`v`?Fd(t):Id(t)},Vd=function(e,t){return e===`v`?Rd(t):zd(t)},Hd=function(e,t){return e===`h`&&t===`rtl`?-1:1},Ud=function(e,t,n,r,i){var a=Hd(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=Vd(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Bd(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},Wd=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Gd=function(e){return[e.deltaX,e.deltaY]},Kd=function(e){return e&&`current`in e?e.current:e},qd=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Jd=function(e){return`
|
|
49
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
50
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
51
|
-
`},Yd=0,Xd=[];function Zd(e){var t=W.useRef([]),n=W.useRef([0,0]),r=W.useRef(),i=W.useState(Yd++)[0],a=W.useState(yd)[0],o=W.useRef(e);W.useEffect(function(){o.current=e},[e]),W.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ju([e.lockRef.current],(e.shards||[]).map(Kd),!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=W.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Wd(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=Ld(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Ld(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 Ud(h,t,e,h===`h`?s:c,!0)},[]),c=W.useCallback(function(e){var n=e;if(!(!Xd.length||Xd[Xd.length-1]!==a)){var r=`deltaY`in n?Gd(n):Wd(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&qd(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Kd).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=W.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Qd(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=W.useCallback(function(e){n.current=Wd(e),r.current=void 0},[]),d=W.useCallback(function(t){l(t.type,Gd(t),t.target,s(t,e.lockRef.current))},[]),f=W.useCallback(function(t){l(t.type,Wd(t),t.target,s(t,e.lockRef.current))},[]);W.useEffect(function(){return Xd.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Md),document.addEventListener(`touchmove`,c,Md),document.addEventListener(`touchstart`,u,Md),function(){Xd=Xd.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Md),document.removeEventListener(`touchmove`,c,Md),document.removeEventListener(`touchstart`,u,Md)}},[]);var p=e.removeScrollBar,m=e.inert;return W.createElement(W.Fragment,null,m?W.createElement(a,{styles:Jd(i)}):null,p?W.createElement(kd,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Qd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var $d=cd(ld,Zd),ef=W.forwardRef(function(e,t){return W.createElement(dd,Ku({},e,{ref:t,sideCar:$d}))});ef.classNames=dd.classNames;var tf=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},nf=new WeakMap,rf=new WeakMap,af={},of=0,sf=function(e){return e&&(e.host||sf(e.parentNode))},cf=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=sf(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})},lf=function(e,t,n,r){var i=cf(t,Array.isArray(e)?e:[e]);af[n]||(af[n]=new WeakMap);var a=af[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=(nf.get(e)||0)+1,l=(a.get(e)||0)+1;nf.set(e,c),a.set(e,l),o.push(e),c===1&&i&&rf.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(),of++,function(){o.forEach(function(e){var t=nf.get(e)-1,i=a.get(e)-1;nf.set(e,t),a.set(e,i),t||(rf.has(e)||e.removeAttribute(r),rf.delete(e)),i||e.removeAttribute(n)}),of--,of||(nf=new WeakMap,nf=new WeakMap,rf=new WeakMap,af={})}},uf=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||tf(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),lf(r,i,n,`aria-hidden`)):function(){return null}},df=`Dialog`,[ff,pf]=Bl(df),[mf,hf]=ff(df),gf=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=W.useRef(null),c=W.useRef(null),[l,u]=ql({prop:r,defaultProp:i??!1,onChange:a,caller:df});return(0,G.jsx)(mf,{scope:t,triggerRef:s,contentRef:c,contentId:Gl(),titleId:Gl(),descriptionId:Gl(),open:l,onOpenChange:u,onOpenToggle:W.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};gf.displayName=df;var _f=`DialogTrigger`,vf=W.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=hf(_f,n),a=Rl(t,i.triggerRef);return(0,G.jsx)(ru.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Rf(i.open),...r,ref:a,onClick:Fl(e.onClick,i.onOpenToggle)})});vf.displayName=_f;var yf=`DialogPortal`,[bf,xf]=ff(yf,{forceMount:void 0}),Sf=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=hf(yf,t);return(0,G.jsx)(bf,{scope:t,forceMount:n,children:W.Children.map(r,e=>(0,G.jsx)(zu,{present:n||a.open,children:(0,G.jsx)(Lu,{asChild:!0,container:i,children:e})}))})};Sf.displayName=yf;var Cf=`DialogOverlay`,wf=W.forwardRef((e,t)=>{let n=xf(Cf,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=hf(Cf,e.__scopeDialog);return a.modal?(0,G.jsx)(zu,{present:r||a.open,children:(0,G.jsx)(Ef,{...i,ref:t})}):null});wf.displayName=Cf;var Tf=Zl(`DialogOverlay.RemoveScroll`),Ef=W.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=hf(Cf,n);return(0,G.jsx)(ef,{as:Tf,allowPinchZoom:!0,shards:[i.contentRef],children:(0,G.jsx)(ru.div,{"data-state":Rf(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Df=`DialogContent`,Of=W.forwardRef((e,t)=>{let n=xf(Df,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=hf(Df,e.__scopeDialog);return(0,G.jsx)(zu,{present:r||a.open,children:a.modal?(0,G.jsx)(kf,{...i,ref:t}):(0,G.jsx)(Af,{...i,ref:t})})});Of.displayName=Df;var kf=W.forwardRef((e,t)=>{let n=hf(Df,e.__scopeDialog),r=W.useRef(null),i=Rl(t,n.contentRef,r);return W.useEffect(()=>{let e=r.current;if(e)return uf(e)},[]),(0,G.jsx)(jf,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Fl(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Fl(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Fl(e.onFocusOutside,e=>e.preventDefault())})}),Af=W.forwardRef((e,t)=>{let n=hf(Df,e.__scopeDialog),r=W.useRef(!1),i=W.useRef(!1);return(0,G.jsx)(jf,{...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()}})}),jf=W.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=hf(Df,n),c=W.useRef(null),l=Rl(t,c);return Wu(),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(wu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,G.jsx)(pu,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Rf(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Hf,{titleId:s.titleId}),(0,G.jsx)(Wf,{contentRef:c,descriptionId:s.descriptionId})]})]})}),Mf=`DialogTitle`,Nf=W.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=hf(Mf,n);return(0,G.jsx)(ru.h2,{id:i.titleId,...r,ref:t})});Nf.displayName=Mf;var Pf=`DialogDescription`,Ff=W.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=hf(Pf,n);return(0,G.jsx)(ru.p,{id:i.descriptionId,...r,ref:t})});Ff.displayName=Pf;var If=`DialogClose`,Lf=W.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=hf(If,n);return(0,G.jsx)(ru.button,{type:`button`,...r,ref:t,onClick:Fl(e.onClick,()=>i.onOpenChange(!1))})});Lf.displayName=If;function Rf(e){return e?`open`:`closed`}var zf=`DialogTitleWarning`,[Bf,Vf]=zl(zf,{contentName:Df,titleName:Mf,docsSlug:`dialog`}),Hf=({titleId:e})=>{let t=Vf(zf),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
52
|
-
|
|
53
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
54
|
-
|
|
55
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return W.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Uf=`DialogDescriptionWarning`,Wf=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Vf(Uf).contentName}}.`;return W.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Gf=gf,Kf=vf,qf=Sf,Jf=wf,Yf=Of,Xf=Nf,Zf=Ff,Qf=Lf,$f=Gf,ep=Kf,tp=qf,np=(0,W.forwardRef)(({className:e,...t},n)=>(0,G.jsx)(Jf,{ref:n,className:J(`fixed inset-0 z-50 bg-black/60 backdrop-blur-xs`,e),...t}));np.displayName=Jf.displayName;var rp=(0,W.forwardRef)(({className:e,children:t,...n},r)=>(0,G.jsxs)(tp,{children:[(0,G.jsx)(np,{}),(0,G.jsxs)(Yf,{ref:r,className:J(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 [&>*]:min-w-0 border-0 bg-surface-container-highest p-6 shadow-ambient duration-200 sm:rounded-lg`,e),...n,children:[t,(0,G.jsxs)(Qf,{className:`absolute right-4 top-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,G.jsx)(Is,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));rp.displayName=Yf.displayName;function ip({className:e,...t}){return(0,G.jsx)(`div`,{className:J(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t})}ip.displayName=`DialogHeader`;function ap({className:e,...t}){return(0,G.jsx)(`div`,{className:J(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t})}ap.displayName=`DialogFooter`;var op=(0,W.forwardRef)(({className:e,...t},n)=>(0,G.jsx)(Xf,{ref:n,className:J(`text-lg font-serif font-semibold leading-none tracking-tight`,e),...t}));op.displayName=Xf.displayName;var sp=(0,W.forwardRef)(({className:e,...t},n)=>(0,G.jsx)(Zf,{ref:n,className:J(`text-sm text-on-surface-variant`,e),...t}));sp.displayName=Zf.displayName;var cp=(0,W.forwardRef)(({className:e,type:t,...n},r)=>(0,G.jsx)(`input`,{type:t,className:J(`flex h-9 w-full rounded-md bg-surface-container-lowest border border-[var(--ghost-border)] px-3 py-1 font-sans text-sm text-on-surface shadow-none transition-colors`,`file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-on-surface`,`placeholder:text-on-surface-variant/50`,`focus-visible:outline-hidden focus-visible:border-primary/40`,`disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));cp.displayName=`Input`;function lp(e,[t,n]){return Math.min(n,Math.max(t,e))}function up(e){let t=e+`CollectionProvider`,[n,r]=Bl(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=W.useRef(null),a=W.useRef(new Map).current;return(0,G.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=Zl(s),l=W.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,G.jsx)(c,{ref:Rl(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=Zl(u),p=W.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=W.useRef(null),s=Rl(t,o),c=a(u,n);return W.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,G.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return W.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]}var dp=W.createContext(void 0);function fp(e){let t=W.useContext(dp);return e||t||`ltr`}var pp=[`top`,`right`,`bottom`,`left`],mp=Math.min,hp=Math.max,gp=Math.round,_p=Math.floor,vp=e=>({x:e,y:e}),yp={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function bp(e,t,n){return hp(e,mp(t,n))}function xp(e,t){return typeof e==`function`?e(t):e}function Sp(e){return e.split(`-`)[0]}function Cp(e){return e.split(`-`)[1]}function wp(e){return e===`x`?`y`:`x`}function Tp(e){return e===`y`?`height`:`width`}function Ep(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Dp(e){return wp(Ep(e))}function Op(e,t,n){n===void 0&&(n=!1);let r=Cp(e),i=Dp(e),a=Tp(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Lp(o)),[o,Lp(o)]}function kp(e){let t=Lp(e);return[Ap(e),t,Ap(t)]}function Ap(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var jp=[`left`,`right`],Mp=[`right`,`left`],Np=[`top`,`bottom`],Pp=[`bottom`,`top`];function Fp(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Mp:jp:t?jp:Mp;case`left`:case`right`:return t?Np:Pp;default:return[]}}function Ip(e,t,n,r){let i=Cp(e),a=Fp(Sp(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ap)))),a}function Lp(e){let t=Sp(e);return yp[t]+e.slice(t.length)}function Rp(e){return{top:0,right:0,bottom:0,left:0,...e}}function zp(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Rp(e)}function Bp(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 Vp(e,t,n){let{reference:r,floating:i}=e,a=Ep(t),o=Dp(t),s=Tp(o),c=Sp(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}}switch(Cp(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Hp(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}=xp(t,e),p=zp(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Bp(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=Bp(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 Up=50,Wp=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Hp},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Vp(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<Up&&(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}=Vp(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Gp=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}=xp(e,t)||{};if(l==null)return{};let d=zp(u),f={x:n,y:r},p=Dp(i),m=Tp(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=mp(d[_],T),D=mp(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=bp(O,A,k),M=!c.arrow&&Cp(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Kp=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}=xp(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Sp(r),_=Ep(o),v=Sp(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Lp(o)]:kp(o)),x=p!==`none`;!d&&x&&b.push(...Ip(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=Op(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`&&_!==Ep(t))||T.every(e=>Ep(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=Ep(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 qp(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Jp(e){return pp.some(t=>e[t]>=0)}var Yp=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=xp(e,t);switch(i){case`referenceHidden`:{let e=qp(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Jp(e)}}}case`escaped`:{let e=qp(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Jp(e)}}}default:return{}}}}},Xp=new Set([`left`,`top`]);async function Zp(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Sp(n),s=Cp(n),c=Ep(n)===`y`,l=Xp.has(o)?-1:1,u=a&&c?-1:1,d=xp(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 Qp=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 Zp(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}}}}},$p=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}=xp(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ep(Sp(i)),p=wp(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=bp(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=bp(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},em=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}=xp(e,t),u={x:n,y:r},d=Ep(i),f=wp(d),p=u[f],m=u[d],h=xp(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};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=Xp.has(Sp(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}}}},tm=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=xp(e,t),u=await o.detectOverflow(t,l),d=Sp(i),f=Cp(i),p=Ep(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=mp(h-u[g],v),x=mp(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=hp(u.left,0),t=hp(u.right,0),n=hp(u.top,0),r=hp(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:hp(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:hp(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function nm(){return typeof window<`u`}function rm(e){return om(e)?(e.nodeName||``).toLowerCase():`#document`}function im(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function am(e){return((om(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function om(e){return nm()?e instanceof Node||e instanceof im(e).Node:!1}function sm(e){return nm()?e instanceof Element||e instanceof im(e).Element:!1}function cm(e){return nm()?e instanceof HTMLElement||e instanceof im(e).HTMLElement:!1}function lm(e){return!nm()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof im(e).ShadowRoot}function um(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=xm(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function dm(e){return/^(table|td|th)$/.test(rm(e))}function fm(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var pm=/transform|translate|scale|rotate|perspective|filter/,mm=/paint|layout|strict|content/,hm=e=>!!e&&e!==`none`,gm;function _m(e){let t=sm(e)?xm(e):e;return hm(t.transform)||hm(t.translate)||hm(t.scale)||hm(t.rotate)||hm(t.perspective)||!ym()&&(hm(t.backdropFilter)||hm(t.filter))||pm.test(t.willChange||``)||mm.test(t.contain||``)}function vm(e){let t=Cm(e);for(;cm(t)&&!bm(t);){if(_m(t))return t;if(fm(t))return null;t=Cm(t)}return null}function ym(){return gm??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),gm}function bm(e){return/^(html|body|#document)$/.test(rm(e))}function xm(e){return im(e).getComputedStyle(e)}function Sm(e){return sm(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cm(e){if(rm(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||lm(e)&&e.host||am(e);return lm(t)?t.host:t}function wm(e){let t=Cm(e);return bm(t)?e.ownerDocument?e.ownerDocument.body:e.body:cm(t)&&um(t)?t:wm(t)}function Tm(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=wm(e),i=r===e.ownerDocument?.body,a=im(r);if(i){let e=Em(a);return t.concat(a,a.visualViewport||[],um(r)?r:[],e&&n?Tm(e):[])}else return t.concat(r,Tm(r,[],n))}function Em(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Dm(e){let t=xm(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=cm(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=gp(n)!==a||gp(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Om(e){return sm(e)?e:e.contextElement}function km(e){let t=Om(e);if(!cm(t))return vp(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Dm(t),o=(a?gp(n.width):n.width)/r,s=(a?gp(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Am=vp(0);function jm(e){let t=im(e);return!ym()||!t.visualViewport?Am:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mm(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==im(e)?!1:t}function Nm(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Om(e),o=vp(1);t&&(r?sm(r)&&(o=km(r)):o=km(e));let s=Mm(a,n,r)?jm(a):vp(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){let e=im(a),t=r&&sm(r)?im(r):r,n=e,i=Em(n);for(;i&&r&&t!==n;){let e=km(i),t=i.getBoundingClientRect(),r=xm(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=im(i),i=Em(n)}}return Bp({width:u,height:d,x:c,y:l})}function Pm(e,t){let n=Sm(e).scrollLeft;return t?t.left+n:Nm(am(e)).left+n}function Fm(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Pm(e,n),y:n.top+t.scrollTop}}function Im(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=am(r),s=t?fm(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=vp(1),u=vp(0),d=cm(r);if((d||!d&&!a)&&((rm(r)!==`body`||um(o))&&(c=Sm(r)),d)){let e=Nm(r);l=km(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Fm(o,c):vp(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 Lm(e){return Array.from(e.getClientRects())}function Rm(e){let t=am(e),n=Sm(e),r=e.ownerDocument.body,i=hp(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=hp(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Pm(e),s=-n.scrollTop;return xm(r).direction===`rtl`&&(o+=hp(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var zm=25;function Bm(e,t){let n=im(e),r=am(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=ym();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Pm(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=zm&&(a-=o)}else l<=zm&&(a+=l);return{width:a,height:o,x:s,y:c}}function Vm(e,t){let n=Nm(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=cm(e)?km(e):vp(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Hm(e,t,n){let r;if(t===`viewport`)r=Bm(e,n);else if(t===`document`)r=Rm(am(e));else if(sm(t))r=Vm(t,n);else{let n=jm(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Bp(r)}function Um(e,t){let n=Cm(e);return n===t||!sm(n)||bm(n)?!1:xm(n).position===`fixed`||Um(n,t)}function Wm(e,t){let n=t.get(e);if(n)return n;let r=Tm(e,[],!1).filter(e=>sm(e)&&rm(e)!==`body`),i=null,a=xm(e).position===`fixed`,o=a?Cm(e):e;for(;sm(o)&&!bm(o);){let t=xm(o),n=_m(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||um(o)&&!n&&Um(e,o))?r=r.filter(e=>e!==o):i=t,o=Cm(o)}return t.set(e,r),r}function Gm(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?fm(t)?[]:Wm(t,this._c):[].concat(n),r],o=Hm(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=Hm(t,a[e],i);s=hp(n.top,s),c=mp(n.right,c),l=mp(n.bottom,l),u=hp(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Km(e){let{width:t,height:n}=Dm(e);return{width:t,height:n}}function qm(e,t,n){let r=cm(t),i=am(t),a=n===`fixed`,o=Nm(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=vp(0);function l(){c.x=Pm(i)}if(r||!r&&!a)if((rm(t)!==`body`||um(i))&&(s=Sm(t)),r){let e=Nm(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Fm(i,s):vp(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Jm(e){return xm(e).position===`static`}function Ym(e,t){if(!cm(e)||xm(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return am(e)===n&&(n=n.ownerDocument.body),n}function Xm(e,t){let n=im(e);if(fm(e))return n;if(!cm(e)){let t=Cm(e);for(;t&&!bm(t);){if(sm(t)&&!Jm(t))return t;t=Cm(t)}return n}let r=Ym(e,t);for(;r&&dm(r)&&Jm(r);)r=Ym(r,t);return r&&bm(r)&&Jm(r)&&!_m(r)?n:r||vm(e)||n}var Zm=async function(e){let t=this.getOffsetParent||Xm,n=this.getDimensions,r=await n(e.floating);return{reference:qm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qm(e){return xm(e).direction===`rtl`}var $m={convertOffsetParentRelativeRectToViewportRelativeRect:Im,getDocumentElement:am,getClippingRect:Gm,getOffsetParent:Xm,getElementRects:Zm,getClientRects:Lm,getDimensions:Km,getScale:km,isElement:sm,isRTL:Qm};function eh(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function th(e,t){let n=null,r,i=am(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=_p(d),h=_p(i.clientWidth-(u+f)),g=_p(i.clientHeight-(d+p)),_=_p(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:hp(0,mp(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!eh(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function nh(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=Om(e),u=i||a?[...l?Tm(l):[],...t?Tm(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?th(l,n):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?Nm(e):null;c&&g();function g(){let t=Nm(e);h&&!eh(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 rh=Qp,ih=$p,ah=Kp,oh=tm,sh=Yp,ch=Gp,lh=em,uh=(e,t,n)=>{let r=new Map,i={platform:$m,...n},a={...i.platform,_c:r};return Wp(e,t,{...i,platform:a})},dh=typeof document<`u`?W.useLayoutEffect:function(){};function fh(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(!fh(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)&&!fh(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ph(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function mh(e,t){let n=ph(e);return Math.round(t*n)/n}function hh(e){let t=W.useRef(e);return dh(()=>{t.current=e}),t}function gh(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]=W.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=W.useState(r);fh(f,r)||p(r);let[m,h]=W.useState(null),[g,_]=W.useState(null),v=W.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=W.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=W.useRef(null),C=W.useRef(null),w=W.useRef(u),T=c!=null,E=hh(c),D=hh(i),O=hh(l),k=W.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),uh(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!fh(w.current,t)&&(w.current=t,Xl.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);dh(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=W.useRef(!1);dh(()=>(A.current=!0,()=>{A.current=!1}),[]),dh(()=>{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=W.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=W.useMemo(()=>({reference:b,floating:x}),[b,x]),N=W.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=mh(M.floating,u.x),r=mh(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ph(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return W.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var _h=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?{}:ch({element:r.current,padding:i}).fn(n):r?ch({element:r,padding:i}).fn(n):{}}}},vh=(e,t)=>{let n=rh(e);return{name:n.name,fn:n.fn,options:[e,t]}},yh=(e,t)=>{let n=ih(e);return{name:n.name,fn:n.fn,options:[e,t]}},bh=(e,t)=>({fn:lh(e).fn,options:[e,t]}),xh=(e,t)=>{let n=ah(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sh=(e,t)=>{let n=oh(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ch=(e,t)=>{let n=sh(e);return{name:n.name,fn:n.fn,options:[e,t]}},wh=(e,t)=>{let n=_h(e);return{name:n.name,fn:n.fn,options:[e,t]}},Th=`Arrow`,Eh=W.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,G.jsx)(ru.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,G.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Eh.displayName=Th;var Dh=Eh;function Oh(e){let[t,n]=W.useState(void 0);return Hl(()=>{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 kh=`Popper`,[Ah,jh]=Bl(kh),[Mh,Nh]=Ah(kh),Ph=e=>{let{__scopePopper:t,children:n}=e,[r,i]=W.useState(null);return(0,G.jsx)(Mh,{scope:t,anchor:r,onAnchorChange:i,children:n})};Ph.displayName=kh;var Fh=`PopperAnchor`,Ih=W.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Nh(Fh,n),o=W.useRef(null),s=Rl(t,o),c=W.useRef(null);return W.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,G.jsx)(ru.div,{...i,ref:s})});Ih.displayName=Fh;var Lh=`PopperContent`,[Rh,zh]=Ah(Lh),Bh=W.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=Nh(Lh,n),[_,v]=W.useState(null),y=Rl(t,e=>v(e)),[b,x]=W.useState(null),S=Oh(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(Wh),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=gh({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>nh(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[vh({mainAxis:i+w,alignmentAxis:o}),c&&yh({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?bh():void 0,...k}),c&&xh({...k}),Sh({...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&&wh({element:b,padding:s}),Gh({arrowWidth:C,arrowHeight:w}),f&&Ch({strategy:`referenceHidden`,...k})]}),[F,I]=Kh(M),L=au(m);Hl(()=>{N&&L?.()},[N,L]);let R=P.arrow?.x,ee=P.arrow?.y,z=P.arrow?.centerOffset!==0,[B,V]=W.useState();return Hl(()=>{_&&V(window.getComputedStyle(_).zIndex)},[_]),(0,G.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:B,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,G.jsx)(Rh,{scope:n,placedSide:F,onArrowChange:x,arrowX:R,arrowY:ee,shouldHideArrow:z,children:(0,G.jsx)(ru.div,{"data-side":F,"data-align":I,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});Bh.displayName=Lh;var Vh=`PopperArrow`,Hh={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Uh=W.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=zh(Vh,n),a=Hh[i.placedSide];return(0,G.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,G.jsx)(Dh,{...r,ref:t,style:{...r.style,display:`block`}})})});Uh.displayName=Vh;function Wh(e){return e!==null}var Gh=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]=Kh(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 Kh(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var qh=Ph,Jh=Ih,Yh=Bh,Xh=Uh;function Zh(e){let t=W.useRef({value:e,previous:e});return W.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Qh=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`}),$h=`VisuallyHidden`,eg=W.forwardRef((e,t)=>(0,G.jsx)(ru.span,{...e,ref:t,style:{...Qh,...e.style}}));eg.displayName=$h;var tg=[` `,`Enter`,`ArrowUp`,`ArrowDown`],ng=[` `,`Enter`],rg=`Select`,[ig,ag,og]=up(rg),[sg,cg]=Bl(rg,[og,jh]),lg=jh(),[ug,dg]=sg(rg),[fg,pg]=sg(rg),mg=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}=e,h=lg(t),[g,_]=W.useState(null),[v,y]=W.useState(null),[b,x]=W.useState(!1),S=fp(l),[C,w]=ql({prop:r,defaultProp:i??!1,onChange:a,caller:rg}),[T,E]=ql({prop:o,defaultProp:s,onChange:c,caller:rg}),D=W.useRef(null),O=g?m||!!g.closest(`form`):!0,[k,A]=W.useState(new Set),j=Array.from(k).map(e=>e.props.value).join(`;`);return(0,G.jsx)(qh,{...h,children:(0,G.jsxs)(ug,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:Gl(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,G.jsx)(ig.Provider,{scope:t,children:(0,G.jsx)(fg,{scope:e.__scopeSelect,onNativeOptionAdd:W.useCallback(e=>{A(t=>new Set(t).add(e))},[]),onNativeOptionRemove:W.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,G.jsxs)(l_,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,G.jsx)(`option`,{value:``}):null,Array.from(k)]},j):null]})})};mg.displayName=rg;var hg=`SelectTrigger`,gg=W.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=lg(n),o=dg(hg,n),s=o.disabled||r,c=Rl(t,o.onTriggerChange),l=ag(n),u=W.useRef(`touch`),[d,f,p]=d_(e=>{let t=l().filter(e=>!e.disabled),n=f_(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,G.jsx)(Jh,{asChild:!0,...a,children:(0,G.jsx)(ru.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"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":u_(o.value)?``:void 0,...i,ref:c,onClick:Fl(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:Fl(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:Fl(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&tg.includes(e.key)&&(m(),e.preventDefault())})})})});gg.displayName=hg;var _g=`SelectValue`,vg=W.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=dg(_g,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Rl(t,c.onValueNodeChange);return Hl(()=>{l(u)},[l,u]),(0,G.jsx)(ru.span,{...s,ref:d,style:{pointerEvents:`none`},children:u_(c.value)?(0,G.jsx)(G.Fragment,{children:o}):a})});vg.displayName=_g;var yg=`SelectIcon`,bg=W.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,G.jsx)(ru.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});bg.displayName=yg;var xg=`SelectPortal`,Sg=e=>(0,G.jsx)(Lu,{asChild:!0,...e});Sg.displayName=xg;var Cg=`SelectContent`,wg=W.forwardRef((e,t)=>{let n=dg(Cg,e.__scopeSelect),[r,i]=W.useState();if(Hl(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Xl.createPortal((0,G.jsx)(Eg,{scope:e.__scopeSelect,children:(0,G.jsx)(ig.Slot,{scope:e.__scopeSelect,children:(0,G.jsx)(`div`,{children:e.children})})}),t):null}return(0,G.jsx)(Ag,{...e,ref:t})});wg.displayName=Cg;var Tg=10,[Eg,Dg]=sg(Cg),Og=`SelectContentImpl`,kg=Zl(`SelectContent.RemoveScroll`),Ag=W.forwardRef((e,t)=>{let{__scopeSelect:n,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=dg(Cg,n),[y,b]=W.useState(null),[x,S]=W.useState(null),C=Rl(t,e=>b(e)),[w,T]=W.useState(null),[E,D]=W.useState(null),O=ag(n),[k,A]=W.useState(!1),j=W.useRef(!1);W.useEffect(()=>{if(y)return uf(y)},[y]),Wu();let M=W.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=W.useCallback(()=>M([w,y]),[M,w,y]);W.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;W.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():y.contains(n.target)||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]),W.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]=d_(e=>{let t=O().filter(e=>!e.disabled),n=f_(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),R=W.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]),ee=W.useCallback(()=>y?.focus(),[y]),z=W.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),B=r===`popper`?Pg:Mg,V=B===Pg?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,G.jsx)(Eg,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:R,selectedItem:w,onItemLeave:ee,itemTextRefCallback:z,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:I,children:(0,G.jsx)(ef,{as:kg,allowPinchZoom:!0,children:(0,G.jsx)(wu,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:Fl(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,G.jsx)(pu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,G.jsx)(B,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...V,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:Fl(_.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()}})})})})})})});Ag.displayName=Og;var jg=`SelectItemAlignedPosition`,Mg=W.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=dg(Cg,n),o=Dg(Cg,n),[s,c]=W.useState(null),[l,u]=W.useState(null),d=Rl(t,e=>u(e)),f=ag(n),p=W.useRef(!1),m=W.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=W.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-Tg,d=lp(a,[Tg,Math.max(Tg,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-Tg,d=lp(a,[Tg,Math.max(Tg,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Tg*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-Tg,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=`${Tg}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]);Hl(()=>y(),[y]);let[b,x]=W.useState();return Hl(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,G.jsx)(Fg,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:W.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,G.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,G.jsx)(ru.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Mg.displayName=jg;var Ng=`SelectPopperPosition`,Pg=W.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Tg,...a}=e,o=lg(n);return(0,G.jsx)(Yh,{...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)`}})});Pg.displayName=Ng;var[Fg,Ig]=sg(Cg,{}),Lg=`SelectViewport`,Rg=W.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Dg(Lg,n),o=Ig(Lg,n),s=Rl(t,a.onViewportChange),c=W.useRef(0);return(0,G.jsxs)(G.Fragment,{children:[(0,G.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,G.jsx)(ig.Slot,{scope:n,children:(0,G.jsx)(ru.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:Fl(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-Tg*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})})})]})});Rg.displayName=Lg;var zg=`SelectGroup`,[Bg,Vg]=sg(zg),Hg=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Gl();return(0,G.jsx)(Bg,{scope:n,id:i,children:(0,G.jsx)(ru.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Hg.displayName=zg;var Ug=`SelectLabel`,Wg=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Vg(Ug,n);return(0,G.jsx)(ru.div,{id:i.id,...r,ref:t})});Wg.displayName=Ug;var Gg=`SelectItem`,[Kg,qg]=sg(Gg),Jg=W.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=dg(Gg,n),c=Dg(Gg,n),l=s.value===r,[u,d]=W.useState(a??``),[f,p]=W.useState(!1),m=Rl(t,e=>c.itemRefCallback?.(e,r,i)),h=Gl(),g=W.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,G.jsx)(Kg,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:W.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,G.jsx)(ig.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,G.jsx)(ru.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:Fl(o.onFocus,()=>p(!0)),onBlur:Fl(o.onBlur,()=>p(!1)),onClick:Fl(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:Fl(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:Fl(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:Fl(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Fl(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Fl(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(ng.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});Jg.displayName=Gg;var Yg=`SelectItemText`,Xg=W.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=dg(Yg,n),s=Dg(Yg,n),c=qg(Yg,n),l=pg(Yg,n),[u,d]=W.useState(null),f=Rl(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=W.useMemo(()=>(0,G.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return Hl(()=>(h(m),()=>g(m)),[h,g,m]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ru.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Xl.createPortal(a.children,o.valueNode):null]})});Xg.displayName=Yg;var Zg=`SelectItemIndicator`,Qg=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return qg(Zg,n).isSelected?(0,G.jsx)(ru.span,{"aria-hidden":!0,...r,ref:t}):null});Qg.displayName=Zg;var $g=`SelectScrollUpButton`,e_=W.forwardRef((e,t)=>{let n=Dg($g,e.__scopeSelect),r=Ig($g,e.__scopeSelect),[i,a]=W.useState(!1),o=Rl(t,r.onScrollButtonChange);return Hl(()=>{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,G.jsx)(r_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});e_.displayName=$g;var t_=`SelectScrollDownButton`,n_=W.forwardRef((e,t)=>{let n=Dg(t_,e.__scopeSelect),r=Ig(t_,e.__scopeSelect),[i,a]=W.useState(!1),o=Rl(t,r.onScrollButtonChange);return Hl(()=>{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,G.jsx)(r_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});n_.displayName=t_;var r_=W.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Dg(`SelectScrollButton`,n),o=W.useRef(null),s=ag(n),c=W.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return W.useEffect(()=>()=>c(),[c]),Hl(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,G.jsx)(ru.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Fl(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Fl(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Fl(i.onPointerLeave,()=>{c()})})}),i_=`SelectSeparator`,a_=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,G.jsx)(ru.div,{"aria-hidden":!0,...r,ref:t})});a_.displayName=i_;var o_=`SelectArrow`,s_=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=lg(n),a=dg(o_,n),o=Dg(o_,n);return a.open&&o.position===`popper`?(0,G.jsx)(Xh,{...i,...r,ref:t}):null});s_.displayName=o_;var c_=`SelectBubbleInput`,l_=W.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=W.useRef(null),a=Rl(r,i),o=Zh(t);return W.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,G.jsx)(ru.select,{...n,style:{...Qh,...n.style},ref:a,defaultValue:t})});l_.displayName=c_;function u_(e){return e===``||e===void 0}function d_(e){let t=au(e),n=W.useRef(``),r=W.useRef(0),i=W.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=W.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return W.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function f_(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=p_(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 p_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var m_=mg,h_=gg,g_=vg,__=bg,v_=Sg,y_=wg,b_=Rg,x_=Jg,S_=Xg,C_=Qg,w_=m_,T_=g_,E_=(0,W.forwardRef)(({className:e,children:t,...n},r)=>(0,G.jsxs)(h_,{ref:r,className:J(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-sm shadow-xs ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,G.jsx)(__,{asChild:!0,children:(0,G.jsx)(ho,{className:`h-4 w-4 opacity-50`})})]}));E_.displayName=h_.displayName;var D_=(0,W.forwardRef)(({className:e,children:t,position:n=`popper`,...r},i)=>(0,G.jsx)(v_,{children:(0,G.jsx)(y_,{ref:i,className:J(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border-0 bg-surface-container-highest text-card-foreground shadow-ambient`,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,...r,children:(0,G.jsx)(b_,{className:J(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t})})}));D_.displayName=y_.displayName;var O_=(0,W.forwardRef)(({className:e,children:t,...n},r)=>(0,G.jsxs)(x_,{ref:r,className:J(`relative flex w-full cursor-default select-none items-center rounded-xs py-1.5 pl-2 pr-8 text-sm outline-hidden focus:bg-surface-bright focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,G.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,G.jsx)(C_,{children:(0,G.jsx)(mo,{className:`h-4 w-4`})})}),(0,G.jsx)(S_,{children:t})]}));O_.displayName=x_.displayName;var k_=`Toggle`,A_=W.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=ql({prop:n,onChange:i,defaultProp:r??!1,caller:k_});return(0,G.jsx)(ru.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:Fl(e.onClick,()=>{e.disabled||s(!o)})})});A_.displayName=k_;var j_=A_,M_=oc(`inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-surface-container-high/80 hover:text-on-surface-variant focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-primary data-[state=on]:text-on-primary`,{variants:{variant:{default:`bg-surface-container-high text-on-surface-variant`,outline:`border border-input bg-surface-container-high text-on-surface-variant shadow-xs hover:bg-surface-container-high/80 hover:text-on-surface-variant`},size:{default:`h-9 px-3`,sm:`h-8 px-2`,lg:`h-10 px-3`}},defaultVariants:{variant:`default`,size:`default`}}),N_=(0,W.forwardRef)(({className:e,variant:t,size:n,...r},i)=>(0,G.jsx)(j_,{ref:i,className:J(M_({variant:t,size:n,className:e})),...r}));N_.displayName=j_.displayName;var P_=oc(`inline-flex items-center rounded-xs px-2 py-0.5 font-sans text-xs font-medium transition-colors`,{variants:{variant:{default:`bg-primary/15 text-primary`,secondary:`bg-surface-container-high text-on-surface-variant`,destructive:`bg-tertiary/15 text-tertiary`,warning:`bg-secondary/15 text-secondary`,outline:`border border-[var(--ghost-border)] text-on-surface-variant`}},defaultVariants:{variant:`default`}});function X({className:e,variant:t,...n}){return(0,G.jsx)(`div`,{className:J(P_({variant:t}),e),...n})}var F_=120,I_={session:{label:`Sessions`,icon:is},spore:{label:`Spores`,icon:Cs},plan:{label:`Plans`,icon:To},prompt_batch:{label:`Prompt Batches`,icon:oo},activity:{label:`Activities`,icon:oo},canopy:{label:`Canopy`,icon:Lo}};function L_(e){return I_[e]??{label:e,icon:zo}}function R_(e){return e.type===`canopy`}function z_(e,t){return e.length<=t?e:e.slice(0,t)+`…`}function B_({score:e}){return(0,G.jsxs)(X,{variant:`outline`,className:`shrink-0 text-xs tabular-nums text-on-surface-variant`,children:[Math.round(e*100),`%`]})}function V_({result:e,onSelect:t,isHighlighted:n}){let{icon:r}=L_(`canopy`),i=e.path??`(unknown path)`;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(e),"data-testid":`search-result-canopy`,className:[`w-full flex items-start gap-3 px-3 py-2 text-left rounded-md transition-colors`,n?`bg-surface-container-high text-on-surface`:`hover:bg-surface-container-high hover:text-on-surface`].join(` `),children:[(0,G.jsx)(r,{className:`h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-mono truncate`,children:i}),e.language&&(0,G.jsx)(X,{variant:`secondary`,className:`shrink-0 text-[10px] uppercase tracking-wider`,children:e.language})]}),e.llm_description&&(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant mt-0.5 truncate`,children:z_(e.llm_description,F_)})]}),(0,G.jsx)(B_,{score:e.score})]})}function H_({result:e,onSelect:t,isHighlighted:n}){if(R_(e))return(0,G.jsx)(V_,{result:e,onSelect:t,isHighlighted:n});let{icon:r}=L_(e.type);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:[`w-full flex items-start gap-3 px-3 py-2 text-left rounded-md transition-colors`,n?`bg-surface-container-high text-on-surface`:`hover:bg-surface-container-high hover:text-on-surface`].join(` `),children:[(0,G.jsx)(r,{className:`h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsx)(`span`,{className:`text-sm font-medium truncate`,children:e.title})}),e.preview&&(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant mt-0.5 line-clamp-2`,children:z_(e.preview,F_)})]}),(0,G.jsx)(B_,{score:e.score})]})}function U_(e,t){return R_(e)?`canopy:${e.path??t}`:e.id??String(t)}function W_({results:e,onSelect:t,highlightedIndex:n}){let r=e.reduce((e,t)=>{let n=t.type??`unknown`;return(e[n]??=[]).push(t),e},{}),i=0;return(0,G.jsx)(`div`,{className:`py-2 space-y-1`,children:Object.entries(r).map(([e,r])=>{let{label:a}=L_(e),o=i;return i+=r.length,(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`px-3 py-1`,children:(0,G.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-on-surface-variant`,children:a})}),r.map((e,r)=>(0,G.jsx)(H_,{result:e,onSelect:t,isHighlighted:n===o+r},U_(e,o+r)))]},e)})})}var G_=2,K_=3e4;function q_(e){let t=Math.floor(Date.now()/1e3);switch(e){case`24h`:return t-1440*60;case`7d`:return t-10080*60;case`30d`:return t-720*60*60;default:return}}function J_(e,t,n){let r=new URLSearchParams({q:e,mode:t});if(t===`semantic`&&n){n.namespace&&n.namespace!==`all`&&r.set(`namespace`,n.namespace),n.observationType&&n.observationType!==`all`&&r.set(`observation_type`,n.observationType);let e=q_(n.recentWindow??`any`);e!==void 0&&r.set(`since`,String(e))}return`/search?${r.toString()}`}function Y_(e,t){let n=new URLSearchParams({q:e,type:`canopy`});return t?.language&&n.set(`language`,t.language),`/search?${n.toString()}`}function X_(e,t=`semantic`,n){return ot({queryKey:Ta([`search`,e,t,n?.namespace??`all`,n?.observationType??`all`,n?.recentWindow??`any`]),queryFn:({signal:r})=>$i(J_(e,t,n),{signal:r}),enabled:e.length>G_,staleTime:K_})}function Z_(e,t,n=!0){return ot({queryKey:Ta([`search-canopy`,e,t?.language??`all`]),queryFn:async({signal:n})=>{let r=await $i(Y_(e,t),{signal:n});return{mode:r.mode,results:(r.results??[]).map(e=>({...e,type:`canopy`})),provider_unavailable:r.provider_unavailable}},enabled:n&&e.length>G_,staleTime:K_})}var Q_=300,$_=20,ev=[{value:`all`,label:`All`},{value:`sessions`,label:`Sessions`},{value:`spores`,label:`Spores`},{value:`plans`,label:`Plans`},{value:`skills`,label:`Skills`},{value:`canopy`,label:`Canopy`}];function tv(e){switch(e){case`sessions`:return`sessions`;case`spores`:return`spores`;case`plans`:return`plans`;case`skills`:return`skill_records`;default:return`all`}}var nv=[{value:`any`,label:`Any time`},{value:`24h`,label:`24 hours`},{value:`7d`,label:`7 days`},{value:`30d`,label:`30 days`}],rv=[{value:`all`,label:`All spore types`},{value:`decision`,label:`Decision`},{value:`gotcha`,label:`Gotcha`},{value:`discovery`,label:`Discovery`},{value:`bug_fix`,label:`Bug fix`},{value:`trade_off`,label:`Trade-off`},{value:`cross-cutting`,label:`Cross-cutting`}];function iv(e){return e.path?`/cortex?tab=canopy§ion=entries&path=${encodeURIComponent(e.path)}`:`/cortex?tab=canopy§ion=entries`}function av(e){if(e.type===`canopy`)return iv(e);let t=e;switch(t.type){case`session`:return`/sessions/${t.id}`;case`spore`:return`/mycelium?tab=spores&spore=${encodeURIComponent(t.id)}`;case`plan`:return t.session_id?`/sessions/${t.session_id}?tab=plans&plan=${encodeURIComponent(t.id)}`:`/sessions`;case`prompt_batch`:return t.session_id?`/sessions/${t.session_id}`:`/sessions`;case`activity`:return t.session_id?`/sessions/${t.session_id}`:`/sessions`;case`skill`:return`/skills?skill=${encodeURIComponent(t.id)}`;default:return`/`}}function ov({open:e,onOpenChange:t}){let n=Nn(),[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(``),[s,c]=(0,W.useState)(`semantic`),[l,u]=(0,W.useState)(`all`),[d,f]=(0,W.useState)(`all`),[p,m]=(0,W.useState)(`any`),[h,g]=(0,W.useState)(0),_=(0,W.useRef)(null),v=l===`canopy`,y=tv(l);(0,W.useEffect)(()=>{let e=setTimeout(()=>{o(r.trim())},Q_);return()=>clearTimeout(e)},[r]),(0,W.useEffect)(()=>{e&&(i(``),o(``),u(`all`),f(`all`),m(`any`),g(0),setTimeout(()=>_.current?.focus(),50))},[e]);let{data:b,isLoading:x}=X_(a,s,s===`semantic`?{namespace:y,observationType:y===`spores`||y===`all`?d:`all`,recentWindow:p}:void 0),{data:S,isLoading:C}=Z_(a,void 0,v),w=v?S:b,T=v?C:x,E=(0,W.useMemo)(()=>v?(S?.results??[]).slice(0,$_):(b?.results??[]).slice(0,$_),[v,S,b]);(0,W.useEffect)(()=>{g(0)},[E.length,a]);let D=(0,W.useCallback)(e=>{let r=av(e);t(!1),n(r)},[n,t]),O=(0,W.useCallback)(e=>{if(E.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),g(e=>Math.min(e+1,E.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),g(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=E[h];t&&D(t)}}},[E,h,D]),k=a.length>2&&!T&&E.length===0,A=a.length<=2&&!T;return(0,G.jsx)($f,{open:e,onOpenChange:t,children:(0,G.jsxs)(rp,{className:`max-w-2xl p-0 gap-0 overflow-hidden`,onKeyDown:O,children:[(0,G.jsx)(op,{className:`sr-only`,children:`Search vault`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-[var(--ghost-border)] pl-4 pr-12 py-3`,children:[(0,G.jsx)(_s,{className:`h-4 w-4 shrink-0 text-on-surface-variant`}),(0,G.jsx)(cp,{ref:_,value:r,onChange:e=>i(e.target.value),placeholder:`Search sessions, spores, plans…`,className:`border-0 shadow-none focus-visible:ring-0 px-0 h-auto text-base bg-surface-bright font-mono`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,G.jsx)(N_,{size:`sm`,pressed:s===`semantic`,onPressedChange:()=>c(`semantic`),"aria-label":`Semantic search`,title:`Semantic (embedded knowledge)`,children:`Semantic`}),(0,G.jsx)(N_,{size:`sm`,pressed:s===`fts`,onPressedChange:()=>c(`fts`),"aria-label":`Full-text search`,title:`Full text (raw data)`,children:`Full Text`})]})]}),(s===`semantic`||v)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-[var(--ghost-border)] px-4 py-2 bg-surface-container-lowest/30`,children:[(0,G.jsx)(`div`,{className:`w-[132px]`,children:(0,G.jsxs)(w_,{value:l,onValueChange:e=>u(e),children:[(0,G.jsx)(E_,{className:`h-8 text-xs`,"aria-label":`Facet`,children:(0,G.jsx)(T_,{placeholder:`Scope`})}),(0,G.jsx)(D_,{children:ev.map(e=>(0,G.jsx)(O_,{value:e.value,children:e.label},e.value))})]})}),!v&&(0,G.jsx)(`div`,{className:`w-[132px]`,children:(0,G.jsxs)(w_,{value:p,onValueChange:e=>m(e),children:[(0,G.jsx)(E_,{className:`h-8 text-xs`,children:(0,G.jsx)(T_,{placeholder:`Recent`})}),(0,G.jsx)(D_,{children:nv.map(e=>(0,G.jsx)(O_,{value:e.value,children:e.label},e.value))})]})}),!v&&(y===`all`||y===`spores`)&&(0,G.jsx)(`div`,{className:`w-[156px]`,children:(0,G.jsxs)(w_,{value:d,onValueChange:e=>f(e),children:[(0,G.jsx)(E_,{className:`h-8 text-xs`,children:(0,G.jsx)(T_,{placeholder:`Spore type`})}),(0,G.jsx)(D_,{children:rv.map(e=>(0,G.jsx)(O_,{value:e.value,children:e.label},e.value))})]})})]}),(0,G.jsxs)(`div`,{className:`max-h-96 overflow-y-auto`,children:[T&&a.length>2&&(0,G.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(`div`,{className:`h-4 w-32 rounded bg-muted animate-pulse`}),(0,G.jsx)(`div`,{className:`h-3 w-24 rounded bg-muted animate-pulse`}),(0,G.jsx)(`div`,{className:`h-3 w-28 rounded bg-muted animate-pulse`})]})}),A&&(0,G.jsx)(`div`,{className:`px-4 py-8 text-center text-sm text-on-surface-variant`,children:`Type to search your vault…`}),k&&(0,G.jsxs)(`div`,{className:`px-4 py-8 text-center text-sm text-on-surface-variant`,children:[`No results for `,(0,G.jsxs)(`span`,{className:`font-medium text-on-surface`,children:[`"`,a,`"`]})]}),E.length>0&&!T&&(0,G.jsx)(W_,{results:E,onSelect:D,highlightedIndex:h})]}),(0,G.jsxs)(`div`,{className:`border-t border-[var(--ghost-border)] px-4 py-2 flex items-center gap-4 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`kbd`,{className:`font-mono`,children:`↑↓`}),` navigate`]}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`kbd`,{className:`font-mono`,children:`↵`}),` open`]}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`kbd`,{className:`font-mono`,children:`Esc`}),` close`]}),(0,G.jsx)(`span`,{className:`ml-auto`,children:w?.mode&&E.length>0&&`${E.length} result${E.length===1?``:`s`} · ${w.mode}`})]})]})})}function sv({collapsed:e=!1}){let t=xa(),{data:n}=tc(),r=Nn(),i=An(),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(``),l=(0,W.useRef)(null),u=n?.groves??[],d=u.reduce((e,t)=>e+t.projects.length,0),f=(0,W.useMemo)(()=>t?null:Gi(u),[t,u]),p=t??f,m=(0,W.useMemo)(()=>{let e=s.trim().toLowerCase();return e?u.map(t=>({...t,projects:t.projects.filter(n=>`${t.name} ${n.name}`.toLowerCase().includes(e))})).filter(e=>e.projects.length>0):u},[u,s]);if((0,W.useEffect)(()=>{if(!a)return;let e=e=>{l.current?.contains(e.target)||o(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[a]),!p)return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(`/groves`),className:J(`flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,e?`justify-center px-2 py-2`:`gap-3 px-3 py-2`),children:[(0,G.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center rounded-md bg-primary/15 text-xs font-semibold text-primary`,children:`M`}),!e&&(0,G.jsx)(`span`,{className:`truncate`,children:`Select project`})]});let h=qi(p.project.project_id),g=d>1,_=(e,t)=>{r(Bi({grove:e,project:t},Vi(i.pathname))),o(!1),c(``)};return(0,G.jsxs)(`div`,{ref:l,className:`relative px-2 pb-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>g&&o(e=>!e),title:e?p.project.name:void 0,className:J(`flex w-full items-center rounded-md text-sm transition-colors`,g?`hover:bg-surface-container-high`:`cursor-default`,e?`justify-center px-0 py-1.5`:`gap-2 px-2 py-2 text-left`),children:[(0,G.jsx)(cv,{project:p.project,color:h}),!e&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-on-surface`,children:p.project.name}),(0,G.jsx)(`span`,{className:`block truncate text-[11px] text-on-surface-variant`,children:p.grove.name})]}),g&&(0,G.jsx)(ho,{className:`h-4 w-4 text-on-surface-variant`})]})]}),a&&(0,G.jsxs)(`div`,{className:`absolute left-2 top-full z-50 mt-1 w-72 rounded-md border border-outline-variant/30 bg-surface-container-high p-2 shadow-lg`,children:[(0,G.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface px-2 py-1.5 text-sm`,children:[(0,G.jsx)(_s,{className:`h-4 w-4 text-on-surface-variant`}),(0,G.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),autoFocus:!0,placeholder:`Find project`,className:`min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-on-surface-variant`})]}),(0,G.jsx)(`div`,{className:`mt-2 max-h-80 overflow-auto`,children:m.map(e=>(0,G.jsxs)(`div`,{className:`py-1`,children:[(0,G.jsx)(`div`,{className:`px-2 py-1 text-[11px] font-medium uppercase tracking-wide text-on-surface-variant`,children:e.name}),e.projects.map(t=>{let n=p.grove.id===e.id&&p.project.project_id===t.project_id;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>_(e,t),className:J(`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors`,n?`bg-primary/10 text-primary`:`text-on-surface hover:bg-surface-container`),children:[(0,G.jsx)(cv,{project:t,color:qi(t.project_id)}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.name}),n&&(0,G.jsx)(mo,{className:`h-4 w-4`})]},t.project_id)})]},e.id))})]})]})}function cv({project:e,color:t}){return(0,G.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-xs font-semibold text-white`,style:{backgroundColor:t},"aria-hidden":`true`,children:Ki(e.name)})}var lv=Hs.LOGS;function uv(e){let t=e?.includeDaemon?`/notifications/unread-count?include_daemon=1`:`/notifications/unread-count`;return Vs({queryKey:[`notifications`,`unread-count`,{includeDaemon:!!e?.includeDaemon}],queryFn:({signal:e})=>$i(t,{signal:e}),refetchInterval:lv,pollCategory:`standard`})}function dv(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.domain&&t.set(`domain`,e.domain),e?.mode&&t.set(`mode`,e.mode),e?.limit&&t.set(`limit`,String(e.limit)),e?.includeDaemon&&t.set(`include_daemon`,`1`);let n=t.toString(),r=n?`/notifications?${n}`:`/notifications`;return Vs({queryKey:[`notifications`,`list`,e],queryFn:({signal:e})=>$i(r,{signal:e}),enabled:e?.enabled,pollCategory:e?.pollCategory??`standard`,refetchInterval:e?.refetchInterval??!1})}function fv(){return ot({queryKey:[`notifications`,`registry`],queryFn:({signal:e})=>$i(`/notifications/registry`,{signal:e}),staleTime:6e4})}function pv(){let e=We();return st({mutationFn:({id:e,status:t})=>$i(`/notifications/${e}`,{method:`PATCH`,body:JSON.stringify({status:t}),headers:{"Content-Type":`application/json`}}),onSuccess:()=>{e.invalidateQueries({queryKey:[`notifications`]})}})}function mv(){let e=We();return st({mutationFn:e=>sa(`/notifications/dismiss-all`,e?{domain:e}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`notifications`]})}})}function hv(){let e=We();return st({mutationFn:e=>sa(`/notifications/mark-all-read`,e?{domain:e}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`notifications`]})}})}var gv=3,_v=5e3,vv=12,yv=400,bv=`notification-banner`,xv={info:`bg-primary/10 border-primary/20 text-primary`,success:`bg-green-500/10 border-green-500/20 text-green-600 dark:text-green-400`,warning:`bg-secondary/10 border-secondary/20 text-secondary`,error:`bg-tertiary/10 border-tertiary/20 text-tertiary`},Sv={info:Jo,success:So,warning:js,error:yo};function Cv({panelOpen:e=!1}){let{data:t}=dv({status:`unread`,mode:`banner`,limit:gv,pollCategory:`realtime`,refetchInterval:Hs.LOGS,includeDaemon:!0}),n=pv(),r=Nn(),[i,a]=(0,W.useState)(new Set),o=(t?.items??[]).filter(e=>!i.has(e.id));if((0,W.useEffect)(()=>{let e=[];for(let t of o)e.push(setTimeout(()=>{a(e=>new Set(e).add(t.id)),n.mutate({id:t.id,status:`read`})},_v));return()=>e.forEach(clearTimeout)},[o.map(e=>e.id).join(`,`)]),o.length===0)return null;let s=e=>{n.mutate({id:e.id,status:`read`}),a(t=>new Set(t).add(e.id)),e.link&&r(e.link,{state:{source:bv,triggeredAt:Date.now()}})},c=(e,t)=>{e.stopPropagation(),a(e=>new Set(e).add(t.id)),n.mutate({id:t.id,status:`read`})};return(0,G.jsx)(`div`,{className:`fixed top-3 z-[60] flex w-80 flex-col gap-2`,style:{right:e?yv:vv},children:o.map(e=>{let t=Sv[e.level];return(0,G.jsxs)(`div`,{onClick:()=>s(e),className:J(`flex items-start gap-2 rounded-md border px-3 py-2.5 text-sm shadow-lg cursor-pointer transition-all animate-in slide-in-from-right-5 fade-in duration-200`,xv[e.level]),children:[(0,G.jsx)(t,{className:`h-4 w-4 mt-0.5 shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-medium truncate`,children:e.title}),e.message&&(0,G.jsx)(`div`,{className:`text-xs mt-0.5 opacity-80 line-clamp-2`,children:e.message})]}),(0,G.jsx)(`button`,{onClick:t=>c(t,e),className:`shrink-0 rounded p-0.5 opacity-60 hover:opacity-100 transition-opacity`,"aria-label":`Dismiss`,children:(0,G.jsx)(Is,{className:`h-3.5 w-3.5`})})]},e.id)})})}function wv(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Tv=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ev=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dv={};function Ov(e,t){return((t||Dv).jsx?Ev:Tv).test(e)}var kv=/[ \t\n\f\r]/g;function Av(e){return typeof e==`object`?e.type===`text`?jv(e.value):!1:jv(e)}function jv(e){return e.replace(kv,``)===``}var Mv=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Mv.prototype.normal={},Mv.prototype.property={},Mv.prototype.space=void 0;function Nv(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Mv(n,r,t)}function Pv(e){return e.toLowerCase()}var Fv=class{constructor(e,t){this.attribute=t,this.property=e}};Fv.prototype.attribute=``,Fv.prototype.booleanish=!1,Fv.prototype.boolean=!1,Fv.prototype.commaOrSpaceSeparated=!1,Fv.prototype.commaSeparated=!1,Fv.prototype.defined=!1,Fv.prototype.mustUseProperty=!1,Fv.prototype.number=!1,Fv.prototype.overloadedBoolean=!1,Fv.prototype.property=``,Fv.prototype.spaceSeparated=!1,Fv.prototype.space=void 0;var Iv=s({boolean:()=>Rv,booleanish:()=>zv,commaOrSpaceSeparated:()=>Uv,commaSeparated:()=>Hv,number:()=>Z,overloadedBoolean:()=>Bv,spaceSeparated:()=>Vv}),Lv=0,Rv=Wv(),zv=Wv(),Bv=Wv(),Z=Wv(),Vv=Wv(),Hv=Wv(),Uv=Wv();function Wv(){return 2**++Lv}var Gv=Object.keys(Iv),Kv=class extends Fv{constructor(e,t,n,r){let i=-1;if(super(e,t),qv(this,`space`,r),typeof n==`number`)for(;++i<Gv.length;){let e=Gv[i];qv(this,Gv[i],(n&Iv[e])===Iv[e])}}};Kv.prototype.defined=!0;function qv(e,t,n){n&&(e[t]=n)}function Jv(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Kv(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Pv(r)]=r,n[Pv(a.attribute)]=r}return new Mv(t,n,e.space)}var Yv=Jv({properties:{ariaActiveDescendant:null,ariaAtomic:zv,ariaAutoComplete:null,ariaBusy:zv,ariaChecked:zv,ariaColCount:Z,ariaColIndex:Z,ariaColSpan:Z,ariaControls:Vv,ariaCurrent:null,ariaDescribedBy:Vv,ariaDetails:null,ariaDisabled:zv,ariaDropEffect:Vv,ariaErrorMessage:null,ariaExpanded:zv,ariaFlowTo:Vv,ariaGrabbed:zv,ariaHasPopup:null,ariaHidden:zv,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Vv,ariaLevel:Z,ariaLive:null,ariaModal:zv,ariaMultiLine:zv,ariaMultiSelectable:zv,ariaOrientation:null,ariaOwns:Vv,ariaPlaceholder:null,ariaPosInSet:Z,ariaPressed:zv,ariaReadOnly:zv,ariaRelevant:null,ariaRequired:zv,ariaRoleDescription:Vv,ariaRowCount:Z,ariaRowIndex:Z,ariaRowSpan:Z,ariaSelected:zv,ariaSetSize:Z,ariaSort:null,ariaValueMax:Z,ariaValueMin:Z,ariaValueNow:Z,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Xv(e,t){return t in e?e[t]:t}function Zv(e,t){return Xv(e,t.toLowerCase())}var Qv=Jv({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Hv,acceptCharset:Vv,accessKey:Vv,action:null,allow:null,allowFullScreen:Rv,allowPaymentRequest:Rv,allowUserMedia:Rv,alt:null,as:null,async:Rv,autoCapitalize:null,autoComplete:Vv,autoFocus:Rv,autoPlay:Rv,blocking:Vv,capture:null,charSet:null,checked:Rv,cite:null,className:Vv,cols:Z,colSpan:null,content:null,contentEditable:zv,controls:Rv,controlsList:Vv,coords:Z|Hv,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Rv,defer:Rv,dir:null,dirName:null,disabled:Rv,download:Bv,draggable:zv,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Rv,formTarget:null,headers:Vv,height:Z,hidden:Bv,high:Z,href:null,hrefLang:null,htmlFor:Vv,httpEquiv:Vv,id:null,imageSizes:null,imageSrcSet:null,inert:Rv,inputMode:null,integrity:null,is:null,isMap:Rv,itemId:null,itemProp:Vv,itemRef:Vv,itemScope:Rv,itemType:Vv,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Rv,low:Z,manifest:null,max:null,maxLength:Z,media:null,method:null,min:null,minLength:Z,multiple:Rv,muted:Rv,name:null,nonce:null,noModule:Rv,noValidate:Rv,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Rv,optimum:Z,pattern:null,ping:Vv,placeholder:null,playsInline:Rv,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Rv,referrerPolicy:null,rel:Vv,required:Rv,reversed:Rv,rows:Z,rowSpan:Z,sandbox:Vv,scope:null,scoped:Rv,seamless:Rv,selected:Rv,shadowRootClonable:Rv,shadowRootDelegatesFocus:Rv,shadowRootMode:null,shape:null,size:Z,sizes:null,slot:null,span:Z,spellCheck:zv,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Z,step:null,style:null,tabIndex:Z,target:null,title:null,translate:null,type:null,typeMustMatch:Rv,useMap:null,value:zv,width:Z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Vv,axis:null,background:null,bgColor:null,border:Z,borderColor:null,bottomMargin:Z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Rv,declare:Rv,event:null,face:null,frame:null,frameBorder:null,hSpace:Z,leftMargin:Z,link:null,longDesc:null,lowSrc:null,marginHeight:Z,marginWidth:Z,noResize:Rv,noHref:Rv,noShade:Rv,noWrap:Rv,object:null,profile:null,prompt:null,rev:null,rightMargin:Z,rules:null,scheme:null,scrolling:zv,standby:null,summary:null,text:null,topMargin:Z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Rv,disableRemotePlayback:Rv,prefix:null,property:null,results:Z,security:null,unselectable:null},space:`html`,transform:Zv}),$v=Jv({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Uv,accentHeight:Z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Z,amplitude:Z,arabicForm:null,ascent:Z,attributeName:null,attributeType:null,azimuth:Z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Z,by:null,calcMode:null,capHeight:Z,className:Vv,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Z,diffuseConstant:Z,direction:null,display:null,dur:null,divisor:Z,dominantBaseline:null,download:Rv,dx:null,dy:null,edgeMode:null,editable:null,elevation:Z,enableBackground:null,end:null,event:null,exponent:Z,externalResourcesRequired:null,fill:null,fillOpacity:Z,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Hv,g2:Hv,glyphName:Hv,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Z,horizOriginX:Z,horizOriginY:Z,id:null,ideographic:Z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Z,k:Z,k1:Z,k2:Z,k3:Z,k4:Z,kernelMatrix:Uv,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Z,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Z,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Z,overlineThickness:Z,paintOrder:null,panose1:null,path:null,pathLength:Z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Vv,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Z,pointsAtY:Z,pointsAtZ:Z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Uv,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Uv,rev:Uv,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Uv,requiredFeatures:Uv,requiredFonts:Uv,requiredFormats:Uv,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Z,specularExponent:Z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Z,strikethroughThickness:Z,string:null,stroke:null,strokeDashArray:Uv,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Z,strokeOpacity:Z,strokeWidth:null,style:null,surfaceScale:Z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Uv,tabIndex:Z,tableValues:null,target:null,targetX:Z,targetY:Z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Uv,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Z,underlineThickness:Z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Z,values:null,vAlphabetic:Z,vMathematical:Z,vectorEffect:null,vHanging:Z,vIdeographic:Z,version:null,vertAdvY:Z,vertOriginX:Z,vertOriginY:Z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Xv}),ey=Jv({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),ty=Jv({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Zv}),ny=Jv({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),ry={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},iy=/[A-Z]/g,ay=/-[a-z]/g,oy=/^data[-\w.:]+$/i;function sy(e,t){let n=Pv(t),r=t,i=Fv;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&oy.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(ay,ly);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!ay.test(e)){let n=e.replace(iy,cy);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Kv}return new i(r,t)}function cy(e){return`-`+e.toLowerCase()}function ly(e){return e.charAt(1).toUpperCase()}var uy=Nv([Yv,Qv,ey,ty,ny],`html`),dy=Nv([Yv,$v,ey,ty,ny],`svg`);function fy(e){return e.join(` `).trim()}var py=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
56
|
-
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),my=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(py());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),hy=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),gy=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(my()),r=hy();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),_y=yy(`end`),vy=yy(`start`);function yy(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function by(e){let t=vy(e),n=_y(e);if(t&&n)return{start:t,end:n}}function xy(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Cy(e.position):`start`in e||`end`in e?Cy(e):`line`in e||`column`in e?Sy(e):``}function Sy(e){return wy(e&&e.line)+`:`+wy(e&&e.column)}function Cy(e){return Sy(e&&e.start)+`-`+Sy(e&&e.end)}function wy(e){return e&&typeof e==`number`?e:1}var Ty=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=xy(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Ty.prototype.file=``,Ty.prototype.name=``,Ty.prototype.reason=``,Ty.prototype.message=``,Ty.prototype.stack=``,Ty.prototype.column=void 0,Ty.prototype.line=void 0,Ty.prototype.ancestors=void 0,Ty.prototype.cause=void 0,Ty.prototype.fatal=void 0,Ty.prototype.place=void 0,Ty.prototype.ruleId=void 0,Ty.prototype.source=void 0;var Ey=l(gy(),1),Dy={}.hasOwnProperty,Oy=new Map,ky=/[A-Z]/g,Ay=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),jy=new Set([`td`,`th`]),My=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Ny(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Wy(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Uy(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?dy:uy,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Py(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Py(e,t,n){if(t.type===`element`)return Fy(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Iy(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Ry(e,t,n);if(t.type===`mdxjsEsm`)return Ly(e,t);if(t.type===`root`)return zy(e,t,n);if(t.type===`text`)return By(e,t)}function Fy(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=dy,e.schema=i),e.ancestors.push(t);let a=Xy(e,t.tagName,!1),o=Gy(e,t),s=qy(e,t);return Ay.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Av(e):!0})),Vy(e,o,a,t),Hy(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Iy(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Zy(e,t.position)}function Ly(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zy(e,t.position)}function Ry(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=dy,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Xy(e,t.name,!0),o=Ky(e,t),s=qy(e,t);return Vy(e,o,a,t),Hy(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function zy(e,t,n){let r={};return Hy(r,qy(e,t)),e.create(t,e.Fragment,r,n)}function By(e,t){return t.value}function Vy(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Hy(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Uy(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Wy(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=vy(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Gy(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Dy.call(t.properties,i)){let a=Jy(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&jy.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Ky(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Zy(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Zy(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function qy(e,t){let n=[],r=-1,i=e.passKeys?new Map:Oy;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Py(e,a,o);s!==void 0&&n.push(s)}return n}function Jy(e,t,n){let r=sy(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?wv(n):fy(n)),r.property===`style`){let t=typeof n==`object`?n:Yy(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Qy(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?ry[r.property]||r.property:r.attribute,n]}}function Yy(e,t){try{return(0,Ey.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Ty("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=My+`#cannot-parse-style-attribute`,r}}function Xy(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Ov(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Ov(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Dy.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Zy(e)}function Zy(e,t){let n=new Ty("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=My+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Qy(e){let t={},n;for(n in e)Dy.call(e,n)&&(t[$y(n)]=e[n]);return t}function $y(e){let t=e.replace(ky,eb);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function eb(e){return`-`+e.toLowerCase()}var tb={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},nb={};function rb(e,t){let n=t||nb;return ib(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function ib(e,t,n){if(ob(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return ab(e.children,t,n)}return Array.isArray(e)?ab(e,t,n):``}function ab(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=ib(e[i],t,n);return r.join(``)}function ob(e){return!!(e&&typeof e==`object`)}var sb=document.createElement(`i`);function cb(e){let t=`&`+e+`;`;sb.innerHTML=t;let n=sb.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function lb(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function ub(e,t){return e.length>0?(lb(e,e.length,0,t),e):t}var db={}.hasOwnProperty;function fb(e){let t={},n=-1;for(;++n<e.length;)pb(t,e[n]);return t}function pb(e,t){let n;for(n in t){let r=(db.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){db.call(r,a)||(r[a]=[]);let e=i[a];mb(r[a],Array.isArray(e)?e:e?[e]:[])}}}function mb(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);lb(e,0,0,r)}function hb(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function gb(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var _b=kb(/[A-Za-z]/),vb=kb(/[\dA-Za-z]/),yb=kb(/[#-'*+\--9=?A-Z^-~]/);function bb(e){return e!==null&&(e<32||e===127)}var xb=kb(/\d/),Sb=kb(/[\dA-Fa-f]/),Cb=kb(/[!-/:-@[-`{-~]/);function wb(e){return e!==null&&e<-2}function Tb(e){return e!==null&&(e<0||e===32)}function Eb(e){return e===-2||e===-1||e===32}var Db=kb(/\p{P}|\p{S}/u),Ob=kb(/\s/);function kb(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Ab(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&vb(e.charCodeAt(n+1))&&vb(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function jb(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Eb(r)?(e.enter(n),s(r)):t(r)}function s(r){return Eb(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Mb={tokenize:Nb};function Nb(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),jb(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return wb(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Pb={tokenize:Ib},Fb={tokenize:Lb};function Ib(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return lb(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Fb,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Fb,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return wb(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;lb(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Lb(e,t,n){return jb(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Rb(e){if(e===null||Tb(e)||Ob(e))return 1;if(Db(e))return 2}function zb(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Bb={name:`attention`,resolveAll:Vb,tokenize:Hb};function Vb(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Ub(d,-c),Ub(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=ub(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=ub(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=ub(l,zb(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=ub(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=ub(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,lb(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Hb(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Rb(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Rb(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Ub(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Wb={name:`autolink`,tokenize:Gb};function Gb(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return _b(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||vb(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||vb(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||bb(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):yb(t)?(e.consume(t),l):n(t)}function u(e){return vb(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||vb(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Kb={partial:!0,tokenize:qb};function qb(e,t,n){return r;function r(t){return Eb(t)?jb(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||wb(e)?t(e):n(e)}}var Jb={continuation:{tokenize:Xb},exit:Zb,name:`blockQuote`,tokenize:Yb};function Yb(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Eb(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Xb(e,t,n){let r=this;return i;function i(t){return Eb(t)?jb(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Jb,t,n)(r)}}function Zb(e){e.exit(`blockQuote`)}var Qb={name:`characterEscape`,tokenize:$b};function $b(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Cb(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var ex={name:`characterReference`,tokenize:tx};function tx(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=vb,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Sb,u):(e.enter(`characterReferenceValue`),a=7,o=xb,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===vb&&!cb(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var nx={partial:!0,tokenize:ax},rx={concrete:!0,name:`codeFenced`,tokenize:ix};function ix(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Eb(t)?jb(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||wb(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(nx,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||wb(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Eb(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),jb(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||wb(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||wb(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Eb(t)?jb(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||wb(t)?e.check(nx,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||wb(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Eb(t)?jb(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Eb(t)?jb(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||wb(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function ax(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var ox={name:`codeIndented`,tokenize:cx},sx={partial:!0,tokenize:lx};function cx(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),jb(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):wb(t)?e.attempt(sx,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||wb(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function lx(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):wb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):jb(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):wb(e)?i(e):n(e)}}var ux={name:`codeText`,previous:fx,resolve:dx,tokenize:px};function dx(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function fx(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function px(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):wb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||wb(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var mx=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&hx(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),hx(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),hx(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);hx(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);hx(this.left,t.reverse())}}};function hx(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function gx(e){let t={},n=-1,r,i,a,o,s,c,l,u=new mx(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,_x(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return lb(e,0,1/0,u.slice(0)),!l}function _x(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var vx={resolve:bx,tokenize:xx},yx={partial:!0,tokenize:Sx};function bx(e){return gx(e),e}function xx(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):wb(t)?e.check(yx,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Sx(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),jb(e,a,`linePrefix`)}function a(i){if(i===null||wb(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Cx(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||bb(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||wb(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Tb(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||bb(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function wx(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):wb(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||wb(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Eb(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Tx(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):wb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),jb(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||wb(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Ex(e,t){let n;return r;function r(i){return wb(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Eb(i)?jb(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Dx={name:`definition`,tokenize:kx},Ox={partial:!0,tokenize:Ax};function kx(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return wx.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=gb(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Tb(t)?Ex(e,l)(t):l(t)}function l(t){return Cx(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Ox,d,d)(t)}function d(t){return Eb(t)?jb(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||wb(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Ax(e,t,n){return r;function r(t){return Tb(t)?Ex(e,i)(t):n(t)}function i(t){return Tx(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Eb(t)?jb(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||wb(e)?t(e):n(e)}}var jx={name:`hardBreakEscape`,tokenize:Mx};function Mx(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return wb(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Nx={name:`headingAtx`,resolve:Px,tokenize:Fx};function Px(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},lb(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Fx(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Tb(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||wb(n)?(e.exit(`atxHeading`),t(n)):Eb(n)?jb(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Tb(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Ix=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Lx=[`pre`,`script`,`style`,`textarea`],Rx={concrete:!0,name:`htmlFlow`,resolveTo:Vx,tokenize:Hx},zx={partial:!0,tokenize:Wx},Bx={partial:!0,tokenize:Ux};function Vx(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Hx(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):_b(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):_b(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return _b(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Tb(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Lx.includes(l)?(i=1,r.interrupt?t(s):O(s)):Ix.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||vb(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Eb(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||_b(t)?(e.consume(t),b):Eb(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||vb(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Eb(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Eb(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||wb(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Tb(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Eb(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||wb(t)?O(t):Eb(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):wb(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(zx,R,k)(t)):t===null||wb(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Bx,A,R)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||wb(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return Lx.includes(n)?(e.consume(t),L):O(t)}return _b(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||wb(t)?(e.exit(`htmlFlowData`),R(t)):(e.consume(t),L)}function R(n){return e.exit(`htmlFlow`),t(n)}}function Ux(e,t,n){let r=this;return i;function i(t){return wb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Wx(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Kb,t,n)}}var Gx={name:`htmlText`,tokenize:Kx};function Kx(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):_b(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):_b(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):wb(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):wb(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):wb(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):wb(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return _b(t)?(e.consume(t),S):n(t)}function S(t){return t===45||vb(t)?(e.consume(t),S):C(t)}function C(t){return wb(t)?(o=C,N(t)):Eb(t)?(e.consume(t),C):M(t)}function w(t){return t===45||vb(t)?(e.consume(t),w):t===47||t===62||Tb(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||_b(t)?(e.consume(t),E):wb(t)?(o=T,N(t)):Eb(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||vb(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):wb(t)?(o=D,N(t)):Eb(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):wb(t)?(o=O,N(t)):Eb(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):wb(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Tb(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Tb(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Eb(t)?jb(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var qx={name:`labelEnd`,resolveAll:Zx,resolveTo:Qx,tokenize:$x},Jx={tokenize:eS},Yx={tokenize:tS},Xx={tokenize:nS};function Zx(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&lb(e,0,e.length,n),e}function Qx(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=ub(s,e.slice(a+1,a+r+3)),s=ub(s,[[`enter`,u,t]]),s=ub(s,zb(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=ub(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=ub(s,e.slice(o+1)),s=ub(s,[[`exit`,c,t]]),lb(e,a,e.length,s),e}function $x(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(gb(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Jx,u,o?u:d)(t):t===91?e.attempt(Yx,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Xx,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function eS(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Tb(t)?Ex(e,a)(t):a(t)}function a(t){return t===41?u(t):Cx(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Tb(t)?Ex(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Tx(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Tb(t)?Ex(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function tS(e,t,n){let r=this;return i;function i(t){return wx.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(gb(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function nS(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var rS={name:`labelStartImage`,resolveAll:qx.resolveAll,tokenize:iS};function iS(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var aS={name:`labelStartLink`,resolveAll:qx.resolveAll,tokenize:oS};function oS(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var sS={name:`lineEnding`,tokenize:cS};function cS(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),jb(e,t,`linePrefix`)}}var lS={name:`thematicBreak`,tokenize:uS};function uS(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||wb(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Eb(t)?jb(e,s,`whitespace`)(t):s(t))}}var dS={continuation:{tokenize:hS},exit:_S,name:`list`,tokenize:mS},fS={partial:!0,tokenize:vS},pS={partial:!0,tokenize:gS};function mS(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:xb(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(lS,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return xb(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Kb,r.interrupt?n:u,e.attempt(fS,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Eb(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function hS(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Kb,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,jb(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Eb(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(pS,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,jb(e,e.attempt(dS,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function gS(e,t,n){let r=this;return jb(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function _S(e){e.exit(this.containerState.type)}function vS(e,t,n){let r=this;return jb(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Eb(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var yS={name:`setextUnderline`,resolveTo:bS,tokenize:xS};function bS(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function xS(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Eb(t)?jb(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||wb(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var SS={tokenize:CS};function CS(e){let t=this,n=e.attempt(Kb,r,e.attempt(this.parser.constructs.flowInitial,i,jb(e,e.attempt(this.parser.constructs.flow,i,e.attempt(vx,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var wS={resolveAll:OS()},TS=DS(`string`),ES=DS(`text`);function DS(e){return{resolveAll:OS(e===`text`?kS:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function OS(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function kS(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var AS=s({attentionMarkers:()=>RS,contentInitial:()=>MS,disable:()=>zS,document:()=>jS,flow:()=>PS,flowInitial:()=>NS,insideSpan:()=>LS,string:()=>FS,text:()=>IS}),jS={42:dS,43:dS,45:dS,48:dS,49:dS,50:dS,51:dS,52:dS,53:dS,54:dS,55:dS,56:dS,57:dS,62:Jb},MS={91:Dx},NS={[-2]:ox,[-1]:ox,32:ox},PS={35:Nx,42:lS,45:[yS,lS],60:Rx,61:yS,95:lS,96:rx,126:rx},FS={38:ex,92:Qb},IS={[-5]:sS,[-4]:sS,[-3]:sS,33:rS,38:ex,42:Bb,60:[Wb,Gx],91:aS,92:[jx,Qb],93:qx,95:Bb,96:ux},LS={null:[Bb,wS]},RS={null:[42,95]},zS={null:[]};function BS(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=ub(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=zb(a,l.events,l),l.events):[]}function f(e,t){return HS(p(e),t)}function p(e){return VS(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){wb(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&lb(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function VS(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function HS(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
57
|
-
`;break;case-3:o=`\r
|
|
58
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function US(e){let t={constructs:fb([AS,...(e||{}).extensions||[]]),content:n(Mb),defined:[],document:n(Pb),flow:n(SS),lazy:{},string:n(TS),text:n(ES)};return t;function n(e){return n;function n(n){return BS(t,e,n)}}}function WS(e){for(;!gx(e););return e}var GS=/[\0\t\n\r]/g;function KS(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(GS.lastIndex=u,c=GS.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var qS=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function JS(e){return e.replace(qS,YS)}function YS(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return hb(n.slice(t?2:1),t?16:10)}return cb(n)||e}var XS={}.hasOwnProperty;function ZS(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),QS(n)(WS(US(n).document().write(KS()(e,t,!0))))}function QS(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(de),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(se),blockQuote:a(U),characterEscape:T,characterReference:T,codeFenced:a(re),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(re,o),codeText:a(ie,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ae),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(oe),hardBreakEscape:a(ce),hardBreakTrailing:a(ce),htmlFlow:a(le,o),htmlFlowData:T,htmlText:a(le,o),htmlTextData:T,image:a(ue),label:o,link:a(de),listItem:a(pe),listItemValue:f,listOrdered:a(fe,d),listUnordered:a(fe),paragraph:a(me),reference:ee,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(se),strong:a(he),thematicBreak:a(_e)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ne,autolinkProtocol:te,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:B,characterReferenceMarkerNumeric:B,characterReferenceValue:V,characterReference:H,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:z,resourceDestinationString:I,resourceTitleString:L,resource:R,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};eC(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];XS.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||nC).call(a,void 0,e[0])}for(r.position={start:$S(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:$S(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:$S(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||nC).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+xy({start:e.start,end:e.end})+`): it’s not open`);n.position.end=$S(e.end)}function u(){return rb(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gb(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=ge(),n.position={start:$S(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=$S(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=$S(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=JS(t),n.identifier=gb(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function R(){this.data.inReference=void 0}function ee(){this.data.referenceType=`collapsed`}function z(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gb(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function B(e){this.data.characterReferenceType=e.type}function V(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=hb(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=cb(t);let i=this.stack[this.stack.length-1];i.value+=r}function H(e){let t=this.stack.pop();t.position.end=$S(e.end)}function te(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ne(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function U(){return{type:`blockquote`,children:[]}}function re(){return{type:`code`,lang:null,meta:null,value:``}}function ie(){return{type:`inlineCode`,value:``}}function ae(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function oe(){return{type:`emphasis`,children:[]}}function se(){return{type:`heading`,depth:0,children:[]}}function ce(){return{type:`break`}}function le(){return{type:`html`,value:``}}function ue(){return{type:`image`,title:null,url:``,alt:null}}function de(){return{type:`link`,title:null,url:``,children:[]}}function fe(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function pe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function me(){return{type:`paragraph`,children:[]}}function he(){return{type:`strong`,children:[]}}function ge(){return{type:`text`,value:``}}function _e(){return{type:`thematicBreak`}}}function $S(e){return{line:e.line,column:e.column,offset:e.offset}}function eC(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?eC(e,r):tC(e,r)}}function tC(e,t){let n;for(n in t)if(XS.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function nC(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+xy({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xy({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+xy({start:t.start,end:t.end})+`) is still open`)}function rC(e){let t=this;t.parser=n;function n(n){return ZS(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function iC(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function aC(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
59
|
-
`}]}function oC(e,t){let n=t.value?t.value+`
|
|
60
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function sC(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cC(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lC(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Ab(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function uC(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dC(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function fC(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function pC(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fC(e,t);let i={src:Ab(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function mC(e,t){let n={src:Ab(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function hC(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function gC(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fC(e,t);let i={href:Ab(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function _C(e,t){let n={href:Ab(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function vC(e,t,n){let r=e.all(t),i=n?yC(n):bC(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
61
|
-
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
62
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function yC(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=bC(n[r])}return t}function bC(e){return e.spread??e.children.length>1}function xC(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function SC(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CC(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function wC(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TC(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=vy(t.children[1]),o=_y(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function EC(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function DC(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var OC=9,kC=32;function AC(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(jC(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(jC(t.slice(i),i>0,!1)),a.join(``)}function jC(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===OC||t===kC;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===OC||t===kC;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function MC(e,t){let n={type:`text`,value:AC(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function NC(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var PC={blockquote:iC,break:aC,code:oC,delete:sC,emphasis:cC,footnoteReference:lC,heading:uC,html:dC,imageReference:pC,image:mC,inlineCode:hC,linkReference:gC,link:_C,listItem:vC,list:xC,paragraph:SC,root:CC,strong:wC,table:TC,tableCell:DC,tableRow:EC,text:MC,thematicBreak:NC,toml:FC,yaml:FC,definition:FC,footnoteDefinition:FC};function FC(){}var IC=typeof self==`object`?self:globalThis,LC=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new IC[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new IC[a](o),i)};return r},RC=e=>LC(new Map,e)(0),zC=``,{toString:BC}={},{keys:VC}=Object,HC=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=BC.call(e).slice(8,-1);switch(n){case`Array`:return[1,zC];case`Object`:return[2,zC];case`Date`:return[3,zC];case`RegExp`:return[4,zC];case`Map`:return[5,zC];case`Set`:return[6,zC];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},UC=([e,t])=>e===0&&(t===`function`||t===`symbol`),WC=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=HC(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of VC(r))(e||!UC(HC(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(UC(HC(n))||UC(HC(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!UC(HC(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},GC=(e,{json:t,lossy:n}={})=>{let r=[];return WC(!(t||n),!!t,new Map,r)(e),r},KC=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?RC(GC(e,t)):structuredClone(e):(e,t)=>RC(GC(e,t));function qC(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function JC(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function YC(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||qC,r=e.options.footnoteBackLabel||JC,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=Ab(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...KC(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
63
|
-
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
64
|
-
`}]}}var XC=(function(e){if(e==null)return tw;if(typeof e==`function`)return ew(e);if(typeof e==`object`)return Array.isArray(e)?ZC(e):QC(e);if(typeof e==`string`)return $C(e);throw Error(`Expected function, string, or object as test`)});function ZC(e){let t=[],n=-1;for(;++n<e.length;)t[n]=XC(e[n]);return ew(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function QC(e){let t=e;return ew(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function $C(e){return ew(t);function t(t){return t&&t.type===e}}function ew(e){return t;function t(t,n,r){return!!(nw(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function tw(){return!0}function nw(e){return typeof e==`object`&&!!e&&`type`in e}function rw(e){return e}var iw=[];function aw(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=XC(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,`name`,{value:`node (`+rw(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=iw,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=ow(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function ow(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?iw:[e]}function sw(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),aw(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var cw={}.hasOwnProperty,lw={};function uw(e,t){let n=t||lw,r=new Map,i=new Map,a={all:s,applyData:fw,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...PC,...n.handlers},one:o,options:n,patch:dw,wrap:mw};return sw(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(cw.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=KC(n);return r.children=a.all(e),r}return KC(e)}return(a.options.unknownHandler||pw)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=hw(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=hw(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function dw(e,t){e.position&&(t.position=by(e))}function fw(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,KC(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function pw(e,t){let n=t.data||{},r=`value`in t&&!(cw.call(n,`hProperties`)||cw.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function mw(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
65
|
-
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
66
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
67
|
-
`}),n}function hw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function gw(e,t){let n=uw(e,t),r=n.one(e,void 0),i=YC(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
68
|
-
`},i)),a}function _w(e,t){return e&&`run`in e?async function(n,r){let i=gw(n,{file:r,...t});await e.run(i,r)}:function(n,r){return gw(n,{file:r,...e||t})}}function vw(e){if(e)throw e}var yw=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function bw(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function xw(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Sw(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Sw(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var Cw={basename:ww,dirname:Tw,extname:Ew,join:Dw,sep:`/`};function ww(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Aw(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Tw(e){if(Aw(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Ew(e){Aw(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Dw(...e){let t=-1,n;for(;++t<e.length;)Aw(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Ow(n)}function Ow(e){Aw(e);let t=e.codePointAt(0)===47,n=kw(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function kw(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Aw(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var jw={cwd:Mw};function Mw(){return`/`}function Nw(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Pw(e){if(typeof e==`string`)e=new URL(e);else if(!Nw(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Fw(e)}function Fw(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Iw=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Lw=class{constructor(e){let t;t=e?Nw(e)?{path:e}:typeof e==`string`||Vw(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:jw.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Iw.length;){let e=Iw[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Iw.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Cw.basename(this.path):void 0}set basename(e){zw(e,`basename`),Rw(e,`basename`),this.path=Cw.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Cw.dirname(this.path):void 0}set dirname(e){Bw(this.basename,`dirname`),this.path=Cw.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Cw.extname(this.path):void 0}set extname(e){if(Rw(e,`extname`),Bw(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=Cw.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Nw(e)&&(e=Pw(e)),zw(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Cw.basename(this.path,this.extname):void 0}set stem(e){zw(e,`stem`),Rw(e,`stem`),this.path=Cw.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Ty(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Rw(e,t){if(e&&e.includes(Cw.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Cw.sep+"`")}function zw(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Bw(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Vw(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Hw=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Uw=l(yw(),1),Ww={}.hasOwnProperty,Gw=new class e extends Hw{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=xw()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Uw.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Jw(`data`,this.frozen),this.namespace[e]=t,this):Ww.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Jw(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=Zw(e),n=this.parser||this.Parser;return Kw(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Kw(`process`,this.parser||this.Parser),qw(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Zw(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);$w(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Kw(`processSync`,this.parser||this.Parser),qw(`processSync`,this.compiler||this.Compiler),this.process(e,r),Xw(`processSync`,`process`,t),n;function r(e,r){t=!0,vw(e),n=r}}run(e,t,n){Yw(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=Zw(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Xw(`runSync`,`run`,n),r;function i(e,t){vw(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Zw(t),r=this.compiler||this.Compiler;return qw(`stringify`,r),Yw(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Jw(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,Uw.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];bw(o)&&bw(r)&&(r=(0,Uw.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Kw(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function qw(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Jw(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Yw(e){if(!bw(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Xw(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Zw(e){return Qw(e)?e:new Lw(e)}function Qw(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function $w(e){return typeof e==`string`||eT(e)}function eT(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var tT=[],nT={allowDangerousHtml:!0},rT=/^(https?|ircs?|mailto|xmpp)$/i,iT=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function aT(e){let t=oT(e),n=sT(e);return cT(t.runSync(t.parse(n),n),e)}function oT(e){let t=e.rehypePlugins||tT,n=e.remarkPlugins||tT,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...nT}:nT;return Gw().use(rC).use(n).use(_w,r).use(t)}function sT(e){let t=e.children||``,n=new Lw;return typeof t==`string`?n.value=t:``+t,n}function cT(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||lT;for(let e of iT)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return sw(e,l),Ny(e,{Fragment:G.Fragment,components:i,ignoreInvalidStyle:!0,jsx:G.jsx,jsxs:G.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in tb)if(Object.hasOwn(tb,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=tb[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function lT(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||rT.test(e.slice(0,t))?e:``}function uT(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function dT(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function fT(e,t,n){let r=XC((n||{}).ignore||[]),i=pT(t),a=-1;for(;++a<i.length;)aw(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function pT(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([mT(e[0]),hT(e[1])])}return t}function mT(e){return typeof e==`string`?new RegExp(dT(e),`g`):e}function hT(e){return typeof e==`function`?e:function(){return e}}var gT=`phrasing`,_T=[`autolink`,`link`,`image`,`label`];function vT(){return{transforms:[ET],enter:{literalAutolink:bT,literalAutolinkEmail:xT,literalAutolinkHttp:xT,literalAutolinkWww:xT},exit:{literalAutolink:TT,literalAutolinkEmail:wT,literalAutolinkHttp:ST,literalAutolinkWww:CT}}}function yT(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:gT,notInConstruct:_T},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:gT,notInConstruct:_T},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:gT,notInConstruct:_T}]}}function bT(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function xT(e){this.config.enter.autolinkProtocol.call(this,e)}function ST(e){this.config.exit.autolinkProtocol.call(this,e)}function CT(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function wT(e){this.config.exit.autolinkEmail.call(this,e)}function TT(e){this.exit(e)}function ET(e){fT(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,DT],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,OT]],{ignore:[`link`,`linkReference`]})}function DT(e,t,n,r,i){let a=``;if(!jT(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!kT(n)))return!1;let o=AT(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function OT(e,t,n,r){return!jT(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function kT(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function AT(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=uT(e,`(`),a=uT(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function jT(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Ob(n)||Db(n))&&(!t||n!==47)}VT.peek=BT;function MT(){this.buffer()}function NT(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function PT(){this.buffer()}function FT(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function IT(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=gb(this.sliceSerialize(e)).toLowerCase(),n.label=t}function LT(e){this.exit(e)}function RT(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=gb(this.sliceSerialize(e)).toLowerCase(),n.label=t}function zT(e){this.exit(e)}function BT(){return`[`}function VT(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function HT(){return{enter:{gfmFootnoteCallString:MT,gfmFootnoteCall:NT,gfmFootnoteDefinitionLabelString:PT,gfmFootnoteDefinition:FT},exit:{gfmFootnoteCallString:IT,gfmFootnoteCall:LT,gfmFootnoteDefinitionLabelString:RT,gfmFootnoteDefinition:zT}}}function UT(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:VT},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
69
|
-
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?GT:WT))),s(),o}}function WT(e,t,n){return t===0?e:GT(e,t,n)}function GT(e,t,n){return(n?``:` `)+e}var KT=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];ZT.peek=QT;function qT(){return{canContainEols:[`delete`],enter:{strikethrough:YT},exit:{strikethrough:XT}}}function JT(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:KT}],handlers:{delete:ZT}}}function YT(e){this.enter({type:`delete`,children:[]},e)}function XT(e){this.exit(e)}function ZT(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function QT(){return`~`}function $T(e){return e.length}function eE(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||$T,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=tE(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=nE(r[d]);else{let e=nE(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
70
|
-
`)}function tE(e){return e==null?``:String(e)}function nE(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function rE(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),iE);return i(),o}function iE(e,t,n){return`>`+(n?``:` `)+e}function aE(e,t){return oE(e,t.inConstruct,!0)&&!oE(e,t.notInConstruct,!1)}function oE(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function sE(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
71
|
-
`&&aE(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
72
|
-
`}function cE(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function lE(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function uE(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function dE(e,t,n,r){let i=uE(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(lE(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,fE);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(cE(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
73
|
-
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
74
|
-
`),a&&(u+=s.move(a+`
|
|
75
|
-
`)),u+=s.move(c),l(),u}function fE(e,t,n){return(n?``:` `)+e}function pE(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function mE(e,t,n,r){let i=pE(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
76
|
-
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function hE(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function gE(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function _E(e,t,n){let r=Rb(e),i=Rb(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}vE.peek=yE;function vE(e,t,n,r){let i=hE(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=_E(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=gE(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=_E(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+gE(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function yE(e,t,n){return n.options.emphasis||`*`}function bE(e,t){let n=!1;return sw(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&rb(e)&&(t.options.setext||n))}function xE(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(bE(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
77
|
-
`,after:`
|
|
78
|
-
`});return r(),t(),o+`
|
|
79
|
-
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
80
|
-
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
81
|
-
`,...a.current()});return/^[\t ]/.test(l)&&(l=gE(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}SE.peek=CE;function SE(e){return e.value||``}function CE(){return`<`}wE.peek=TE;function wE(e,t,n,r){let i=pE(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function TE(){return`!`}EE.peek=DE;function EE(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function DE(){return`!`}OE.peek=kE;function OE(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function kE(){return"`"}function AE(e,t){let n=rb(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}jE.peek=ME;function jE(e,t,n,r){let i=pE(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(AE(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function ME(e,t,n){return AE(e,n)?`<`:`[`}NE.peek=PE;function NE(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function PE(){return`[`}function FE(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function IE(e){let t=FE(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function LE(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function RE(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function zE(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?LE(n):FE(n),s=e.ordered?o===`.`?`)`:`.`:IE(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),RE(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function BE(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function VE(e,t,n,r){let i=BE(n),a=n.bulletCurrent||FE(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function HE(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var UE=XC([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function WE(e,t,n,r){return(e.children.some(function(e){return UE(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function GE(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}KE.peek=qE;function KE(e,t,n,r){let i=GE(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=_E(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=gE(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=_E(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+gE(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function qE(e,t,n){return n.options.strong||`*`}function JE(e,t,n,r){return n.safe(e.value,r)}function YE(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function XE(e,t,n){let r=(RE(n)+(n.options.ruleSpaces?` `:``)).repeat(YE(n));return n.options.ruleSpaces?r.slice(0,-1):r}var ZE={blockquote:rE,break:sE,code:dE,definition:mE,emphasis:vE,hardBreak:sE,heading:xE,html:SE,image:wE,imageReference:EE,inlineCode:OE,link:jE,linkReference:NE,list:zE,listItem:VE,paragraph:HE,root:WE,strong:KE,text:JE,thematicBreak:XE};function QE(){return{enter:{table:$E,tableData:rD,tableHeader:rD,tableRow:tD},exit:{codeText:iD,table:eD,tableData:nD,tableHeader:nD,tableRow:nD}}}function $E(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function eD(e){this.exit(e),this.data.inTable=void 0}function tD(e){this.enter({type:`tableRow`,children:[]},e)}function nD(e){this.exit(e)}function rD(e){this.enter({type:`tableCell`,children:[]},e)}function iD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,aD));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function aD(e,t){return t===`|`?t:e}function oD(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
82
|
-
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
83
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return eE(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=ZE.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function sD(){return{exit:{taskListCheckValueChecked:lD,taskListCheckValueUnchecked:lD,paragraph:uD}}}function cD(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:dD}}}function lD(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function uD(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function dD(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=ZE.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function fD(){return[vT(),HT(),qT(),QE(),sD()]}function pD(e){return{extensions:[yT(),UT(e),JT(),oD(e),cD()]}}var mD={tokenize:OD,partial:!0},hD={tokenize:kD,partial:!0},gD={tokenize:AD,partial:!0},_D={tokenize:jD,partial:!0},vD={tokenize:MD,partial:!0},yD={name:`wwwAutolink`,tokenize:ED,previous:ND},bD={name:`protocolAutolink`,tokenize:DD,previous:PD},xD={name:`emailAutolink`,tokenize:TD,previous:FD},SD={};function CD(){return{text:SD}}for(var wD=48;wD<123;)SD[wD]=xD,wD++,wD===58?wD=65:wD===91&&(wD=97);SD[43]=xD,SD[45]=xD,SD[46]=xD,SD[95]=xD,SD[72]=[xD,bD],SD[104]=[xD,bD],SD[87]=[xD,yD],SD[119]=[xD,yD];function TD(e,t,n){let r=this,i,a;return o;function o(t){return!ID(t)||!FD.call(r,r.previous)||LD(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return ID(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(vD,u,l)(t):t===45||t===95||vb(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&_b(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function ED(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!ND.call(r,r.previous)||LD(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(mD,e.attempt(hD,e.attempt(gD,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function DD(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&PD.call(r,r.previous)&&!LD(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(_b(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||bb(t)||Tb(t)||Ob(t)||Db(t)?n(t):e.attempt(hD,e.attempt(gD,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function OD(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function kD(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(_D,c,s)(t):t===null||Tb(t)||Ob(t)||t!==45&&Db(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function AD(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(_D,t,a)(o):o===null||Tb(o)||Ob(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function jD(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||Tb(o)||Ob(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Tb(e)||Ob(e)?t(e):r(e)}function a(e){return _b(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):_b(t)?(e.consume(t),o):n(t)}}function MD(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return vb(e)?n(e):t(e)}}function ND(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tb(e)}function PD(e){return!_b(e)}function FD(e){return!(e===47||ID(e))}function ID(e){return e===43||e===45||e===46||e===95||vb(e)}function LD(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var RD={tokenize:KD,partial:!0};function zD(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:UD,continuation:{tokenize:WD},exit:GD}},text:{91:{name:`gfmFootnoteCall`,tokenize:HD},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:BD,resolveTo:VD}}}}function BD(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=gb(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function VD(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function HD(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||Tb(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(gb(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Tb(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function UD(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Tb(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=gb(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Tb(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),jb(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function WD(e,t,n){return e.check(Kb,t,e.attempt(RD,t,n))}function GD(e){e.exit(`gfmFootnoteDefinition`)}function KD(e,t,n){let r=this;return jb(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function qD(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&lb(o,o.length,0,zb(s,e.slice(r+1,n),t)),lb(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),lb(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Rb(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Rb(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var JD=class{constructor(){this.map=[]}add(e,t,n){YD(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function YD(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function XD(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function ZD(){return{flow:{null:{name:`table`,tokenize:QD,resolveAll:$D}}}}function QD(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):wb(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Eb(t)?jb(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Tb(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Eb(t)?jb(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Eb(t)?jb(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||wb(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Eb(t)?jb(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||wb(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||wb(n)?(e.exit(`tableRow`),t(n)):Eb(n)?jb(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Tb(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function $D(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new JD;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(tO(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=eO(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=eO(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=eO(f,t,o,i,n,d)):(o[0]=o[1],d=eO(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&tO(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=XD(t.events,n))}return e}function eO(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},nO(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=nO(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=nO(t.events,n[2]),a=nO(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},nO(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function tO(e,t,n,r,i){let a=[],o=nO(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function nO(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var rO={name:`tasklistCheck`,tokenize:aO};function iO(){return{text:{91:rO}}}function aO(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Tb(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return wb(r)?t(r):Eb(r)?e.check({tokenize:oO},t,n)(r):n(r)}}function oO(e,t,n){return jb(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function sO(e){return fb([CD(),zD(),qD(e),ZD(),iO()])}var cO={};function lO(e){let t=this,n=e||cO,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(sO(n)),a.push(fD()),o.push(pD(n))}function uO({content:e,className:t,compact:n=!1}){return(0,G.jsx)(`div`,{className:J(n?`prose-myco-compact`:`prose-myco`,t),children:(0,G.jsx)(aT,{remarkPlugins:[lO],children:e})})}var dO={info:`bg-primary`,success:`bg-green-500`,warning:`bg-secondary`,error:`bg-tertiary`},fO={info:Jo,success:So,warning:js,error:yo},pO={unread:`New`,read:`Earlier`},mO=`notification-panel`;function hO(e){let t=Math.floor(Date.now()/1e3)-e;if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function gO({title:e,count:t}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-[0.18em] text-on-surface-variant`,children:e}),(0,G.jsx)(`span`,{className:`text-[11px] text-on-surface-variant/70`,children:t})]})}function _O({notification:e,onOpen:t,onDismiss:n}){let r=fO[e.level],i=e.status===`unread`;return(0,G.jsx)(`div`,{onClick:()=>t(e),className:J(`group cursor-pointer rounded-lg border border-transparent px-4 py-3 transition-colors hover:border-outline-variant/20 hover:bg-surface-container-high/70`,i&&`border-primary/10 bg-primary/[0.04]`),children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`relative mt-0.5 shrink-0`,children:[(0,G.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-surface-container-high text-on-surface-variant`,children:(0,G.jsx)(r,{className:`h-4 w-4`})}),i&&(0,G.jsx)(`span`,{className:J(`absolute -top-0.5 -right-0.5 h-2.5 w-2.5 rounded-full ring-2 ring-surface-container`,dO[e.level])})]}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:J(`text-sm font-medium`,i?`text-on-surface`:`text-on-surface-variant`),children:e.title}),(0,G.jsx)(`span`,{className:`rounded-full bg-surface-container-high px-2 py-0.5 text-[10px] uppercase tracking-wider text-on-surface-variant`,children:e.domain})]}),e.message&&(0,G.jsx)(uO,{content:e.message,compact:!0,className:`line-clamp-3 text-xs leading-5 text-on-surface-variant`})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[(0,G.jsx)(`span`,{className:`pt-0.5 text-[10px] font-mono text-on-surface-variant/70`,children:hO(e.created_at)}),(0,G.jsx)(`button`,{onClick:t=>n(t,e),className:`rounded p-0.5 text-on-surface-variant/40 opacity-0 transition hover:text-on-surface-variant group-hover:opacity-100`,"aria-label":`Dismiss`,children:(0,G.jsx)(Is,{className:`h-3.5 w-3.5`})})]})]})})]})})}function vO({open:e,onClose:t}){let{data:n,refetch:r}=dv({limit:50,enabled:e,pollCategory:`realtime`,refetchInterval:Hs.LOGS}),i=pv(),a=hv(),o=mv(),s=Nn();(0,W.useEffect)(()=>{e&&r()},[e,r]),(0,W.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]);let c=(0,W.useCallback)(e=>{e.status===`unread`&&i.mutate({id:e.id,status:`read`}),e.link&&(s(e.link,{state:{source:mO,triggeredAt:Date.now()}}),t())},[i,s,t]),l=(0,W.useCallback)((e,t)=>{e.stopPropagation(),i.mutate({id:t.id,status:`dismissed`})},[i]),u=(n?.items??[]).filter(e=>e.status!==`dismissed`),d=n?.unread_count??0,f=u.filter(e=>e.status===`unread`),p=u.filter(e=>e.status!==`unread`);return(0,G.jsxs)(G.Fragment,{children:[e&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-40 bg-surface-dim/40 backdrop-blur-xs transition-opacity`,onClick:t,"aria-hidden":`true`}),(0,G.jsxs)(`aside`,{className:J(`fixed top-0 right-0 bottom-0 z-50 flex w-96 max-w-[calc(100vw-3rem)] flex-col border-l border-outline-variant/20 bg-surface-container shadow-2xl transition-transform duration-200 ease-out`,e?`translate-x-0`:`translate-x-full`),children:[(0,G.jsxs)(`div`,{className:`border-b border-outline-variant/20 px-4 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(lo,{className:`h-4 w-4 shrink-0 text-primary`}),(0,G.jsx)(`h2`,{className:`min-w-0 text-sm font-medium text-on-surface`,children:`Notifications`}),d>0&&(0,G.jsx)(`span`,{className:`inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-primary/15 px-1.5 text-xs font-medium text-primary`,children:d})]})}),(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`h-7 shrink-0 px-2`,children:(0,G.jsx)(Is,{className:`h-4 w-4`})})]}),(d>0||u.length>0)&&(0,G.jsxs)(`div`,{className:`mt-3 flex items-center justify-end gap-1 border-t border-outline-variant/10 pt-3`,children:[d>0&&(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:e=>{e.stopPropagation(),a.mutate(void 0)},title:`Mark all as read`,className:`h-7 gap-1 px-2 text-xs text-on-surface-variant`,children:[(0,G.jsx)(ts,{className:`h-3.5 w-3.5`}),`Mark all read`]}),u.length>0&&(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:e=>{e.stopPropagation(),o.mutate(void 0)},title:`Clear all notifications`,className:`h-7 gap-1 px-2 text-xs text-on-surface-variant`,children:[(0,G.jsx)(ks,{className:`h-3.5 w-3.5`}),`Clear`]})]})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:u.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 px-6 text-center`,children:[(0,G.jsx)(lo,{className:`h-5 w-5 text-on-surface-variant/50`}),(0,G.jsx)(`div`,{className:`text-sm text-on-surface-variant`,children:`No notifications yet`}),(0,G.jsx)(`div`,{className:`text-xs text-on-surface-variant/70`,children:`New events will appear here whether they display as banners or summary-only items.`})]}):(0,G.jsxs)(`div`,{className:`space-y-4 px-3 py-3`,children:[f.length>0&&(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(gO,{title:pO.unread,count:f.length}),(0,G.jsx)(`div`,{className:`space-y-2`,children:f.map(e=>(0,G.jsx)(_O,{notification:e,onOpen:c,onDismiss:l},e.id))})]}),p.length>0&&(0,G.jsxs)(`section`,{className:`space-y-2`,children:[(0,G.jsx)(gO,{title:pO.read,count:p.length}),(0,G.jsx)(`div`,{className:`space-y-2`,children:p.map(e=>(0,G.jsx)(_O,{notification:e,onOpen:c,onDismiss:l},e.id))})]})]})})]})]})}function yO(){let{effective:e}=Na(),t=e?.notifications?.system_notifications??!1,{data:n,refetch:r}=dv({status:`unread`,mode:`banner`,limit:5,enabled:t,pollCategory:`heartbeat`,refetchInterval:Hs.PROGRESS,includeDaemon:!0}),i=(0,W.useRef)(new Set);return(0,W.useEffect)(()=>{t&&`Notification`in window&&Notification.permission===`default`&&Notification.requestPermission()},[t]),(0,W.useEffect)(()=>{if(!t||!(`Notification`in window)||Notification.permission!==`granted`||document.hasFocus())return;let e=n?.items??[];for(let t of e)i.current.has(t.id)||(i.current.add(t.id),bO(t))},[t,n]),(0,W.useEffect)(()=>{if(!t)return;let e=()=>{(document.hidden||!document.hasFocus())&&r()};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`blur`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`blur`,e)}},[t,r]),null}function bO(e){try{new window.Notification(e.title,{body:e.message??void 0,tag:e.id,icon:`/favicon.svg`})}catch{}}var xO=[`sage`,`moss`,`terracotta`,`dusk`,`plum`,`slate`],SO=[`light`,`dark`,`system`],CO=[`default`,`geist-mono`,`system`,`sf-mono`,`fira-code`,`jetbrains-mono`],wO=[`compact`,`normal`,`comfy`],TO={personal:`Personal`,project:`Project`,grove:`Grove`,"all-groves":`All Groves`,machine:`Machine`},EO={personal:`This setting is overridden on this machine`,project:`This setting is using the shared project value`,grove:`This setting applies to every project in this Grove`,"all-groves":`This view aggregates every Grove on this machine`,machine:`This setting applies to every Grove on this machine`},DO={personal:`border-sage/40 bg-sage/5 text-sage`,project:`border-[var(--ghost-border)] bg-surface-container/40 text-on-surface-variant`,grove:`border-ochre/40 bg-ochre/5 text-ochre`,"all-groves":`border-terracotta/40 bg-terracotta/5 text-terracotta`,machine:`border-terracotta/40 bg-terracotta/5 text-terracotta`};function OO({scope:e}){let t=TO[e];return(0,G.jsxs)(`span`,{title:EO[e],className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider ${DO[e]}`,children:[(0,G.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full ${e===`personal`?`bg-sage`:`bg-outline-variant/80`}`,"aria-hidden":!0}),t]})}function kO(e){let[t,n]=(0,W.useState)(!1),r=(0,W.useRef)(null);if((0,W.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)},i=e=>{e.key===`Escape`&&n(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,i)}},[t]),e.mode===`local-default`){let{onPromote:i,onReset:a}=e;return(0,G.jsxs)(`span`,{ref:r,className:`relative inline-block`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-haspopup":`menu`,"aria-expanded":t,title:`This setting is overridden on this machine`,className:`cursor-pointer transition-colors hover:bg-sage/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 rounded-sm`,children:(0,G.jsx)(OO,{scope:`personal`})}),t&&(0,G.jsxs)(`div`,{role:`menu`,className:`absolute left-0 top-full z-10 mt-1 w-44 rounded-md border border-[var(--ghost-border)] bg-surface-container-high p-1 text-xs shadow-lg`,children:[(0,G.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{i(),n(!1)},className:`block w-full rounded px-2 py-1 text-left hover:bg-surface-container-highest focus-visible:outline-none focus-visible:bg-surface-container-highest`,children:`Save to project`}),(0,G.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{a(),n(!1)},className:`block w-full rounded px-2 py-1 text-left hover:bg-surface-container-highest focus-visible:outline-none focus-visible:bg-surface-container-highest`,children:`Reset to project`})]})]})}let{hasLocalOverride:i,defaultScopeBadge:a,onSavePersonal:o,onReset:s}=e,c=i?`personal`:a;return(0,G.jsxs)(`span`,{ref:r,className:`relative inline-block`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-haspopup":`menu`,"aria-expanded":t,title:i?`This setting is overridden on this machine`:EO[a],className:`cursor-pointer transition-colors hover:bg-sage/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 rounded-sm`,children:(0,G.jsx)(OO,{scope:c})}),t&&(0,G.jsx)(`div`,{role:`menu`,className:`absolute left-0 top-full z-10 mt-1 w-44 rounded-md border border-[var(--ghost-border)] bg-surface-container-high p-1 text-xs shadow-lg`,children:i?(0,G.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{s(),n(!1)},className:`block w-full rounded px-2 py-1 text-left hover:bg-surface-container-highest focus-visible:outline-none focus-visible:bg-surface-container-highest`,children:[`Reset to `,TO[a]]}):(0,G.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{o(),n(!1)},className:`block w-full rounded px-2 py-1 text-left hover:bg-surface-container-highest focus-visible:outline-none focus-visible:bg-surface-container-highest`,children:`Save Personal`})})]})}var AO={sage:{label:`Sage`,swatch:`#abcfb8`},moss:{label:`Moss`,swatch:`#9ca884`},terracotta:{label:`Terracotta`,swatch:`#d28a73`},dusk:{label:`Dusk`,swatch:`#8faed1`},plum:{label:`Plum`,swatch:`#b59ec8`},slate:{label:`Slate`,swatch:`#a6b0b8`}},jO={light:{icon:Es,label:`Light`},dark:{icon:os,label:`Dark`},system:{icon:as,label:`System`}},MO={default:`Default`,"geist-mono":`Geist`,system:`System`,"sf-mono":`SF Mono`,"fira-code":`Fira Code`,"jetbrains-mono":`JetBrains`},NO=`myco-ui-appearance-expanded`;function PO(){let e=typeof window<`u`?localStorage.getItem(NO):null;return e===null?!0:e===`true`}function FO({collapsed:e}){let{effective:t,local:n,set:r,resetKey:i,saveAllAsProject:a,resetAll:o}=Ga(),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(PO);(0,W.useEffect)(()=>{localStorage.setItem(NO,String(l))},[l]);let d=e=>n[e]!==void 0,f=(e,t)=>{r(e,t,`local`).catch(e=>console.error(`[appearance] write failed`,e))};if(e)return null;let p=(e,n,a)=>(0,G.jsxs)(`div`,{id:Xa(`appearance.${n}`),"data-config-field":`appearance.${n}`,className:`rounded-md transition-all duration-300`,children:[(0,G.jsxs)(`div`,{className:`flex items-center text-xs text-on-surface-variant`,children:[e,d(n)?(0,G.jsx)(kO,{mode:`local-default`,onPromote:()=>r(n,t[n],`project`).catch(e=>console.error(`[appearance] promote failed`,e)),onReset:()=>i(n).catch(e=>console.error(`[appearance] reset failed`,e))}):(0,G.jsx)(OO,{scope:`project`})]}),a]});return(0,G.jsxs)(`div`,{id:Ya.appearance,className:`rounded-md border border-[var(--ghost-border)] p-3 ${l?`space-y-3`:``}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`-m-1 flex flex-1 items-center gap-1.5 rounded p-1 text-left hover:bg-surface-container-high`,"aria-expanded":l,"aria-label":l?`Collapse appearance section`:`Expand appearance section`,children:[(0,G.jsx)(ho,{className:`h-3 w-3 text-on-surface-variant transition-transform ${l?``:`-rotate-90`}`}),(0,G.jsx)(`h3`,{className:`text-[10px] uppercase tracking-[0.22em] text-on-surface-variant`,children:`Appearance`})]}),l&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>c(e=>!e),className:`rounded p-1 hover:bg-surface-container-high`,"aria-label":`Appearance menu`,children:(0,G.jsx)(No,{className:`h-3.5 w-3.5`})})]}),l&&s&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>{a(),c(!1)},className:`rounded px-2 py-1 text-left hover:bg-surface-container-high`,children:`Save current as project defaults`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{o(),c(!1)},className:`rounded px-2 py-1 text-left hover:bg-surface-container-high`,children:`Reset all to project defaults`})]}),l&&(0,G.jsxs)(G.Fragment,{children:[p(`Color theme`,`theme`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-6 gap-1.5`,children:xO.map(e=>{let n=AO[e];return(0,G.jsx)(`button`,{type:`button`,onClick:()=>f(`theme`,e),title:n.label,"aria-label":n.label,className:`relative aspect-square rounded-md border ${t.theme===e?`border-primary`:`border-[var(--ghost-border)]`}`,style:{backgroundColor:n.swatch},children:t.theme===e&&(0,G.jsx)(mo,{className:`absolute inset-0 m-auto h-3 w-3 text-on-surface`})},e)})})),p(`Mode`,`mode`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-3 gap-1.5`,children:SO.map(e=>{let{icon:n,label:r}=jO[e];return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>f(`mode`,e),className:`flex items-center justify-center gap-1 rounded-md border py-1 text-xs ${t.mode===e?`border-primary text-on-surface`:`border-[var(--ghost-border)] text-on-surface-variant`}`,"aria-label":r,children:[(0,G.jsx)(n,{className:`h-3 w-3`}),` `,r]},e)})})),p(`Font`,`font`,(0,G.jsx)(`select`,{value:t.font,onChange:e=>f(`font`,e.target.value),className:`mt-2 h-8 w-full rounded-md border border-[var(--ghost-border)] bg-[var(--surface-container-lowest)] px-2 text-xs`,children:CO.map(e=>(0,G.jsx)(`option`,{value:e,children:MO[e]},e))})),p(`Density`,`density`,(0,G.jsx)(`div`,{className:`mt-2 grid grid-cols-3 gap-1.5`,children:wO.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>f(`density`,e),className:`rounded-md border py-1 text-xs capitalize ${t.density===e?`border-primary text-on-surface`:`border-[var(--ghost-border)] text-on-surface-variant`}`,children:e},e))}))]})]})}function IO(){return Vs({queryKey:[`git-identity`],queryFn:({signal:e})=>$i(`/git/status`,{signal:e}),refetchInterval:Hs.GIT_IDENTITY,pollCategory:`standard`})}function LO(e){if(!e)return`?`;let t=e.trim();if(!t)return`?`;let n=t.split(/\s+/),r=n[0]??``;if(n.length===1)return r.slice(0,2).toUpperCase();let i=n[n.length-1]??``;return((r[0]??``)+(i[0]??``)).toUpperCase()}function RO({data:e,isPending:t,isError:n,className:r}){if(t||n||!e)return(0,G.jsxs)(`button`,{type:`button`,disabled:!0,"data-testid":`git-identity-pill`,className:J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 text-on-surface-variant`,r),title:n?`Failed to load git state`:`Loading git state`,children:[(0,G.jsx)(Go,{className:`h-3 w-3`}),(0,G.jsx)(`span`,{className:`font-mono text-xs`,children:`—`})]});let i=LO(e.author);return(0,G.jsxs)(`button`,{type:`button`,title:`${e.author} <${e.author_email}> · ${e.branch}${e.dirty?` (dirty)`:``}`,"data-testid":`git-identity-pill`,className:J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1 hover:bg-surface-container-high transition-colors`,r),children:[(0,G.jsx)(Go,{className:`h-3 w-3 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex flex-col items-start leading-tight`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:e.branch}),(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant inline-flex items-center gap-1`,children:[e.dirty&&(0,G.jsx)(`span`,{title:`working tree dirty`,className:`text-secondary`,children:`●`}),e.ahead>0&&(0,G.jsxs)(`span`,{title:`ahead of upstream`,children:[`↑`,e.ahead]}),e.behind>0&&(0,G.jsxs)(`span`,{title:`behind upstream`,children:[`↓`,e.behind]}),(0,G.jsx)(`span`,{children:e.author})]})]}),(0,G.jsx)(`span`,{className:`ml-1 inline-flex h-6 w-6 items-center justify-center rounded-full bg-primary/20 font-sans text-[10px] font-semibold text-primary`,children:i})]})}var zO={sage:`bg-primary`,ochre:`bg-secondary`,terracotta:`bg-tertiary`,outline:`bg-outline-variant`};function BO({tone:e,pulse:t=!1,sizePx:n=6,className:r}){return(0,G.jsx)(`span`,{"data-testid":`status-dot`,"data-tone":e,"data-pulsing":t?`true`:`false`,className:J(`inline-block rounded-full`,zO[e],t&&`animate-pulse`,r),style:{width:n,height:n},"aria-hidden":!0})}function VO(e){return e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d ${Math.floor(e%86400/3600)}h`}function HO({uptimeSeconds:e,version:t,className:n}){return(0,G.jsxs)(`div`,{className:J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1`,n),title:t?`Daemon uptime · ${t}`:`Daemon uptime`,"aria-live":`polite`,children:[(0,G.jsx)(BO,{tone:`sage`}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`daemon`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:e===void 0?`—`:VO(e)}),t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`text-on-surface-variant`,children:`·`}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[`v`,t]})]})]})}function UO({className:e}){let{data:t}=Zs();return(0,G.jsx)(HO,{uptimeSeconds:t?.daemon.uptime_seconds,version:t?.daemon.version,className:e})}function WO(e,t){return!t||t<=0?0:Math.floor(e/t*100)}function GO({describedCount:e,entriesCount:t,className:n}){let r=e!==void 0&&t!==void 0,i=r?WO(e,t):null,a=r&&i<100;return(0,G.jsxs)(`div`,{className:J(`inline-flex items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 py-1`,n),title:`Cortex (Canopy) describe coverage`,children:[(0,G.jsx)(BO,{tone:a?`ochre`:`sage`,pulse:a}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`cortex`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:i===null?`—`:`${i}%`})]})}function KO({className:e}){let{data:t}=Zs();return(0,G.jsx)(GO,{describedCount:t?.canopy.described_count,entriesCount:t?.canopy.entries_count,className:e})}var qO={"/":`Dashboard`,"/sessions":`Sessions`,"/cortex":`Cortex`,"/mycelium":`Mycelium`,"/skills":`Skills`,"/agent":`Agent`,"/settings":`Settings`,"/logs":`Logs`,"/machine":`Machine`,"/groves":`Groves`};function JO(e){let t=e,n=e.match(/^\/g\/[^/]+\/p\/[^/]+(\/.*)?$/);if(n)t=n[1]||`/`;else{let n=e.match(/^\/g\/[^/]+(\/.*)?$/);n&&(t=n[1]||`/`)}if(t===`/`)return[`Dashboard`];let r=t.split(`/`).filter(Boolean);return[qO[`/${r[0]}`]??r[0]]}function YO({onOpenSearch:e,onOpenNotifications:t,unreadCount:n,className:r}){let i=JO(An().pathname),a=IO();return(0,G.jsxs)(`header`,{className:J(`sticky top-0 z-20 flex h-12 items-center gap-3 border-b border-outline-variant/20 bg-surface-container/90 backdrop-blur px-4`,r),children:[(0,G.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`flex items-center gap-1 font-sans text-xs text-on-surface-variant`,children:i.map((e,t)=>(0,G.jsxs)(`span`,{className:J(t===i.length-1&&`text-on-surface`),children:[t>0&&(0,G.jsx)(`span`,{className:`mx-1`,children:`/`}),e]},t))}),(0,G.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Search`,className:`ml-auto inline-flex h-7 items-center gap-2 rounded-md border border-outline-variant/30 bg-surface-container px-2 text-on-surface-variant hover:bg-surface-container-high transition-colors`,children:[(0,G.jsx)(_s,{className:`h-3 w-3`}),(0,G.jsx)(`span`,{className:`font-sans text-xs`,children:`Search`}),(0,G.jsxs)(`kbd`,{className:`inline-flex items-center gap-0.5 font-mono text-[10px] text-on-surface-variant/70`,children:[(0,G.jsx)(Oo,{className:`h-2.5 w-2.5`}),`K`]})]}),(0,G.jsx)(UO,{}),(0,G.jsx)(KO,{}),(0,G.jsx)(RO,{data:a.data,isPending:a.isPending,isError:a.isError}),(0,G.jsxs)(`button`,{type:`button`,onClick:t,"aria-label":`Notifications`,className:`relative rounded-md p-1.5 text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface transition-colors`,children:[(0,G.jsx)(lo,{className:`h-4 w-4`}),n>0&&(0,G.jsx)(`span`,{className:`absolute top-0.5 right-0.5 h-2 w-2 rounded-full bg-primary`})]})]})}var XO=[`Project`,`Observability`,`Grove management`,`Settings`],ZO=[{to:`/`,label:`Dashboard`,icon:Zo,scope:`project`,category:`Project`},{to:`/sessions`,label:`Sessions`,icon:is,scope:`project`,category:`Project`},{to:`/agent`,label:`Agent`,icon:fo,scope:`project`,category:`Project`},{to:`/cortex`,label:`Cortex`,icon:po,scope:`project`,category:`Project`},{to:`/mycelium`,label:`Mycelium`,icon:ss,scope:`project`,category:`Project`},{to:`/skills`,label:`Skills`,icon:Cs,scope:`project`,category:`Project`},{to:`/g/:groveSlug/operations`,label:`Operations`,icon:oo,scope:`grove`,category:`Observability`},{to:`/logs`,label:`Logs`,icon:gs,scope:`machine`,category:`Observability`},{to:`/g/:groveSlug/dashboard`,label:`Grove`,icon:As,scope:`grove`,category:`Grove management`},{to:`/groves`,label:`Groves`,icon:Wo,scope:`machine`,category:`Grove management`},{to:`/g/:groveSlug/team`,label:`Team`,icon:Ns,scope:`grove`,category:`Grove management`},{to:`/settings`,label:`Settings`,icon:bs,scope:`machine`,category:`Settings`}],QO=`myco-ui-sidebar-collapsed`,$O=768,ek=80,tk=2e3,nk=[`ring-2`,`ring-primary/40`,`bg-primary/5`];function rk(){let[e,t]=(0,W.useState)(()=>localStorage.getItem(QO)===`true`);return{collapsed:e,toggle:(0,W.useCallback)(()=>{t(e=>{let t=!e;return localStorage.setItem(QO,String(t)),t})},[])}}function ik(){let[e,t]=(0,W.useState)(!1),[n,r]=(0,W.useState)(()=>typeof window<`u`&&window.innerWidth<$O);return(0,W.useEffect)(()=>{let e=window.matchMedia(`(max-width: ${$O-1}px)`),n=e=>{r(e.matches),e.matches||t(!1)};return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),(0,W.useEffect)(()=>{t(!1)},[An().pathname]),(0,W.useEffect)(()=>{if(e)return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=``}},[e]),{open:e,isMobile:n,toggle:(0,W.useCallback)(()=>t(e=>!e),[]),close:(0,W.useCallback)(()=>t(!1),[])}}function ak({collapsed:e=!1}){let{restart:t,isRestarting:n}=ec();return(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(),disabled:n,title:e?n?`Restarting...`:`Restart Daemon`:void 0,className:J(`text-on-surface-variant hover:text-on-surface`,e?`w-8 p-0 justify-center`:`w-full justify-start gap-2`),children:[(0,G.jsx)(ms,{className:J(`h-4 w-4`,n&&`animate-spin`)}),!e&&(0,G.jsx)(`span`,{children:n?`Restarting...`:`Restart Daemon`})]})}function ok({collapsed:e}){let{data:t}=Zs(),n=t?.daemon.runtime;if(!n||n.source===`stable`)return null;let r=n.source===`dev`,i=r?`DEV`:`BETA`,a=r?`Daemon is running from a dev binary (make dev-link / npm link).`:`Daemon is running from the managed beta runtime under ~/.myco/runtime/.`,o=r?`bg-tertiary/20 text-tertiary border-tertiary/40`:`bg-secondary/20 text-secondary border-secondary/40`;return e?(0,G.jsx)(`div`,{className:J(`mx-auto flex h-5 w-8 items-center justify-center rounded border text-[10px] font-bold tracking-wider`,o),title:a,children:i}):(0,G.jsxs)(`div`,{className:J(`mx-2 flex items-center justify-center rounded border px-2 py-1 text-[11px] font-semibold tracking-wider`,o),title:a,children:[i,` runtime`]})}function sk({collapsed:e,onSearchOpen:t,onNotificationsOpen:n,unreadCount:r,onCollapseToggle:i,showCollapseToggle:a}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(sv,{collapsed:e}),(0,G.jsxs)(`div`,{className:`px-2 pt-2 pb-1 space-y-0.5`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:t,title:e?`Search (⌘K)`:void 0,className:J(`flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,e?`justify-center px-2 py-2`:`gap-3 px-3 py-2`),children:[(0,G.jsx)(_s,{className:`h-4 w-4 shrink-0`}),!e&&(0,G.jsx)(`span`,{className:`flex-1 text-left`,children:`Search`}),!e&&(0,G.jsxs)(`kbd`,{className:`text-xs text-on-surface-variant/60 font-mono`,children:[`⌘`,`K`]})]}),(0,G.jsxs)(`button`,{type:`button`,onClick:n,title:e?`Notifications`:void 0,className:J(`flex w-full items-center rounded-md text-sm text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,e?`justify-center px-2 py-2`:`gap-3 px-3 py-2`),children:[(0,G.jsx)(lo,{className:`h-4 w-4 shrink-0`}),!e&&(0,G.jsx)(`span`,{className:`flex-1 text-left`,children:`Notifications`}),r>0&&(0,G.jsx)(`span`,{className:J(`h-2 w-2 rounded-full bg-primary shrink-0`,!e&&`ml-auto`)})]})]}),(0,G.jsx)(`nav`,{className:`flex-1 space-y-1 px-2 py-2`,"aria-label":`Main navigation`,children:XO.map(t=>{let n=ZO.filter(e=>e.category===t);return n.length===0?null:(0,G.jsx)(ck,{label:t,collapsed:e,children:n.map(t=>(0,G.jsx)(uk,{item:t,collapsed:e},t.to))},t)})}),(0,G.jsxs)(`div`,{className:J(`py-3 space-y-2 mt-auto`,e?`px-1 flex flex-col items-center`:`px-2`),children:[(0,G.jsx)(ok,{collapsed:e}),!e&&(0,G.jsx)(FO,{collapsed:e}),(0,G.jsx)(ak,{collapsed:e})]}),a&&i&&(0,G.jsx)(`div`,{className:J(`px-2 py-2`,e&&`flex justify-center`),children:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,className:J(`text-on-surface-variant hover:text-on-surface`,e?`w-8 p-0 justify-center`:`w-full justify-start gap-2`),title:e?`Expand sidebar`:`Collapse sidebar`,children:[e?(0,G.jsx)(_o,{className:`h-4 w-4`}):(0,G.jsx)(go,{className:`h-4 w-4`}),!e&&(0,G.jsx)(`span`,{children:`Collapse`})]})})]})}function ck({label:e,collapsed:t,children:n}){return(0,G.jsxs)(`div`,{role:`group`,"aria-label":e,className:J(`space-y-0.5`,t&&`border-t border-[var(--ghost-border)] pt-3 mt-3 first:border-t-0 first:pt-0 first:mt-0`),children:[!t&&(0,G.jsx)(`div`,{className:`px-3 pt-4 pb-1 text-[10px] uppercase tracking-wider text-on-surface-variant`,children:e}),n]})}function lk(e,t,n,r){if(e.scope===`project`)return n;if(e.scope===`machine`)return e.to;if(!e.to.includes(`:groveSlug`))return n;let i=t?.grove??Gi(r)?.grove??zi(r)?.grove??r[0];return i?e.to.replace(`:groveSlug`,i.slug):`/`}function uk({item:e,collapsed:t}){return(0,G.jsxs)(ii,{to:lk(e,xa(),Sa(e.to),tc().data?.groves??[]),end:e.to===`/`,title:t?e.label:void 0,className:({isActive:e})=>J(`flex items-center rounded-md text-sm font-medium transition-colors`,t?`justify-center px-2 py-2`:`gap-3 px-3 py-2`,e?`bg-primary/10 text-primary`:`text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface`),children:[(0,G.jsx)(e.icon,{className:`h-4 w-4 shrink-0`}),!t&&e.label]})}function dk(e){let t=xa();(0,W.useEffect)(()=>{let n=t?.project.name??e??null;document.title=n?`${t?`${Ki(t.project.name)} `:``}${n} - Myco`:`Myco`},[t,e])}function fk(){let{collapsed:e,toggle:t}=rk(),{data:n}=Zs(),r=xa()?.project.name??n?.context.project.name??n?.vault.name;dk(r);let[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),{data:c}=uv(),l=c?.count??0,u=ik();(0,W.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&(e.preventDefault(),a(e=>!e))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]),(0,W.useEffect)(()=>{if(!u.open)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),u.close())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[u.open,u.close]);let d=(0,W.useCallback)(()=>a(!0),[]),f=(0,W.useCallback)(()=>s(!0),[]),p=(0,W.useCallback)(()=>s(!1),[]);return(0,W.useEffect)(()=>{let e=new URLSearchParams(location.search),t=e.get(`configField`)??void 0,n=e.get(`configSection`)??void 0;if(!t&&!n)return;let r=window.setTimeout(()=>{let e=pk(t,n);e&&(e.scrollIntoView({behavior:`smooth`,block:`center`}),e.classList.add(...nk),window.setTimeout(()=>{e.classList.remove(...nk)},tk))},ek);return()=>window.clearTimeout(r)},[location.key,location.search]),(0,G.jsxs)(`div`,{className:`flex h-screen bg-background`,children:[(0,G.jsx)(ov,{open:i,onOpenChange:a}),(0,G.jsx)(Cv,{panelOpen:o}),(0,G.jsx)(vO,{open:o,onClose:p}),(0,G.jsx)(yO,{}),u.isMobile&&(0,G.jsxs)(`div`,{className:`fixed top-0 left-0 right-0 z-40 flex h-12 items-center gap-3 border-b border-outline-variant/20 bg-surface-container px-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:u.toggle,className:`rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,"aria-label":u.open?`Close navigation`:`Open navigation`,children:u.open?(0,G.jsx)(Is,{className:`h-5 w-5`}):(0,G.jsx)(rs,{className:`h-5 w-5`})}),(0,G.jsx)(`span`,{className:`font-serif text-base text-primary tracking-wider`,children:`myco`}),r&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline uppercase tracking-widest`,children:r}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:f,className:`relative rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,"aria-label":`Notifications`,children:[(0,G.jsx)(lo,{className:`h-4 w-4`}),l>0&&(0,G.jsx)(`span`,{className:`absolute top-0.5 right-0.5 h-2 w-2 rounded-full bg-primary`})]}),(0,G.jsx)(`button`,{type:`button`,onClick:d,className:`rounded-md p-1.5 text-on-surface-variant transition-colors hover:bg-surface-container-high hover:text-on-surface`,"aria-label":`Search`,children:(0,G.jsx)(_s,{className:`h-4 w-4`})})]})]}),u.isMobile&&u.open&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-40 bg-surface-dim/60 backdrop-blur-xs transition-opacity`,onClick:u.close,"aria-hidden":`true`}),u.isMobile&&(0,G.jsx)(`aside`,{className:J(`fixed top-12 left-0 bottom-0 z-50 w-64 flex flex-col bg-surface-container transition-transform duration-200 ease-out`,u.open?`translate-x-0`:`-translate-x-full`),children:(0,G.jsx)(sk,{collapsed:!1,onSearchOpen:d,onNotificationsOpen:f,unreadCount:l,showCollapseToggle:!1})}),!u.isMobile&&(0,G.jsx)(`aside`,{className:J(`flex flex-col bg-surface-container transition-[width] duration-200`,e?`w-14`:`w-56`),children:(0,G.jsx)(sk,{collapsed:e,onSearchOpen:d,onNotificationsOpen:f,unreadCount:l,onCollapseToggle:t,showCollapseToggle:!0})}),(0,G.jsxs)(`main`,{className:J(`flex-1 overflow-auto bg-surface`,u.isMobile&&`pt-12`),"aria-label":`Page content`,children:[!u.isMobile&&(0,G.jsx)(YO,{onOpenSearch:d,onOpenNotifications:f,unreadCount:l}),(0,G.jsx)(cr,{})]})]})}function pk(e,t){if(e){let t=e;for(;t.length>0;){let e=document.getElementById(Xa(t));if(e instanceof HTMLElement)return e;let n=t.lastIndexOf(`.`);if(n===-1)break;t=t.slice(0,n)}}if(t){let e=document.getElementById(t);if(e instanceof HTMLElement)return e}return null}var mk=0,hk=[],gk=new Set;function _k(){for(let e of gk)e(hk)}function vk(e){let t=++mk,n={...e,id:t};hk=[...hk,n],_k();let r=e.ttlMs??5e3;r>0&&setTimeout(()=>{hk=hk.filter(e=>e.id!==t),_k()},r)}function yk(){let[e,t]=(0,W.useState)(hk);return(0,W.useEffect)(()=>(gk.add(t),()=>{gk.delete(t)}),[]),e.length===0?null:(0,G.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`pointer-events-none fixed bottom-4 right-4 z-[60] flex w-full max-w-sm flex-col gap-2`,children:e.map(e=>(0,G.jsxs)(`div`,{className:J(`pointer-events-auto rounded-md border bg-surface-container-highest px-4 py-3 shadow-lg`,e.level===`success`&&`border-primary/30`,e.level===`error`&&`border-tertiary/40`,e.level===`info`&&`border-outline-variant/30`),children:[(0,G.jsx)(`div`,{className:`text-sm font-medium text-on-surface`,children:e.title}),e.detail&&(0,G.jsx)(`div`,{className:`mt-1 break-all font-mono text-xs text-on-surface-variant`,children:e.detail})]},e.id))})}var bk=Hs.SESSIONS,xk=Hs.SESSION_DETAIL,Sk=Hs.SESSION_DETAIL,Ck=3e4,wk=6e4,Tk=1e4,Ek=Hs.SESSION_DETAIL;function Dk(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.agent&&t.set(`agent`,e.agent),e?.search&&t.set(`search`,e.search),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset));let n=t.toString(),r=n?`/sessions?${n}`:`/sessions`;return Vs({queryKey:[`sessions`,e],queryFn:({signal:e})=>$i(r,{signal:e}),pollCategory:`standard`,refetchInterval:bk})}function Ok(e){return Vs({queryKey:[`session`,e],queryFn:({signal:t})=>$i(`/sessions/${e}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:xk})}function kk(e,t=[`human`]){let n=t===`all`?``:`?origins=${t.join(`,`)}`;return Vs({queryKey:[`session-batches`,e,t===`all`?`all`:[...t].sort().join(`,`)],queryFn:({signal:t})=>$i(`/sessions/${e}/batches${n}`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:Sk})}function Ak(e){return ot({queryKey:Ta([`batch-activities`,e]),queryFn:({signal:t})=>$i(`/batches/${e}/activities`,{signal:t}),enabled:e!==void 0,staleTime:Ck})}function jk(e){return ot({queryKey:Ta([`session-attachments`,e]),queryFn:({signal:t})=>$i(`/sessions/${e}/attachments`,{signal:t}),enabled:e!==void 0,staleTime:wk})}function Mk(){let e=We();return st({mutationFn:e=>la(`/sessions/${e}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`sessions`]})}})}function Nk(){let e=We();return st({mutationFn:e=>sa(`/sessions/${e}/complete`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`session`,n]}),e.invalidateQueries({queryKey:[`sessions`]})}})}function Pk(e){return ot({queryKey:Ta([`session-impact`,e]),queryFn:({signal:t})=>$i(`/sessions/${e}/impact`,{signal:t}),enabled:e!==null,staleTime:Tk})}function Fk(e){return Vs({queryKey:[`session-plans`,e],queryFn:async({signal:t})=>(await $i(`/sessions/${e}/plans`,{signal:t})).plans,enabled:!!e,pollCategory:`standard`,refetchInterval:Ek})}function Ik(e){let t=We();return st({mutationFn:e=>la(`/plans/${e}`),onSuccess:()=>{t.invalidateQueries({queryKey:[`session-plans`,e]})}})}var Lk=Hs.RUNS_ACTIVE,Rk=Hs.RUN_DETAIL,zk=Hs.STATS,Bk=new Set([`completed`,`failed`,`skipped`]),Vk=Hs.STATS,Hk=6e4,Uk=50;function Wk(e){let t=e?.limit??Uk,n=new URLSearchParams;n.set(`limit`,String(t)),e?.offset!==void 0&&n.set(`offset`,String(e.offset)),e?.search&&n.set(`search`,e.search),e?.status&&n.set(`status`,e.status),e?.task&&n.set(`task`,e.task);let r=n.toString();return Vs({queryKey:[`agent-runs`,e],queryFn:({signal:e})=>$i(`/agent/runs?${r}`,{signal:e}),pollCategory:`standard`,refetchInterval:Lk})}function Gk(e){return ot({queryKey:Ta([`agent-run`,e]),queryFn:({signal:t})=>$i(`/agent/runs/${e}`,{signal:t}),enabled:e!==void 0,refetchInterval:e=>{let t=e.state.data?.run?.status;return t&&Bk.has(t)?!1:Rk}})}function Kk(e,t){let n=t?Bk.has(t):!1;return Vs({queryKey:[`agent-reports`,e],queryFn:({signal:t})=>$i(`/agent/runs/${e}/reports`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:n?0:zk})}function qk(e,t){let n=t?Bk.has(t):!1;return Vs({queryKey:[`agent-turns`,e],queryFn:({signal:t})=>$i(`/agent/runs/${e}/turns`,{signal:t}),enabled:e!==void 0,pollCategory:`standard`,refetchInterval:n?0:Vk})}function Jk(){return ot({queryKey:Ta([`agent-tasks`]),queryFn:({signal:e})=>$i(`/agent/tasks`,{signal:e}),staleTime:Hk})}function Yk(e){return ot({queryKey:Ta([`agent-task`,e]),queryFn:({signal:t})=>$i(`/agent/tasks/${e}`,{signal:t}),enabled:e!==void 0,staleTime:Hk})}function Xk(){let e=We();return st({mutationFn:({taskId:e,name:t})=>sa(`/agent/tasks/${e}/copy`,t?{name:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]})}})}function Zk(){let e=We();return st({mutationFn:e=>la(`/agent/tasks/${e}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]})}})}function Qk(e){return ot({queryKey:Ta([`agent-task-yaml`,e]),queryFn:({signal:t})=>$i(`/agent/tasks/${e}/yaml`,{signal:t}),enabled:e!==void 0,staleTime:Hk})}function $k(){let e=We();return st({mutationFn:({taskId:e,yaml:t})=>ca(`/agent/tasks/${e}`,{yaml:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-tasks`]}),e.invalidateQueries({queryKey:[`agent-task`]}),e.invalidateQueries({queryKey:[`agent-task-yaml`]})}})}function eA(){let e=We();return st({mutationFn:e=>sa(`/agent/run`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`agent-runs`]})}})}function tA(){let e=We();return st({mutationFn:({runId:e,mode:t})=>sa(`/agent/runs/${e}/resume`,t?{mode:t}:{}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`agent-runs`]}),e.invalidateQueries({queryKey:[`agent-run`,n.runId]})}})}function nA(e){return Vs({queryKey:[`agent-run-write-intents`,e],queryFn:({signal:t})=>$i(`/agent/runs/${e}/write-intents`,{signal:t}),enabled:e!==null,pollCategory:`standard`,refetchInterval:!1})}function rA(e){return Vs({queryKey:[`agent-run-audit`,e],queryFn:({signal:t})=>$i(`/agent/runs/${e}/audit`,{signal:t}),enabled:e!==null,pollCategory:`standard`,refetchInterval:!1})}function iA(e,t){let n=new URLSearchParams;n.set(`agentId`,e),n.set(`tier`,String(t));let r=n.toString();return Vs({queryKey:[`digest-revisions`,e,t],queryFn:({signal:e})=>$i(`/digest/revisions?${r}`,{signal:e}),enabled:!!e&&Number.isFinite(t),pollCategory:`standard`,refetchInterval:!1})}function aA(){let e=We();return st({mutationFn:({revisionId:e,runId:t})=>sa(`/digest/revisions/${e}/restore`,t?{runId:t}:{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`digest-revisions`]})}})}function oA(e){return{id:e.id,agent_id:e.agent_id,task:e.task,instruction:e.instruction,status:e.status,harness:e.harness,provider:e.provider,model:e.model,session_ref:e.session_ref,started_at:e.started_at,completed_at:e.completed_at,tokens_used:e.tokens_used,cost_usd:e.cost_usd,usage_data:e.usage_data,error:e.error,dry_run:e.dry_run??!1,reasoning_level:e.reasoning_level??null,execution_overrides:e.execution_overrides??null,write_intents:e.write_intents,duration_ms:e.duration_ms}}function sA(e){let t=xa(),n=it({queries:e.map(e=>({queryKey:wa(t,[`agent-run`,e]),queryFn:({signal:t})=>$i(`/agent/runs/${e}`,{signal:t}),enabled:!!e}))}),r=[],i=[],a=!1;for(let e of n){e.isLoading&&(a=!0),e.error&&i.push(e.error);let t=e.data?.run;t&&r.push(oA(t))}return{runs:r,isLoading:a,errors:i,isError:i.length>0}}function cA(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset));let n=t.toString(),r=n?`/skill-candidates?${n}`:`/skill-candidates`;return ot({queryKey:Ta([`skill-candidates`,e]),queryFn:({signal:e})=>$i(r,{signal:e})})}function lA(){let e=We();return st({mutationFn:({id:e,...t})=>ca(`/skill-candidates/${e}`,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`skill-candidates`]})}})}function uA(e){let t=new URLSearchParams;e?.status&&t.set(`status`,e.status),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset));let n=t.toString(),r=n?`/skill-records?${n}`:`/skill-records`;return ot({queryKey:Ta([`skill-records`,e]),queryFn:({signal:e})=>$i(r,{signal:e})})}function dA(e){return ot({queryKey:Ta([`skill-record`,e]),queryFn:({signal:t})=>$i(`/skill-records/${e}`,{signal:t}),enabled:!!e})}function fA(){let e=We();return st({mutationFn:e=>la(`/skill-records/${encodeURIComponent(e)}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`skill-records`]}),e.invalidateQueries({queryKey:[`skill-record`]})}})}var pA=6e4,mA=36e5,hA=3e4;function gA(e,t,n=``){return e?.myco_tool_calls?e.myco_tool_calls.find(e=>e.tool_name===t&&e.op===n)?.count??0:0}async function _A(e,t){try{return await $i(e,{signal:t})}catch(e){if(e instanceof ma&&e.status===404)return null;throw e}}function vA(e){return ot({queryKey:Ta([`session-canopy`,e]),queryFn:({signal:t})=>_A(`/sessions/${e}/canopy`,t),enabled:e!==void 0,staleTime:pA,retry:(e,t)=>t instanceof ma&&t.status===404?!1:e<2})}function yA(e){let t=new URLSearchParams;e.limit!==void 0&&t.set(`limit`,String(e.limit)),e.offset!==void 0&&t.set(`offset`,String(e.offset)),e.language!==void 0&&t.set(`language`,e.language),e.described!==void 0&&t.set(`described`,String(e.described)),e.embedded!==void 0&&t.set(`embedded`,String(e.embedded)),e.path_prefix!==void 0&&t.set(`path_prefix`,e.path_prefix),e.q!==void 0&&e.q!==``&&t.set(`q`,e.q),e.sort_by!==void 0&&t.set(`sort_by`,e.sort_by),e.sort_dir!==void 0&&t.set(`sort_dir`,e.sort_dir);let n=t.toString();return n?`?${n}`:``}function bA(e){return ot({queryKey:Ta([`canopy-entries`,e.limit??null,e.offset??null,e.language??null,e.described??null,e.embedded??null,e.path_prefix??null,e.q??null,e.sort_by??null,e.sort_dir??null]),queryFn:({signal:t})=>$i(`/canopy/entries${yA(e)}`,{signal:t}),staleTime:hA,refetchInterval:Hs.CANOPY_ENTRIES})}function xA(e){return ot({queryKey:Ta([`canopy-entry`,e]),queryFn:({signal:t})=>_A(`/canopy/entries/${encodeURIComponent(e??``)}`,t),enabled:typeof e==`string`&&e.length>0,staleTime:hA,retry:(e,t)=>t instanceof ma&&t.status===404?!1:e<2})}function SA(){let e=We();return st({mutationFn:async e=>sa(`/canopy/entries/${encodeURIComponent(e)}/reembed`),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`canopy-entries`]}),e.invalidateQueries({queryKey:[`canopy-entry`,n]})}})}function CA(){let e=We();return st({mutationFn:async e=>sa(`/canopy/entries/${encodeURIComponent(e)}/redescribe`,{}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`canopy-entries`]}),e.invalidateQueries({queryKey:[`canopy-entry`,n]})}})}var wA=3e4;function TA(){return ot({queryKey:Ta([`canopy-map`]),queryFn:({signal:e})=>$i(`/canopy/map`,{signal:e}),staleTime:wA})}function EA(){let e=We();return st({mutationFn:async e=>sa(`/canopy/map/regenerate`,{force_cold_start:e.force_cold_start===!0}),onSuccess:()=>{e.invalidateQueries({queryKey:[`canopy-map`]})}})}function DA(e,t){return ot({queryKey:Ta([`canopy-tool-call-blob`,e,t]),queryFn:({signal:n})=>_A(`/sessions/${e}/canopy/tool-calls/${t}/blob`,n),enabled:e!==void 0&&t!==void 0,staleTime:mA,retry:(e,t)=>t instanceof ma&&t.status===404?!1:e<2})}function OA({isLoading:e,error:t,loadingText:n=`Loading...`,children:r}){return e?(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(es,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:n})]}):t?(0,G.jsxs)(`div`,{className:`flex h-64 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to connect to daemon`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:t.message})]}):(0,G.jsx)(G.Fragment,{children:r})}var kA={default:`w-full`,narrow:`mx-auto w-full max-w-3xl`},AA=(0,W.forwardRef)(({variant:e=`default`,className:t,children:n,...r},i)=>(0,G.jsx)(`div`,{ref:i,className:J(`flex flex-col gap-6 p-6`,kA[e],t),...r,children:n}));AA.displayName=`PageContainer`;var jA=oc(`rounded-xl bg-surface-container-low border border-outline-variant`,{variants:{accent:{sage:`border-t-2 border-t-sage`,ochre:`border-t-2 border-t-ochre`,terra:`border-t-2 border-t-terracotta`,outline:`border-t-2 border-t-outline-variant`},padded:{true:`p-4`,false:``}},defaultVariants:{accent:`sage`,padded:!1}}),MA=(0,W.forwardRef)(({className:e,accent:t,padded:n,...r},i)=>(0,G.jsx)(`div`,{ref:i,className:J(jA({accent:t,padded:n}),e),...r}));MA.displayName=`AccentSurface`;var NA=oc(`inline-flex items-center myco-eyebrow`,{variants:{tone:{default:`text-outline`,sage:`text-sage`,ochre:`text-ochre`,terra:`text-terracotta`,outline:`text-outline`},size:{sm:`myco-eyebrow-sm`,md:`myco-eyebrow`}},defaultVariants:{tone:`default`,size:`md`}}),PA=(0,W.forwardRef)(({className:e,tone:t,size:n,...r},i)=>(0,G.jsx)(`span`,{ref:i,className:J(NA({tone:t,size:n}),e),...r}));PA.displayName=`Eyebrow`;var FA=(0,W.forwardRef)(({tone:e=`sage`,eyebrow:t,title:n,actions:r,footer:i,padded:a=!0,className:o,children:s,...c},l)=>{let u=t!=null||n!=null||r!=null;return(0,G.jsxs)(MA,{ref:l,accent:e,className:J(`flex flex-col`,o),...c,children:[u&&(0,G.jsxs)(`header`,{className:J(`flex items-start justify-between gap-3`,a?`px-5 pt-4`:`px-5 py-4`),children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[t!=null&&(0,G.jsx)(PA,{tone:e,children:t}),n!=null&&(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:n})]}),r!=null&&(0,G.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:r})]}),s!=null&&(0,G.jsx)(`div`,{className:J(a?`px-5 py-4`:``),children:s}),i!=null&&(0,G.jsx)(`footer`,{className:`border-t border-[var(--ghost-border)] px-5 py-3`,children:i})]})});FA.displayName=`Panel`;function IA({data:e,widthPx:t=56,heightPx:n=16,barClassName:r=`fill-primary/60`,ariaLabel:i=`Activity sparkline`,className:a}){let o=e.length;if(o===0)return(0,G.jsx)(`svg`,{role:`img`,"aria-label":i,width:t,height:n,className:J(`inline-block`,a)});let s=Math.max(...e,1),c=Math.max(1,(t-1*(o-1))/o);return(0,G.jsx)(`svg`,{role:`img`,"aria-label":i,width:t,height:n,className:J(`inline-block`,a),children:e.map((e,t)=>{let i=s===0?0:Math.round(e/s*n);return(0,G.jsx)(`rect`,{x:t*(c+1),y:n-i,width:c,height:i,className:r,rx:.5},t)})})}var LA=oc(`flex flex-col gap-1 rounded-md bg-surface-container-lowest border border-[var(--ghost-border)] px-4 py-3`,{variants:{tone:{default:``,sage:`border-t-2 border-t-sage`,ochre:`border-t-2 border-t-ochre`,terra:`border-t-2 border-t-terracotta`}},defaultVariants:{tone:`default`}}),RA=(0,W.forwardRef)(({label:e,value:t,sub:n,tone:r,mono:i=!1,sparklineData:a,className:o,...s},c)=>(0,G.jsxs)(`div`,{ref:c,className:J(LA({tone:r}),o),...s,children:[(0,G.jsx)(PA,{size:`sm`,children:e}),(0,G.jsxs)(`div`,{className:J(`flex items-end justify-between gap-2`),children:[(0,G.jsx)(`div`,{className:J(i?`font-mono text-base leading-tight text-on-surface`:`myco-display-md text-on-surface`),children:t}),a&&a.length>=2&&(0,G.jsx)(IA,{data:a,widthPx:80,heightPx:20,className:`opacity-60 shrink-0`})]}),n!=null&&(0,G.jsx)(`div`,{className:`font-mono text-[10px] text-outline`,children:n})]}));RA.displayName=`MetricCard`;var zA=3600,BA=86400,VA=1e3;function HA(e){return e<60?`${Math.floor(e)}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/zA)}h ${Math.floor(e%zA/60)}m`:`${Math.floor(e/BA)}d ${Math.floor(e%BA/zA)}h`}function UA(e){let t=(Date.now()-new Date(e).getTime())/VA;return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/zA)}h ago`:`${Math.floor(t/BA)}d ago`}function WA(e){return UA(new Date(e*VA).toISOString())}function GA(e){return new Date(e*VA).toLocaleString()}function KA(e,t){return e?e.length>t?e.slice(0,t)+`…`:e:``}function qA(e){return e?e.slice(0,8):``}function JA(e){return e.split(`/`).pop()||e}function YA(e){return e.charAt(0).toUpperCase()+e.slice(1)}function XA(e,t){if(e===null||t===null)return`—`;let n=(t-e)*VA;return n<VA?`${n}ms`:n<60*VA?`${(n/VA).toFixed(1)}s`:`${Math.floor(n/(60*VA))}m ${Math.floor(n%(60*VA)/VA)}s`}function ZA(e){return e===null?`—`:e<VA?`${e}ms`:`${(e/VA).toFixed(1)}s`}function QA(e){return e===null?`—`:WA(e)}var $A=1024,ej=[`KB`,`MB`,`GB`,`TB`];function tj(e){if(e<$A)return`${e} B`;let t=e/$A,n=0;for(;t>=$A&&n<ej.length-1;)t/=$A,n++;let r=t>=100?0:1;return`${t.toFixed(r)} ${ej[n]}`}var nj=6,rj=6,ij=6,aj=6;function oj(e){return e===`running`?`sage`:e===`failed`||e===`error`?`terracotta`:e===`completed`||e===`succeeded`?`outline`:`ochre`}function sj(){let{data:e,isLoading:t,isError:n,error:r}=Zs(),{data:i}=Dk({status:`active`,limit:nj}),{data:a}=Wk({limit:rj}),{data:o}=uA({limit:ij}),{data:s}=bA({limit:aj,sort_by:`llm_updated_at`,sort_dir:`desc`});return(0,G.jsx)(OA,{isLoading:t,error:n?r instanceof Error?r:Error(`Unable to reach daemon`):null,loadingText:`Connecting to daemon...`,children:e&&(0,G.jsxs)(AA,{className:`gap-8`,children:[(0,G.jsx)(cj,{stats:e,activeSessionCount:i?.total??0,inFlightRunCount:(a?.runs??[]).filter(e=>e.status===`running`).length}),(0,G.jsx)(uj,{stats:e}),(0,G.jsx)(mj,{sessions:i?.sessions??[],totalSporeCount:e.vault.spore_count,totalActiveCount:i?.total??0}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,G.jsx)(gj,{runs:a?.runs??[]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,G.jsx)(vj,{skills:o?.records??[]}),(0,G.jsx)(yj,{entries:s?.rows??[]})]})]})]})})}function cj({stats:e,activeSessionCount:t,inFlightRunCount:n}){let r=e.context.project.name||JA(e.context.project.root),i=lj(t,n,e.embedding.queue_depth);return(0,G.jsx)(`header`,{className:`flex items-start justify-between gap-4 flex-wrap`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(PA,{children:r}),(0,G.jsx)(`h1`,{className:`myco-display-lg text-on-surface m-0`,children:`Dashboard`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:i})]})})}function lj(e,t,n){let r=[];return e>0&&r.push(`${e} ${e===1?`active session`:`active sessions`}`),t>0&&r.push(`${t} ${t===1?`run`:`runs`} running`),n>0&&r.push(`${n} in the embed queue`),r.length===0?`Quiet right now — nothing running.`:r.join(` · `)}function uj({stats:e}){return(0,G.jsxs)(`section`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,G.jsx)(fj,{stats:e}),(0,G.jsx)(pj,{stats:e})]})}function dj({accent:e,Icon:t,eyebrow:n,name:r,sub:i,children:a}){let o=e===`sage`?`text-sage`:e===`ochre`?`text-ochre`:`text-terracotta`,s=e===`sage`?`sage`:e===`ochre`?`ochre`:`default`;return(0,G.jsxs)(MA,{accent:e,className:`p-5 flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(t,{className:J(`h-3.5 w-3.5`,o)}),(0,G.jsx)(PA,{tone:s,children:n})]}),(0,G.jsx)(`div`,{className:`myco-display-md text-on-surface truncate`,title:r,children:r}),(0,G.jsx)(`div`,{className:`font-mono text-[10px] text-outline truncate`,title:i,children:i})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:a})]})}function fj({stats:e}){return(0,G.jsxs)(dj,{accent:`sage`,Icon:cs,eyebrow:`Project`,name:e.context.project.name||JA(e.context.project.root),sub:e.context.project.root,children:[(0,G.jsx)(RA,{label:`Sessions`,value:e.vault.session_count.toLocaleString(),tone:`sage`}),(0,G.jsx)(RA,{label:`Spores`,value:e.vault.spore_count.toLocaleString()}),(0,G.jsx)(RA,{label:`Plans`,value:e.vault.plan_count.toLocaleString()}),(0,G.jsx)(RA,{label:`Canopy`,value:`${e.canopy.described_count}/${e.canopy.entries_count}`,sub:`described`,mono:!0})]})}function pj({stats:e}){let t=e.context.grove,n=t.name??`Local only`,r=t.slug?`${t.mode??`local`} · ${t.connection_state}`:`no grove bound`,i=e.embedding.total_embeddable,a=e.embedding.embedded_count,o=e.embedding.queue_depth;return(0,G.jsxs)(dj,{accent:`ochre`,Icon:As,eyebrow:`Grove`,name:n,sub:r,children:[(0,G.jsx)(RA,{label:`Embeddings`,value:i>0?`${a}/${i}`:`—`,sub:i>0?`embedded`:`no items`,mono:!0,tone:`ochre`}),(0,G.jsx)(RA,{label:`Embed queue`,value:o.toLocaleString(),sub:o>0?`pending`:`idle`})]})}function mj({sessions:e,totalSporeCount:t,totalActiveCount:n}){let r=Nn(),i=Ca(),a=n===0?`No active sessions`:`${n} ${n===1?`active session`:`active sessions`}`;return(0,G.jsxs)(FA,{tone:`sage`,eyebrow:`Active sessions · ${n}`,title:a,children:[e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`Sessions appear here when a symbiont starts a new conversation.`}):(0,G.jsx)(`div`,{className:`space-y-2`,children:e.map((e,t)=>(0,G.jsx)(hj,{session:e,accent:[`sage`,`ochre`,`terra`][t%3],onClick:()=>r(i(`/sessions/${e.id}`))},e.id))}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between border-t border-[var(--ghost-border)] pt-3 text-xs font-mono text-outline`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`span`,{className:`text-on-surface tabular-nums`,children:t.toLocaleString()}),` spores total`]}),(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(i(`/sessions`)),className:`inline-flex items-center gap-1 text-sage hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40 rounded`,children:[`View session archive`,(0,G.jsx)(co,{className:`h-3 w-3`})]})]})]})}function hj({session:e,accent:t,onClick:n}){return(0,G.jsxs)(`button`,{type:`button`,onClick:n,className:J(`w-full text-left rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-4 py-3 transition-colors`,`hover:bg-surface-container focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,t===`sage`&&`border-l-2 border-l-sage`,t===`ochre`&&`border-l-2 border-l-ochre`,t===`terra`&&`border-l-2 border-l-terracotta`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(BO,{tone:e.status===`active`?`sage`:`ochre`,pulse:e.status===`active`}),(0,G.jsx)(`span`,{className:`font-serif italic text-sm text-on-surface truncate flex-1 min-w-0`,children:e.title||`Untitled session`}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:WA(e.started_at)})]}),(0,G.jsxs)(`div`,{className:`mt-1 font-mono text-[11px] text-on-surface-variant flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(`span`,{children:e.agent}),e.branch&&(0,G.jsxs)(`span`,{children:[`· `,e.branch]}),(0,G.jsxs)(`span`,{children:[`· `,e.prompt_count,`p · `,e.tool_count,`t`]}),e.activity_buckets&&e.activity_buckets.length>1&&(0,G.jsx)(`span`,{className:`ml-auto`,children:(0,G.jsx)(IA,{data:e.activity_buckets,widthPx:64,heightPx:14})})]})]})}function gj({runs:e}){let t=Nn(),n=Ca(),r=[...e].sort((e,t)=>e.status===`running`&&t.status!==`running`?-1:e.status!==`running`&&t.status===`running`?1:(t.started_at??0)-(e.started_at??0));return(0,G.jsx)(FA,{accent:`terra`,eyebrow:`Agent runs`,title:`Recent`,actions:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n(`/agent`)),className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`All runs `,(0,G.jsx)(co,{className:`h-3 w-3`})]}),children:r.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`No agent runs yet for this project.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none flex flex-col gap-2`,children:r.map(e=>(0,G.jsx)(_j,{run:e,onClick:()=>t(n(`/agent?runId=${e.id}`))},e.id))})})}function _j({run:e,onClick:t}){let n=oj(e.status),r=e.task??`untitled task`,i=e.tokens_used??0;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:t,className:`w-full text-left rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 transition-colors hover:bg-surface-container focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(BO,{tone:n,pulse:e.status===`running`}),(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface truncate flex-1 min-w-0`,children:r}),e.dry_run&&(0,G.jsx)(`span`,{className:`font-mono text-[9px] uppercase tracking-wider text-ochre bg-ochre/10 px-1.5 rounded`,children:`dry`}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:e.status})]}),(0,G.jsxs)(`div`,{className:`mt-1 font-mono text-[10px] text-outline flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{children:e.id.slice(0,8)}),e.started_at&&(0,G.jsxs)(`span`,{children:[`· `,WA(e.started_at)]}),i>0&&(0,G.jsxs)(`span`,{children:[`· `,i.toLocaleString(),` tok`]}),e.model&&(0,G.jsxs)(`span`,{children:[`· `,e.model]})]})]})})}function vj({skills:e}){let t=Nn(),n=Ca(),r=[...e].sort((e,t)=>t.updated_at-e.updated_at);return(0,G.jsx)(FA,{accent:`sage`,eyebrow:`Skills`,title:`Recently evolved`,actions:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n(`/skills`)),className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Curate `,(0,G.jsx)(co,{className:`h-3 w-3`})]}),children:r.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`No skills yet. The agent surfaces candidates as you work.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none grid grid-cols-1 sm:grid-cols-2 gap-2`,children:r.map(e=>(0,G.jsxs)(`li`,{className:`rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(Cs,{className:`h-3 w-3 text-sage shrink-0`}),(0,G.jsx)(`span`,{className:`font-sans text-xs font-medium text-on-surface truncate`,title:e.display_name,children:e.display_name||e.name}),(0,G.jsxs)(`span`,{className:`ml-auto font-mono text-[9px] uppercase tracking-wider text-ochre bg-ochre/10 px-1.5 rounded shrink-0`,children:[`gen `,e.generation]})]}),(0,G.jsx)(`div`,{className:`mt-1 font-mono text-[10px] text-outline`,children:WA(e.updated_at)})]},e.id))})})}function yj({entries:e}){let t=Nn(),n=Ca();return(0,G.jsx)(FA,{accent:`ochre`,eyebrow:`Canopy`,title:`Recent entries`,actions:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n(`/cortex?tab=canopy`)),className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Open Cortex `,(0,G.jsx)(co,{className:`h-3 w-3`})]}),children:e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`Canopy hasn't summarized any files yet.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none flex flex-col gap-1.5`,children:e.map(e=>(0,G.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(Lo,{className:`h-3 w-3 text-outline shrink-0`}),(0,G.jsx)(`span`,{className:`font-mono truncate flex-1 min-w-0 text-on-surface`,title:e.path,children:e.path}),e.language&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:e.language}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline whitespace-nowrap`,children:e.llm_updated_at?WA(e.llm_updated_at):WA(e.mechanical_updated_at)})]},e.path))})})}function bj(e){let[t,n]=(0,W.useState)(()=>typeof window>`u`?!1:window.matchMedia(e).matches);return(0,W.useEffect)(()=>{if(typeof window>`u`)return;let t=window.matchMedia(e),r=e=>n(e.matches);return n(t.matches),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}var xj=`(min-width: 768px)`,Sj=240,Cj=360;function wj({master:e,detail:t,hasSelection:n,onCloseMobileDetail:r,railMinWidthPx:i=Sj,railMaxWidthPx:a=Cj,className:o,masterAriaLabel:s=`List`,detailAriaLabel:c=`Details`}){return bj(xj)?(0,G.jsxs)(`div`,{className:J(`flex h-full w-full`,o),children:[(0,G.jsx)(`aside`,{"aria-label":s,className:`flex-shrink-0 overflow-y-auto border-r border-outline-variant/20`,style:{minWidth:i,maxWidth:a,width:`clamp(${i}px, 30vw, ${a}px)`},children:e}),(0,G.jsx)(`section`,{"aria-label":c,className:`flex-1 overflow-y-auto p-6`,children:t})]}):n?(0,G.jsxs)(`section`,{role:`region`,"aria-label":c,className:J(`flex h-full w-full flex-col`,o),children:[r&&(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:`sticky top-0 z-10 flex items-center gap-1 border-b border-outline-variant/20 bg-surface-container px-3 py-2 text-sm text-on-surface-variant hover:bg-surface-container-high`,children:[(0,G.jsx)(go,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{children:`Back`})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:t})]}):(0,G.jsx)(`section`,{role:`region`,"aria-label":s,className:J(`h-full w-full overflow-y-auto`,o),children:e})}function Tj({message:e,className:t}){return(0,G.jsx)(`div`,{className:J(`flex h-full w-full items-center justify-center text-on-surface-variant`,t),children:(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:e})})}function Ej({searchPlaceholder:e=`Search...`,searchValue:t,onSearchChange:n,filters:r=[],filterValues:i={},onFilterChange:a,inputRef:o,count:s,className:c}){return(0,G.jsxs)(`div`,{className:J(`flex items-center gap-3 px-4 py-2.5 rounded-md bg-surface-container-low border border-[var(--ghost-border)]`,c),children:[(0,G.jsx)(_s,{className:`h-4 w-4 text-on-surface-variant shrink-0`}),(0,G.jsx)(cp,{ref:o,placeholder:e,value:t,onChange:e=>n(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1 min-w-[200px]`,"aria-label":e}),r.map(e=>(0,G.jsx)(`div`,{className:`w-44 shrink-0`,children:(0,G.jsxs)(w_,{value:i[e.key]??`all`,onValueChange:t=>a?.(e.key,t),children:[(0,G.jsx)(E_,{children:(0,G.jsx)(T_,{placeholder:e.label})}),(0,G.jsx)(D_,{children:e.options.map(e=>(0,G.jsx)(O_,{value:e.value,children:e.label},e.value))})]})},e.key)),s!=null&&(0,G.jsx)(`span`,{className:`myco-eyebrow-sm shrink-0`,children:s})]})}var Dj=oc(`rounded-md transition-colors`,{variants:{level:{lowest:`bg-surface-container-lowest`,low:`bg-surface-container-low`,default:`bg-surface-container`,high:`bg-surface-container-high`,highest:`bg-surface-container-highest`,bright:`bg-surface-bright`},interactive:{true:`cursor-pointer hover-lift hover:brightness-[1.08]`,false:``},ghostBorder:{true:`border border-[var(--ghost-border)]`,false:``},glass:{true:`backdrop-blur-xl bg-surface-variant/60`,false:``},glow:{true:`shadow-[inset_0_0_12px_rgba(171,207,184,0.2)]`,false:``},accent:{none:``,sage:`border-t-2 border-t-sage`,ochre:`border-t-2 border-t-ochre`,terra:`border-t-2 border-t-terracotta`,outline:`border-t-2 border-t-outline-variant`}},defaultVariants:{level:`low`,interactive:!1,ghostBorder:!1,glass:!1,glow:!1,accent:`none`}}),Q=(0,W.forwardRef)(({className:e,level:t,interactive:n,ghostBorder:r,glass:i,glow:a,accent:o,...s},c)=>(0,G.jsx)(`div`,{ref:c,className:J(Dj({level:t,interactive:n,ghostBorder:r,glass:i,glow:a,accent:o}),e),...s}));Q.displayName=`Surface`;var Oj={sage:`bg-sage/[0.08] shadow-[inset_2px_0_0_var(--sage)]`,ochre:`bg-ochre/[0.08] shadow-[inset_2px_0_0_var(--ochre)]`,terra:`bg-terracotta/[0.08] shadow-[inset_2px_0_0_var(--terracotta)]`},kj={sage:`bg-surface-container/60 ring-1 ring-inset ring-sage/30`,ochre:`bg-surface-container/60 ring-1 ring-inset ring-ochre/30`,terra:`bg-surface-container/60 ring-1 ring-inset ring-terracotta/30`},Aj=(0,W.forwardRef)(({accent:e=`sage`,isActive:t=!1,isCursor:n=!1,interactive:r,onClick:i,className:a,children:o,onKeyDown:s,...c},l)=>{let u=r??typeof i==`function`;function d(e){u&&i&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i()),s?.(e)}return(0,G.jsx)(`div`,{ref:l,onClick:u?i:void 0,onKeyDown:u?d:s,tabIndex:u?0:void 0,role:u?`row`:void 0,"aria-selected":u?t:void 0,"data-active":t||void 0,"data-cursor":n||void 0,className:J(`relative border-b border-[var(--ghost-border)] last:border-b-0 px-4 py-3 transition-colors duration-100`,u&&`cursor-pointer hover:bg-surface-container focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sage/40`,t&&Oj[e],n&&!t&&kj[e],a),...c,children:o})});Aj.displayName=`Row`;function jj({open:e,onOpenChange:t,title:n,description:r,icon:i,meta:a,impact:o,confirmLabel:s=`Confirm`,variant:c=`destructive`,onConfirm:l,isPending:u=!1,errorMessage:d=null}){return(0,G.jsx)($f,{open:e,onOpenChange:t,children:(0,G.jsxs)(rp,{className:`sm:max-w-md border border-outline-variant/20 [&>button:last-child]:hidden`,children:[(0,G.jsxs)(ip,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[i&&(0,G.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-tertiary/15`,children:i}),(0,G.jsx)(op,{children:n})]}),(0,G.jsx)(sp,{children:r})]}),a&&a.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-outline-variant/20 px-4 py-3`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant bg-surface-container px-1.5 py-0.5 rounded shrink-0`,children:a[0]?.value}),a.length>1&&(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface truncate`,children:a[1]?.value})]}),o&&o.length>0&&(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:o.map(e=>(0,G.jsxs)(`div`,{className:`rounded-md border border-outline-variant/20 px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`font-sans text-[10px] font-medium uppercase tracking-wider text-on-surface-variant`,children:e.label}),(0,G.jsx)(`div`,{className:`font-sans text-base font-medium text-on-surface`,children:e.value})]},e.label))}),d&&(0,G.jsx)(`p`,{className:`text-sm text-tertiary`,"data-testid":`confirm-dialog-error`,role:`alert`,children:d}),(0,G.jsxs)(ap,{children:[(0,G.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:u,children:`Cancel`}),(0,G.jsxs)(Y,{variant:c,size:`sm`,onClick:l,disabled:u,className:`gap-2`,children:[u&&(0,G.jsx)(es,{className:`h-4 w-4 animate-spin`}),s]})]})]})})}function Mj({total:e,offset:t,limit:n,onPageChange:r}){if(Math.ceil(e/n)<=1)return null;let i=t>0,a=t+n<e,o=t+1,s=Math.min(t+n,e);return(0,G.jsxs)(`div`,{className:`flex items-center justify-center gap-3 pt-1`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!i,onClick:()=>r(Math.max(0,t-n)),className:`gap-1 text-on-surface-variant`,children:[(0,G.jsx)(go,{className:`h-4 w-4`}),`Prev`]}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[o,`–`,s,` of `,e]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!a,onClick:()=>r(t+n),className:`gap-1 text-on-surface-variant`,children:[`Next`,(0,G.jsx)(_o,{className:`h-4 w-4`})]})]})}var Nj=3e5;function Pj(){return ot({queryKey:Ta([`symbionts`]),queryFn:({signal:e})=>$i(`/symbionts`,{signal:e}),staleTime:Nj})}function Fj(e,t,n){let r=e.find(e=>e.name===t);return r?.resumeCommand?r.resumeCommand.replace(`{sessionId}`,n):null}var Ij={released:`released`,merged_unreleased:`merged`,not_on_release_line:`feature`,unknown:`unknown`,unreconciled:`unreconciled`},Lj={released:`bg-primary/15 text-primary`,merged_unreleased:`bg-secondary/15 text-secondary`,not_on_release_line:`border border-[var(--ghost-border)] text-on-surface-variant`,unknown:`bg-surface-container-high text-on-surface-variant`,unreconciled:`border border-[var(--ghost-border)] text-on-surface-variant/70`},Rj={released:`bg-primary`,merged_unreleased:`bg-secondary`,not_on_release_line:`bg-on-surface-variant/50`,unknown:`bg-on-surface-variant/40`,unreconciled:`bg-on-surface-variant/25`},zj={released:`border-primary`,merged_unreleased:`border-secondary`,not_on_release_line:`border-on-surface-variant/50`,unknown:`border-on-surface-variant/40`,unreconciled:`border-on-surface-variant/25`};function Bj(e){let t=[Ij[e.state]??e.state];return e.confidence&&t.push(`confidence: ${e.confidence}`),e.basis_kind&&t.push(`basis: ${e.basis_kind}`),e.basis_ref&&t.push(`ref: ${e.basis_ref}`),e.reason&&t.push(e.reason),t.join(` — `)}function Vj({annotation:e,className:t}){if(!e)return null;let n=Ij[e.state]??e.state;return(0,G.jsxs)(`span`,{className:J(`inline-flex items-center gap-1 rounded-xs px-1.5 py-0.5 font-sans text-[10px] font-medium uppercase tracking-wider`,Lj[e.state]??Lj.unknown,t),title:Bj(e),children:[(0,G.jsx)(`span`,{children:n}),e.confidence?(0,G.jsx)(`span`,{className:`font-mono normal-case opacity-70`,children:e.confidence}):null]})}function Hj({annotation:e,className:t}){if(!e)return null;let n=Rj[e.state]??Rj.unknown,r=zj[e.state]??zj.unknown,i=e.confidence??null,a;return a=i===`high`?n:i===`medium`?J(n,`opacity-60 border`,r):i===`low`?J(`bg-transparent border-2`,r):J(n,`opacity-50`),(0,G.jsx)(`span`,{className:J(`inline-block h-2.5 w-2.5 rounded-full shrink-0`,a,t),title:Bj(e),"aria-label":`Release: ${Bj(e)}`,role:`img`})}var Uj=[`ACTIVE`,`TODAY`,`YESTERDAY`,`EARLIER`];function Wj(e,t){let{isActive:n,startedAtEpochSec:r,nowEpochSec:i}=t,a=i??Math.floor(Date.now()/1e3),o=new Date(a*1e3),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime()/1e3,c=s-1440*60,l={ACTIVE:[],TODAY:[],YESTERDAY:[],EARLIER:[]};for(let t of e){if(n(t)){l.ACTIVE.push(t);continue}let e=r(t);if(e==null){l.EARLIER.push(t);continue}e>=s?l.TODAY.push(t):e>=c?l.YESTERDAY.push(t):l.EARLIER.push(t)}let u=[];for(let e of Uj)l[e].length>0&&u.push({label:e,rows:l[e]});return u}function Gj(e){return!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey}function Kj({items:e,getId:t,selectedId:n,onActivate:r,filterInputRef:i,enabled:a=!0}){let o=(0,W.useRef)(t);o.current=t;let[s,c]=(0,W.useState)(()=>{if(!n)return 0;let r=e.findIndex(e=>t(e)===n);return r>=0?r:0}),l=(0,W.useRef)([]),u=(0,W.useRef)(n);return(0,W.useEffect)(()=>{if(u.current===n||(u.current=n,!n))return;let t=e.findIndex(e=>o.current(e)===n);t>=0&&c(t)},[n,e]),(0,W.useEffect)(()=>{s>=e.length&&c(Math.max(0,e.length-1)),l.current.length>e.length&&(l.current.length=e.length)},[e.length,s]),(0,W.useEffect)(()=>{let e=l.current[s];e&&typeof e.scrollIntoView==`function`&&e.scrollIntoView({block:`nearest`})},[s]),{cursorIndex:s,setRowRef:(0,W.useCallback)(e=>t=>{l.current[e]=t},[]),containerProps:{tabIndex:0,onKeyDown:(0,W.useCallback)(n=>{if(a){if(n.key===`/`&&Gj(n)&&i?.current){n.preventDefault(),i.current.focus();return}if(Gj(n)){if(n.key===`j`||n.key===`ArrowDown`){n.preventDefault(),c(t=>Math.min(e.length-1,t+1));return}if(n.key===`k`||n.key===`ArrowUp`){n.preventDefault(),c(e=>Math.max(0,e-1));return}if(n.key===`Enter`){n.preventDefault();let i=e[s];i&&r(t(i))}}}},[a,e,s,r,t,i])}}}var qj=5;function Jj(e){return e===`active`?`sage`:e===`completed`?`outline`:`ochre`}var Yj=(0,W.forwardRef)(function({session:e,symbiontDisplayName:t,isSelected:n,isCursor:r,onClick:i,onDelete:a},o){let s=e.title||qA(e.id);return(0,G.jsxs)(Aj,{ref:o,isActive:n,isCursor:r,accent:`sage`,onClick:i,"aria-label":`Session: ${s}`,"data-selected":n||void 0,className:`group`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0 flex-1`,children:[(0,G.jsx)(BO,{tone:Jj(e.status),pulse:e.status===`active`,className:`mt-1.5 shrink-0`}),(0,G.jsx)(`h3`,{className:`font-serif italic text-sm text-on-surface truncate leading-snug`,children:s})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,G.jsx)(Hj,{annotation:e.release_state}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant whitespace-nowrap`,children:WA(e.started_at)}),(0,G.jsx)(IA,{data:e.activity_buckets,widthPx:48,heightPx:14}),(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),a()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:`opacity-0 group-hover:opacity-100 focus-visible:opacity-100 p-1 rounded hover:bg-terracotta/10 hover:text-terracotta transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-terracotta/40`,"aria-label":`Delete session ${s}`,title:`Delete session`,children:(0,G.jsx)(ks,{className:`h-3.5 w-3.5`})})]})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 ml-5 font-mono text-[11px] text-on-surface-variant truncate`,children:[e.agent,` · `,t,` · `,e.prompt_count,`p · `,e.tool_count,`t`]}),e.branch&&(0,G.jsxs)(`div`,{className:`mt-0.5 ml-5 inline-flex items-center gap-1 font-mono text-[10px] italic text-on-surface-variant`,children:[(0,G.jsx)(Go,{className:`h-2.5 w-2.5`}),e.branch]})]})});function Xj(){return(0,G.jsxs)(`div`,{className:`border-b border-[var(--ghost-border)] last:border-b-0 px-4 py-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`mt-1.5 h-1.5 w-1.5 rounded-full bg-surface-container-high animate-pulse shrink-0`}),(0,G.jsx)(`div`,{className:`h-3 w-48 rounded bg-surface-container-high animate-pulse`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`}),(0,G.jsx)(`div`,{className:`h-3 w-12 rounded bg-surface-container-high animate-pulse`})]})]}),(0,G.jsx)(`div`,{className:`mt-1.5 ml-5 h-2.5 w-40 rounded bg-surface-container-high animate-pulse`})]})}function Zj({selectedId:e,search:t,statusFilter:n,agentFilter:r,offset:i,onOffsetChange:a,filterInputRef:o}){let s=Nn(),[c,l]=(0,W.useState)(null),u=Mk(),{data:d}=Pk(c?.id??null),{data:f}=Pj(),p=(0,W.useMemo)(()=>{let e=new Map;for(let t of f?.symbionts??[])e.set(t.name,t.displayName);return t=>t?e.get(t)??t:`unknown`},[f]),{data:m,isLoading:h,isError:g,error:_}=Dk({limit:50,offset:i,status:n,agent:r,search:t});function v(){c&&u.mutate(c.id,{onSuccess:()=>l(null)})}let y=m?.sessions??[],b=m?.total??0,x=(0,W.useRef)(!1);(0,W.useEffect)(()=>{x.current||!e&&!h&&y.length>0&&(x.current=!0,s(`/sessions/${y[0].id}`,{replace:!0}))},[e,h,y,s]);let S=Kj({items:y,getId:e=>e.id,selectedId:e,onActivate:e=>s(`/sessions/${e}`),filterInputRef:o}),C=y.filter(e=>e.status===`active`).length,w=y.reduce((e,t)=>e+(t.prompt_count??0),0),T=(0,G.jsxs)(`div`,{className:`px-4 py-3 border-b border-[var(--ghost-border)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-2`,children:[(0,G.jsx)(`h2`,{className:`myco-eyebrow-sm`,children:`Sessions`}),(0,G.jsx)(`span`,{className:`myco-display-sm text-on-surface`,children:`Archive`})]}),(0,G.jsxs)(`div`,{className:`font-mono text-[11px] text-on-surface-variant inline-flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:b.toLocaleString()}),` TOTAL`]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:C.toLocaleString()}),` ACTIVE`]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:w.toLocaleString()}),` PROMPTS`]})]})]});return g?(0,G.jsxs)(`div`,{children:[T,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-terracotta mt-4`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load sessions`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:_ instanceof Error?_.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{children:[T,h?(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsx)(`div`,{role:`list`,"aria-label":`Session archive loading`,children:Array.from({length:qj}).map((e,t)=>(0,G.jsx)(Xj,{},t))})}):y.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant mt-4`,children:[(0,G.jsx)(is,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:b===0&&!t&&!n&&!r?`No sessions yet`:`No matching sessions`}),b===0&&!t&&!n&&!r&&(0,G.jsx)(`span`,{className:`font-sans text-xs`,children:`Sessions appear here as you work with your agent`})]}):(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsx)(`div`,{...S.containerProps,role:`list`,"aria-label":`Session archive`,className:`outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sage/40`,children:(()=>{let t=Wj(y,{isActive:e=>e.status===`active`,startedAtEpochSec:e=>e.started_at}),n=0;return t.map(t=>(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{role:`separator`,className:`flex items-center justify-between px-4 py-2 border-b border-[var(--ghost-border)] bg-surface-container/40`,children:[(0,G.jsx)(`span`,{className:`myco-eyebrow-sm`,children:t.label}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline`,children:t.rows.length})]}),t.rows.map(t=>{let r=n++;return(0,G.jsx)(Yj,{ref:S.setRowRef(r),session:t,symbiontDisplayName:p(t.agent),isSelected:e===t.id,isCursor:S.cursorIndex===r,onClick:()=>s(`/sessions/${t.id}`),onDelete:()=>l(t)},t.id)})]},t.label))})()})}),(0,G.jsx)(Mj,{total:b,offset:i,limit:50,onPageChange:a}),(0,G.jsx)(jj,{open:c!==null,onOpenChange:e=>{e||l(null)},title:`Delete Session`,description:`This will permanently remove this session and all related data. This action cannot be undone.`,icon:(0,G.jsx)(ks,{className:`h-4 w-4 text-terracotta`}),meta:c?[{label:`ID`,value:qA(c.id)},{label:`Title`,value:c.title||qA(c.id)}]:[],impact:d?[{label:`Prompts`,value:d.promptCount},{label:`Spores`,value:d.sporeCount},{label:`Attachments`,value:d.attachmentCount},{label:`Graph Edges`,value:d.graphEdgeCount}]:[],confirmLabel:`Delete Session`,variant:`destructive`,onConfirm:v,isPending:u.isPending})]})}function Qj({children:e,className:t}){return(0,G.jsx)(`div`,{className:J(`font-sans text-xs font-medium uppercase tracking-widest text-on-surface-variant`,t),children:e})}function $j({images:e,index:t,onClose:n,onNavigate:r}){let i=e[t],a=t>0,o=t<e.length-1;(0,W.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]);let s=(0,W.useCallback)(e=>{e.key===`Escape`&&n(),e.key===`ArrowLeft`&&a&&r(t-1),e.key===`ArrowRight`&&o&&r(t+1)},[n,r,t,a,o]);return(0,W.useEffect)(()=>(document.addEventListener(`keydown`,s),()=>document.removeEventListener(`keydown`,s)),[s]),i?(0,G.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-surface-dim/90 backdrop-blur-xs`,onClick:n,children:[(0,G.jsx)(`button`,{onClick:n,className:`absolute top-4 right-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10`,children:(0,G.jsx)(Is,{className:`h-5 w-5`})}),e.length>1&&(0,G.jsxs)(`span`,{className:`absolute top-4 left-1/2 -translate-x-1/2 font-mono text-xs text-on-surface/60 z-10`,children:[t+1,` / `,e.length]}),a&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r(t-1)},className:`absolute left-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10`,children:(0,G.jsx)(go,{className:`h-6 w-6`})}),o&&(0,G.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r(t+1)},className:`absolute right-4 rounded-full bg-surface-container-high/80 p-2 text-on-surface hover:bg-surface-container-highest transition-colors z-10`,children:(0,G.jsx)(_o,{className:`h-6 w-6`})}),(0,G.jsx)(`img`,{src:i.src,alt:i.alt,className:`max-h-[90vh] max-w-[90vw] rounded-lg shadow-ambient object-contain`,onClick:e=>e.stopPropagation()})]}):null}var eM=new Set([`Read`,`read`]);function tM(e){return e.canopy_injection_tokens===null?!1:eM.has(e.tool_name)}function nM({sessionId:e,toolCallId:t}){let{data:n,isLoading:r,isError:i,error:a}=DA(e,t);return r?(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`h-3 w-3/4 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-3 w-2/3 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-3 w-1/2 animate-pulse rounded bg-surface-container-high`})]}):i||n===null?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Bo,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:a instanceof Error?a.message:`No injection blob available for this tool call.`})]}):(0,G.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap break-words bg-surface-container-lowest rounded-md p-3 text-on-surface overflow-x-auto`,"data-testid":`canopy-blob-text`,children:n.blob})}function rM({sessionId:e,activity:t}){let[n,r]=(0,W.useState)(!1);if(!tM(t))return null;let i=t.canopy_injection_tokens;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r(!0)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},className:J(`inline-flex items-center gap-1 px-1.5 py-0.5 rounded`,`font-mono text-[10px] text-sage`,`bg-sage/10 hover:bg-sage/20 transition-colors cursor-pointer`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sage/40`),title:`Canopy injected ${i} tokens of file anatomy. Click to view the blob sent to the agent.`,"aria-label":`Canopy injection: ${i} tokens`,"data-testid":`canopy-tool-call-indicator`,children:[(0,G.jsx)(ws,{className:`h-3 w-3`,"aria-hidden":`true`}),(0,G.jsxs)(`span`,{children:[i,` tok`]}),(0,G.jsx)(co,{className:`h-2.5 w-2.5 opacity-60`,"aria-hidden":`true`})]}),(0,G.jsx)($f,{open:n,onOpenChange:r,children:(0,G.jsxs)(rp,{className:`max-w-2xl`,children:[(0,G.jsxs)(ip,{children:[(0,G.jsx)(op,{children:`Canopy injection blob`}),(0,G.jsx)(sp,{children:`The verbatim file-anatomy snippet Cortex sent the agent before this Read. Transparency is the default — what you see here is exactly what the model saw.`})]}),(0,G.jsx)(nM,{sessionId:e,toolCallId:t.id})]})})]})}var iM=3;function aM({activity:e}){let[t,n]=(0,W.useState)(!1),r=e.success===1,i=!!(e.tool_input||e.tool_output_summary||e.error_message);return(0,G.jsxs)(`div`,{className:J(`border-l-2 transition-colors`,t?`border-l-primary/30`:`border-transparent hover:border-l-primary/20`),children:[(0,G.jsxs)(`div`,{role:`button`,tabIndex:0,className:`w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-surface-container/30 transition-all`,onClick:()=>n(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(e=>!e))},"aria-expanded":t,children:[t?(0,G.jsx)(ho,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}):(0,G.jsx)(_o,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`font-mono text-xs font-medium text-on-surface`,children:e.tool_name}),e.file_path&&(0,G.jsx)(`span`,{className:`truncate font-sans text-xs text-on-surface-variant flex-1`,children:e.file_path}),(0,G.jsx)(`span`,{className:`shrink-0 ml-auto`}),(0,G.jsx)(rM,{sessionId:e.session_id,activity:e}),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:ZA(e.duration_ms)}),r?(0,G.jsx)(So,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):(0,G.jsx)(wo,{className:`h-3.5 w-3.5 shrink-0 text-tertiary`})]}),(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-150 ease-out`,style:{gridTemplateRows:t?`1fr`:`0fr`},children:(0,G.jsx)(`div`,{className:`overflow-hidden`,children:(0,G.jsxs)(`div`,{className:`px-8 pb-3 space-y-2`,children:[!i&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant/60 italic py-1`,children:`No input/output details captured`}),e.tool_input&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-sans text-xs font-medium text-on-surface-variant mb-1`,children:`Input`}),(0,G.jsx)(`pre`,{className:`font-mono text-xs bg-surface-container-lowest rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all text-on-surface`,children:e.tool_input})]}),e.tool_output_summary&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-sans text-xs font-medium text-on-surface-variant mb-1`,children:`Output`}),(0,G.jsx)(`pre`,{className:`font-mono text-xs bg-surface-container-lowest rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all text-on-surface`,children:e.tool_output_summary})]}),e.error_message&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-sans text-xs font-medium text-tertiary mb-1`,children:`Error`}),(0,G.jsx)(`pre`,{className:`font-mono text-xs bg-tertiary/10 text-tertiary rounded-md p-2 overflow-x-auto whitespace-pre-wrap break-all`,children:e.error_message})]})]})})})]})}function oM({batchId:e,activityCount:t}){let[n,r]=(0,W.useState)(!1),{data:i,isLoading:a}=Ak(n?e:void 0);if(t===0)return null;let o=i??[];return(0,G.jsxs)(`div`,{className:`border-t border-[var(--ghost-border)]`,children:[(0,G.jsxs)(`button`,{type:`button`,className:J(`w-full flex items-center gap-2 px-4 py-2 text-left transition-colors`,`hover:bg-surface-container/30`),onClick:()=>r(e=>!e),children:[n?(0,G.jsx)(ho,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}):(0,G.jsx)(_o,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,children:`Tool Calls`}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant/60`,children:t})]}),(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-out`,style:{gridTemplateRows:n?`1fr`:`0fr`},children:(0,G.jsxs)(`div`,{className:`overflow-hidden`,children:[a&&(0,G.jsx)(`div`,{className:`px-3 py-2 space-y-1`,children:Array.from({length:Math.min(t,iM)}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-3 animate-pulse rounded bg-surface-container-high w-full`},t))}),!a&&o.length>0&&(0,G.jsx)(`div`,{className:`space-y-0`,children:o.map(e=>(0,G.jsx)(aM,{activity:e},e.id))})]})})]})}var sM=`h-7 w-7`;function cM(e){return new Date(e*1e3).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function lM(e){return e?e.length>120?e.slice(0,120)+`…`:e:`(no prompt)`}function uM({child:e}){return(0,G.jsxs)(`div`,{className:`mt-3 border-l-2 border-primary/30 pl-4 pb-3 mx-4`,children:[(0,G.jsx)(`div`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-primary/70 mb-1`,children:e.kind===`interrupt`?`⚠ interrupt`:`↳ steering`}),(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-1`,children:[(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant shrink-0`,children:`Prompt`}),e.started_at&&(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:cM(e.started_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface whitespace-pre-wrap`,children:e.user_prompt??`(no prompt)`}),e.activity_count>0&&(0,G.jsx)(oM,{batchId:e.id,activityCount:e.activity_count})]})}function dM({batch:e,batchAttachments:t,steeringChildren:n,defaultOpen:r=!1,promptIndex:i,isLast:a}){let[o,s]=(0,W.useState)(r),[c,l]=(0,W.useState)(null);return(0,G.jsxs)(`div`,{className:`relative flex gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative flex flex-col items-center shrink-0`,style:{width:`28px`},children:[i>0&&(0,G.jsx)(`div`,{className:`absolute top-0 w-px bg-outline-variant/40`,style:{height:`14px`}}),(0,G.jsx)(`div`,{className:J(sM,`rounded-full flex items-center justify-center shrink-0 text-[10px] font-mono font-bold transition-colors z-10`,o?`bg-primary text-on-primary`:`bg-surface-container-high text-on-surface-variant border border-outline-variant/40`),children:i+1}),!a&&(0,G.jsx)(`div`,{className:`flex-1 w-px bg-outline-variant/40`})]}),(0,G.jsxs)(Q,{level:`low`,className:J(`flex-1 overflow-hidden rounded-md max-w-full border border-outline-variant/10 mb-2`,e.kind===`recovered`&&`opacity-60 border-dashed`),children:[(0,G.jsxs)(`button`,{type:`button`,className:J(`flex w-full items-start gap-3 px-4 py-3 text-left transition-colors overflow-hidden`,`hover:bg-surface-container/40`,o&&`bg-surface-container/20`),onClick:()=>s(e=>!e),"aria-expanded":o,children:[o?(0,G.jsx)(ho,{className:`mt-0.5 h-4 w-4 shrink-0 text-on-surface-variant transition-transform`}):(0,G.jsx)(_o,{className:`mt-0.5 h-4 w-4 shrink-0 text-on-surface-variant transition-transform`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-0.5`,children:[(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant shrink-0`,children:e.kind===`recovered`?`Recovered`:`Prompt`}),e.activity_count>0&&(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant/70 shrink-0`,children:[e.activity_count,` tool call`,e.activity_count===1?``:`s`]}),e.started_at&&(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-on-surface-variant`,children:cM(e.started_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface truncate`,children:o?e.user_prompt??`(no prompt)`:lM(e.user_prompt)})]})]}),(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-out`,style:{gridTemplateRows:o?`1fr`:`0fr`},children:(0,G.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`px-4 pt-0 pb-3 overflow-hidden`,children:[e.user_prompt&&e.user_prompt.length>120&&(0,G.jsx)(uO,{content:e.user_prompt}),t.length>0&&(0,G.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-3`,children:t.map((e,t)=>(0,G.jsx)(`button`,{type:`button`,className:`rounded-md overflow-hidden hover:ring-2 hover:ring-primary/40 transition-all`,onClick:()=>l(t),children:(0,G.jsx)(`img`,{src:Mi(`/api/attachments/${e.file_path}`),alt:e.description??e.file_path??``,className:`max-w-[200px] max-h-[140px] object-cover rounded-md`,loading:`lazy`})},e.id))}),c!==null&&(0,G.jsx)($j,{images:t.map(e=>({src:Mi(`/api/attachments/${e.file_path}`),alt:e.description??e.file_path??``})),index:c,onNavigate:l,onClose:()=>l(null)})]}),e.activity_count>0&&(0,G.jsx)(oM,{batchId:e.id,activityCount:e.activity_count}),n.map(e=>(0,G.jsx)(uM,{child:e},e.id)),e.response_summary&&(0,G.jsx)(`div`,{className:`border-t border-[var(--ghost-border)] overflow-hidden`,children:(0,G.jsxs)(`div`,{className:`flex gap-3 px-4 py-3`,children:[(0,G.jsx)(`div`,{className:`w-0.5 shrink-0 rounded-full bg-primary/30`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 mb-1.5`,children:[(0,G.jsx)(fo,{className:`h-3 w-3 text-primary/60`}),(0,G.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,children:`Response`})]}),(0,G.jsx)(uO,{content:e.response_summary})]})]})})]})})]})]})}var fM=3;function pM(e){let t=new Map,n=[];for(let r of e)if(r.parent_prompt_batch_id==null)n.push(r);else{let e=t.get(r.parent_prompt_batch_id)??[];e.push(r),t.set(r.parent_prompt_batch_id,e)}return n.map(e=>({parent:e,children:(t.get(e.id)??[]).sort((e,t)=>(e.started_at??0)-(t.started_at??0))}))}var mM=[`human`],hM=[`human`,`system`,`agent_dispatch`,`hook_injected`];function gM({sessionId:e}){let[t,n]=(0,W.useState)(!1),{data:r,isLoading:i}=kk(e,t?hM:mM),{data:a}=jk(e),o=a??[],{byBatchId:s,byTurnNumber:c}=(0,W.useMemo)(()=>{let e=new Map,t=new Map;for(let n of o){if(n.prompt_batch_id!=null){let t=e.get(n.prompt_batch_id)??[];t.push(n),e.set(n.prompt_batch_id,t)}if(n.turn_number!=null){let e=t.get(n.turn_number)??[];e.push(n),t.set(n.turn_number,e)}}return{byBatchId:e,byTurnNumber:t}},[o]),l=(0,W.useMemo)(()=>pM([...r??[]].sort((e,t)=>(e.started_at??0)-(t.started_at??0))),[r]);return i?(0,G.jsx)(`div`,{className:`space-y-3 pl-11`,children:Array.from({length:fM}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-16 animate-pulse rounded-md bg-surface-container-low`},t))}):l.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(is,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No prompts recorded`})]}):(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-3 flex items-center justify-end pl-11 text-xs text-on-surface-variant`,children:(0,G.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-2 select-none`,children:[(0,G.jsx)(`input`,{type:`checkbox`,className:`h-3 w-3 cursor-pointer accent-primary`,checked:t,onChange:e=>n(e.target.checked)}),(0,G.jsx)(`span`,{children:`Show system & sub-agent prompts`})]})}),l.map(({parent:e,children:t},n)=>(0,G.jsx)(dM,{batch:e,batchAttachments:s.get(e.id)??(e.prompt_number===null?[]:c.get(e.prompt_number)??[]),steeringChildren:t,defaultOpen:n===l.length-1,promptIndex:n,isLast:n===l.length-1},e.id))]})}var _M=`▲`,vM=`▼`;function yM(e){let t=(e.match(/- \[x\]/gi)??[]).length;return{total:t+(e.match(/- \[ \]/g)??[]).length,checked:t}}var bM={active:`bg-green-500/10 text-green-500`,completed:`bg-blue-500/10 text-blue-500`},xM=`bg-muted text-muted-foreground`;function SM({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide`,bM[e]??xM),children:e})}function CM({plan:e,initialExpanded:t=!1,isDeleting:n=!1,onDelete:r}){let[i,a]=(0,W.useState)(t),o=(0,W.useMemo)(()=>e.content?yM(e.content):null,[e.content]),s=o!==null&&o.total>0,c=s?Math.round(o.checked/o.total*100):0,l=!!e.content,u=()=>{l&&a(e=>!e)};return(0,G.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/50 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:J(`flex items-start gap-3 p-4`,l&&`cursor-pointer hover:bg-muted/70 transition-colors`),onClick:l?u:void 0,onKeyDown:l?e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u())}:void 0,role:l?`button`:void 0,tabIndex:l?0:void 0,"aria-expanded":l?i:void 0,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(SM,{status:e.status}),e.title&&(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface truncate`,children:e.title})]}),e.source_path&&(0,G.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground truncate`,title:e.source_path,children:e.source_path}),(0,G.jsxs)(`div`,{className:`flex gap-3 font-sans text-xs text-muted-foreground`,children:[(0,G.jsxs)(`span`,{children:[`Created `,WA(e.created_at)]}),e.updated_at&&e.updated_at!==e.created_at&&(0,G.jsxs)(`span`,{title:GA(e.updated_at),children:[`Updated `,WA(e.updated_at)]})]}),s&&(0,G.jsxs)(`div`,{className:`space-y-1 pt-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between font-sans text-xs text-muted-foreground`,children:[(0,G.jsxs)(`span`,{children:[o.checked,`/`,o.total,` items`]}),(0,G.jsxs)(`span`,{children:[c,`%`]})]}),(0,G.jsx)(`div`,{className:`h-1.5 rounded-full bg-border overflow-hidden`,children:(0,G.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-all`,style:{width:`${c}%`}})})]})]}),(l||r)&&(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r&&(0,G.jsx)(`button`,{onClick:t=>{t.stopPropagation(),r(e.id)},className:`text-xs text-muted-foreground hover:text-destructive transition-colors cursor-pointer disabled:opacity-50`,disabled:n,"aria-label":`Delete plan`,children:n?`Deleting...`:`Delete`}),l&&(0,G.jsx)(`span`,{className:`mt-0.5 text-xs text-muted-foreground`,"aria-hidden":`true`,children:i?_M:vM})]})]}),i&&e.content&&(0,G.jsx)(`div`,{className:`border-t border-border px-4 py-3`,children:(0,G.jsx)(uO,{content:e.content,className:`text-sm`})})]})}function wM({sessionId:e,expandedPlanId:t}){let{data:n,isLoading:r,isError:i}=Fk(e),a=Ik(e),[o,s]=(0,W.useState)(null);async function c(){if(o)try{await a.mutateAsync(o.id),s(null)}catch{s(null)}}return r?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-muted-foreground`,children:`Loading plans...`})}):i?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-muted-foreground`,children:`Failed to load plans.`})}):!n||n.length===0?(0,G.jsx)(`div`,{className:`flex h-32 items-center justify-center rounded-lg border border-border bg-muted/30`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-muted-foreground`,children:`No plans captured for this session`})}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[a.isError&&(0,G.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 font-sans text-sm text-destructive`,children:`Failed to delete plan.`}),n.map(e=>(0,G.jsx)(CM,{plan:e,initialExpanded:e.status===`in_progress`||String(e.id)===t,isDeleting:a.isPending&&o?.id===e.id,onDelete:()=>s(e)},e.id)),(0,G.jsx)(jj,{open:o!==null,onOpenChange:e=>{e||s(null)},title:`Delete Plan`,description:`This will permanently remove this captured plan from the session.`,icon:(0,G.jsx)(ks,{className:`h-4 w-4 text-tertiary`}),meta:o?[{label:`Status`,value:o.status},{label:`Title`,value:o.title||o.source_path||o.id}]:[],confirmLabel:`Delete Plan`,variant:`destructive`,onConfirm:c,isPending:a.isPending})]})}var TM=15e3,EM=3e4,DM=3e4,OM=6e4;function kM(e){let t=new URLSearchParams;e?.type&&t.set(`type`,e.type),e?.status&&t.set(`status`,e.status),e?.search&&t.set(`search`,e.search),e?.limit!==void 0&&t.set(`limit`,String(e.limit)),e?.offset!==void 0&&t.set(`offset`,String(e.offset)),e?.session_id&&t.set(`session_id`,e.session_id);let n=t.toString(),r=n?`/spores?${n}`:`/spores`;return ot({queryKey:Ta([`spores`,e]),queryFn:({signal:e})=>$i(r,{signal:e}),staleTime:TM,refetchInterval:Hs.SPORES})}function AM(e){return ot({queryKey:Ta([`spore`,e]),queryFn:({signal:t})=>$i(`/spores/${e}`,{signal:t}),enabled:e!==void 0,staleTime:EM})}function jM(e,t=1,n=!0){return ot({queryKey:Ta([`graph`,e,t]),queryFn:({signal:n})=>$i(`/graph/${e}?depth=${t}`,{signal:n}),enabled:n&&e!==void 0,staleTime:DM})}function MM(e=!0){return ot({queryKey:Ta([`full-graph`]),queryFn:({signal:e})=>$i(`/graph`,{signal:e}),enabled:e,staleTime:DM})}function NM(){return ot({queryKey:Ta([`graph-seeds`]),queryFn:({signal:e})=>$i(`/graph/seeds`,{signal:e}),staleTime:DM})}function PM(e){let t=e?`/digest?agent_id=${encodeURIComponent(e)}`:`/digest`;return ot({queryKey:Ta([`digest`,e]),queryFn:({signal:e})=>$i(t,{signal:e}),staleTime:OM})}var FM=200,IM={decision:`default`,discovery:`default`,wisdom:`default`,architecture:`default`,trade_off:`secondary`,"cross-cutting":`secondary`,pattern:`secondary`,gotcha:`destructive`,bug_fix:`destructive`},LM={active:`default`,superseded:`outline`,consolidated:`outline`,archived:`outline`};function RM({spore:e}){let[t,n]=(0,W.useState)(!1),r=IM[e.observation_type]??`secondary`,i=LM[e.status]??`outline`,a=e.content.split(`
|
|
84
|
-
`).find(e=>e.trim().length>0)?.replace(/^#+\s*/,``)??``;return(0,G.jsxs)(Q,{level:`low`,className:J(`rounded-md border border-outline-variant/20 transition-colors`,e.status===`superseded`&&`opacity-70`),role:`listitem`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-expanded":t,className:`w-full px-4 py-3 text-left hover:bg-surface-container-high/50 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t?(0,G.jsx)(ho,{className:`h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant`}):(0,G.jsx)(_o,{className:`h-4 w-4 mt-0.5 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-1`,children:[(0,G.jsx)(X,{variant:r,children:e.observation_type}),(0,G.jsx)(X,{variant:i,children:e.status})]}),(0,G.jsx)(`p`,{className:J(`font-sans text-sm text-on-surface truncate`,e.status===`superseded`&&`line-through`),children:a})]})]})}),t&&(0,G.jsxs)(`div`,{className:`border-t border-outline-variant/20 px-4 py-3 space-y-3`,children:[(0,G.jsx)(uO,{content:e.content}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{title:GA(e.created_at),children:[`Created `,WA(e.created_at)]}),(0,G.jsxs)(`span`,{title:GA(e.updated_at),children:[`Last updated `,WA(e.updated_at)]})]})]})]})}function zM({sessionId:e,className:t}){let{data:n,isPending:r,isError:i}=kM({session_id:e,limit:FM});return r?(0,G.jsx)(`div`,{className:J(`space-y-3 p-4`,t),children:Array.from({length:3}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-20 animate-pulse rounded-md bg-surface-container-high`},t))}):i||!n?(0,G.jsx)(`div`,{className:J(`p-4 text-sm text-tertiary`,t),role:`alert`,children:`Failed to load spores for this session.`}):n.spores.length===0?(0,G.jsxs)(`div`,{className:J(`p-8 text-center text-on-surface-variant`,t),children:[(0,G.jsx)(`p`,{className:`font-sans text-sm italic`,children:`No spores derived from this session yet.`}),(0,G.jsx)(`p`,{className:`mt-2 font-mono text-xs`,children:`Spores get captured automatically as the agent learns from your prompts.`})]}):(0,G.jsx)(`div`,{className:J(`space-y-3 p-4`,t),role:`list`,children:n.spores.map(e=>(0,G.jsx)(RM,{spore:e},e.id))})}var BM=`/cortex?tab=canopy`,VM=1e3,HM=1e6;function UM(e){let t=e<0?`-`:``,n=Math.abs(e);return n>=HM?`${t}${(n/HM).toFixed(1)}M`:n>=VM*10?`${t}${Math.round(n/VM)}k`:n>=VM?`${t}${(n/VM).toFixed(1)}k`:`${t}${n.toLocaleString()}`}function WM(e){return e===null?`—`:e.toLocaleString()}function GM({label:e,value:t,hint:n}){return(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 py-1.5 border-b border-[var(--ghost-border)] last:border-0`,title:n,children:[(0,G.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-outline`,children:e}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:t})]})}function KM({sessionId:e,fixture:t,className:n}){let[r,i]=(0,W.useState)(!1),a=t!==void 0,{data:o,isLoading:s}=vA(a?void 0:e),c=a?t:o??null;if(!a&&s)return null;let l=c?.canopy_tokens_saved??0,u=c?.canopy_injections_offered??null,d=c?.canopy_skips_after_injection??null,f=c?.canopy_reads_after_injection??null,p=c?.canopy_redundant_reads??null,m=c?.canopy_injection_total_tokens??null,h=gA(c,`myco_cortex`,`canopy_map`),g=u!==null&&u>0&&d!==null?`${d}/${u} skipped`:null;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:J(`rounded-lg border border-outline-variant/10 bg-surface-container/60 p-4 border-t-2 border-t-sage`,`transition-[border-color,background-color] duration-200`,`hover:border-outline-variant/25 hover:bg-surface-container/80 cursor-pointer text-left`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sage/40`,n),"data-testid":`canopy-efficiency-tile`,"aria-label":`${UM(l)} tokens saved by Canopy. Click for breakdown.`,children:[(0,G.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-wider text-outline mb-2`,children:`Reads saved`}),(0,G.jsx)(`div`,{className:`flex items-end justify-between gap-2`,children:(0,G.jsx)(`p`,{className:J(`font-serif text-2xl font-bold`,l>=0?`text-sage`:`text-terracotta`),children:UM(l)})}),g&&(0,G.jsx)(`p`,{className:`font-mono text-[10px] text-outline mt-1`,children:g}),(0,G.jsxs)(`p`,{className:`font-mono text-[10px] text-outline mt-1`,"data-testid":`canopy-map-calls`,children:[`Map calls: `,h]})]}),(0,G.jsx)($f,{open:r,onOpenChange:i,children:(0,G.jsxs)(rp,{className:`max-w-md`,children:[(0,G.jsxs)(ip,{children:[(0,G.jsx)(op,{children:`Canopy: Reads saved this session`}),(0,G.jsx)(sp,{children:`Direct token savings from files the agent skipped Reading after Canopy injected file anatomy via PreToolUse.`})]}),(0,G.jsxs)(`div`,{className:`mb-4`,children:[(0,G.jsx)(`p`,{className:J(`font-serif text-3xl font-bold tracking-tight`,l>=0?`text-sage`:`text-terracotta`),"aria-label":`${UM(l)} net tokens saved on Reads`,children:UM(l)}),(0,G.jsxs)(`p`,{className:`font-mono text-[10px] uppercase tracking-wider text-outline mt-1`,children:[`net tokens `,l>=0?`saved on reads`:`spent on injections`]})]}),(0,G.jsxs)(`div`,{className:`space-y-0`,children:[(0,G.jsx)(GM,{label:`Injections offered`,value:WM(u),hint:`PreToolUse Read events where Canopy injected anatomy.`}),(0,G.jsx)(GM,{label:`Skipped after injection`,value:WM(d),hint:`Files the agent did not Read after seeing the injected blob.`}),(0,G.jsx)(GM,{label:`Read anyway`,value:WM(f),hint:`Files the agent Read in full after the injection.`}),(0,G.jsx)(GM,{label:`Injection cost`,value:m===null?`—`:`${UM(m)} tok`,hint:`Sum of tokens spent on Canopy injections this session.`}),p!==null&&p>0&&(0,G.jsx)(GM,{label:`Redundant reads`,value:WM(p),hint:`Files Read more than once in this session (informational).`}),(0,G.jsx)(GM,{label:`Map calls`,value:h.toLocaleString(),hint:`Times the agent called canopy_map() during this session.`})]}),(0,G.jsx)(ri,{to:BM,onClick:()=>i(!1),className:`inline-block mt-4 font-mono text-xs text-sage hover:underline`,children:`Learn more about Canopy →`})]})})]})}function qM(e){return e===`active`?`active`:e===`completed`?`completed`:`error`}var JM={active:`bg-primary`,completed:`bg-secondary`,error:`bg-tertiary`},YM={active:`bg-primary/15 text-primary`,completed:`bg-surface-container-high text-on-surface-variant`,error:`bg-tertiary/15 text-tertiary`};function XM({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-block h-2 w-2 rounded-full shrink-0`,JM[qM(e)])})}function ZM({status:e}){let t=qM(e),n=e.charAt(0).toUpperCase()+e.slice(1);return(0,G.jsxs)(`span`,{className:J(`inline-flex items-center gap-1.5 rounded-xs px-2 py-0.5 font-sans text-xs font-medium`,YM[t]),children:[(0,G.jsx)(XM,{status:e}),n]})}function QM(e){return e===null?`—`:UA(new Date(e*1e3).toISOString())}var $M=1500;function eN({label:e,value:t,mono:n=!0,copyable:r=!1,code:i=!1}){let[a,o]=(0,W.useState)(!1),s=(0,W.useCallback)(()=>{navigator.clipboard.writeText(t),o(!0),setTimeout(()=>o(!1),$M)},[t]),c=i?(0,G.jsx)(`code`,{className:`text-xs font-mono text-primary bg-surface-container-lowest rounded px-1.5 py-0.5`,children:t}):(0,G.jsx)(`span`,{className:J(`text-xs text-on-surface`,n&&`font-mono`),children:t});return(0,G.jsxs)(`div`,{className:`flex items-baseline gap-3 py-1.5 border-b border-[var(--ghost-border)] last:border-0`,children:[(0,G.jsx)(`span`,{className:`shrink-0 w-20 font-sans text-xs font-medium text-on-surface-variant`,children:e}),r?(0,G.jsxs)(`button`,{onClick:s,title:`Click to copy`,className:`flex items-center gap-1.5 min-w-0 hover:text-primary transition-colors cursor-pointer`,children:[c,a&&(0,G.jsx)(mo,{className:`h-3 w-3 text-primary shrink-0`})]}):(0,G.jsx)(`span`,{className:`min-w-0`,children:c})]})}function tN({label:e,value:t,activeTab:n,onClick:r}){return(0,G.jsx)(`button`,{onClick:()=>r(t),className:J(`px-4 py-2 font-sans text-sm font-medium transition-colors cursor-pointer`,n===t?`border-b-2 border-primary text-on-surface`:`text-muted-foreground hover:text-on-surface`),children:e})}function nN({id:e}){let t=Nn(),{data:n,isLoading:r,isError:i,error:a}=Ok(e),{data:o}=Pj(),s=eA(),c=Nk(),[l,u]=(0,W.useState)(`idle`),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`tab`);return e===`plans`?`plans`:e===`spores`?`spores`:`conversation`}),[h]=(0,W.useState)(()=>new URLSearchParams(window.location.search).get(`plan`)),g=Mk(),{data:_}=Pk(d?e:null),{data:v}=Fk(e);if(r)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(`/sessions`),className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Session Archive`})]}),(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(es,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Loading session...`})]})]});if(i||!n)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(`/sessions`),className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Session Archive`})]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Session not found`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:a instanceof Error?a.message:`Unknown error`})]})]});let y=o?Fj(o.symbionts,n.agent,e):null;return(0,G.jsxs)(`div`,{className:`space-y-6 overflow-hidden`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(`/sessions`),className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Session Archive`})]}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(`h1`,{className:`myco-display-lg text-on-surface m-0`,children:n.title??qA(n.id)}),(0,G.jsx)(ZM,{status:n.status}),(0,G.jsx)(Vj,{annotation:n.release_state}),n.agent&&(0,G.jsx)(X,{variant:`outline`,className:`font-mono text-[10px] px-1.5 py-0`,children:n.agent}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,className:`ml-auto gap-2`,disabled:l===`running`,onClick:async()=>{u(`running`);try{await s.mutateAsync({task:`title-summary`,instruction:`Process session ${e} only`}),u(`done`)}catch{u(`error`)}},children:[l===`running`?(0,G.jsx)(es,{className:`h-4 w-4 animate-spin`}):(0,G.jsx)(Cs,{className:`h-4 w-4`}),l===`done`?`Summary Requested`:`Generate Summary`]}),(()=>{let t=n.status!==`active`,r=c.isSuccess?`Session Completed`:t?`Already Completed`:`Complete Session`;return(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,className:`gap-2`,disabled:c.isPending||t,title:t?`Session is already completed`:`Mark this session completed and regenerate its summary`,onClick:()=>c.mutate(e),children:[c.isPending?(0,G.jsx)(es,{className:`h-4 w-4 animate-spin`}):(0,G.jsx)(So,{className:`h-4 w-4`}),r]})})(),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`gap-2 text-tertiary hover:text-tertiary hover:bg-tertiary/10`,onClick:()=>f(!0),children:[(0,G.jsx)(ks,{className:`h-4 w-4`}),`Delete`]})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 font-sans text-sm text-on-surface-variant`,children:[n.user&&(0,G.jsxs)(`span`,{children:[`User: `,(0,G.jsx)(`span`,{className:`text-on-surface`,children:n.user})]}),n.branch&&(0,G.jsxs)(`span`,{children:[`Branch: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:n.branch})]}),(0,G.jsxs)(`span`,{children:[`Started `,QM(n.started_at)]}),n.ended_at&&(0,G.jsxs)(`span`,{children:[`Duration: `,XA(n.started_at,n.ended_at)]})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-4 gap-4`,children:[(0,G.jsx)(RA,{label:`Prompts`,value:String(n.prompt_count),tone:`sage`}),(0,G.jsx)(RA,{label:`Tool Calls`,value:String(n.tool_count),tone:`sage`}),(0,G.jsx)(RA,{label:`Plans`,value:String(v?.length??0)}),(0,G.jsx)(KM,{sessionId:e})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-4 overflow-hidden`,children:[(0,G.jsx)(Qj,{className:`mb-3`,children:`Metadata`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-6`,children:[(0,G.jsx)(eN,{label:`Session ID`,value:e,copyable:!0}),y&&(0,G.jsx)(eN,{label:`Resume`,value:y,copyable:!0,code:!0}),n.parent_session_id&&(0,G.jsx)(eN,{label:`Parent`,value:n.parent_session_id}),n.parent_session_reason&&(0,G.jsx)(eN,{label:`Reason`,value:n.parent_session_reason,mono:!1}),n.project_root&&(0,G.jsx)(eN,{label:`Project`,value:n.project_root})]})]}),n.summary&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 overflow-hidden`,children:[(0,G.jsx)(Qj,{className:`mb-2`,children:`Summary`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant whitespace-pre-wrap break-words`,children:n.summary})]}),(0,G.jsxs)(`div`,{className:`min-w-0 overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`flex gap-0 border-b border-border mb-4`,children:[(0,G.jsx)(tN,{label:`Conversation`,value:`conversation`,activeTab:p,onClick:m}),(0,G.jsx)(tN,{label:`Plans`,value:`plans`,activeTab:p,onClick:m}),(0,G.jsx)(tN,{label:`Spores`,value:`spores`,activeTab:p,onClick:m})]}),p===`conversation`&&(0,G.jsx)(gM,{sessionId:e}),p===`plans`&&(0,G.jsx)(wM,{sessionId:e,expandedPlanId:h}),p===`spores`&&(0,G.jsx)(zM,{sessionId:e})]}),(0,G.jsx)(jj,{open:d,onOpenChange:f,title:`Delete Session`,description:`This will permanently remove this session and all related data. This action cannot be undone.`,icon:(0,G.jsx)(ks,{className:`h-4 w-4 text-tertiary`}),meta:n?[{label:`ID`,value:qA(n.id)},{label:`Title`,value:n.title||qA(n.id)}]:[],impact:_?[{label:`Prompts`,value:_.promptCount},{label:`Spores`,value:_.sporeCount},{label:`Attachments`,value:_.attachmentCount},{label:`Graph Edges`,value:_.graphEdgeCount}]:[],confirmLabel:`Delete Session`,variant:`destructive`,onConfirm:()=>{g.mutate(n.id,{onSuccess:()=>{f(!1),t(`/sessions`)}})},isPending:g.isPending})]})}var rN=300;function iN(e,t=rN){let[n,r]=(0,W.useState)(e);return(0,W.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function aN({initialFilters:e}){let[t,n]=(0,W.useState)(``),r=iN(t),[i,a]=(0,W.useState)(e),[o,s]=(0,W.useState)(0),c=(0,W.useCallback)((e,t)=>{a(n=>({...n,[e]:t})),s(0)},[]),l=(0,W.useCallback)(e=>{n(e),s(0)},[]),u=(0,W.useCallback)(e=>{let t=i[e];return t&&t!==`all`?t:void 0},[i]);return{searchInput:t,debouncedSearch:r.length>0?r:void 0,filterValues:i,offset:o,setOffset:s,handleSearchChange:l,handleFilterChange:c,activeFilter:u}}var oN={key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:`active`,label:`Active`},{value:`completed`,label:`Completed`}]};function sN(){let{id:e}=Ln(),t=Nn(),n=(0,W.useRef)(null),{searchInput:r,debouncedSearch:i,filterValues:a,offset:o,setOffset:s,handleSearchChange:c,handleFilterChange:l,activeFilter:u}=aN({initialFilters:{status:`all`,agent:`all`}}),{data:d}=Pj(),f=(0,W.useMemo)(()=>[oN,{key:`agent`,label:`Symbiont`,options:[{value:`all`,label:`All symbionts`},...(d?.symbionts??[]).filter(e=>e.enabled).map(e=>({value:e.name,label:e.displayName}))]}],[d]),p=u(`status`),m=u(`agent`);return(0,G.jsxs)(`div`,{className:`flex flex-col h-full gap-4 p-4`,children:[(0,G.jsx)(Ej,{searchPlaceholder:`Search sessions...`,searchValue:r,onSearchChange:c,filters:f,filterValues:a,onFilterChange:l,inputRef:n}),(0,G.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,G.jsx)(wj,{hasSelection:!!e,onCloseMobileDetail:()=>t(`..`),masterAriaLabel:`Sessions`,detailAriaLabel:`Session details`,master:(0,G.jsx)(Zj,{selectedId:e,search:i,statusFilter:p,agentFilter:m,offset:o,onOffsetChange:s,filterInputRef:n}),detail:e?(0,G.jsx)(nN,{id:e}):(0,G.jsx)(Tj,{message:`Select a session to see its details.`})})})]})}function cN({title:e,subtitle:t,actions:n,className:r}){return(0,G.jsx)(`div`,{className:J(`pb-6`,r),children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`font-serif text-2xl font-normal text-on-surface tracking-wide`,children:e}),t&&(0,G.jsx)(`p`,{className:`mt-1 font-sans text-sm text-on-surface-variant`,children:t})]}),n&&(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:n})]})})}function lN({checked:e,onCheckedChange:t,disabled:n}){return(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,disabled:n,onClick:()=>t(!e),className:`relative inline-flex h-6 w-11 shrink-0 rounded-full transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 ${n?`cursor-not-allowed opacity-50`:`cursor-pointer`} ${e?`bg-primary`:`bg-surface-container-high`}`,children:(0,G.jsx)(`span`,{className:`pointer-events-none block h-5 w-5 rounded-full bg-on-surface shadow-lg ring-0 transition-transform ${e?`translate-x-5`:`translate-x-0`}`})})}var uN=(0,W.createContext)(null);function dN({children:e}){let[t,n]=(0,W.useState)(()=>new Set),r=(0,W.useCallback)(e=>{n(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),i=(0,W.useCallback)(()=>n(new Set),[]),a=(0,W.useMemo)(()=>({dirty:t,markDirty:r,clear:i}),[t,r,i]);return(0,G.jsx)(uN.Provider,{value:a,children:e})}function fN(){let e=(0,W.useContext)(uN);if(!e)throw Error(`useRestartGate must be inside RestartGateProvider`);return e}function pN(){return(0,W.useContext)(uN)?.markDirty??(()=>{})}function mN(){let{dirty:e,clear:t}=fN(),{restart:n,isRestarting:r}=ec();if(e.size===0)return null;let i=async()=>{try{await n(),t()}catch{}};return(0,G.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-4 rounded-md border border-ochre/40 bg-ochre/5 p-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Restart required`}),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant truncate`,children:[`Changed: `,[...e].join(`, `)]})]}),(0,G.jsxs)(Y,{onClick:i,size:`sm`,disabled:r,children:[r?(0,G.jsx)(es,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):(0,G.jsx)(ps,{className:`mr-1.5 h-3.5 w-3.5`}),`Restart daemon`]})]})}function hN({id:e,label:t,scope:n,scopeIndicator:r,hint:i,helper:a,error:o,children:s}){return(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:e,className:`font-sans text-sm font-medium text-on-surface`,children:t}),i&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant font-normal`,children:[`(`,i,`)`]}),r??(n?(0,G.jsx)(OO,{scope:n}):null)]}),s,a&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:a}),o&&(0,G.jsxs)(`p`,{className:`flex items-center gap-1 font-sans text-xs text-tertiary`,children:[(0,G.jsx)(yo,{className:`h-3 w-3`}),`Save failed: `,o]})]})}function gN(e,t,n){return e||(t===`local`?`personal`:t===`grove`||n===`grove`?`grove`:`project`)}function _N({path:e,label:t,hint:n,defaultScope:r=`local`,lockScope:i,allowPersonal:a=!0,requiresRestart:o,commitOn:s=`change`,parse:c,scopeBadgeOverride:l,children:u}){let{effective:d,local:f,setField:p,resetField:m,promoteField:h}=Na(),g=pN(),_=ga(d??{},e),v=!i&&ga(f??{},e)!==void 0,y=i??r,b=(0,W.useRef)(_);b.current=_;let[x,S]=(0,W.useState)(_),C=(0,W.useRef)(!1);(0,W.useEffect)(()=>{C.current||S(_)},[_]);let[w,T]=(0,W.useState)(null),E=(0,W.useCallback)(t=>{let n=c?c(t):t;n!==b.current&&(T(null),p(e,n,y).then(()=>{o&&g(e)}).catch(t=>{S(b.current),T(t instanceof Error?t.message:String(t)),console.error(`[scoped-field] write failed for ${e}`,t)}))},[e,y,c,o,p,g]),D=(0,W.useCallback)(e=>{C.current=!0,S(e),s===`change`&&(E(e),C.current=!1)},[E,s]),O=(0,W.useCallback)(()=>{s===`blur`&&x!==void 0&&E(x),C.current=!1},[E,s,x]),k=gN(l,i,r),A;!i&&a&&(r===`local`?v&&(A=(0,G.jsx)(kO,{mode:`local-default`,onPromote:()=>h(e).catch(e=>console.error(`[scoped-field] promote failed`,e)),onReset:()=>m(e).catch(e=>console.error(`[scoped-field] reset failed`,e))})):A=(0,G.jsx)(kO,{mode:`shared-default`,hasLocalOverride:v,defaultScopeBadge:k===`personal`?`project`:k,onSavePersonal:()=>p(e,b.current,`local`).catch(e=>console.error(`[scoped-field] save-personal failed`,e)),onReset:()=>m(e).catch(e=>console.error(`[scoped-field] reset failed`,e))}));let j=a&&r!==`local`&&!i?void 0:k;return(0,G.jsx)(`div`,{id:Xa(e),"data-config-field":e,className:`rounded-md transition-all duration-300`,children:(0,G.jsx)(hN,{label:t,hint:n,scope:A?void 0:j,scopeIndicator:A,error:w??void 0,children:u({value:x,onChange:D,onBlur:O})})})}var vN=200,yN={1500:`T1500 — Compact`,5e3:`T5000 — Standard`,1e4:`T10000 — Full`};function bN(e){return yN[e]??`T${e}`}function xN({tier:e}){let[t,n]=(0,W.useState)(!1),r=e.content.length>vN,i=r&&!t?e.content.slice(0,vN)+`…`:e.content;return(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface font-medium`,children:bN(e.tier)}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Generated `,WA(e.generated_at)]})]}),(0,G.jsx)(uO,{content:i}),r&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:`h-7 gap-1 text-xs text-on-surface-variant`,onClick:()=>n(!t),children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(vo,{className:`h-3 w-3`}),`Show less`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ho,{className:`h-3 w-3`}),`Show more (`,e.content.length-vN,` more chars)`]})})]})}function SN(){return(0,G.jsxs)(Q,{level:`low`,className:`p-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`div`,{className:`h-4 w-24 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-20 animate-pulse rounded bg-surface-container`})]}),(0,G.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[(0,G.jsx)(`div`,{className:`h-3 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-3/5 animate-pulse rounded bg-surface-container`})]})]})}function CN({agentId:e}){let{data:t,isLoading:n,isError:r,error:i}=PM(e),a=t?.tiers??[];return n?(0,G.jsx)(`div`,{className:`space-y-4`,children:[1,2,3].map(e=>(0,G.jsx)(SN,{},e))}):r?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-destructive`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load digest`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:i instanceof Error?i.message:`Unknown error`})]}):a.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(Ho,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No digest generated yet`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-center max-w-xs`,children:`Run the agent with the digest-only task to synthesize your vault knowledge into context extracts.`})]}):(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[a.length,` tier`,a.length===1?``:`s`,` — pre-computed context extracts at different token budgets.`]}),a.map(e=>(0,G.jsx)(xN,{tier:e},e.tier))]})}var wN=6,TN=[{value:`all`,label:`All`},{value:`yes`,label:`Yes`},{value:`no`,label:`No`}],EN=[{value:`all`,label:`All`},{value:`typescript`,label:`TypeScript`},{value:`javascript`,label:`JavaScript`},{value:`tsx`,label:`TSX`},{value:`jsx`,label:`JSX`},{value:`python`,label:`Python`},{value:`rust`,label:`Rust`},{value:`go`,label:`Go`},{value:`json`,label:`JSON`},{value:`yaml`,label:`YAML`},{value:`markdown`,label:`Markdown`},{value:`shell`,label:`Shell`},{value:`sql`,label:`SQL`}],DN=[{id:`path`,label:`Path`},{id:`language`,label:`Language`},{id:`embedded`,label:`Embedded`},{id:`llm_updated_at`,label:`Last Described`},{id:`token_estimate`,label:`Tokens`}];function ON(e){if(e===`yes`)return!0;if(e===`no`)return!1}function kN(e){return(0,G.jsx)(X,{variant:e?`default`:`secondary`,children:e?`Yes`:`No`})}function AN({label:e,value:t,options:n,onValueChange:r,triggerClassName:i=`w-32`}){return(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-sans text-xs uppercase tracking-wider`,children:e}),(0,G.jsx)(`div`,{className:`${i} shrink-0`,children:(0,G.jsxs)(w_,{value:t,onValueChange:r,children:[(0,G.jsx)(E_,{children:(0,G.jsx)(T_,{})}),(0,G.jsx)(D_,{children:n.map(e=>(0,G.jsx)(O_,{value:e.value,children:e.label},e.value))})]})})]})}function jN({children:e,className:t,sortKey:n,activeSort:r,activeDir:i,onSort:a}){let o=n!==void 0&&a!==void 0,s=o&&r===n;return o?(0,G.jsx)(`th`,{className:J(`px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,t),"aria-sort":s?i===`desc`?`descending`:`ascending`:`none`,children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>a(n),className:J(`flex items-center gap-1 uppercase tracking-widest text-[10px] font-medium transition-colors`,s?`text-on-surface`:`text-on-surface-variant hover:text-on-surface`),"aria-label":`Sort by ${String(e)}`,children:[(0,G.jsx)(`span`,{children:e}),s?i===`desc`?(0,G.jsx)(ho,{className:`h-3 w-3`}):(0,G.jsx)(vo,{className:`h-3 w-3`}):(0,G.jsx)(ho,{className:`h-3 w-3 opacity-30`})]})}):(0,G.jsx)(`th`,{className:J(`px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,t),children:e})}function MN(){return(0,G.jsxs)(`tr`,{className:`border-b border-[var(--ghost-border)]`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-64 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-16 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-20 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-12 rounded bg-surface-container-high animate-pulse`})})]})}function NN({entry:e,selected:t,onClick:n}){return(0,G.jsxs)(`tr`,{className:J(`border-b border-[var(--ghost-border)] last:border-0 cursor-pointer transition-all duration-150`,`hover:bg-surface-container/60 hover:shadow-[inset_3px_0_0_var(--primary)]`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40`,t&&`bg-primary/5 shadow-[inset_3px_0_0_var(--primary)]`),onClick:n,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},tabIndex:0,role:`row`,"aria-selected":t,"aria-label":`Canopy entry: ${e.path}`,"data-testid":`canopy-entry-row-${e.path}`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface block truncate`,title:e.path,children:e.path})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:e.language??`—`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:kN(e.llm_description!==null)}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:kN(e.embedded===1)}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:QA(e.llm_updated_at)})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:e.token_estimate.toLocaleString()})})]})}function PN({selectedPath:e,onSelectPath:t}){let{searchInput:n,debouncedSearch:r,filterValues:i,offset:a,setOffset:o,handleSearchChange:s,handleFilterChange:c,activeFilter:l}=aN({initialFilters:{language:`all`,described:`all`}}),[u,d]=(0,W.useState)(`llm_updated_at`),[f,p]=(0,W.useState)(`desc`),m=e=>{e===u?p(e=>e===`asc`?`desc`:`asc`):(d(e),p(`asc`))},{data:h,isLoading:g,isError:_,error:v}=bA((0,W.useMemo)(()=>({limit:50,offset:a,language:l(`language`),described:ON(l(`described`)),q:r,sort_by:u,sort_dir:f}),[a,l,r,u,f])),y=h?.rows??[],b=h?.total??0,x=(0,G.jsxs)(Q,{level:`bright`,className:`flex flex-wrap items-center gap-3 px-4 py-2 rounded-md`,children:[(0,G.jsx)(_s,{className:`h-3.5 w-3.5 text-on-surface-variant shrink-0`}),(0,G.jsx)(cp,{placeholder:`Search files (path or description)…`,value:n,onChange:e=>s(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1 min-w-[180px]`,"aria-label":`Search files`}),(0,G.jsx)(AN,{label:`Language`,value:i.language??`all`,options:EN,onValueChange:e=>c(`language`,e)}),(0,G.jsx)(AN,{label:`Described`,value:i.described??`all`,options:TN,onValueChange:e=>c(`described`,e)})]}),S=(0,G.jsx)(`thead`,{children:(0,G.jsx)(`tr`,{className:`border-b border-[var(--ghost-border)] bg-surface-container/50`,children:DN.map((e,t)=>{let n=[(0,G.jsx)(jN,{sortKey:e.id,activeSort:u,activeDir:f,onSort:m,children:e.label},e.id)];return e.id===`language`&&n.push((0,G.jsx)(jN,{children:`Described`},`described`)),n})})});return _?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[x,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load canopy entries`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:v instanceof Error?v.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[x,g?(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden`,children:(0,G.jsxs)(`table`,{className:`w-full`,children:[S,(0,G.jsx)(`tbody`,{children:Array.from({length:wN}).map((e,t)=>(0,G.jsx)(MN,{},t))})]})}):y.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-3 text-on-surface-variant`,"data-testid":`canopy-entries-empty`,children:[(0,G.jsx)(Ro,{className:`h-10 w-10 opacity-20`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:b===0?`No canopy entries match the current filters.`:`No matching entries on this page.`})]}):(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden`,children:(0,G.jsxs)(`table`,{className:`w-full`,"aria-label":`Canopy entries`,children:[S,(0,G.jsx)(`tbody`,{children:y.map(n=>(0,G.jsx)(NN,{entry:n,selected:n.path===e,onClick:()=>t(n.path)},n.path))})]})}),(0,G.jsx)(Mj,{total:b,offset:a,limit:50,onPageChange:o})]})}function FN({open:e,onClose:t,widthPx:n=480,children:r,ariaLabel:i=`Detail panel`,className:a,testIdRoot:o}){return(0,W.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),e?(0,G.jsxs)(Q,{glass:!0,role:`dialog`,"aria-label":i,className:J(`fixed top-3 right-3 bottom-3 z-30 flex flex-col shadow-lg border border-outline-variant/15 rounded-md max-w-[calc(100vw-1.5rem)]`,a),style:{width:n},"data-testid":o?`${o}-panel`:void 0,children:[(0,G.jsx)(`div`,{className:`flex justify-end px-3 pt-3`,children:(0,G.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Close detail`,"data-testid":o?`${o}-close`:void 0,className:`shrink-0 rounded-md p-1 text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high transition-colors`,children:(0,G.jsx)(Is,{className:`h-4 w-4`})})}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 pb-5 pt-2`,children:r})]}):null}function IN(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function LN(e){return e.length>12?`${e.slice(0,12)}…`:e}function RN({label:e,children:t}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-[140px_1fr] gap-3 items-baseline`,children:[(0,G.jsx)(`span`,{className:`font-sans text-xs uppercase tracking-wide text-on-surface-variant`,children:e}),(0,G.jsx)(`div`,{className:`font-mono text-xs text-on-surface min-w-0 break-all`,children:t})]})}function zN({text:e}){let[t,n]=(0,W.useState)(!1),r=(0,W.useCallback)(async()=>{navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(e),n(!0),window.setTimeout(()=>n(!1),1500))},[e]);return(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>void r(),className:`gap-1 px-2 h-6 text-xs text-on-surface-variant`,children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(mo,{className:`h-3 w-3`}),`Copied`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ko,{className:`h-3 w-3`}),`Copy`]})})}function BN(){return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(`div`,{className:`h-7 w-48 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-20 animate-pulse rounded-md bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:6}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-4 w-full animate-pulse rounded bg-surface-container-high`},t))})]})}function VN({path:e,onBack:t,onClose:n}){let{data:r,isPending:i,isError:a,error:o}=xA(e),s=SA(),c=CA(),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(null),[h,g]=(0,W.useState)(!1),_=(0,W.useMemo)(()=>IN(r?.exports_json??null),[r?.exports_json]),v=(0,W.useMemo)(()=>IN(r?.imports_json??null),[r?.imports_json]),y=(0,W.useCallback)(()=>{u(null),f(!1),s.mutate(e,{onSuccess:()=>{f(!0),window.setTimeout(()=>f(!1),2500)},onError:e=>{u(e instanceof Error?e.message:`Re-embed failed`)}})},[e,s]),b=(0,W.useCallback)(()=>{m(null),g(!1),c.mutate(e,{onSuccess:()=>{g(!0),window.setTimeout(()=>g(!1),2500)},onError:e=>{m(e instanceof Error?e.message:`Re-describe failed`)}})},[e,c]);if(i)return(0,G.jsx)(FN,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsx)(BN,{})});if(a)return(0,G.jsx)(FN,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[t?(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),`Back to list`]}):null,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,"data-testid":`canopy-entry-detail-error`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load entry`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:o instanceof Error?o.message:`Unknown error`})]})]})});if(!r)return(0,G.jsx)(FN,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[t?(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),`Back to list`]}):null,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant`,"data-testid":`canopy-entry-detail-empty`,children:[(0,G.jsx)(yo,{className:`h-5 w-5 opacity-50`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No entry found at this path.`})]})]})});let x=r.embedded===1;return(0,G.jsx)(FN,{open:!0,onClose:n,ariaLabel:`Canopy entry detail`,testIdRoot:`canopy-entry-detail`,children:(0,G.jsxs)(`div`,{className:`space-y-4`,"data-testid":`canopy-entry-detail`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-2 min-w-0`,children:[t?(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant -ml-2`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),`Back to list`]}):null,(0,G.jsx)(`h2`,{className:`font-mono text-sm text-on-surface break-all`,title:r.path,children:r.path}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r.language?(0,G.jsx)(X,{variant:`outline`,children:r.language}):null,(0,G.jsx)(X,{variant:x?`default`:`secondary`,children:x?`Embedded`:`Not embedded`}),(0,G.jsx)(X,{variant:r.llm_description?`default`:`secondary`,children:r.llm_description?`Described`:`No description`})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col items-end gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:b,disabled:c.isPending,className:`gap-2`,"data-testid":`canopy-entry-redescribe`,"aria-label":`Re-run the Myco agent's description for this file.`,title:`Re-run the Myco agent's description for this file.`,children:[(0,G.jsx)(Cs,{className:c.isPending?`h-3.5 w-3.5 animate-pulse`:`h-3.5 w-3.5`}),c.isPending?`Describing...`:`Re-describe`]}),(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:y,disabled:s.isPending,className:`gap-2`,"data-testid":`canopy-entry-reembed`,children:[(0,G.jsx)(ps,{className:s.isPending?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),s.isPending?`Queuing...`:`Re-embed`]})]}),h?(0,G.jsx)(`span`,{className:`font-sans text-xs text-primary`,role:`status`,children:`Queued for re-describe`}):null,p?(0,G.jsx)(`span`,{className:`font-sans text-xs text-tertiary`,role:`alert`,children:p}):null,d?(0,G.jsx)(`span`,{className:`font-sans text-xs text-primary`,role:`status`,children:`Queued for re-embed`}):null,l?(0,G.jsx)(`span`,{className:`font-sans text-xs text-tertiary`,role:`alert`,children:l}):null]})]}),r.llm_description?(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-primary/15 p-4`,children:[(0,G.jsx)(Qj,{children:`Description`}),(0,G.jsx)(`p`,{className:`mt-2 font-sans text-sm text-on-surface leading-relaxed`,children:r.llm_description})]}):(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4`,children:[(0,G.jsx)(Qj,{children:`Description`}),(0,G.jsx)(`p`,{className:`mt-2 font-sans text-sm text-on-surface-variant`,children:`The Myco agent hasn't described this file yet.`})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4 space-y-2`,children:[(0,G.jsx)(Qj,{children:`Exports`}),_.length===0?(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`No exports detected.`}):(0,G.jsx)(`ul`,{className:`space-y-1`,children:_.map(e=>(0,G.jsx)(`li`,{className:`font-mono text-xs text-on-surface break-all`,children:e},e))})]}),(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4 space-y-2`,children:[(0,G.jsx)(Qj,{children:`Imports`}),v.length===0?(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`No imports detected.`}):(0,G.jsx)(`ul`,{className:`space-y-1`,children:v.map(e=>(0,G.jsx)(`li`,{className:`font-mono text-xs text-on-surface break-all`,children:e},e))})]})]}),r.top_comment?(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4 space-y-2`,children:[(0,G.jsx)(Qj,{children:`Top Comment`}),(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs text-on-surface`,children:r.top_comment})]}):null,(0,G.jsxs)(Q,{level:`low`,className:`rounded-md border border-outline-variant/20 p-4 space-y-3`,children:[(0,G.jsx)(Qj,{children:`Metadata`}),(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(RN,{label:`Tokens`,children:r.token_estimate.toLocaleString()}),(0,G.jsx)(RN,{label:`Lines`,children:r.line_count.toLocaleString()}),(0,G.jsxs)(RN,{label:`Size`,children:[r.size_bytes.toLocaleString(),` B`]}),(0,G.jsx)(RN,{label:`Hash`,children:(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,G.jsx)(`code`,{title:r.content_hash,children:LN(r.content_hash)}),(0,G.jsx)(zN,{text:r.content_hash})]})}),(0,G.jsx)(RN,{label:`Indexed`,children:GA(r.mechanical_updated_at)}),(0,G.jsx)(RN,{label:`Described`,children:r.llm_updated_at===null?`—`:GA(r.llm_updated_at)})]})]})]})})}function HN({defaultPath:e}={}){let[t,n]=(0,W.useState)(e);return(0,G.jsxs)(`div`,{className:`relative space-y-6`,children:[(0,G.jsx)(PN,{selectedPath:t,onSelectPath:n}),t?(0,G.jsx)(VN,{path:t,onClose:()=>n(void 0)}):null]})}var UN={canopy_disabled:{title:`Canopy injection is turned off.`,detail:(0,G.jsxs)(G.Fragment,{children:[`Enable canopy injection on the`,` `,(0,G.jsx)(ri,{to:`/cortex?tab=canopy`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`Cortex → Canopy`}),` `,`page before regenerating the map.`]})},no_described_entries:{title:`No described files yet.`,detail:(0,G.jsxs)(G.Fragment,{children:[`The map is built from per-file descriptions written by the`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=canopy-describe`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`canopy-describe task`}),`, which is opt-in. Enable its schedule (or run it once) so files get described, then regenerate the map.`]})},inputs_unchanged:{title:`The map is already current.`,detail:(0,G.jsx)(G.Fragment,{children:`No described files have changed since the last run. Use Rebuild to regenerate from scratch.`})},no_project_root:{title:`Project root unavailable.`,detail:(0,G.jsx)(G.Fragment,{children:`The daemon can’t resolve a project directory for this vault.`})}};function WN(){let e=TA(),t=EA(),[n,r]=(0,W.useState)(null),[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(null),c=(0,W.useCallback)(e=>{r(null),a(null),s(e),t.mutate({force_cold_start:e===`rebuild`},{onSettled:()=>s(null),onSuccess:e=>{`skipped`in e&&e.skipped&&a(e.reason)},onError:e=>{r(e instanceof Error?e.message:`Regenerate failed`)}})},[t]),l=i?UN[i]??null:null,u=t.isPending,d=e.data,f=d?.is_empty===!0||!d?.content,p=d?.generated_at!==void 0&&d.generated_at!==null?GA(d.generated_at):`—`,m=d?.token_estimate!==void 0&&d.token_estimate!==null?d.token_estimate.toLocaleString():`—`;return(0,G.jsxs)(`div`,{className:`space-y-6`,"data-testid":`project-map-panel`,children:[(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-primary/15 p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-primary/10 p-2 text-primary`,children:(0,G.jsx)(ns,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`The Canopy Map is a guided tour of your project's architecture.`}),(0,G.jsxs)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:[`The Myco agent regenerates it as the codebase shifts, so connected agents can pull a current overview before exploring with Glob or Grep. Use `,(0,G.jsx)(`strong`,{children:`Rebuild`}),` to start over from scratch instead of refreshing the existing draft.`]})]})]})}),(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-2 min-w-0`,children:[(0,G.jsx)(Qj,{children:`Canopy Map`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{"data-testid":`project-map-generated-at`,children:[`Last generated: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:p})]}),(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,G.jsxs)(`span`,{"data-testid":`project-map-tokens`,children:[`Tokens: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:m})]}),f?(0,G.jsx)(X,{variant:`secondary`,className:`ml-1`,children:`No map yet`}):null]})]}),f?null:(0,G.jsxs)(`div`,{className:`flex flex-col items-end gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`default`,size:`sm`,onClick:()=>c(`refresh`),disabled:u,className:`gap-2`,"data-testid":`canopy-map-refresh`,children:[(0,G.jsx)(ps,{className:o===`refresh`?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),o===`refresh`?`Refreshing…`:`Refresh`]}),(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:()=>c(`rebuild`),disabled:u,className:`gap-2`,"data-testid":`canopy-map-rebuild`,children:[(0,G.jsx)(ms,{className:o===`rebuild`?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),o===`rebuild`?`Rebuilding…`:`Rebuild`]})]}),n?(0,G.jsx)(`span`,{className:`font-sans text-xs text-tertiary`,role:`alert`,children:n}):null]})]}),i?(0,G.jsxs)(`div`,{className:`mt-4 flex items-start gap-2 rounded-md border border-primary/20 bg-primary/5 p-3 text-xs text-on-surface`,role:`status`,"data-testid":`canopy-map-skip-notice`,children:[(0,G.jsx)(Jo,{className:`mt-0.5 h-3.5 w-3.5 flex-shrink-0 text-primary`}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`font-sans font-medium`,children:l?.title??`Regenerate skipped.`}),(0,G.jsx)(`p`,{className:`font-sans text-on-surface-variant`,children:l?.detail??(0,G.jsxs)(G.Fragment,{children:[`Reason: `,(0,G.jsx)(`code`,{className:`font-mono`,children:i})]})})]})]}):null]}),e.isPending?(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6`,children:(0,G.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,G.jsx)(`div`,{className:`h-5 w-1/3 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-full animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-5/6 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-2/3 animate-pulse rounded bg-surface-container-high`})]})}):e.isError?(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-tertiary/20 p-6`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 text-tertiary`,"data-testid":`project-map-error`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load Canopy Map.`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:e.error instanceof Error?e.error.message:`Unknown error`})]})}):f?(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-primary/20 p-8`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 text-center`,"data-testid":`project-map-empty`,children:[(0,G.jsx)(ns,{className:`h-6 w-6 text-primary`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface`,children:d?.message??`No Canopy Map yet.`}),(0,G.jsxs)(`p`,{className:`max-w-md font-sans text-xs text-on-surface-variant`,children:[`Generate the first map to give connected agents a high-level tour of your codebase. Future runs refresh incrementally; use`,` `,(0,G.jsx)(`strong`,{children:`Rebuild`}),` to start over.`]}),(0,G.jsxs)(`p`,{className:`max-w-md font-sans text-xs text-on-surface-variant`,children:[`The map needs at least one described file to build from. Enable the`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=canopy-describe`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`canopy-describe task`}),` `,`(opt-in by default) so files get described in the background.`]}),(0,G.jsxs)(Y,{variant:`default`,size:`sm`,onClick:()=>c(`rebuild`),disabled:u,className:`gap-2 mt-1`,"data-testid":`canopy-map-generate`,children:[(0,G.jsx)(ps,{className:u?`h-3.5 w-3.5 animate-spin`:`h-3.5 w-3.5`}),u?`Generating…`:`Generate Map`]}),n?(0,G.jsx)(`span`,{className:`font-sans text-xs text-tertiary`,role:`alert`,children:n}):null,i?(0,G.jsxs)(`div`,{className:`max-w-md space-y-1 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`p`,{className:`font-sans font-medium text-on-surface`,children:l?.title??`Regenerate skipped.`}),(0,G.jsx)(`p`,{className:`font-sans`,children:l?.detail??(0,G.jsxs)(G.Fragment,{children:[`Reason: `,(0,G.jsx)(`code`,{className:`font-mono`,children:i})]})})]}):null]})}):(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6`,children:(0,G.jsx)(`div`,{"data-testid":`project-map-content`,children:(0,G.jsx)(uO,{content:d.content})})})]})}var GN={2:`grid-cols-1 md:grid-cols-2`,3:`grid-cols-1 md:grid-cols-3`,4:`grid-cols-1 md:grid-cols-2 lg:grid-cols-4`};function KN(e,t){return e||(t<=2?2:t===3?3:4)}function qN({tabs:e,activeTab:t,onTabChange:n,columns:r,className:i}){return(0,G.jsx)(`div`,{role:`tablist`,className:J(`grid divide-y md:divide-y-0 md:divide-x divide-[var(--ghost-border)] border border-[var(--ghost-border)] rounded-md overflow-hidden bg-surface-container-low`,GN[KN(r,e.length)],i),children:e.map(e=>{let r=e.id===t;return(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.id),className:J(`relative flex flex-col items-start gap-1 px-4 py-3 text-left transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,r?`bg-surface-container text-on-surface`:`text-on-surface-variant hover:bg-surface-container/60 hover:text-on-surface`),children:[r&&(0,G.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-[2px] bg-sage`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.Icon&&(0,G.jsx)(e.Icon,{size:14,className:r?`text-sage`:`text-outline`}),(0,G.jsx)(`span`,{className:`myco-display-xs`,children:e.label})]}),e.description&&(0,G.jsx)(`span`,{className:`myco-eyebrow-sm`,children:e.description})]},e.id)})})}function JN({tabs:e,activeTab:t,onTabChange:n,className:r}){return(0,G.jsx)(`div`,{role:`tablist`,className:J(`inline-flex items-center gap-1 p-1 rounded-md bg-surface-container-low border border-[var(--ghost-border)]`,r),children:e.map(e=>{let r=e.id===t;return(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.id),className:J(`inline-flex items-center gap-1.5 px-3 py-1 rounded text-sm font-sans transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,r?`bg-surface-container text-on-surface shadow-[inset_0_-2px_0_var(--sage)]`:`text-on-surface-variant hover:text-on-surface`),children:[(0,G.jsx)(`span`,{children:e.label}),e.count!=null&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-outline`,children:e.count})]},e.id)})})}var YN=[{id:`overview`,label:`Overview`},{id:`entries`,label:`Entries`},{id:`map`,label:`Map`}],XN=new Set(YN.map(e=>e.id)),ZN=`section`,QN=[{id:`instructions`,label:`Instructions`,description:`session-start`},{id:`builder`,label:`Builder`,description:`prompt forge`},{id:`digest`,label:`Digest`,description:`context tiers`},{id:`canopy`,label:`Canopy`,description:`code index`}],$N=new Set(QN.map(e=>e.id)),eP=new Set([`completed`,`failed`,`skipped`]),tP=12,nP=140,rP=[{value:`1500`,label:`1.5K - Executive briefing`},{value:`5000`,label:`5K - Deep onboarding`},{value:`10000`,label:`10K - Full institutional`}];function iP(e){let t=new URLSearchParams(e).get(`tab`);return t&&$N.has(t)?t:`instructions`}function aP(e){let t=new URLSearchParams(e).get(ZN);return t&&XN.has(t)?t:`overview`}function oP(e){return e?new Date(e*1e3).toLocaleString():`Not generated yet`}function sP(e){switch(e){case`event-tasks-disabled`:return`event-driven tasks are disabled`;case`provider-not-configured`:return`no provider is configured for Cortex instructions`;case`agent-module-unavailable`:return`the agent harness is unavailable`;default:return e??`unknown reason`}}function cP(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=e.match(RegExp(`## ${n}\\n([\\s\\S]*?)\\n\\n## `));if(!r?.[1])return null;try{return JSON.parse(r[1])}catch{return null}}function lP(e){if(!e)return{goal:``,targetSymbiontName:null,targetSymbiontDisplayName:null,inlineInstructions:null};let t=e.match(/^Goal:\n([\s\S]*?)\n\n## Target symbiont\n/),n=cP(e,`Target symbiont`),r=cP(e,`Delivery contract`);return{goal:t?.[1]?.trim()??``,targetSymbiontName:n?.name??null,targetSymbiontDisplayName:n?.displayName??null,inlineInstructions:typeof r?.inline_instructions==`boolean`?r.inline_instructions:null}}function uP(e){switch(e){case`completed`:return`default`;case`failed`:return`destructive`;case`running`:return`warning`;default:return`secondary`}}function dP(e){return e===null?null:e?`Instructions included in prompt`:`Uses session-start instructions`}function fP(){return ot({queryKey:[`cortex-instructions`],queryFn:({signal:e})=>$i(`/cortex/instructions`,{signal:e}),staleTime:6e4})}function pP(e){return ot({queryKey:[`cortex-prompt-builder`,e],queryFn:({signal:t})=>$i(`/cortex/prompt-builder/${e}`,{signal:t}),enabled:!!e,staleTime:0,refetchInterval:e=>{let t=e.state.data?.status;return t&&eP.has(t)?!1:Hs.PROGRESS}})}function mP(){let e=An(),t=Nn(),n=iP(e.search),r=aP(e.search),i=(0,W.useCallback)(n=>{if(!$N.has(n))return;let r=new URLSearchParams(e.search);n===`instructions`?r.delete(`tab`):r.set(`tab`,n),n!==`canopy`&&r.delete(ZN);let i=r.toString();t({pathname:e.pathname,search:i?`?${i}`:``},{replace:!0})},[e.pathname,e.search,t]),a=(0,W.useCallback)(n=>{if(!XN.has(n))return;let r=new URLSearchParams(e.search);r.set(`tab`,`canopy`),n===`overview`?r.delete(ZN):r.set(ZN,n);let i=r.toString();t({pathname:e.pathname,search:i?`?${i}`:``},{replace:!0})},[e.pathname,e.search,t]);return(0,G.jsxs)(AA,{children:[(0,G.jsx)(cN,{title:`Cortex`,subtitle:`Manage session-start context, prompt building, and digest access for connected symbionts.`}),(0,G.jsx)(qN,{tabs:QN.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:n,onTabChange:i,columns:4}),n===`digest`?(0,G.jsx)(yP,{}):n===`builder`?(0,G.jsx)(_P,{}):n===`canopy`?(0,G.jsx)(hP,{section:r,onSectionChange:a,searchParams:e.search}):(0,G.jsx)(gP,{})]})}function hP({section:e,onSectionChange:t,searchParams:n}){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(JN,{tabs:YN.map(e=>({id:e.id,label:e.label})),activeTab:e,onTabChange:t}),e===`entries`?(()=>{let e=new URLSearchParams(n).get(`path`)??void 0;return(0,G.jsx)(HN,{defaultPath:e},e??`no-path`)})():e===`map`?(0,G.jsx)(WN,{}):(0,G.jsx)(xP,{})]})}function gP(){let{effective:e,isLoading:t}=Na(),n=fP(),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(!0),[s,c]=(0,W.useState)(null),l=(0,W.useCallback)(async()=>{i(!0);try{c(await sa(`/cortex/instructions/refresh`,{})),await n.refetch()}finally{i(!1)}},[n]);if(t||!e)return(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading...`});let u=n.data;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(Q,{level:`low`,accent:`sage`,className:`rounded-lg border border-outline-variant p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-sage/10 p-2 text-sage`,children:(0,G.jsx)(po,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{tone:`sage`,children:`Cortex · instructions`}),(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:`Session-start instructions for Myco-enabled symbionts`}),(0,G.jsx)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:`Review the stored instructions, control whether they inject alongside the digest, and refresh the stored guidance when project context changes.`})]})]})}),(0,G.jsxs)(Q,{id:Ya.cortexInstructions,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{children:`Settings`}),(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:`Instructions Settings`})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(_N,{path:Ka.instructions.injectOnSessionStart,label:`Inject session-start instructions`,defaultScope:`project`,children:({value:e,onChange:t})=>(0,G.jsx)(lN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(_N,{path:Ka.digest.injectOnSessionStart,label:`Inject preferred digest`,defaultScope:`project`,children:({value:e,onChange:t})=>(0,G.jsx)(lN,{checked:e??!1,onCheckedChange:t})})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(_N,{path:Ka.spores.injectOnPromptSubmit,label:`Prompt-time spore retrieval`,defaultScope:`project`,children:({value:e,onChange:t})=>(0,G.jsx)(lN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(_N,{path:Ka.spores.maxPerPrompt,label:`Max spores per prompt`,defaultScope:`project`,children:({value:e,onChange:t})=>(0,G.jsx)(cp,{type:`number`,min:0,max:10,value:String(e??3),onChange:e=>t(Number(e.target.value))})})]})]}),(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{children:`Artifact`}),(0,G.jsx)(`h3`,{className:`myco-display-sm text-on-surface m-0`,children:`Current Instructions`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Stored Markdown generated by the Myco agent for session-start injection.`}),s?(0,G.jsx)(`p`,{className:`mt-2 font-sans text-sm text-on-surface-variant`,children:s.started?`Refresh started${s.runId?` — run ${s.runId}`:``}. The stored artifact updates when that run completes.`:`Refresh did not start${s.reason?` — ${sP(s.reason)}`:``}.`}):null]}),(0,G.jsx)(Y,{onClick:()=>void l(),disabled:r,children:r?`Starting...`:`Refresh`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(X,{variant:u?.enabled?`default`:`secondary`,children:u?.enabled?`Session start enabled`:`Session start disabled`}),(0,G.jsx)(X,{variant:`secondary`,children:u?.stored?`Stored artifact`:`No stored artifact`}),(0,G.jsxs)(X,{variant:`secondary`,children:[`Generated: `,oP(u?.generatedAt??null)]})]}),(0,G.jsx)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5`,children:n.isLoading?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading instructions...`}):u?.content?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?`Collapse`:`Expand`})}),(0,G.jsx)(`div`,{className:a?`max-h-[70vh] overflow-auto pr-2`:`max-h-[28rem] overflow-auto pr-2`,children:(0,G.jsx)(uO,{content:u.content})})]}):(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No Cortex instructions are stored yet. Refresh to generate them.`})})]})]})}function _P(){let e=Wk({task:`cortex-prompt-builder`,limit:tP}),{data:t}=Pj(),n=(0,W.useMemo)(()=>(t?.symbionts??[]).filter(e=>e.enabled),[t]),[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(n[0]?.name??``),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1),p=pP(s?.runId??null),m=pP(l),h=(0,W.useMemo)(()=>(e.data?.runs??[]).map(e=>({run:e,parsed:lP(e.instruction)})),[e.data?.runs]),g=(0,W.useMemo)(()=>h.find(({run:e})=>e.id===l)??null,[h,l]);(0,W.useEffect)(()=>{if(n.length===0){a&&o(``);return}n.some(e=>e.name===a)||o(n[0]?.name??``)},[n,a]);let _=(0,W.useCallback)(async()=>{f(!0);try{c(await sa(`/cortex/prompt-builder`,{goal:r,...a?{symbiont:a}:{}})),e.refetch()}finally{f(!1)}},[e,r,a]),v=r.trim().length>0;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Q,{id:Ya.cortexBuilder,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-primary/10 p-2 text-primary`,children:(0,G.jsx)(Cs,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(Qj,{children:`Prompt Builder`}),(0,G.jsx)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:`Tell Myco what you want to build and which enabled symbiont you are targeting. Cortex runs a task through the Myco agent harness and returns a high-signal prompt you can paste into that agent.`})]})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`label`,{className:`block space-y-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:`What do you want to build?`}),(0,G.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),placeholder:`Build a migration workflow for ...`,rows:5,className:`w-full rounded-md bg-surface-container-lowest px-3 py-2 font-sans text-sm text-on-surface placeholder:text-on-surface-variant/50 focus:outline-hidden focus:ring-2 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 resize-y`})]}),(0,G.jsxs)(`label`,{className:`block space-y-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Target symbiont`}),(0,G.jsxs)(w_,{value:a,onValueChange:o,children:[(0,G.jsx)(E_,{children:(0,G.jsx)(T_,{placeholder:`Choose a symbiont`})}),(0,G.jsx)(D_,{children:n.map(e=>(0,G.jsx)(O_,{value:e.name,children:e.displayName},e.name))})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`This list comes from the symbionts enabled for this project.`})]}),(0,G.jsx)(Y,{onClick:()=>void _(),disabled:!v||d,children:d?`Starting...`:`Build Prompt`})]})]}),s?(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(X,{variant:uP(p.data?.status??`running`),children:p.data?.status??`running`}),dP(s.inlineInstructions)?(0,G.jsx)(X,{variant:`secondary`,children:dP(s.inlineInstructions)}):null,s.targetSymbiont?(0,G.jsx)(X,{variant:`secondary`,children:s.targetSymbiont.displayName}):null]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:p.data?.status&&eP.has(p.data.status)?`Run ${s.runId??`pending`} finished.`:`Run ${s.runId??`pending`} is in progress. Cortex checks for the prompt automatically.`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s.runId?(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>u(s.runId),children:`View Details`}):null,(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{p.refetch(),e.refetch()},disabled:p.isFetching||e.isFetching,children:p.isFetching||e.isFetching?`Refreshing...`:`Refresh`})]})]})]}):null,(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Qj,{children:`Recent Builds`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Each run captures the original build request, the generated prompt, and a direct link to the underlying agent run.`})]}),(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void e.refetch(),disabled:e.isFetching,children:e.isFetching?`Refreshing...`:`Refresh`})]}),e.isLoading?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading recent builds...`}):h.length===0?(0,G.jsx)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5`,children:(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No builder runs yet. Start one above and Cortex will keep the prompt artifact here.`})}):(0,G.jsx)(`div`,{className:`space-y-3`,children:h.map(({run:e,parsed:t})=>(0,G.jsx)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-4 space-y-3`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(X,{variant:uP(e.status),children:e.status}),dP(t.inlineInstructions)?(0,G.jsx)(X,{variant:`secondary`,children:dP(t.inlineInstructions)}):null,t.targetSymbiontDisplayName?(0,G.jsx)(X,{variant:`secondary`,children:t.targetSymbiontDisplayName}):null]}),(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:KA(t.goal||`Untitled build request`,nP)}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{children:[`Started `,QA(e.started_at)]}),(0,G.jsxs)(`span`,{children:[`Run `,qA(e.id)]}),e.completed_at?(0,G.jsxs)(`span`,{children:[`Duration `,XA(e.started_at,e.completed_at)]}):null]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>u(e.id),children:`View Details`}),(0,G.jsx)(`a`,{href:`/agent?run=${e.id}`,className:`inline-flex h-8 items-center justify-center rounded-md border border-[var(--ghost-border)] px-3 font-sans text-xs font-medium text-on-surface transition-all hover:bg-surface-container-high`,children:`Open Run`})]})]})},e.id))})]}),(0,G.jsx)($f,{open:l!==null,onOpenChange:e=>{e||u(null)},children:(0,G.jsxs)(rp,{className:`max-w-4xl max-h-[90vh] overflow-y-auto`,children:[(0,G.jsxs)(ip,{children:[(0,G.jsx)(op,{children:`Prompt Build Details`}),(0,G.jsx)(sp,{children:`Review the generated prompt, task reports, and jump to the full agent run when you need deeper diagnostics.`})]}),l?(0,G.jsx)(vP,{runId:l,runInstruction:g?.run.instruction??null,result:m.data,isLoading:m.isLoading,isFetching:m.isFetching,onRefresh:()=>void m.refetch()}):null]})})]})}function vP({runId:e,runInstruction:t,result:n,isLoading:r,isFetching:i,onRefresh:a}){let o=(0,W.useMemo)(()=>lP(t),[t]),[s,c]=(0,W.useState)(!1),l=(0,W.useCallback)(async()=>{n?.prompt&&navigator.clipboard?.writeText&&(await navigator.clipboard.writeText(n.prompt),c(!0),window.setTimeout(()=>c(!1),1500))},[n?.prompt]);return r&&!n?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading build details...`}):(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(X,{variant:uP(n?.status),children:n?.status??`loading`}),(0,G.jsxs)(X,{variant:`secondary`,children:[`Run `,qA(e)]}),o.targetSymbiontDisplayName?(0,G.jsx)(X,{variant:`secondary`,children:o.targetSymbiontDisplayName}):null]}),o.goal?(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:o.goal}):null,dP(o.inlineInstructions)?(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:o.inlineInstructions?`This build embeds the current Cortex instructions directly into the generated prompt.`:`This build expects the target symbiont to receive Cortex instructions at session start.`}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n?.prompt?(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void l(),children:s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(mo,{className:`mr-1.5 h-3.5 w-3.5`}),`Copied`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ko,{className:`mr-1.5 h-3.5 w-3.5`}),`Copy Prompt`]})}):null,(0,G.jsx)(`a`,{href:`/agent?run=${e}`,className:`inline-flex h-8 items-center justify-center rounded-md border border-[var(--ghost-border)] px-3 font-sans text-xs font-medium text-on-surface transition-all hover:bg-surface-container-high`,children:`Open Full Run`}),(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:a,disabled:i,children:i?`Refreshing...`:`Refresh`})]})]}),(0,G.jsxs)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5 space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Generated Prompt`}),n?.prompt?(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-sm text-on-surface`,children:n.prompt}):(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:n?.status===`failed`?n.error||`The prompt builder run failed before producing a prompt.`:`Waiting for the Myco agent to produce the prompt...`})]}),n?.reports?.length?(0,G.jsxs)(Q,{level:`default`,className:`rounded-lg border border-outline-variant/20 p-5 space-y-3`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Task Reports`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:n.reports.map(e=>(0,G.jsxs)(`div`,{className:`rounded-md border border-outline-variant/20 px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:e.action}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:GA(e.created_at)})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:e.summary})]},e.id))})]}):null]})}function yP(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Q,{id:Ya.cortexDigest,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-primary/10 p-2 text-primary`,children:(0,G.jsx)(jo,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(Qj,{children:`Digest`}),(0,G.jsx)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:`Choose which digest tier Cortex should use when digest injection is enabled, and review the maintained extracts below for on-demand retrieval.`})]})]}),(0,G.jsx)(_N,{path:Ka.digest.tier,label:`Preferred digest tier`,defaultScope:`project`,children:({value:e,onChange:t})=>(0,G.jsxs)(w_,{value:String(e??5e3),onValueChange:e=>t(Number(e)),children:[(0,G.jsx)(E_,{children:(0,G.jsx)(T_,{})}),(0,G.jsx)(D_,{children:rP.map(e=>(0,G.jsx)(O_,{value:e.value,children:e.label},e.value))})]})})]}),(0,G.jsx)(CN,{})]})}function bP({patterns:e,onChange:t}){let[n,r]=(0,W.useState)(``),i=(0,W.useCallback)(()=>{let i=n.trim();if(!(!i||i.startsWith(`#`))){if(e.includes(i)){r(``);return}t([...e,i]),r(``)}},[n,e,t]),a=(0,W.useCallback)(n=>{t(e.filter((e,t)=>t!==n))},[e,t]);return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`div`,{className:`rounded-md border border-outline-variant/30 bg-surface-container-low px-3 py-2 min-h-[44px]`,children:e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-xs italic text-on-surface-variant`,children:`No custom patterns yet — the Myco baseline above already covers common noise.`}):(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.map((e,t)=>(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-surface-container px-2 py-0.5 font-mono text-xs text-on-surface`,children:[e,(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(t),"aria-label":`Remove pattern ${e}`,className:`rounded text-on-surface-variant hover:text-on-surface focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-primary/40`,children:`×`})]},`${e}-${t}`))})}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(cp,{value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())},placeholder:`e.g. fixtures/large/** or **/*.snap`,className:`font-mono text-xs`}),(0,G.jsx)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:i,disabled:n.trim().length===0,children:`Add`})]}),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Press Enter or click Add. Glob syntax: `,(0,G.jsx)(`code`,{className:`font-mono`,children:`**`}),` `,`any depth, `,(0,G.jsx)(`code`,{className:`font-mono`,children:`*`}),` any chars in one segment.`]})]})}function xP(){let{effective:e,isLoading:t}=Na(),{data:n}=Jk(),r=n?.tasks.find(e=>e.name===`canopy-describe`),i=(e?.agent?.tasks?.[`canopy-describe`])?.schedule?.enabled??r?.schedule?.enabled??!1;return t||!e?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading...`}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(Q,{level:`low`,className:`rounded-lg border border-primary/15 p-5`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`rounded-md bg-primary/10 p-2 text-primary`,children:(0,G.jsx)(As,{className:`h-4 w-4`})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Canopy is your project's live code index.`}),(0,G.jsx)(`p`,{className:`max-w-3xl font-sans text-sm text-on-surface-variant`,children:`It tracks what every file does so connected agents can answer codebase questions and skip redundant Reads. The Myco agent describes files in the background — opt-in, configurable below.`})]})]})}),(0,G.jsxs)(Q,{id:`config-section-cortex-canopy-collection`,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(Qj,{children:`Collection`}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`The scanner automatically skips anything matched by this project's`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.gitignore`}),` `,`files (root and nested), the Myco baseline below, and directories that Myco and your installed symbionts manage (`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.myco/`}),`,`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.agents/`}),`,`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.claude/`}),`,`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`.cursor/`}),`, etc.). Add your own patterns at the bottom to exclude additional paths.`]})]}),(0,G.jsx)(_N,{path:Ka.canopy.exclude.defaultPatterns,label:`Myco baseline (read-only)`,defaultScope:`project`,children:({value:e})=>(0,G.jsxs)(`div`,{className:`rounded-md border border-outline-variant/20 bg-surface-container-low/50 px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(e??[]).map(e=>(0,G.jsx)(`code`,{className:`inline-block rounded bg-surface-container px-2 py-0.5 font-mono text-xs text-on-surface-variant`,children:e},e))}),(0,G.jsx)(`p`,{className:`pt-2 font-sans text-xs text-on-surface-variant`,children:`Maintained by Myco. Filesystem and toolchain noise that shouldn't be indexed regardless of project setup.`})]})}),(0,G.jsx)(_N,{path:Ka.canopy.exclude.patterns,label:`Your patterns`,defaultScope:`project`,children:({value:e,onChange:t})=>(0,G.jsx)(bP,{patterns:e??[],onChange:t})}),(0,G.jsxs)(`div`,{className:`space-y-1 pt-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-xs uppercase tracking-wide text-on-surface-variant`,children:`Background refresh`}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Session start and the Write/Edit tool already keep the index fresh during sessions. The background sweep is the safety net for changes made outside sessions (`,` `,(0,G.jsx)(`code`,{className:`font-mono text-xs`,children:`git pull`}),`, edits via non-Myco tools).`]})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(_N,{path:Ka.canopy.refresh.backgroundEnabled,label:`Periodic background scan`,defaultScope:`project`,children:({value:e,onChange:t})=>(0,G.jsx)(lN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(_N,{path:Ka.canopy.refresh.backgroundPeriodMinutes,label:`Period (minutes)`,defaultScope:`project`,children:({value:e,onChange:t})=>(0,G.jsx)(cp,{type:`number`,min:1,value:String(e??60),onChange:e=>t(Number(e.target.value))})})]})]}),(0,G.jsxs)(Q,{id:`config-section-cortex-canopy-injection`,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-5`,children:[(0,G.jsx)(Qj,{children:`Injection`}),(0,G.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(_N,{path:Ka.canopy.injectOnPreToolUse,label:`Inject canopy on Read`,defaultScope:`project`,children:({value:e,onChange:t})=>(0,G.jsx)(lN,{checked:e??!0,onCheckedChange:t})}),(0,G.jsx)(_N,{path:Ka.canopy.minFileBytes,label:`Minimum file size (bytes)`,defaultScope:`project`,children:({value:e,onChange:t})=>(0,G.jsx)(cp,{type:`number`,min:0,value:String(e??800),onChange:e=>t(Number(e.target.value))})})]})]}),(0,G.jsxs)(Q,{id:`config-section-cortex-canopy-llm`,level:`low`,className:`rounded-lg border border-outline-variant/20 p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,G.jsx)(Qj,{children:`Intelligence`}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 font-sans text-xs font-medium `+(i?`border-primary/30 bg-primary/10 text-primary`:`border-outline-variant/40 bg-surface-container text-on-surface-variant`),children:[(0,G.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full `+(i?`bg-primary`:`bg-on-surface-variant/60`),"aria-hidden":!0}),i?`Descriptions on`:`Descriptions off`]})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`One-sentence summaries the Myco agent writes for each file. They power semantic search across your codebase, ride along with Canopy injection on Read, and feed the Canopy Map — the highest-leverage piece of Canopy once it’s on.`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:i?(0,G.jsxs)(G.Fragment,{children:[`The`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=canopy-describe`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`canopy-describe task`}),` `,`is enabled and filling in descriptions on schedule. Visit the task page to change the model, schedule, or token budget.`]}):(0,G.jsxs)(G.Fragment,{children:[`The`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=canopy-describe`,className:`text-primary underline underline-offset-2 hover:text-primary/80`,children:`canopy-describe task`}),` `,`ships `,(0,G.jsx)(`strong`,{children:`opt-in`}),` — its schedule is off by default so new projects don’t spend tokens unprompted. Enable it on the task page (where you can also pick a model and schedule) to start filling in descriptions; the Canopy Map needs at least one described file before it can build.`]})})]})]})}function SP(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 CP(e){if(Array.isArray(e))return e}function wP(e){if(Array.isArray(e))return SP(e)}function TP(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function EP(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,LP(r.key),r)}}function DP(e,t,n){return t&&EP(e.prototype,t),Object.defineProperty(e,`prototype`,{writable:!1}),e}function OP(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=zP(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
85
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function kP(e,t,n){return(t=LP(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function AP(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function jP(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){if(Object(n)!==n)return;c=!1}else 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 MP(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
86
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NP(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
87
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PP(e,t){return CP(e)||jP(e,t)||zP(e,t)||MP()}function FP(e){return wP(e)||AP(e)||zP(e)||NP()}function IP(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}function LP(e){var t=IP(e,`string`);return typeof t==`symbol`?t:t+``}function RP(e){"@babel/helpers - typeof";return RP=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},RP(e)}function zP(e,t){if(e){if(typeof e==`string`)return SP(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)?SP(e,t):void 0}}var BP=typeof window>`u`?null:window,VP=BP?BP.navigator:null;BP&&BP.document;var HP=RP(``),UP=RP({}),WP=RP(function(){}),GP=typeof HTMLElement>`u`?`undefined`:RP(HTMLElement),KP=function(e){return e&&e.instanceString&&JP(e.instanceString)?e.instanceString():null},qP=function(e){return e!=null&&RP(e)==HP},JP=function(e){return e!=null&&RP(e)===WP},YP=function(e){return!eF(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},XP=function(e){return e!=null&&RP(e)===UP&&!YP(e)&&e.constructor===Object},ZP=function(e){return e!=null&&RP(e)===UP},$=function(e){return e!=null&&RP(e)===RP(1)&&!isNaN(e)},QP=function(e){return $(e)&&Math.floor(e)===e},$P=function(e){if(GP!==`undefined`)return e!=null&&e instanceof HTMLElement},eF=function(e){return tF(e)||nF(e)},tF=function(e){return KP(e)===`collection`&&e._private.single},nF=function(e){return KP(e)===`collection`&&!e._private.single},rF=function(e){return KP(e)===`core`},iF=function(e){return KP(e)===`stylesheet`},aF=function(e){return KP(e)===`event`},oF=function(e){return e==null?!0:!!(e===``||e.match(/^\s+$/))},sF=function(e){return typeof HTMLElement>`u`?!1:e instanceof HTMLElement},cF=function(e){return XP(e)&&$(e.x1)&&$(e.x2)&&$(e.y1)&&$(e.y2)},lF=function(e){return ZP(e)&&JP(e.then)},uF=function(){return VP&&VP.userAgent.match(/msie|trident|edge/i)},dF=function(e,t){t||=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return`undefined`;for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join(`$`)};var n=function(){var r=this,i=arguments,a,o=t.apply(r,i),s=n.cache;return(a=s[o])||(a=s[o]=e.apply(r,i)),a};return n.cache={},n},fF=dF(function(e){return e.replace(/([A-Z])/g,function(e){return`-`+e.toLowerCase()})}),pF=dF(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),mF=dF(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+`$`+t}),hF=function(e){return oF(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},gF=function(e,t){return e.slice(-1*t.length)===t},_F=`(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))`,vF=`rgb[a]?\\((`+_F+`[%]?)\\s*,\\s*(`+_F+`[%]?)\\s*,\\s*(`+_F+`[%]?)(?:\\s*,\\s*(`+_F+`))?\\)`,yF=`rgb[a]?\\((?:`+_F+`[%]?)\\s*,\\s*(?:`+_F+`[%]?)\\s*,\\s*(?:`+_F+`[%]?)(?:\\s*,\\s*(?:`+_F+`))?\\)`,bF=`hsl[a]?\\((`+_F+`)\\s*,\\s*(`+_F+`[%])\\s*,\\s*(`+_F+`[%])(?:\\s*,\\s*(`+_F+`))?\\)`,xF=`hsl[a]?\\((?:`+_F+`)\\s*,\\s*(?:`+_F+`[%])\\s*,\\s*(?:`+_F+`[%])(?:\\s*,\\s*(?:`+_F+`))?\\)`,SF=`\\#[0-9a-fA-F]{3}`,CF=`\\#[0-9a-fA-F]{6}`,wF=function(e,t){return e<t?-1:+(e>t)},TF=function(e,t){return-1*wF(e,t)},EF=Object.assign==null?function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(r!=null)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e}:Object.assign.bind(Object),DF=function(e){if(!(!(e.length===4||e.length===7)||e[0]!==`#`)){var t=e.length===4,n,r,i,a=16;return t?(n=parseInt(e[1]+e[1],a),r=parseInt(e[2]+e[2],a),i=parseInt(e[3]+e[3],a)):(n=parseInt(e[1]+e[2],a),r=parseInt(e[3]+e[4],a),i=parseInt(e[5]+e[6],a)),[n,r,i]}},OF=function(e){var t,n,r,i,a,o,s,c;function l(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var u=RegExp(`^`+bF+`$`).exec(e);if(u){if(n=parseInt(u[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,r=parseFloat(u[2]),r<0||r>100||(r/=100,i=parseFloat(u[3]),i<0||i>100)||(i/=100,a=u[4],a!==void 0&&(a=parseFloat(a),a<0||a>1)))return;if(r===0)o=s=c=Math.round(i*255);else{var d=i<.5?i*(1+r):i+r-i*r,f=2*i-d;o=Math.round(255*l(f,d,n+1/3)),s=Math.round(255*l(f,d,n)),c=Math.round(255*l(f,d,n-1/3))}t=[o,s,c,a]}return t},kF=function(e){var t,n=RegExp(`^`+vF+`$`).exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if(a[a.length-1]===`%`&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var c=n[4];if(c!==void 0){if(c=parseFloat(c),c<0||c>1)return;t.push(c)}}return t},AF=function(e){return MF[e.toLowerCase()]},jF=function(e){return(YP(e)?e:null)||AF(e)||DF(e)||kF(e)||OF(e)},MF={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},NF=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(XP(a))throw Error(`Tried to set map with object key`);i<n.length-1?(t[a]??(t[a]={}),t=t[a]):t[a]=e.value}},PF=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(XP(a))throw Error(`Tried to get map with object key`);if(t=t[a],t==null)return t}return t},FF=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function IF(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var LF,RF;function zF(){if(RF)return LF;RF=1;function e(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}return LF=e,LF}var BF,VF;function HF(){return VF?BF:(VF=1,BF=typeof FF==`object`&&FF&&FF.Object===Object&&FF,BF)}var UF,WF;function GF(){if(WF)return UF;WF=1;var e=HF(),t=typeof self==`object`&&self&&self.Object===Object&&self;return UF=e||t||Function(`return this`)(),UF}var KF,qF;function JF(){if(qF)return KF;qF=1;var e=GF();return KF=function(){return e.Date.now()},KF}var YF,XF;function ZF(){if(XF)return YF;XF=1;var e=/\s/;function t(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}return YF=t,YF}var QF,$F;function eI(){if($F)return QF;$F=1;var e=ZF(),t=/^\s+/;function n(n){return n&&n.slice(0,e(n)+1).replace(t,``)}return QF=n,QF}var tI,nI;function rI(){return nI?tI:(nI=1,tI=GF().Symbol,tI)}var iI,aI;function oI(){if(aI)return iI;aI=1;var e=rI(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch{}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}return iI=a,iI}var sI,cI;function lI(){if(cI)return sI;cI=1;var e=Object.prototype.toString;function t(t){return e.call(t)}return sI=t,sI}var uI,dI;function fI(){if(dI)return uI;dI=1;var e=rI(),t=oI(),n=lI(),r=`[object Null]`,i=`[object Undefined]`,a=e?e.toStringTag:void 0;function o(e){return e==null?e===void 0?i:r:a&&a in Object(e)?t(e):n(e)}return uI=o,uI}var pI,mI;function hI(){if(mI)return pI;mI=1;function e(e){return typeof e==`object`&&!!e}return pI=e,pI}var gI,_I;function vI(){if(_I)return gI;_I=1;var e=fI(),t=hI(),n=`[object Symbol]`;function r(r){return typeof r==`symbol`||t(r)&&e(r)==n}return gI=r,gI}var yI,bI;function xI(){if(bI)return yI;bI=1;var e=eI(),t=zF(),n=vI(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function c(c){if(typeof c==`number`)return c;if(n(c))return r;if(t(c)){var l=typeof c.valueOf==`function`?c.valueOf():c;c=t(l)?l+``:l}if(typeof c!=`string`)return c===0?c:+c;c=e(c);var u=a.test(c);return u||o.test(c)?s(c.slice(2),u?2:8):i.test(c)?r:+c}return yI=c,yI}var SI,CI;function wI(){if(CI)return SI;CI=1;var e=zF(),t=JF(),n=xI(),r=`Expected a function`,i=Math.max,a=Math.min;function o(o,s,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof o!=`function`)throw TypeError(r);s=n(s)||0,e(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?i(n(c.maxWait)||0,s):d,v=`trailing`in c?!!c.trailing:v);function y(e){var t=l,n=u;return l=u=void 0,h=e,f=o.apply(n,t),f}function b(e){return h=e,p=setTimeout(C,s),g?y(e):f}function x(e){var t=e-m,n=e-h,r=s-t;return _?a(r,d-n):r}function S(e){var t=e-m,n=e-h;return m===void 0||t>=s||t<0||_&&n>=d}function C(){var e=t();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(t())}function D(){var e=t(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,s),y(m)}return p===void 0&&(p=setTimeout(C,s)),f}return D.cancel=T,D.flush=E,D}return SI=o,SI}var TI=IF(wI()),EI=BP?BP.performance:null,DI=EI&&EI.now?function(){return EI.now()}:function(){return Date.now()},OI=function(){if(BP){if(BP.requestAnimationFrame)return function(e){BP.requestAnimationFrame(e)};if(BP.mozRequestAnimationFrame)return function(e){BP.mozRequestAnimationFrame(e)};if(BP.webkitRequestAnimationFrame)return function(e){BP.webkitRequestAnimationFrame(e)};if(BP.msRequestAnimationFrame)return function(e){BP.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(DI())},1e3/60)}}(),kI=function(e){return OI(e)},AI=DI,jI=9261,MI=65599,NI=5381,PI=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jI,n;n=e.next(),!n.done;)t=t*MI+n.value|0;return t},FI=function(e){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:jI)*MI+e|0},II=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:NI;return(t<<5)+t+e|0},LI=function(e,t){return e*2097152+t},RI=function(e){return e[0]*2097152+e[1]},zI=function(e,t){return[FI(e[0],t[0]),II(e[1],t[1])]},BI=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return PI({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},VI=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return PI({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},HI=function(){return UI(arguments)},UI=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=n===0?VI(r):VI(r,t)}return t};function WI(e,t,n,r,i){var a=i*Math.PI/180;return{x:Math.cos(a)*(e-n)-Math.sin(a)*(t-r)+n,y:Math.sin(a)*(e-n)+Math.cos(a)*(t-r)+r}}var GI=function(e,t,n,r,i,a){return{x:(e-n)*i+n,y:(t-r)*a+r}};function KI(e,t,n){if(n===0)return e;var r=(t.x1+t.x2)/2,i=(t.y1+t.y2)/2,a=t.w/t.h,o=1/a,s=WI(e.x,e.y,r,i,n),c=GI(s.x,s.y,r,i,a,o);return{x:c.x,y:c.y}}var qI=!0,JI=console.warn!=null,YI=console.trace!=null,XI=2**53-1||9007199254740991,ZI=function(){return!0},QI=function(){return!1},$I=function(){return 0},eL=function(){},tL=function(e){throw Error(e)},nL=function(e){if(e!==void 0)qI=!!e;else return qI},rL=function(e){nL()&&(JI?console.warn(e):(console.log(e),YI&&console.trace()))},iL=function(e){return EF({},e)},aL=function(e){return e==null?e:YP(e)?e.slice():XP(e)?iL(e):e},oL=function(e){return e.slice()},sL=function(e,t){for(t=e=``;e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):`-`);return t},cL={},lL=function(){return cL},uL=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=n?.[a];r[a]=o===void 0?e[a]:o}return r}},dL=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},fL=function(e){e.splice(0,e.length)},pL=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},mL=function(e,t,n){return n&&(t=mF(n,t)),e[t]},hL=function(e,t,n,r){n&&(t=mF(n,t)),e[t]=r},gL=typeof Map<`u`?Map:function(){function e(){TP(this,e),this._obj={}}return DP(e,[{key:`set`,value:function(e,t){return this._obj[e]=t,this}},{key:`delete`,value:function(e){return this._obj[e]=void 0,this}},{key:`clear`,value:function(){this._obj={}}},{key:`has`,value:function(e){return this._obj[e]!==void 0}},{key:`get`,value:function(e){return this._obj[e]}}])}(),_L=`undefined`,vL=function(){function e(t){if(TP(this,e),this._obj=Object.create(null),this.size=0,t!=null)for(var n=t.instanceString!=null&&t.instanceString()===this.instanceString()?t.toArray():t,r=0;r<n.length;r++)this.add(n[r])}return DP(e,[{key:`instanceString`,value:function(){return`set`}},{key:`add`,value:function(e){var t=this._obj;t[e]!==1&&(t[e]=1,this.size++)}},{key:`delete`,value:function(e){var t=this._obj;t[e]===1&&(t[e]=0,this.size--)}},{key:`clear`,value:function(){this._obj=Object.create(null)}},{key:`has`,value:function(e){return this._obj[e]===1}},{key:`toArray`,value:function(){var e=this;return Object.keys(this._obj).filter(function(t){return e.has(t)})}},{key:`forEach`,value:function(e,t){return this.toArray().forEach(e,t)}}])}(),yL=(typeof Set>`u`?`undefined`:RP(Set))===_L?vL:Set,bL=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!rF(e)){tL(`An element must have a core reference and parameters set`);return}var r=t.group;if(r??=t.data&&t.data.source!=null&&t.data.target!=null?`edges`:`nodes`,r!==`nodes`&&r!==`edges`){tL("An element must be of type `nodes` or `edges`; you specified `"+r+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?r===`edges`:!!t.pannable,active:!1,classes:new yL,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x??(i.position.x=0),i.position.y??(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var c=[];YP(t.classes)?c=t.classes:qP(t.classes)&&(c=t.classes.split(/\s+/));for(var l=0,u=c.length;l<u;l++){var d=c[l];!d||d===``||i.classes.add(d)}this.createEmitter(),(n===void 0||n)&&this.restore();var f=t.style||t.css;f&&(rL("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(f))},xL=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var i;XP(t)&&!eF(t)&&(i=t,t=i.roots||i.root,n=i.visit,r=i.directed),r=arguments.length===2&&!JP(n)?n:r,n=JP(n)?n:function(){};for(var a=this._private.cy,o=t=qP(t)?this.filter(t):t,s=[],c=[],l={},u={},d={},f=0,p,m=this.byGroup(),h=m.nodes,g=m.edges,_=0;_<o.length;_++){var v=o[_],y=v.id();v.isNode()&&(s.unshift(v),e.bfs&&(d[y]=!0,c.push(v)),u[y]=0)}for(var b=function(){var t=e.bfs?s.shift():s.pop(),i=t.id();if(e.dfs){if(d[i])return 0;d[i]=!0,c.push(t)}var a=u[i],o=l[i],m=o==null?null:o.source(),_=o==null?null:o.target(),v=o==null?void 0:t.same(m)?_[0]:m[0],y=n(t,o,v,f++,a);if(y===!0)return p=t,1;if(y===!1)return 1;for(var b=t.connectedEdges().filter(function(e){return(!r||e.source().same(t))&&g.has(e)}),x=0;x<b.length;x++){var S=b[x],C=S.connectedNodes().filter(function(e){return!e.same(t)&&h.has(e)}),w=C.id();C.length!==0&&!d[w]&&(C=C[0],s.push(C),e.bfs&&(d[w]=!0,c.push(C)),l[w]=S,u[w]=u[i]+1)}},x;s.length!==0&&(x=b(),!(x!==0&&x===1)););for(var S=a.collection(),C=0;C<c.length;C++){var w=c[C],T=l[w.id()];T!=null&&S.push(T),S.push(w)}return{path:a.collection(S),found:a.collection(p)}}},SL={breadthFirstSearch:xL({bfs:!0}),depthFirstSearch:xL({dfs:!0})};SL.bfs=SL.breadthFirstSearch,SL.dfs=SL.depthFirstSearch;var CL={exports:{}},wL=CL.exports,TL;function EL(){return TL?CL.exports:(TL=1,(function(e,t){(function(){var t,n,r=Math.floor,i,a,o,s,c,l,u=Math.min,d,f,p,m,h;n=function(e,t){return e<t?-1:+(e>t)},l=function(e,t,i,a,o){var s;if(i??=0,o??=n,i<0)throw Error(`lo must be non-negative`);for(a??=e.length;i<a;)s=r((i+a)/2),o(t,e[s])<0?a=s:i=s+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return r??=n,e.push(t),m(e,0,e.length-1,r)},a=function(e,t){var r,i;return t??=n,r=e.pop(),e.length?(i=e[0],e[0]=r,h(e,0,t)):i=r,i},c=function(e,t,r){var i;return r??=n,i=e[0],e[0]=t,h(e,0,r),i},s=function(e,t,r){var i;return r??=n,e.length&&r(e[0],t)<0&&(i=[e[0],t],t=i[0],e[0]=i[1],h(e,0,r)),t},i=function(e,t){var i,a,o,s,c,l;for(t??=n,s=(function(){l=[];for(var t=0,n=r(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)l.push(t);return l}).apply(this).reverse(),c=[],a=0,o=s.length;a<o;a++)i=s[a],c.push(h(e,i,t));return c},p=function(e,t,r){var i;if(r??=n,i=e.indexOf(t),i!==-1)return m(e,0,i,r),h(e,i,r)},d=function(e,t,r){var a,o,c,l,u;if(r??=n,o=e.slice(0,t),!o.length)return o;for(i(o,r),u=e.slice(t),c=0,l=u.length;c<l;c++)a=u[c],s(o,a,r);return o.sort(r).reverse()},f=function(e,t,r){var o,s,c,d,f,p,m,h,g;if(r??=n,t*10<=e.length){if(c=e.slice(0,t).sort(r),!c.length)return c;for(s=c[c.length-1],m=e.slice(t),d=0,p=m.length;d<p;d++)o=m[d],r(o,s)<0&&(l(c,o,0,null,r),c.pop(),s=c[c.length-1]);return c}for(i(e,r),g=[],f=0,h=u(t,e.length);0<=h?f<h:f>h;0<=h?++f:--f)g.push(a(e,r));return g},m=function(e,t,r,i){var a,o,s;for(i??=n,a=e[r];r>t;){if(s=r-1>>1,o=e[s],i(a,o)<0){e[r]=o,r=s;continue}break}return e[r]=a},h=function(e,t,r){var i,a,o,s,c;for(r??=n,a=e.length,c=t,o=e[t],i=2*t+1;i<a;)s=i+1,s<a&&!(r(e[i],e[s])<0)&&(i=s),e[t]=e[i],t=i,i=2*t+1;return e[t]=o,m(e,c,t,r)},t=(function(){e.push=o,e.pop=a,e.replace=c,e.pushpop=s,e.heapify=i,e.updateItem=p,e.nlargest=d,e.nsmallest=f;function e(e){this.cmp=e??n,this.nodes=[]}return e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return this.nodes.indexOf(e)!==-1},e.prototype.replace=function(e){return c(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return this.nodes.length===0},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t=new e;return t.nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e})(),(function(t,n){return e.exports=n()})(this,function(){return t})}).call(wL)})(CL),CL.exports)}var DL,OL;function kL(){return OL?DL:(OL=1,DL=EL(),DL)}var AL=IF(kL()),jL=uL({root:null,weight:function(e){return 1},directed:!1}),ML={dijkstra:function(e){if(!XP(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=jL(e),r=n.root,i=n.weight,a=n.directed,o=this,s=i,c=qP(r)?this.filter(r)[0]:r[0],l={},u={},d={},f=this.byGroup(),p=f.nodes,m=f.edges;m.unmergeBy(function(e){return e.isLoop()});for(var h=function(e){return l[e.id()]},g=function(e,t){l[e.id()]=t,_.updateItem(e)},_=new AL(function(e,t){return h(e)-h(t)}),v=0;v<p.length;v++){var y=p[v];l[y.id()]=y.same(c)?0:1/0,_.push(y)}for(var b=function(e,t){for(var n=(a?e.edgesTo(t):e.edgesWith(t)).intersect(m),r=1/0,i,o=0;o<n.length;o++){var c=n[o],l=s(c);(l<r||!i)&&(r=l,i=c)}return{edge:i,dist:r}};_.size()>0;){var x=_.pop(),S=h(x),C=x.id();if(d[C]=S,S!==1/0)for(var w=x.neighborhood().intersect(p),T=0;T<w.length;T++){var E=w[T],D=E.id(),O=b(x,E),k=S+O.dist;k<h(E)&&(g(E,k),u[D]={node:x,edge:O.edge})}}return{distanceTo:function(e){return d[(qP(e)?p.filter(e)[0]:e[0]).id()]},pathTo:function(e){var t=qP(e)?p.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);u[i];){var a=u[i];n.unshift(a.edge),n.unshift(a.node),r=a.node,i=r.id()}return o.spawn(n)}}}},NL={kruskal:function(e){e||=function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=Array(i),o=n,s=function(e){for(var t=0;t<a.length;t++)if(a[t].has(e))return t},c=0;c<i;c++)a[c]=this.spawn(n[c]);for(var l=r.sort(function(t,n){return e(t)-e(n)}),u=0;u<l.length;u++){var d=l[u],f=d.source()[0],p=d.target()[0],m=s(f),h=s(p),g=a[m],_=a[h];m!==h&&(o.merge(d),g.merge(_),a.splice(h,1))}return o}},PL=uL({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),FL={aStar:function(e){var t=this.cy(),n=PL(e),r=n.root,i=n.goal,a=n.heuristic,o=n.directed,s=n.weight;r=t.collection(r)[0],i=t.collection(i)[0];var c=r.id(),l=i.id(),u={},d={},f={},p=new AL(function(e,t){return d[e.id()]-d[t.id()]}),m=new yL,h={},g={},_=function(e,t){p.push(e),m.add(t)},v,y,b=function(){v=p.pop(),y=v.id(),m.delete(y)},x=function(e){return m.has(e)};_(r,c),u[c]=0,d[c]=a(r);for(var S=0;p.size()>0;){if(b(),S++,y===l){for(var C=[],w=i,T=l,E=g[T];C.unshift(w),E!=null&&C.unshift(E),w=h[T],w!=null;)T=w.id(),E=g[T];return{found:!0,distance:u[y],path:this.spawn(C),steps:S}}f[y]=!0;for(var D=v._private.edges,O=0;O<D.length;O++){var k=D[O];if(this.hasElementWithId(k.id())&&!(o&&k.data(`source`)!==y)){var A=k.source(),j=k.target(),M=A.id()===y?j:A,N=M.id();if(this.hasElementWithId(N)&&!f[N]){var P=u[y]+s(k);if(!x(N)){u[N]=P,d[N]=P+a(M),_(M,N),h[N]=v,g[N]=k;continue}P<u[N]&&(u[N]=P,d[N]=P+a(M),h[N]=v,g[N]=k)}}}}return{found:!1,distance:void 0,path:void 0,steps:S}}},IL=uL({weight:function(e){return 1},directed:!1}),LL={floydWarshall:function(e){for(var t=this.cy(),n=IL(e),r=n.weight,i=n.directed,a=r,o=this.byGroup(),s=o.nodes,c=o.edges,l=s.length,u=l*l,d=function(e){return s.indexOf(e)},f=function(e){return s[e]},p=Array(u),m=0;m<u;m++){var h=m%l;(m-h)/l===h?p[m]=0:p[m]=1/0}for(var g=Array(u),_=Array(u),v=0;v<c.length;v++){var y=c[v],b=y.source()[0],x=y.target()[0];if(b!==x){var S=d(b),C=d(x),w=S*l+C,T=a(y);if(p[w]>T&&(p[w]=T,g[w]=C,_[w]=y),!i){var E=C*l+S;!i&&p[E]>T&&(p[E]=T,g[E]=S,_[E]=y)}}}for(var D=0;D<l;D++)for(var O=0;O<l;O++)for(var k=O*l+D,A=0;A<l;A++){var j=O*l+A,M=D*l+A;p[k]+p[M]<p[j]&&(p[j]=p[k]+p[M],g[j]=g[k])}var N=function(e){return(qP(e)?t.filter(e):e)[0]},P=function(e){return d(N(e))};return{distance:function(e,t){var n=P(e),r=P(t);return p[n*l+r]},path:function(e,n){var r=P(e),i=P(n),a=f(r);if(r===i)return a.collection();if(g[r*l+i]==null)return t.collection();var o=t.collection(),s=r,c;for(o.merge(a);r!==i;)s=r,r=g[r*l+i],c=_[s*l+r],o.merge(c),o.merge(f(r));return o}}}},RL=uL({weight:function(e){return 1},directed:!1,root:null}),zL={bellmanFord:function(e){var t=this,n=RL(e),r=n.weight,i=n.directed,a=n.root,o=r,s=this,c=this.cy(),l=this.byGroup(),u=l.edges,d=l.nodes,f=d.length,p=new gL,m=!1,h=[];a=c.collection(a)[0],u.unmergeBy(function(e){return e.isLoop()});for(var g=u.length,_=function(e){var t=p.get(e.id());return t||(t={},p.set(e.id(),t)),t},v=function(e){return(qP(e)?c.$(e):e)[0]},y=function(e){return _(v(e)).dist},b=function(e){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:a,r=v(e),i=[],o=r;;){if(o==null)return t.spawn();var c=_(o),l=c.edge,u=c.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;l!=null&&i.unshift(l),o=u}return s.spawn(i)},x=0;x<f;x++){var S=d[x],C=_(S);S.same(a)?C.dist=0:C.dist=1/0,C.pred=null,C.edge=null}for(var w=!1,T=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,w=!0)},E=1;E<f;E++){w=!1;for(var D=0;D<g;D++){var O=u[D],k=O.source(),A=O.target(),j=o(O),M=_(k),N=_(A);T(k,A,O,M,N,j),i||T(A,k,O,N,M,j)}if(!w)break}if(w)for(var P=[],F=0;F<g;F++){var I=u[F],L=I.source(),R=I.target(),ee=o(I),z=_(L).dist,B=_(R).dist;if(z+ee<B||!i&&B+ee<z)if(m||=(rL(`Graph contains a negative weight cycle for Bellman-Ford`),!0),e.findNegativeWeightCycles!==!1){var V=[];z+ee<B&&V.push(L),!i&&B+ee<z&&V.push(R);for(var H=V.length,te=0;te<H;te++){var ne=V[te],U=[ne];U.push(_(ne).edge);for(var re=_(ne).pred;U.indexOf(re)===-1;)U.push(re),U.push(_(re).edge),re=_(re).pred;U=U.slice(U.indexOf(re));for(var ie=U[0].id(),ae=0,oe=2;oe<U.length;oe+=2)U[oe].id()<ie&&(ie=U[oe].id(),ae=oe);U=U.slice(ae).concat(U.slice(0,ae)),U.push(U[0]);var se=U.map(function(e){return e.id()}).join(`,`);P.indexOf(se)===-1&&(h.push(s.spawn(U)),P.push(se))}}else break}return{distanceTo:y,pathTo:b,hasNegativeWeightCycle:m,negativeWeightCycles:h}}},BL=Math.sqrt(2),VL=function(e,t,n){n.length===0&&tL(`Karger-Stein must be run on a connected (sub)graph`);for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],c=n,l=c.length-1;l>=0;l--){var u=c[l],d=u[1],f=u[2];(t[d]===o&&t[f]===s||t[d]===s&&t[f]===o)&&c.splice(l,1)}for(var p=0;p<c.length;p++){var m=c[p];m[1]===s?(c[p]=m.slice(),c[p][1]=o):m[2]===s&&(c[p]=m.slice(),c[p][2]=o)}for(var h=0;h<t.length;h++)t[h]===s&&(t[h]=o);return c},HL=function(e,t,n,r){for(;n>r;)t=VL(Math.floor(Math.random()*t.length),e,t),n--;return t},UL={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var i=n.length,a=r.length,o=Math.ceil((Math.log(i)/Math.LN2)**2),s=Math.floor(i/BL);if(i<2){tL(`At least 2 nodes are required for Karger-Stein algorithm`);return}for(var c=[],l=0;l<a;l++){var u=r[l];c.push([l,n.indexOf(u.source()),n.indexOf(u.target())])}for(var d=1/0,f=[],p=Array(i),m=Array(i),h=Array(i),g=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},_=0;_<=o;_++){for(var v=0;v<i;v++)m[v]=v;var y=HL(m,c.slice(),i,s),b=y.slice();g(m,h);var x=HL(m,y,s,2),S=HL(h,b,s,2);x.length<=S.length&&x.length<d?(d=x.length,f=x,g(m,p)):S.length<=x.length&&S.length<d&&(d=S.length,f=S,g(h,p))}for(var C=this.spawn(f.map(function(e){return r[e[0]]})),w=this.spawn(),T=this.spawn(),E=p[0],D=0;D<p.length;D++){var O=p[D],k=n[D];O===E?w.merge(k):T.merge(k)}var A=function(t){var n=e.spawn();return t.forEach(function(t){n.merge(t),t.connectedEdges().forEach(function(t){e.contains(t)&&!C.contains(t)&&n.merge(t)})}),n};return{cut:C,components:[A(w),A(T)],partition1:w,partition2:T}}},WL=function(e){return{x:e.x,y:e.y}},GL=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},KL=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},qL=function(e){return{x:e[0],y:e[1]}},JL=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r},YL=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r},XL=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i},ZL=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var c=e[s];a?isFinite(c)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var l=e.length,u=Math.floor(l/2);return l%2==0?(e[u-1+o]+e[u+o])/2:e[u+1+o]},QL=function(e){return Math.PI*e/180},$L=function(e,t){return Math.atan2(t,e)-Math.PI/2},eR=Math.log2||function(e){return Math.log(e)/Math.log(2)},tR=function(e){return e>0?1:e<0?-1:0},nR=function(e,t){return Math.sqrt(rR(e,t))},rR=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},iR=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},aR=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},oR=function(e,t,n,r){return{x:aR(e.x,t.x,n.x,r),y:aR(e.y,t.y,n.y,r)}},sR=function(e,t,n,r){var i={x:t.x-e.x,y:t.y-e.y},a=nR(e,t),o={x:i.x/a,y:i.y/a};return n??=0,r??=n*a,{x:e.x+o.x*r,y:e.y+o.y*r}},cR=function(e,t,n){return Math.max(e,Math.min(n,t))},lR=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},uR=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},dR=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},fR=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},pR=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},mR=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},hR=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,r,i,a;if(t.length===1)n=r=i=a=t[0];else if(t.length===2)n=i=t[0],a=r=t[1];else if(t.length===4){var o=PP(t,4);n=o[0],r=o[1],i=o[2],a=o[3]}return e.x1-=a,e.x2+=r,e.y1-=n,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},gR=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},_R=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},vR=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},yR=function(e,t){return vR(e,t.x,t.y)},bR=function(e,t){return vR(e,t.x1,t.y1)&&vR(e,t.x2,t.y2)},xR=Math.hypot??function(e,t){return Math.sqrt(e*e+t*t)};function SR(e,t){if(e.length<3)throw Error(`Need at least 3 vertices`);var n=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},r=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},i=function(e,t){return{x:e.x*t,y:e.y*t}},a=function(e,t){return e.x*t.y-e.y*t.x},o=function(e){var t=xR(e.x,e.y);return t===0?{x:0,y:0}:{x:e.x/t,y:e.y/t}},s=function(e){for(var t=0,n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return t/2},c=function(e,t,o,s){var c=r(t,e),l=r(s,o),u=a(c,l);return Math.abs(u)<1e-9?n(e,i(c,.5)):n(e,i(c,a(r(o,e),l)/u))},l=e.map(function(e){return{x:e.x,y:e.y}});s(l)<0&&l.reverse();for(var u=l.length,d=[],f=0;f<u;f++){var p=l[f],m=l[(f+1)%u],h=r(m,p),g=o({x:h.y,y:-h.x});d.push(g)}for(var _=d.map(function(e,r){return{p1:n(l[r],i(e,t)),p2:n(l[(r+1)%u],i(e,t))}}),v=[],y=0;y<u;y++){var b=_[(y-1+u)%u],x=_[y],S=c(b.p1,b.p2,x.p1,x.p2);v.push(S)}return v}function CR(e,t,n,r,i,a){var o=SR(VR(e,t,n,r,i),a),s=lR();return o.forEach(function(e){return pR(s,e.x,e.y)}),s}var wR=function(e,t,n,r,i,a,o){var s=arguments.length>7&&arguments[7]!==void 0?arguments[7]:`auto`,c=s===`auto`?JR(i,a):s,l=i/2,u=a/2;c=Math.min(c,l,u);var d=c!==l,f=c!==u,p;if(d){var m=n-l+c-o,h=r-u-o;if(p=BR(e,t,n,r,m,h,n+l-c+o,h,!1),p.length>0)return p}if(f){var g=n+l+o;if(p=BR(e,t,n,r,g,r-u+c-o,g,r+u-c+o,!1),p.length>0)return p}if(d){var _=n-l+c-o,v=r+u+o;if(p=BR(e,t,n,r,_,v,n+l-c+o,v,!1),p.length>0)return p}if(f){var y=n-l-o;if(p=BR(e,t,n,r,y,r-u+c-o,y,r+u-c+o,!1),p.length>0)return p}var b,x=n-l+c,S=r-u+c;if(b=RR(e,t,n,r,x,S,c+o),b.length>0&&b[0]<=x&&b[1]<=S)return[b[0],b[1]];var C=n+l-c,w=r-u+c;if(b=RR(e,t,n,r,C,w,c+o),b.length>0&&b[0]>=C&&b[1]<=w)return[b[0],b[1]];var T=n+l-c,E=r+u-c;if(b=RR(e,t,n,r,T,E,c+o),b.length>0&&b[0]>=T&&b[1]>=E)return[b[0],b[1]];var D=n-l+c,O=r+u-c;return b=RR(e,t,n,r,D,O,c+o),b.length>0&&b[0]<=D&&b[1]>=O?[b[0],b[1]]:[]},TR=function(e,t,n,r,i,a,o){var s=o,c=Math.min(n,i),l=Math.max(n,i),u=Math.min(r,a),d=Math.max(r,a);return c-s<=e&&e<=l+s&&u-s<=t&&t<=d+s},ER=function(e,t,n,r,i,a,o,s,c){var l={x1:Math.min(n,o,i)-c,x2:Math.max(n,o,i)+c,y1:Math.min(r,s,a)-c,y2:Math.max(r,s,a)+c};return!(e<l.x1||e>l.x2||t<l.y1||t>l.y2)},DR=function(e,t,n,r){n-=r;var i=t*t-4*e*n;if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},OR=function(e,t,n,r,i){e===0&&(e=1e-5),t/=e,n/=e,r/=e;var a,o=(3*n-t*t)/9,s=-(27*r)+t*(9*n-t*t*2),c,l,u,d,f;if(s/=54,a=o*o*o+s*s,i[1]=0,d=t/3,a>0){l=s+Math.sqrt(a),l=l<0?-((-l)**(1/3)):l**(1/3),u=s-Math.sqrt(a),u=u<0?-((-u)**(1/3)):u**(1/3),i[0]=-d+l+u,d+=(l+u)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-u+l)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,a===0){f=s<0?-((-s)**(1/3)):s**(1/3),i[0]=-d+2*f,i[4]=i[2]=-(f+d);return}o=-o,c=o*o*o,c=Math.acos(s/Math.sqrt(c)),f=2*Math.sqrt(o),i[0]=-d+f*Math.cos(c/3),i[2]=-d+f*Math.cos((c+2*Math.PI)/3),i[4]=-d+f*Math.cos((c+4*Math.PI)/3)},kR=function(e,t,n,r,i,a,o,s){var c=1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,l=9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,u=3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,d=1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,f=[];OR(c,l,u,d,f);for(var p=1e-7,m=[],h=0;h<6;h+=2)Math.abs(f[h+1])<p&&f[h]>=0&&f[h]<=1&&m.push(f[h]);m.push(1),m.push(0);for(var g=-1,_,v,y,b=0;b<m.length;b++)_=(1-m[b])**2*n+2*(1-m[b])*m[b]*i+m[b]*m[b]*o,v=(1-m[b])**2*r+2*(1-m[b])*m[b]*a+m[b]*m[b]*s,y=(_-e)**2+(v-t)**2,g>=0?y<g&&(g=y):g=y;return g},AR=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],c=s[0]*s[0]+s[1]*s[1],l=o[0]*o[0]+o[1]*o[1],u=o[0]*s[0]+o[1]*s[1],d=u*u/c;return u<0?l:d>c?(e-i)*(e-i)+(t-a)*(t-a):l-d},jR=function(e,t,n){for(var r,i,a,o,s,c=0,l=0;l<n.length/2;l++)if(r=n[l*2],i=n[l*2+1],l+1<n.length/2?(a=n[(l+1)*2],o=n[(l+1)*2+1]):(a=n[(l+1-n.length/2)*2],o=n[(l+1-n.length/2)*2+1]),!(r==e&&a==e))if(r>=e&&e>=a||r<=e&&e<=a)s=(e-r)/(a-r)*(o-i)+i,s>t&&c++;else continue;return c%2!=0},MR=function(e,t,n,r,i,a,o,s,c){var l=Array(n.length),u;s[0]==null?u=s:(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2);for(var d=Math.cos(-u),f=Math.sin(-u),p=0;p<l.length/2;p++)l[p*2]=a/2*(n[p*2]*d-n[p*2+1]*f),l[p*2+1]=o/2*(n[p*2+1]*d+n[p*2]*f),l[p*2]+=r,l[p*2+1]+=i;return jR(e,t,c>0?PR(FR(l,-c)):l)},NR=function(e,t,n,r,i,a,o,s){for(var c=Array(n.length*2),l=0;l<s.length;l++){var u=s[l];if(c[l*4+0]=u.startX,c[l*4+1]=u.startY,c[l*4+2]=u.stopX,c[l*4+3]=u.stopY,(u.cx-e)**2+(u.cy-t)**2<=u.radius**2)return!0}return jR(e,t,c)},PR=function(e){for(var t=Array(e.length/2),n,r,i,a,o,s,c,l,u=0;u<e.length/4;u++){n=e[u*4],r=e[u*4+1],i=e[u*4+2],a=e[u*4+3],u<e.length/4-1?(o=e[(u+1)*4],s=e[(u+1)*4+1],c=e[(u+1)*4+2],l=e[(u+1)*4+3]):(o=e[0],s=e[1],c=e[2],l=e[3]);var d=BR(n,r,i,a,o,s,c,l,!0);t[u*2]=d[0],t[u*2+1]=d[1]}return t},FR=function(e,t){for(var n=Array(e.length*2),r,i,a,o,s=0;s<e.length/2;s++){r=e[s*2],i=e[s*2+1],s<e.length/2-1?(a=e[(s+1)*2],o=e[(s+1)*2+1]):(a=e[0],o=e[1]);var c=o-i,l=-(a-r),u=Math.sqrt(c*c+l*l),d=c/u,f=l/u;n[s*4]=r+d*t,n[s*4+1]=i+f*t,n[s*4+2]=a+d*t,n[s*4+3]=o+f*t}return n},IR=function(e,t,n,r,i,a){var o=n-e,s=r-t;o/=i,s/=a;var c=Math.sqrt(o*o+s*s),l=c-1;if(l<0)return[];var u=l/c;return[(n-e)*u+e,(r-t)*u+t]},LR=function(e,t,n,r,i,a,o){return e-=i,t-=a,e/=n/2+o,t/=r/2+o,e*e+t*t<=1},RR=function(e,t,n,r,i,a,o){var s=[n-e,r-t],c=[e-i,t-a],l=s[0]*s[0]+s[1]*s[1],u=2*(c[0]*s[0]+c[1]*s[1]),d=c[0]*c[0]+c[1]*c[1]-o*o,f=u*u-4*l*d;if(f<0)return[];var p=(-u+Math.sqrt(f))/(2*l),m=(-u-Math.sqrt(f))/(2*l),h=Math.min(p,m),g=Math.max(p,m),_=[];if(h>=0&&h<=1&&_.push(h),g>=0&&g<=1&&_.push(g),_.length===0)return[];var v=_[0]*s[0]+e,y=_[0]*s[1]+t;return _.length>1?_[0]==_[1]?[v,y]:[v,y,_[1]*s[0]+e,_[1]*s[1]+t]:[v,y]},zR=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},BR=function(e,t,n,r,i,a,o,s,c){var l=e-i,u=n-e,d=o-i,f=t-a,p=r-t,m=s-a,h=d*f-m*l,g=u*f-p*l,_=m*u-d*p;if(_!==0){var v=h/_,y=g/_,b=.001,x=0-b,S=1+b;return x<=v&&v<=S&&x<=y&&y<=S||c?[e+v*u,t+v*p]:[]}else if(h===0||g===0)return zR(e,n,o)===o?[o,s]:zR(e,n,i)===i?[i,a]:zR(i,o,n)===n?[n,r]:[];else return[]},VR=function(e,t,n,r,i){var a=[],o=r/2,s=i/2,c=t,l=n;a.push({x:c+o*e[0],y:l+s*e[1]});for(var u=1;u<e.length/2;u++)a.push({x:c+o*e[u*2],y:l+s*e[u*2+1]});return a},HR=function(e,t,n,r,i,a,o,s){var c=[],l,u=Array(n.length),d=!0;a??(d=!1);var f;if(d){for(var p=0;p<u.length/2;p++)u[p*2]=n[p*2]*a+r,u[p*2+1]=n[p*2+1]*o+i;f=s>0?PR(FR(u,-s)):u}else f=n;for(var m,h,g,_,v=0;v<f.length/2;v++)m=f[v*2],h=f[v*2+1],v<f.length/2-1?(g=f[(v+1)*2],_=f[(v+1)*2+1]):(g=f[0],_=f[1]),l=BR(e,t,r,i,m,h,g,_),l.length!==0&&c.push(l[0],l[1]);return c},UR=function(e,t,n,r,i,a,o,s,c){var l=[],u,d=Array(n.length*2);c.forEach(function(n,a){a===0?(d[d.length-2]=n.startX,d[d.length-1]=n.startY):(d[a*4-2]=n.startX,d[a*4-1]=n.startY),d[a*4]=n.stopX,d[a*4+1]=n.stopY,u=RR(e,t,r,i,n.cx,n.cy,n.radius),u.length!==0&&l.push(u[0],u[1])});for(var f=0;f<d.length/4;f++)u=BR(e,t,r,i,d[f*4],d[f*4+1],d[f*4+2],d[f*4+3],!1),u.length!==0&&l.push(u[0],u[1]);if(l.length>2){for(var p=[l[0],l[1]],m=(p[0]-e)**2+(p[1]-t)**2,h=1;h<l.length/2;h++){var g=(l[h*2]-e)**2+(l[h*2+1]-t)**2;g<=m&&(p[0]=l[h*2],p[1]=l[h*2+1],m=g)}return p}return l},WR=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},GR=function(e,t){var n=qR(e,t);return n=KR(n),n},KR=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,c=0;c<r;c++)t=e[2*c],n=e[2*c+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var l=2/(o-i),u=2/(s-a),d=0;d<r;d++)t=e[2*d]=e[2*d]*l,n=e[2*d+1]=e[2*d+1]*u,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var f=0;f<r;f++)n=e[2*f+1]=e[2*f+1]+(-1-a);return e},qR=function(e,t){var n=1/e*2*Math.PI,r=e%2==0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var i=Array(e*2),a,o=0;o<e;o++)a=o*n+r,i[2*o]=Math.cos(a),i[2*o+1]=Math.sin(-a);return i},JR=function(e,t){return Math.min(e/4,t/4,8)},YR=function(e,t){return Math.min(e/10,t/10,8)},XR=function(){return 8},ZR=function(e,t,n){return[e-2*t+n,2*(t-e),e]},QR=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function $R(e,t){function n(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length],a={x:i.x-r.x,y:i.y-r.y},o={x:-a.y,y:a.x},s=Math.sqrt(o.x*o.x+o.y*o.y);t.push({x:o.x/s,y:o.y/s})}return t}function r(e,t){var n=1/0,r=-1/0,i=OP(e),a;try{for(i.s();!(a=i.n()).done;){var o=a.value,s=o.x*t.x+o.y*t.y;n=Math.min(n,s),r=Math.max(r,s)}}catch(e){i.e(e)}finally{i.f()}return{min:n,max:r}}function i(e,t){return!(e.max<t.min||t.max<e.min)}var a=OP([].concat(FP(n(e)),FP(n(t)))),o;try{for(a.s();!(o=a.n()).done;){var s=o.value;if(!i(r(e,s),r(t,s)))return!1}}catch(e){a.e(e)}finally{a.f()}return!0}var ez=uL({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),tz={pageRank:function(e){for(var t=ez(e),n=t.dampingFactor,r=t.precision,i=t.iterations,a=t.weight,o=this._private.cy,s=this.byGroup(),c=s.nodes,l=s.edges,u=c.length,d=u*u,f=l.length,p=Array(d),m=Array(u),h=(1-n)/u,g=0;g<u;g++){for(var _=0;_<u;_++){var v=g*u+_;p[v]=0}m[g]=0}for(var y=0;y<f;y++){var b=l[y],x=b.data(`source`),S=b.data(`target`);if(x!==S){var C=c.indexOfId(x),w=c.indexOfId(S),T=a(b),E=w*u+C;p[E]+=T,m[C]+=T}}for(var D=1/u+h,O=0;O<u;O++)if(m[O]===0)for(var k=0;k<u;k++){var A=k*u+O;p[A]=D}else for(var j=0;j<u;j++){var M=j*u+O;p[M]=p[M]/m[O]+h}for(var N=Array(u),P=Array(u),F,I=0;I<u;I++)N[I]=1;for(var L=0;L<i;L++){for(var R=0;R<u;R++)P[R]=0;for(var ee=0;ee<u;ee++)for(var z=0;z<u;z++){var B=ee*u+z;P[ee]+=p[B]*N[z]}iR(P),F=N,N=P,P=F;for(var V=0,H=0;H<u;H++){var te=F[H]-N[H];V+=te*te}if(V<r)break}return{rank:function(e){return e=o.collection(e)[0],N[c.indexOf(e)]}}}},nz=uL({root:null,weight:function(e){return 1},directed:!1,alpha:0}),rz={degreeCentralityNormalized:function(e){e=nz(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,c=0;c<r;c++){var l=n[c],u=l.id();e.root=l;var d=this.degreeCentrality(e);o<d.indegree&&(o=d.indegree),s<d.outdegree&&(s=d.outdegree),i[u]=d.indegree,a[u]=d.outdegree}return{indegree:function(e){return o==0?0:(qP(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return s===0?0:(qP(e)&&(e=t.filter(e)),a[e.id()]/s)}}}else{for(var f={},p=0,m=0;m<r;m++){var h=n[m];e.root=h;var g=this.degreeCentrality(e);p<g.degree&&(p=g.degree),f[h.id()]=g.degree}return{degree:function(e){return p===0?0:(qP(e)&&(e=t.filter(e)),f[e.id()]/p)}}}},degreeCentrality:function(e){e=nz(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var c=i.connectedEdges(),l=c.filter(function(e){return e.target().same(i)&&n.has(e)}),u=c.filter(function(e){return e.source().same(i)&&n.has(e)}),d=l.length,f=u.length,p=0,m=0,h=0;h<l.length;h++)p+=a(l[h]);for(var g=0;g<u.length;g++)m+=a(u[g]);return{indegree:d**(1-s)*p**+s,outdegree:f**(1-s)*m**+s}}else{for(var _=i.connectedEdges().intersection(n),v=_.length,y=0,b=0;b<_.length;b++)y+=a(_[b]);return{degree:v**(1-s)*y**+s}}}};rz.dc=rz.degreeCentrality,rz.dcn=rz.degreeCentralityNormalised=rz.degreeCentralityNormalized;var iz=uL({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),az={closenessCentralityNormalized:function(e){for(var t=iz(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,c=this.nodes(),l=this.floydWarshall({weight:r,directed:i}),u=0;u<c.length;u++){for(var d=0,f=c[u],p=0;p<c.length;p++)if(u!==p){var m=l.distance(f,c[p]);n?d+=1/m:d+=m}n||(d=1/d),s<d&&(s=d),o[f.id()]=d}return{closeness:function(e){return s==0?0:(e=qP(e)?a.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=iz(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,c=this.nodes(),l=0;l<c.length;l++){var u=c[l];if(!u.same(n)){var d=o.distanceTo(u);a?s+=1/d:s+=d}}return a?s:1/s}};az.cc=az.closenessCentrality,az.ccn=az.closenessCentralityNormalised=az.closenessCentralityNormalized;var oz=uL({weight:null,directed:!1}),sz={betweennessCentrality:function(e){for(var t=oz(e),n=t.directed,r=t.weight,i=r!=null,a=this.cy(),o=this.nodes(),s={},c={},l=0,u={set:function(e,t){c[e]=t,t>l&&(l=t)},get:function(e){return c[e]}},d=0;d<o.length;d++){var f=o[d],p=f.id();n?s[p]=f.outgoers().nodes():s[p]=f.openNeighborhood().nodes(),u.set(p,0)}for(var m=function(){for(var e=o[h].id(),t=[],n={},c={},l={},d=new AL(function(e,t){return l[e]-l[t]}),f=0;f<o.length;f++){var p=o[f].id();n[p]=[],c[p]=0,l[p]=1/0}for(c[e]=1,l[e]=0,d.push(e);!d.empty();){var m=d.pop();if(t.push(m),i)for(var g=0;g<s[m].length;g++){var _=s[m][g],v=a.getElementById(m),y=void 0;y=v.edgesTo(_).length>0?v.edgesTo(_)[0]:_.edgesTo(v)[0];var b=r(y);_=_.id(),l[_]>l[m]+b&&(l[_]=l[m]+b,d.nodes.indexOf(_)<0?d.push(_):d.updateItem(_),c[_]=0,n[_]=[]),l[_]==l[m]+b&&(c[_]=c[_]+c[m],n[_].push(m))}else for(var x=0;x<s[m].length;x++){var S=s[m][x].id();l[S]==1/0&&(d.push(S),l[S]=l[m]+1),l[S]==l[m]+1&&(c[S]=c[S]+c[m],n[S].push(m))}}for(var C={},w=0;w<o.length;w++)C[o[w].id()]=0;for(;t.length>0;){for(var T=t.pop(),E=0;E<n[T].length;E++){var D=n[T][E];C[D]=C[D]+c[D]/c[T]*(1+C[T])}T!=o[h].id()&&u.set(T,u.get(T)+C[T])}},h=0;h<o.length;h++)m();var g={betweenness:function(e){var t=a.collection(e).id();return u.get(t)},betweennessNormalized:function(e){if(l==0)return 0;var t=a.collection(e).id();return u.get(t)/l}};return g.betweennessNormalised=g.betweennessNormalized,g}};sz.bc=sz.betweennessCentrality;var cz=uL({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),lz=function(e){return cz(e)},uz=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},dz=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},fz=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},pz=function(e,t,n){for(var r=Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},mz=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=pz(e,r,t);return e},hz=function(e,t,n){for(var r=Array(t*t),i=0;i<t*t;i++)r[i]=e[i]**+n;return fz(r,t),r},gz=function(e,t,n,r){for(var i=0;i<n;i++)if(Math.round(e[i]*10**r)/10**r!=Math.round(t[i]*10**r)/10**r)return!1;return!0},_z=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(e[a*t+s]*1e3)/1e3>0&&o.push(n[s]);o.length!==0&&i.push(r.collection(o))}return i},vz=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},yz=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&vz(e[t],e[n])&&e.splice(n,1);return e},bz=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=lz(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s=t.length,c=s*s,l=Array(c),u,d=0;d<c;d++)l[d]=0;for(var f=0;f<n.length;f++){var p=n[f],m=a[p.source().id()],h=a[p.target().id()],g=uz(p,i.attributes);l[m*s+h]+=g,l[h*s+m]+=g}dz(l,s,i.multFactor),fz(l,s);for(var _=!0,v=0;_&&v<i.maxIterations;)_=!1,u=mz(l,s,i.expandFactor),l=hz(u,s,i.inflateFactor),gz(l,u,c,4)||(_=!0),v++;var y=_z(l,s,t,r);return y=yz(y),y},xz={markovClustering:bz,mcl:bz},Sz=function(e){return e},Cz=function(e,t){return Math.abs(t-e)},wz=function(e,t,n){return e+Cz(t,n)},Tz=function(e,t,n){return e+(n-t)**2},Ez=function(e){return Math.sqrt(e)},Dz=function(e,t,n){return Math.max(e,Cz(t,n))},Oz=function(e,t,n,r,i){for(var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Sz,o=r,s,c,l=0;l<e;l++)s=t(l),c=n(l),o=i(o,s,c);return a(o)},kz={euclidean:function(e,t,n){return e>=2?Oz(e,t,n,0,Tz,Ez):Oz(e,t,n,0,wz)},squaredEuclidean:function(e,t,n){return Oz(e,t,n,0,Tz)},manhattan:function(e,t,n){return Oz(e,t,n,0,wz)},max:function(e,t,n){return Oz(e,t,n,-1/0,Dz)}};kz[`squared-euclidean`]=kz.squaredEuclidean,kz.squaredeuclidean=kz.squaredEuclidean;function Az(e,t,n,r,i,a){var o=JP(e)?e:kz[e]||kz.euclidean;return t===0&&JP(e)?o(i,a):o(t,n,r,i,a)}var jz=uL({k:2,m:2,sensitivityThreshold:1e-4,distance:`euclidean`,maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Mz=function(e){return jz(e)},Nz=function(e,t,n,r,i){var a=i===`kMedoids`?function(e){return r[e](n)}:function(e){return n[e]},o=function(e){return r[e](t)},s=n,c=t;return Az(e,r.length,a,o,s,c)},Pz=function(e,t,n){for(var r=n.length,i=Array(r),a=Array(r),o=Array(t),s=null,c=0;c<r;c++)i[c]=e.min(n[c]).value,a[c]=e.max(n[c]).value;for(var l=0;l<t;l++){s=[];for(var u=0;u<r;u++)s[u]=Math.random()*(a[u]-i[u])+i[u];o[l]=s}return o},Fz=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var c=Nz(n,e,t[s],r,i);c<a&&(a=c,o=s)}return o},Iz=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)i=t[a],n[i.id()]===e&&r.push(i);return r},Lz=function(e,t,n){return Math.abs(t-e)<=n},Rz=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++)if(Math.abs(e[r][i]-t[r][i])>n)return!1;return!0},zz=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},Bz=function(e,t){var n=Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];zz(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},Vz=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=Nz(`manhattan`,t[i],e,n,`kMedoids`);return r},Hz=function(e){var t=this.cy(),n=this.nodes(),r=null,i=Mz(e),a=Array(i.k),o={},s;i.testMode?typeof i.testCentroids==`number`?(i.testCentroids,s=Pz(n,i.k,i.attributes)):s=RP(i.testCentroids)===`object`?i.testCentroids:Pz(n,i.k,i.attributes):s=Pz(n,i.k,i.attributes);for(var c=!0,l=0;c&&l<i.maxIterations;){for(var u=0;u<n.length;u++)r=n[u],o[r.id()]=Fz(r,s,i.distance,i.attributes,`kMeans`);c=!1;for(var d=0;d<i.k;d++){var f=Iz(d,n,o);if(f.length!==0){for(var p=i.attributes.length,m=s[d],h=Array(p),g=Array(p),_=0;_<p;_++){g[_]=0;for(var v=0;v<f.length;v++)r=f[v],g[_]+=i.attributes[_](r);h[_]=g[_]/f.length,Lz(h[_],m[_],i.sensitivityThreshold)||(c=!0)}s[d]=h,a[d]=t.collection(f)}}l++}return a},Uz=function(e){var t=this.cy(),n=this.nodes(),r=null,i=Mz(e),a=Array(i.k),o,s={},c,l=Array(i.k);i.testMode?typeof i.testCentroids==`number`||(o=RP(i.testCentroids)===`object`?i.testCentroids:Bz(n,i.k)):o=Bz(n,i.k);for(var u=!0,d=0;u&&d<i.maxIterations;){for(var f=0;f<n.length;f++)r=n[f],s[r.id()]=Fz(r,o,i.distance,i.attributes,`kMedoids`);u=!1;for(var p=0;p<o.length;p++){var m=Iz(p,n,s);if(m.length!==0){l[p]=Vz(o[p],m,i.attributes);for(var h=0;h<m.length;h++)c=Vz(m[h],m,i.attributes),c<l[p]&&(l[p]=c,o[p]=m[h],u=!0);a[p]=t.collection(m)}}d++}return a},Wz=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var c=0;c<e.length;c++)r[s][c]=n[s][c]**+i.m;for(var l=0;l<e.length;l++)for(var u=0;u<i.attributes.length;u++){a=0,o=0;for(var d=0;d<t.length;d++)a+=r[d][l]*i.attributes[u](t[d]),o+=r[d][l];e[l][u]=a/o}},Gz=function(e,t,n,r,i){for(var a=0;a<e.length;a++)t[a]=e[a].slice();for(var o,s,c,l=2/(i.m-1),u=0;u<n.length;u++)for(var d=0;d<r.length;d++){o=0;for(var f=0;f<n.length;f++)s=Nz(i.distance,r[d],n[u],i.attributes,`cmeans`),c=Nz(i.distance,r[d],n[f],i.attributes,`cmeans`),o+=(s/c)**+l;e[d][u]=1/o}},Kz=function(e,t,n,r){for(var i=Array(n.k),a=0;a<i.length;a++)i[a]=[];for(var o,s,c=0;c<t.length;c++){o=-1/0,s=-1;for(var l=0;l<t[0].length;l++)t[c][l]>o&&(o=t[c][l],s=l);i[s].push(e[c])}for(var u=0;u<i.length;u++)i[u]=r.collection(i[u]);return i},qz=function(e){for(var t=this.cy(),n=this.nodes(),r=Mz(e),i,a,o,s=Array(n.length),c,l=0;l<n.length;l++)s[l]=Array(r.k);o=Array(n.length);for(var u=0;u<n.length;u++)o[u]=Array(r.k);for(var d=0;d<n.length;d++){for(var f=0,p=0;p<r.k;p++)o[d][p]=Math.random(),f+=o[d][p];for(var m=0;m<r.k;m++)o[d][m]=o[d][m]/f}a=Array(r.k);for(var h=0;h<r.k;h++)a[h]=Array(r.attributes.length);c=Array(n.length);for(var g=0;g<n.length;g++)c[g]=Array(r.k);for(var _=!0,v=0;_&&v<r.maxIterations;)_=!1,Wz(a,n,o,c,r),Gz(o,s,a,n,r),Rz(o,s,r.sensitivityThreshold)||(_=!0),v++;return i=Kz(n,o,r,t),{clusters:i,degreeOfMembership:o}},Jz={kMeans:Hz,kMedoids:Uz,fuzzyCMeans:qz,fcm:qz},Yz=uL({distance:`euclidean`,linkage:`min`,mode:`threshold`,threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Xz={single:`min`,complete:`max`},Zz=function(e){var t=Yz(e),n=Xz[t.linkage];return n!=null&&(t.linkage=n),t},Qz=function(e,t,n,r,i){for(var a=0,o=1/0,s,c=i.attributes,l=function(e,t){return Az(i.distance,c.length,function(t){return c[t](e)},function(e){return c[e](t)},e,t)},u=0;u<e.length;u++){var d=e[u].key,f=n[d][r[d]];f<o&&(a=d,o=f)}if(i.mode===`threshold`&&o>=i.threshold||i.mode===`dendrogram`&&e.length===1)return!1;var p=t[a],m=t[r[a]],h=i.mode===`dendrogram`?{left:p,right:m,key:p.key}:{value:p.value.concat(m.value),key:p.key};e[p.index]=h,e.splice(m.index,1),t[p.key]=h;for(var g=0;g<e.length;g++){var _=e[g];p.key===_.key?s=1/0:i.linkage===`min`?(s=n[p.key][_.key],n[p.key][_.key]>n[m.key][_.key]&&(s=n[m.key][_.key])):i.linkage===`max`?(s=n[p.key][_.key],n[p.key][_.key]<n[m.key][_.key]&&(s=n[m.key][_.key])):s=i.linkage===`mean`?(n[p.key][_.key]*p.size+n[m.key][_.key]*m.size)/(p.size+m.size):i.mode===`dendrogram`?l(_.value,p.value):l(_.value[0],p.value[0]),n[p.key][_.key]=n[_.key][p.key]=s}for(var v=0;v<e.length;v++){var y=e[v].key;if(r[y]===p.key||r[y]===m.key){for(var b=y,x=0;x<e.length;x++){var S=e[x].key;n[y][S]<n[y][b]&&(b=S)}r[y]=b}e[v].index=v}return p.key=m.key=p.index=m.index=null,!0},$z=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&$z(e.left,t),e.right&&$z(e.right,t)))},eB=function(e,t){if(!e)return``;if(e.left&&e.right){var n=eB(e.left,t),r=eB(e.right,t),i=t.add({group:`nodes`,data:{id:n+`,`+r}});return t.add({group:`edges`,data:{source:n,target:i.id()}}),t.add({group:`edges`,data:{source:r,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},tB=function(e,t,n){if(!e)return[];var r=[],i=[],a=[];return t===0?(e.left&&$z(e.left,r),e.right&&$z(e.right,i),a=r.concat(i),[n.collection(a)]):t===1?e.value?[n.collection(e.value)]:(e.left&&$z(e.left,r),e.right&&$z(e.right,i),[n.collection(r),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(r=tB(e.left,t-1,n)),e.right&&(i=tB(e.right,t-1,n)),r.concat(i))},nB=function(e){for(var t=this.cy(),n=this.nodes(),r=Zz(e),i=r.attributes,a=function(e,t){return Az(r.distance,i.length,function(t){return i[t](e)},function(e){return i[e](t)},e,t)},o=[],s=[],c=[],l=[],u=0;u<n.length;u++){var d={value:r.mode===`dendrogram`?n[u]:[n[u]],key:u,index:u};o[u]=d,l[u]=d,s[u]=[],c[u]=0}for(var f=0;f<o.length;f++)for(var p=0;p<=f;p++){var m=void 0;m=r.mode===`dendrogram`?f===p?1/0:a(o[f].value,o[p].value):f===p?1/0:a(o[f].value[0],o[p].value[0]),s[f][p]=m,s[p][f]=m,m<s[f][c[f]]&&(c[f]=p)}for(var h=Qz(o,l,s,c,r);h;)h=Qz(o,l,s,c,r);var g;return r.mode===`dendrogram`?(g=tB(o[0],r.dendrogramDepth,t),r.addDendrogram&&eB(o[0],t)):(g=Array(o.length),o.forEach(function(e,n){e.key=e.index=null,g[n]=t.collection(e.value)})),g},rB={hierarchicalClustering:nB,hca:nB},iB=uL({distance:`euclidean`,preference:`median`,damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),aB=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||tL(`Damping must range on [0.5, 1). Got: ${t}`);var r=[`median`,`mean`,`min`,`max`];return r.some(function(e){return e===n})||$(n)||tL(`Preference must be one of [${r.map(function(e){return`'${e}'`}).join(`, `)}] or a number. Got: ${n}`),iB(e)},oB=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-Az(e,r.length,function(e){return i(t,e)},function(e){return i(n,e)},t,n)},sB=function(e,t){var n=null;return n=t===`median`?ZL(e):t===`mean`?XL(e):t===`min`?JL(e):t===`max`?YL(e):t,n},cB=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r},lB=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var c=n[s];t[i*e+c]>o&&(a=c,o=t[i*e+c])}a>0&&r.push(a)}for(var l=0;l<n.length;l++)r[n[l]]=n[l];return r},uB=function(e,t,n){for(var r=lB(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,c=-1/0,l=0;l<a.length;l++){for(var u=0,d=0;d<a.length;d++)u+=t[a[d]*e+a[l]];u>c&&(s=l,c=u)}n[i]=a[s]}return r=lB(e,t,n),r},dB=function(e){for(var t=this.cy(),n=this.nodes(),r=aB(e),i={},a=0;a<n.length;a++)i[n[a].id()]=a;for(var o=n.length,s=o*o,c=Array(s),l,u,d,f=0;f<s;f++)c[f]=-1/0;for(var p=0;p<o;p++)for(var m=0;m<o;m++)p!==m&&(c[p*o+m]=oB(r.distance,n[p],n[m],r.attributes));l=sB(c,r.preference);for(var h=0;h<o;h++)c[h*o+h]=l;u=Array(s);for(var g=0;g<s;g++)u[g]=0;d=Array(s);for(var _=0;_<s;_++)d[_]=0;for(var v=Array(o),y=Array(o),b=Array(o),x=0;x<o;x++)v[x]=0,y[x]=0,b[x]=0;for(var S=Array(o*r.minIterations),C=0;C<S.length;C++)S[C]=0;var w;for(w=0;w<r.maxIterations;w++){for(var T=0;T<o;T++){for(var E=-1/0,D=-1/0,O=-1,k=0,A=0;A<o;A++)v[A]=u[T*o+A],k=d[T*o+A]+c[T*o+A],k>=E?(D=E,E=k,O=A):k>D&&(D=k);for(var j=0;j<o;j++)u[T*o+j]=(1-r.damping)*(c[T*o+j]-E)+r.damping*v[j];u[T*o+O]=(1-r.damping)*(c[T*o+O]-D)+r.damping*v[O]}for(var M=0;M<o;M++){for(var N=0,P=0;P<o;P++)v[P]=d[P*o+M],y[P]=Math.max(0,u[P*o+M]),N+=y[P];N-=y[M],y[M]=u[M*o+M],N+=y[M];for(var F=0;F<o;F++)d[F*o+M]=(1-r.damping)*Math.min(0,N-y[F])+r.damping*v[F];d[M*o+M]=(1-r.damping)*(N-y[M])+r.damping*v[M]}for(var I=0,L=0;L<o;L++){var R=+(d[L*o+L]+u[L*o+L]>0);S[w%r.minIterations*o+L]=R,I+=R}if(I>0&&(w>=r.minIterations-1||w==r.maxIterations-1)){for(var ee=0,z=0;z<o;z++){b[z]=0;for(var B=0;B<r.minIterations;B++)b[z]+=S[B*o+z];(b[z]===0||b[z]===r.minIterations)&&ee++}if(ee===o)break}}for(var V=cB(o,u,d),H=uB(o,c,V),te={},ne=0;ne<V.length;ne++)te[V[ne]]=[];for(var U=0;U<n.length;U++){var re=H[i[n[U].id()]];re!=null&&te[re].push(n[U])}for(var ie=Array(V.length),ae=0;ae<V.length;ae++)ie[ae]=t.collection(te[V[ae]]);return ie},fB={affinityPropagation:dB,ap:dB},pB=uL({root:void 0,directed:!1}),mB={hierholzer:function(e){if(!XP(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n=pB(e),r=n.root,i=n.directed,a=this,o=!1,s,c,l;r&&(l=qP(r)?this.filter(r)[0].id():r[0].id());var u={},d={};i?a.forEach(function(e){var t=e.id();if(e.isNode()){var n=e.indegree(!0),r=e.outdegree(!0),i=n-r,a=r-n;i==1?s?o=!0:s=t:a==1?c?o=!0:c=t:(a>1||i>1)&&(o=!0),u[t]=[],e.outgoers().forEach(function(e){e.isEdge()&&u[t].push(e.id())})}else d[t]=[void 0,e.target().id()]}):a.forEach(function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(s?c?o=!0:c=t:s=t),u[t]=[],e.connectedEdges().forEach(function(e){return u[t].push(e.id())})):d[t]=[e.source().id(),e.target().id()]});var f={found:!1,trail:void 0};if(o)return f;if(c&&s)if(i){if(l&&c!=l)return f;l=c}else if(l&&c!=l&&s!=l)return f;else l||=c;else l||=a[0].id();var p=function(e){for(var t=e,n=[e],r,a,o;u[t].length;)r=u[t].shift(),a=d[r][0],o=d[r][1],t==o?!i&&t!=a&&(u[a]=u[a].filter(function(e){return e!=r}),t=a):(u[o]=u[o].filter(function(e){return e!=r}),t=o),n.unshift(r),n.unshift(t);return n},m=[],h=[];for(h=p(l);h.length!=1;)u[h[0]].length==0?(m.unshift(a.getElementById(h.shift())),m.unshift(a.getElementById(h.shift()))):h=p(h.shift()).concat(h);for(var g in m.unshift(a.getElementById(h.shift())),u)if(u[g].length)return f;return f.found=!0,f.trail=this.spawn(m,!0),f}},hB=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(n,r){for(var o=a.length-1,s=[],c=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach(function(n){var r=n.connectedNodes().intersection(e);c.merge(n),r.forEach(function(n){var r=n.id(),i=n.connectedEdges().intersection(e);c.merge(n),t[r].cutVertex?c.merge(i.filter(function(e){return e.isLoop()})):c.merge(i)})}),i.push(c)},c=function(l,u,d){l===d&&(r+=1),t[u]={id:n,low:n++,cutVertex:!1};var f=e.getElementById(u).connectedEdges().intersection(e);if(f.size()===0)i.push(e.spawn(e.getElementById(u)));else{var p,m,h,g;f.forEach(function(e){p=e.source().id(),m=e.target().id(),h=p===u?m:p,h!==d&&(g=e.id(),o[g]||(o[g]=!0,a.push({x:u,y:h,edge:e})),h in t?t[u].low=Math.min(t[u].low,t[h].id):(c(l,h,u),t[u].low=Math.min(t[u].low,t[h].low),t[u].id<=t[h].low&&(t[u].cutVertex=!0,s(u,h))))})}};e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||(r=0,c(n,n),t[n].cutVertex=r>1)}});var l=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(l),components:i}},gB={hopcroftTarjanBiconnected:hB,htbc:hB,htb:hB,hopcroftTarjanBiconnectedComponents:hB},_B=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var c=e.spawn();;){var l=i.pop();if(c.merge(e.getElementById(l)),t[l].low=t[s].index,t[l].explored=!0,l===s)break}var u=c.edgesWith(c),d=c.merge(u);r.push(d),a=a.difference(d)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:a,components:r}},vB={tarjanStronglyConnected:_B,tsc:_B,tscc:_B,tarjanStronglyConnectedComponents:_B},yB={};[SL,ML,NL,FL,LL,zL,UL,tz,rz,az,sz,xz,Jz,rB,fB,mB,gB,vB].forEach(function(e){EF(yB,e)});var bB=0,xB=1,SB=2,CB=function(e){if(!(this instanceof CB))return new CB(e);this.id=`Thenable/1.0.7`,this.state=bB,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e==`function`&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};CB.prototype={fulfill:function(e){return wB(this,xB,`fulfillValue`,e)},reject:function(e){return wB(this,SB,`rejectReason`,e)},then:function(e,t){var n=this,r=new CB;return n.onFulfilled.push(DB(e,r,`fulfill`)),n.onRejected.push(DB(t,r,`reject`)),TB(n),r.proxy}};var wB=function(e,t,n,r){return e.state===bB&&(e.state=t,e[n]=r,TB(e)),e},TB=function(e){e.state===xB?EB(e,`onFulfilled`,e.fulfillValue):e.state===SB&&EB(e,`onRejected`,e.rejectReason)},EB=function(e,t,n){if(e[t].length!==0){var r=e[t];e[t]=[];var i=function(){for(var e=0;e<r.length;e++)r[e](n)};typeof setImmediate==`function`?setImmediate(i):setTimeout(i,0)}},DB=function(e,t,n){return function(r){if(typeof e!=`function`)t[n].call(t,r);else{var i;try{i=e(r)}catch(e){t.reject(e);return}OB(t,i)}}},OB=function(e,t){if(e===t||e.proxy===t){e.reject(TypeError(`cannot resolve promise with itself`));return}var n;if(RP(t)===`object`&&t!==null||typeof t==`function`)try{n=t.then}catch(t){e.reject(t);return}if(typeof n==`function`){var r=!1;try{n.call(t,function(n){r||(r=!0,n===t?e.reject(TypeError(`circular thenable chain`)):OB(e,n))},function(t){r||(r=!0,e.reject(t))})}catch(t){r||e.reject(t)}return}e.fulfill(t)};CB.all=function(e){return new CB(function(t,n){for(var r=Array(e.length),i=0,a=function(n,a){r[n]=a,i++,i===e.length&&t(r)},o=0;o<e.length;o++)(function(t){var r=e[t];r!=null&&r.then!=null?r.then(function(e){a(t,e)},function(e){n(e)}):a(t,r)})(o)})},CB.resolve=function(e){return new CB(function(t,n){t(e)})},CB.reject=function(e){return new CB(function(t,n){n(e)})};var kB=typeof Promise<`u`?Promise:CB,AB=function(e,t,n){var r=rF(e),i=!r,a=this._private=EF({duration:1e3},t,n);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&JP(a.complete)&&a.completes.push(a.complete),i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(r){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},jB=AB.prototype;EF(jB,{instanceString:function(){return`animation`},hook:function(){var e=this._private;if(!e.hooked){var t,n=e.target._private.animation;t=e.queue?n.queue:n.current,t.push(this),eF(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return e===void 0?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];r!=null&&(e[t]=e[n],e[n]=r)};if(n(`zoom`,`startZoom`),n(`pan`,`startPan`),n(`position`,`startPosition`),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t=this._private,n;switch(e){case`frame`:n=t.frames;break;default:case`complete`:case`completed`:n=t.completes}return new kB(function(e,t){n.push(function(){e()})})}}),jB.complete=jB.completed,jB.run=jB.play,jB.running=jB.playing;var MB={animated:function(){return function(){var e=this,t=e.length===void 0?[e]:e;if(!(this._private.cy||this).styleEnabled())return!1;var n=t[0];if(n)return n._private.animation.current.length>0}},clearQueue:function(){return function(){var e=this,t=e.length===void 0?[e]:e;if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n<t.length;n++){var r=t[n];r._private.animation.queue=[]}return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=this,r=n.length!==void 0,i=r?n:[n],a=this._private.cy||this,o=!r,s=!o;if(!a.styleEnabled())return this;var c=a.style();if(e=EF({},e,t),Object.keys(e).length===0)return new AB(i[0],e);switch(e.duration===void 0&&(e.duration=400),e.duration){case`slow`:e.duration=600;break;case`fast`:e.duration=200;break}if(s&&(e.style=c.getPropsList(e.style||e.css),e.css=void 0),s&&e.renderedPosition!=null){var l=e.renderedPosition,u=a.pan(),d=a.zoom();e.position=KL(l,d,u)}if(o&&e.panBy!=null){var f=e.panBy,p=a.pan();e.pan={x:p.x+f.x,y:p.y+f.y}}var m=e.center||e.centre;if(o&&m!=null){var h=a.getCenterPan(m.eles,e.zoom);h!=null&&(e.pan=h)}if(o&&e.fit!=null){var g=e.fit,_=a.getFitViewport(g.eles||g.boundingBox,g.padding);_!=null&&(e.pan=_.pan,e.zoom=_.zoom)}if(o&&XP(e.zoom)){var v=a.getZoomedViewport(e.zoom);v==null?e.zoom=null:(v.zoomed&&(e.zoom=v.zoom),v.panned&&(e.pan=v.pan))}return new AB(i[0],e)}},animate:function(){return function(e,t){var n=this,r=n.length===void 0?[n]:n;if(!(this._private.cy||this).styleEnabled())return this;t&&(e=EF({},e,t));for(var i=0;i<r.length;i++){var a=r[i],o=a.animated()&&(e.queue===void 0||e.queue);a.animation(e,o?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=this,r=n.length===void 0?[n]:n,i=this._private.cy||this;if(!i.styleEnabled())return this;for(var a=0;a<r.length;a++){for(var o=r[a]._private,s=o.animation.current,c=0;c<s.length;c++){var l=s[c]._private;t&&(l.duration=0)}e&&(o.animation.queue=[]),t||(o.animation.current=[])}return i.notify(`draw`),this}}},NB,PB;function FB(){return PB?NB:(PB=1,NB=Array.isArray,NB)}var IB,LB;function RB(){if(LB)return IB;LB=1;var e=FB(),t=vI(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(i,a){if(e(i))return!1;var o=typeof i;return o==`number`||o==`symbol`||o==`boolean`||i==null||t(i)?!0:r.test(i)||!n.test(i)||a!=null&&i in Object(a)}return IB=i,IB}var zB,BB;function VB(){if(BB)return zB;BB=1;var e=fI(),t=zF(),n=`[object AsyncFunction]`,r=`[object Function]`,i=`[object GeneratorFunction]`,a=`[object Proxy]`;function o(o){if(!t(o))return!1;var s=e(o);return s==r||s==i||s==n||s==a}return zB=o,zB}var HB,UB;function WB(){return UB?HB:(UB=1,HB=GF()[`__core-js_shared__`],HB)}var GB,KB;function qB(){if(KB)return GB;KB=1;var e=WB(),t=function(){var t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||``);return t?`Symbol(src)_1.`+t:``}();function n(e){return!!t&&t in e}return GB=n,GB}var JB,YB;function XB(){if(YB)return JB;YB=1;var e=Function.prototype.toString;function t(t){if(t!=null){try{return e.call(t)}catch{}try{return t+``}catch{}}return``}return JB=t,JB}var ZB,QB;function $B(){if(QB)return ZB;QB=1;var e=VB(),t=qB(),n=zF(),r=XB(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=RegExp(`^`+c.call(l).replace(i,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function d(i){return!n(i)||t(i)?!1:(e(i)?u:a).test(r(i))}return ZB=d,ZB}var eV,tV;function nV(){if(tV)return eV;tV=1;function e(e,t){return e?.[t]}return eV=e,eV}var rV,iV;function aV(){if(iV)return rV;iV=1;var e=$B(),t=nV();function n(n,r){var i=t(n,r);return e(i)?i:void 0}return rV=n,rV}var oV,sV;function cV(){return sV?oV:(sV=1,oV=aV()(Object,`create`),oV)}var lV,uV;function dV(){if(uV)return lV;uV=1;var e=cV();function t(){this.__data__=e?e(null):{},this.size=0}return lV=t,lV}var fV,pV;function mV(){if(pV)return fV;pV=1;function e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}return fV=e,fV}var hV,gV;function _V(){if(gV)return hV;gV=1;var e=cV(),t=`__lodash_hash_undefined__`,n=Object.prototype.hasOwnProperty;function r(r){var i=this.__data__;if(e){var a=i[r];return a===t?void 0:a}return n.call(i,r)?i[r]:void 0}return hV=r,hV}var vV,yV;function bV(){if(yV)return vV;yV=1;var e=cV(),t=Object.prototype.hasOwnProperty;function n(n){var r=this.__data__;return e?r[n]!==void 0:t.call(r,n)}return vV=n,vV}var xV,SV;function CV(){if(SV)return xV;SV=1;var e=cV(),t=`__lodash_hash_undefined__`;function n(n,r){var i=this.__data__;return this.size+=+!this.has(n),i[n]=e&&r===void 0?t:r,this}return xV=n,xV}var wV,TV;function EV(){if(TV)return wV;TV=1;var e=dV(),t=mV(),n=_V(),r=bV(),i=CV();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,wV=a,wV}var DV,OV;function kV(){if(OV)return DV;OV=1;function e(){this.__data__=[],this.size=0}return DV=e,DV}var AV,jV;function MV(){if(jV)return AV;jV=1;function e(e,t){return e===t||e!==e&&t!==t}return AV=e,AV}var NV,PV;function FV(){if(PV)return NV;PV=1;var e=MV();function t(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1}return NV=t,NV}var IV,LV;function RV(){if(LV)return IV;LV=1;var e=FV(),t=Array.prototype.splice;function n(n){var r=this.__data__,i=e(r,n);return i<0?!1:(i==r.length-1?r.pop():t.call(r,i,1),--this.size,!0)}return IV=n,IV}var zV,BV;function VV(){if(BV)return zV;BV=1;var e=FV();function t(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]}return zV=t,zV}var HV,UV;function WV(){if(UV)return HV;UV=1;var e=FV();function t(t){return e(this.__data__,t)>-1}return HV=t,HV}var GV,KV;function qV(){if(KV)return GV;KV=1;var e=FV();function t(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}return GV=t,GV}var JV,YV;function XV(){if(YV)return JV;YV=1;var e=kV(),t=RV(),n=VV(),r=WV(),i=qV();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,JV=a,JV}var ZV,QV;function $V(){return QV?ZV:(QV=1,ZV=aV()(GF(),`Map`),ZV)}var eH,tH;function nH(){if(tH)return eH;tH=1;var e=EV(),t=XV(),n=$V();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return eH=r,eH}var rH,iH;function aH(){if(iH)return rH;iH=1;function e(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}return rH=e,rH}var oH,sH;function cH(){if(sH)return oH;sH=1;var e=aH();function t(t,n){var r=t.__data__;return e(n)?r[typeof n==`string`?`string`:`hash`]:r.map}return oH=t,oH}var lH,uH;function dH(){if(uH)return lH;uH=1;var e=cH();function t(t){var n=e(this,t).delete(t);return this.size-=+!!n,n}return lH=t,lH}var fH,pH;function mH(){if(pH)return fH;pH=1;var e=cH();function t(t){return e(this,t).get(t)}return fH=t,fH}var hH,gH;function _H(){if(gH)return hH;gH=1;var e=cH();function t(t){return e(this,t).has(t)}return hH=t,hH}var vH,yH;function bH(){if(yH)return vH;yH=1;var e=cH();function t(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=r.size==i?0:1,this}return vH=t,vH}var xH,SH;function CH(){if(SH)return xH;SH=1;var e=nH(),t=dH(),n=mH(),r=_H(),i=bH();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,xH=a,xH}var wH,TH;function EH(){if(TH)return wH;TH=1;var e=CH(),t=`Expected a function`;function n(r,i){if(typeof r!=`function`||i!=null&&typeof i!=`function`)throw TypeError(t);var a=function(){var e=arguments,t=i?i.apply(this,e):e[0],n=a.cache;if(n.has(t))return n.get(t);var o=r.apply(this,e);return a.cache=n.set(t,o)||n,o};return a.cache=new(n.Cache||e),a}return n.Cache=e,wH=n,wH}var DH,OH;function kH(){if(OH)return DH;OH=1;var e=EH(),t=500;function n(n){var r=e(n,function(e){return i.size===t&&i.clear(),e}),i=r.cache;return r}return DH=n,DH}var AH,jH;function MH(){if(jH)return AH;jH=1;var e=kH(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g;return AH=e(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(``),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,`$1`):t||e)}),r}),AH}var NH,PH;function FH(){if(PH)return NH;PH=1;function e(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}return NH=e,NH}var IH,LH;function RH(){if(LH)return IH;LH=1;var e=rI(),t=FH(),n=FB(),r=vI(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(e){if(typeof e==`string`)return e;if(n(e))return t(e,o)+``;if(r(e))return a?a.call(e):``;var i=e+``;return i==`0`&&1/e==-1/0?`-0`:i}return IH=o,IH}var zH,BH;function VH(){if(BH)return zH;BH=1;var e=RH();function t(t){return t==null?``:e(t)}return zH=t,zH}var HH,UH;function WH(){if(UH)return HH;UH=1;var e=FB(),t=RB(),n=MH(),r=VH();function i(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}return HH=i,HH}var GH,KH;function qH(){if(KH)return GH;KH=1;var e=vI();function t(t){if(typeof t==`string`||e(t))return t;var n=t+``;return n==`0`&&1/t==-1/0?`-0`:n}return GH=t,GH}var JH,YH;function XH(){if(YH)return JH;YH=1;var e=WH(),t=qH();function n(n,r){r=e(r,n);for(var i=0,a=r.length;n!=null&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}return JH=n,JH}var ZH,QH;function $H(){if(QH)return ZH;QH=1;var e=XH();function t(t,n,r){var i=t==null?void 0:e(t,n);return i===void 0?r:i}return ZH=t,ZH}var eU=IF($H()),tU,nU;function rU(){if(nU)return tU;nU=1;var e=aV();return tU=function(){try{var t=e(Object,`defineProperty`);return t({},``,{}),t}catch{}}(),tU}var iU,aU;function oU(){if(aU)return iU;aU=1;var e=rU();function t(t,n,r){n==`__proto__`&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}return iU=t,iU}var sU,cU;function lU(){if(cU)return sU;cU=1;var e=oU(),t=MV(),n=Object.prototype.hasOwnProperty;function r(r,i,a){var o=r[i];(!(n.call(r,i)&&t(o,a))||a===void 0&&!(i in r))&&e(r,i,a)}return sU=r,sU}var uU,dU;function fU(){if(dU)return uU;dU=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(n,r){var i=typeof n;return r??=e,!!r&&(i==`number`||i!=`symbol`&&t.test(n))&&n>-1&&n%1==0&&n<r}return uU=n,uU}var pU,mU;function hU(){if(mU)return pU;mU=1;var e=lU(),t=WH(),n=fU(),r=zF(),i=qH();function a(a,o,s,c){if(!r(a))return a;o=t(o,a);for(var l=-1,u=o.length,d=u-1,f=a;f!=null&&++l<u;){var p=i(o[l]),m=s;if(p===`__proto__`||p===`constructor`||p===`prototype`)return a;if(l!=d){var h=f[p];m=c?c(h,p,f):void 0,m===void 0&&(m=r(h)?h:n(o[l+1])?[]:{})}e(f,p,m),f=f[p]}return a}return pU=a,pU}var gU,_U;function vU(){if(_U)return gU;_U=1;var e=hU();function t(t,n,r){return t==null?t:e(t,n,r)}return gU=t,gU}var yU=IF(vU()),bU,xU;function SU(){if(xU)return bU;xU=1;function e(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}return bU=e,bU}var CU,wU;function TU(){if(wU)return CU;wU=1;var e=FH(),t=SU(),n=FB(),r=vI(),i=MH(),a=qH(),o=VH();function s(s){return n(s)?e(s,a):r(s)?[s]:t(i(o(s)))}return CU=s,CU}var EU=IF(TU()),DU={data:function(e){return e=EF({},{field:`data`,bindingEvent:`data`,allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:`data`,settingTriggersEvent:!1,triggerFnName:`trigger`,immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r=e,i=this,a=i.length!==void 0,o=a?i:[i],s=a?i[0]:i;if(qP(t)){var c=t.indexOf(`.`)!==-1&&EU(t);if(r.allowGetting&&n===void 0){var l;return s&&(r.beforeGet(s),l=c&&s._private[r.field][t]===void 0?eU(s._private[r.field],c):s._private[r.field][t]),l}else if(r.allowSetting&&n!==void 0&&!r.immutableKeys[t]){var u=kP({},t,n);r.beforeSet(i,u);for(var d=0,f=o.length;d<f;d++){var p=o[d];r.canSet(p)&&(c&&s._private[r.field][t]===void 0?yU(p._private[r.field],c,n):p._private[r.field][t]=n)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&XP(t)){var m=t,h,g,_=Object.keys(m);r.beforeSet(i,m);for(var v=0;v<_.length;v++)if(h=_[v],g=m[h],!r.immutableKeys[h])for(var y=0;y<o.length;y++){var b=o[y];r.canSet(b)&&(b._private[r.field][h]=g)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&JP(t)){var x=t;i.on(r.bindingEvent,x)}else if(r.allowGetting&&t===void 0){var S;return s&&(r.beforeGet(s),S=s._private[r.field]),S}return i}},removeData:function(e){return e=EF({},{field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=this,i=r.length===void 0?[r]:r;if(qP(t)){for(var a=t.split(/\s+/),o=a.length,s=0;s<o;s++){var c=a[s];if(!oF(c)&&!n.immutableKeys[c])for(var l=0,u=i.length;l<u;l++)i[l]._private[n.field][c]=void 0}n.triggerEvent&&r[n.triggerFnName](n.event)}else if(t===void 0){for(var d=0,f=i.length;d<f;d++)for(var p=i[d]._private[n.field],m=Object.keys(p),h=0;h<m.length;h++){var g=m[h];n.immutableKeys[g]||(p[g]=void 0)}n.triggerEvent&&r[n.triggerFnName](n.event)}return r}}},OU={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new kB(function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)})}}},kU={};[MB,DU,OU].forEach(function(e){EF(kU,e)});var AU={animate:kU.animate(),animation:kU.animation(),animated:kU.animated(),clearQueue:kU.clearQueue(),delay:kU.delay(),delayAnimation:kU.delayAnimation(),stop:kU.stop()},jU={classes:function(e){var t=this;if(e===void 0){var n=[];return t[0]._private.classes.forEach(function(e){return n.push(e)}),n}else YP(e)||(e=(e||``).match(/\S+/g)||[]);for(var r=[],i=new yL(e),a=0;a<t.length;a++){for(var o=t[a],s=o._private,c=s.classes,l=!1,u=0;u<e.length;u++){var d=e[u];if(!c.has(d)){l=!0;break}}l||=c.size!==e.length,l&&(s.classes=i,r.push(o))}return r.length>0&&this.spawn(r).updateStyle().emit(`class`),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){YP(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=t===void 0,i=[],a=0,o=n.length;a<o;a++)for(var s=n[a],c=s._private.classes,l=!1,u=0;u<e.length;u++){var d=e[u],f=c.has(d),p=!1;t||r&&!f?(c.add(d),p=!0):(!t||r&&f)&&(c.delete(d),p=!0),!l&&p&&(i.push(s),l=!0)}return i.length>0&&this.spawn(i).updateStyle().emit(`class`),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};jU.className=jU.classNames=jU.classes;var MU={metaChar:`[\\!\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\\`\\{\\|\\}\\~]`,comparatorOp:`=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=`,boolOp:`\\?|\\!|\\^`,string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:_F,meta:`degree|indegree|outdegree`,separator:`\\s*,\\s*`,descendant:`\\s+`,child:`\\s+>\\s+`,subject:`\\$`,group:`node|edge|\\*`,directedEdge:`\\s+->\\s+`,undirectedEdge:`\\s+<->\\s+`};MU.variable=`(?:[\\w-.]|(?:\\\\`+MU.metaChar+`))+`,MU.className=`(?:[\\w-]|(?:\\\\`+MU.metaChar+`))+`,MU.value=MU.string+`|`+MU.number,MU.id=MU.variable,(function(){var e=MU.comparatorOp.split(`|`),t,n;for(n=0;n<e.length;n++)t=e[n],MU.comparatorOp+=`|@`+t;for(e=MU.comparatorOp.split(`|`),n=0;n<e.length;n++)t=e[n],!(t.indexOf(`!`)>=0)&&t!==`=`&&(MU.comparatorOp+=`|\\!`+t)})();var NU=function(){return{checks:[]}},PU={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},FU=[{selector:`:selected`,matches:function(e){return e.selected()}},{selector:`:unselected`,matches:function(e){return!e.selected()}},{selector:`:selectable`,matches:function(e){return e.selectable()}},{selector:`:unselectable`,matches:function(e){return!e.selectable()}},{selector:`:locked`,matches:function(e){return e.locked()}},{selector:`:unlocked`,matches:function(e){return!e.locked()}},{selector:`:visible`,matches:function(e){return e.visible()}},{selector:`:hidden`,matches:function(e){return!e.visible()}},{selector:`:transparent`,matches:function(e){return e.transparent()}},{selector:`:grabbed`,matches:function(e){return e.grabbed()}},{selector:`:free`,matches:function(e){return!e.grabbed()}},{selector:`:removed`,matches:function(e){return e.removed()}},{selector:`:inside`,matches:function(e){return!e.removed()}},{selector:`:grabbable`,matches:function(e){return e.grabbable()}},{selector:`:ungrabbable`,matches:function(e){return!e.grabbable()}},{selector:`:animated`,matches:function(e){return e.animated()}},{selector:`:unanimated`,matches:function(e){return!e.animated()}},{selector:`:parent`,matches:function(e){return e.isParent()}},{selector:`:childless`,matches:function(e){return e.isChildless()}},{selector:`:child`,matches:function(e){return e.isChild()}},{selector:`:orphan`,matches:function(e){return e.isOrphan()}},{selector:`:nonorphan`,matches:function(e){return e.isChild()}},{selector:`:compound`,matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:`:loop`,matches:function(e){return e.isLoop()}},{selector:`:simple`,matches:function(e){return e.isSimple()}},{selector:`:active`,matches:function(e){return e.active()}},{selector:`:inactive`,matches:function(e){return!e.active()}},{selector:`:backgrounding`,matches:function(e){return e.backgrounding()}},{selector:`:nonbackgrounding`,matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return TF(e.selector,t.selector)}),IU=function(){for(var e={},t,n=0;n<FU.length;n++)t=FU[n],e[t.selector]=t.matches;return e}(),LU=function(e,t){return IU[e](t)},RU=`(`+FU.map(function(e){return e.selector}).join(`|`)+`)`,zU=function(e){return e.replace(RegExp(`\\\\(`+MU.metaChar+`)`,`g`),function(e,t){return t})},BU=function(e,t,n){e[e.length-1]=n},VU=[{name:`group`,query:!0,regex:`(`+MU.group+`)`,populate:function(e,t,n){var r=PP(n,1)[0];t.checks.push({type:PU.GROUP,value:r===`*`?r:r+`s`})}},{name:`state`,query:!0,regex:RU,populate:function(e,t,n){var r=PP(n,1)[0];t.checks.push({type:PU.STATE,value:r})}},{name:`id`,query:!0,regex:`\\#(`+MU.id+`)`,populate:function(e,t,n){var r=PP(n,1)[0];t.checks.push({type:PU.ID,value:zU(r)})}},{name:`className`,query:!0,regex:`\\.(`+MU.className+`)`,populate:function(e,t,n){var r=PP(n,1)[0];t.checks.push({type:PU.CLASS,value:zU(r)})}},{name:`dataExists`,query:!0,regex:`\\[\\s*(`+MU.variable+`)\\s*\\]`,populate:function(e,t,n){var r=PP(n,1)[0];t.checks.push({type:PU.DATA_EXIST,field:zU(r)})}},{name:`dataCompare`,query:!0,regex:`\\[\\s*(`+MU.variable+`)\\s*(`+MU.comparatorOp+`)\\s*(`+MU.value+`)\\s*\\]`,populate:function(e,t,n){var r=PP(n,3),i=r[0],a=r[1],o=r[2];o=RegExp(`^`+MU.string+`$`).exec(o)==null?parseFloat(o):o.substring(1,o.length-1),t.checks.push({type:PU.DATA_COMPARE,field:zU(i),operator:a,value:o})}},{name:`dataBool`,query:!0,regex:`\\[\\s*(`+MU.boolOp+`)\\s*(`+MU.variable+`)\\s*\\]`,populate:function(e,t,n){var r=PP(n,2),i=r[0],a=r[1];t.checks.push({type:PU.DATA_BOOL,field:zU(a),operator:i})}},{name:`metaCompare`,query:!0,regex:`\\[\\[\\s*(`+MU.meta+`)\\s*(`+MU.comparatorOp+`)\\s*(`+MU.number+`)\\s*\\]\\]`,populate:function(e,t,n){var r=PP(n,3),i=r[0],a=r[1],o=r[2];t.checks.push({type:PU.META_COMPARE,field:zU(i),operator:a,value:parseFloat(o)})}},{name:`nextQuery`,separator:!0,regex:MU.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return n!=null&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=NU()}},{name:`directedEdge`,separator:!0,regex:MU.directedEdge,populate:function(e,t){if(e.currentSubject==null){var n=NU(),r=t,i=NU();return n.checks.push({type:PU.DIRECTED_EDGE,source:r,target:i}),BU(e,t,n),e.edgeCount++,i}else{var a=NU(),o=t,s=NU();return a.checks.push({type:PU.NODE_SOURCE,source:o,target:s}),BU(e,t,a),e.edgeCount++,s}}},{name:`undirectedEdge`,separator:!0,regex:MU.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var n=NU(),r=t,i=NU();return n.checks.push({type:PU.UNDIRECTED_EDGE,nodes:[r,i]}),BU(e,t,n),e.edgeCount++,i}else{var a=NU(),o=t,s=NU();return a.checks.push({type:PU.NODE_NEIGHBOR,node:o,neighbor:s}),BU(e,t,a),s}}},{name:`child`,separator:!0,regex:MU.child,populate:function(e,t){if(e.currentSubject==null){var n=NU(),r=NU(),i=e[e.length-1];return n.checks.push({type:PU.CHILD,parent:i,child:r}),BU(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var a=NU(),o=e[e.length-1],s=NU(),c=NU(),l=NU(),u=NU();return a.checks.push({type:PU.COMPOUND_SPLIT,left:o,right:s,subject:c}),c.checks=t.checks,t.checks=[{type:PU.TRUE}],u.checks.push({type:PU.TRUE}),s.checks.push({type:PU.PARENT,parent:u,child:l}),BU(e,o,a),e.currentSubject=c,e.compoundCount++,l}else{var d=NU(),f=NU(),p=[{type:PU.PARENT,parent:d,child:f}];return d.checks=t.checks,t.checks=p,e.compoundCount++,f}}},{name:`descendant`,separator:!0,regex:MU.descendant,populate:function(e,t){if(e.currentSubject==null){var n=NU(),r=NU(),i=e[e.length-1];return n.checks.push({type:PU.DESCENDANT,ancestor:i,descendant:r}),BU(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var a=NU(),o=e[e.length-1],s=NU(),c=NU(),l=NU(),u=NU();return a.checks.push({type:PU.COMPOUND_SPLIT,left:o,right:s,subject:c}),c.checks=t.checks,t.checks=[{type:PU.TRUE}],u.checks.push({type:PU.TRUE}),s.checks.push({type:PU.ANCESTOR,ancestor:u,descendant:l}),BU(e,o,a),e.currentSubject=c,e.compoundCount++,l}else{var d=NU(),f=NU(),p=[{type:PU.ANCESTOR,ancestor:d,descendant:f}];return d.checks=t.checks,t.checks=p,e.compoundCount++,f}}},{name:`subject`,modifier:!0,regex:MU.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return rL("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=n==null?null:n.type;r===PU.DIRECTED_EDGE?n.type=PU.NODE_TARGET:r===PU.UNDIRECTED_EDGE&&(n.type=PU.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];VU.forEach(function(e){return e.regexObj=RegExp(`^`+e.regex)});var HU=function(e){for(var t,n,r,i=0;i<VU.length;i++){var a=VU[i],o=a.name,s=e.match(a.regexObj);if(s!=null){n=s,t=a,r=o;var c=s[0];e=e.substring(c.length);break}}return{expr:t,match:n,name:r,remaining:e}},UU=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},WU={parse:function(e){var t=this,n=t.inputText=e,r=t[0]=NU();for(t.length=1,n=UU(n);;){var i=HU(n);if(i.expr==null)return rL("The selector `"+e+"`is invalid"),!1;var a=i.match.slice(1),o=i.expr.populate(t,r,a);if(o===!1)return!1;if(o!=null&&(r=o),n=i.remaining,n.match(/^\s*$/))break}var s=t[t.length-1];t.currentSubject!=null&&(s.subject=t.currentSubject),s.edgeCount=t.edgeCount,s.compoundCount=t.compoundCount;for(var c=0;c<t.length;c++){var l=t[c];if(l.compoundCount>0&&l.edgeCount>0)return rL("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return rL("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;l.edgeCount===1&&rL("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(e){return e??``},t=function(t){return qP(t)?`"`+t+`"`:e(t)},n=function(e){return` `+e+` `},r=function(r,a){var o=r.type,s=r.value;switch(o){case PU.GROUP:var c=e(s);return c.substring(0,c.length-1);case PU.DATA_COMPARE:var l=r.field,u=r.operator;return`[`+l+n(e(u))+t(s)+`]`;case PU.DATA_BOOL:var d=r.operator,f=r.field;return`[`+e(d)+f+`]`;case PU.DATA_EXIST:return`[`+r.field+`]`;case PU.META_COMPARE:var p=r.operator;return`[[`+r.field+n(e(p))+t(s)+`]]`;case PU.STATE:return s;case PU.ID:return`#`+s;case PU.CLASS:return`.`+s;case PU.PARENT:case PU.CHILD:return i(r.parent,a)+n(`>`)+i(r.child,a);case PU.ANCESTOR:case PU.DESCENDANT:return i(r.ancestor,a)+` `+i(r.descendant,a);case PU.COMPOUND_SPLIT:var m=i(r.left,a),h=i(r.subject,a),g=i(r.right,a);return m+(m.length>0?` `:``)+h+g;case PU.TRUE:return``}},i=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&a===0?`$`:``)+r(i,t)},``)},a=``,o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=`, `)}return this.toStringCache=a,a}},GU=function(e,t,n){var r,i=qP(e),a=$(e),o=qP(n),s,c,l=!1,u=!1,d=!1;switch(t.indexOf(`!`)>=0&&(t=t.replace(`!`,``),u=!0),t.indexOf(`@`)>=0&&(t=t.replace(`@`,``),l=!0),(i||o||l)&&(s=!i&&!a?``:``+e,c=``+n),l&&(e=s=s.toLowerCase(),n=c=c.toLowerCase()),t){case`*=`:r=s.indexOf(c)>=0;break;case`$=`:r=s.indexOf(c,s.length-c.length)>=0;break;case`^=`:r=s.indexOf(c)===0;break;case`=`:r=e===n;break;case`>`:d=!0,r=e>n;break;case`>=`:d=!0,r=e>=n;break;case`<`:d=!0,r=e<n;break;case`<=`:d=!0,r=e<=n;break;default:r=!1;break}return u&&(e!=null||!d)&&(r=!r),r},KU=function(e,t){switch(t){case`?`:return!!e;case`!`:return!e;case`^`:return e===void 0}},qU=function(e){return e!==void 0},JU=function(e,t){return e.data(t)},YU=function(e,t){return e[t]()},XU=[],ZU=function(e,t){return e.checks.every(function(e){return XU[e.type](e,t)})};XU[PU.GROUP]=function(e,t){var n=e.value;return n===`*`||n===t.group()},XU[PU.STATE]=function(e,t){var n=e.value;return LU(n,t)},XU[PU.ID]=function(e,t){var n=e.value;return t.id()===n},XU[PU.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},XU[PU.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return GU(YU(t,n),r,i)},XU[PU.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return GU(JU(t,n),r,i)},XU[PU.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return KU(JU(t,n),r)},XU[PU.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,qU(JU(t,n))},XU[PU.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return ZU(n,i)&&ZU(r,a)||ZU(r,i)&&ZU(n,a)},XU[PU.NODE_NEIGHBOR]=function(e,t){return ZU(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&ZU(e.neighbor,t)})},XU[PU.DIRECTED_EDGE]=function(e,t){return ZU(e.source,t.source())&&ZU(e.target,t.target())},XU[PU.NODE_SOURCE]=function(e,t){return ZU(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&ZU(e.target,t)})},XU[PU.NODE_TARGET]=function(e,t){return ZU(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&ZU(e.source,t)})},XU[PU.CHILD]=function(e,t){return ZU(e.child,t)&&ZU(e.parent,t.parent())},XU[PU.PARENT]=function(e,t){return ZU(e.parent,t)&&t.children().some(function(t){return ZU(e.child,t)})},XU[PU.DESCENDANT]=function(e,t){return ZU(e.descendant,t)&&t.ancestors().some(function(t){return ZU(e.ancestor,t)})},XU[PU.ANCESTOR]=function(e,t){return ZU(e.ancestor,t)&&t.descendants().some(function(t){return ZU(e.descendant,t)})},XU[PU.COMPOUND_SPLIT]=function(e,t){return ZU(e.subject,t)&&ZU(e.left,t)&&ZU(e.right,t)},XU[PU.TRUE]=function(){return!0},XU[PU.COLLECTION]=function(e,t){return e.value.has(t)},XU[PU.FILTER]=function(e,t){var n=e.value;return n(t)};var QU={matches:function(e){for(var t=this,n=0;n<t.length;n++){var r=t[n];if(ZU(r,e))return!0}return!1},filter:function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===PU.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++){var r=t[n];if(ZU(r,e))return!0}return!1};return t.text()??(n=function(){return!0}),e.filter(n)}},$U=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||qP(e)&&e.match(/^\s*$/)||(eF(e)?this.addQuery({checks:[{type:PU.COLLECTION,value:e.collection()}]}):JP(e)?this.addQuery({checks:[{type:PU.FILTER,value:e}]}):qP(e)?this.parse(e)||(this.invalid=!0):tL(`A selector must be created from a string; found `))},eW=$U.prototype;[WU,QU].forEach(function(e){return EF(eW,e)}),eW.text=function(){return this.inputText},eW.size=function(){return this.length},eW.eq=function(e){return this[e]},eW.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},eW.addQuery=function(e){this[this.length++]=e},eW.selector=eW.toString;var tW={allAre:function(e){var t=new $U(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new $U(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length?t===1?this[0]===e[0]:this.every(function(t){return e.hasElementWithId(t.id())}):!1},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(e){return t.hasElementWithId(e.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(e){return t.hasElementWithId(e.id())})}};tW.allAreNeighbours=tW.allAreNeighbors,tW.has=tW.contains,tW.equal=tW.equals=tW.same;var nW=function(e,t){return function(n,r,i,a){var o=n,s=this,c;if(o==null?c=``:eF(o)&&o.length===1&&(c=o.id()),s.length===1&&c){var l=s[0]._private,u=l.traversalCache=l.traversalCache||{},d=u[t]=u[t]||[],f=VI(c);return d[f]||(d[f]=e.call(s,n,r,i,a))}else return e.call(s,n,r,i,a)}},rW={parent:function(e){var t=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&t.push(i)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t||=r,t=t.intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(e){return e.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(e){return e.isChild()}).filter(e)},children:nW(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);return this.spawn(t,!0).filter(e)},`children`),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var t=[];function n(e){for(var r=0;r<e.length;r++){var i=e[r];t.push(i),i.children().nonempty()&&n(i.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function iW(e,t,n,r){for(var i=[],a=new yL,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var c=e[s];n?i.push(c):o&&r(i,a,c)}for(;i.length>0;){var l=i.shift();t(l),a.add(l.id()),o&&r(i,a,l)}return e}function aW(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}rW.forEachDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return iW(this,e,t,aW)};function oW(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}rW.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return iW(this,e,t,oW)};function sW(e,t,n){oW(e,t,n),aW(e,t,n)}rW.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return iW(this,e,t,sW)},rW.ancestors=rW.parents;var cW=lW={data:kU.data({field:`data`,bindingEvent:`data`,allowBinding:!0,allowSetting:!0,settingEvent:`data`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:kU.removeData({field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:kU.data({field:`scratch`,bindingEvent:`scratch`,allowBinding:!0,allowSetting:!0,settingEvent:`scratch`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeScratch:kU.removeData({field:`scratch`,event:`scratch`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0}),rscratch:kU.data({field:`rscratch`,allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:kU.removeData({field:`rscratch`,triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},lW;cW.attr=cW.data,cW.removeAttr=cW.removeData;var uW=lW,dW={};function fW(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0)if(n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;o<a.length;o++){var s=a[o];!t&&s.isLoop()||(r+=e(i,s))}return r}else return}}EF(dW,{degree:fW(function(e,t){return t.source().same(t.target())?2:1}),indegree:fW(function(e,t){return+!!t.target().same(e)}),outdegree:fW(function(e,t){return+!!t.source().same(e)})});function pW(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);o!==void 0&&(r===void 0||t(o,r))&&(r=o)}return r}}EF(dW,{minDegree:pW(`degree`,function(e,t){return e<t}),maxDegree:pW(`degree`,function(e,t){return e>t}),minIndegree:pW(`indegree`,function(e,t){return e<t}),maxIndegree:pW(`indegree`,function(e,t){return e>t}),minOutdegree:pW(`outdegree`,function(e,t){return e<t}),maxOutdegree:pW(`outdegree`,function(e,t){return e>t})}),EF(dW,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var mW,hW,gW=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:t.x==null?0:t.x-a.x,y:t.y==null?0:t.y-a.y};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,n),i.dirtyBoundingBoxCache()}}},_W={field:`position`,bindingEvent:`position`,allowBinding:!0,allowSetting:!0,settingEvent:`position`,settingTriggersEvent:!0,triggerFnName:`emitAndNotify`,allowGetting:!0,validKeys:[`x`,`y`],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){gW(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};mW=hW={position:kU.data(_W),silentPosition:kU.data(EF({},_W,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){gW(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(XP(e))t?this.silentPosition(e):this.position(e);else if(JP(e)){var n=e,r=this.cy();r.startBatch();for(var i=0;i<this.length;i++){var a=this[i],o=void 0;(o=n(a,i))&&(t?a.silentPosition(o):a.position(o))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(XP(e)?(r={x:$(e.x)?e.x:0,y:$(e.y)?e.y:0},n=t):qP(e)&&$(t)&&(r={x:0,y:0},r[e]=t),r!=null){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),c={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(c):o.position(c)}}i.endBatch()}return this},silentShift:function(e,t){return XP(e)?this.shift(e,!0):qP(e)&&$(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=XP(e)?e:void 0,s=o!==void 0||t!==void 0&&qP(e);if(n&&n.isNode())if(s)for(var c=0;c<this.length;c++){var l=this[c];t===void 0?o!==void 0&&l.position(KL(o,i,a)):l.position(e,(t-a[e])/i)}else return o=GL(n.position(),i,a),e===void 0?o:o[e];else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=XP(e)?e:void 0,a=i!==void 0||t!==void 0&&qP(e),o=r.hasCompoundNodes();if(n&&n.isNode())if(a)for(var s=0;s<this.length;s++){var c=this[s],l=o?c.parent():null,u=l&&l.length>0,d=u;u&&(l=l[0]);var f=d?l.position():{x:0,y:0};t===void 0?i!==void 0&&c.position({x:i.x+f.x,y:i.y+f.y}):c.position(e,t+f[e])}else{var p=n.position(),m=o?n.parent():null,h=m&&m.length>0,g=h;h&&(m=m[0]);var _=g?m.position():{x:0,y:0};return i={x:p.x-_.x,y:p.y-_.y},e===void 0?i:i[e]}else if(!a)return;return this}},mW.modelPosition=mW.point=mW.position,mW.modelPositions=mW.points=mW.positions,mW.renderedPoint=mW.renderedPosition,mW.relativePoint=mW.relativePosition;var vW=hW,yW=bW={},bW;bW.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,c=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:c,w:o-a,h:c-s}},bW.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()||this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify(`bounds`)}}),this},bW.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;function n(e){if(!e.isParent())return;var t=e._private,n=e.children(),r=e.pstyle(`compound-sizing-wrt-labels`).value===`include`,i={width:{val:e.pstyle(`min-width`).pfValue,left:e.pstyle(`min-width-bias-left`),right:e.pstyle(`min-width-bias-right`)},height:{val:e.pstyle(`min-height`).pfValue,top:e.pstyle(`min-height-bias-top`),bottom:e.pstyle(`min-height-bias-bottom`)}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;(a.w===0||a.h===0)&&(a={w:e.pstyle(`width`).pfValue,h:e.pstyle(`height`).pfValue},a.x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);function s(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}function c(e,t,n,r){if(n.units===`%`)switch(r){case`width`:return e>0?n.pfValue*e:0;case`height`:return t>0?n.pfValue*t:0;case`average`:return e>0&&t>0?n.pfValue*(e+t)/2:0;case`min`:return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case`max`:return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}else if(n.units===`px`)return n.pfValue;else return 0}var l=i.width.left.value;i.width.left.units===`px`&&i.width.val>0&&(l=l*100/i.width.val);var u=i.width.right.value;i.width.right.units===`px`&&i.width.val>0&&(u=u*100/i.width.val);var d=i.height.top.value;i.height.top.units===`px`&&i.height.val>0&&(d=d*100/i.height.val);var f=i.height.bottom.value;i.height.bottom.units===`px`&&i.height.val>0&&(f=f*100/i.height.val);var p=s(i.width.val-a.w,l,u),m=p.biasDiff,h=p.biasComplementDiff,g=s(i.height.val-a.h,d,f),_=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=c(a.w,a.h,e.pstyle(`padding`),e.pstyle(`padding-relative-to`).value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-m+a.x1+a.x2+h)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-_+a.y1+a.y2+v)/2}for(var r=0;r<this.length;r++){var i=this[r],a=i._private;(!a.compoundBoundsClean||e)&&(n(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var xW=function(e){return e===1/0||e===-1/0?0:e},SW=function(e,t,n,r,i){r-t===0||i-n===0||t==null||n==null||r==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},CW=function(e,t){return t==null?e:SW(e,t.x1,t.y1,t.x2,t.y2)},wW=function(e,t,n){return mL(e,t,n)},TW=function(e,t,n){if(!t.cy().headless()){var r=t._private,i=r.rstyle,a=i.arrowWidth/2,o=t.pstyle(n+`-arrow-shape`).value,s,c;if(o!==`none`){n===`source`?(s=i.srcX,c=i.srcY):n===`target`?(s=i.tgtX,c=i.tgtY):(s=i.midX,c=i.midY);var l=r.arrowBounds=r.arrowBounds||{},u=l[n]=l[n]||{};u.x1=s-a,u.y1=c-a,u.x2=s+a,u.y2=c+a,u.w=u.x2-u.x1,u.h=u.y2-u.y1,mR(u,1),SW(e,u.x1,u.y1,u.x2,u.y2)}}},EW=function(e,t,n){if(!t.cy().headless()){var r=n?n+`-`:``,i=t._private,a=i.rstyle;if(t.pstyle(r+`label`).strValue){var o=t.pstyle(`text-halign`),s=t.pstyle(`text-valign`),c=wW(a,`labelWidth`,n),l=wW(a,`labelHeight`,n),u=wW(a,`labelX`,n),d=wW(a,`labelY`,n),f=t.pstyle(r+`text-margin-x`).pfValue,p=t.pstyle(r+`text-margin-y`).pfValue,m=t.isEdge(),h=t.pstyle(r+`text-rotation`),g=t.pstyle(`text-outline-width`).pfValue,_=t.pstyle(`text-border-width`).pfValue/2,v=t.pstyle(`text-background-padding`).pfValue,y=2,b=l,x=c,S=x/2,C=b/2,w,T,E,D;if(m)w=u-S,T=u+S,E=d-C,D=d+C;else{switch(o.value){case`left`:w=u-x,T=u;break;case`center`:w=u-S,T=u+S;break;case`right`:w=u,T=u+x;break}switch(s.value){case`top`:E=d-b,D=d;break;case`center`:E=d-C,D=d+C;break;case`bottom`:E=d,D=d+b;break}}var O=f-Math.max(g,_)-v-y,k=f+Math.max(g,_)+v+y,A=p-Math.max(g,_)-v-y,j=p+Math.max(g,_)+v+y;w+=O,T+=k,E+=A,D+=j;var M=n||`main`,N=i.labelBounds,P=N[M]=N[M]||{};P.x1=w,P.y1=E,P.x2=T,P.y2=D,P.w=T-w,P.h=D-E,P.leftPad=O,P.rightPad=k,P.topPad=A,P.botPad=j;var F=m&&h.strValue===`autorotate`,I=h.pfValue!=null&&h.pfValue!==0;if(F||I){var L=F?wW(i.rstyle,`labelAngle`,n):h.pfValue,R=Math.cos(L),ee=Math.sin(L),z=(w+T)/2,B=(E+D)/2;if(!m){switch(o.value){case`left`:z=T;break;case`right`:z=w;break}switch(s.value){case`top`:B=D;break;case`bottom`:B=E;break}}var V=function(e,t){return e-=z,t-=B,{x:e*R-t*ee+z,y:e*ee+t*R+B}},H=V(w,E),te=V(w,D),ne=V(T,E),U=V(T,D);w=Math.min(H.x,te.x,ne.x,U.x),T=Math.max(H.x,te.x,ne.x,U.x),E=Math.min(H.y,te.y,ne.y,U.y),D=Math.max(H.y,te.y,ne.y,U.y)}var re=M+`Rot`,ie=N[re]=N[re]||{};ie.x1=w,ie.y1=E,ie.x2=T,ie.y2=D,ie.w=T-w,ie.h=D-E,SW(e,w,E,T,D),SW(i.labelBounds.all,w,E,T,D)}return e}},DW=function(e,t){if(!t.cy().headless()){var n=t.pstyle(`outline-opacity`).value,r=t.pstyle(`outline-width`).value+t.pstyle(`outline-offset`).value;OW(e,t,n,r,`outside`,r/2)}},OW=function(e,t,n,r,i,a){if(!(n===0||r<=0||i===`inside`)){var o=t.cy().renderer(),s=o.nodeShapes[o.getNodeShape(t)];if(s){var c=t.position(),l=c.x,u=c.y,d=t.width(),f=t.height();s.hasMiterBounds?(i===`center`&&(r/=2),CW(e,s.miterBounds(l,u,d,f,r))):a!=null&&a>0&&hR(e,[a,a,a,a])}}},kW=function(e,t){if(!t.cy().headless()){var n=t.pstyle(`border-opacity`).value,r=t.pstyle(`border-width`).pfValue,i=t.pstyle(`border-position`).value;OW(e,t,n,r,i)}},AW=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a=lR(),o=e._private,s=e.isNode(),c=e.isEdge(),l,u,d,f,p,m,h=o.rstyle,g=s&&r?e.pstyle(`bounds-expansion`).pfValue:[0],_=function(e){return e.pstyle(`display`).value!==`none`},v=!r||_(e)&&(!c||_(e.source())&&_(e.target()));if(v){var y=0,b=0;r&&t.includeOverlays&&(y=e.pstyle(`overlay-opacity`).value,y!==0&&(b=e.pstyle(`overlay-padding`).value));var x=0,S=0;r&&t.includeUnderlays&&(x=e.pstyle(`underlay-opacity`).value,x!==0&&(S=e.pstyle(`underlay-padding`).value));var C=Math.max(b,S),w=0,T=0;if(r&&(w=e.pstyle(`width`).pfValue,T=w/2),s&&t.includeNodes){var E=e.position();p=E.x,m=E.y;var D=e.outerWidth()/2,O=e.outerHeight()/2;l=p-D,u=p+D,d=m-O,f=m+O,SW(a,l,d,u,f),r&&DW(a,e),r&&t.includeOutlines&&!i&&DW(a,e),r&&kW(a,e)}else if(c&&t.includeEdges)if(r&&!i){var k=e.pstyle(`curve-style`).strValue;if(l=Math.min(h.srcX,h.midX,h.tgtX),u=Math.max(h.srcX,h.midX,h.tgtX),d=Math.min(h.srcY,h.midY,h.tgtY),f=Math.max(h.srcY,h.midY,h.tgtY),l-=T,u+=T,d-=T,f+=T,SW(a,l,d,u,f),k===`haystack`){var A=h.haystackPts;if(A&&A.length===2){if(l=A[0].x,d=A[0].y,u=A[1].x,f=A[1].y,l>u){var j=l;l=u,u=j}if(d>f){var M=d;d=f,f=M}SW(a,l-T,d-T,u+T,f+T)}}else if(k===`bezier`||k===`unbundled-bezier`||gF(k,`segments`)||gF(k,`taxi`)){var N;switch(k){case`bezier`:case`unbundled-bezier`:N=h.bezierPts;break;case`segments`:case`taxi`:case`round-segments`:case`round-taxi`:N=h.linePts;break}if(N!=null)for(var P=0;P<N.length;P++){var F=N[P];l=F.x-T,u=F.x+T,d=F.y-T,f=F.y+T,SW(a,l,d,u,f)}}}else{var I=e.source().position(),L=e.target().position();if(l=I.x,u=L.x,d=I.y,f=L.y,l>u){var R=l;l=u,u=R}if(d>f){var ee=d;d=f,f=ee}l-=T,u+=T,d-=T,f+=T,SW(a,l,d,u,f)}if(r&&t.includeEdges&&c&&(TW(a,e,`mid-source`),TW(a,e,`mid-target`),TW(a,e,`source`),TW(a,e,`target`)),r&&e.pstyle(`ghost`).value===`yes`){var z=e.pstyle(`ghost-offset-x`).pfValue,B=e.pstyle(`ghost-offset-y`).pfValue;SW(a,a.x1+z,a.y1+B,a.x2+z,a.y2+B)}var V=o.bodyBounds=o.bodyBounds||{};gR(V,a),hR(V,g),mR(V,1),r&&(l=a.x1,u=a.x2,d=a.y1,f=a.y2,SW(a,l-C,d-C,u+C,f+C));var H=o.overlayBounds=o.overlayBounds||{};gR(H,a),hR(H,g),mR(H,1);var te=o.labelBounds=o.labelBounds||{};te.all==null?te.all=lR():dR(te.all),r&&t.includeLabels&&(t.includeMainLabels&&EW(a,e,null),c&&(t.includeSourceLabels&&EW(a,e,`source`),t.includeTargetLabels&&EW(a,e,`target`)))}return a.x1=xW(a.x1),a.y1=xW(a.y1),a.x2=xW(a.x2),a.y2=xW(a.y2),a.w=xW(a.x2-a.x1),a.h=xW(a.y2-a.y1),a.w>0&&a.h>0&&v&&(hR(a,g),mR(a,1)),a},jW=function(e){var t=0,n=function(e){return+!!e<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays),r+=n(e.includeOutlines),r},MW=function(e){var t=function(e){return Math.round(e)};if(e.isEdge()){var n=e.source().position(),r=e.target().position();return BI([t(n.x),t(n.y),t(r.x),t(r.y)])}else{var i=e.position();return BI([t(i.x),t(i.y)])}},NW=function(e,t){var n=e._private,r,i=e.isEdge(),a=(t==null?FW:jW(t))===FW;if(n.bbCache==null?(r=AW(e,PW),n.bbCache=r,n.bbCachePosKey=MW(e)):r=n.bbCache,!a){var o=e.isNode();r=lR(),(t.includeNodes&&o||t.includeEdges&&!o)&&(t.includeOverlays?CW(r,n.overlayBounds):CW(r,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?CW(r,n.labelBounds.all):(t.includeMainLabels&&CW(r,n.labelBounds.mainRot),t.includeSourceLabels&&CW(r,n.labelBounds.sourceRot),t.includeTargetLabels&&CW(r,n.labelBounds.targetRot))),r.w=r.x2-r.x1,r.h=r.y2-r.y1}return r},PW={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},FW=jW(PW),IW=uL(PW);bW.boundingBox=function(e){var t,n=e===void 0||e.useCache===void 0||e.useCache===!0,r=dF(function(e){var t=e._private;return t.bbCache==null||t.styleDirty||t.bbCachePosKey!==MW(e)},function(e){return e.id()});if(n&&this.length===1&&!r(this[0]))e=e===void 0?PW:IW(e),t=NW(this[0],e);else{t=lR(),e||=PW;var i=IW(e),a=this,o=a.cy().styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var s=0;s<a.length;s++){var c=a[s];r(c)&&c.dirtyBoundingBoxCache(),CW(t,NW(c,i))}}return t.x1=xW(t.x1),t.y1=xW(t.y1),t.x2=xW(t.x2),t.y2=xW(t.y2),t.w=xW(t.x2-t.x1),t.h=xW(t.y2-t.y1),t},bW.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds[`mid-source`]=null,t.arrowBounds[`mid-target`]=null}return this.emitAndNotify(`bounds`),this},bW.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),i=n.collection();if(r&&(i=t.filter(function(e){return e.isParent()}),t=t.not(i)),XP(e)){var a=e;e=function(){return a}}var o=function(t,n){return t._private.bbAtOldPos=e(t,n)},s=function(e){return e._private.bbAtOldPos};n.startBatch(),t.forEach(o).silentPositions(e),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var c=uR(this.boundingBox({useCache:!1}));return t.silentPositions(s),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),n.endBatch(),c},yW.boundingbox=yW.bb=yW.boundingBox,yW.renderedBoundingbox=yW.renderedBoundingBox;var LW=bW,RW=zW={},zW,BW=function(e){e.uppercaseName=hF(e.name),e.autoName=`auto`+e.uppercaseName,e.labelName=`label`+e.uppercaseName,e.outerName=`outer`+e.uppercaseName,e.uppercaseOuterName=hF(e.outerName),RW[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t)if(r){if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);switch(i.strValue){case`label`:return t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return i.pfValue}}else return 1},RW[`outer`+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)if(n){var r=t[e.name](),i=t.pstyle(`border-position`).value,a=i===`center`?t.pstyle(`border-width`).pfValue:i===`outside`?2*t.pstyle(`border-width`).pfValue:0,o=2*t.padding();return r+a+o}else return 1},RW[`rendered`+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},RW[`rendered`+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};BW({name:`width`}),BW({name:`height`}),zW.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),t.autoPadding===void 0?e.pstyle(`padding`).pfValue:t.autoPadding):e.pstyle(`padding`).pfValue},zW.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},zW.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var VW=zW,HW=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},UW=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return GL(t(e),n.zoom(),n.pan())}},WW=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map(function(e){return GL(e,i,r)})}},GW={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},KW=function(e){return`rendered`+e[0].toUpperCase()+e.substr(1)},qW=EF({},vW,LW,VW,Object.keys(GW).reduce(function(e,t){var n=GW[t],r=KW(t);return e[t]=function(){return HW(this,n.get)},n.mult?e[r]=function(){return WW(this,n.get)}:e[r]=function(){return UW(this,n.get)},e},{})),JW=function(e,t){this.recycle(e,t)};function YW(){return!1}function XW(){return!0}JW.prototype={instanceString:function(){return`event`},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=YW,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?XW:YW):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type==null?this.type:t.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=XW;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=XW;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=XW,this.stopPropagation()},isDefaultPrevented:YW,isPropagationStopped:YW,isImmediatePropagationStopped:YW};var ZW=/^([^.]+)(\.(?:[^.]+))?$/,QW=`.*`,$W={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},eG=Object.keys($W),tG={};function nG(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tG,t=arguments.length>1?arguments[1]:void 0,n=0;n<eG.length;n++){var r=eG[n];this[r]=e[r]||$W[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var rG=nG.prototype,iG=function(e,t,n,r,i,a,o){JP(r)&&(i=r,r=null),o&&(a=a==null?o:EF({},a,o));for(var s=YP(n)?n:n.split(/\s+/),c=0;c<s.length;c++){var l=s[c];if(!oF(l)){var u=l.match(ZW);if(u){var d=u[1];if(t(e,l,d,u[2]?u[2]:null,r,i,a)===!1)break}}}},aG=function(e,t){return e.addEventFields(e.context,t),new JW(t.type,t)},oG=function(e,t,n){if(aF(n)){t(e,n);return}else if(XP(n)){t(e,aG(e,n));return}for(var r=YP(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!oF(a)){var o=a.match(ZW);if(o){var s=o[1];t(e,aG(e,{type:s,namespace:o[2]?o[2]:null,target:e.context}))}}}};rG.on=rG.addListener=function(e,t,n,r,i){return iG(this,function(e,t,n,r,i,a,o){JP(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})},e,t,n,r,i),this},rG.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},rG.removeListener=rG.off=function(e,t,n,r){var i=this;this.emitting!==0&&(this.listeners=oL(this.listeners));for(var a=this.listeners,o=function(o){var s=a[o];iG(i,function(t,n,r,i,c,l){if((s.type===r||e===`*`)&&(!i&&s.namespace!==`.*`||s.namespace===i)&&(!c||t.qualifierCompare(s.qualifier,c))&&(!l||s.callback===l))return a.splice(o,1),!1},e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},rG.removeAllListeners=function(){return this.removeListener(`*`)},rG.emit=rG.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,YP(t)||(t=[t]),oG(this,function(e,a){n!=null&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(){var n=r[s];if(n.type===a.type&&(!n.namespace||n.namespace===a.namespace||n.namespace===QW)&&e.eventMatches(e.context,n,a)){var i=[a];t!=null&&pL(i,t),e.beforeEmit(e.context,n,a),n.conf&&n.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==n}));var o=e.callbackContext(e.context,n,a),c=n.callback.apply(o,i);e.afterEmit(e.context,n,a),c===!1&&(a.stopPropagation(),a.preventDefault())}},s=0;s<i;s++)o();e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)},e),this.emitting--,this};var sG={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null?!0:e!==n.target&&tF(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier==null?e:n.target},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},cG=function(e){return qP(e)?new $U(e):e},lG={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||=new nG(sG,t)}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=cG(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=cG(t),i=0;i<this.length;i++)this[i].emitter().removeListener(e,r,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var r=cG(t),i=0;i<this.length;i++)this[i].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=cG(t),i=0;i<this.length;i++)this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};kU.eventAliasesOn(lG);var uG={nodes:function(e){return this.filter(function(e){return e.isNode()}).filter(e)},edges:function(e){return this.filter(function(e){return e.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(qP(e)||eF(e))return new $U(e).filter(this);if(JP(e)){for(var n=this.spawn(),r=this,i=0;i<r.length;i++){var a=r[i];(t?e.apply(t,[a,i,r]):e(a,i,r))&&n.push(a)}return n}return this.spawn()},not:function(e){if(e){qP(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t}else return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(qP(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=this,i=e,a=this.length<e.length,o=a?r:i,s=a?i:r,c=0;c<o.length;c++){var l=o[c];s.has(l)&&n.push(l)}return n},xor:function(e){var t=this._private.cy;qP(e)&&(e=t.$(e));var n=this.spawn(),r=this,i=e,a=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return a(r,i),a(i,r),n},diff:function(e){var t=this._private.cy;qP(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),i=this.spawn(),a=this,o=e,s=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):n.push(a)}};return s(a,o,n),s(o,a,r),{left:n,right:r,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(qP(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i];this.has(a)||r.push(a)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&qP(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var c=this.length++;this[c]=o,i.set(s,{ele:o,index:c})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&qP(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,i=0;i<r.length;i++){var a=r[i],o=t?e.apply(t,[a,i,r]):e(a,i,r);n.push(o)}return n},reduce:function(e,t){for(var n=t,r=this,i=0;i<r.length;i++)n=e(n,r[i],i,r);return n},max:function(e,t){for(var n=-1/0,r,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s>n&&(n=s,r=o)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s<n&&(n=s,r=o)}return{value:n,ele:r}}},dG=uG;dG.u=dG[`|`]=dG[`+`]=dG.union=dG.or=dG.add,dG[`\\`]=dG[`!`]=dG[`-`]=dG.difference=dG.relativeComplement=dG.subtract=dG.not,dG.n=dG[`&`]=dG[`.`]=dG.and=dG.intersection=dG.intersect,dG[`^`]=dG[`(+)`]=dG[`(-)`]=dG.symmetricDifference=dG.symdiff=dG.xor,dG.fnFilter=dG.filterFn=dG.stdFilter=dG.filter,dG.complement=dG.abscomp=dG.absoluteComplement;var fG={isNode:function(){return this.group()===`nodes`},isEdge:function(){return this.group()===`edges`},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},pG=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle(`z-compound-depth`);return t.value===`auto`?n?e.zDepth():0:t.value===`bottom`?-1:t.value===`top`?XI:0}var i=r(e)-r(t);if(i!==0)return i;function a(e){return e.pstyle(`z-index-compare`).value===`auto`?+!!e.isNode():0}var o=a(e)-a(t);if(o!==0)return o;var s=e.pstyle(`z-index`).value-t.pstyle(`z-index`).value;return s===0?e.poolIndex()-t.poolIndex():s},mG={forEach:function(e,t){if(JP(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if((t?e.apply(t,[i,r,this]):e(i,r,this))===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;t??=r,e??=0,e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!JP(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(pG)},zDepth:function(){var e=this[0];if(e){var t=e._private;if(t.group===`nodes`){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:XI-1}else{var r=t.source,i=t.target,a=r.zDepth(),o=i.zDepth();return Math.max(a,o,0)}}}};mG.each=mG.forEach,(function(){var e=`undefined`;(typeof Symbol>`u`?`undefined`:RP(Symbol))!=e&&RP(Symbol.iterator)!=e&&(mG[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return kP({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})})})();var hG=uL({nodeDimensionsIncludeLabels:!1}),gG={layoutDimensions:function(e){e=hG(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter(function(e){return!e.isParent()}),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=dF(n,o);e.emit({type:`layoutstart`,layout:e}),e.animations=[];var c=function(e,t,n){var r={x:t.x1+t.w/2,y:t.y1+t.h/2},i={x:(n.x-r.x)*e,y:(n.y-r.y)*e};return{x:r.x+i.x,y:r.y+i.y}},l=t.spacingFactor&&t.spacingFactor!==1,u=function(){if(!l)return null;for(var e=lR(),t=0;t<r.length;t++){var n=r[t],i=s(n,t);pR(e,i.x,i.y)}return e}(),d=dF(function(e,n){var r=s(e,n);return l&&(r=c(Math.abs(t.spacingFactor),u,r)),t.transform!=null&&(r=t.transform(e,r)),r},o);if(t.animate){for(var f=0;f<r.length;f++){var p=r[f],m=d(p,f);if(t.animateFilter==null||t.animateFilter(p,f)){var h=p.animation({position:m,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(h)}else p.position(m)}if(t.fit){var g=i.animation({fit:{boundingBox:a.boundingBoxAt(d),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else if(t.zoom!==void 0&&t.pan!==void 0){var _=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(_)}e.animations.forEach(function(e){return e.play()}),e.one(`layoutready`,t.ready),e.emit({type:`layoutready`,layout:e}),kB.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one(`layoutstop`,t.stop),e.emit({type:`layoutstop`,layout:e})})}else r.positions(d),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one(`layoutready`,t.ready),e.emit({type:`layoutready`,layout:e}),e.one(`layoutstop`,t.stop),e.emit({type:`layoutstop`,layout:e});return this},layout:function(e){return this.cy().makeLayout(EF({},e,{eles:this}))}};gG.createLayout=gG.makeLayout=gG.layout;function _G(e,t,n){var r=n._private,i=r.styleCache=r.styleCache||[],a;return(a=i[e])??(a=i[e]=t(n)),a}function vG(e,t){return e=VI(e),function(n){return _G(e,t,n)}}function yG(e,t){e=VI(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return _G(e,n,t)}}var bG={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(e){return e._private.styleCache=null};if(e.hasCompoundNodes()){var n=this.spawnSelf().merge(this.descendants()).merge(this.parents());n.merge(n.connectedEdges()),n.forEach(t)}else this.forEach(function(e){t(e),e.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=t.hasCompoundNodes(),r=this;e=!!(e||e===void 0),n&&(r=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=r;return e?i.emitAndNotify(`style`):i.emit(`style`),r.forEach(function(e){return e._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],r=n.cy();if(r.styleEnabled()&&n)return n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n)),n._private.style[e]??(t?r.style().getDefaultProperty(e):null)},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue===void 0?n.value:n.pfValue}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,i=n.style();if(XP(e)){var a=e;i.applyBypass(this,a,r),this.emitAndNotify(`style`)}else if(qP(e))if(t===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,t,r),this.emitAndNotify(`style`);else if(e===void 0){var s=this[0];return s?i.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),i=this;if(e===void 0)for(var a=0;a<i.length;a++){var o=i[a];r.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var s=0;s<i.length;s++){var c=i[s];r.removeBypasses(c,e,n)}}return this.emitAndNotify(`style`),this},show:function(){return this.css(`display`,`element`),this},hide:function(){return this.css(`display`,`none`),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle(`opacity`).value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++)i=a[o].pstyle(`opacity`).value*i;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();if(e)return t?e.effectiveOpacity()===0:e.pstyle(`opacity`).value===0},backgrounding:function(){return this.cy().styleEnabled()?!!this[0]._private.backgrounding:!1}};function xG(e,t){var n=e._private.data.parent?e.parents():null;if(n)for(var r=0;r<n.length;r++){var i=n[r];if(!t(i))return!1}return!0}function SG(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||xG(i,r);var s=o.source,c=o.target;return n(s)&&(!a||xG(s,n))&&(s===c||n(c)&&(!a||xG(c,n)))}}}var CG=vG(`eleTakesUpSpace`,function(e){return e.pstyle(`display`).value===`element`&&e.width()!==0&&(e.isNode()?e.height()!==0:!0)});bG.takesUpSpace=yG(`takesUpSpace`,SG({ok:CG})),bG.interactive=yG(`interactive`,SG({ok:vG(`eleInteractive`,function(e){return e.pstyle(`events`).value===`yes`&&e.pstyle(`visibility`).value===`visible`&&CG(e)}),parentOk:vG(`parentInteractive`,function(e){return e.pstyle(`visibility`).value===`visible`&&CG(e)}),edgeOkViaNode:CG})),bG.noninteractive=function(){var e=this[0];if(e)return!e.interactive()},bG.visible=yG(`visible`,SG({ok:vG(`eleVisible`,function(e){return e.pstyle(`visibility`).value===`visible`&&e.pstyle(`opacity`).pfValue!==0&&CG(e)}),edgeOkViaNode:CG})),bG.hidden=function(){var e=this[0];if(e)return!e.visible()},bG.isBundledBezier=yG(`isBundledBezier`,function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle(`curve-style`).value===`bezier`&&this.takesUpSpace():!1}),bG.bypass=bG.css=bG.style,bG.renderedCss=bG.renderedStyle,bG.removeBypass=bG.removeCss=bG.removeStyle,bG.pstyle=bG.parsedStyle;var wG={};function TG(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(t.length===1&&JP(t[0])){var a=t[0];this.on(e.event,a)}else if(t.length===0||t.length===1&&YP(t[0])){for(var o=t.length===1?t[0]:null,s=0;s<this.length;s++){var c=this[s],l=!e.ableField||c._private[e.ableField],u=c._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(c);if(d!==void 0&&(l=d,!d))return this}l&&(c._private[e.field]=e.value,u&&n.push(c))}var f=this.spawn(n);f.updateStyle(),f.emit(e.event),o&&f.emit(o)}return this}}function EG(e){wG[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},wG[e.on]=TG({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),wG[e.off]=TG({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}EG({field:`locked`,overrideField:function(e){return e.cy().autolock()?!0:void 0},on:`lock`,off:`unlock`}),EG({field:`grabbable`,overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:`grabify`,off:`ungrabify`}),EG({field:`selected`,ableField:`selectable`,overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:`select`,off:`unselect`}),EG({field:`selectable`,overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:`selectify`,off:`unselectify`}),wG.deselect=wG.unselect,wG.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},EG({field:`active`,on:`activate`,off:`unactivate`}),EG({field:`pannable`,on:`panify`,off:`unpanify`}),wG.inactive=function(){var e=this[0];if(e)return!e._private.active};var DG={},OG=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode()){for(var o=!1,s=a.connectedEdges(),c=0;c<s.length;c++){var l=s[c],u=l.source(),d=l.target();if(e.noIncomingEdges&&d===a&&u!==a||e.noOutgoingEdges&&u===a&&d!==a){o=!0;break}}o||r.push(a)}}return this.spawn(r,!0).filter(t)}},kG=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode())for(var o=a.connectedEdges(),s=0;s<o.length;s++){var c=o[s],l=c.source(),u=c.target();e.outgoing&&l===a?(r.push(c),r.push(u)):e.incoming&&u===a&&(r.push(c),r.push(l))}}return this.spawn(r,!0).filter(t)}},AG=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(a.length===0)break;for(var o=!1,s=0;s<a.length;s++){var c=a[s],l=c.id();i[l]||(i[l]=!0,r.push(c),o=!0)}if(!o)break;n=a}return this.spawn(r,!0).filter(t)}};DG.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},EF(DG,{roots:OG({noIncomingEdges:!0}),leaves:OG({noOutgoingEdges:!0}),outgoers:nW(kG({outgoing:!0}),`outgoers`),successors:AG({outgoing:!0}),incomers:nW(kG({incoming:!0}),`incomers`),predecessors:AG({})}),EF(DG,{neighborhood:nW(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],c=s.source(),l=s.target(),u=i===c?l:c;u.length>0&&t.push(u[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},`neighborhood`),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),DG.neighbourhood=DG.neighborhood,DG.closedNeighbourhood=DG.closedNeighborhood,DG.openNeighbourhood=DG.openNeighborhood,EF(DG,{source:nW(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},`source`),target:nW(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},`target`),sources:jG({attr:`source`}),targets:jG({attr:`target`})});function jG(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}EF(DG,{edgesWith:nW(MG(),`edgesWith`),edgesTo:nW(MG({thisIsSrc:!0}),`edgesTo`)});function MG(e){return function(t){var n=[],r=this._private.cy,i=e||{};qP(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var c=o[s],l=c._private.data,u=this.hasElementWithId(l.source)&&t.hasElementWithId(l.target),d=t.hasElementWithId(l.source)&&this.hasElementWithId(l.target);(u||d)&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!u||i.thisIsTgt&&!d)||n.push(c))}return this.spawn(n,!0)}}EF(DG,{connectedEdges:nW(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];if(i.isNode())for(var a=i._private.edges,o=0;o<a.length;o++){var s=a[o];t.push(s)}}return this.spawn(t,!0).filter(e)},`connectedEdges`),connectedNodes:nW(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];i.isEdge()&&(t.push(i.source()[0]),t.push(i.target()[0]))}return this.spawn(t,!0).filter(e)},`connectedNodes`),parallelEdges:nW(NG(),`parallelEdges`),codirectedEdges:nW(NG({codirected:!0}),`codirectedEdges`)});function NG(e){return e=EF({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,c=s._private.data.id,l=o.data.target,u=s._private.edges,d=0;d<u.length;d++){var f=u[d],p=f._private.data,m=p.target,h=p.source,g=m===l&&h===c,_=c===m&&l===h;(i.codirected&&g||!i.codirected&&(g||_))&&n.push(f)}return this.spawn(n,!0).filter(t)}}EF(DG,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=e==null?t.nodes():e.nodes(),a=[];e!=null&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();var s=function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach(function(n){n.connectedEdges().forEach(function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)})})};do s();while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),DG.componentsOf=DG.components;var PG=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){tL(`A collection must have a reference to the core`);return}var i=new gL,a=!1;if(!t)t=[];else if(t.length>0&&XP(t[0])&&!tF(t[0])){a=!0;for(var o=[],s=new yL,c=0,l=t.length;c<l;c++){var u=t[c];u.data??={};var d=u.data;if(d.id==null)d.id=sL();else if(e.hasElementWithId(d.id)||s.has(d.id))continue;var f=new bL(e,u,!1);o.push(f),s.add(d.id)}t=o}this.length=0;for(var p=0,m=t.length;p<m;p++){var h=t[p][0];if(h!=null){var g=h._private.data.id;(!n||!i.has(g))&&(n&&i.set(g,{index:this.length,ele:h}),this[this.length]=h,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap??this.rebuildMap(),this.lazyMap},set map(e){this.lazyMap=e},rebuildMap:function(){for(var e=this.lazyMap=new gL,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=i),a&&!r&&this.restore()},FG=bL.prototype=PG.prototype=Object.create(Array.prototype);FG.instanceString=function(){return`collection`},FG.spawn=function(e,t){return new PG(this.cy(),e,t)},FG.spawnSelf=function(){return this.spawn(this)},FG.cy=function(){return this._private.cy},FG.renderer=function(){return this._private.cy.renderer()},FG.element=function(){return this[0]},FG.collection=function(){return nF(this)?this:new PG(this._private.cy,[this])},FG.unique=function(){return new PG(this._private.cy,this,!0)},FG.hasElementWithId=function(e){return e=``+e,this._private.map.has(e)},FG.getElementById=function(e){e=``+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new PG(t)},FG.$id=FG.getElementById,FG.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},FG.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},FG.indexOfId=function(e){return e=``+e,this._private.map.get(e).index},FG.json=function(e){var t=this.element(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(XP(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,c=e.data.target;s!=null&&s!=i.source&&(o.source=``+s,a=!0),c!=null&&c!=i.target&&(o.target=``+c,a=!0),a&&(t=t.move(o))}else{var l=`parent`in e.data,u=e.data.parent;l&&(u!=null||i.parent!=null)&&u!=i.parent&&(u===void 0&&(u=null),u!=null&&(u=``+u),t=t.move({parent:u}))}}e.position&&t.position(e.position);var d=function(n,i,a){var o=e[n];o!=null&&o!==r[n]&&(o?t[i]():t[a]())};return d(`removed`,`remove`,`restore`),d(`selected`,`select`,`unselect`),d(`selectable`,`selectify`,`unselectify`),d(`locked`,`lock`,`unlock`),d(`grabbable`,`grabify`,`ungrabify`),d(`pannable`,`panify`,`unpanify`),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}else if(e===void 0){var f={data:aL(r.data),position:aL(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};f.classes=``;var p=0;return r.classes.forEach(function(e){return f.classes+=p++===0?e:` `+e}),f}}},FG.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},FG.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=new bL(e,this[n].json(),!1);t.push(r)}return new PG(e,t)},FG.copy=FG.clone,FG.restore=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),i=r._private,a=[],o=[],s,c=0,l=n.length;c<l;c++){var u=n[c];t&&!u.removed()||(u.isNode()?a.push(u):o.push(u))}s=a.concat(o);var d,f=function(){s.splice(d,1),d--};for(d=0;d<s.length;d++){var p=s[d],m=p._private,h=m.data;if(p.clearTraversalCache(),!(!t&&!m.removed)){if(h.id===void 0)h.id=sL();else if($(h.id))h.id=``+h.id;else if(oF(h.id)||!qP(h.id)){tL("Can not create element with invalid string ID `"+h.id+"`"),f();continue}else if(r.hasElementWithId(h.id)){tL("Can not create second element with ID `"+h.id+"`"),f();continue}}var g=h.id;if(p.isNode()){var _=m.position;_.x??=0,_.y??=0}if(p.isEdge()){for(var v=p,y=[`source`,`target`],b=y.length,x=!1,S=0;S<b;S++){var C=y[S],w=h[C];$(w)&&(w=h[C]=``+h[C]),w==null||w===``?(tL("Can not create edge `"+g+"` with unspecified "+C),x=!0):r.hasElementWithId(w)||(tL("Can not create edge `"+g+"` with nonexistent "+C+" `"+w+"`"),x=!0)}if(x){f();continue}var T=r.getElementById(h.source),E=r.getElementById(h.target);T.same(E)?T._private.edges.push(v):(T._private.edges.push(v),E._private.edges.push(v)),v._private.source=T,v._private.target=E}m.map=new gL,m.map.set(g,{ele:p,index:0}),m.removed=!1,t&&r.addToPool(p)}for(var D=0;D<a.length;D++){var O=a[D],k=O._private.data;$(k.parent)&&(k.parent=``+k.parent);var A=k.parent;if(A!=null||O._private.parent){var j=O._private.parent?r.collection().merge(O._private.parent):r.getElementById(A);if(j.empty())k.parent=void 0;else if(j[0].removed())rL(`Node added with missing parent, reference to parent removed`),k.parent=void 0,O._private.parent=null;else{for(var M=!1,N=j;!N.empty();){if(O.same(N)){M=!0,k.parent=void 0;break}N=N.parent()}M||(j[0]._private.children.push(O),O._private.parent=j[0],i.hasCompoundNodes=!0)}}}if(s.length>0){for(var P=s.length===n.length?n:new PG(r,s),F=0;F<P.length;F++){var I=P[F];I.isNode()||(I.parallelEdges().clearTraversalCache(),I.source().clearTraversalCache(),I.target().clearTraversalCache())}(i.hasCompoundNodes?r.collection().merge(P).merge(P.connectedNodes()).merge(P.parent()):P).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?P.emitAndNotify(`add`):t&&P.emit(`add`)}return n},FG.removed=function(){var e=this[0];return e&&e._private.removed},FG.inside=function(){var e=this[0];return e&&!e._private.removed},FG.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n<t.length;n++)c(t[n])}function s(e){for(var t=e._private.children,n=0;n<t.length;n++)c(t[n])}function c(e){var n=i[e.id()];t&&e.removed()||n||(i[e.id()]=!0,e.isNode()?(r.push(e),o(e),s(e)):r.unshift(e))}for(var l=0,u=n.length;l<u;l++){var d=n[l];c(d)}function f(e,t){var n=e._private.edges;dL(n,t),e.clearTraversalCache()}function p(e){e.clearTraversalCache()}var m=[];m.ids={};function h(e,t){t=t[0],e=e[0];var n=e._private.children,r=e.id();dL(n,t),t._private.parent=null,m.ids[r]||(m.ids[r]=!0,m.push(e))}n.dirtyCompoundBoundsCache(),t&&a.removeFromPool(r);for(var g=0;g<r.length;g++){var _=r[g];if(_.isEdge()){var v=_.source()[0],y=_.target()[0];f(v,_),f(y,_);for(var b=_.parallelEdges(),x=0;x<b.length;x++){var S=b[x];p(S),S.isBundledBezier()&&S.dirtyBoundingBoxCache()}}else{var C=_.parent();C.length!==0&&h(C,_)}t&&(_._private.removed=!0)}var w=a._private.elements;a._private.hasCompoundNodes=!1;for(var T=0;T<w.length;T++)if(w[T].isParent()){a._private.hasCompoundNodes=!0;break}var E=new PG(this.cy(),r);E.size()>0&&(e?E.emitAndNotify(`remove`):t&&E.emit(`remove`));for(var D=0;D<m.length;D++){var O=m[D];(!t||!O.removed())&&O.updateStyle()}return E},FG.move=function(e){var t=this._private.cy,n=this,r=!1,i=!1,a=function(e){return e==null?e:``+e};if(e.source!==void 0||e.target!==void 0){var o=a(e.source),s=a(e.target),c=o!=null&&t.hasElementWithId(o),l=s!=null&&t.hasElementWithId(s);(c||l)&&(t.batch(function(){n.remove(r,i),n.emitAndNotify(`moveout`);for(var e=0;e<n.length;e++){var t=n[e],a=t._private.data;t.isEdge()&&(c&&(a.source=o),l&&(a.target=s))}n.restore(r,i)}),n.emitAndNotify(`move`))}else if(e.parent!==void 0){var u=a(e.parent);if(u===null||t.hasElementWithId(u)){var d=u===null?void 0:u;t.batch(function(){var e=n.remove(r,i);e.emitAndNotify(`moveout`);for(var t=0;t<n.length;t++){var a=n[t],o=a._private.data;a.isNode()&&(o.parent=d)}e.restore(r,i)}),n.emitAndNotify(`move`)}}return this},[yB,AU,jU,tW,rW,uW,dW,qW,lG,uG,fG,mG,gG,bG,wG,DG].forEach(function(e){EF(FG,e)});var IG={add:function(e){var t,n=this;if(eF(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var i=[],a=0;a<r.length;a++){var o=r[a];i.push(o.json())}t=new PG(n,i)}}else if(YP(e))t=new PG(n,e);else if(XP(e)&&(YP(e.nodes)||YP(e.edges))){for(var s=e,c=[],l=[`nodes`,`edges`],u=0,d=l.length;u<d;u++){var f=l[u],p=s[f];if(YP(p))for(var m=0,h=p.length;m<h;m++){var g=EF({group:f},p[m]);c.push(g)}}t=new PG(n,c)}else t=new bL(n,e).collection();return t},remove:function(e){if(!eF(e)&&qP(e)){var t=e;e=this.$(t)}return e.remove()}};function LG(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,c=11,l=1/(c-1),u=typeof Float32Array<`u`;if(arguments.length!==4)return!1;for(var d=0;d<4;++d)if(typeof arguments[d]!=`number`||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var f=u?new Float32Array(c):Array(c);function p(e,t){return 1-3*t+3*e}function m(e,t){return 3*t-6*e}function h(e){return 3*e}function g(e,t,n){return((p(t,n)*e+m(t,n))*e+h(t))*e}function _(e,t,n){return 3*p(t,n)*e*e+2*m(t,n)*e+h(t)}function v(t,r){for(var a=0;a<i;++a){var o=_(r,e,n);if(o===0)return r;var s=g(r,e,n)-t;r-=s/o}return r}function y(){for(var t=0;t<c;++t)f[t]=g(t*l,e,n)}function b(t,r,i){var a,c,l=0;do c=r+(i-r)/2,a=g(c,e,n)-t,a>0?i=c:r=c;while(Math.abs(a)>o&&++l<s);return c}function x(t){for(var r=0,i=1,o=c-1;i!==o&&f[i]<=t;++i)r+=l;--i;var s=(t-f[i])/(f[i+1]-f[i]),u=r+s*l,d=_(u,e,n);return d>=a?v(t,u):d===0?u:b(t,r,r+l)}var S=!1;function C(){S=!0,(e!==t||n!==r)&&y()}var w=function(i){return S||C(),e===t&&n===r?i:i===0?0:i===1?1:g(x(i),t,r)};w.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var T=`generateBezier(`+[e,t,n,r]+`)`;return w.toString=function(){return T},w}var RG=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,r*.5,i),o=t(n,r*.5,a),s=t(n,r,o),c=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),l=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x+=c*r,n.v+=l*r,n}return function e(t,r,i){var a={x:-1,v:0,tension:null,friction:null},o=[0],s=0,c=1/1e4,l=16/1e3,u,d,f;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i||=null,a.tension=t,a.friction=r,u=i!==null,u?(s=e(t,r),d=s/i*l):d=l;f=n(f||a,d),o.push(1+f.x),s+=16,Math.abs(f.x)>c&&Math.abs(f.v)>c;);return u?function(e){return o[e*(o.length-1)|0]}:s}}(),zG=function(e,t,n,r){var i=LG(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},BG={linear:function(e,t,n){return e+(t-e)*n},ease:zG(.25,.1,.25,1),"ease-in":zG(.42,0,1,1),"ease-out":zG(0,0,.58,1),"ease-in-out":zG(.42,0,.58,1),"ease-in-sine":zG(.47,0,.745,.715),"ease-out-sine":zG(.39,.575,.565,1),"ease-in-out-sine":zG(.445,.05,.55,.95),"ease-in-quad":zG(.55,.085,.68,.53),"ease-out-quad":zG(.25,.46,.45,.94),"ease-in-out-quad":zG(.455,.03,.515,.955),"ease-in-cubic":zG(.55,.055,.675,.19),"ease-out-cubic":zG(.215,.61,.355,1),"ease-in-out-cubic":zG(.645,.045,.355,1),"ease-in-quart":zG(.895,.03,.685,.22),"ease-out-quart":zG(.165,.84,.44,1),"ease-in-out-quart":zG(.77,0,.175,1),"ease-in-quint":zG(.755,.05,.855,.06),"ease-out-quint":zG(.23,1,.32,1),"ease-in-out-quint":zG(.86,0,.07,1),"ease-in-expo":zG(.95,.05,.795,.035),"ease-out-expo":zG(.19,1,.22,1),"ease-in-out-expo":zG(1,0,0,1),"ease-in-circ":zG(.6,.04,.98,.335),"ease-out-circ":zG(.075,.82,.165,1),"ease-in-out-circ":zG(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return BG.linear;var r=RG(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":zG};function VG(e,t,n,r,i){if(r===1||t===n)return n;var a=i(t,n,r);return e==null?a:((e.roundValue||e.color)&&(a=Math.round(a)),e.min!==void 0&&(a=Math.max(a,e.min)),e.max!==void 0&&(a=Math.min(a,e.max)),a)}function HG(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!==`%`)?e.pfValue:e.value:e}function UG(e,t,n,r,i){var a=i==null?null:i.type;n<0?n=0:n>1&&(n=1);var o=HG(e,i),s=HG(t,i);if($(o)&&$(s))return VG(a,o,s,n,r);if(YP(o)&&YP(s)){for(var c=[],l=0;l<s.length;l++){var u=o[l],d=s[l];if(u!=null&&d!=null){var f=VG(a,u,d,n,r);c.push(f)}else c.push(d)}return c}}function WG(e,t,n,r){var i=!r,a=e._private,o=t._private,s=o.easing,c=o.startTime,l=(r?e:e.cy()).style();if(!o.easingImpl)if(s==null)o.easingImpl=BG.linear;else{var u=qP(s)?l.parse(`transition-timing-function`,s).value:s,d,f;qP(u)?(d=u,f=[]):(d=u[1],f=u.slice(2).map(function(e){return+e})),f.length>0?(d===`spring`&&f.push(o.duration),o.easingImpl=BG[d].apply(null,f)):o.easingImpl=BG[d]}var p=o.easingImpl,m=o.duration===0?1:(n-c)/o.duration;if(o.applying&&(m=o.progress),m<0?m=0:m>1&&(m=1),o.delay==null){var h=o.startPosition,g=o.position;if(g&&i&&!e.locked()){var _={};GG(h.x,g.x)&&(_.x=UG(h.x,g.x,m,p)),GG(h.y,g.y)&&(_.y=UG(h.y,g.y,m,p)),e.position(_)}var v=o.startPan,y=o.pan,b=a.pan,x=y!=null&&r;x&&(GG(v.x,y.x)&&(b.x=UG(v.x,y.x,m,p)),GG(v.y,y.y)&&(b.y=UG(v.y,y.y,m,p)),e.emit(`pan`));var S=o.startZoom,C=o.zoom,w=C!=null&&r;w&&(GG(S,C)&&(a.zoom=cR(a.minZoom,UG(S,C,m,p),a.maxZoom)),e.emit(`zoom`)),(x||w)&&e.emit(`viewport`);var T=o.style;if(T&&T.length>0&&i){for(var E=0;E<T.length;E++){var D=T[E],O=D.name,k=D,A=o.startStyle[O],j=l.properties[A.name],M=UG(A,k,m,p,j);l.overrideBypass(e,O,M)}e.emit(`style`)}}return o.progress=m,m}function GG(e,t){return e==null||t==null?!1:$(e)&&$(t)?!0:!!(e&&t)}function KG(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function qG(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(a.length===0){var c=o.shift();c&&a.push(c)}for(var l=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t];n()}e.splice(0,e.length)},u=a.length-1;u>=0;u--){var d=a[u],f=d._private;if(f.stopped){a.splice(u,1),f.hooked=!1,f.playing=!1,f.started=!1,l(f.frames);continue}!f.playing&&!f.applying||(f.playing&&f.applying&&(f.applying=!1),f.started||KG(t,d,e),WG(t,d,e,n),f.applying&&=!1,l(f.frames),f.step!=null&&f.step(e),d.completed()&&(a.splice(u,1),f.hooked=!1,f.playing=!1,f.started=!1,l(f.completes)),s=!0)}return!n&&a.length===0&&o.length===0&&r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=n[o],c=i(s);a||=c}var l=i(t,!0);(a||l)&&(n.length>0?t.notify(`draw`,n):t.notify(`draw`)),n.unmerge(r),t.emit(`step`)}var JG={animate:kU.animate(),animation:kU.animation(),animated:kU.animated(),clearQueue:kU.clearQueue(),delay:kU.delay(),delayAnimation:kU.delayAnimation(),stop:kU.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&kI(function(n){qG(n,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(t,n){qG(n,e)},n.beforeRenderPriorities.animations):t()}},YG={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r==null?!0:e!==n.target&&tF(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier==null?e:n.target}},XG=function(e){return qP(e)?new $U(e):e},ZG={createEmitter:function(){var e=this._private;return e.emitter||=new nG(YG,this),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,XG(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,XG(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,XG(t),n),this},once:function(e,t,n){return this.emitter().one(e,XG(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};kU.eventAliasesOn(ZG);var QG={png:function(e){var t=this._private.renderer;return e||={},t.png(e)},jpg:function(e){var t=this._private.renderer;return e||={},e.bg=e.bg||`#fff`,t.jpg(e)}};QG.jpeg=QG.jpg;var $G={layout:function(e){var t=this;if(e==null){tL(`Layout options must be specified to make a layout`);return}if(e.name==null){tL("A `name` must be specified to make a layout");return}var n=e.name,r=t.extension(`layout`,n);if(r==null){tL("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}return new r(EF({},e,{cy:t,eles:qP(e.eles)?t.$(e.eles):e.eles==null?t.$():e.eles}))}};$G.createLayout=$G.makeLayout=$G.layout;var eK={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&r.merge(t);return}if(n.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount??=0,e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i];t.getElementById(i).data(a)}})}},tK=uL({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),nK={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify(`draw`),this},resize:function(){return this.invalidateSize(),this.emitAndNotify(`resize`),this},initRenderer:function(e){var t=this,n=t.extension(`renderer`,e.name);if(n==null){tL(`Can not initialise: No such renderer \`${e.name}\` found. Did you forget to import it and \`cytoscape.use()\` it?`);return}e.wheelSensitivity!==void 0&&rL(`You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.`);var r=tK(e);r.cy=t,t._private.renderer=new n(r),this.notify(`init`)},destroyRenderer:function(){var e=this;e.notify(`destroy`);var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on(`render`,e)},offRender:function(e){return this.off(`render`,e)}};nK.invalidateDimensions=nK.resize;var rK={collection:function(e,t){return qP(e)?this.$(e):eF(e)?e.collection():YP(e)?(t||={},new PG(this,e,t.unique,t.removed)):new PG(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};rK.elements=rK.filter=rK.$;var iK={},aK=`t`,oK=`f`;iK.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r<e.length;r++){var i=e[r],a=t.getContextMeta(i);if(!a.empty){var o=t.getContextStyle(a),s=t.applyContextStyle(a,o,i);i._private.appliedInitStyle?t.updateTransitions(i,s.diffProps):i._private.appliedInitStyle=!0,t.updateStyleHints(i)&&n.push(i)}}return n},iK.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},i=e+`-`+t,a=r[i];if(a)return a;for(var o=[],s={},c=0;c<n.length;c++){var l=n[c],u=e[c]===aK,d=t[c]===aK,f=u!==d,p=l.mappedProperties.length>0;if(f||d&&p){var m=void 0;f&&p||f?m=l.properties:p&&(m=l.mappedProperties);for(var h=0;h<m.length;h++){for(var g=m[h],_=g.name,v=!1,y=c+1;y<n.length;y++){var b=n[y];if(t[y]===aK&&(v=b.properties[g.name]!=null,v))break}!s[_]&&!v&&(s[_]=!0,o.push(_))}}}return r[i]=o,o},iK.getContextMeta=function(e){for(var t=this,n=``,r,i=e._private.styleCxtKey||``,a=0;a<t.length;a++){var o=t[a];o.selector&&o.selector.matches(e)?n+=aK:n+=oK}return r=t.getPropertiesDiff(i,n),e._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}},iK.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var i={_private:{key:t}},a=0;a<n.length;a++){var o=n[a];if(t[a]===aK)for(var s=0;s<o.properties.length;s++){var c=o.properties[s];i[c.name]=c}}return r[t]=i,i},iK.applyContextStyle=function(e,t,n){for(var r=this,i=e.diffPropNames,a={},o=r.types,s=0;s<i.length;s++){var c=i[s],l=t[c],u=n.pstyle(c);if(!l)if(u)l=u.bypass?{name:c,deleteBypassed:!0}:{name:c,delete:!0};else continue;if(u!==l){if(l.mapped===o.fn&&u!=null&&u.mapping!=null&&u.mapping.value===l.value){var d=u.mapping;if((d.fnValue=l.value(n))===d.prevFnValue)continue}var f=a[c]={prev:u};r.applyParsedProperty(n,l),f.next=n.pstyle(c),f.next&&f.next.bypass&&(f.next=f.next.bypassed)}}return{diffProps:a}},iK.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s=t.group===`nodes`,c=e._private.style;r=Object.keys(c);for(var l=0;l<i.length;l++){var u=i[l];t.styleKeys[u]=[jI,NI]}for(var d=function(e,n){return t.styleKeys[n][0]=FI(e,t.styleKeys[n][0])},f=function(e,n){return t.styleKeys[n][1]=II(e,t.styleKeys[n][1])},p=function(e,t){d(e,t),f(e,t)},m=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);d(r,t),f(r,t)}},h=2e9,g=function(e){return-128<e&&e<128&&Math.floor(e)!==e?h-(e*1024|0):e},_=0;_<r.length;_++){var v=r[_],y=c[v];if(y!=null){var b=this.properties[v],x=b.type,S=b.groupKey,C=void 0;b.hashOverride==null?y.pfValue!=null&&(C=y.pfValue):C=b.hashOverride(e,y);var w=b.enums==null?y.value:null,T=C!=null,E=T||w!=null,D=y.units;x.number&&E&&!x.multiple?(p(g(T?C:w),S),!T&&D!=null&&m(D,S)):m(y.strValue,S)}}for(var O=[jI,NI],k=0;k<i.length;k++){var A=i[k],j=t.styleKeys[A];O[0]=FI(j[0],O[0]),O[1]=II(j[1],O[1])}t.styleKey=LI(O[0],O[1]);var M=t.styleKeys;t.labelDimsKey=RI(M.labelDimensions);var N=a(e,[`label`],M.labelDimensions);if(t.labelKey=RI(N),t.labelStyleKey=RI(zI(M.commonLabel,N)),!s){var P=a(e,[`source-label`],M.labelDimensions);t.sourceLabelKey=RI(P),t.sourceLabelStyleKey=RI(zI(M.commonLabel,P));var F=a(e,[`target-label`],M.labelDimensions);t.targetLabelKey=RI(F),t.targetLabelStyleKey=RI(zI(M.commonLabel,F))}if(s){var I=t.styleKeys,L=I.nodeBody,R=I.nodeBorder,ee=I.nodeOutline,z=I.backgroundImage,B=I.compound,V=I.pie,H=I.stripe;t.nodeKey=RI([L,R,ee,z,B,V,H].filter(function(e){return e!=null}).reduce(zI,[jI,NI])),t.hasPie=V!=null&&V[0]!==jI&&V[1]!==NI,t.hasStripe=H!=null&&H[0]!==jI&&H[1]!==NI}return o!==t.styleKey},iK.clearStyleHints=function(e){var t=e._private;t.styleCxtKey=``,t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null,t.hasStripe=null},iK.applyParsedProperty=function(e,t){var n=this,r=t,i=e._private.style,a,o=n.types,s=n.properties[r.name].type,c=r.bypass,l=i[r.name],u=l&&l.bypass,d=e._private,f=`mapping`,p=function(e){return e==null?null:e.pfValue==null?e.value:e.pfValue},m=function(){var t=p(l),i=p(r);n.checkTriggers(e,r.name,t,i)};if(t.name===`curve-style`&&e.isEdge()&&(t.value!==`bezier`&&e.isLoop()||t.value===`haystack`&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,`bezier`,c)),r.delete)return i[r.name]=void 0,m(),!0;if(r.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,m(),!0):!1:(m(),!0);if(r.deleteBypass)return l?l.bypass?(i[r.name]=l.bypassed,m(),!0):!1:(m(),!0);var h=function(){rL("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case o.mapData:for(var g=r.field.split(`.`),_=d.data,v=0;v<g.length&&_;v++){var y=g[v];_=_[y]}if(_==null)return h(),!1;var b;if($(_)){var x=r.fieldMax-r.fieldMin;b=x===0?0:(_-r.fieldMin)/x}else return rL("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+`: `+_+"` for `"+e.id()+"` is non-numeric)"),!1;if(b<0?b=0:b>1&&(b=1),s.color){var S=r.valueMin[0],C=r.valueMax[0],w=r.valueMin[1],T=r.valueMax[1],E=r.valueMin[2],D=r.valueMax[2],O=r.valueMin[3]==null?1:r.valueMin[3],k=r.valueMax[3]==null?1:r.valueMax[3],A=[Math.round(S+(C-S)*b),Math.round(w+(T-w)*b),Math.round(E+(D-E)*b),Math.round(O+(k-O)*b)];a={bypass:r.bypass,name:r.name,value:A,strValue:`rgb(`+A[0]+`, `+A[1]+`, `+A[2]+`)`}}else if(s.number){var j=r.valueMin+(r.valueMax-r.valueMin)*b;a=this.parse(r.name,j,r.bypass,f)}else return!1;if(!a)return h(),!1;a.mapping=r,r=a;break;case o.data:for(var M=r.field.split(`.`),N=d.data,P=0;P<M.length&&N;P++){var F=M[P];N=N[F]}if(N!=null&&(a=this.parse(r.name,N,r.bypass,f)),!a)return h(),!1;a.mapping=r,r=a;break;case o.fn:var I=r.value,L=r.fnValue==null?I(e):r.fnValue;if(r.prevFnValue=L,L==null)return rL("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(a=this.parse(r.name,L,r.bypass,f),!a)return rL("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;a.mapping=aL(r),r=a;break;case void 0:break;default:return!1}return c?(u?r.bypassed=l.bypassed:r.bypassed=l,i[r.name]=r):u?l.bypassed=r:i[r.name]=r,m(),!0},iK.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!t)r._private.style={};else for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],c=i[s];c!=null&&(c.bypass?c.bypassed=null:i[s]=null)}}},iK.update=function(){this._private.cy.mutableElements().updateStyle()},iK.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle(`transition-property`).value,a=e.pstyle(`transition-duration`).pfValue,o=e.pstyle(`transition-delay`).pfValue;if(i.length>0&&a>0){for(var s={},c=!1,l=0;l<i.length;l++){var u=i[l],d=e.pstyle(u),f=t[u];if(f){var p=f.prev,m=f.next==null?d:f.next,h=!1,g=void 0,_=1e-6;p&&($(p.pfValue)&&$(m.pfValue)?(h=m.pfValue-p.pfValue,g=p.pfValue+_*h):$(p.value)&&$(m.value)?(h=m.value-p.value,g=p.value+_*h):YP(p.value)&&YP(m.value)&&(h=p.value[0]!==m.value[0]||p.value[1]!==m.value[1]||p.value[2]!==m.value[2],g=p.strValue),h&&(s[u]=m.strValue,this.applyBypass(e,u,g),c=!0))}}if(!c)return;r.transitioning=!0,new kB(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle(`transition-timing-function`).value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify(`style`),r.transitioning=!1})}else r.transitioning&&=(this.removeBypasses(e,i),e.emitAndNotify(`style`),!1)},iK.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);e.removed()||s!=null&&s(n,r,e)&&a(o)},iK.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){i._private.cy.notify(`zorder`,e)})},iK.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},iK.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},iK.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},iK.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var sK={};sK.applyBypass=function(e,t,n,r){var i=this,a=[],o=!0;if(t===`*`||t===`**`){if(n!==void 0)for(var s=0;s<i.properties.length;s++){var c=i.properties[s].name,l=this.parse(c,n,!0);l&&a.push(l)}}else if(qP(t)){var u=this.parse(t,n,!0);u&&a.push(u)}else if(XP(t)){var d=t;r=n;for(var f=Object.keys(d),p=0;p<f.length;p++){var m=f[p],h=d[m];if(h===void 0&&(h=d[pF(m)]),h!==void 0){var g=this.parse(m,h,!0);g&&a.push(g)}}}else return!1;if(a.length===0)return!1;for(var _=!1,v=0;v<e.length;v++){for(var y=e[v],b={},x=void 0,S=0;S<a.length;S++){var C=a[S];if(r){var w=y.pstyle(C.name);x=b[C.name]={prev:w}}_=this.applyParsedProperty(y,aL(C))||_,r&&(x.next=y.pstyle(C.name))}_&&this.updateStyleHints(y),r&&this.updateTransitions(y,b,o)}return _},sK.overrideBypass=function(e,t,n){t=fF(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,c=o.mutiple,l=a?a.pfValue==null?a.value:a.pfValue:null;!a||!a.bypass?this.applyBypass(i,t,n):(a.value=n,a.pfValue!=null&&(a.pfValue=n),s?a.strValue=`rgb(`+n.join(`,`)+`)`:c?a.strValue=n.join(` `):a.strValue=``+n,this.updateStyleHints(i)),this.checkTriggers(i,t,l,n)}},sK.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},sK.removeBypasses=function(e,t,n){for(var r=!0,i=0;i<e.length;i++){for(var a=e[i],o={},s=0;s<t.length;s++){var c=t[s],l=this.properties[c],u=a.pstyle(l.name);if(!(!u||!u.bypass)){var d=this.parse(c,``,!0),f=o[l.name]={prev:u};this.applyParsedProperty(a,d),f.next=a.pstyle(l.name)}}this.updateStyleHints(a),n&&this.updateTransitions(a,o,r)}};var cK={};cK.getEmSizeInPixels=function(){var e=this.containerCss(`font-size`);return e==null?1:parseFloat(e)},cK.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var lK={};lK.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},lK.getRawStyle=function(e,t){var n=this;if(e=e[0],e){for(var r={},i=0;i<n.properties.length;i++){var a=n.properties[i],o=n.getStylePropertyValue(e,a.name,t);o!=null&&(r[a.name]=o,r[pF(a.name)]=o)}return r}},lK.getIndexedStyle=function(e,t,n,r){return e.pstyle(t)[n][r]??e.cy().style().getDefaultProperty(t)[n][0]},lK.getStylePropertyValue=function(e,t,n){var r=this;if(e=e[0],e){var i=r.properties[t];i.alias&&(i=i.pointsTo);var a=i.type,o=e.pstyle(i.name);if(o){var s=o.value,c=o.units,l=o.strValue;if(n&&a.number&&s!=null&&$(s)){var u=e.cy().zoom(),d=function(e){return e*u},f=function(e,t){return d(e)+t},p=YP(s);return(p?c.every(function(e){return e!=null}):c!=null)?p?s.map(function(e,t){return f(e,c[t])}).join(` `):f(s,c):p?s.map(function(e){return qP(e)?e:``+d(e)}).join(` `):``+d(s)}else if(l!=null)return l}return null}},lK.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);a!==void 0&&(a=XP(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},lK.getPropsList=function(e){var t=this,n=[],r=e,i=t.properties;if(r)for(var a=Object.keys(r),o=0;o<a.length;o++){var s=a[o],c=r[s],l=i[s]||i[fF(s)],u=this.parse(l.name,c);u&&n.push(u)}return n},lK.getNonDefaultPropertiesHash=function(e,t,n){var r=n.slice(),i,a,o,s,c,l;for(c=0;c<t.length;c++)if(i=t[c],a=e.pstyle(i,!1),a!=null)if(a.pfValue!=null)r[0]=FI(s,r[0]),r[1]=II(s,r[1]);else for(o=a.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),r[0]=FI(s,r[0]),r[1]=II(s,r[1]);return r},lK.getPropertiesHash=lK.getNonDefaultPropertiesHash;var uK={};uK.appendFromJson=function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],i=r.selector,a=r.style||r.css,o=Object.keys(a);t.selector(i);for(var s=0;s<o.length;s++){var c=o[s],l=a[c];t.css(c,l)}}return t},uK.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},uK.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():`core`,style:a})}return e};var dK={};dK.appendFromString=function(e){var t=this,n=this,r=``+e,i,a,o;r=r.replace(/[/][*](\s|.)+?[*][/]/g,``);function s(){r=r.length>i.length?r.substr(i.length):``}function c(){a=a.length>o.length?a.substr(o.length):``}for(;!r.match(/^\s*$/);){var l=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){rL(`Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: `+r);break}i=l[0];var u=l[1];if(u!==`core`&&new $U(u).invalid){rL(`Skipping parsing of block: Invalid selector found in string stylesheet: `+u),s();continue}var d=l[2],f=!1;a=d;for(var p=[];!a.match(/^\s*$/);){var m=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){rL(`Skipping parsing of block: Invalid formatting of style property and value definitions found in:`+d),f=!0;break}o=m[0];var h=m[1],g=m[2];if(!t.properties[h]){rL(`Skipping property: Invalid property name in: `+o),c();continue}if(!n.parse(h,g)){rL(`Skipping property: Invalid property definition in: `+o),c();continue}p.push({name:h,val:g}),c()}if(f){s();break}n.selector(u);for(var _=0;_<p.length;_++){var v=p[_];n.css(v.name,v.val)}s()}return n},dK.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var fK={};(function(){var e=_F,t=yF,n=xF,r=SF,i=CF,a=function(e){return`^`+e+`\\s*\\(\\s*([\\w\\.]+)\\s*\\)$`},o=function(a){var o=e+`|\\w+|`+t+`|`+n+`|`+r+`|`+i;return`^`+a+`\\s*\\(([\\w\\.]+)\\s*\\,\\s*(`+e+`)\\s*\\,\\s*(`+e+`)\\s*,\\s*(`+o+`)\\s*\\,\\s*(`+o+`)\\)$`},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,`^(none)$`,`^(.+)$`];fK.types={time:{number:!0,min:0,units:`s|ms`,implicitUnits:`ms`},percent:{number:!0,min:0,max:100,units:`%`,implicitUnits:`%`},percentages:{number:!0,min:0,max:100,units:`%`,implicitUnits:`%`,multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:[`parent`,`origin`]},nodeSize:{number:!0,min:0,enums:[`label`]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:[`horizontal`,`leftward`,`rightward`,`vertical`,`upward`,`downward`,`auto`]},axisDirectionExplicit:{enums:[`leftward`,`rightward`,`upward`,`downward`]},axisDirectionPrimary:{enums:[`horizontal`,`vertical`]},paddingRelativeTo:{enums:[`width`,`height`,`average`,`min`,`max`]},bgWH:{number:!0,min:0,allowPercent:!0,enums:[`auto`],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:[`inner`,`include-padding`],multiple:!0},bgRepeat:{enums:[`repeat`,`repeat-x`,`repeat-y`,`no-repeat`],multiple:!0},bgFit:{enums:[`none`,`contain`,`cover`],multiple:!0},bgCrossOrigin:{enums:[`anonymous`,`use-credentials`,`null`],multiple:!0},bgClip:{enums:[`none`,`node`],multiple:!0},bgContainment:{enums:[`inside`,`over`],multiple:!0},boxSelection:{enums:[`contain`,`overlap`,`none`]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:[`solid`,`linear-gradient`,`radial-gradient`]},bool:{enums:[`yes`,`no`]},bools:{enums:[`yes`,`no`],multiple:!0},lineStyle:{enums:[`solid`,`dotted`,`dashed`]},lineCap:{enums:[`butt`,`round`,`square`]},linePosition:{enums:[`center`,`inside`,`outside`]},lineJoin:{enums:[`round`,`bevel`,`miter`]},borderStyle:{enums:[`solid`,`dotted`,`dashed`,`double`]},curveStyle:{enums:[`bezier`,`unbundled-bezier`,`haystack`,`segments`,`straight`,`straight-triangle`,`taxi`,`round-segments`,`round-taxi`]},radiusType:{enums:[`arc-radius`,`influence-radius`],multiple:!0},fontFamily:{regex:`^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$`},fontStyle:{enums:[`italic`,`normal`,`oblique`]},fontWeight:{enums:[`normal`,`bold`,`bolder`,`lighter`,`100`,`200`,`300`,`400`,`500`,`600`,`800`,`900`,100,200,300,400,500,600,700,800,900]},textDecoration:{enums:[`none`,`underline`,`overline`,`line-through`]},textTransform:{enums:[`none`,`uppercase`,`lowercase`]},textWrap:{enums:[`none`,`wrap`,`ellipsis`]},textOverflowWrap:{enums:[`whitespace`,`anywhere`]},textBackgroundShape:{enums:[`rectangle`,`roundrectangle`,`round-rectangle`,`circle`]},nodeShape:{enums:`rectangle.roundrectangle.round-rectangle.cutrectangle.cut-rectangle.bottomroundrectangle.bottom-round-rectangle.barrel.ellipse.triangle.round-triangle.square.pentagon.round-pentagon.hexagon.round-hexagon.concavehexagon.concave-hexagon.heptagon.round-heptagon.octagon.round-octagon.tag.round-tag.star.diamond.round-diamond.vee.rhomboid.right-rhomboid.polygon`.split(`.`)},overlayShape:{enums:[`roundrectangle`,`round-rectangle`,`ellipse`]},cornerRadius:{number:!0,min:0,units:`px|em`,implicitUnits:`px`,enums:[`auto`]},compoundIncludeLabels:{enums:[`include`,`exclude`]},arrowShape:{enums:[`tee`,`triangle`,`triangle-tee`,`circle-triangle`,`triangle-cross`,`triangle-backcurve`,`vee`,`square`,`circle`,`diamond`,`chevron`,`none`]},arrowFill:{enums:[`filled`,`hollow`]},arrowWidth:{number:!0,units:`%|px|em`,implicitUnits:`px`,enums:[`match-line`]},display:{enums:[`element`,`none`]},visibility:{enums:[`hidden`,`visible`]},zCompoundDepth:{enums:[`bottom`,`orphan`,`auto`,`top`]},zIndexCompare:{enums:[`auto`,`manual`]},valign:{enums:[`top`,`center`,`bottom`]},halign:{enums:[`left`,`center`,`right`]},justification:{enums:[`left`,`center`,`right`,`auto`]},text:{string:!0},data:{mapping:!0,regex:a(`data`)},layoutData:{mapping:!0,regex:a(`layoutData`)},scratch:{mapping:!0,regex:a(`scratch`)},mapData:{mapping:!0,regex:o(`mapData`)},mapLayoutData:{mapping:!0,regex:o(`mapLayoutData`)},mapScratch:{mapping:!0,regex:o(`mapScratch`)},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:`deg|rad`,implicitUnits:`rad`},textRotation:{number:!0,units:`deg|rad`,implicitUnits:`rad`,enums:[`none`,`autorotate`]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:[`intersection`,`node-position`,`endpoints`]},edgeEndpoint:{number:!0,multiple:!0,units:`%|px|em|deg|rad`,implicitUnits:`px`,enums:[`inside-to-node`,`outside-to-node`,`outside-to-node-or-label`,`outside-to-line`,`outside-to-line-or-label`],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return t[0]!==`deg`&&t[0]!==`rad`&&t[1]!==`deg`&&t[1]!==`rad`;case 1:return qP(e[0])||t[0]===`deg`||t[0]===`rad`;default:return!1}}},easing:{regexes:[`^(spring)\\s*\\(\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*\\)$`,`^(cubic-bezier)\\s*\\(\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*,\\s*(`+e+`)\\s*\\)$`],enums:`linear.ease.ease-in.ease-out.ease-in-out.ease-in-sine.ease-out-sine.ease-in-out-sine.ease-in-quad.ease-out-quad.ease-in-out-quad.ease-in-cubic.ease-out-cubic.ease-in-out-cubic.ease-in-quart.ease-out-quart.ease-in-out-quart.ease-in-quint.ease-out-quint.ease-in-out-quint.ease-in-expo.ease-out-expo.ease-in-out-expo.ease-in-circ.ease-out-circ.ease-in-out-circ`.split(`.`)},gradientDirection:{enums:[`to-bottom`,`to-top`,`to-left`,`to-right`,`to-bottom-right`,`to-bottom-left`,`to-top-right`,`to-top-left`,`to-right-bottom`,`to-left-bottom`,`to-right-top`,`to-left-top`]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(e){var t=e.length;return t===1||t===2||t===4}}};var c={zeroNonZero:function(e,t){return(e==null||t==null)&&e!==t||e==0&&t!=0?!0:e!=0&&t==0},any:function(e,t){return e!=t},emptyNonEmpty:function(e,t){var n=oF(e),r=oF(t);return n&&!r||!n&&r}},l=fK.types,u=[{name:`label`,type:l.text,triggersBounds:c.any,triggersZOrder:c.emptyNonEmpty},{name:`text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any}],d=[{name:`source-label`,type:l.text,triggersBounds:c.any},{name:`source-text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`source-text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`source-text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`source-text-offset`,type:l.size,triggersBounds:c.any}],f=[{name:`target-label`,type:l.text,triggersBounds:c.any},{name:`target-text-rotation`,type:l.textRotation,triggersBounds:c.any},{name:`target-text-margin-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`target-text-margin-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`target-text-offset`,type:l.size,triggersBounds:c.any}],p=[{name:`font-family`,type:l.fontFamily,triggersBounds:c.any},{name:`font-style`,type:l.fontStyle,triggersBounds:c.any},{name:`font-weight`,type:l.fontWeight,triggersBounds:c.any},{name:`font-size`,type:l.size,triggersBounds:c.any},{name:`text-transform`,type:l.textTransform,triggersBounds:c.any},{name:`text-wrap`,type:l.textWrap,triggersBounds:c.any},{name:`text-overflow-wrap`,type:l.textOverflowWrap,triggersBounds:c.any},{name:`text-max-width`,type:l.size,triggersBounds:c.any},{name:`text-outline-width`,type:l.size,triggersBounds:c.any},{name:`line-height`,type:l.positiveNumber,triggersBounds:c.any}],m=[{name:`text-valign`,type:l.valign,triggersBounds:c.any},{name:`text-halign`,type:l.halign,triggersBounds:c.any},{name:`color`,type:l.color},{name:`text-outline-color`,type:l.color},{name:`text-outline-opacity`,type:l.zeroOneNumber},{name:`text-background-color`,type:l.color},{name:`text-background-opacity`,type:l.zeroOneNumber},{name:`text-background-padding`,type:l.size,triggersBounds:c.any},{name:`text-border-opacity`,type:l.zeroOneNumber},{name:`text-border-color`,type:l.color},{name:`text-border-width`,type:l.size,triggersBounds:c.any},{name:`text-border-style`,type:l.borderStyle,triggersBounds:c.any},{name:`text-background-shape`,type:l.textBackgroundShape,triggersBounds:c.any},{name:`text-justification`,type:l.justification},{name:`box-select-labels`,type:l.bool,triggersBounds:c.any}],h=[{name:`events`,type:l.bool,triggersZOrder:c.any},{name:`text-events`,type:l.bool,triggersZOrder:c.any},{name:`box-selection`,type:l.boxSelection,triggersZOrder:c.any}],g=[{name:`display`,type:l.display,triggersZOrder:c.any,triggersBounds:c.any,triggersBoundsOfConnectedEdges:c.any,triggersBoundsOfParallelEdges:function(e,t,n){return e===t?!1:n.pstyle(`curve-style`).value===`bezier`}},{name:`visibility`,type:l.visibility,triggersZOrder:c.any},{name:`opacity`,type:l.zeroOneNumber,triggersZOrder:c.zeroNonZero},{name:`text-opacity`,type:l.zeroOneNumber},{name:`min-zoomed-font-size`,type:l.size},{name:`z-compound-depth`,type:l.zCompoundDepth,triggersZOrder:c.any},{name:`z-index-compare`,type:l.zIndexCompare,triggersZOrder:c.any},{name:`z-index`,type:l.number,triggersZOrder:c.any}],_=[{name:`overlay-padding`,type:l.size,triggersBounds:c.any},{name:`overlay-color`,type:l.color},{name:`overlay-opacity`,type:l.zeroOneNumber,triggersBounds:c.zeroNonZero},{name:`overlay-shape`,type:l.overlayShape,triggersBounds:c.any},{name:`overlay-corner-radius`,type:l.cornerRadius}],v=[{name:`underlay-padding`,type:l.size,triggersBounds:c.any},{name:`underlay-color`,type:l.color},{name:`underlay-opacity`,type:l.zeroOneNumber,triggersBounds:c.zeroNonZero},{name:`underlay-shape`,type:l.overlayShape,triggersBounds:c.any},{name:`underlay-corner-radius`,type:l.cornerRadius}],y=[{name:`transition-property`,type:l.propList},{name:`transition-duration`,type:l.time},{name:`transition-delay`,type:l.time},{name:`transition-timing-function`,type:l.easing}],b=function(e,t){return t.value===`label`?-e.poolIndex():t.pfValue},x=[{name:`height`,type:l.nodeSize,triggersBounds:c.any,hashOverride:b},{name:`width`,type:l.nodeSize,triggersBounds:c.any,hashOverride:b},{name:`shape`,type:l.nodeShape,triggersBounds:c.any},{name:`shape-polygon-points`,type:l.polygonPointList,triggersBounds:c.any},{name:`corner-radius`,type:l.cornerRadius},{name:`background-color`,type:l.color},{name:`background-fill`,type:l.fill},{name:`background-opacity`,type:l.zeroOneNumber},{name:`background-blacken`,type:l.nOneOneNumber},{name:`background-gradient-stop-colors`,type:l.colors},{name:`background-gradient-stop-positions`,type:l.percentages},{name:`background-gradient-direction`,type:l.gradientDirection},{name:`padding`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`padding-relative-to`,type:l.paddingRelativeTo,triggersBounds:c.any},{name:`bounds-expansion`,type:l.boundsExpansion,triggersBounds:c.any}],S=[{name:`border-color`,type:l.color},{name:`border-opacity`,type:l.zeroOneNumber},{name:`border-width`,type:l.size,triggersBounds:c.any},{name:`border-style`,type:l.borderStyle},{name:`border-cap`,type:l.lineCap},{name:`border-join`,type:l.lineJoin},{name:`border-dash-pattern`,type:l.numbers},{name:`border-dash-offset`,type:l.number},{name:`border-position`,type:l.linePosition}],C=[{name:`outline-color`,type:l.color},{name:`outline-opacity`,type:l.zeroOneNumber},{name:`outline-width`,type:l.size,triggersBounds:c.any},{name:`outline-style`,type:l.borderStyle},{name:`outline-offset`,type:l.size,triggersBounds:c.any}],w=[{name:`background-image`,type:l.urls},{name:`background-image-crossorigin`,type:l.bgCrossOrigin},{name:`background-image-opacity`,type:l.zeroOneNumbers},{name:`background-image-containment`,type:l.bgContainment},{name:`background-image-smoothing`,type:l.bools},{name:`background-position-x`,type:l.bgPos},{name:`background-position-y`,type:l.bgPos},{name:`background-width-relative-to`,type:l.bgRelativeTo},{name:`background-height-relative-to`,type:l.bgRelativeTo},{name:`background-repeat`,type:l.bgRepeat},{name:`background-fit`,type:l.bgFit},{name:`background-clip`,type:l.bgClip},{name:`background-width`,type:l.bgWH},{name:`background-height`,type:l.bgWH},{name:`background-offset-x`,type:l.bgPos},{name:`background-offset-y`,type:l.bgPos}],T=[{name:`position`,type:l.position,triggersBounds:c.any},{name:`compound-sizing-wrt-labels`,type:l.compoundIncludeLabels,triggersBounds:c.any},{name:`min-width`,type:l.size,triggersBounds:c.any},{name:`min-width-bias-left`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-width-bias-right`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-height`,type:l.size,triggersBounds:c.any},{name:`min-height-bias-top`,type:l.sizeMaybePercent,triggersBounds:c.any},{name:`min-height-bias-bottom`,type:l.sizeMaybePercent,triggersBounds:c.any}],E=[{name:`line-style`,type:l.lineStyle},{name:`line-color`,type:l.color},{name:`line-fill`,type:l.fill},{name:`line-cap`,type:l.lineCap},{name:`line-opacity`,type:l.zeroOneNumber},{name:`line-dash-pattern`,type:l.numbers},{name:`line-dash-offset`,type:l.number},{name:`line-outline-width`,type:l.size},{name:`line-outline-color`,type:l.color},{name:`line-gradient-stop-colors`,type:l.colors},{name:`line-gradient-stop-positions`,type:l.percentages},{name:`curve-style`,type:l.curveStyle,triggersBounds:c.any,triggersBoundsOfParallelEdges:function(e,t){return e===t?!1:e===`bezier`||t===`bezier`}},{name:`haystack-radius`,type:l.zeroOneNumber,triggersBounds:c.any},{name:`source-endpoint`,type:l.edgeEndpoint,triggersBounds:c.any},{name:`target-endpoint`,type:l.edgeEndpoint,triggersBounds:c.any},{name:`control-point-step-size`,type:l.size,triggersBounds:c.any},{name:`control-point-distances`,type:l.bidirectionalSizes,triggersBounds:c.any},{name:`control-point-weights`,type:l.numbers,triggersBounds:c.any},{name:`segment-distances`,type:l.bidirectionalSizes,triggersBounds:c.any},{name:`segment-weights`,type:l.numbers,triggersBounds:c.any},{name:`segment-radii`,type:l.numbers,triggersBounds:c.any},{name:`radius-type`,type:l.radiusType,triggersBounds:c.any},{name:`taxi-turn`,type:l.bidirectionalSizeMaybePercent,triggersBounds:c.any},{name:`taxi-turn-min-distance`,type:l.size,triggersBounds:c.any},{name:`taxi-direction`,type:l.axisDirection,triggersBounds:c.any},{name:`taxi-radius`,type:l.number,triggersBounds:c.any},{name:`edge-distances`,type:l.edgeDistances,triggersBounds:c.any},{name:`arrow-scale`,type:l.positiveNumber,triggersBounds:c.any},{name:`loop-direction`,type:l.angle,triggersBounds:c.any},{name:`loop-sweep`,type:l.angle,triggersBounds:c.any},{name:`source-distance-from-node`,type:l.size,triggersBounds:c.any},{name:`target-distance-from-node`,type:l.size,triggersBounds:c.any}],D=[{name:`ghost`,type:l.bool,triggersBounds:c.any},{name:`ghost-offset-x`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`ghost-offset-y`,type:l.bidirectionalSize,triggersBounds:c.any},{name:`ghost-opacity`,type:l.zeroOneNumber}],O=[{name:`selection-box-color`,type:l.color},{name:`selection-box-opacity`,type:l.zeroOneNumber},{name:`selection-box-border-color`,type:l.color},{name:`selection-box-border-width`,type:l.size},{name:`active-bg-color`,type:l.color},{name:`active-bg-opacity`,type:l.zeroOneNumber},{name:`active-bg-size`,type:l.size},{name:`outside-texture-bg-color`,type:l.color},{name:`outside-texture-bg-opacity`,type:l.zeroOneNumber}],k=[];fK.pieBackgroundN=16,k.push({name:`pie-size`,type:l.sizeMaybePercent}),k.push({name:`pie-hole`,type:l.sizeMaybePercent}),k.push({name:`pie-start-angle`,type:l.angle});for(var A=1;A<=fK.pieBackgroundN;A++)k.push({name:`pie-`+A+`-background-color`,type:l.color}),k.push({name:`pie-`+A+`-background-size`,type:l.percent}),k.push({name:`pie-`+A+`-background-opacity`,type:l.zeroOneNumber});var j=[];fK.stripeBackgroundN=16,j.push({name:`stripe-size`,type:l.sizeMaybePercent}),j.push({name:`stripe-direction`,type:l.axisDirectionPrimary});for(var M=1;M<=fK.stripeBackgroundN;M++)j.push({name:`stripe-`+M+`-background-color`,type:l.color}),j.push({name:`stripe-`+M+`-background-size`,type:l.percent}),j.push({name:`stripe-`+M+`-background-opacity`,type:l.zeroOneNumber});var N=[],P=fK.arrowPrefixes=[`source`,`mid-source`,`target`,`mid-target`];[{name:`arrow-shape`,type:l.arrowShape,triggersBounds:c.any},{name:`arrow-color`,type:l.color},{name:`arrow-fill`,type:l.arrowFill},{name:`arrow-width`,type:l.arrowWidth}].forEach(function(e){P.forEach(function(t){var n=t+`-`+e.name,r=e.type,i=e.triggersBounds;N.push({name:n,type:r,triggersBounds:i})})},{});var F=fK.properties=[].concat(h,y,g,_,v,D,m,p,u,d,f,x,S,C,w,k,j,T,E,N,O),I=fK.propertyGroups={behavior:h,transition:y,visibility:g,overlay:_,underlay:v,ghost:D,commonLabel:m,labelDimensions:p,mainLabel:u,sourceLabel:d,targetLabel:f,nodeBody:x,nodeBorder:S,nodeOutline:C,backgroundImage:w,pie:k,stripe:j,compound:T,edgeLine:E,edgeArrow:N,core:O},L=fK.propertyGroupNames={};(fK.propertyGroupKeys=Object.keys(I)).forEach(function(e){L[e]=I[e].map(function(e){return e.name}),I[e].forEach(function(t){return t.groupKey=e})});var R=fK.aliases=[{name:`content`,pointsTo:`label`},{name:`control-point-distance`,pointsTo:`control-point-distances`},{name:`control-point-weight`,pointsTo:`control-point-weights`},{name:`segment-distance`,pointsTo:`segment-distances`},{name:`segment-weight`,pointsTo:`segment-weights`},{name:`segment-radius`,pointsTo:`segment-radii`},{name:`edge-text-rotation`,pointsTo:`text-rotation`},{name:`padding-left`,pointsTo:`padding`},{name:`padding-right`,pointsTo:`padding`},{name:`padding-top`,pointsTo:`padding`},{name:`padding-bottom`,pointsTo:`padding`}];fK.propertyNames=F.map(function(e){return e.name});for(var ee=0;ee<F.length;ee++){var z=F[ee];F[z.name]=z}for(var B=0;B<R.length;B++){var V=R[B],H=F[V.pointsTo],te={name:V.name,alias:!0,pointsTo:H};F.push(te),F[V.name]=te}})(),fK.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},fK.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=EF({"selection-box-color":`#ddd`,"selection-box-opacity":.65,"selection-box-border-color":`#aaa`,"selection-box-border-width":1,"active-bg-color":`black`,"active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":`#000`,"outside-texture-bg-opacity":.125,events:`yes`,"text-events":`no`,"text-valign":`top`,"text-halign":`center`,"text-justification":`auto`,"line-height":1,color:`#000`,"box-selection":`contain`,"text-outline-color":`#000`,"text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":`none`,"text-transform":`none`,"text-wrap":`none`,"text-overflow-wrap":`whitespace`,"text-max-width":9999,"text-background-color":`#000`,"text-background-opacity":0,"text-background-shape":`rectangle`,"text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":`solid`,"text-border-color":`#000`,"font-family":`Helvetica Neue, Helvetica, sans-serif`,"font-style":`normal`,"font-weight":`normal`,"font-size":16,"min-zoomed-font-size":0,"text-rotation":`none`,"source-text-rotation":`none`,"target-text-rotation":`none`,visibility:`visible`,display:`element`,opacity:1,"z-compound-depth":`auto`,"z-index-compare":`auto`,"z-index":0,label:``,"text-margin-x":0,"text-margin-y":0,"source-label":``,"source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":``,"target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":`#000`,"overlay-padding":10,"overlay-shape":`round-rectangle`,"overlay-corner-radius":`auto`,"underlay-opacity":0,"underlay-color":`#000`,"underlay-padding":10,"underlay-shape":`round-rectangle`,"underlay-corner-radius":`auto`,"transition-property":`none`,"transition-duration":0,"transition-delay":0,"transition-timing-function":`linear`,"box-select-labels":`no`,"background-blacken":0,"background-color":`#999`,"background-fill":`solid`,"background-opacity":1,"background-image":`none`,"background-image-crossorigin":`anonymous`,"background-image-opacity":1,"background-image-containment":`inside`,"background-image-smoothing":`yes`,"background-position-x":`50%`,"background-position-y":`50%`,"background-offset-x":0,"background-offset-y":0,"background-width-relative-to":`include-padding`,"background-height-relative-to":`include-padding`,"background-repeat":`no-repeat`,"background-fit":`none`,"background-clip":`node`,"background-width":`auto`,"background-height":`auto`,"border-color":`#000`,"border-opacity":1,"border-width":0,"border-style":`solid`,"border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":`butt`,"border-join":`miter`,"border-position":`center`,"outline-color":`#999`,"outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":`solid`,height:30,width:30,shape:`ellipse`,"shape-polygon-points":`-1, -1, 1, -1, 1, 1, -1, 1`,"corner-radius":`auto`,"bounds-expansion":0,"background-gradient-direction":`to-bottom`,"background-gradient-stop-colors":`#999`,"background-gradient-stop-positions":`0%`,ghost:`no`,"ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":`width`,position:`origin`,"compound-sizing-wrt-labels":`include`,"min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":`100%`,"pie-hole":0,"pie-start-angle":`0deg`},[{name:`pie-{{i}}-background-color`,value:`black`},{name:`pie-{{i}}-background-size`,value:`0%`},{name:`pie-{{i}}-background-opacity`,value:1}].reduce(function(e,t){for(var n=1;n<=fK.pieBackgroundN;n++){var r=t.name.replace(`{{i}}`,n);e[r]=t.value}return e},{}),{"stripe-size":`100%`,"stripe-direction":`horizontal`},[{name:`stripe-{{i}}-background-color`,value:`black`},{name:`stripe-{{i}}-background-size`,value:`0%`},{name:`stripe-{{i}}-background-opacity`,value:1}].reduce(function(e,t){for(var n=1;n<=fK.stripeBackgroundN;n++){var r=t.name.replace(`{{i}}`,n);e[r]=t.value}return e},{}),{"line-style":`solid`,"line-color":`#999`,"line-fill":`solid`,"line-cap":`butt`,"line-opacity":1,"line-outline-width":0,"line-outline-color":`#000`,"line-gradient-stop-colors":`#999`,"line-gradient-stop-positions":`0%`,"control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":`arc-radius`,"taxi-turn":`50%`,"taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":`auto`,"edge-distances":`intersection`,"curve-style":`haystack`,"haystack-radius":0,"arrow-scale":1,"loop-direction":`-45deg`,"loop-sweep":`-90deg`,"source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":`outside-to-node`,"target-endpoint":`outside-to-node`,"line-dash-pattern":[6,3],"line-dash-offset":0},[{name:`arrow-shape`,value:`none`},{name:`arrow-color`,value:`#999`},{name:`arrow-fill`,value:`filled`},{name:`arrow-width`,value:1}].reduce(function(e,t){return fK.arrowPrefixes.forEach(function(n){var r=n+`-`+t.name;e[r]=t.value}),e},{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a];n[a]=this.parse(a,o)}}return e.defaultProperties=n,e.defaultProperties},fK.addDefaultStylesheet=function(){this.selector(`:parent`).css({shape:`rectangle`,padding:10,"background-color":`#eee`,"border-color":`#ccc`,"border-width":1}).selector(`edge`).css({width:3}).selector(`:loop`).css({"curve-style":`bezier`}).selector(`edge:compound`).css({"curve-style":`bezier`,"source-endpoint":`outside-to-line`,"target-endpoint":`outside-to-line`}).selector(`:selected`).css({"background-color":`#0169D9`,"line-color":`#0169D9`,"source-arrow-color":`#0169D9`,"target-arrow-color":`#0169D9`,"mid-source-arrow-color":`#0169D9`,"mid-target-arrow-color":`#0169D9`}).selector(`:parent:selected`).css({"background-color":`#CCE1F9`,"border-color":`#aec8e5`}).selector(`:active`).css({"overlay-color":`black`,"overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var pK={};pK.parse=function(e,t,n,r){var i=this;if(JP(t))return i.parseImplWarn(e,t,n,r);var a=r===`mapping`||r===!0||r===!1||r==null?`dontcare`:r,o=n?`t`:`f`,s=HI(e,``+t,o,a),c=i.propCache=i.propCache||[],l;return(l=c[s])||(l=c[s]=i.parseImplWarn(e,t,n,r)),(n||r===`mapping`)&&(l=aL(l),l&&(l.value=aL(l.value))),l},pK.parseImplWarn=function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return!i&&t!=null&&rL(`The style property \`${e}: ${t}\` is invalid`),i&&(i.name===`width`||i.name===`height`)&&t===`label`&&rL("The style value of `label` is deprecated for `"+i.name+"`"),i},pK.parseImpl=function(e,t,n,r){var i=this;e=fF(e);var a=i.properties[e],o=t,s=i.types;if(!a||t===void 0)return null;a.alias&&(a=a.pointsTo,e=a.name);var c=qP(t);c&&(t=t.trim());var l=a.type;if(!l)return null;if(n&&(t===``||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(JP(t))return{name:e,value:t,strValue:`fn`,mapped:s.fn,bypass:n};var u,d;if(!(!c||r||t.length<7||t[1]!==`a`)){if(t.length>=7&&t[0]===`d`&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var f=s.data;return{name:e,value:u,strValue:``+t,mapped:f,field:u[1],bypass:n}}else if(t.length>=10&&t[0]===`m`&&(d=new RegExp(s.mapData.regex).exec(t))){if(n||l.multiple)return!1;var p=s.mapData;if(!(l.color||l.number))return!1;var m=this.parse(e,d[4]);if(!m||m.mapped)return!1;var h=this.parse(e,d[5]);if(!h||h.mapped)return!1;if(m.pfValue===h.pfValue||m.strValue===h.strValue)return rL("`"+e+`: `+t+"` is not a valid mapper because the output range is zero; converting to `"+e+`: `+m.strValue+"`"),this.parse(e,m.strValue);if(l.color){var g=m.value,_=h.value;if(g[0]===_[0]&&g[1]===_[1]&&g[2]===_[2]&&(g[3]===_[3]||(g[3]==null||g[3]===1)&&(_[3]==null||_[3]===1)))return!1}return{name:e,value:d,strValue:``+t,mapped:p,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:m.value,valueMax:h.value,bypass:n}}}if(l.multiple&&r!==`multiple`){var v=c?t.split(/\s+/):YP(t)?t:[t];if(l.evenMultiple&&v.length%2!=0)return null;for(var y=[],b=[],x=[],S=``,C=!1,w=0;w<v.length;w++){var T=i.parse(e,v[w],n,`multiple`);C||=qP(T.value),y.push(T.value),x.push(T.pfValue==null?T.value:T.pfValue),b.push(T.units),S+=(w>0?` `:``)+T.strValue}return l.validate&&!l.validate(y,b)?null:l.singleEnum&&C?y.length===1&&qP(y[0])?{name:e,value:y[0],strValue:y[0],bypass:n}:null:{name:e,value:y,pfValue:x,strValue:S,bypass:n,units:b}}var E=function(){for(var r=0;r<l.enums.length;r++)if(l.enums[r]===t)return{name:e,value:t,strValue:``+t,bypass:n};return null};if(l.number){var D,O=`px`;if(l.units&&(D=l.units),l.implicitUnits&&(O=l.implicitUnits),!l.unitless)if(c){var k=`px|em`+(l.allowPercent?`|\\%`:``);D&&(k=D);var A=t.match(`^(`+_F+`)(`+k+`)?$`);A&&(t=A[1],D=A[2]||O)}else (!D||l.implicitUnits)&&(D=O);if(t=parseFloat(t),isNaN(t)&&l.enums===void 0)return null;if(isNaN(t)&&l.enums!==void 0)return t=o,E();if(l.integer&&!QP(t)||l.min!==void 0&&(t<l.min||l.strictMin&&t===l.min)||l.max!==void 0&&(t>l.max||l.strictMax&&t===l.max))return null;var j={name:e,value:t,strValue:``+t+(D||``),units:D,bypass:n};return l.unitless||D!==`px`&&D!==`em`?j.pfValue=t:j.pfValue=D===`px`||!D?t:this.getEmSizeInPixels()*t,(D===`ms`||D===`s`)&&(j.pfValue=D===`ms`?t:1e3*t),(D===`deg`||D===`rad`)&&(j.pfValue=D===`rad`?t:QL(t)),D===`%`&&(j.pfValue=t/100),j}else if(l.propList){var M=[],N=``+t;if(N!==`none`){for(var P=N.split(/\s*,\s*|\s+/),F=0;F<P.length;F++){var I=P[F].trim();i.properties[I]?M.push(I):rL("`"+I+"` is not a valid property name")}if(M.length===0)return null}return{name:e,value:M,strValue:M.length===0?`none`:M.join(` `),bypass:n}}else if(l.color){var L=jF(t);return L?{name:e,value:L,pfValue:L,strValue:`rgb(`+L[0]+`,`+L[1]+`,`+L[2]+`)`,bypass:n}:null}else if(l.regex||l.regexes){if(l.enums){var R=E();if(R)return R}for(var ee=l.regexes?l.regexes:[l.regex],z=0;z<ee.length;z++){var B=new RegExp(ee[z]).exec(t);if(B)return{name:e,value:l.singleRegexMatchValue?B[1]:B,strValue:``+t,bypass:n}}return null}else if(l.string)return{name:e,value:``+t,strValue:``+t,bypass:n};else if(l.enums)return E();else return null};var mK=function(e){if(!(this instanceof mK))return new mK(e);if(!rF(e)){tL(`A style must have a core reference`);return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},hK=mK.prototype;hK.instanceString=function(){return`style`},hK.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach(function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1}),this},hK.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},hK.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},hK.selector=function(e){var t=e===`core`?null:new $U(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},hK.css=function(){var e=this,t=arguments;if(t.length===1)for(var n=t[0],r=0;r<e.properties.length;r++){var i=e.properties[r],a=n[i.name];a===void 0&&(a=n[pF(i.name)]),a!==void 0&&this.cssRule(i.name,a)}else t.length===2&&this.cssRule(t[0],t[1]);return this},hK.style=hK.css,hK.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.name.match(/stripe-(\d+)-background-size/)&&n.value&&(this._private.hasStripe=!0),n.mapped&&this[r].mappedProperties.push(n),this[r].selector||(this._private.coreStyle[n.name]=n)}return this},hK.append=function(e){return iF(e)?e.appendToStyle(this):YP(e)?this.appendFromJson(e):qP(e)&&this.appendFromString(e),this},mK.fromJson=function(e,t){var n=new mK(e);return n.fromJson(t),n},mK.fromString=function(e,t){return new mK(e).fromString(t)},[iK,sK,cK,lK,uK,dK,fK,pK].forEach(function(e){EF(hK,e)}),mK.types=hK.types,mK.properties=hK.properties,mK.propertyGroups=hK.propertyGroups,mK.propertyGroupNames=hK.propertyGroupNames,mK.propertyGroupKeys=hK.propertyGroupKeys;var gK={style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return iF(e)?t.style=e.generateStyle(this):YP(e)?t.style=mK.fromJson(this,e):qP(e)?t.style=mK.fromString(this,e):t.style=mK(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},_K=`single`,vK={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var t=this._private;if(t.selectionType??=_K,e!==void 0)(e===`additive`||e===`single`)&&(t.selectionType=e);else return t.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,t=this._private.pan,n,r,i,a,o;switch(e.length){case 0:return t;case 1:if(qP(e[0]))return n=e[0],t[n];if(XP(e[0])){if(!this._private.panningEnabled)return this;i=e[0],a=i.x,o=i.y,$(a)&&(t.x=a),$(o)&&(t.y=o),this.emit(`pan viewport`)}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],r=e[1],(n===`x`||n===`y`)&&$(r)&&(t[n]=r),this.emit(`pan viewport`);break}return this.notify(`viewport`),this},panBy:function(e,t){var n=arguments,r=this._private.pan,i,a,o,s,c;if(!this._private.panningEnabled)return this;switch(n.length){case 1:XP(e)&&(o=n[0],s=o.x,c=o.y,$(s)&&(r.x+=s),$(c)&&(r.y+=c),this.emit(`pan viewport`));break;case 2:i=e,a=t,(i===`x`||i===`y`)&&$(a)&&(r[i]+=a),this.emit(`pan viewport`);break}return this.notify(`viewport`),this},gc:function(){this.notify(`gc`)},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit(`pan zoom viewport`),this.notify(`viewport`)}return this},getFitViewport:function(e,t){if($(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(qP(e)){var r=e;e=this.$(r)}else if(cF(e)){var i=e;n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else eF(e)||(e=this.mutableElements());if(!(eF(e)&&e.empty())){n||=e.boundingBox();var a=this.width(),o=this.height(),s;if(t=$(t)?t:0,!isNaN(a)&&!isNaN(o)&&a>0&&o>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){s=Math.min((a-2*t)/n.w,(o-2*t)/n.h),s=s>this._private.maxZoom?this._private.maxZoom:s,s=s<this._private.minZoom?this._private.minZoom:s;var c={x:(a-s*(n.x1+n.x2))/2,y:(o-s*(n.y1+n.y2))/2};return{zoom:s,pan:c}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var r=e;e=r.min,t=r.max}return $(e)&&$(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):$(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:$(t)&&e===void 0&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,n=t.pan,r=t.zoom,i,a,o=!1;if(t.zoomingEnabled||(o=!0),$(e)?a=e:XP(e)&&(a=e.level,e.position==null?e.renderedPosition!=null&&(i=e.renderedPosition):i=GL(e.position,r,n),i!=null&&!t.panningEnabled&&(o=!0)),a=a>t.maxZoom?t.maxZoom:a,a=a<t.minZoom?t.minZoom:a,o||!$(a)||a===r||i!=null&&(!$(i.x)||!$(i.y)))return null;if(i!=null){var s=n,c=r,l=a;return{zoomed:!0,panned:!0,zoom:l,pan:{x:-l/c*(i.x-s.x)+i.x,y:-l/c*(i.y-s.y)+i.y}}}else return{zoomed:!0,panned:!1,zoom:a,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t==null||!t.zoomed?this:(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit(`zoom`+(t.panned?` pan`:``)+` viewport`),this.notify(`viewport`),this)},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1,o=!1;if(!e||($(e.zoom)||(n=!1),XP(e.pan)||(r=!1),!n&&!r))return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push(`zoom`))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var c=e.pan;$(c.x)&&(t.pan.x=c.x,o=!1),$(c.y)&&(t.pan.y=c.y,o=!1),o||i.push(`pan`)}return i.length>0&&(i.push(`viewport`),this.emit(i.join(` `)),this.notify(`viewport`)),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit(`pan viewport`),this.notify(`viewport`)),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(qP(e)){var n=e;e=this.mutableElements().filter(n)}else eF(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),i=this.width(),a=this.height();return t=t===void 0?this._private.zoom:t,{x:(i-t*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled||this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?function(){var e=n.window().getComputedStyle(t),r=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-r(`padding-left`)-r(`padding-right`),height:t.clientHeight-r(`padding-top`)-r(`padding-bottom`)}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};vK.centre=vK.center,vK.autolockNodes=vK.autolock,vK.autoungrabifyNodes=vK.autoungrabify;var yK={data:kU.data({field:`data`,bindingEvent:`data`,allowBinding:!0,allowSetting:!0,settingEvent:`data`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeData:kU.removeData({field:`data`,event:`data`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0}),scratch:kU.data({field:`scratch`,bindingEvent:`scratch`,allowBinding:!0,allowSetting:!0,settingEvent:`scratch`,settingTriggersEvent:!0,triggerFnName:`trigger`,allowGetting:!0,updateStyle:!0}),removeScratch:kU.removeData({field:`scratch`,event:`scratch`,triggerFnName:`trigger`,triggerEvent:!0,updateStyle:!0})};yK.attr=yK.data,yK.removeAttr=yK.removeData;var bK=function(e){var t=this;e=EF({},e);var n=e.container;n&&!$P(n)&&$P(n[0])&&(n=n[0]);var r=n?n._cyreg:null;r||={},r&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=BP!==void 0&&n!==void 0&&!e.headless,o=e;o.layout=EF({name:a?`grid`:`null`},o.layout),o.renderer=EF({name:a?`canvas`:`null`},o.renderer);var s=function(e,t,n){return t===void 0?n===void 0?e:n:t},c=this._private={container:n,ready:!1,options:o,elements:new PG(this),listeners:[],aniEles:new PG(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?a:o.styleEnabled,zoom:$(o.zoom)?o.zoom:1,pan:{x:XP(o.pan)&&$(o.pan.x)?o.pan.x:0,y:XP(o.pan)&&$(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var l=function(e,t){if(e.some(lF))return kB.all(e).then(t);t(e)};c.styleEnabled&&t.setStyle([]);var u=EF({},o,o.renderer);t.initRenderer(u);var d=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),e!=null&&(XP(e)||YP(e))&&t.add(e),t.one(`layoutready`,function(e){t.notifications(!0),t.emit(e),t.one(`load`,n),t.emitAndNotify(`load`)}).one(`layoutstop`,function(){t.one(`done`,r),t.emit(`done`)});var a=EF({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};l([o.style,o.elements],function(e){var n=e[0],a=e[1];c.styleEnabled&&t.style().append(n),d(a,function(){t.startAnimationLoop(),c.ready=!0,JP(o.ready)&&t.on(`ready`,o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on(`ready`,n)}r&&(r.readies=[]),t.emit(`ready`)},o.done)})},xK=bK.prototype;EF(xK,{instanceString:function(){return`core`},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit(`ready`,[],e):this.on(`ready`,e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit(`destroy`),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){if(this._private.container==null)return BP;var e=this._private.container.ownerDocument;return e===void 0||e==null?BP:e.defaultView||BP},mount:function(e){if(e!=null){var t=this,n=t._private,r=n.options;return!$P(e)&&$P(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(EF({},r,r.renderer,{name:r.renderer.name===`null`?`canvas`:r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit(`mount`),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:`null`}),e.emit(`unmount`),e},options:function(){return aL(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements(),i=function(e){return t.getElementById(e.id())};if(XP(e)){if(t.startBatch(),e.elements){var a={},o=function(e,n){for(var r=[],i=[],o=0;o<e.length;o++){var s=e[o];if(!s.data.id){rL(`cy.json() cannot handle elements without an ID attribute`);continue}var c=``+s.data.id,l=t.getElementById(c);a[c]=!0,l.length===0?(n&&(s.group=n),r.push(s)):i.push({ele:l,json:s})}t.add(r);for(var u=0;u<i.length;u++){var d=i[u],f=d.ele,p=d.json;f.json(p)}};if(YP(e.elements))o(e.elements);else for(var s=[`nodes`,`edges`],c=0;c<s.length;c++){var l=s[c],u=e.elements[l];YP(u)&&o(u,l)}var d=t.collection();r.filter(function(e){return!a[e.id()]}).forEach(function(e){e.isParent()?d.merge(e):e.remove()}),d.forEach(function(e){return e.children().move({parent:null})}),d.forEach(function(e){return i(e).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var f=[`minZoom`,`maxZoom`,`zoomingEnabled`,`userZoomingEnabled`,`panningEnabled`,`userPanningEnabled`,`boxSelectionEnabled`,`autolock`,`autoungrabify`,`autounselectify`,`multiClickDebounceTime`],p=0;p<f.length;p++){var m=f[p];e[m]!=null&&t[m](e[m])}return t.endBatch(),this}else{var h=!!e,g={};h?g.elements=this.elements().map(function(e){return e.json()}):(g.elements={},r.forEach(function(e){var t=e.group();g.elements[t]||(g.elements[t]=[]),g.elements[t].push(e.json())})),this._private.styleEnabled&&(g.style=t.style().json()),g.data=aL(t.data());var _=n.options;return g.zoomingEnabled=n.zoomingEnabled,g.userZoomingEnabled=n.userZoomingEnabled,g.zoom=n.zoom,g.minZoom=n.minZoom,g.maxZoom=n.maxZoom,g.panningEnabled=n.panningEnabled,g.userPanningEnabled=n.userPanningEnabled,g.pan=aL(n.pan),g.boxSelectionEnabled=n.boxSelectionEnabled,g.renderer=aL(_.renderer),g.hideEdgesOnViewport=_.hideEdgesOnViewport,g.textureOnViewport=_.textureOnViewport,g.wheelSensitivity=_.wheelSensitivity,g.motionBlur=_.motionBlur,g.multiClickDebounceTime=_.multiClickDebounceTime,g}}}),xK.$id=xK.getElementById,[IG,JG,ZG,QG,$G,eK,nK,rK,gK,vK,yK].forEach(function(e){EF(xK,e)});var SK={fit:!0,directed:!1,direction:`downward`,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},CK={maximal:!1,acyclic:!1},wK=function(e){return e.scratch(`breadthfirst`)},TK=function(e,t){return e.scratch(`breadthfirst`,t)};function EK(e){this.options=EF({},SK,CK,e)}EK.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().filter(function(e){return e.isChildless()}),i=n,a=e.directed,o=e.acyclic||e.maximal||e.maximalAdjustments>0,s=!!e.boundingBox,c=lR(s?e.boundingBox:structuredClone(t.extent())),l;if(eF(e.roots))l=e.roots;else if(YP(e.roots)){for(var u=[],d=0;d<e.roots.length;d++){var f=e.roots[d],p=t.getElementById(f);u.push(p)}l=t.collection(u)}else if(qP(e.roots))l=t.$(e.roots);else if(a)l=r.roots();else{var m=n.components();l=t.collection();for(var h=function(){var e=m[g],t=e.maxDegree(!1),n=e.filter(function(e){return e.degree(!1)===t});l=l.add(n)},g=0;g<m.length;g++)h()}var _=[],v={},y=function(e,t){_[t]??(_[t]=[]);var n=_[t].length;_[t].push(e),TK(e,{index:n,depth:t})},b=function(e,t){var n=wK(e),r=n.depth,i=n.index;_[r][i]=null,e.isChildless()&&y(e,t)};i.bfs({roots:l,directed:e.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();a.isChildless()&&y(a,i),v[o]=!0}});for(var x=[],S=0;S<r.length;S++){var C=r[S];v[C.id()]||x.push(C)}var w=function(e){for(var t=_[e],n=0;n<t.length;n++){var r=t[n];if(r==null){t.splice(n,1),n--;continue}TK(r,{depth:e,index:n})}},T=function(t,r){for(var i=wK(t),a=t.incomers().filter(function(e){return e.isNode()&&n.has(e)}),o=-1,s=t.id(),c=0;c<a.length;c++){var l=a[c],u=wK(l);o=Math.max(o,u.depth)}if(i.depth<=o){if(!e.acyclic&&r[s])return null;var d=o+1;return b(t,d),r[s]=d,!0}return!1};if(a&&o){var E=[],D={},O=function(e){return E.push(e)},k=function(){return E.shift()};for(r.forEach(function(e){return E.push(e)});E.length>0;){var A=k(),j=T(A,D);if(j)A.outgoers().filter(function(e){return e.isNode()&&n.has(e)}).forEach(O);else if(j===null){rL("Detected double maximal shift for node `"+A.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var M=0;if(e.avoidOverlap)for(var N=0;N<r.length;N++){var P=r[N].layoutDimensions(e),F=P.w,I=P.h;M=Math.max(M,F,I)}var L={},R=function(e){if(L[e.id()])return L[e.id()];for(var t=wK(e).depth,n=e.neighborhood(),i=0,a=0,o=0;o<n.length;o++){var s=n[o];if(!(s.isEdge()||s.isParent()||!r.has(s))){var c=wK(s);if(c!=null){var l=c.index,u=c.depth;if(!(l==null||u==null)){var d=_[u].length;u<t&&(i+=l/d,a++)}}}}return a=Math.max(1,a),i/=a,a===0&&(i=0),L[e.id()]=i,i},ee=function(e,t){var n=R(e)-R(t);return n===0?wF(e.id(),t.id()):n};e.depthSort!==void 0&&(ee=e.depthSort);for(var z=_.length,B=0;B<z;B++)_[B].sort(ee),w(B);for(var V=[],H=0;H<x.length;H++)V.push(x[H]);V.length&&(_.unshift(V),z=_.length,function(){for(var e=0;e<z;e++)w(e)}());for(var te=0,ne=0;ne<z;ne++)te=Math.max(_[ne].length,te);var U={x:c.x1+c.w/2,y:c.y1+c.h/2},re=r.reduce(function(t,n){return function(e){return{w:t.w===-1?e.w:(t.w+e.w)/2,h:t.h===-1?e.h:(t.h+e.h)/2}}(n.boundingBox({includeLabels:e.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),ie=Math.max(z===1?0:s?(c.h-e.padding*2-re.h)/(z-1):(c.h-e.padding*2-re.h)/(z+1),M),ae=_.reduce(function(e,t){return Math.max(e,t.length)},0),oe=function(t){var n=wK(t),r=n.depth,i=n.index;if(e.circle){var a=Math.min(c.w/2/z,c.h/2/z);a=Math.max(a,M);var o=a*r+a-(z>0&&_[0].length<=3?a/2:0),l=2*Math.PI/_[r].length*i;return r===0&&_[0].length===1&&(o=1),{x:U.x+o*Math.cos(l),y:U.y+o*Math.sin(l)}}else{var u=_[r].length,d=Math.max(u===1?0:s?(c.w-e.padding*2-re.w)/((e.grid?ae:u)-1):(c.w-e.padding*2-re.w)/((e.grid?ae:u)+1),M);return{x:U.x+(i+1-(u+1)/2)*d,y:U.y+(r+1-(z+1)/2)*ie}}},se={downward:0,leftward:90,upward:180,rightward:-90};return Object.keys(se).indexOf(e.direction)===-1&&tL(`Invalid direction '${e.direction}' specified for breadthfirst layout. Valid values are: ${Object.keys(se).join(`, `)}`),n.nodes().layoutPositions(this,e,function(t){return KI(oe(t),c,se[e.direction])}),this};var DK={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function OK(e){this.options=EF({},DK,e)}OK.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=t.counterclockwise===void 0?t.clockwise:!t.counterclockwise,a=r.nodes().not(`:parent`);t.sort&&(a=a.sort(t.sort));for(var o=lR(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},c=(t.sweep===void 0?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),l,u=0,d=0;d<a.length;d++){var f=a[d].layoutDimensions(t),p=f.w,m=f.h;u=Math.max(u,p,m)}if(l=$(t.radius)?t.radius:a.length<=1?0:Math.min(o.h,o.w)/2-u,a.length>1&&t.avoidOverlap){u*=1.75;var h=Math.cos(c)-Math.cos(0),g=Math.sin(c)-Math.sin(0),_=Math.sqrt(u*u/(h*h+g*g));l=Math.max(_,l)}return r.nodes().layoutPositions(this,t,function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=l*Math.cos(r),o=l*Math.sin(r);return{x:s.x+a,y:s.y+o}}),this};var kK={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function AK(e){this.options=EF({},kK,e)}AK.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise===void 0?t.clockwise:!t.counterclockwise,r=e.cy,i=t.eles,a=i.nodes().not(`:parent`),o=lR(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},c=[],l=0,u=0;u<a.length;u++){var d=a[u],f=void 0;f=t.concentric(d),c.push({value:f,node:d}),d._private.scratch.concentric=f}a.updateStyle();for(var p=0;p<a.length;p++){var m=a[p].layoutDimensions(t);l=Math.max(l,m.w,m.h)}c.sort(function(e,t){return t.value-e.value});for(var h=t.levelWidth(a),g=[[]],_=g[0],v=0;v<c.length;v++){var y=c[v];_.length>0&&Math.abs(_[0].value-y.value)>=h&&(_=[],g.push(_)),_.push(y)}var b=l+t.minNodeSpacing;if(!t.avoidOverlap){var x=g.length>0&&g[0].length>1,S=(Math.min(o.w,o.h)/2-b)/(g.length+x?1:0);b=Math.min(b,S)}for(var C=0,w=0;w<g.length;w++){var T=g[w],E=T.dTheta=(t.sweep===void 0?2*Math.PI-2*Math.PI/T.length:t.sweep)/Math.max(1,T.length-1);if(T.length>1&&t.avoidOverlap){var D=Math.cos(E)-Math.cos(0),O=Math.sin(E)-Math.sin(0),k=Math.sqrt(b*b/(D*D+O*O));C=Math.max(k,C)}T.r=C,C+=b}if(t.equidistant){for(var A=0,j=0,M=0;M<g.length;M++){var N=g[M].r-j;A=Math.max(A,N)}j=0;for(var P=0;P<g.length;P++){var F=g[P];P===0&&(j=F.r),F.r=j,j+=A}}for(var I={},L=0;L<g.length;L++)for(var R=g[L],ee=R.dTheta,z=R.r,B=0;B<R.length;B++){var V=R[B],H=t.startAngle+(n?1:-1)*ee*B,te={x:s.x+z*Math.cos(H),y:s.y+z*Math.sin(H)};I[V.node.id()]=te}return i.nodes().layoutPositions(this,t,function(e){return I[e.id()]}),this};var jK,MK={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function NK(e){this.options=EF({},MK,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges().filter(function(e){var n=e.source().data(`id`),r=e.target().data(`id`),i=t.some(function(e){return e.data(`id`)===n}),a=t.some(function(e){return e.data(`id`)===r});return!i||!a});this.options.eles=this.options.eles.not(n)}NK.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(e.animate===!0||e.animate===!1)&&n.emit({type:`layoutstart`,layout:n}),jK=!0===e.debug;var r=PK(t,n,e);jK&&LK(r),e.randomize&&RK(r);var i=AI(),a=function(){BK(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter||(VK(r,e),r.temperature*=e.coolingFactor,r.temperature<e.minTemp))},s=function(){if(e.animate===!0||e.animate===!1)a(),n.one(`layoutstop`,e.stop),n.emit({type:`layoutstop`,layout:n});else{var t=e.eles.nodes(),i=zK(r,e,t);t.layoutPositions(n,e,i)}},c=0,l=!0;if(e.animate===!0){var u=function(){for(var t=0;l&&t<e.refresh;)l=o(c),c++,t++;l?(AI()-i>=e.animationThreshold&&a(),kI(u)):($K(r,e),s())};u()}else{for(;l;)l=o(c),c++;$K(r,e),s()}return this},NK.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit(`layoutstop`),this},NK.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var PK=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=lR(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),c={},l=0;l<s.length;l++)for(var u=s[l],d=0;d<u.length;d++){var f=u[d];c[f.id()]=l}for(var l=0;l<o.nodeSize;l++){var p=i[l],m=p.layoutDimensions(n),h={};h.isLocked=p.locked(),h.id=p.data(`id`),h.parentId=p.data(`parent`),h.cmptId=c[p.id()],h.children=[],h.positionX=p.position(`x`),h.positionY=p.position(`y`),h.offsetX=0,h.offsetY=0,h.height=m.w,h.width=m.h,h.maxX=h.positionX+h.width/2,h.minX=h.positionX-h.width/2,h.maxY=h.positionY+h.height/2,h.minY=h.positionY-h.height/2,h.padLeft=parseFloat(p.style(`padding`)),h.padRight=parseFloat(p.style(`padding`)),h.padTop=parseFloat(p.style(`padding`)),h.padBottom=parseFloat(p.style(`padding`)),h.nodeRepulsion=JP(n.nodeRepulsion)?n.nodeRepulsion(p):n.nodeRepulsion,o.layoutNodes.push(h),o.idToIndex[h.id]=l}for(var g=[],_=0,v=-1,y=[],l=0;l<o.nodeSize;l++){var p=o.layoutNodes[l],b=p.parentId;b==null?(g[++v]=p.id,y.push(p.id)):o.layoutNodes[o.idToIndex[b]].children.push(p.id)}for(o.graphSet.push(y);_<=v;){var x=g[_++],S=o.idToIndex[x],f=o.layoutNodes[S],C=f.children;if(C.length>0){o.graphSet.push(C);for(var l=0;l<C.length;l++)g[++v]=C[l]}}for(var l=0;l<o.graphSet.length;l++)for(var w=o.graphSet[l],d=0;d<w.length;d++){var T=o.idToIndex[w[d]];o.indexToGraph[T]=l}for(var l=0;l<o.edgeSize;l++){var E=r[l],D={};D.id=E.data(`id`),D.sourceId=E.data(`source`),D.targetId=E.data(`target`);var O=JP(n.idealEdgeLength)?n.idealEdgeLength(E):n.idealEdgeLength,k=JP(n.edgeElasticity)?n.edgeElasticity(E):n.edgeElasticity,A=o.idToIndex[D.sourceId],j=o.idToIndex[D.targetId];if(o.indexToGraph[A]!=o.indexToGraph[j]){for(var M=FK(D.sourceId,D.targetId,o),N=o.graphSet[M],P=0,h=o.layoutNodes[A];N.indexOf(h.id)===-1;)h=o.layoutNodes[o.idToIndex[h.parentId]],P++;for(h=o.layoutNodes[j];N.indexOf(h.id)===-1;)h=o.layoutNodes[o.idToIndex[h.parentId]],P++;O*=P*n.nestingFactor}D.idealLength=O,D.elasticity=k,o.layoutEdges.push(D)}return o},FK=function(e,t,n){var r=IK(e,t,0,n);return 2>r.count?0:r.graph},IK=function(e,t,n,r){var i=r.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var a=0,o=0;o<i.length;o++){var s=i[o],c=r.idToIndex[s],l=r.layoutNodes[c].children;if(l.length!==0){var u=r.indexToGraph[r.idToIndex[l[0]]],d=IK(e,t,u,r);if(d.count!==0)if(d.count===1){if(a++,a===2)break}else return d}}return{count:a,graph:n}},LK,RK=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];a.children.length===0&&!a.isLocked&&(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},zK=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(t){var n=e.layoutNodes[e.idToIndex[t.data(`id`)]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data(`id`)]];if(t.boundingBox){var s=i.w===0?.5:(o.positionX-i.x1)/i.w,c=i.h===0?.5:(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+c*r.h}}else return{x:o.positionX,y:o.positionY}}},BK=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=zK(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one(`layoutready`,n.ready),r.emit({type:`layoutready`,layout:this}))},VK=function(e,t,n){HK(e,t),qK(e),JK(e,t),YK(e),XK(e)},HK=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++){var c=e.layoutNodes[e.idToIndex[r[s]]];WK(o,c,e,t)}},UK=function(e){return-1+2*e*Math.random()},WK=function(e,t,n,r){if(!(e.cmptId!==t.cmptId&&!n.isCompound)){var i=t.positionX-e.positionX,a=t.positionY-e.positionY,o=1;i===0&&a===0&&(i=UK(o),a=UK(o));var s=GK(e,t,i,a);if(s>0)var c=r.nodeOverlap*s,l=Math.sqrt(i*i+a*a),u=c*i/l,d=c*a/l;else var f=KK(e,i,a),p=KK(t,-1*i,-1*a),m=p.x-f.x,h=p.y-f.y,g=m*m+h*h,l=Math.sqrt(g),c=(e.nodeRepulsion+t.nodeRepulsion)/g,u=c*m/l,d=c*h/l;e.isLocked||(e.offsetX-=u,e.offsetY-=d),t.isLocked||(t.offsetX+=u,t.offsetY+=d)}},GK=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},KK=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,c=a/o,l={};return t===0&&0<n||t===0&&0>n?(l.x=r,l.y=i+a/2,l):0<t&&-1*c<=s&&s<=c?(l.x=r+o/2,l.y=i+o*n/2/t,l):0>t&&-1*c<=s&&s<=c?(l.x=r-o/2,l.y=i-o*n/2/t,l):0<n&&(s<=-1*c||s>=c)?(l.x=r+a*t/2/n,l.y=i+a/2,l):0>n&&(s<=-1*c||s>=c)?(l.x=r-a*t/2/n,l.y=i-a/2,l):l},qK=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],c=s.positionX-a.positionX,l=s.positionY-a.positionY;if(!(c===0&&l===0)){var u=KK(a,c,l),d=KK(s,-1*c,-1*l),f=d.x-u.x,p=d.y-u.y,m=Math.sqrt(f*f+p*p),h=(r.idealLength-m)**2/r.elasticity;if(m!==0)var g=h*f/m,_=h*p/m;else var g=0,_=0;a.isLocked||(a.offsetX+=g,a.offsetY+=_),s.isLocked||(s.offsetX-=g,s.offsetY-=_)}}},JK=function(e,t){if(t.gravity!==0)for(var n=1,r=0;r<e.graphSet.length;r++){var i=e.graphSet[r],a=i.length;if(r===0)var o=e.clientHeight/2,s=e.clientWidth/2;else var c=e.layoutNodes[e.idToIndex[i[0]]],l=e.layoutNodes[e.idToIndex[c.parentId]],o=l.positionX,s=l.positionY;for(var u=0;u<a;u++){var d=e.layoutNodes[e.idToIndex[i[u]]];if(!d.isLocked){var f=o-d.positionX,p=s-d.positionY,m=Math.sqrt(f*f+p*p);if(m>n){var h=t.gravity*f/m,g=t.gravity*p/m;d.offsetX+=h,d.offsetY+=g}}}}},YK=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],c=s.children;if(0<c.length&&!s.isLocked){for(var l=s.offsetX,u=s.offsetY,d=0;d<c.length;d++){var f=e.layoutNodes[e.idToIndex[c[d]]];f.offsetX+=l,f.offsetY+=u,n[++i]=c[d]}s.offsetX=0,s.offsetY=0}}},XK=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];if(!(0<r.children.length||r.isLocked)){var i=ZK(r.offsetX,r.offsetY,e.temperature);r.positionX+=i.x,r.positionY+=i.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,QK(r,e)}}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},ZK=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},QK=function(e,t){var n=e.parentId;if(n!=null){var r=t.layoutNodes[t.idToIndex[n]],i=!1;if((r.maxX==null||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,i=!0),(r.minX==null||e.minX-r.padLeft<r.minX)&&(r.minX=e.minX-r.padLeft,i=!0),(r.maxY==null||e.maxY+r.padBottom>r.maxY)&&(r.maxY=e.maxY+r.padBottom,i=!0),(r.minY==null||e.minY-r.padTop<r.minY)&&(r.minY=e.minY-r.padTop,i=!0),i)return QK(r,t)}},$K=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}for(var s=0,i=0;i<r.length;i++){var c=r[i];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var l=0;l<c.length;l++){var u=c[l];c.x1=Math.min(c.x1,u.positionX-u.width/2),c.x2=Math.max(c.x2,u.positionX+u.width/2),c.y1=Math.min(c.y1,u.positionY-u.height/2),c.y2=Math.max(c.y2,u.positionY+u.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,s+=c.w*c.h}}r.sort(function(e,t){return t.w*t.h-e.w*e.h});for(var d=0,f=0,p=0,m=0,h=Math.sqrt(s)*e.clientWidth/e.clientHeight,i=0;i<r.length;i++){var c=r[i];if(c){for(var l=0;l<c.length;l++){var u=c[l];u.isLocked||(u.positionX+=d-c.x1,u.positionY+=f-c.y1)}d+=c.w+t.componentSpacing,p+=c.w+t.componentSpacing,m=Math.max(m,c.h),p>h&&(f+=m+t.componentSpacing,d=0,p=0,m=0)}}},eq={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function tq(e){this.options=EF({},eq,e)}tq.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(`:parent`);t.sort&&(i=i.sort(t.sort));var a=lR(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(a.h===0||a.w===0)r.nodes().layoutPositions(this,t,function(e){return{x:a.x1,y:a.y1}});else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),c=Math.round(s),l=Math.round(a.w/a.h*s),u=function(e){if(e==null)return Math.min(c,l);Math.min(c,l)==c?c=e:l=e},d=function(e){if(e==null)return Math.max(c,l);Math.max(c,l)==c?c=e:l=e},f=t.rows,p=t.cols==null?t.columns:t.cols;if(f!=null&&p!=null)c=f,l=p;else if(f!=null&&p==null)c=f,l=Math.ceil(o/c);else if(f==null&&p!=null)l=p,c=Math.ceil(o/l);else if(l*c>o){var m=u(),h=d();(m-1)*h>=o?u(m-1):(h-1)*m>=o&&d(h-1)}else for(;l*c<o;){var g=u(),_=d();(_+1)*g>=o?d(_+1):u(g+1)}var v=a.w/l,y=a.h/c;if(t.condense&&(v=0,y=0),t.avoidOverlap)for(var b=0;b<i.length;b++){var x=i[b],S=x._private.position;(S.x==null||S.y==null)&&(S.x=0,S.y=0);var C=x.layoutDimensions(t),w=t.avoidOverlapPadding,T=C.w+w,E=C.h+w;v=Math.max(v,T),y=Math.max(y,E)}for(var D={},O=function(e,t){return!!D[`c-`+e+`-`+t]},k=function(e,t){D[`c-`+e+`-`+t]=!0},A=0,j=0,M=function(){j++,j>=l&&(j=0,A++)},N={},P=0;P<i.length;P++){var F=i[P],I=t.position(F);if(I&&(I.row!==void 0||I.col!==void 0)){var L={row:I.row,col:I.col};if(L.col===void 0)for(L.col=0;O(L.row,L.col);)L.col++;else if(L.row===void 0)for(L.row=0;O(L.row,L.col);)L.row++;N[F.id()]=L,k(L.row,L.col)}}i.layoutPositions(this,t,function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var i=N[e.id()];if(i)n=i.col*v+v/2+a.x1,r=i.row*y+y/2+a.y1;else{for(;O(A,j);)M();n=j*v+v/2+a.x1,r=A*y+y/2+a.y1,k(A,j),M()}return{x:n,y:r}})}return this};var nq={ready:function(){},stop:function(){}};function rq(e){this.options=EF({},nq,e)}rq.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit(`layoutstart`),t.nodes().positions(function(){return{x:0,y:0}}),n.one(`layoutready`,e.ready),n.emit(`layoutready`),n.one(`layoutstop`,e.stop),n.emit(`layoutstop`),this},rq.prototype.stop=function(){return this};var iq={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function aq(e){this.options=EF({},iq,e)}aq.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=JP(e.positions);function r(t){return e.positions==null?WL(t.position()):n?e.positions(t):e.positions[t._private.data.id]??null}return t.layoutPositions(this,e,function(e,t){var n=r(e);return e.locked()||n==null?!1:n}),this};var oq={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function sq(e){this.options=EF({},oq,e)}sq.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=lR(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.nodes().layoutPositions(this,e,function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}}),this};var cq=[{name:`breadthfirst`,impl:EK},{name:`circle`,impl:OK},{name:`concentric`,impl:AK},{name:`cose`,impl:NK},{name:`grid`,impl:tq},{name:`null`,impl:rq},{name:`preset`,impl:aq},{name:`random`,impl:sq}];function lq(e){this.options=e,this.notifications=0}var uq=function(){},dq=function(){throw Error(`A headless instance can not render images`)};lq.prototype={recalculateRenderedStyle:uq,notify:function(){this.notifications++},init:uq,isHeadless:function(){return!0},png:dq,jpg:dq};var fq={};fq.arrowShapeWidth=.3,fq.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,c=i.x+n/2+o,l=i.y-n/2-o,u=i.y+n/2+o;return s<=e&&e<=c&&l<=t&&t<=u},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=e*Math.sin(r)+t*Math.cos(r),s=a*n,c=o*n;return{x:s+i.x,y:c+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],c=e[o+1];a.push(r(s,c,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).pfValue*2},s=function(r,s){qP(s)&&(s=e[s]),e[r]=EF({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){return jR(e,t,a(i(this.points,n+2*s,r,o)))},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl(`polygon`)(e,o)},spacing:function(e){return 0},gap:o},s)};s(`none`,{collide:QI,roughCollide:QI,draw:eL,spacing:$I,gap:$I}),s(`triangle`,{points:[-.15,-.3,0,0,.15,-.3]}),s(`arrow`,`triangle`),s(`triangle-backcurve`,{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var c=i(this.points,n,a,o),l=this.controlPoint,u=r(l[0],l[1],n,a,o);t.arrowShapeImpl(this.name)(e,c,u)},gap:function(e){return o(e)*.8}}),s(`triangle-tee`,{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,c){var l=a(i(this.points,n+2*c,r,o)),u=a(i(this.pointsTee,n+2*c,r,o));return jR(e,t,l)||jR(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),c=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,c)}}),s(`circle-triangle`,{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,r,o,s,c){var l=o,u=(l.x-e)**2+(l.y-t)**2<=((n+2*c)*this.radius)**2;return jR(e,t,a(i(this.points,n+2*c,r,o)))||u},draw:function(e,n,r,a,o){var s=i(this.pointsTr,n,r,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.radius}}),s(`triangle-cross`,{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e,i=3,a=5;return n[i]=n[i]-r,n[a]=n[a]-r,n},collide:function(e,t,n,r,o,s,c){var l=a(i(this.points,n+2*c,r,o)),u=a(i(this.crossLinePts(n,s),n+2*c,r,o));return jR(e,t,l)||jR(e,t,u)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),c=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,c)}}),s(`vee`,{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return o(e)*.525}}),s(`circle`,{radius:.15,collide:function(e,t,n,r,i,a,o){var s=i;return(s.x-e)**2+(s.y-t)**2<=((n+2*o)*this.radius)**2},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.radius}}),s(`tee`,{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s(`square`,{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s(`diamond`,{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).value}}),s(`chevron`,{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return .95*e.pstyle(`width`).pfValue*e.pstyle(`arrow-scale`).value}})};var pq={};pq.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),c=n.zoom();return[((e-i)/o-s.x)/c,((t-a)/o-s.y)/c]},pq.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i={left:r(`padding-left`),right:r(`padding-right`),top:r(`padding-top`),bottom:r(`padding-bottom`)},a={left:r(`border-left-width`),right:r(`border-right-width`),top:r(`border-top-width`),bottom:r(`border-bottom-width`)},o=e.clientWidth,s=e.clientHeight,c=i.left+i.right,l=i.top+i.bottom,u=a.left+a.right,d=t.width/(o+u),f=o-c,p=s-l,m=t.left+i.left+a.left,h=t.top+i.top+a.top;return this.containerBB=[m,h,f,p,d]},pq.invalidateContainerClientCoordsCache=function(){this.containerBB=null},pq.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},pq.findNearestElements=function(e,t,n,r){var i=this,a=this,o=a.getCachedZSortedEles(),s=[],c=a.cy.zoom(),l=a.cy.hasCompoundNodes(),u=(r?24:8)/c,d=(r?8:2)/c,f=(r?8:2)/c,p=1/0,m,h;n&&(o=o.interactive);function g(e,t){if(e.isNode()){if(h)return;h=e,s.push(e)}if(e.isEdge()&&(t==null||t<p))if(m){if(m.pstyle(`z-compound-depth`).value===e.pstyle(`z-compound-depth`).value&&m.pstyle(`z-compound-depth`).value===e.pstyle(`z-compound-depth`).value){for(var n=0;n<s.length;n++)if(s[n].isEdge()){s[n]=e,m=e,p=t??p;break}}}else s.push(e),m=e,p=t??p}function _(n){var r=n.outerWidth()+2*d,o=n.outerHeight()+2*d,s=r/2,c=o/2,l=n.position(),u=n.pstyle(`corner-radius`).value===`auto`?`auto`:n.pstyle(`corner-radius`).pfValue,f=n._private.rscratch;if(l.x-s<=e&&e<=l.x+s&&l.y-c<=t&&t<=l.y+c&&a.nodeShapes[i.getNodeShape(n)].checkPoint(e,t,0,r,o,l.x,l.y,u,f))return g(n,0),!0}function v(n){var r=n._private,o=r.rscratch,c=n.pstyle(`width`).pfValue,d=n.pstyle(`arrow-scale`).value,f=c/2+u,p=f*f,m=f*2,h=r.source,v=r.target,y;if(o.edgeType===`segments`||o.edgeType===`straight`||o.edgeType===`haystack`){for(var b=o.allpts,x=0;x+3<b.length;x+=2)if(TR(e,t,b[x],b[x+1],b[x+2],b[x+3],m)&&p>(y=AR(e,t,b[x],b[x+1],b[x+2],b[x+3])))return g(n,y),!0}else if(o.edgeType===`bezier`||o.edgeType===`multibezier`||o.edgeType===`self`||o.edgeType===`compound`){for(var b=o.allpts,x=0;x+5<o.allpts.length;x+=4)if(ER(e,t,b[x],b[x+1],b[x+2],b[x+3],b[x+4],b[x+5],m)&&p>(y=kR(e,t,b[x],b[x+1],b[x+2],b[x+3],b[x+4],b[x+5])))return g(n,y),!0}for(var h=h||r.source,v=v||r.target,S=i.getArrowWidth(c,d),C=[{name:`source`,x:o.arrowStartX,y:o.arrowStartY,angle:o.srcArrowAngle},{name:`target`,x:o.arrowEndX,y:o.arrowEndY,angle:o.tgtArrowAngle},{name:`mid-source`,x:o.midX,y:o.midY,angle:o.midsrcArrowAngle},{name:`mid-target`,x:o.midX,y:o.midY,angle:o.midtgtArrowAngle}],x=0;x<C.length;x++){var w=C[x],T=a.arrowShapes[n.pstyle(w.name+`-arrow-shape`).value],E=n.pstyle(`width`).pfValue;if(T.roughCollide(e,t,S,w.angle,{x:w.x,y:w.y},E,u)&&T.collide(e,t,S,w.angle,{x:w.x,y:w.y},E,u))return g(n),!0}l&&s.length>0&&(_(h),_(v))}function y(e,t,n){return mL(e,t,n)}function b(n,r){var i=n._private,a=f,o=r?r+`-`:``;n.boundingBox();var s=i.labelBounds[r||`main`],c=n.pstyle(o+`label`).value;if(!(n.pstyle(`text-events`).strValue!==`yes`||!c)){var l=y(i.rscratch,`labelX`,r),u=y(i.rscratch,`labelY`,r),d=y(i.rscratch,`labelAngle`,r),p=n.pstyle(o+`text-margin-x`).pfValue,m=n.pstyle(o+`text-margin-y`).pfValue,h=s.x1-a-p,_=s.x2+a-p,v=s.y1-a-m,b=s.y2+a-m;if(d){var x=Math.cos(d),S=Math.sin(d),C=function(e,t){return e-=l,t-=u,{x:e*x-t*S+l,y:e*S+t*x+u}},w=C(h,v),T=C(h,b),E=C(_,v),D=C(_,b);if(jR(e,t,[w.x+p,w.y+m,E.x+p,E.y+m,D.x+p,D.y+m,T.x+p,T.y+m]))return g(n),!0}else if(vR(s,e,t))return g(n),!0}}for(var x=o.length-1;x>=0;x--){var S=o[x];S.isNode()?_(S)||b(S):v(S)||b(S)||b(S,`source`)||b(S,`target`)}return s},pq.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=2/this.cy.zoom(),o=[],s=Math.min(e,n),c=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r);e=s,n=c,t=l,r=u;var d=lR({x1:e,y1:t,x2:n,y2:r}),f=[{x:d.x1,y:d.y1},{x:d.x2,y:d.y1},{x:d.x2,y:d.y2},{x:d.x1,y:d.y2}],p=[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]],[f[3],f[0]]];function m(e,t,n){return mL(e,t,n)}function h(e,t){var n=e._private,r=a,i=``;e.boundingBox();var o=n.labelBounds.main;if(!o)return null;var s=m(n.rscratch,`labelX`,t),c=m(n.rscratch,`labelY`,t),l=m(n.rscratch,`labelAngle`,t),u=e.pstyle(i+`text-margin-x`).pfValue,d=e.pstyle(i+`text-margin-y`).pfValue,f=o.x1-r-u,p=o.x2+r-u,h=o.y1-r-d,g=o.y2+r-d;if(l){var _=Math.cos(l),v=Math.sin(l),y=function(e,t){return e-=s,t-=c,{x:e*_-t*v+s,y:e*v+t*_+c}};return[y(f,h),y(p,h),y(p,g),y(f,g)]}else return[{x:f,y:h},{x:p,y:h},{x:p,y:g},{x:f,y:g}]}function g(e,t,n,r){function i(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return i(e,n,r)!==i(t,n,r)&&i(e,t,n)!==i(e,t,r)}for(var _=0;_<i.length;_++){var v=i[_];if(v.isNode()){var y=v,b=y.pstyle(`text-events`).strValue===`yes`,x=y.pstyle(`box-selection`).strValue,S=y.pstyle(`box-select-labels`).strValue===`yes`;if(x===`none`)continue;var C=(x===`overlap`||S)&&b,w=y.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:C});if(x===`contain`){var T=!1;if(S&&b){var E=h(y);E&&$R(E,f)&&(o.push(y),T=!0)}!T&&bR(d,w)&&o.push(y)}else if(x===`overlap`&&_R(d,w)){var D=y.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1});if($R([{x:D.x1,y:D.y1},{x:D.x2,y:D.y1},{x:D.x2,y:D.y2},{x:D.x1,y:D.y2}],f))o.push(y);else{var O=h(y);O&&$R(O,f)&&o.push(y)}}}else{var k=v,A=k._private,j=A.rscratch,M=k.pstyle(`box-selection`).strValue;if(M===`none`)continue;if(M===`contain`){if(j.startX!=null&&j.startY!=null&&!vR(d,j.startX,j.startY)||j.endX!=null&&j.endY!=null&&!vR(d,j.endX,j.endY))continue;if(j.edgeType===`bezier`||j.edgeType===`multibezier`||j.edgeType===`self`||j.edgeType===`compound`||j.edgeType===`segments`||j.edgeType===`haystack`){for(var N=A.rstyle.bezierPts||A.rstyle.linePts||A.rstyle.haystackPts,P=!0,F=0;F<N.length;F++)if(!yR(d,N[F])){P=!1;break}P&&o.push(k)}else j.edgeType===`straight`&&o.push(k)}else if(M===`overlap`){var I=!1;if(j.startX!=null&&j.startY!=null&&j.endX!=null&&j.endY!=null&&(vR(d,j.startX,j.startY)||vR(d,j.endX,j.endY)))o.push(k),I=!0;else if(!I&&j.edgeType===`haystack`){for(var L=A.rstyle.haystackPts,R=0;R<L.length;R++)if(yR(d,L[R])){o.push(k),I=!0;break}}if(!I){var ee=A.rstyle.bezierPts||A.rstyle.linePts||A.rstyle.haystackPts;if((!ee||ee.length<2)&&j.edgeType===`straight`&&j.startX!=null&&j.startY!=null&&j.endX!=null&&j.endY!=null&&(ee=[{x:j.startX,y:j.startY},{x:j.endX,y:j.endY}]),!ee||ee.length<2)continue;for(var z=0;z<ee.length-1;z++){for(var B=ee[z],V=ee[z+1],H=0;H<p.length;H++){var te=PP(p[H],2),ne=te[0],U=te[1];if(g(B,V,ne,U)){o.push(k),I=!0;break}}if(I)break}}}}}return o};var mq={};mq.calculateArrowAngles=function(e){var t=e._private.rscratch,n=t.edgeType===`haystack`,r=t.edgeType===`bezier`,i=t.edgeType===`multibezier`,a=t.edgeType===`segments`,o=t.edgeType===`compound`,s=t.edgeType===`self`,c,l,u,d,f,p,m,h;if(n?(u=t.haystackPts[0],d=t.haystackPts[1],f=t.haystackPts[2],p=t.haystackPts[3]):(u=t.arrowStartX,d=t.arrowStartY,f=t.arrowEndX,p=t.arrowEndY),m=t.midX,h=t.midY,a)c=u-t.segpts[0],l=d-t.segpts[1];else if(i||o||s||r){var g=t.allpts,_=aR(g[0],g[2],g[4],.1),v=aR(g[1],g[3],g[5],.1);c=u-_,l=d-v}else c=u-m,l=d-h;t.srcArrowAngle=$L(c,l);var m=t.midX,h=t.midY;if(n&&(m=(u+f)/2,h=(d+p)/2),c=f-u,l=p-d,a){var g=t.allpts;if(g.length/2%2==0){var y=g.length/2,b=y-2;c=g[y]-g[b],l=g[y+1]-g[b+1]}else if(t.isRound)c=t.midVector[1],l=-t.midVector[0];else{var y=g.length/2-1,b=y-2;c=g[y]-g[b],l=g[y+1]-g[b+1]}}else if(i||o||s){var g=t.allpts,x=t.ctrlpts,S,C,w,T;if(x.length/2%2==0){var E=g.length/2-1,D=E+2,O=D+2;S=aR(g[E],g[D],g[O],0),C=aR(g[E+1],g[D+1],g[O+1],0),w=aR(g[E],g[D],g[O],1e-4),T=aR(g[E+1],g[D+1],g[O+1],1e-4)}else{var D=g.length/2-1,E=D-2,O=D+2;S=aR(g[E],g[D],g[O],.4999),C=aR(g[E+1],g[D+1],g[O+1],.4999),w=aR(g[E],g[D],g[O],.5),T=aR(g[E+1],g[D+1],g[O+1],.5)}c=w-S,l=T-C}if(t.midtgtArrowAngle=$L(c,l),t.midDispX=c,t.midDispY=l,c*=-1,l*=-1,a){var g=t.allpts;if(g.length/2%2!=0&&!t.isRound){var y=g.length/2-1,k=y+2;c=-(g[k]-g[y]),l=-(g[k+1]-g[y+1])}}if(t.midsrcArrowAngle=$L(c,l),a)c=f-t.segpts[t.segpts.length-2],l=p-t.segpts[t.segpts.length-1];else if(i||o||s||r){var g=t.allpts,A=g.length,_=aR(g[A-6],g[A-4],g[A-2],.9),v=aR(g[A-5],g[A-3],g[A-1],.9);c=f-_,l=p-v}else c=f-m,l=p-h;t.tgtArrowAngle=$L(c,l)},mq.getArrowWidth=mq.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+`, `+t];return r||(r=Math.max((e*13.37)**.9,29)*t,n[e+`, `+t]=r,r)};var hq,gq,_q={},vq={},yq,bq,xq,Sq,Cq,wq,Tq,Eq,Dq,Oq,kq,Aq,jq,Mq,Nq,Pq=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},Fq=function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},Iq=function(e,t,n,r,i){if(e===Nq?Fq(vq,_q):Pq(t,e,_q),Pq(t,n,vq),yq=_q.nx*vq.ny-_q.ny*vq.nx,bq=_q.nx*vq.nx-_q.ny*-vq.ny,Cq=Math.asin(Math.max(-1,Math.min(1,yq))),Math.abs(Cq)<1e-6){hq=t.x,gq=t.y,Tq=Dq=0;return}xq=1,Sq=!1,bq<0?Cq<0?Cq=Math.PI+Cq:(Cq=Math.PI-Cq,xq=-1,Sq=!0):Cq>0&&(xq=-1,Sq=!0),Dq=t.radius===void 0?r:t.radius,wq=Cq/2,Oq=Math.min(_q.len/2,vq.len/2),i?(Eq=Math.abs(Math.cos(wq)*Dq/Math.sin(wq)),Eq>Oq?(Eq=Oq,Tq=Math.abs(Eq*Math.sin(wq)/Math.cos(wq))):Tq=Dq):(Eq=Math.min(Oq,Dq),Tq=Math.abs(Eq*Math.sin(wq)/Math.cos(wq))),jq=t.x+vq.nx*Eq,Mq=t.y+vq.ny*Eq,hq=jq-vq.ny*Tq*xq,gq=Mq+vq.nx*Tq*xq,kq=t.x+_q.nx*Eq,Aq=t.y+_q.ny*Eq,Nq=t};function Lq(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function Rq(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(Iq(e,t,n,r,i),{cx:hq,cy:gq,radius:Tq,startX:kq,startY:Aq,stopX:jq,stopY:Mq,startAngle:_q.ang+Math.PI/2*xq,endAngle:vq.ang-Math.PI/2*xq,counterClockwise:Sq})}var zq=.01,Bq=Math.sqrt(2*zq),Vq={};Vq.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,i=t.vectorNormInverse,a,o=e.pstyle(`source-endpoint`),s=e.pstyle(`target-endpoint`),c=o.units!=null&&s.units!=null,l=function(e,t,n,r){var i=r-t,a=n-e,o=Math.sqrt(a*a+i*i);return{x:-i/o,y:a/o}};switch(e.pstyle(`edge-distances`).value){case`node-position`:a=n;break;case`intersection`:a=r;break;case`endpoints`:if(c){var u=PP(this.manualEndptToPx(e.source()[0],o),2),d=u[0],f=u[1],p=PP(this.manualEndptToPx(e.target()[0],s),2),m=p[0],h=p[1],g={x1:d,y1:f,x2:m,y2:h};i=l(d,f,m,h),a=g}else rL(`Edge ${e.id()} has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).`),a=r;break}return{midptPts:a,vectorNormInverse:i}},Vq.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=Math.random()*2*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=Math.random()*2*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=r.source,s=r.target,c=o.position(),l=s.position(),u=o.width(),d=s.width(),f=o.height(),p=s.height(),m=n.pstyle(`haystack-radius`).value/2;i.haystackPts=i.allpts=[i.source.x*u*m+c.x,i.source.y*f*m+c.y,i.target.x*d*m+l.x,i.target.y*p*m+l.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType=`haystack`,i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},Vq.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle(`segment-weights`),i=e.pstyle(`segment-distances`),a=e.pstyle(`segment-radii`),o=e.pstyle(`radius-type`),s=Math.min(r.pfValue.length,i.pfValue.length),c=a.pfValue[a.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];n.edgeType=`segments`,n.segpts=[],n.radii=[],n.isArcRadius=[];for(var u=0;u<s;u++){var d=r.pfValue[u],f=i.pfValue[u],p=1-d,m=d,h=this.findMidptPtsEtc(e,t),g=h.midptPts,_=h.vectorNormInverse,v={x:g.x1*p+g.x2*m,y:g.y1*p+g.y2*m};n.segpts.push(v.x+_.x*f,v.y+_.y*f),n.radii.push(a.pfValue[u]===void 0?c:a.pfValue[u]),n.isArcRadius.push((o.pfValue[u]===void 0?l:o.pfValue[u])===`arc-radius`)}},Vq.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle(`control-point-distances`),c=s?s.pfValue[0]:void 0,l=e.pstyle(`loop-direction`).pfValue,u=e.pstyle(`loop-sweep`).pfValue,d=e.pstyle(`control-point-step-size`).pfValue;i.edgeType=`self`;var f=n,p=d;r&&(f=0,p=c);var m=l-Math.PI/2,h=m-u/2,g=m+u/2,_=String(l+`_`+u);f=a[_]===void 0?a[_]=0:++a[_],i.ctrlpts=[o.x+Math.cos(h)*1.4*p*(f/3+1),o.y+Math.sin(h)*1.4*p*(f/3+1),o.x+Math.cos(g)*1.4*p*(f/3+1),o.y+Math.sin(g)*1.4*p*(f/3+1)]},Vq.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType=`compound`;var a=t.srcPos,o=t.tgtPos,s=t.srcW,c=t.srcH,l=t.tgtW,u=t.tgtH,d=e.pstyle(`control-point-step-size`).pfValue,f=e.pstyle(`control-point-distances`),p=f?f.pfValue[0]:void 0,m=n,h=d;r&&(m=0,h=p);var g=50,_={x:a.x-s/2,y:a.y-c/2},v={x:o.x-l/2,y:o.y-u/2},y={x:Math.min(_.x,v.x),y:Math.min(_.y,v.y)},b=.5,x=Math.max(b,Math.log(s*zq)),S=Math.max(b,Math.log(l*zq));i.ctrlpts=[y.x,y.y-(1+g**1.12/100)*h*(m/3+1)*x,y.x-(1+g**1.12/100)*h*(m/3+1)*S,y.y]},Vq.findStraightEdgePoints=function(e){e._private.rscratch.edgeType=`straight`},Vq.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=e.pstyle(`control-point-step-size`).pfValue,s=e.pstyle(`control-point-distances`),c=e.pstyle(`control-point-weights`),l=s&&c?Math.min(s.value.length,c.value.length):1,u=s?s.pfValue[0]:void 0,d=c.value[0],f=r;a.edgeType=f?`multibezier`:`bezier`,a.ctrlpts=[];for(var p=0;p<l;p++){var m=(.5-t.eles.length/2+n)*o*(i?-1:1),h=void 0,g=tR(m);f&&(u=s?s.pfValue[p]:o,d=c.value[p]),h=r?u:u===void 0?void 0:g*u;var _=h===void 0?m:h,v=1-d,y=d,b=this.findMidptPtsEtc(e,t),x=b.midptPts,S=b.vectorNormInverse,C={x:x.x1*v+x.x2*y,y:x.y1*v+x.y2*y};a.ctrlpts.push(C.x+S.x*_,C.y+S.y*_)}},Vq.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType=`segments`;var r=`vertical`,i=`horizontal`,a=`leftward`,o=`rightward`,s=`downward`,c=`upward`,l=`auto`,u=t.posPts,d=t.srcW,f=t.srcH,p=t.tgtW,m=t.tgtH,h=e.pstyle(`edge-distances`).value!==`node-position`,g=e.pstyle(`taxi-direction`).value,_=g,v=e.pstyle(`taxi-turn`),y=v.units===`%`,b=v.pfValue,x=b<0,S=e.pstyle(`taxi-turn-min-distance`).pfValue,C=h?(d+p)/2:0,w=h?(f+m)/2:0,T=u.x2-u.x1,E=u.y2-u.y1,D=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},O=D(T,C),k=D(E,w),A=!1;_===l?g=Math.abs(O)>Math.abs(k)?i:r:_===c||_===s?(g=r,A=!0):(_===a||_===o)&&(g=i,A=!0);var j=g===r,M=j?k:O,N=j?E:T,P=tR(N),F=!1;!(A&&(y||x))&&(_===s&&N<0||_===c&&N>0||_===a&&N>0||_===o&&N<0)&&(P*=-1,M=P*Math.abs(M),F=!0);var I=y?(b<0?1+b:b)*M:(b<0?M:0)+b*P,L=function(e){return Math.abs(e)<S||Math.abs(e)>=Math.abs(M)},R=L(I),ee=L(Math.abs(M)-Math.abs(I));if((R||ee)&&!F)if(j){var z=Math.abs(N)<=f/2,B=Math.abs(T)<=p/2;if(z){var V=(u.x1+u.x2)/2;n.segpts=[V,u.y1,V,u.y2]}else if(B){var H=(u.y1+u.y2)/2;n.segpts=[u.x1,H,u.x2,H]}else n.segpts=[u.x1,u.y2]}else{var te=Math.abs(N)<=d/2,ne=Math.abs(E)<=m/2;if(te){var U=(u.y1+u.y2)/2;n.segpts=[u.x1,U,u.x2,U]}else if(ne){var re=(u.x1+u.x2)/2;n.segpts=[re,u.y1,re,u.y2]}else n.segpts=[u.x2,u.y1]}else if(j){var ie=u.y1+I+(h?f/2*P:0);n.segpts=[u.x1,ie,u.x2,ie]}else{var ae=u.x1+I+(h?d/2*P:0);n.segpts=[ae,u.y1,ae,u.y2]}if(n.isRound){var oe=e.pstyle(`taxi-radius`).value,se=e.pstyle(`radius-type`).value[0]===`arc-radius`;n.radii=Array(n.segpts.length/2).fill(oe),n.isArcRadius=Array(n.segpts.length/2).fill(se)}},Vq.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType===`bezier`){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,c=t.tgtH,l=t.srcShape,u=t.tgtShape,d=t.srcCornerRadius,f=t.tgtCornerRadius,p=t.srcRs,m=t.tgtRs,h=!$(n.startX)||!$(n.startY),g=!$(n.arrowStartX)||!$(n.arrowStartY),_=!$(n.endX)||!$(n.endY),v=!$(n.arrowEndX)||!$(n.arrowEndY),y=3*(this.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.arrowShapeWidth),b=nR({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=b<y,S=nR({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),C=S<y,w=!1;if(h||g||x){w=!0;var T={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},E=Math.sqrt(T.x*T.x+T.y*T.y),D={x:T.x/E,y:T.y/E},O=Math.max(a,o),k={x:n.ctrlpts[0]+D.x*2*O,y:n.ctrlpts[1]+D.y*2*O},A=l.intersectLine(r.x,r.y,a,o,k.x,k.y,0,d,p);x?(n.ctrlpts[0]=n.ctrlpts[0]+D.x*(y-b),n.ctrlpts[1]=n.ctrlpts[1]+D.y*(y-b)):(n.ctrlpts[0]=A[0]+D.x*y,n.ctrlpts[1]=A[1]+D.y*y)}if(_||v||C){w=!0;var j={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},M=Math.sqrt(j.x*j.x+j.y*j.y),N={x:j.x/M,y:j.y/M},P=Math.max(a,o),F={x:n.ctrlpts[0]+N.x*2*P,y:n.ctrlpts[1]+N.y*2*P},I=u.intersectLine(i.x,i.y,s,c,F.x,F.y,0,f,m);C?(n.ctrlpts[0]=n.ctrlpts[0]+N.x*(y-S),n.ctrlpts[1]=n.ctrlpts[1]+N.y*(y-S)):(n.ctrlpts[0]=I[0]+N.x*y,n.ctrlpts[1]=I[1]+N.y*y)}w&&this.findEndpoints(e)}},Vq.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType===`multibezier`||t.edgeType===`bezier`||t.edgeType===`self`||t.edgeType===`compound`){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);t.allpts.push(t.endX,t.endY);var r,i;t.ctrlpts.length/2%2==0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,i=.5,t.midX=aR(t.allpts[r],t.allpts[r+2],t.allpts[r+4],i),t.midY=aR(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],i))}else if(t.edgeType===`straight`)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType===`segments`){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var a=2;a+3<t.allpts.length;a+=2){var o=t.radii[a/2-1],s=t.isArcRadius[a/2-1];t.roundCorners.push(Rq({x:t.allpts[a-2],y:t.allpts[a-1]},{x:t.allpts[a],y:t.allpts[a+1],radius:o},{x:t.allpts[a+2],y:t.allpts[a+3]},o,s))}}if(t.segpts.length%4==0){var c=t.segpts.length/2,l=c-2;t.midX=(t.segpts[l]+t.segpts[c])/2,t.midY=(t.segpts[l+1]+t.segpts[c+1])/2}else{var u=t.segpts.length/2-1;if(!t.isRound)t.midX=t.segpts[u],t.midY=t.segpts[u+1];else{var d={x:t.segpts[u],y:t.segpts[u+1]},f=t.roundCorners[u/2];if(f.radius===0){var p={x:t.segpts[u+2],y:t.segpts[u+3]};t.midX=d.x,t.midY=d.y,t.midVector=[d.y-p.y,p.x-d.x]}else{var m=[d.x-f.cx,d.y-f.cy],h=f.radius/Math.sqrt(m[0]**2+m[1]**2);m=m.map(function(e){return e*h}),t.midX=f.cx+m[0],t.midY=f.cy+m[1],t.midVector=m}}}}},Vq.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||$(t.startX)&&$(t.startY)&&$(t.endX)&&$(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,rL("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},Vq.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var n=this,r=n.cy.hasCompoundNodes(),i=new gL,a=function(e,t){return[].concat(FP(e),[+!!t]).join(`-`)},o=[],s=[],c=0;c<e.length;c++){var l=e[c],u=l._private,d=l.pstyle(`curve-style`).value;if(!(l.removed()||!l.takesUpSpace())){if(d===`haystack`){s.push(l);continue}var f=d===`unbundled-bezier`||gF(d,`segments`)||d===`straight`||d===`straight-triangle`||gF(d,`taxi`),p=d===`unbundled-bezier`||d===`bezier`,m=u.source,h=u.target,g=[m.poolIndex(),h.poolIndex()].sort(),_=a(g,f),v=i.get(_);v??(v={eles:[]},o.push({pairId:g,edgeIsUnbundled:f}),i.set(_,v)),v.eles.push(l),f&&(v.hasUnbundled=!0),p&&(v.hasBezier=!0)}}for(var y=function(){var e=o[b],s=e.pairId,c=e.edgeIsUnbundled,l=a(s,c),u=i.get(l),d;if(!u.hasUnbundled){var f=u.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});fL(u.eles),f.forEach(function(e){return u.eles.push(e)}),u.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var p=u.eles[0],m=p.source(),h=p.target();if(m.poolIndex()>h.poolIndex()){var g=m;m=h,h=g}var _=u.srcPos=m.position(),v=u.tgtPos=h.position(),y=u.srcW=m.outerWidth(),x=u.srcH=m.outerHeight(),S=u.tgtW=h.outerWidth(),C=u.tgtH=h.outerHeight(),w=u.srcShape=n.nodeShapes[t.getNodeShape(m)],T=u.tgtShape=n.nodeShapes[t.getNodeShape(h)],E=u.srcCornerRadius=m.pstyle(`corner-radius`).value===`auto`?`auto`:m.pstyle(`corner-radius`).pfValue,D=u.tgtCornerRadius=h.pstyle(`corner-radius`).value===`auto`?`auto`:h.pstyle(`corner-radius`).pfValue,O=u.tgtRs=h._private.rscratch,k=u.srcRs=m._private.rscratch;u.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var A=0;A<u.eles.length;A++){var j=u.eles[A],M=j[0]._private.rscratch,N=j.pstyle(`curve-style`).value,P=N===`unbundled-bezier`||gF(N,`segments`)||gF(N,`taxi`),F=!m.same(j.source());if(!u.calculatedIntersection&&m!==h&&(u.hasBezier||u.hasUnbundled)){u.calculatedIntersection=!0;var I=w.intersectLine(_.x,_.y,y,x,v.x,v.y,0,E,k),L=u.srcIntn=I,R=T.intersectLine(v.x,v.y,S,C,_.x,_.y,0,D,O),ee=u.tgtIntn=R,z=u.intersectionPts={x1:I[0],x2:R[0],y1:I[1],y2:R[1]},B=u.posPts={x1:_.x,x2:v.x,y1:_.y,y2:v.y},V=R[1]-I[1],H=R[0]-I[0],te=Math.sqrt(H*H+V*V);$(te)&&te>=Bq||(te=Math.sqrt(Math.max(H*H,zq)+Math.max(V*V,zq)));var ne=u.vector={x:H,y:V},U=u.vectorNorm={x:ne.x/te,y:ne.y/te},re={x:-U.y,y:U.x};u.nodesOverlap=!$(te)||T.checkPoint(I[0],I[1],0,S,C,v.x,v.y,D,O)||w.checkPoint(R[0],R[1],0,y,x,_.x,_.y,E,k),u.vectorNormInverse=re,d={nodesOverlap:u.nodesOverlap,dirCounts:u.dirCounts,calculatedIntersection:!0,hasBezier:u.hasBezier,hasUnbundled:u.hasUnbundled,eles:u.eles,srcPos:v,srcRs:O,tgtPos:_,tgtRs:k,srcW:S,srcH:C,tgtW:y,tgtH:x,srcIntn:ee,tgtIntn:L,srcShape:T,tgtShape:w,posPts:{x1:B.x2,y1:B.y2,x2:B.x1,y2:B.y1},intersectionPts:{x1:z.x2,y1:z.y2,x2:z.x1,y2:z.y1},vector:{x:-ne.x,y:-ne.y},vectorNorm:{x:-U.x,y:-U.y},vectorNormInverse:{x:-re.x,y:-re.y}}}var ie=F?d:u;M.nodesOverlap=ie.nodesOverlap,M.srcIntn=ie.srcIntn,M.tgtIntn=ie.tgtIntn,M.isRound=N.startsWith(`round`),r&&(m.isParent()||m.isChild()||h.isParent()||h.isChild())&&(m.parents().anySame(h)||h.parents().anySame(m)||m.same(h)&&m.isParent())?t.findCompoundLoopPoints(j,ie,A,P):m===h?t.findLoopPoints(j,ie,A,P):N.endsWith(`segments`)?t.findSegmentsPoints(j,ie):N.endsWith(`taxi`)?t.findTaxiPoints(j,ie):N===`straight`||!P&&u.eles.length%2==1&&A===Math.floor(u.eles.length/2)?t.findStraightEdgePoints(j):t.findBezierPoints(j,ie,A,P,F),t.findEndpoints(j),t.tryToCorrectInvalidPoints(j,ie),t.checkForInvalidEdgeWarning(j),t.storeAllpts(j),t.storeEdgeProjections(j),t.calculateArrowAngles(j),t.recalculateEdgeLabelProjections(j),t.calculateLabelAngles(j)}},b=0;b<o.length;b++)y();this.findHaystackPoints(s)}};function Hq(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}Vq.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),t.edgeType===`segments`)return Hq(t.segpts)},Vq.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n===`bezier`||n===`multibezier`||n===`self`||n===`compound`)return Hq(t.ctrlpts)},Vq.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var Uq={};Uq.manualEndptToPx=function(e,t){var n=this,r=e.position(),i=e.outerWidth(),a=e.outerHeight(),o=e._private.rscratch;if(t.value.length===2){var s=[t.pfValue[0],t.pfValue[1]];return t.units[0]===`%`&&(s[0]*=i),t.units[1]===`%`&&(s[1]*=a),s[0]+=r.x,s[1]+=r.y,s}else{var c=t.pfValue[0];c=-Math.PI/2+c;var l=2*Math.max(i,a),u=[r.x+Math.cos(c)*l,r.y+Math.sin(c)*l];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,i,a,u[0],u[1],0,e.pstyle(`corner-radius`).value===`auto`?`auto`:e.pstyle(`corner-radius`).pfValue,o)}},Uq.findEndpoints=function(e){var t,n,r=this,i,a=e.source()[0],o=e.target()[0],s=a.position(),c=o.position(),l=e.pstyle(`target-arrow-shape`).value,u=e.pstyle(`source-arrow-shape`).value,d=e.pstyle(`target-distance-from-node`).pfValue,f=e.pstyle(`source-distance-from-node`).pfValue,p=a._private.rscratch,m=o._private.rscratch,h=e.pstyle(`curve-style`).value,g=e._private.rscratch,_=g.edgeType,v=gF(h,`taxi`),y=_===`self`||_===`compound`,b=_===`bezier`||_===`multibezier`||y,x=_!==`bezier`,S=_===`straight`||_===`segments`,C=_===`segments`,w=b||x||S,T=y||v,E=e.pstyle(`source-endpoint`),D=T?`outside-to-node`:E.value,O=a.pstyle(`corner-radius`).value===`auto`?`auto`:a.pstyle(`corner-radius`).pfValue,k=e.pstyle(`target-endpoint`),A=T?`outside-to-node`:k.value,j=o.pstyle(`corner-radius`).value===`auto`?`auto`:o.pstyle(`corner-radius`).pfValue;g.srcManEndpt=E,g.tgtManEndpt=k;var M,N,P,F,I=((k==null||(t=k.pfValue)==null?void 0:t.length)===2?k.pfValue:null)??[0,0],L=((E==null||(n=E.pfValue)==null?void 0:n.length)===2?E.pfValue:null)??[0,0];if(b){var R=[g.ctrlpts[0],g.ctrlpts[1]];M=x?[g.ctrlpts[g.ctrlpts.length-2],g.ctrlpts[g.ctrlpts.length-1]]:R,N=R}else if(S){var ee=C?g.segpts.slice(0,2):[c.x+I[0],c.y+I[1]];M=C?g.segpts.slice(g.segpts.length-2):[s.x+L[0],s.y+L[1]],N=ee}if(A===`inside-to-node`)i=[c.x,c.y];else if(k.units)i=this.manualEndptToPx(o,k);else if(A===`outside-to-line`)i=g.tgtIntn;else if(A===`outside-to-node`||A===`outside-to-node-or-label`?P=M:(A===`outside-to-line`||A===`outside-to-line-or-label`)&&(P=[s.x,s.y]),i=r.nodeShapes[this.getNodeShape(o)].intersectLine(c.x,c.y,o.outerWidth(),o.outerHeight(),P[0],P[1],0,j,m),A===`outside-to-node-or-label`||A===`outside-to-line-or-label`){var z=o._private.rscratch,B=z.labelWidth,V=z.labelHeight,H=z.labelX,te=z.labelY,ne=B/2,U=V/2,re=o.pstyle(`text-valign`).value;re===`top`?te-=U:re===`bottom`&&(te+=U);var ie=o.pstyle(`text-halign`).value;ie===`left`?H-=ne:ie===`right`&&(H+=ne);var ae=HR(P[0],P[1],[H-ne,te-U,H+ne,te-U,H+ne,te+U,H-ne,te+U],c.x,c.y);if(ae.length>0){var oe=s,se=rR(oe,qL(i)),ce=rR(oe,qL(ae)),le=se;ce<se&&(i=ae,le=ce),ae.length>2&&rR(oe,{x:ae[2],y:ae[3]})<le&&(i=[ae[2],ae[3]])}}var ue=WR(i,M,r.arrowShapes[l].spacing(e)+d),de=WR(i,M,r.arrowShapes[l].gap(e)+d);if(g.endX=de[0],g.endY=de[1],g.arrowEndX=ue[0],g.arrowEndY=ue[1],D===`inside-to-node`)i=[s.x,s.y];else if(E.units)i=this.manualEndptToPx(a,E);else if(D===`outside-to-line`)i=g.srcIntn;else if(D===`outside-to-node`||D===`outside-to-node-or-label`?F=N:(D===`outside-to-line`||D===`outside-to-line-or-label`)&&(F=[c.x,c.y]),i=r.nodeShapes[this.getNodeShape(a)].intersectLine(s.x,s.y,a.outerWidth(),a.outerHeight(),F[0],F[1],0,O,p),D===`outside-to-node-or-label`||D===`outside-to-line-or-label`){var fe=a._private.rscratch,pe=fe.labelWidth,me=fe.labelHeight,he=fe.labelX,ge=fe.labelY,_e=pe/2,ve=me/2,ye=a.pstyle(`text-valign`).value;ye===`top`?ge-=ve:ye===`bottom`&&(ge+=ve);var be=a.pstyle(`text-halign`).value;be===`left`?he-=_e:be===`right`&&(he+=_e);var xe=HR(F[0],F[1],[he-_e,ge-ve,he+_e,ge-ve,he+_e,ge+ve,he-_e,ge+ve],s.x,s.y);if(xe.length>0){var Se=c,Ce=rR(Se,qL(i)),we=rR(Se,qL(xe)),Te=Ce;we<Ce&&(i=[xe[0],xe[1]],Te=we),xe.length>2&&rR(Se,{x:xe[2],y:xe[3]})<Te&&(i=[xe[2],xe[3]])}}var Ee=WR(i,N,r.arrowShapes[u].spacing(e)+f),De=WR(i,N,r.arrowShapes[u].gap(e)+f);g.startX=De[0],g.startY=De[1],g.arrowStartX=Ee[0],g.arrowStartY=Ee[1],w&&(!$(g.startX)||!$(g.startY)||!$(g.endX)||!$(g.endY)?g.badLine=!0:g.badLine=!1)},Uq.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case`haystack`:return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}},Uq.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case`haystack`:return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}};var Wq={};function Gq(e,t,n){for(var r=function(e,t,n,r){return aR(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}Wq.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r===`multibezier`||r===`bezier`||r===`self`||r===`compound`){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)Gq(this,e,n.allpts.slice(i,i+6))}else if(r===`segments`)for(var a=t.rstyle.linePts=[],i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]});else if(r===`haystack`){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle(`width`).pfValue,e.pstyle(`arrow-scale`).value)*this.arrowShapeWidth},Wq.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var Kq={};Kq.recalculateNodeLabelProjection=function(e){var t=e.pstyle(`label`).strValue;if(!oF(t)){var n,r,i=e._private,a=e.width(),o=e.height(),s=e.padding(),c=e.position(),l=e.pstyle(`text-halign`).strValue,u=e.pstyle(`text-valign`).strValue,d=i.rscratch,f=i.rstyle;switch(l){case`left`:n=c.x-a/2-s;break;case`right`:n=c.x+a/2+s;break;default:n=c.x}switch(u){case`top`:r=c.y-o/2-s;break;case`bottom`:r=c.y+o/2+s;break;default:r=c.y}d.labelX=n,d.labelY=r,f.labelX=n,f.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var qq=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n*=-1),n},Jq=function(e,t){return qq(t.x-e.x,t.y-e.y)},Yq=function(e,t,n,r){var i=cR(0,r-.001,1),a=cR(0,r+.001,1);return Jq(oR(e,t,n,i),oR(e,t,n,a))};Kq.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle(`label`).strValue,source:e.pstyle(`source-label`).strValue,target:e.pstyle(`target-label`).strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){hL(n.rscratch,e,t,r),hL(n.rstyle,e,t,r)};o(`labelX`,null,t.x),o(`labelY`,null,t.y),o(`labelAutoAngle`,null,qq(r.midDispX,r.midDispY));var s=function(){if(s.cache)return s.cache;for(var e=[],t=0;t+5<r.allpts.length;t+=4){var a={x:r.allpts[t],y:r.allpts[t+1]},o={x:r.allpts[t+2],y:r.allpts[t+3]},c={x:r.allpts[t+4],y:r.allpts[t+5]};e.push({p0:a,p1:o,p2:c,startDist:0,length:0,segments:[]})}var l=n.rstyle.bezierPts,u=i.bezierProjPcts.length;function d(e,t,n,r,i){var a=nR(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var f=0;f<e.length;f++){var p=e[f],m=e[f-1];m&&(p.startDist=m.startDist+m.length),d(p,p.p0,l[f*u],0,i.bezierProjPcts[0]);for(var h=0;h<u-1;h++)d(p,l[f*u+h],l[f*u+h+1],i.bezierProjPcts[h],i.bezierProjPcts[h+1]);d(p,l[f*u+u-1],p.p2,i.bezierProjPcts[u-1],1)}return s.cache=e},c=function(n){var i,c=n===`source`;if(a[n]){var l=e.pstyle(n+`-text-offset`).pfValue;switch(r.edgeType){case`self`:case`compound`:case`bezier`:case`multibezier`:for(var u=s(),d,f=0,p=0,m=0;m<u.length;m++){for(var h=u[c?m:u.length-1-m],g=0;g<h.segments.length;g++){var _=h.segments[c?g:h.segments.length-1-g],v=m===u.length-1&&g===h.segments.length-1;if(f=p,p+=_.length,p>=l||v){d={cp:h,segment:_};break}}if(d)break}var y=d.cp,b=d.segment,x=(l-f)/b.length,S=b.t1-b.t0,C=c?b.t0+S*x:b.t1-S*x;C=cR(0,C,1),t=oR(y.p0,y.p1,y.p2,C),i=Yq(y.p0,y.p1,y.p2,C);break;case`straight`:case`segments`:case`haystack`:for(var w=0,T,E,D,O,k=r.allpts.length,A=0;A+3<k&&(c?(D={x:r.allpts[A],y:r.allpts[A+1]},O={x:r.allpts[A+2],y:r.allpts[A+3]}):(D={x:r.allpts[k-2-A],y:r.allpts[k-1-A]},O={x:r.allpts[k-4-A],y:r.allpts[k-3-A]}),T=nR(D,O),E=w,w+=T,!(w>=l));A+=2);var j=(l-E)/T;j=cR(0,j,1),t=sR(D,O,j),i=Jq(D,O);break}o(`labelX`,n,t.x),o(`labelY`,n,t.y),o(`labelAutoAngle`,n,i)}};c(`source`),c(`target`),this.applyLabelDimensions(e)}},Kq.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,`source`),this.applyPrefixedLabelDimensions(e,`target`))},Kq.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=VI(r,e._private.labelDimsKey);if(mL(n.rscratch,`prefixedLabelDimsKey`,t)!==i){hL(n.rscratch,`prefixedLabelDimsKey`,t,i);var a=this.calculateLabelDimensions(e,r),o=e.pstyle(`line-height`).pfValue,s=e.pstyle(`text-wrap`).strValue,c=mL(n.rscratch,`labelWrapCachedLines`,t)||[],l=s===`wrap`?Math.max(c.length,1):1,u=a.height/l,d=u*o,f=a.width,p=a.height+(l-1)*(o-1)*u;hL(n.rstyle,`labelWidth`,t,f),hL(n.rscratch,`labelWidth`,t,f),hL(n.rstyle,`labelHeight`,t,p),hL(n.rscratch,`labelHeight`,t,p),hL(n.rscratch,`labelLineHeight`,t,d)}},Kq.getLabelText=function(e,t){var n=e._private,r=t?t+`-`:``,i=e.pstyle(r+`label`).strValue,a=e.pstyle(`text-transform`).value,o=function(e,r){return r?(hL(n.rscratch,e,t,r),r):mL(n.rscratch,e,t)};if(!i)return``;a==`none`||(a==`uppercase`?i=i.toUpperCase():a==`lowercase`&&(i=i.toLowerCase()));var s=e.pstyle(`text-wrap`).value;if(s===`wrap`){var c=o(`labelKey`);if(c!=null&&o(`labelWrapKey`)===c)return o(`labelWrapCachedText`);for(var l=``,u=i.split(`
|
|
88
|
-
`),d=e.pstyle(`text-max-width`).pfValue,f=e.pstyle(`text-overflow-wrap`).value===`anywhere`,p=[],m=/[\s\u200b]+|$/g,h=0;h<u.length;h++){var g=u[h],_=this.calculateLabelDimensions(e,g).width;if(f&&(g=g.split(``).join(l)),_>d){var v=g.matchAll(m),y=``,b=0,x=OP(v),S;try{for(x.s();!(S=x.n()).done;){var C=S.value,w=C[0],T=g.substring(b,C.index);b=C.index+w.length;var E=y.length===0?T:y+T+w;this.calculateLabelDimensions(e,E).width<=d?y+=T+w:(y&&p.push(y),y=T+w)}}catch(e){x.e(e)}finally{x.f()}y.match(/^[\s\u200b]+$/)||p.push(y)}else p.push(g)}o(`labelWrapCachedLines`,p),i=o(`labelWrapCachedText`,p.join(`
|
|
89
|
-
`)),o(`labelWrapKey`,c)}else if(s===`ellipsis`){var D=e.pstyle(`text-max-width`).pfValue,O=``,k=`…`,A=!1;if(this.calculateLabelDimensions(e,i).width<D)return i;for(var j=0;j<i.length&&!(this.calculateLabelDimensions(e,O+i[j]+k).width>D);j++)O+=i[j],j===i.length-1&&(A=!0);return A||(O+=k),O}return i},Kq.getLabelJustification=function(e){var t=e.pstyle(`text-justification`).strValue,n=e.pstyle(`text-halign`).strValue;if(t===`auto`)if(e.isNode())switch(n){case`left`:return`right`;case`right`:return`left`;default:return`center`}else return`center`;else return t},Kq.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=0,i=e.pstyle(`font-style`).strValue,a=e.pstyle(`font-size`).pfValue,o=e.pstyle(`font-family`).strValue,s=e.pstyle(`font-weight`).strValue,c=this.labelCalcCanvas,l=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=n.createElement(`canvas`),l=this.labelCalcCanvasContext=c.getContext(`2d`);var u=c.style;u.position=`absolute`,u.left=`-9999px`,u.top=`-9999px`,u.zIndex=`-1`,u.visibility=`hidden`,u.pointerEvents=`none`}l.font=`${i} ${s} ${a}px ${o}`;for(var d=0,f=0,p=t.split(`
|
|
90
|
-
`),m=0;m<p.length;m++){var h=p[m],g=l.measureText(h),_=Math.ceil(g.width),v=a;d=Math.max(_,d),f+=v}return d+=r,f+=r,{width:d,height:f}},Kq.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),i=t?t+`-`:``,a=e.pstyle(i+`text-rotation`),o=a.strValue;return o===`none`?0:r&&o===`autorotate`?n.labelAutoAngle:o===`autorotate`?0:a.pfValue},Kq.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private.rscratch;r.labelAngle=t.calculateLabelAngle(e),n&&(r.sourceLabelAngle=t.calculateLabelAngle(e,`source`),r.targetLabelAngle=t.calculateLabelAngle(e,`target`))};var Xq={},Zq=28,Qq=!1;Xq.getNodeShape=function(e){var t=this,n=e.pstyle(`shape`).value;if(n===`cutrectangle`&&(e.width()<Zq||e.height()<Zq))return Qq||=(rL("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),!0),`rectangle`;if(e.isParent())return n===`rectangle`||n===`roundrectangle`||n===`round-rectangle`||n===`cutrectangle`||n===`cut-rectangle`||n===`barrel`?n:`rectangle`;if(n===`polygon`){var r=e.pstyle(`shape-polygon-points`).value;return t.nodeShapes.makePolygon(r).name}return n};var $q={};$q.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(e),n)for(var r=0;r<e.length;r++){var i=e[r]._private.rstyle;i.clean=!1,i.cleanConnected=!1}};n.binder(e).on(`bounds.* dirty.*`,function(e){var t=e.target;r(t)}).on(`style.* background.*`,function(e){var t=e.target;r(t,!1)});var i=function(i){if(i){var a=n.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],c=s._private.rstyle;s.isNode()&&!c.cleanConnected&&(r(s.connectedEdges()),c.cleanConnected=!0)}if(a)for(var l=0;l<a.length;l++){var u=a[l];u(i,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},$q.onUpdateEleCalcs=function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},$q.recalculateRenderedStyle=function(e,t){var n=function(e){return e._private.rstyle.cleanConnected};if(e.length!==0){var r=[],i=[];if(!this.destroyed){t===void 0&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,c=s.rstyle;o.isEdge()&&(!n(o.source())||!n(o.target()))&&(c.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(e){return!e._private.rstyle.clean&&e.isBundledBezier()})&&(c.clean=!1),!(t&&c.clean||o.removed())&&o.pstyle(`display`).value!==`none`&&(s.group===`nodes`?i.push(o):r.push(o),c.clean=!0)}for(var l=0;l<i.length;l++){var u=i[l],d=u._private.rstyle,f=u.position();this.recalculateNodeLabelProjection(u),d.nodeX=f.x,d.nodeY=f.y,d.nodeW=u.pstyle(`width`).pfValue,d.nodeH=u.pstyle(`height`).pfValue}this.recalculateEdgeProjections(r);for(var p=0;p<r.length;p++){var m=r[p]._private,h=m.rstyle,g=m.rscratch;h.srcX=g.arrowStartX,h.srcY=g.arrowStartY,h.tgtX=g.arrowEndX,h.tgtY=g.arrowEndY,h.midX=g.midX,h.midY=g.midY,h.labelAngle=g.labelAngle,h.sourceLabelAngle=g.sourceLabelAngle,h.targetLabelAngle=g.targetLabelAngle}}}};var eJ={};eJ.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],i=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):i.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}},eJ.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},eJ.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(pG),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var tJ={};[pq,mq,Vq,Uq,Wq,Kq,Xq,$q,eJ].forEach(function(e){EF(tJ,e)});var nJ={};nJ.getCachedImage=function(e,t,n){var r=this,i=r.imageCache=r.imageCache||{},a=i[e];if(a)return a.image.complete||a.image.addEventListener(`load`,n),a.image;a=i[e]=i[e]||{};var o=a.image=new Image;o.addEventListener(`load`,n),o.addEventListener(`error`,function(){o.error=!0});var s=`data:`;return e.substring(0,s.length).toLowerCase()!==s&&(t=t===`null`?null:t,o.crossOrigin=t),o.src=e,o};var rJ=function(e,t){var n=e[0];!n||n._private.grabbed===t||(n._private.grabbed=t,e.updateStyle(!1))},iJ=function(e){rJ(e,!0)},aJ=function(e){rJ(e,!1)},oJ={};oJ.registerBinding=function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var a=[],o=0;o<e.length;o++){var s=e[o];if(s!==void 0){var c=this.binder(s);a.push(c.on.apply(c,i))}}return a}var c=this.binder(e);return c.on.apply(c,i)},oJ.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||sF(e);if(t.supportsPassiveEvents==null){var i=!1;try{var a=Object.defineProperty({},`passive`,{get:function(){return i=!0,!0}});n.addEventListener(`test`,null,a)}catch{}t.supportsPassiveEvents=i}var o=function(n,i,a){var o=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(o[2]={capture:a??!1,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},oJ.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},oJ.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},oJ.load=function(){var e=this,t=e.cy.window(),n=function(e){return e.selected()},r=function(e){var t=e.getRootNode();if(t&&t.nodeType===11&&t.host!==void 0)return t},i=function(t,n,r,i){t??=e.cy;for(var a=0;a<n.length;a++){var o=n[a];t.emit({originalEvent:r,type:o,position:i})}},a=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},o=function(t,n){var r=!0;if(e.cy.hasCompoundNodes()&&t&&t.pannable())for(var i=0;n&&i<n.length;i++){var t=n[i];if(t.isNode()&&t.isParent()&&!t.pannable()){r=!1;break}}else r=!0;return r},s=function(e){e[0]._private.rscratch.inDragLayer=!0},c=function(e){e[0]._private.rscratch.inDragLayer=!1},l=function(e){e[0]._private.rscratch.isGrabTarget=!0},u=function(e){e[0]._private.rscratch.isGrabTarget=!1},d=function(e,t){var n=t.addToList;!n.has(e)&&e.grabbable()&&!e.locked()&&(n.merge(e),iJ(e))},f=function(e,t){if(e.cy().hasCompoundNodes()&&!(t.inDragLayer==null&&t.addToList==null)){var n=e.descendants();t.inDragLayer&&(n.forEach(s),n.connectedEdges().forEach(s)),t.addToList&&d(n,t)}},p=function(t,n){n||={};var r=t.cy().hasCompoundNodes();n.inDragLayer&&(t.forEach(s),t.neighborhood().stdFilter(function(e){return!r||e.isEdge()}).forEach(s)),n.addToList&&t.forEach(function(e){d(e,n)}),f(t,n),g(t,{inDragLayer:n.inDragLayer}),e.updateCachedGrabbedEles()},m=p,h=function(t){t&&(e.getCachedZSortedEles().forEach(function(e){aJ(e),c(e),u(e)}),e.updateCachedGrabbedEles())},g=function(e,t){if(!(t.inDragLayer==null&&t.addToList==null)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(s),r.forEach(s)),t.addToList&&r.forEach(function(e){d(e,t)})}}},_=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},v=typeof MutationObserver<`u`,y=typeof ResizeObserver<`u`;v?(e.removeObserver=new MutationObserver(function(t){for(var n=0;n<t.length;n++){var r=t[n].removedNodes;if(r){for(var i=0;i<r.length;i++)if(r[i]===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,`DOMNodeRemoved`,function(t){e.destroy()});var b=TI(function(){e.cy.resize()},100);v&&(e.styleObserver=new MutationObserver(b),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,`resize`,b),y&&(e.resizeObserver=new ResizeObserver(b),e.resizeObserver.observe(e.container));var x=function(e,t){for(;e!=null;)t(e),e=e.parentNode},S=function(){e.invalidateContainerClientCoordsCache()};x(e.container,function(t){e.registerBinding(t,`transitionend`,S),e.registerBinding(t,`animationend`,S),e.registerBinding(t,`scroll`,S)}),e.registerBinding(e.container,`contextmenu`,function(e){e.preventDefault()});var C=function(){return e.selection[4]!==0},w=function(t){for(var n=e.findContainerClientCoords(),r=n[0],i=n[1],a=n[2],o=n[3],s=t.touches?t.touches:[t],c=!1,l=0;l<s.length;l++){var u=s[l];if(r<=u.clientX&&u.clientX<=r+a&&i<=u.clientY&&u.clientY<=i+o){c=!0;break}}if(!c)return!1;for(var d=e.container,f=t.target.parentNode,p=!1;f;){if(f===d){p=!0;break}f=f.parentNode}return!!p};e.registerBinding(e.container,`mousedown`,function(t){if(w(t)&&!(e.hoverData.which===1&&t.which!==1)){t.preventDefault(),_(),e.hoverData.capture=!0,e.hoverData.which=t.which;var n=e.cy,r=[t.clientX,t.clientY],a=e.projectIntoViewport(r[0],r[1]),o=e.selection,s=e.findNearestElements(a[0],a[1],!0,!1),c=s[0],u=e.dragData.possibleDragElements;e.hoverData.mdownPos=a,e.hoverData.mdownGPos=r;var d=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}},f=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var t=e.hoverData.down;t?t.emit(d(`taphold`)):n.emit(d(`taphold`))}},e.tapholdDuration)};if(t.which==3){e.hoverData.cxtStarted=!0;var h={originalEvent:t,type:`cxttapstart`,position:{x:a[0],y:a[1]}};c?(c.activate(),c.emit(h),e.hoverData.down=c):n.emit(h),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(t.which==1){if(c&&c.activate(),c!=null&&e.nodeIsGrabbable(c)){var g=function(e){e.emit(d(`grab`))};if(l(c),!c.selected())u=e.dragData.possibleDragElements=n.collection(),m(c,{addToList:u}),c.emit(d(`grabon`)).emit(d(`grab`));else{u=e.dragData.possibleDragElements=n.collection();var v=n.$(function(t){return t.isNode()&&t.selected()&&e.nodeIsGrabbable(t)});p(v,{addToList:u}),c.emit(d(`grabon`)),v.forEach(g)}e.redrawHint(`eles`,!0),e.redrawHint(`drag`,!0)}e.hoverData.down=c,e.hoverData.downs=s,e.hoverData.downTime=new Date().getTime(),i(c,[`mousedown`,`tapstart`,`vmousedown`],t,{x:a[0],y:a[1]}),c==null?(o[4]=1,e.data.bgActivePosistion={x:a[0],y:a[1]},e.redrawHint(`select`,!0),e.redraw()):c.pannable()&&(o[4]=1),f()}o[0]=o[2]=a[0],o[1]=o[3]=a[1]}},!1);var T=r(e.container);e.registerBinding([t,T],`mousemove`,function(t){if(!(!e.hoverData.capture&&!w(t))){var n=!1,r=e.cy,s=r.zoom(),c=[t.clientX,t.clientY],l=e.projectIntoViewport(c[0],c[1]),u=e.hoverData.mdownPos,d=e.hoverData.mdownGPos,f=e.selection,m=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(m=e.findNearestElement(l[0],l[1],!0,!1));var g=e.hoverData.last,_=e.hoverData.down,v=[l[0]-f[2],l[1]-f[3]],y=e.dragData.possibleDragElements,b;if(d){var x=c[0]-d[0],S=x*x,C=c[1]-d[1],T=S+C*C;e.hoverData.isOverThresholdDrag=b=T>=e.desktopTapThreshold2}var E=a(t);b&&(e.hoverData.tapholdCancelled=!0);var D=function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];t.length===0?(t.push(v[0]),t.push(v[1])):(t[0]+=v[0],t[1]+=v[1])};n=!0,i(m,[`mousemove`,`vmousemove`,`tapdrag`],t,{x:l[0],y:l[1]});var O=function(e){return{originalEvent:t,type:e,position:{x:l[0],y:l[1]}}},k=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||r.emit(O(`boxstart`)),f[4]=1,e.hoverData.selecting=!0,e.redrawHint(`select`,!0),e.redraw()};if(e.hoverData.which===3){if(b){var A=O(`cxtdrag`);_?_.emit(A):r.emit(A),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||m!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(O(`cxtdragout`)),e.hoverData.cxtOver=m,m&&m.emit(O(`cxtdragover`)))}}else if(e.hoverData.dragging){if(n=!0,r.panningEnabled()&&r.userPanningEnabled()){var j;if(e.hoverData.justStartedPan){var M=e.hoverData.mdownPos;j={x:(l[0]-M[0])*s,y:(l[1]-M[1])*s},e.hoverData.justStartedPan=!1}else j={x:v[0]*s,y:v[1]*s};r.panBy(j),r.emit(O(`dragpan`)),e.hoverData.dragged=!0}l=e.projectIntoViewport(t.clientX,t.clientY)}else if(f[4]==1&&(_==null||_.pannable()))b&&(!e.hoverData.dragging&&r.boxSelectionEnabled()&&(E||!r.panningEnabled()||!r.userPanningEnabled())?k():!e.hoverData.selecting&&r.panningEnabled()&&r.userPanningEnabled()&&o(_,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=qL(u),e.redrawHint(`select`,!0),e.redraw()),_&&_.pannable()&&_.active()&&_.unactivate());else{if(_&&_.pannable()&&_.active()&&_.unactivate(),(!_||!_.grabbed())&&m!=g&&(g&&i(g,[`mouseout`,`tapdragout`],t,{x:l[0],y:l[1]}),m&&i(m,[`mouseover`,`tapdragover`],t,{x:l[0],y:l[1]}),e.hoverData.last=m),_)if(b){if(r.boxSelectionEnabled()&&E)_&&_.grabbed()&&(h(y),_.emit(O(`freeon`)),y.emit(O(`free`)),e.dragData.didDrag&&(_.emit(O(`dragfreeon`)),y.emit(O(`dragfree`)))),k();else if(_&&_.grabbed()&&e.nodeIsDraggable(_)){var N=!e.dragData.didDrag;N&&e.redrawHint(`eles`,!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||p(y,{inDragLayer:!0});var P={x:0,y:0};if($(v[0])&&$(v[1])&&(P.x+=v[0],P.y+=v[1],N)){var F=e.hoverData.dragDelta;F&&$(F[0])&&$(F[1])&&(P.x+=F[0],P.y+=F[1])}e.hoverData.draggingEles=!0,y.silentShift(P).emit(O(`position`)).emit(O(`drag`)),e.redrawHint(`drag`,!0),e.redraw()}}else D();n=!0}if(f[2]=l[0],f[3]=l[1],n)return t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1}},!1);var E,D,O;e.registerBinding(t,`mouseup`,function(t){if(!(e.hoverData.which===1&&t.which!==1&&e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var r=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,c=e.findNearestElement(o[0],o[1],!0,!1),l=e.dragData.possibleDragElements,u=e.hoverData.down,d=a(t);e.data.bgActivePosistion&&(e.redrawHint(`select`,!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,u&&u.unactivate();var f=function(e){return{originalEvent:t,type:e,position:{x:o[0],y:o[1]}}};if(e.hoverData.which===3){var p=f(`cxttapend`);if(u?u.emit(p):r.emit(p),!e.hoverData.cxtDragged){var m=f(`cxttap`);u?u.emit(m):r.emit(m)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(i(c,[`mouseup`,`tapend`,`vmouseup`],t,{x:o[0],y:o[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(i(u,[`click`,`tap`,`vclick`],t,{x:o[0],y:o[1]}),D=!1,t.timeStamp-O<=r.multiClickDebounceTime()?(E&&clearTimeout(E),D=!0,O=null,i(u,[`dblclick`,`dbltap`,`vdblclick`],t,{x:o[0],y:o[1]})):(E=setTimeout(function(){D||i(u,[`oneclick`,`onetap`,`voneclick`],t,{x:o[0],y:o[1]})},r.multiClickDebounceTime()),O=t.timeStamp)),u==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(t)&&(r.$(n).unselect([`tapunselect`]),l.length>0&&e.redrawHint(`eles`,!0),e.dragData.possibleDragElements=l=r.collection()),c==u&&!e.dragData.didDrag&&!e.hoverData.selecting&&c!=null&&c._private.selectable&&(e.hoverData.dragging||(r.selectionType()===`additive`||d?c.selected()?c.unselect([`tapunselect`]):c.select([`tapselect`]):d||(r.$(n).unmerge(c).unselect([`tapunselect`]),c.select([`tapselect`]))),e.redrawHint(`eles`,!0)),e.hoverData.selecting){var g=r.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint(`select`,!0),g.length>0&&e.redrawHint(`eles`,!0),r.emit(f(`boxend`)),r.selectionType()===`additive`||d||r.$(n).unmerge(g).unselect(),g.emit(f(`box`)).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(f(`boxselect`)),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint(`select`,!0),e.redrawHint(`eles`,!0),e.redraw()),!s[4]){e.redrawHint(`drag`,!0),e.redrawHint(`eles`,!0);var _=u&&u.grabbed();h(l),_&&(u.emit(f(`freeon`)),l.emit(f(`free`)),e.dragData.didDrag&&(u.emit(f(`dragfreeon`)),l.emit(f(`dragfree`))))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}},!1);var k=[],A=4,j,M=1e5,N=function(e,t){for(var n=0;n<e.length;n++)if(e[n]%t!==0)return!1;return!0},P=function(e){for(var t=Math.abs(e[0]),n=1;n<e.length;n++)if(Math.abs(e[n])!==t)return!1;return!0},F=function(t){var n=!1,r=t.deltaY;if(r??(t.wheelDeltaY==null?t.wheelDelta!=null&&(r=t.wheelDelta/4):r=t.wheelDeltaY/4),r!==0){if(j==null)if(k.length>=A){var i=k;if(j=N(i,5),!j){var a=Math.abs(i[0]);j=P(i)&&a>5}if(j)for(var o=0;o<i.length;o++)M=Math.min(Math.abs(i[o]),M)}else k.push(r),n=!0;else j&&(M=Math.min(Math.abs(r),M));if(!e.scrollingPage){var s=e.cy,c=s.zoom(),l=s.pan(),u=e.projectIntoViewport(t.clientX,t.clientY),d=[u[0]*c+l.x,u[1]*c+l.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||C()){t.preventDefault();return}if(s.panningEnabled()&&s.userPanningEnabled()&&s.zoomingEnabled()&&s.userZoomingEnabled()){t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint(`eles`,!0),e.redraw()},150);var f;n&&Math.abs(r)>5&&(r=tR(r)*5),f=r/-250,j&&(f/=M,f*=3),f*=e.wheelSensitivity,t.deltaMode===1&&(f*=33);var p=s.zoom()*10**f;t.type===`gesturechange`&&(p=e.gestureStartZoom*t.scale),s.zoom({level:p,renderedPosition:{x:d[0],y:d[1]}}),s.emit({type:t.type===`gesturechange`?`pinchzoom`:`scrollzoom`,originalEvent:t,position:{x:u[0],y:u[1]}})}}}};e.registerBinding(e.container,`wheel`,F,!0),e.registerBinding(t,`scroll`,function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,`gesturestart`,function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()},!0),e.registerBinding(e.container,`gesturechange`,function(t){e.hasTouchStarted||F(t)},!0),e.registerBinding(e.container,`mouseout`,function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:`mouseout`,position:{x:n[0],y:n[1]}})},!1),e.registerBinding(e.container,`mouseover`,function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:`mouseover`,position:{x:n[0],y:n[1]}})},!1);var I,L,R,ee,z,B,V,H,te,ne,U,re,ie,ae=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},oe=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)},se;e.registerBinding(e.container,`touchstart`,se=function(t){if(e.hasTouchStarted=!0,w(t)){_(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,r=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);r[0]=o[0],r[1]=o[1]}if(t.touches[1]){var o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);r[2]=o[0],r[3]=o[1]}if(t.touches[2]){var o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);r[4]=o[0],r[5]=o[1]}var s=function(e){return{originalEvent:t,type:e,position:{x:r[0],y:r[1]}}};if(t.touches[1]){e.touchData.singleTouchMoved=!0,h(e.dragData.touchDragEles);var c=e.findContainerClientCoords();te=c[0],ne=c[1],U=c[2],re=c[3],I=t.touches[0].clientX-te,L=t.touches[0].clientY-ne,R=t.touches[1].clientX-te,ee=t.touches[1].clientY-ne,ie=0<=I&&I<=U&&0<=R&&R<=U&&0<=L&&L<=re&&0<=ee&&ee<=re;var u=n.pan(),d=n.zoom();z=ae(I,L,R,ee),B=oe(I,L,R,ee),V=[(I+R)/2,(L+ee)/2],H=[(V[0]-u.x)/d,(V[1]-u.y)/d];var f=200,g=f*f;if(B<g&&!t.touches[2]){var v=e.findNearestElement(r[0],r[1],!0,!0),y=e.findNearestElement(r[2],r[3],!0,!0);v&&v.isNode()?(v.activate().emit(s(`cxttapstart`)),e.touchData.start=v):y&&y.isNode()?(y.activate().emit(s(`cxttapstart`)),e.touchData.start=y):n.emit(s(`cxttapstart`)),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(!t.touches[1]&&t.touches[0]){var b=e.findNearestElements(r[0],r[1],!0,!0),x=b[0];if(x!=null&&(x.activate(),e.touchData.start=x,e.touchData.starts=b,e.nodeIsGrabbable(x))){var S=e.dragData.touchDragEles=n.collection(),C=null;e.redrawHint(`eles`,!0),e.redrawHint(`drag`,!0),x.selected()?(C=n.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),p(C,{addToList:S})):m(x,{addToList:S}),l(x),x.emit(s(`grabon`)),C?C.forEach(function(e){e.emit(s(`grab`))}):x.emit(s(`grab`))}i(x,[`touchstart`,`tapstart`,`vmousedown`],t,{x:r[0],y:r[1]}),x??(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint(`select`,!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&i(e.touchData.start,[`taphold`],t,{x:r[0],y:r[1]})},e.tapholdDuration)}if(t.touches.length>=1){for(var T=e.touchData.startPosition=[null,null,null,null,null,null],E=0;E<r.length;E++)T[E]=a[E]=r[E];var D=t.touches[0];e.touchData.startGPosition=[D.clientX,D.clientY]}}},!1);var ce;e.registerBinding(t,`touchmove`,ce=function(t){var n=e.touchData.capture;if(!(!n&&!w(t))){var r=e.selection,a=e.cy,s=e.touchData.now,c=e.touchData.earlier,l=a.zoom();if(t.touches[0]){var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=u[0],s[1]=u[1]}if(t.touches[1]){var u=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=u[0],s[3]=u[1]}if(t.touches[2]){var u=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=u[0],s[5]=u[1]}var d=function(e){return{originalEvent:t,type:e,position:{x:s[0],y:s[1]}}},f=e.touchData.startGPosition,m;if(n&&t.touches[0]&&f){for(var g=[],_=0;_<s.length;_++)g[_]=s[_]-c[_];var v=t.touches[0].clientX-f[0],y=v*v,b=t.touches[0].clientY-f[1];m=y+b*b>=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var x=t.touches[0].clientX-te,S=t.touches[0].clientY-ne,C=t.touches[1].clientX-te,T=t.touches[1].clientY-ne,E=oe(x,S,C,T),D=E/B,O=150,k=O*O,A=1.5;if(D>=A*A||E>=k){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);var j=d(`cxttapend`);e.touchData.start?(e.touchData.start.unactivate().emit(j),e.touchData.start=null):a.emit(j)}}if(n&&e.touchData.cxt){var j=d(`cxtdrag`);e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0),e.touchData.start?e.touchData.start.emit(j):a.emit(j),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var M=e.findNearestElement(s[0],s[1],!0,!0);(!e.touchData.cxtOver||M!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit(d(`cxtdragout`)),e.touchData.cxtOver=M,M&&M.emit(d(`cxtdragover`)))}else if(n&&t.touches[2]&&a.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||a.emit(d(`boxstart`)),e.touchData.selecting=!0,e.touchData.didSelect=!0,r[4]=1,!r||r.length===0||r[0]===void 0?(r[0]=(s[0]+s[2]+s[4])/3,r[1]=(s[1]+s[3]+s[5])/3,r[2]=(s[0]+s[2]+s[4])/3+1,r[3]=(s[1]+s[3]+s[5])/3+1):(r[2]=(s[0]+s[2]+s[4])/3,r[3]=(s[1]+s[3]+s[5])/3),e.redrawHint(`select`,!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&a.zoomingEnabled()&&a.panningEnabled()&&a.userZoomingEnabled()&&a.userPanningEnabled()){t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);var N=e.dragData.touchDragEles;if(N){e.redrawHint(`drag`,!0);for(var P=0;P<N.length;P++){var F=N[P]._private;F.grabbed=!1,F.rscratch.inDragLayer=!1}}var V=e.touchData.start,x=t.touches[0].clientX-te,S=t.touches[0].clientY-ne,C=t.touches[1].clientX-te,T=t.touches[1].clientY-ne,U=ae(x,S,C,T),re=U/z;if(ie){var se=x-I,ce=S-L,le=C-R,ue=T-ee,de=(se+le)/2,fe=(ce+ue)/2,pe=a.zoom(),me=pe*re,he=a.pan(),ge=H[0]*pe+he.x,_e=H[1]*pe+he.y,ve={x:-me/pe*(ge-he.x-de)+ge,y:-me/pe*(_e-he.y-fe)+_e};if(V&&V.active()){var N=e.dragData.touchDragEles;h(N),e.redrawHint(`drag`,!0),e.redrawHint(`eles`,!0),V.unactivate().emit(d(`freeon`)),N.emit(d(`free`)),e.dragData.didDrag&&(V.emit(d(`dragfreeon`)),N.emit(d(`dragfree`)))}a.viewport({zoom:me,pan:ve,cancelOnFailedZoom:!0}),a.emit(d(`pinchzoom`)),z=U,I=x,L=S,R=C,ee=T,e.pinching=!0}if(t.touches[0]){var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=u[0],s[1]=u[1]}if(t.touches[1]){var u=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=u[0],s[3]=u[1]}if(t.touches[2]){var u=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=u[0],s[5]=u[1]}}else if(t.touches[0]&&!e.touchData.didSelect){var ye=e.touchData.start,be=e.touchData.last,M;if(!e.hoverData.draggingEles&&!e.swipePanning&&(M=e.findNearestElement(s[0],s[1],!0,!0)),n&&ye!=null&&t.preventDefault(),n&&ye!=null&&e.nodeIsDraggable(ye))if(m){var N=e.dragData.touchDragEles,xe=!e.dragData.didDrag;xe&&p(N,{inDragLayer:!0}),e.dragData.didDrag=!0;var Se={x:0,y:0};if($(g[0])&&$(g[1])&&(Se.x+=g[0],Se.y+=g[1],xe)){e.redrawHint(`eles`,!0);var Ce=e.touchData.dragDelta;Ce&&$(Ce[0])&&$(Ce[1])&&(Se.x+=Ce[0],Se.y+=Ce[1])}e.hoverData.draggingEles=!0,N.silentShift(Se).emit(d(`position`)).emit(d(`drag`)),e.redrawHint(`drag`,!0),e.touchData.startPosition[0]==c[0]&&e.touchData.startPosition[1]==c[1]&&e.redrawHint(`eles`,!0),e.redraw()}else{var Ce=e.touchData.dragDelta=e.touchData.dragDelta||[];Ce.length===0?(Ce.push(g[0]),Ce.push(g[1])):(Ce[0]+=g[0],Ce[1]+=g[1])}if(i(ye||M,[`touchmove`,`tapdrag`,`vmousemove`],t,{x:s[0],y:s[1]}),(!ye||!ye.grabbed())&&M!=be&&(be&&be.emit(d(`tapdragout`)),M&&M.emit(d(`tapdragover`))),e.touchData.last=M,n)for(var P=0;P<s.length;P++)s[P]&&e.touchData.startPosition[P]&&m&&(e.touchData.singleTouchMoved=!0);if(n&&(ye==null||ye.pannable())&&a.panningEnabled()&&a.userPanningEnabled()){o(ye,e.touchData.starts)&&(t.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=qL(e.touchData.startPosition)),e.swipePanning?(a.panBy({x:g[0]*l,y:g[1]*l}),a.emit(d(`dragpan`))):m&&(e.swipePanning=!0,a.panBy({x:v*l,y:b*l}),a.emit(d(`dragpan`)),ye&&(ye.unactivate(),e.redrawHint(`select`,!0),e.touchData.start=null)));var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=u[0],s[1]=u[1]}}for(var _=0;_<s.length;_++)c[_]=s[_];n&&t.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0),e.redraw())}},!1);var le;e.registerBinding(t,`touchcancel`,le=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()});var ue,de,fe,pe;if(e.registerBinding(t,`touchend`,ue=function(t){var r=e.touchData.start;if(e.touchData.capture)t.touches.length===0&&(e.touchData.capture=!1),t.preventDefault();else return;var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o=e.cy,s=o.zoom(),c=e.touchData.now,l=e.touchData.earlier;if(t.touches[0]){var u=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);c[0]=u[0],c[1]=u[1]}if(t.touches[1]){var u=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);c[2]=u[0],c[3]=u[1]}if(t.touches[2]){var u=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);c[4]=u[0],c[5]=u[1]}var d=function(e){return{originalEvent:t,type:e,position:{x:c[0],y:c[1]}}};r&&r.unactivate();var f;if(e.touchData.cxt){if(f=d(`cxttapend`),r?r.emit(f):o.emit(f),!e.touchData.cxtDragged){var p=d(`cxttap`);r?r.emit(p):o.emit(p)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!t.touches[2]&&o.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var m=o.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint(`select`,!0),o.emit(d(`boxend`)),m.emit(d(`box`)).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(d(`boxselect`)),m.nonempty()&&e.redrawHint(`eles`,!0),e.redraw()}if(r?.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);else if(!t.touches[1]&&!t.touches[0]&&!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint(`select`,!0);var g=e.dragData.touchDragEles;if(r!=null){var _=r._private.grabbed;h(g),e.redrawHint(`drag`,!0),e.redrawHint(`eles`,!0),_&&(r.emit(d(`freeon`)),g.emit(d(`free`)),e.dragData.didDrag&&(r.emit(d(`dragfreeon`)),g.emit(d(`dragfree`)))),i(r,[`touchend`,`tapend`,`vmouseup`,`tapdragout`],t,{x:c[0],y:c[1]}),r.unactivate(),e.touchData.start=null}else i(e.findNearestElement(c[0],c[1],!0,!0),[`touchend`,`tapend`,`vmouseup`,`tapdragout`],t,{x:c[0],y:c[1]});var v=e.touchData.startPosition[0]-c[0],y=v*v,b=e.touchData.startPosition[1]-c[1],x=(y+b*b)*s*s;e.touchData.singleTouchMoved||(r||o.$(`:selected`).unselect([`tapunselect`]),i(r,[`tap`,`vclick`],t,{x:c[0],y:c[1]}),de=!1,t.timeStamp-pe<=o.multiClickDebounceTime()?(fe&&clearTimeout(fe),de=!0,pe=null,i(r,[`dbltap`,`vdblclick`],t,{x:c[0],y:c[1]})):(fe=setTimeout(function(){de||i(r,[`onetap`,`voneclick`],t,{x:c[0],y:c[1]})},o.multiClickDebounceTime()),pe=t.timeStamp)),r!=null&&!e.dragData.didDrag&&r._private.selectable&&x<e.touchTapThreshold2&&!e.pinching&&(o.selectionType()===`single`?(o.$(n).unmerge(r).unselect([`tapunselect`]),r.select([`tapselect`])):r.selected()?r.unselect([`tapunselect`]):r.select([`tapselect`]),e.redrawHint(`eles`,!0)),e.touchData.singleTouchMoved=!0}for(var S=0;S<c.length;S++)l[S]=c[S];e.dragData.didDrag=!1,t.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),t.touches.length<2&&(t.touches.length===1&&(e.touchData.startGPosition=[t.touches[0].clientX,t.touches[0].clientY]),e.pinching=!1,e.redrawHint(`eles`,!0),e.redraw())},!1),typeof TouchEvent>`u`){var me=[],he=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},ge=function(e){return{event:e,touch:he(e)}},_e=function(e){me.push(ge(e))},ve=function(e){for(var t=0;t<me.length;t++)if(me[t].event.pointerId===e.pointerId){me.splice(t,1);return}},ye=function(e){var t=me.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=he(e)},be=function(e){e.touches=me.map(function(e){return e.touch})},xe=function(e){return e.pointerType===`mouse`||e.pointerType===4};e.registerBinding(e.container,`pointerdown`,function(e){xe(e)||(e.preventDefault(),_e(e),be(e),se(e))}),e.registerBinding(e.container,`pointerup`,function(e){xe(e)||(ve(e),be(e),ue(e))}),e.registerBinding(e.container,`pointercancel`,function(e){xe(e)||(ve(e),be(e),le(e))}),e.registerBinding(e.container,`pointermove`,function(e){xe(e)||(e.preventDefault(),ye(e),be(e),ce(e))})}};var sJ={};sJ.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(`polygon`,e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o,s){return HR(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o,s){return MR(e,t,this.points,a,o,r,i,[0,-1],n)},hasMiterBounds:e!==`rectangle`,miterBounds:function(e,t,n,r,i,a){return CR(this.points,e,t,n,r,i)}}},sJ.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:`ellipse`,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){return IR(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o,s){return LR(e,t,r,i,a,o,n)}}},sJ.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,n,r,i,a,o,s){if(o[s]!==void 0&&o[s+`-cx`]===e&&o[s+`-cy`]===n)return o[s];o[s]=Array(t.length/2),o[s+`-cx`]=e,o[s+`-cy`]=n;var c=r/2,l=i/2;a=a===`auto`?YR(r,i):a;for(var u=Array(t.length/2),d=0;d<t.length/2;d++)u[d]={x:e+c*t[d*2],y:n+l*t[d*2+1]};var f,p,m,h,g=u.length;for(p=u[g-1],f=0;f<g;f++)m=u[f%g],h=u[(f+1)%g],o[s][f]=Rq(p,m,h,a),p=m,m=h;return o[s]},draw:function(e,t,n,r,i,a,o){this.renderer.nodeShapeImpl(`round-polygon`,e,t,n,r,i,this.points,this.getOrCreateCorners(t,n,r,i,a,o,`drawCorners`))},intersectLine:function(e,t,n,r,i,a,o,s,c){return UR(i,a,this.points,e,t,n,r,o,this.getOrCreateCorners(e,t,n,r,s,c,`corners`))},checkPoint:function(e,t,n,r,i,a,o,s,c){return NR(e,t,this.points,a,o,r,i,this.getOrCreateCorners(a,o,r,i,s,c,`corners`))}}},sJ.generateRoundRectangle=function(){return this.nodeShapes[`round-rectangle`]=this.nodeShapes.roundrectangle={renderer:this,name:`round-rectangle`,points:GR(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){return wR(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var c=r/2,l=i/2;s=s===`auto`?JR(r,i):s,s=Math.min(c,l,s);var u=s*2;return!!(MR(e,t,this.points,a,o,r,i-u,[0,-1],n)||MR(e,t,this.points,a,o,r-u,i,[0,-1],n)||LR(e,t,u,u,a-c+s,o-l+s,n)||LR(e,t,u,u,a+c-s,o-l+s,n)||LR(e,t,u,u,a+c-s,o+l-s,n)||LR(e,t,u,u,a-c+s,o+l-s,n))}}},sJ.generateCutRectangle=function(){return this.nodeShapes[`cut-rectangle`]=this.nodeShapes.cutrectangle={renderer:this,name:`cut-rectangle`,cornerLength:XR(),points:GR(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,null,a)},generateCutTrianglePts:function(e,t,n,r,i){var a=i===`auto`?this.cornerLength:i,o=t/2,s=e/2,c=n-s,l=n+s,u=r-o,d=r+o;return{topLeft:[c,u+a,c+a,u,c+a,u+a],topRight:[l-a,u,l,u+a,l-a,u+a],bottomRight:[l,d-a,l-a,d,l-a,d-a],bottomLeft:[c+a,d,c,d-a,c+a,d-a]}},intersectLine:function(e,t,n,r,i,a,o,s){var c=this.generateCutTrianglePts(n+2*o,r+2*o,e,t,s);return HR(i,a,[].concat.apply([],[c.topLeft.splice(0,4),c.topRight.splice(0,4),c.bottomRight.splice(0,4),c.bottomLeft.splice(0,4)]),e,t)},checkPoint:function(e,t,n,r,i,a,o,s){var c=s===`auto`?this.cornerLength:s;if(MR(e,t,this.points,a,o,r,i-2*c,[0,-1],n)||MR(e,t,this.points,a,o,r-2*c,i,[0,-1],n))return!0;var l=this.generateCutTrianglePts(r,i,a,o);return jR(e,t,l.topLeft)||jR(e,t,l.topRight)||jR(e,t,l.bottomRight)||jR(e,t,l.bottomLeft)}}},sJ.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:`barrel`,points:GR(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){var c=.15,l=.5,u=.85,d=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),f=function(e){var t=oR({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},c),n=oR({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},l),r=oR({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},u);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]};return HR(i,a,[].concat(f(d.topLeft),f(d.topRight),f(d.bottomRight),f(d.bottomLeft)),e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,c=r-i,l=r+i,u=QR(e,t),d=u.heightOffset,f=u.widthOffset,p=u.ctrlPtOffsetPct*e,m={topLeft:[o,c+d,o+p,c,o+f,c],topRight:[s-f,c,s-p,c,s,c+d],bottomRight:[s,l-d,s-p,l,s-f,l],bottomLeft:[o+f,l,o+p,l,o,l-d]};return m.topLeft.isTop=!0,m.topRight.isTop=!0,m.bottomLeft.isBottom=!0,m.bottomRight.isBottom=!0,m},checkPoint:function(e,t,n,r,i,a,o,s){var c=QR(r,i),l=c.heightOffset,u=c.widthOffset;if(MR(e,t,this.points,a,o,r,i-2*l,[0,-1],n)||MR(e,t,this.points,a,o,r-2*u,i,[0,-1],n))return!0;for(var d=this.generateBarrelBezierPts(r,i,a,o),f=function(e,t,n){var r=n[4],i=n[2],a=n[0],o=n[5],s=n[1];if(Math.min(r,a)<=e&&e<=Math.max(r,a)&&Math.min(o,s)<=t&&t<=Math.max(o,s)){var c=ZR(r,i,a),l=DR(c[0],c[1],c[2],e).filter(function(e){return 0<=e&&e<=1});if(l.length>0)return l[0]}return null},p=Object.keys(d),m=0;m<p.length;m++){var h=d[p[m]],g=f(e,t,h);if(g!=null){var _=h[5],v=h[3],y=h[1],b=aR(_,v,y,g);if(h.isTop&&b<=t||h.isBottom&&t<=b)return!0}}return!1}}},sJ.generateBottomRoundrectangle=function(){return this.nodeShapes[`bottom-round-rectangle`]=this.nodeShapes.bottomroundrectangle={renderer:this,name:`bottom-round-rectangle`,points:GR(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){var c=e-(n/2+o),l=t-(r/2+o),u=l,d=BR(i,a,e,t,c,l,e+(n/2+o),u,!1);return d.length>0?d:wR(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){s=s===`auto`?JR(r,i):s;var c=2*s;if(MR(e,t,this.points,a,o,r,i-c,[0,-1],n)||MR(e,t,this.points,a,o,r-c,i,[0,-1],n))return!0;var l=r/2+2*n,u=i/2+2*n;return!!(jR(e,t,[a-l,o-u,a-l,o,a+l,o,a+l,o-u])||LR(e,t,c,c,a+r/2-s,o+i/2-s,n)||LR(e,t,c,c,a-r/2+s,o+i/2-s,n))}}},sJ.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon(`triangle`,GR(3,0)),this.generateRoundPolygon(`round-triangle`,GR(3,0)),this.generatePolygon(`rectangle`,GR(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon(`diamond`,n),this.generateRoundPolygon(`round-diamond`,n),this.generatePolygon(`pentagon`,GR(5,0)),this.generateRoundPolygon(`round-pentagon`,GR(5,0)),this.generatePolygon(`hexagon`,GR(6,0)),this.generateRoundPolygon(`round-hexagon`,GR(6,0)),this.generatePolygon(`heptagon`,GR(7,0)),this.generateRoundPolygon(`round-heptagon`,GR(7,0)),this.generatePolygon(`octagon`,GR(8,0)),this.generateRoundPolygon(`round-octagon`,GR(8,0));var r=Array(20),i=qR(5,0),a=qR(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[s*2]*=o,a[s*2+1]*=o;for(var s=0;s<20/4;s++)r[s*4]=i[s*2],r[s*4+1]=i[s*2+1],r[s*4+2]=a[s*2],r[s*4+3]=a[s*2+1];r=KR(r),this.generatePolygon(`star`,r),this.generatePolygon(`vee`,[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon(`rhomboid`,[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon(`right-rhomboid`,[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon(`concave-hexagon`,[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var c=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon(`tag`,c),this.generateRoundPolygon(`round-tag`,c),e.makePolygon=function(e){var n=`polygon-`+e.join(`$`),r;return(r=this[n])?r:t.generatePolygon(n,e)}};var cJ={};cJ.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},cJ.redraw=function(e){e||=lL();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},cJ.beforeRender=function(e,t){if(!this.destroyed){t??tL(`Priority is not optional for beforeRender`);var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(e,t){return t.priority-e.priority})}};var lJ=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};cJ.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(r){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){lJ(e,!0,r);var i=AI();e.render(e.renderOptions);var a=e.lastDrawTime=AI();e.averageRedrawTime===void 0&&(e.averageRedrawTime=a-i),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else lJ(e,!1,r);e.skipFrame=!1,kI(n)}};kI(n)}};var uJ=function(e){this.init(e)},dJ=uJ.prototype;dJ.clientFunctions=[`redrawHint`,`render`,`renderTo`,`matchCanvasSize`,`nodeShapeImpl`,`arrowShapeImpl`],dJ.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var i=r.document,a=i.head,o=`__________cytoscape_stylesheet`,s=`__________cytoscape_container`,c=i.getElementById(o)!=null;if(n.className.indexOf(s)<0&&(n.className=(n.className||``)+` `+s),!c){var l=i.createElement(`style`);l.id=o,l.textContent=`.`+s+` { position: relative; }`,a.insertBefore(l,a.children[0])}r.getComputedStyle(n).getPropertyValue(`position`)===`static`&&rL(`A Cytoscape container has style position:static and so can not use UI extensions properly`)}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.webgl=e.webgl,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=$(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},dJ.notify=function(e,t){var n=this,r=n.cy;if(!this.destroyed){if(e===`init`){n.load();return}if(e===`destroy`){n.destroy();return}(e===`add`||e===`remove`||e===`move`&&r.hasCompoundNodes()||e===`load`||e===`zorder`||e===`mount`)&&n.invalidateCachedZSortedEles(),e===`viewport`&&n.redrawHint(`select`,!0),e===`gc`&&n.redrawHint(`gc`,!0),(e===`load`||e===`resize`||e===`mount`)&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint(`eles`,!0),n.redrawHint(`drag`,!0),this.startRenderLoop(),this.redraw()}},dJ.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n.target;(r.off||r.removeEventListener).apply(r,n.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}},dJ.isHeadless=function(){return!1},[fq,tJ,nJ,oJ,sJ,cJ].forEach(function(e){EF(dJ,e)});var fJ=1e3/60,pJ={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=TI(function(){n.redrawHint(`eles`,!0),n.redrawHint(`drag`,!0),n.redraw()},e.deqRedrawThreshold),i=function(i,a){var o=AI(),s=n.averageRedrawTime,c=n.lastRedrawTime,l=[],u=n.cy.extent(),d=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var f=AI(),p=f-o,m=f-a;if(c<fJ){var h=fJ-(i?s:0);if(m>=e.deqFastCost*h)break}else if(i){if(p>=e.deqCost*c||p>=e.deqAvgCost*s)break}else if(m>=e.deqNoDrawCost*fJ)break;var g=e.deq(t,d,u);if(g.length>0)for(var _=0;_<g.length;_++)l.push(g[_]);else break}l.length>0&&(e.onDeqd(t,l),!i&&e.shouldRedraw(t,l,d,u)&&r())},a=e.priority||eL;n.beforeRender(i,a(t))}}}},mJ=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:QI;TP(this,e),this.idsByKey=new gL,this.keyForId=new gL,this.cachesByLvl=new gL,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return DP(e,[{key:`getIdsFor`,value:function(e){e??tL(`Can not get id list for null key`);var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new yL,t.set(e,n)),n}},{key:`addIdForKey`,value:function(e,t){e!=null&&this.getIdsFor(e).add(t)}},{key:`deleteIdForKey`,value:function(e,t){e!=null&&this.getIdsFor(e).delete(t)}},{key:`getNumberOfIdsForKey`,value:function(e){return e==null?0:this.getIdsFor(e).size}},{key:`updateKeyMappingFor`,value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:`deleteKeyMappingFor`,value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:`keyHasChangedFor`,value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:`isInvalid`,value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:`getCachesAt`,value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new gL,t.set(e,r),n.push(e)),r}},{key:`getCache`,value:function(e,t){return this.getCachesAt(t).get(e)}},{key:`get`,value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return r!=null&&this.updateKeyMappingFor(e),r}},{key:`getForCachedKey`,value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:`hasCache`,value:function(e,t){return this.getCachesAt(t).has(e)}},{key:`has`,value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:`setCache`,value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:`set`,value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:`deleteCache`,value:function(e,t){this.getCachesAt(t).delete(e)}},{key:`delete`,value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:`invalidateKey`,value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:`invalidate`,value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||this.getNumberOfIdsForKey(n)===0}}])}(),hJ=25,gJ=50,_J=-4,vJ=3,yJ=7.99,bJ=8,xJ=1024,SJ=1024,CJ=1024,wJ=.2,TJ=.8,EJ=10,DJ=.15,OJ=.1,kJ=.9,AJ=.9,jJ=100,MJ=1,NJ={dequeue:`dequeue`,downscale:`downscale`,highQuality:`highQuality`},PJ=uL({getKey:null,doesEleInvalidateKey:QI,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:ZI,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),FJ=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=PJ(t);EF(n,r),n.lookup=new mJ(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},IJ=FJ.prototype;IJ.reasons=NJ,IJ.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},IJ.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{};return n[e]=n[e]||[]},IJ.getElementQueue=function(){var e=this;return e.eleCacheQueue=e.eleCacheQueue||new AL(function(e,t){return t.reqs-e.reqs})},IJ.getElementKeyToQueue=function(){var e=this;return e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{}},IJ.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),c=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(r??=Math.ceil(eR(s*n)),r<_J)r=_J;else if(s>=yJ||r>vJ)return null;var l=2**r,u=t.h*l,d=t.w*l,f=o.eleTextBiggerThanMin(e,l);if(!this.isVisible(e,f))return null;var p=c.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;var m=u<=hJ?hJ:u<=gJ?gJ:Math.ceil(u/gJ)*gJ;if(u>CJ||d>SJ)return null;var h=a.getTextureQueue(m),g=h[h.length-2],_=function(){return a.recycleTexture(m,d)||a.addTexture(m,d)};g||=h[h.length-1],g||=_(),g.width-g.usedWidth<d&&(g=_());for(var v=function(e){return e&&e.scaledLabelShown===f},y=i&&i===NJ.dequeue,b=i&&i===NJ.highQuality,x=i&&i===NJ.downscale,S,C=r+1;C<=vJ;C++){var w=c.get(e,C);if(w){S=w;break}}var T=S&&S.level===r+1?S:null,E=function(){g.context.drawImage(T.texture.canvas,T.x,0,T.width,T.height,g.usedWidth,0,d,u)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,d,m),v(T))E();else if(v(S))if(b){for(var D=S.level;D>r;D--)T=a.getElement(e,t,n,D,NJ.downscale);E()}else return a.queueElement(e,S.level-1),S;else{var O;if(!y&&!b&&!x)for(var k=r-1;k>=_J;k--){var A=c.get(e,k);if(A){O=A;break}}if(v(O))return a.queueElement(e,r),O;g.context.translate(g.usedWidth,0),g.context.scale(l,l),this.drawElement(g.context,e,t,f,!1),g.context.scale(1/l,1/l),g.context.translate(-g.usedWidth,0)}return p={x:g.usedWidth,texture:g,level:r,scale:l,width:d,height:u,scaledLabelShown:f},g.usedWidth+=Math.ceil(d+bJ),g.eleCaches.push(p),c.set(e,r,p),a.checkTextureFullness(g),p},IJ.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},IJ.invalidateElement=function(e){var t=this,n=t.lookup,r=[];if(n.isInvalid(e)){for(var i=_J;i<=vJ;i++){var a=n.getForCachedKey(e,i);a&&r.push(a)}if(n.invalidate(e))for(var o=0;o<r.length;o++){var s=r[o],c=s.texture;c.invalidatedWidth+=s.width,s.invalidated=!0,t.checkTextureUtility(c)}t.removeFromQueue(e)}},IJ.checkTextureUtility=function(e){e.invalidatedWidth>=wJ*e.width&&this.retireTexture(e)},IJ.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>TJ&&e.fullnessChecks>=EJ?dL(t,e):e.fullnessChecks++},IJ.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),i=this.lookup;dL(r,e),e.retired=!0;for(var a=e.eleCaches,o=0;o<a.length;o++){var s=a[o];i.deleteCache(s.key,s.level)}fL(a),t.getRetiredTextureQueue(n).push(e)},IJ.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),i={};return r.push(i),i.eleCaches=[],i.height=e,i.width=Math.max(xJ,t),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=n.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext(`2d`),i},IJ.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),i=n.getRetiredTextureQueue(e),a=0;a<i.length;a++){var o=i[a];if(o.width>=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,fL(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),dL(i,o),r.push(o),o}},IJ.queueElement=function(e,t){var n=this,r=n.getElementQueue(),i=n.getElementKeyToQueue(),a=this.getKey(e),o=i[a];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,r.updateItem(o);else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:a};r.push(s),i[a]=s}},IJ.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],a=t.lookup,o=0;o<MJ&&n.size()>0;o++){var s=n.pop(),c=s.key,l=s.eles[0],u=a.hasCache(l,s.level);if(r[c]=null,!u){i.push(s);var d=t.getBoundingBox(l);t.getElement(l,d,e,s.level,NJ.dequeue)}}return i},IJ.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=this.getKey(e),a=r[i];a!=null&&(a.eles.length===1?(a.reqs=XI,n.updateItem(a),n.pop(),r[i]=null):a.eles.unmerge(e))},IJ.onDequeue=function(e){this.onDequeues.push(e)},IJ.offDequeue=function(e){dL(this.onDequeues,e)},IJ.setupDequeueing=pJ.setupDequeueing({deqRedrawThreshold:jJ,deqCost:DJ,deqAvgCost:OJ,deqNoDrawCost:kJ,deqFastCost:AJ,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var r=e.onDequeues[n];r(t)}},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++)if(_R(a[o].boundingBox(),r))return!0;return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var LJ=1,RJ=-4,zJ=2,BJ=3.99,VJ=50,HJ=50,UJ=.15,WJ=.1,GJ=.9,KJ=.9,qJ=1,JJ=250,YJ=4e3*4e3,XJ=32767,ZJ=!0,QJ=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=AI()-2*JJ,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=TI(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},HJ),n.beforeRender(function(e,n){n-t.lastInvalidationTime<=JJ?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new AL(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},$J=QJ.prototype,eY=0,tY=2**53-1;$J.makeLayer=function(e,t){var n=2**t,r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:eY=++eY%tY,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext(`2d`),eles:[],elesQueue:[],reqs:0},s=o.context,c=-o.bb.x1,l=-o.bb.y1;return s.scale(n,n),s.translate(c,l),o},$J.getLayers=function(e,t,n){var r=this,i=r.renderer.cy.zoom(),a=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(eR(i*t)),n<RJ)n=RJ;else if(i>=BJ||n>zJ)return null}r.validateLayersElesOrdering(n,e);var o=r.layersByLevel,s=2**n,c=o[n]=o[n]||[],l,u=r.levelIsComplete(n,e),d,f=function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return d=o[t],!0},i=function(e){if(!d)for(var r=n+e;RJ<=r&&r<=zJ&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var s=c[a];s.invalid&&dL(c,s)}};if(!u)f();else return c;var p=function(){if(!l){l=lR();for(var t=0;t<e.length;t++)fR(l,e[t].boundingBox())}return l},m=function(e){e||={};var t=e.after;p();var i=Math.ceil(l.w*s),a=Math.ceil(l.h*s);if(i>XJ||a>XJ||i*a>YJ)return null;var o=r.makeLayer(l,n);if(t!=null){var u=c.indexOf(t)+1;c.splice(u,0,o)}else (e.insert===void 0||e.insert)&&c.unshift(o);return o};if(r.skipping&&!a)return null;for(var h=null,g=e.length/LJ,_=!a,v=0;v<e.length;v++){var y=e[v],b=y._private.rscratch,x=b.imgLayerCaches=b.imgLayerCaches||{},S=x[n];if(S){h=S;continue}if((!h||h.eles.length>=g||!bR(h.bb,y.boundingBox()))&&(h=m({insert:!0,after:h}),!h))return null;d||_?r.queueLayer(h,y):r.drawEleInLayer(h,y,n,t),h.eles.push(y),x[n]=h}return d||(_?null:c)},$J.getEleLevelForLayerLevel=function(e,t){return e},$J.drawEleInLayer=function(e,t,n,r){var i=this,a=this.renderer,o=e.context,s=t.boundingBox();s.w===0||s.h===0||!t.visible()||(n=i.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(o,!1),a.drawCachedElement(o,t,null,null,n,ZJ),a.setImgSmoothing(o,!0))},$J.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||n.length===0)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(a.reqs>0||a.invalid)return!1;r+=a.eles.length}return r===t.length},$J.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0){this.invalidateLayer(i);continue}for(var s=a,o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}},$J.updateElementsInLayers=function(e,t){for(var n=this,r=tF(e[0]),i=0;i<e.length;i++)for(var a=r?null:e[i],o=r?e[i]:e[i].ele,s=o._private.rscratch,c=s.imgLayerCaches=s.imgLayerCaches||{},l=RJ;l<=zJ;l++){var u=c[l];u&&(a&&n.getEleLevelForLayerLevel(u.level)!==a.level||t(u,o,a))}},$J.haveLayers=function(){for(var e=this,t=!1,n=RJ;n<=zJ;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t},$J.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=AI(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},$J.invalidateLayer=function(e){if(this.lastInvalidationTime=AI(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];dL(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},$J.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,n,r){var i=e.replacement;if(i||(i=e.replacement=t.makeLayer(e.bb,e.level),i.replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])})},$J.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},$J.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},$J.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],i=0;i<qJ&&n.size()!==0;){var a=n.peek();if(a.replacement){n.pop();continue}if(a.replaces&&a!==a.replaces.replacement){n.pop();continue}if(a.invalid){n.pop();continue}var o=a.elesQueue.shift();o&&(t.drawEleInLayer(a,o,a.level,e),i++),r.length===0&&r.push(!0),a.elesQueue.length===0&&(n.pop(),a.reqs=0,a.replaces&&t.applyLayerReplacement(a),t.requestRedraw())}return r},$J.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,i=n.indexOf(r);if(!(i<0||r.invalid)){n[i]=e;for(var a=0;a<e.eles.length;a++){var o=e.eles[a]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[e.level]=e)}t.requestRedraw()}},$J.requestRedraw=TI(function(){var e=this.renderer;e.redrawHint(`eles`,!0),e.redrawHint(`drag`,!0),e.redraw()},100),$J.setupDequeueing=pJ.setupDequeueing({deqRedrawThreshold:VJ,deqCost:UJ,deqAvgCost:WJ,deqNoDrawCost:GJ,deqFastCost:KJ,deq:function(e,t){return e.dequeue(t)},onDeqd:eL,shouldRedraw:ZI,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var nY={},rY;function iY(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function aY(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];i===0&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function oY(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var a=r[i];e.lineTo(a.x,a.y)}var o=n,s=n[0];e.moveTo(s.x,s.y);for(var i=1;i<o.length;i++){var a=o[i];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function sY(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,Math.PI*2,!1);var a=t,o=a[0];e.moveTo(o.x,o.y);for(var s=0;s<a.length;s++){var c=a[s];e.lineTo(c.x,c.y)}e.closePath&&e.closePath()}function cY(e,t,n,r){e.arc(t,n,r,0,Math.PI*2,!1)}nY.arrowShapeImpl=function(e){return(rY||={polygon:iY,"triangle-backcurve":aY,"triangle-tee":oY,"circle-triangle":sY,"triangle-cross":oY,circle:cY})[e]};var lY={};lY.drawElement=function(e,t,n,r,i,a){var o=this;t.isNode()?o.drawNode(e,t,n,r,i,a):o.drawEdge(e,t,n,r,i,a)},lY.drawElementOverlay=function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)},lY.drawElementUnderlay=function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)},lY.drawCachedElementPortion=function(e,t,n,r,i,a,o,s){var c=this,l=n.getBoundingBox(t);if(!(l.w===0||l.h===0)){var u=n.getElement(t,l,r,i,a);if(u!=null){var d=s(c,t);if(d===0)return;var f=o(c,t),p=l.x1,m=l.y1,h=l.w,g=l.h,_,v,y,b,x;if(f!==0){var S=n.getRotationPoint(t);y=S.x,b=S.y,e.translate(y,b),e.rotate(f),x=c.getImgSmoothing(e),x||c.setImgSmoothing(e,!0);var C=n.getRotationOffset(t);_=C.x,v=C.y}else _=p,v=m;var w;d!==1&&(w=e.globalAlpha,e.globalAlpha=w*d),e.drawImage(u.texture.canvas,u.x,0,u.width,u.height,_,v,h,g),d!==1&&(e.globalAlpha=w),f!==0&&(e.rotate(-f),e.translate(-y,-b),x||c.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var uY=function(){return 0},dY=function(e,t){return e.getTextAngle(t,null)},fY=function(e,t){return e.getTextAngle(t,`source`)},pY=function(e,t){return e.getTextAngle(t,`target`)},mY=function(e,t){return t.effectiveOpacity()},hY=function(e,t){return t.pstyle(`text-opacity`).pfValue*t.effectiveOpacity()};lY.drawCachedElement=function(e,t,n,r,i,a){var o=this,s=o.data,c=s.eleTxrCache,l=s.lblTxrCache,u=s.slbTxrCache,d=s.tlbTxrCache,f=t.boundingBox(),p=a===!0?c.reasons.highQuality:null;if(!(f.w===0||f.h===0||!t.visible())&&(!r||_R(f,r))){var m=t.isEdge(),h=t.element()._private.rscratch.badLine;o.drawElementUnderlay(e,t),o.drawCachedElementPortion(e,t,c,n,i,p,uY,mY),(!m||!h)&&o.drawCachedElementPortion(e,t,l,n,i,p,dY,hY),m&&!h&&(o.drawCachedElementPortion(e,t,u,n,i,p,fY,hY),o.drawCachedElementPortion(e,t,d,n,i,p,pY,hY)),o.drawElementOverlay(e,t)}},lY.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var i=t[r];n.drawElement(e,i)}},lY.drawCachedElements=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var o=t[a];i.drawCachedElement(e,o,n,r)}},lY.drawCachedNodes=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var o=t[a];o.isNode()&&i.drawCachedElement(e,o,n,r)}},lY.drawLayeredElements=function(e,t,n,r){var i=this,a=i.data.lyrTxrCache.getLayers(t,n);if(a)for(var o=0;o<a.length;o++){var s=a[o],c=s.bb;c.w===0||c.h===0||e.drawImage(s.canvas,c.x1,c.y1,c.w,c.h)}else i.drawCachedElements(e,t,n,r)};var gY={};gY.drawEdge=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=t._private.rscratch;if(!(a&&!t.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var c;n&&(c=n,e.translate(-c.x1,-c.y1));var l=a?t.pstyle(`opacity`).value:1,u=a?t.pstyle(`line-opacity`).value:1,d=t.pstyle(`curve-style`).value,f=t.pstyle(`line-style`).value,p=t.pstyle(`width`).pfValue,m=t.pstyle(`line-cap`).value,h=t.pstyle(`line-outline-width`).value,g=t.pstyle(`line-outline-color`).value,_=l*u,v=l*u,y=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;d===`straight-triangle`?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=m,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,f),e.lineCap=`butt`)},b=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;if(e.lineWidth=p+h,e.lineCap=m,h>0)o.colorStrokeStyle(e,g[0],g[1],g[2],n);else{e.lineCap=`butt`;return}d===`straight-triangle`?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,f),e.lineCap=`butt`)},x=function(){i&&o.drawEdgeOverlay(e,t)},S=function(){i&&o.drawEdgeUnderlay(e,t)},C=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v;o.drawArrowheads(e,t,n)},w=function(){o.drawElementText(e,t,null,r)};if(e.lineJoin=`round`,t.pstyle(`ghost`).value===`yes`){var T=t.pstyle(`ghost-offset-x`).pfValue,E=t.pstyle(`ghost-offset-y`).pfValue,D=_*t.pstyle(`ghost-opacity`).value;e.translate(T,E),y(D),C(D),e.translate(-T,-E)}else b();S(),y(),C(),x(),w(),n&&e.translate(c.x1,c.y1)}};var _Y=function(e){if(![`overlay`,`underlay`].includes(e))throw Error(`Invalid state`);return function(t,n){if(n.visible()){var r=n.pstyle(`${e}-opacity`).value;if(r!==0){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle(`${e}-padding`).pfValue,c=n.pstyle(`${e}-color`).value;t.lineWidth=s,o.edgeType===`self`&&!a?t.lineCap=`butt`:t.lineCap=`round`,i.colorStrokeStyle(t,c[0],c[1],c[2],r),i.drawEdgePath(n,t,o.allpts,`solid`)}}}};gY.drawEdgeOverlay=_Y(`overlay`),gY.drawEdgeUnderlay=_Y(`underlay`),gY.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,o,s=!1,c=this.usePaths(),l=e.pstyle(`line-dash-pattern`).pfValue,u=e.pstyle(`line-dash-offset`).pfValue;if(c){var d=n.join(`$`);i.pathCacheKey&&i.pathCacheKey===d?(o=t=i.pathCache,s=!0):(o=t=new Path2D,i.pathCacheKey=d,i.pathCache=o)}if(a.setLineDash)switch(r){case`dotted`:a.setLineDash([1,1]);break;case`dashed`:a.setLineDash(l),a.lineDashOffset=u;break;case`solid`:a.setLineDash([]);break}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case`bezier`:case`self`:case`compound`:case`multibezier`:for(var f=2;f+3<n.length;f+=4)t.quadraticCurveTo(n[f],n[f+1],n[f+2],n[f+3]);break;case`straight`:case`haystack`:for(var p=2;p+1<n.length;p+=2)t.lineTo(n[p],n[p+1]);break;case`segments`:if(i.isRound){var m=OP(i.roundCorners),h;try{for(m.s();!(h=m.n()).done;){var g=h.value;Lq(t,g)}}catch(e){m.e(e)}finally{m.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var _=2;_+1<n.length;_+=2)t.lineTo(n[_],n[_+1]);break}t=a,c?t.stroke(o):t.stroke(),t.setLineDash&&t.setLineDash([])},gY.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle(`width`).pfValue,i=0;i+1<n.length;i+=2){var a=[n[i+2]-n[i],n[i+3]-n[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],c=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[i]-c[0],n[i+1]-c[1]),t.lineTo(n[i]+c[0],n[i+1]+c[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},gY.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i=r.edgeType===`haystack`;i||this.drawArrowhead(e,t,`source`,r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,`mid-target`,r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,`mid-source`,r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,`target`,r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},gY.drawArrowhead=function(e,t,n,r,i,a,o){if(!(isNaN(r)||r==null||isNaN(i)||i==null||isNaN(a)||a==null)){var s=this,c=t.pstyle(n+`-arrow-shape`).value;if(c!==`none`){var l=t.pstyle(n+`-arrow-fill`).value===`hollow`?`both`:`filled`,u=t.pstyle(n+`-arrow-fill`).value,d=t.pstyle(`width`).pfValue,f=t.pstyle(n+`-arrow-width`),p=f.value===`match-line`?d:f.pfValue;f.units===`%`&&(p*=d);var m=t.pstyle(`opacity`).value;o===void 0&&(o=m);var h=e.globalCompositeOperation;(o!==1||u===`hollow`)&&(e.globalCompositeOperation=`destination-out`,s.colorFillStyle(e,255,255,255,1),s.colorStrokeStyle(e,255,255,255,1),s.drawArrowShape(t,e,l,d,c,p,r,i,a),e.globalCompositeOperation=h);var g=t.pstyle(n+`-arrow-color`).value;s.colorFillStyle(e,g[0],g[1],g[2],o),s.colorStrokeStyle(e,g[0],g[1],g[2],o),s.drawArrowShape(t,e,u,d,c,p,r,i,a)}}},gY.drawArrowShape=function(e,t,n,r,i,a,o,s,c){var l=this,u=this.usePaths()&&i!==`triangle-cross`,d=!1,f,p=t,m={x:o,y:s},h=e.pstyle(`arrow-scale`).value,g=this.getArrowWidth(r,h),_=l.arrowShapes[i];if(u){var v=l.arrowPathCache=l.arrowPathCache||[],y=VI(i),b=v[y];b==null?(f=t=new Path2D,v[y]=f):(f=t=b,d=!0)}d||(t.beginPath&&t.beginPath(),u?_.draw(t,1,0,{x:0,y:0},1):_.draw(t,g,c,m,r),t.closePath&&t.closePath()),t=p,u&&(t.translate(o,s),t.rotate(c),t.scale(g,g)),(n===`filled`||n===`both`)&&(u?t.fill(f):t.fill()),(n===`hollow`||n===`both`)&&(t.lineWidth=a/(u?g:1),t.lineJoin=`miter`,u?t.stroke(f):t.stroke()),u&&(t.scale(1/g,1/g),t.rotate(-c),t.translate(-o,-s))};var vY={};vY.safeDrawImage=function(e,t,n,r,i,a,o,s,c,l){if(!(i<=0||a<=0||c<=0||l<=0))try{e.drawImage(t,n,r,i,a,o,s,c,l)}catch(e){rL(e)}},vY.drawInscribedImage=function(e,t,n,r,i){var a=this,o=n.position(),s=o.x,c=o.y,l=n.cy().style(),u=l.getIndexedStyle.bind(l),d=u(n,`background-fit`,`value`,r),f=u(n,`background-repeat`,`value`,r),p=n.width(),m=n.height(),h=n.padding()*2,g=p+(u(n,`background-width-relative-to`,`value`,r)===`inner`?0:h),_=m+(u(n,`background-height-relative-to`,`value`,r)===`inner`?0:h),v=n._private.rscratch,y=u(n,`background-clip`,`value`,r)===`node`,b=u(n,`background-image-opacity`,`value`,r)*i,x=u(n,`background-image-smoothing`,`value`,r),S=n.pstyle(`corner-radius`).value;S!==`auto`&&(S=n.pstyle(`corner-radius`).pfValue);var C=t.width||t.cachedW,w=t.height||t.cachedH;(C==null||w==null)&&(document.body.appendChild(t),C=t.cachedW=t.width||t.offsetWidth,w=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var T=C,E=w;if(u(n,`background-width`,`value`,r)!==`auto`&&(T=u(n,`background-width`,`units`,r)===`%`?u(n,`background-width`,`pfValue`,r)*g:u(n,`background-width`,`pfValue`,r)),u(n,`background-height`,`value`,r)!==`auto`&&(E=u(n,`background-height`,`units`,r)===`%`?u(n,`background-height`,`pfValue`,r)*_:u(n,`background-height`,`pfValue`,r)),!(T===0||E===0)){if(d===`contain`){var D=Math.min(g/T,_/E);T*=D,E*=D}else if(d===`cover`){var D=Math.max(g/T,_/E);T*=D,E*=D}var O=s-g/2,k=u(n,`background-position-x`,`units`,r),A=u(n,`background-position-x`,`pfValue`,r);k===`%`?O+=(g-T)*A:O+=A;var j=u(n,`background-offset-x`,`units`,r),M=u(n,`background-offset-x`,`pfValue`,r);j===`%`?O+=(g-T)*M:O+=M;var N=c-_/2,P=u(n,`background-position-y`,`units`,r),F=u(n,`background-position-y`,`pfValue`,r);P===`%`?N+=(_-E)*F:N+=F;var I=u(n,`background-offset-y`,`units`,r),L=u(n,`background-offset-y`,`pfValue`,r);I===`%`?N+=(_-E)*L:N+=L,v.pathCache&&(O-=s,N-=c,s=0,c=0);var R=e.globalAlpha;e.globalAlpha=b;var ee=a.getImgSmoothing(e),z=!1;x===`no`&&ee?(a.setImgSmoothing(e,!1),z=!0):x===`yes`&&!ee&&(a.setImgSmoothing(e,!0),z=!0),f===`no-repeat`?(y&&(e.save(),v.pathCache?e.clip(v.pathCache):(a.nodeShapes[a.getNodeShape(n)].draw(e,s,c,g,_,S,v),e.clip())),a.safeDrawImage(e,t,0,0,C,w,O,N,T,E),y&&e.restore()):(e.fillStyle=e.createPattern(t,f),a.nodeShapes[a.getNodeShape(n)].draw(e,s,c,g,_,S,v),e.translate(O,N),e.fill(),e.translate(-O,-N)),e.globalAlpha=R,z&&a.setImgSmoothing(e,ee)}};var yY={};yY.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio();t=2**Math.ceil(eR(n*r))}return!(e.pstyle(`font-size`).pfValue*t<e.pstyle(`min-zoomed-font-size`).pfValue)},yY.drawElementText=function(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(r==null){if(a&&!o.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var s=t.pstyle(`label`);if(!s||!s.value)return;e.textAlign=o.getLabelJustification(t),e.textBaseline=`bottom`}else{var c=t.element()._private.rscratch.badLine,l=t.pstyle(`label`),u=t.pstyle(`source-label`),d=t.pstyle(`target-label`);if(c||(!l||!l.value)&&(!u||!u.value)&&(!d||!d.value))return;e.textAlign=`center`,e.textBaseline=`bottom`}var f=!n,p;n&&(p=n,e.translate(-p.x1,-p.y1)),i==null?(o.drawText(e,t,null,f,a),t.isEdge()&&(o.drawText(e,t,`source`,f,a),o.drawText(e,t,`target`,f,a))):o.drawText(e,t,i,f,a),n&&e.translate(p.x1,p.y1)},yY.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t},yY.setupTextStyle=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle(`font-style`).strValue,i=t.pstyle(`font-size`).pfValue+`px`,a=t.pstyle(`font-family`).strValue,o=t.pstyle(`font-weight`).strValue,s=n?t.effectiveOpacity()*t.pstyle(`text-opacity`).value:1,c=t.pstyle(`text-outline-opacity`).value*s,l=t.pstyle(`color`).value,u=t.pstyle(`text-outline-color`).value;e.font=r+` `+o+` `+i+` `+a,e.lineJoin=`round`,this.colorFillStyle(e,l[0],l[1],l[2],s),this.colorStrokeStyle(e,u[0],u[1],u[2],c)};function bY(e,t,n,r,i){var a=Math.min(r,i)/2,o=t+r/2,s=n+i/2;e.beginPath(),e.arc(o,s,a,0,Math.PI*2),e.closePath()}function xY(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(a,r/2,i/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}yY.getTextAngle=function(e,t){var n,r=e._private.rscratch,i=t?t+`-`:``,a=e.pstyle(i+`text-rotation`);if(a.strValue===`autorotate`){var o=mL(r,`labelAngle`,t);n=e.isEdge()?o:0}else n=a.strValue===`none`?0:a.pfValue;return n},yY.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!(i&&(o===0||t.pstyle(`text-opacity`).value===0))){n===`main`&&(n=null);var s=mL(a,`labelX`,n),c=mL(a,`labelY`,n),l,u,d=this.getLabelText(t,n);if(d!=null&&d!==``&&!isNaN(s)&&!isNaN(c)){this.setupTextStyle(e,t,i);var f=n?n+`-`:``,p=mL(a,`labelWidth`,n),m=mL(a,`labelHeight`,n),h=t.pstyle(f+`text-margin-x`).pfValue,g=t.pstyle(f+`text-margin-y`).pfValue,_=t.isEdge(),v=t.pstyle(`text-halign`).value,y=t.pstyle(`text-valign`).value;_&&(v=`center`,y=`center`),s+=h,c+=g;var b=r?this.getTextAngle(t,n):0;switch(b!==0&&(l=s,u=c,e.translate(l,u),e.rotate(b),s=0,c=0),y){case`top`:break;case`center`:c+=m/2;break;case`bottom`:c+=m;break}var x=t.pstyle(`text-background-opacity`).value,S=t.pstyle(`text-border-opacity`).value,C=t.pstyle(`text-border-width`).pfValue,w=t.pstyle(`text-background-padding`).pfValue,T=t.pstyle(`text-background-shape`).strValue,E=T===`round-rectangle`||T===`roundrectangle`,D=T===`circle`,O=2;if(x>0||C>0&&S>0){var k=e.fillStyle,A=e.strokeStyle,j=e.lineWidth,M=t.pstyle(`text-background-color`).value,N=t.pstyle(`text-border-color`).value,P=t.pstyle(`text-border-style`).value,F=x>0,I=C>0&&S>0,L=s-w;switch(v){case`left`:L-=p;break;case`center`:L-=p/2;break}var R=c-m-w,ee=p+2*w,z=m+2*w;if(F&&(e.fillStyle=`rgba(${M[0]},${M[1]},${M[2]},${x*o})`),I&&(e.strokeStyle=`rgba(${N[0]},${N[1]},${N[2]},${S*o})`,e.lineWidth=C,e.setLineDash))switch(P){case`dotted`:e.setLineDash([1,1]);break;case`dashed`:e.setLineDash([4,2]);break;case`double`:e.lineWidth=C/4,e.setLineDash([]);break;default:e.setLineDash([]);break}if(E?(e.beginPath(),xY(e,L,R,ee,z,O)):D?(e.beginPath(),bY(e,L,R,ee,z)):(e.beginPath(),e.rect(L,R,ee,z)),F&&e.fill(),I&&e.stroke(),I&&P===`double`){var B=C/2;e.beginPath(),E?xY(e,L+B,R+B,ee-2*B,z-2*B,O):e.rect(L+B,R+B,ee-2*B,z-2*B),e.stroke()}e.fillStyle=k,e.strokeStyle=A,e.lineWidth=j,e.setLineDash&&e.setLineDash([])}var V=2*t.pstyle(`text-outline-width`).pfValue;if(V>0&&(e.lineWidth=V),t.pstyle(`text-wrap`).value===`wrap`){var H=mL(a,`labelWrapCachedLines`,n),te=mL(a,`labelLineHeight`,n),ne=p/2,U=this.getLabelJustification(t);switch(U===`auto`||(v===`left`?U===`left`?s+=-p:U===`center`&&(s+=-ne):v===`center`?U===`left`?s+=-ne:U===`right`&&(s+=ne):v===`right`&&(U===`center`?s+=ne:U===`right`&&(s+=p))),y){case`top`:c-=(H.length-1)*te;break;case`center`:case`bottom`:c-=(H.length-1)*te;break}for(var re=0;re<H.length;re++)V>0&&e.strokeText(H[re],s,c),e.fillText(H[re],s,c),c+=te}else V>0&&e.strokeText(d,s,c),e.fillText(d,s,c);b!==0&&(e.rotate(-b),e.translate(-l,-u))}}};var SY={};SY.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,c,l=t._private,u=l.rscratch,d=t.position();if(!(!$(d.x)||!$(d.y))&&!(a&&!t.visible())){var f=a?t.effectiveOpacity():1,p=o.usePaths(),m,h=!1,g=t.padding();s=t.width()+2*g,c=t.height()+2*g;var _;n&&(_=n,e.translate(-_.x1,-_.y1));for(var v=t.pstyle(`background-image`).value,y=Array(v.length),b=Array(v.length),x=0,S=0;S<v.length;S++){var C=v[S];if(y[S]=C!=null&&C!==`none`){var w=t.cy().style().getIndexedStyle(t,`background-image-crossorigin`,`value`,S);x++,b[S]=o.getCachedImage(C,w,function(){l.backgroundTimestamp=Date.now(),t.emitAndNotify(`background`)})}}var T=t.pstyle(`background-blacken`).value,E=t.pstyle(`border-width`).pfValue,D=t.pstyle(`background-opacity`).value*f,O=t.pstyle(`border-color`).value,k=t.pstyle(`border-style`).value,A=t.pstyle(`border-join`).value,j=t.pstyle(`border-cap`).value,M=t.pstyle(`border-position`).value,N=t.pstyle(`border-dash-pattern`).pfValue,P=t.pstyle(`border-dash-offset`).pfValue,F=t.pstyle(`border-opacity`).value*f,I=t.pstyle(`outline-width`).pfValue,L=t.pstyle(`outline-color`).value,R=t.pstyle(`outline-style`).value,ee=t.pstyle(`outline-opacity`).value*f,z=t.pstyle(`outline-offset`).value,B=t.pstyle(`corner-radius`).value;B!==`auto`&&(B=t.pstyle(`corner-radius`).pfValue);var V=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:D;o.eleFillStyle(e,t,n)},H=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;o.colorStrokeStyle(e,O[0],O[1],O[2],t)},te=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ee;o.colorStrokeStyle(e,L[0],L[1],L[2],t)},ne=function(e,t,n,r){var i=o.nodePathCache=o.nodePathCache||[],a=HI(n===`polygon`?n+`,`+r.join(`,`):n,``+t,``+e,``+B),s=i[a],c,l=!1;return s==null?(c=new Path2D,i[a]=u.pathCache=c):(c=s,l=!0,u.pathCache=c),{path:c,cacheHit:l}},U=t.pstyle(`shape`).strValue,re=t.pstyle(`shape-polygon-points`).pfValue;if(p){e.translate(d.x,d.y);var ie=ne(s,c,U,re);m=ie.path,h=ie.cacheHit}var ae=function(){if(!h){var n=d;p&&(n={x:0,y:0}),o.nodeShapes[o.getNodeShape(t)].draw(m||e,n.x,n.y,s,c,B,u)}p?e.fill(m):e.fill()},oe=function(){for(var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=l.backgrounding,a=0,s=0;s<b.length;s++){var c=t.cy().style().getIndexedStyle(t,`background-image-containment`,`value`,s);if(r&&c===`over`||!r&&c===`inside`){a++;continue}y[s]&&b[s].complete&&!b[s].error&&(a++,o.drawInscribedImage(e,b[s],t,s,n))}l.backgrounding=a!==x,i!==l.backgrounding&&t.updateStyle(!1)},se=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;o.hasPie(t)&&(o.drawPie(e,t,r),n&&(p||o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,s,c,B,u)))},ce=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:f;o.hasStripe(t)&&(e.save(),p?e.clip(u.pathCache):(o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,s,c,B,u),e.clip()),o.drawStripe(e,t,r),e.restore(),n&&(p||o.nodeShapes[o.getNodeShape(t)].draw(e,d.x,d.y,s,c,B,u)))},le=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:f,n=(T>0?T:-T)*t,r=T>0?0:255;T!==0&&(o.colorFillStyle(e,r,r,r,n),p?e.fill(m):e.fill())},ue=function(){if(E>0){if(e.lineWidth=E,e.lineCap=j,e.lineJoin=A,e.setLineDash)switch(k){case`dotted`:e.setLineDash([1,1]);break;case`dashed`:e.setLineDash(N),e.lineDashOffset=P;break;case`solid`:case`double`:e.setLineDash([]);break}if(M!==`center`){if(e.save(),e.lineWidth*=2,M===`inside`)p?e.clip(m):e.clip();else{var t=new Path2D;t.rect(-s/2-E,-c/2-E,s+2*E,c+2*E),t.addPath(m),e.clip(t,`evenodd`)}p?e.stroke(m):e.stroke(),e.restore()}else p?e.stroke(m):e.stroke();if(k===`double`){e.lineWidth=E/3;var n=e.globalCompositeOperation;e.globalCompositeOperation=`destination-out`,p?e.stroke(m):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},de=function(){if(I>0){if(e.lineWidth=I,e.lineCap=`butt`,e.setLineDash)switch(R){case`dotted`:e.setLineDash([1,1]);break;case`dashed`:e.setLineDash([4,2]);break;case`solid`:case`double`:e.setLineDash([]);break}var n=d;p&&(n={x:0,y:0});var r=o.getNodeShape(t),i=E;M===`inside`&&(i=0),M===`outside`&&(i*=2);var a=(s+i+(I+z))/s,l=(c+i+(I+z))/c,u=s*a,f=c*l,m=o.nodeShapes[r].points,h;if(p&&(h=ne(u,f,r,m).path),r===`ellipse`)o.drawEllipsePath(h||e,n.x,n.y,u,f);else if([`round-diamond`,`round-heptagon`,`round-hexagon`,`round-octagon`,`round-pentagon`,`round-polygon`,`round-triangle`,`round-tag`].includes(r)){var g=0,_=0,v=0;r===`round-diamond`?g=(i+z+I)*1.4:r===`round-heptagon`?(g=(i+z+I)*1.075,v=-(i/2+z+I)/35):r===`round-hexagon`?g=(i+z+I)*1.12:r===`round-pentagon`?(g=(i+z+I)*1.13,v=-(i/2+z+I)/15):r===`round-tag`?(g=(i+z+I)*1.12,_=(i/2+I+z)*.07):r===`round-triangle`&&(g=(i+z+I)*(Math.PI/2),v=-(i+z/2+I)/Math.PI),g!==0&&(a=(s+g)/s,u=s*a,[`round-hexagon`,`round-tag`].includes(r)||(l=(c+g)/c,f=c*l)),B=B===`auto`?YR(u,f):B;for(var y=u/2,b=f/2,x=B+(i+I+z)/2,S=Array(m.length/2),C=Array(m.length/2),w=0;w<m.length/2;w++)S[w]={x:n.x+_+y*m[w*2],y:n.y+v+b*m[w*2+1]};var T,D,O,k,A=S.length;for(D=S[A-1],T=0;T<A;T++)O=S[T%A],k=S[(T+1)%A],C[T]=Rq(D,O,k,x),D=O,O=k;o.drawRoundPolygonPath(h||e,n.x+_,n.y+v,s*a,c*l,m,C)}else if([`roundrectangle`,`round-rectangle`].includes(r))B=B===`auto`?JR(u,f):B,o.drawRoundRectanglePath(h||e,n.x,n.y,u,f,B+(i+I+z)/2);else if([`cutrectangle`,`cut-rectangle`].includes(r))B=B===`auto`?XR():B,o.drawCutRectanglePath(h||e,n.x,n.y,u,f,null,B+(i+I+z)/4);else if([`bottomroundrectangle`,`bottom-round-rectangle`].includes(r))B=B===`auto`?JR(u,f):B,o.drawBottomRoundRectanglePath(h||e,n.x,n.y,u,f,B+(i+I+z)/2);else if(r===`barrel`)o.drawBarrelPath(h||e,n.x,n.y,u,f);else if(r.startsWith(`polygon`)||[`rhomboid`,`right-rhomboid`,`round-tag`,`tag`,`vee`].includes(r)){var j=(i+I+z)/s;m=PR(FR(m,j)),o.drawPolygonPath(h||e,n.x,n.y,s,c,m)}else{var N=(i+I+z)/s;m=PR(FR(m,-N)),o.drawPolygonPath(h||e,n.x,n.y,s,c,m)}if(p?e.stroke(h):e.stroke(),R===`double`){e.lineWidth=i/3;var P=e.globalCompositeOperation;e.globalCompositeOperation=`destination-out`,p?e.stroke(h):e.stroke(),e.globalCompositeOperation=P}e.setLineDash&&e.setLineDash([])}},fe=function(){i&&o.drawNodeOverlay(e,t,d,s,c)},pe=function(){i&&o.drawNodeUnderlay(e,t,d,s,c)},me=function(){o.drawElementText(e,t,null,r)};if(t.pstyle(`ghost`).value===`yes`){var he=t.pstyle(`ghost-offset-x`).pfValue,ge=t.pstyle(`ghost-offset-y`).pfValue,_e=t.pstyle(`ghost-opacity`).value,ve=_e*f;e.translate(he,ge),te(),de(),V(_e*D),ae(),oe(ve,!0),H(_e*F),ue(),se(T!==0||E!==0),ce(T!==0||E!==0),oe(ve,!1),le(ve),e.translate(-he,-ge)}p&&e.translate(-d.x,-d.y),pe(),p&&e.translate(d.x,d.y),te(),de(),V(),ae(),oe(f,!0),H(),ue(),se(T!==0||E!==0),ce(T!==0||E!==0),oe(f,!1),le(),p&&e.translate(-d.x,-d.y),me(),fe(),n&&e.translate(_.x1,_.y1)}};var CY=function(e){if(![`overlay`,`underlay`].includes(e))throw Error(`Invalid state`);return function(t,n,r,i,a){var o=this;if(n.visible()){var s=n.pstyle(`${e}-padding`).pfValue,c=n.pstyle(`${e}-opacity`).value,l=n.pstyle(`${e}-color`).value,u=n.pstyle(`${e}-shape`).value,d=n.pstyle(`${e}-corner-radius`).value;if(c>0){if(r||=n.position(),i==null||a==null){var f=n.padding();i=n.width()+2*f,a=n.height()+2*f}o.colorFillStyle(t,l[0],l[1],l[2],c),o.nodeShapes[u].draw(t,r.x,r.y,i+s*2,a+s*2,d),t.fill()}}}};SY.drawNodeOverlay=CY(`overlay`),SY.drawNodeUnderlay=CY(`underlay`),SY.hasPie=function(e){return e=e[0],e._private.hasPie},SY.hasStripe=function(e){return e=e[0],e._private.hasStripe},SY.drawPie=function(e,t,n,r){t=t[0],r||=t.position();var i=t.cy().style(),a=t.pstyle(`pie-size`),o=t.pstyle(`pie-hole`),s=t.pstyle(`pie-start-angle`).pfValue,c=r.x,l=r.y,u=t.width(),d=t.height(),f=Math.min(u,d)/2,p,m=0;if(this.usePaths()&&(c=0,l=0),a.units===`%`?f*=a.pfValue:a.pfValue!==void 0&&(f=a.pfValue/2),o.units===`%`?p=f*o.pfValue:o.pfValue!==void 0&&(p=o.pfValue/2),!(p>=f))for(var h=1;h<=i.pieBackgroundN;h++){var g=t.pstyle(`pie-`+h+`-background-size`).value,_=t.pstyle(`pie-`+h+`-background-color`).value,v=t.pstyle(`pie-`+h+`-background-opacity`).value*n,y=g/100;y+m>1&&(y=1-m);var b=1.5*Math.PI+2*Math.PI*m;b+=s;var x=2*Math.PI*y,S=b+x;g===0||m>=1||m+y>1||(p===0?(e.beginPath(),e.moveTo(c,l),e.arc(c,l,f,b,S),e.closePath()):(e.beginPath(),e.arc(c,l,f,b,S),e.arc(c,l,p,S,b,!0),e.closePath()),this.colorFillStyle(e,_[0],_[1],_[2],v),e.fill(),m+=y)}},SY.drawStripe=function(e,t,n,r){t=t[0],r||=t.position();var i=t.cy().style(),a=r.x,o=r.y,s=t.width(),c=t.height(),l=0,u=this.usePaths();e.save();var d=t.pstyle(`stripe-direction`).value,f=t.pstyle(`stripe-size`);switch(d){case`vertical`:break;case`righward`:e.rotate(-Math.PI/2);break}var p=s,m=c;f.units===`%`?(p*=f.pfValue,m*=f.pfValue):f.pfValue!==void 0&&(p=f.pfValue,m=f.pfValue),u&&(a=0,o=0),o-=p/2,a-=m/2;for(var h=1;h<=i.stripeBackgroundN;h++){var g=t.pstyle(`stripe-`+h+`-background-size`).value,_=t.pstyle(`stripe-`+h+`-background-color`).value,v=t.pstyle(`stripe-`+h+`-background-opacity`).value*n,y=g/100;y+l>1&&(y=1-l),!(g===0||l>=1||l+y>1)&&(e.beginPath(),e.rect(a,o+m*l,p,m*y),e.closePath(),this.colorFillStyle(e,_[0],_[1],_[2],v),e.fill(),l+=y)}e.restore()};var wY={},TY=100;wY.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},wY.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,i=0;i<t.length;i++)if(r=t[i],r.context===e){n=!1;break}return n&&(r={context:e},t.push(r)),r},wY.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+`-gradient-stop-colors`).value,c=n.pstyle(t+`-gradient-stop-positions`).pfValue;if(r===`radial-gradient`)if(n.isEdge()){var l=n.sourceEndpoint(),u=n.targetEndpoint(),d=n.midpoint(),f=nR(l,d),p=nR(u,d);a=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(f,p))}else{var m=o?{x:0,y:0}:n.position(),h=n.paddedWidth(),g=n.paddedHeight();a=e.createRadialGradient(m.x,m.y,0,m.x,m.y,Math.max(h,g))}else if(n.isEdge()){var _=n.sourceEndpoint(),v=n.targetEndpoint();a=e.createLinearGradient(_.x,_.y,v.x,v.y)}else{var y=o?{x:0,y:0}:n.position(),b=n.paddedWidth(),x=n.paddedHeight(),S=b/2,C=x/2;switch(n.pstyle(`background-gradient-direction`).value){case`to-bottom`:a=e.createLinearGradient(y.x,y.y-C,y.x,y.y+C);break;case`to-top`:a=e.createLinearGradient(y.x,y.y+C,y.x,y.y-C);break;case`to-left`:a=e.createLinearGradient(y.x+S,y.y,y.x-S,y.y);break;case`to-right`:a=e.createLinearGradient(y.x-S,y.y,y.x+S,y.y);break;case`to-bottom-right`:case`to-right-bottom`:a=e.createLinearGradient(y.x-S,y.y-C,y.x+S,y.y+C);break;case`to-top-right`:case`to-right-top`:a=e.createLinearGradient(y.x-S,y.y+C,y.x+S,y.y-C);break;case`to-bottom-left`:case`to-left-bottom`:a=e.createLinearGradient(y.x+S,y.y-C,y.x-S,y.y+C);break;case`to-top-left`:case`to-left-top`:a=e.createLinearGradient(y.x+S,y.y+C,y.x-S,y.y-C);break}}if(!a)return null;for(var w=c.length===s.length,T=s.length,E=0;E<T;E++)a.addColorStop(w?c[E]:E/(T-1),`rgba(`+s[E][0]+`,`+s[E][1]+`,`+s[E][2]+`,`+i+`)`);return a},wY.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,`background`,t,n,r);if(!i)return null;e.fillStyle=i},wY.colorFillStyle=function(e,t,n,r,i){e.fillStyle=`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`},wY.eleFillStyle=function(e,t,n){var r=t.pstyle(`background-fill`).value;if(r===`linear-gradient`||r===`radial-gradient`)this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle(`background-color`).value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},wY.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,`line`,t,n,r);if(!i)return null;e.strokeStyle=i},wY.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle=`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`},wY.eleStrokeStyle=function(e,t,n){var r=t.pstyle(`line-fill`).value;if(r===`linear-gradient`||r===`radial-gradient`)this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle(`line-color`).value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},wY.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),i=r[2],a=r[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var c=i*o,l=a*o,u;if(!(c===t.canvasWidth&&l===t.canvasHeight)){t.fontCaches=null;var d=n.canvasContainer;d.style.width=i+`px`,d.style.height=a+`px`;for(var f=0;f<t.CANVAS_LAYERS;f++)u=n.canvases[f],u.width=c,u.height=l,u.style.width=i+`px`,u.style.height=a+`px`;for(var f=0;f<t.BUFFER_COUNT;f++)u=n.bufferCanvases[f],u.width=c,u.height=l,u.style.width=i+`px`,u.style.height=a+`px`;t.textureMult=1,o<=1&&(u=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,u.width=c*t.textureMult,u.height=l*t.textureMult),t.canvasWidth=c,t.canvasHeight=l,t.pixelRatio=o}},wY.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},wY.clearCanvas=function(){var e=this,t=e.data;function n(t){t.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])},wY.render=function(e){var t=this;e||=lL();var n=t.cy,r=e.forcedContext,i=e.drawAllLayers,a=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,c=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,l=t.data,u=l.canvasNeedsRedraw,d=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),f=e.motionBlur===void 0?t.motionBlur:e.motionBlur,p=t.motionBlurPxRatio,m=n.hasCompoundNodes(),h=t.hoverData.draggingEles,g=!!(t.hoverData.selecting||t.touchData.selecting);f=f&&!r&&t.motionBlurEnabled&&!g;var _=f;r||(t.prevPxRatio!==c&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint(`eles`,!0),t.redrawHint(`drag`,!0)),t.prevPxRatio=c),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),f&&(t.mbFrames??=0,t.mbFrames++,t.mbFrames<3&&(_=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!d&&(u[t.NODE]=!0,u[t.SELECT_BOX]=!0);var v=n.style(),y=n.zoom(),b=o===void 0?y:o,x=n.pan(),S={x:x.x,y:x.y},C={zoom:y,pan:{x:x.x,y:x.y}},w=t.prevViewport;!(w===void 0||C.zoom!==w.zoom||C.pan.x!==w.pan.x||C.pan.y!==w.pan.y)&&!(h&&!m)&&(t.motionBlurPxRatio=1),s&&(S=s),b*=c,S.x*=c,S.y*=c;var T=t.getCachedZSortedEles();function E(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation=`destination-out`,t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function D(e,n){var a,c,u,d;!t.clearingMotionBlur&&(e===l.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]||e===l.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG])?(a={x:x.x*p,y:x.y*p},c=y*p,u=t.canvasWidth*p,d=t.canvasHeight*p):(a=S,c=b,u=t.canvasWidth,d=t.canvasHeight),e.setTransform(1,0,0,1,0,0),n===`motionBlur`?E(e,0,0,u,d):!r&&(n===void 0||n)&&e.clearRect(0,0,u,d),i||(e.translate(a.x,a.y),e.scale(c,c)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(d||(t.textureDrawLastFrame=!1),d){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var O=t.data.bufferContexts[t.TEXTURE_BUFFER];O.setTransform(1,0,0,1,0,0),O.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:O,drawOnlyNodeLayer:!0,forcedPxRatio:c*t.textureMult});var C=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};C.mpan={x:(0-C.pan.x)/C.zoom,y:(0-C.pan.y)/C.zoom}}u[t.DRAG]=!1,u[t.NODE]=!1;var k=l.contexts[t.NODE],A=t.textureCache.texture,C=t.textureCache.viewport;k.setTransform(1,0,0,1,0,0),f?E(k,0,0,C.width,C.height):k.clearRect(0,0,C.width,C.height);var j=v.core(`outside-texture-bg-color`).value,M=v.core(`outside-texture-bg-opacity`).value;t.colorFillStyle(k,j[0],j[1],j[2],M),k.fillRect(0,0,C.width,C.height);var y=n.zoom();D(k,!1),k.clearRect(C.mpan.x,C.mpan.y,C.width/C.zoom/c,C.height/C.zoom/c),k.drawImage(A,C.mpan.x,C.mpan.y,C.width/C.zoom/c,C.height/C.zoom/c)}else t.textureOnViewport&&!r&&(t.textureCache=null);var N=n.extent(),P=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),F=t.hideEdgesOnViewport&&P,I=[];if(I[t.NODE]=!u[t.NODE]&&f&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,I[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),I[t.DRAG]=!u[t.DRAG]&&f&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,I[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),u[t.NODE]||i||a||I[t.NODE]){var L=f&&!I[t.NODE]&&p!==1,k=r||(L?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:l.contexts[t.NODE]);D(k,f&&!L?`motionBlur`:void 0),F?t.drawCachedNodes(k,T.nondrag,c,N):t.drawLayeredElements(k,T.nondrag,c,N),t.debug&&t.drawDebugPoints(k,T.nondrag),!i&&!f&&(u[t.NODE]=!1)}if(!a&&(u[t.DRAG]||i||I[t.DRAG])){var L=f&&!I[t.DRAG]&&p!==1,k=r||(L?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:l.contexts[t.DRAG]);D(k,f&&!L?`motionBlur`:void 0),F?t.drawCachedNodes(k,T.drag,c,N):t.drawCachedElements(k,T.drag,c,N),t.debug&&t.drawDebugPoints(k,T.drag),!i&&!f&&(u[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,D),f&&p!==1){var R=l.contexts[t.NODE],ee=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],z=l.contexts[t.DRAG],B=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],V=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!_?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):E(e,0,0,t.canvasWidth,t.canvasHeight);var i=p;e.drawImage(n,0,0,t.canvasWidth*i,t.canvasHeight*i,0,0,t.canvasWidth,t.canvasHeight)};(u[t.NODE]||I[t.NODE])&&(V(R,ee,I[t.NODE]),u[t.NODE]=!1),(u[t.DRAG]||I[t.DRAG])&&(V(z,B,I[t.DRAG]),u[t.DRAG]=!1)}t.prevViewport=C,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),f&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!d,t.mbFrames=0,u[t.NODE]=!0,u[t.DRAG]=!0,t.redraw()},TY)),r||n.emit(`render`)};var EY;wY.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,i=n.data,a=r.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,c=i.canvasNeedsRedraw,l=e.forcedContext;if(n.showFps||!o&&c[n.SELECT_BOX]&&!s){var u=l||i.contexts[n.SELECT_BOX];if(t(u),n.selection[4]==1&&(n.hoverData.selecting||n.touchData.selecting)){var d=n.cy.zoom(),f=a.core(`selection-box-border-width`).value/d;u.lineWidth=f,u.fillStyle=`rgba(`+a.core(`selection-box-color`).value[0]+`,`+a.core(`selection-box-color`).value[1]+`,`+a.core(`selection-box-color`).value[2]+`,`+a.core(`selection-box-opacity`).value+`)`,u.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),f>0&&(u.strokeStyle=`rgba(`+a.core(`selection-box-border-color`).value[0]+`,`+a.core(`selection-box-border-color`).value[1]+`,`+a.core(`selection-box-border-color`).value[2]+`,`+a.core(`selection-box-opacity`).value+`)`,u.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(i.bgActivePosistion&&!n.hoverData.selecting){var d=n.cy.zoom(),p=i.bgActivePosistion;u.fillStyle=`rgba(`+a.core(`active-bg-color`).value[0]+`,`+a.core(`active-bg-color`).value[1]+`,`+a.core(`active-bg-color`).value[2]+`,`+a.core(`active-bg-opacity`).value+`)`,u.beginPath(),u.arc(p.x,p.y,a.core(`active-bg-size`).pfValue/d,0,2*Math.PI),u.fill()}var m=n.lastRedrawTime;if(n.showFps&&m){m=Math.round(m);var h=Math.round(1e3/m),g=`1 frame = `+m+` ms = `+h+` fps`;u.setTransform(1,0,0,1,0,0),u.fillStyle=`rgba(255, 0, 0, 0.75)`,u.strokeStyle=`rgba(255, 0, 0, 0.75)`,u.font=`30px Arial`,EY||=u.measureText(g).actualBoundingBoxAscent,u.fillText(g,0,EY),u.strokeRect(0,EY+10,250,20),u.fillRect(0,EY+10,250*Math.min(h/60,1),20)}s||(c[n.SELECT_BOX]=!1)}};function DY(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw Error(e.getShaderInfoLog(r));return r}function OY(e,t,n){var r=DY(e,e.VERTEX_SHADER,t),i=DY(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw Error(`Could not initialize shaders`);return a}function kY(e,t,n){n===void 0&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext(`2d`);return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function AY(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function jY(e){var t=e.pixelRatio;return e.cy.zoom()*t}function MY(e,t,n,r,i){var a=r*n+t.x,o=i*n+t.y;return o=Math.round(e.canvasHeight-o),[a,o]}function NY(e,t){return t.picking?!0:e.pstyle(`background-fill`).value!==`solid`||e.pstyle(`background-image`).strValue!==`none`?!1:e.pstyle(`border-width`).value===0||e.pstyle(`border-opacity`).value===0?!0:e.pstyle(`border-style`).value===`solid`}function PY(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function FY(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,o=t,s=n||[,,,,];return s[0]=r*o,s[1]=i*o,s[2]=a*o,s[3]=o,s}function IY(e,t){var n=t||[,,,,];return n[0]=(e>>0&255)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function LY(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function RY(e,t){var n=e.createTexture();return n.buffer=function(t){e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},n.deleteTexture=function(){e.deleteTexture(n)},n}function zY(e,t){switch(t){case`float`:return[1,e.FLOAT,4];case`vec2`:return[2,e.FLOAT,4];case`vec3`:return[3,e.FLOAT,4];case`vec4`:return[4,e.FLOAT,4];case`int`:return[1,e.INT,4];case`ivec2`:return[2,e.INT,4]}}function BY(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function VY(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}function HY(e,t,n,r){var i=PP(zY(e,t),2),a=i[0],o=i[1],s=BY(e,o,r),c=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,s,e.STATIC_DRAW),o===e.FLOAT?e.vertexAttribPointer(n,a,o,!1,0,0):o===e.INT&&e.vertexAttribIPointer(n,a,o,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null),c}function UY(e,t,n,r){var i=PP(zY(e,n),3),a=i[0],o=i[1],s=i[2],c=BY(e,o,t*a),l=a*s,u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,t*l,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,a,o,!1,l,0):o===e.INT&&e.vertexAttribIPointer(r,a,o,l,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var d=Array(t),f=0;f<t;f++)d[f]=VY(e,o,c,l,a,f);return u.dataArray=c,u.stride=l,u.size=a,u.getView=function(e){return d[e]},u.setPoint=function(e,t,n){var r=d[e];r[0]=t,r[1]=n},u.bufferSubData=function(t){e.bindBuffer(e.ARRAY_BUFFER,u),t?e.bufferSubData(e.ARRAY_BUFFER,0,c,0,t*a):e.bufferSubData(e.ARRAY_BUFFER,0,c)},u}function WY(e,t,n){for(var r=9,i=new Float32Array(t*r),a=Array(t),o=0;o<t;o++){var s=o*r*4;a[o]=new Float32Array(i.buffer,s,r)}var c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,i.byteLength,e.DYNAMIC_DRAW);for(var l=0;l<3;l++){var u=n+l;e.enableVertexAttribArray(u),e.vertexAttribPointer(u,3,e.FLOAT,!1,36,l*12),e.vertexAttribDivisor(u,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),c.getMatrixView=function(e){return a[e]},c.setData=function(e,t){a[t].set(e,0)},c.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferSubData(e.ARRAY_BUFFER,0,i)},c}function GY(e){var t=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.bindFramebuffer(e.FRAMEBUFFER,null),t.setFramebufferAttachmentSizes=function(t,r){e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}var KY=typeof Float32Array<`u`?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function qY(){var e=new KY(9);return KY!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function JY(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function YY(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=n[0],p=n[1],m=n[2],h=n[3],g=n[4],_=n[5],v=n[6],y=n[7],b=n[8];return e[0]=f*r+p*o+m*l,e[1]=f*i+p*s+m*u,e[2]=f*a+p*c+m*d,e[3]=h*r+g*o+_*l,e[4]=h*i+g*s+_*u,e[5]=h*a+g*c+_*d,e[6]=v*r+y*o+b*l,e[7]=v*i+y*s+b*u,e[8]=v*a+y*c+b*d,e}function XY(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=n[0],p=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=f*r+p*o+l,e[7]=f*i+p*s+u,e[8]=f*a+p*c+d,e}function ZY(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=Math.sin(n),p=Math.cos(n);return e[0]=p*r+f*o,e[1]=p*i+f*s,e[2]=p*a+f*c,e[3]=p*o-f*r,e[4]=p*s-f*i,e[5]=p*c-f*a,e[6]=l,e[7]=u,e[8]=d,e}function QY(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function $Y(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}var eX=function(){function e(t,n,r,i){TP(this,e),this.debugID=Math.floor(Math.random()*1e4),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(t,n,n),this.scratch=i(t,n,this.texHeight,`scratch`)}return DP(e,[{key:`lock`,value:function(){this.locked=!0}},{key:`getKeys`,value:function(){return new Set(this.keyToLocation.keys())}},{key:`getScale`,value:function(e){var t=e.w,n=e.h,r=this.texHeight,i=this.texSize,a=r/n,o=t*a,s=n*a;return o>i&&(a=i/t,o=t*a,s=n*a),{scale:a,texW:o,texH:s}}},{key:`draw`,value:function(e,t,n){var r=this;if(this.locked)throw Error(`can't draw, atlas is locked`);var i=this.texSize,a=this.texRows,o=this.texHeight,s=this.getScale(t),c=s.scale,l=s.texW,u=s.texH,d=function(e,r){if(n&&r){var i=r.context,a=e.x,s=e.row,l=a,u=o*s;i.save(),i.translate(l,u),i.scale(c,c),n(i,t),i.restore()}},f=[null,null],p=function(){d(r.freePointer,r.canvas),f[0]={x:r.freePointer.x,y:r.freePointer.row*o,w:l,h:u},f[1]={x:r.freePointer.x+l,y:r.freePointer.row*o,w:0,h:u},r.freePointer.x+=l,r.freePointer.x==i&&(r.freePointer.x=0,r.freePointer.row++)},m=function(){var e=r.scratch,t=r.canvas;e.clear(),d({x:0,row:0},e);var n=i-r.freePointer.x,a=l-n,s=o,c=r.freePointer.x,p=r.freePointer.row*o,m=n;t.context.drawImage(e,0,0,m,s,c,p,m,s),f[0]={x:c,y:p,w:m,h:u};var h=n,g=(r.freePointer.row+1)*o,_=a;t&&t.context.drawImage(e,h,0,_,s,0,g,_,s),f[1]={x:0,y:g,w:_,h:u},r.freePointer.x=a,r.freePointer.row++},h=function(){r.freePointer.x=0,r.freePointer.row++};if(this.freePointer.x+l<=i)p();else if(this.freePointer.row>=a-1)return!1;else this.freePointer.x===i?(h(),p()):this.enableWrapping?m():(h(),p());return this.keyToLocation.set(e,f),this.needsBuffer=!0,f}},{key:`getOffsets`,value:function(e){return this.keyToLocation.get(e)}},{key:`isEmpty`,value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:`canFit`,value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return this.freePointer.x+r>t?this.freePointer.row<n-1:!0}},{key:`bufferIfNeeded`,value:function(e){this.texture||=RY(e,this.debugID),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:`dispose`,value:function(){this.texture&&=(this.texture.deleteTexture(),null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),tX=function(){function e(t,n,r,i){TP(this,e),this.r=t,this.texSize=n,this.texRows=r,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return DP(e,[{key:`getKeys`,value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:`_createAtlas`,value:function(){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas;return new eX(e,t,n,r)}},{key:`_getScratchCanvas`,value:function(){if(!this.scratch){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas,i=Math.floor(t/n);this.scratch=r(e,t,i,`scratch`)}return this.scratch}},{key:`draw`,value:function(e,t,n){var r=this.styleKeyToAtlas.get(e);return r||(r=this.atlases[this.atlases.length-1],(!r||!r.canFit(t))&&(r&&r.lock(),r=this._createAtlas(),this.atlases.push(r)),r.draw(e,t,n),this.styleKeyToAtlas.set(e,r)),r}},{key:`getAtlas`,value:function(e){return this.styleKeyToAtlas.get(e)}},{key:`hasAtlas`,value:function(e){return this.styleKeyToAtlas.has(e)}},{key:`markKeyForGC`,value:function(e){this.markedKeys.add(e)}},{key:`gc`,value:function(){var e=this,t=this.markedKeys;if(t.size===0){console.log(`nothing to garbage collect`);return}var n=[],r=new Map,i=null,a=OP(this.atlases),o;try{var s=function(){var a=o.value,s=a.getKeys(),c=nX(t,s);if(c.size===0)return n.push(a),s.forEach(function(e){return r.set(e,a)}),1;i||(i=e._createAtlas(),n.push(i));var l=OP(s),u;try{for(l.s();!(u=l.n()).done;){var d=u.value;if(!c.has(d)){var f=PP(a.getOffsets(d),2),p=f[0],m=f[1];i.canFit({w:p.w+m.w,h:p.h})||(i.lock(),i=e._createAtlas(),n.push(i)),a.canvas&&(e._copyTextureToNewAtlas(d,a,i),r.set(d,i))}}}catch(e){l.e(e)}finally{l.f()}a.dispose()};for(a.s();!(o=a.n()).done;)if(s())continue}catch(e){a.e(e)}finally{a.f()}this.atlases=n,this.styleKeyToAtlas=r,this.markedKeys=new Set}},{key:`_copyTextureToNewAtlas`,value:function(e,t,n){var r=PP(t.getOffsets(e),2),i=r[0],a=r[1];if(a.w===0)n.draw(e,i,function(e){e.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h)});else{var o=this._getScratchCanvas();o.clear(),o.context.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h),o.context.drawImage(t.canvas,a.x,a.y,a.w,a.h,i.w,0,a.w,a.h);var s=i.w+a.w,c=i.h;n.draw(e,{w:s,h:c},function(e){e.drawImage(o,0,0,s,c,0,0,s,c)})}}},{key:`getCounts`,value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();function nX(e,t){return e.intersection?e.intersection(t):new Set(FP(e).filter(function(e){return t.has(e)}))}var rX=function(){function e(t,n){TP(this,e),this.r=t,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return DP(e,[{key:`getAtlasSize`,value:function(){return this.atlasSize}},{key:`addAtlasCollection`,value:function(e,t){var n=this.globalOptions,r=n.webglTexSize,i=n.createTextureCanvas,a=t.texRows,o=this._cacheScratchCanvas(i),s=new tX(this.r,r,a,o);this.collections.set(e,s)}},{key:`addRenderType`,value:function(e,t){var n=t.collection;if(!this.collections.has(n))throw Error(`invalid atlas collection name '${n}'`);var r=EF({type:e,atlasCollection:this.collections.get(n)},t);this.renderTypes.set(e,r)}},{key:`getRenderTypeOpts`,value:function(e){return this.renderTypes.get(e)}},{key:`getAtlasCollection`,value:function(e){return this.collections.get(e)}},{key:`_cacheScratchCanvas`,value:function(e){var t=-1,n=-1,r=null;return function(i,a,o,s){return s?((!r||a!=t||o!=n)&&(t=a,n=o,r=e(i,a,o)),r):e(i,a,o)}}},{key:`_key`,value:function(e,t){return`${e}-${t}`}},{key:`invalidate`,value:function(e){var t=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.forceRedraw,i=r===void 0?!1:r,a=n.filterEle,o=a===void 0?function(){return!0}:a,s=n.filterType,c=s===void 0?function(){return!0}:s,l=!1,u=!1,d=OP(e),f;try{for(d.s();!(f=d.n()).done;){var p=f.value;if(o(p)){var m=OP(this.renderTypes.values()),h;try{var g=function(){var e=h.value,n=e.type;if(c(n)){var r=t.collections.get(e.collection),a=e.getKey(p),o=Array.isArray(a)?a:[a];if(i)o.forEach(function(e){return r.markKeyForGC(e)}),u=!0;else{var s=e.getID?e.getID(p):p.id(),d=t._key(n,s),f=t.typeAndIdToKey.get(d);f!==void 0&&!PY(o,f)&&(l=!0,t.typeAndIdToKey.delete(d),f.forEach(function(e){return r.markKeyForGC(e)}))}}};for(m.s();!(h=m.n()).done;)g()}catch(e){m.e(e)}finally{m.f()}}}}catch(e){d.e(e)}finally{d.f()}return u&&(this.gc(),l=!1),l}},{key:`gc`,value:function(){var e=OP(this.collections.values()),t;try{for(e.s();!(t=e.n()).done;)t.value.gc()}catch(t){e.e(t)}finally{e.f()}}},{key:`getOrCreateAtlas`,value:function(e,t,n,r){var i=this.renderTypes.get(t),a=this.collections.get(i.collection),o=!1,s=a.draw(r,n,function(t){i.drawClipped?(t.save(),t.beginPath(),t.rect(0,0,n.w,n.h),t.clip(),i.drawElement(t,e,n,!0,!0),t.restore()):i.drawElement(t,e,n,!0,!0),o=!0});if(o){var c=i.getID?i.getID(e):e.id(),l=this._key(t,c);this.typeAndIdToKey.has(l)?this.typeAndIdToKey.get(l).push(r):this.typeAndIdToKey.set(l,[r])}return s}},{key:`getAtlasInfo`,value:function(e,t){var n=this,r=this.renderTypes.get(t),i=r.getKey(e);return(Array.isArray(i)?i:[i]).map(function(i){var a=r.getBoundingBox(e,i),o=n.getOrCreateAtlas(e,t,a,i),s=PP(o.getOffsets(i),2),c=s[0];return{atlas:o,tex:c,tex1:c,tex2:s[1],bb:a}})}},{key:`getDebugInfo`,value:function(){var e=[],t=OP(this.collections),n;try{for(t.s();!(n=t.n()).done;){var r=PP(n.value,2),i=r[0],a=r[1].getCounts(),o=a.keyCount,s=a.atlasCount;e.push({type:i,keyCount:o,atlasCount:s})}}catch(e){t.e(e)}finally{t.f()}return e}}])}(),iX=function(){function e(t){TP(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]}return DP(e,[{key:`getMaxAtlasesPerBatch`,value:function(){return this.maxAtlasesPerBatch}},{key:`getAtlasSize`,value:function(){return this.atlasSize}},{key:`getIndexArray`,value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(e,t){return t})}},{key:`startBatch`,value:function(){this.batchAtlases=[]}},{key:`getAtlasCount`,value:function(){return this.batchAtlases.length}},{key:`getAtlases`,value:function(){return this.batchAtlases}},{key:`canAddToCurrentBatch`,value:function(e){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(e):!0}},{key:`getAtlasIndexForBatch`,value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw Error(`cannot add more atlases to batch`);this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}}])}(),aX=`
|
|
91
|
-
float circleSD(vec2 p, float r) {
|
|
92
|
-
return distance(vec2(0), p) - r; // signed distance
|
|
93
|
-
}
|
|
94
|
-
`,oX=`
|
|
95
|
-
float rectangleSD(vec2 p, vec2 b) {
|
|
96
|
-
vec2 d = abs(p)-b;
|
|
97
|
-
return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
|
|
98
|
-
}
|
|
99
|
-
`,sX=`
|
|
100
|
-
float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
|
|
101
|
-
cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
|
|
102
|
-
cr.x = (p.y > 0.0) ? cr.x : cr.y;
|
|
103
|
-
vec2 q = abs(p) - b + cr.x;
|
|
104
|
-
return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
|
|
105
|
-
}
|
|
106
|
-
`,cX=`
|
|
107
|
-
float ellipseSD(vec2 p, vec2 ab) {
|
|
108
|
-
p = abs( p ); // symmetry
|
|
109
|
-
|
|
110
|
-
// find root with Newton solver
|
|
111
|
-
vec2 q = ab*(p-ab);
|
|
112
|
-
float w = (q.x<q.y)? 1.570796327 : 0.0;
|
|
113
|
-
for( int i=0; i<5; i++ ) {
|
|
114
|
-
vec2 cs = vec2(cos(w),sin(w));
|
|
115
|
-
vec2 u = ab*vec2( cs.x,cs.y);
|
|
116
|
-
vec2 v = ab*vec2(-cs.y,cs.x);
|
|
117
|
-
w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// compute final point and distance
|
|
121
|
-
float d = length(p-ab*vec2(cos(w),sin(w)));
|
|
122
|
-
|
|
123
|
-
// return signed distance
|
|
124
|
-
return (dot(p/ab,p/ab)>1.0) ? d : -d;
|
|
125
|
-
}
|
|
126
|
-
`,lX={SCREEN:{name:`screen`,screen:!0},PICKING:{name:`picking`,picking:!0}},uX={IGNORE:1,USE_BB:2},dX=0,fX=1,pX=2,mX=3,hX=4,gX=5,_X=6,vX=7,yX=function(){function e(t,n,r){TP(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=kY,this.atlasManager=new rX(t,r),this.batchManager=new iX(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(lX.SCREEN),this.pickingProgram=this._createShaderProgram(lX.PICKING),this.vao=this._createVAO()}return DP(e,[{key:`addAtlasCollection`,value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:`addTextureAtlasRenderType`,value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:`addSimpleShapeRenderType`,value:function(e,t){this.simpleShapeOptions.set(e,t)}},{key:`invalidate`,value:function(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).type,n=this.atlasManager;return t?n.invalidate(e,{filterType:function(e){return e===t},forceRedraw:!0}):n.invalidate(e)}},{key:`gc`,value:function(){this.atlasManager.gc()}},{key:`_createShaderProgram`,value:function(e){var t=this.gl,n=`#version 300 es
|
|
127
|
-
precision highp float;
|
|
128
|
-
|
|
129
|
-
uniform mat3 uPanZoomMatrix;
|
|
130
|
-
uniform int uAtlasSize;
|
|
131
|
-
|
|
132
|
-
// instanced
|
|
133
|
-
in vec2 aPosition; // a vertex from the unit square
|
|
134
|
-
|
|
135
|
-
in mat3 aTransform; // used to transform verticies, eg into a bounding box
|
|
136
|
-
in int aVertType; // the type of thing we are rendering
|
|
137
|
-
|
|
138
|
-
// the z-index that is output when using picking mode
|
|
139
|
-
in vec4 aIndex;
|
|
140
|
-
|
|
141
|
-
// For textures
|
|
142
|
-
in int aAtlasId; // which shader unit/atlas to use
|
|
143
|
-
in vec4 aTex; // x/y/w/h of texture in atlas
|
|
144
|
-
|
|
145
|
-
// for edges
|
|
146
|
-
in vec4 aPointAPointB;
|
|
147
|
-
in vec4 aPointCPointD;
|
|
148
|
-
in vec2 aLineWidth; // also used for node border width
|
|
149
|
-
|
|
150
|
-
// simple shapes
|
|
151
|
-
in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
|
|
152
|
-
in vec4 aColor; // also used for edges
|
|
153
|
-
in vec4 aBorderColor; // aLineWidth is used for border width
|
|
154
|
-
|
|
155
|
-
// output values passed to the fragment shader
|
|
156
|
-
out vec2 vTexCoord;
|
|
157
|
-
out vec4 vColor;
|
|
158
|
-
out vec2 vPosition;
|
|
159
|
-
// flat values are not interpolated
|
|
160
|
-
flat out int vAtlasId;
|
|
161
|
-
flat out int vVertType;
|
|
162
|
-
flat out vec2 vTopRight;
|
|
163
|
-
flat out vec2 vBotLeft;
|
|
164
|
-
flat out vec4 vCornerRadius;
|
|
165
|
-
flat out vec4 vBorderColor;
|
|
166
|
-
flat out vec2 vBorderWidth;
|
|
167
|
-
flat out vec4 vIndex;
|
|
168
|
-
|
|
169
|
-
void main(void) {
|
|
170
|
-
int vid = gl_VertexID;
|
|
171
|
-
vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
|
|
172
|
-
|
|
173
|
-
if(aVertType == ${dX}) {
|
|
174
|
-
float texX = aTex.x; // texture coordinates
|
|
175
|
-
float texY = aTex.y;
|
|
176
|
-
float texW = aTex.z;
|
|
177
|
-
float texH = aTex.w;
|
|
178
|
-
|
|
179
|
-
if(vid == 1 || vid == 2 || vid == 4) {
|
|
180
|
-
texX += texW;
|
|
181
|
-
}
|
|
182
|
-
if(vid == 2 || vid == 4 || vid == 5) {
|
|
183
|
-
texY += texH;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
float d = float(uAtlasSize);
|
|
187
|
-
vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
|
|
188
|
-
|
|
189
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
190
|
-
}
|
|
191
|
-
else if(aVertType == ${hX} || aVertType == ${vX}
|
|
192
|
-
|| aVertType == ${gX} || aVertType == ${_X}) { // simple shapes
|
|
193
|
-
|
|
194
|
-
// the bounding box is needed by the fragment shader
|
|
195
|
-
vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
|
|
196
|
-
vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
|
|
197
|
-
vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
|
|
198
|
-
|
|
199
|
-
// calculations are done in the fragment shader, just pass these along
|
|
200
|
-
vColor = aColor;
|
|
201
|
-
vCornerRadius = aCornerRadius;
|
|
202
|
-
vBorderColor = aBorderColor;
|
|
203
|
-
vBorderWidth = aLineWidth;
|
|
204
|
-
|
|
205
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
206
|
-
}
|
|
207
|
-
else if(aVertType == ${fX}) {
|
|
208
|
-
vec2 source = aPointAPointB.xy;
|
|
209
|
-
vec2 target = aPointAPointB.zw;
|
|
210
|
-
|
|
211
|
-
// adjust the geometry so that the line is centered on the edge
|
|
212
|
-
position.y = position.y - 0.5;
|
|
213
|
-
|
|
214
|
-
// stretch the unit square into a long skinny rectangle
|
|
215
|
-
vec2 xBasis = target - source;
|
|
216
|
-
vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
|
|
217
|
-
vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
|
|
218
|
-
|
|
219
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
|
|
220
|
-
vColor = aColor;
|
|
221
|
-
}
|
|
222
|
-
else if(aVertType == ${pX}) {
|
|
223
|
-
vec2 pointA = aPointAPointB.xy;
|
|
224
|
-
vec2 pointB = aPointAPointB.zw;
|
|
225
|
-
vec2 pointC = aPointCPointD.xy;
|
|
226
|
-
vec2 pointD = aPointCPointD.zw;
|
|
227
|
-
|
|
228
|
-
// adjust the geometry so that the line is centered on the edge
|
|
229
|
-
position.y = position.y - 0.5;
|
|
230
|
-
|
|
231
|
-
vec2 p0, p1, p2, pos;
|
|
232
|
-
if(position.x == 0.0) { // The left side of the unit square
|
|
233
|
-
p0 = pointA;
|
|
234
|
-
p1 = pointB;
|
|
235
|
-
p2 = pointC;
|
|
236
|
-
pos = position;
|
|
237
|
-
} else { // The right side of the unit square, use same approach but flip the geometry upside down
|
|
238
|
-
p0 = pointD;
|
|
239
|
-
p1 = pointC;
|
|
240
|
-
p2 = pointB;
|
|
241
|
-
pos = vec2(0.0, -position.y);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
vec2 p01 = p1 - p0;
|
|
245
|
-
vec2 p12 = p2 - p1;
|
|
246
|
-
vec2 p21 = p1 - p2;
|
|
247
|
-
|
|
248
|
-
// Find the normal vector.
|
|
249
|
-
vec2 tangent = normalize(normalize(p12) + normalize(p01));
|
|
250
|
-
vec2 normal = vec2(-tangent.y, tangent.x);
|
|
251
|
-
|
|
252
|
-
// Find the vector perpendicular to p0 -> p1.
|
|
253
|
-
vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
|
|
254
|
-
|
|
255
|
-
// Determine the bend direction.
|
|
256
|
-
float sigma = sign(dot(p01 + p21, normal));
|
|
257
|
-
float width = aLineWidth[0];
|
|
258
|
-
|
|
259
|
-
if(sign(pos.y) == -sigma) {
|
|
260
|
-
// This is an intersecting vertex. Adjust the position so that there's no overlap.
|
|
261
|
-
vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
|
|
262
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
263
|
-
} else {
|
|
264
|
-
// This is a non-intersecting vertex. Treat it like a mitre join.
|
|
265
|
-
vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
|
|
266
|
-
gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
vColor = aColor;
|
|
270
|
-
}
|
|
271
|
-
else if(aVertType == ${mX} && vid < 3) {
|
|
272
|
-
// massage the first triangle into an edge arrow
|
|
273
|
-
if(vid == 0)
|
|
274
|
-
position = vec2(-0.15, -0.3);
|
|
275
|
-
if(vid == 1)
|
|
276
|
-
position = vec2( 0.0, 0.0);
|
|
277
|
-
if(vid == 2)
|
|
278
|
-
position = vec2( 0.15, -0.3);
|
|
279
|
-
|
|
280
|
-
gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
|
|
281
|
-
vColor = aColor;
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
vAtlasId = aAtlasId;
|
|
288
|
-
vVertType = aVertType;
|
|
289
|
-
vIndex = aIndex;
|
|
290
|
-
}
|
|
291
|
-
`,r=this.batchManager.getIndexArray(),i=OY(t,n,`#version 300 es
|
|
292
|
-
precision highp float;
|
|
293
|
-
|
|
294
|
-
// declare texture unit for each texture atlas in the batch
|
|
295
|
-
${r.map(function(e){return`uniform sampler2D uTexture${e};`}).join(`
|
|
296
|
-
`)}
|
|
297
|
-
|
|
298
|
-
uniform vec4 uBGColor;
|
|
299
|
-
uniform float uZoom;
|
|
300
|
-
|
|
301
|
-
in vec2 vTexCoord;
|
|
302
|
-
in vec4 vColor;
|
|
303
|
-
in vec2 vPosition; // model coordinates
|
|
304
|
-
|
|
305
|
-
flat in int vAtlasId;
|
|
306
|
-
flat in vec4 vIndex;
|
|
307
|
-
flat in int vVertType;
|
|
308
|
-
flat in vec2 vTopRight;
|
|
309
|
-
flat in vec2 vBotLeft;
|
|
310
|
-
flat in vec4 vCornerRadius;
|
|
311
|
-
flat in vec4 vBorderColor;
|
|
312
|
-
flat in vec2 vBorderWidth;
|
|
313
|
-
|
|
314
|
-
out vec4 outColor;
|
|
315
|
-
|
|
316
|
-
${aX}
|
|
317
|
-
${oX}
|
|
318
|
-
${sX}
|
|
319
|
-
${cX}
|
|
320
|
-
|
|
321
|
-
vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
|
|
322
|
-
return vec4(
|
|
323
|
-
top.rgb + (bot.rgb * (1.0 - top.a)),
|
|
324
|
-
top.a + (bot.a * (1.0 - top.a))
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
|
|
329
|
-
// scale to the zoom level so that borders don't look blurry when zoomed in
|
|
330
|
-
// note 1.5 is an aribitrary value chosen because it looks good
|
|
331
|
-
return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
void main(void) {
|
|
335
|
-
if(vVertType == ${dX}) {
|
|
336
|
-
// look up the texel from the texture unit
|
|
337
|
-
${r.map(function(e){return`if(vAtlasId == ${e}) outColor = texture(uTexture${e}, vTexCoord);`}).join(`
|
|
338
|
-
else `)}
|
|
339
|
-
}
|
|
340
|
-
else if(vVertType == ${mX}) {
|
|
341
|
-
// mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
|
|
342
|
-
outColor = blend(vColor, uBGColor);
|
|
343
|
-
outColor.a = 1.0; // make opaque, masks out line under arrow
|
|
344
|
-
}
|
|
345
|
-
else if(vVertType == ${hX} && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
|
|
346
|
-
outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
|
|
347
|
-
}
|
|
348
|
-
else if(vVertType == ${hX} || vVertType == ${vX}
|
|
349
|
-
|| vVertType == ${gX} || vVertType == ${_X}) { // use SDF
|
|
350
|
-
|
|
351
|
-
float outerBorder = vBorderWidth[0];
|
|
352
|
-
float innerBorder = vBorderWidth[1];
|
|
353
|
-
float borderPadding = outerBorder * 2.0;
|
|
354
|
-
float w = vTopRight.x - vBotLeft.x - borderPadding;
|
|
355
|
-
float h = vTopRight.y - vBotLeft.y - borderPadding;
|
|
356
|
-
vec2 b = vec2(w/2.0, h/2.0); // half width, half height
|
|
357
|
-
vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
|
|
358
|
-
|
|
359
|
-
float d; // signed distance
|
|
360
|
-
if(vVertType == ${hX}) {
|
|
361
|
-
d = rectangleSD(p, b);
|
|
362
|
-
} else if(vVertType == ${vX} && w == h) {
|
|
363
|
-
d = circleSD(p, b.x); // faster than ellipse
|
|
364
|
-
} else if(vVertType == ${vX}) {
|
|
365
|
-
d = ellipseSD(p, b);
|
|
366
|
-
} else {
|
|
367
|
-
d = roundRectangleSD(p, b, vCornerRadius.wzyx);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
// use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
|
|
371
|
-
// we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
|
|
372
|
-
if(d > 0.0) {
|
|
373
|
-
if(d > outerBorder) {
|
|
374
|
-
discard;
|
|
375
|
-
} else {
|
|
376
|
-
outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
|
|
377
|
-
}
|
|
378
|
-
} else {
|
|
379
|
-
if(d > innerBorder) {
|
|
380
|
-
vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
|
|
381
|
-
vec4 innerBorderColor = blend(vBorderColor, vColor);
|
|
382
|
-
outColor = distInterp(innerBorderColor, outerColor, d);
|
|
383
|
-
}
|
|
384
|
-
else {
|
|
385
|
-
vec4 outerColor;
|
|
386
|
-
if(innerBorder == 0.0 && outerBorder == 0.0) {
|
|
387
|
-
outerColor = vec4(0);
|
|
388
|
-
} else if(innerBorder == 0.0) {
|
|
389
|
-
outerColor = vBorderColor;
|
|
390
|
-
} else {
|
|
391
|
-
outerColor = blend(vBorderColor, vColor);
|
|
392
|
-
}
|
|
393
|
-
outColor = distInterp(vColor, outerColor, d - innerBorder);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
outColor = vColor;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
${e.picking?`if(outColor.a == 0.0) discard;
|
|
402
|
-
else outColor = vIndex;`:``}
|
|
403
|
-
}
|
|
404
|
-
`);i.aPosition=t.getAttribLocation(i,`aPosition`),i.aIndex=t.getAttribLocation(i,`aIndex`),i.aVertType=t.getAttribLocation(i,`aVertType`),i.aTransform=t.getAttribLocation(i,`aTransform`),i.aAtlasId=t.getAttribLocation(i,`aAtlasId`),i.aTex=t.getAttribLocation(i,`aTex`),i.aPointAPointB=t.getAttribLocation(i,`aPointAPointB`),i.aPointCPointD=t.getAttribLocation(i,`aPointCPointD`),i.aLineWidth=t.getAttribLocation(i,`aLineWidth`),i.aColor=t.getAttribLocation(i,`aColor`),i.aCornerRadius=t.getAttribLocation(i,`aCornerRadius`),i.aBorderColor=t.getAttribLocation(i,`aBorderColor`),i.uPanZoomMatrix=t.getUniformLocation(i,`uPanZoomMatrix`),i.uAtlasSize=t.getUniformLocation(i,`uAtlasSize`),i.uBGColor=t.getUniformLocation(i,`uBGColor`),i.uZoom=t.getUniformLocation(i,`uZoom`),i.uTextures=[];for(var a=0;a<this.batchManager.getMaxAtlasesPerBatch();a++)i.uTextures.push(t.getUniformLocation(i,`uTexture${a}`));return i}},{key:`_createVAO`,value:function(){var e=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=e.length/2;var t=this.maxInstances,n=this.gl,r=this.program,i=n.createVertexArray();return n.bindVertexArray(i),HY(n,`vec2`,r.aPosition,e),this.transformBuffer=WY(n,t,r.aTransform),this.indexBuffer=UY(n,t,`vec4`,r.aIndex),this.vertTypeBuffer=UY(n,t,`int`,r.aVertType),this.atlasIdBuffer=UY(n,t,`int`,r.aAtlasId),this.texBuffer=UY(n,t,`vec4`,r.aTex),this.pointAPointBBuffer=UY(n,t,`vec4`,r.aPointAPointB),this.pointCPointDBuffer=UY(n,t,`vec4`,r.aPointCPointD),this.lineWidthBuffer=UY(n,t,`vec2`,r.aLineWidth),this.colorBuffer=UY(n,t,`vec4`,r.aColor),this.cornerRadiusBuffer=UY(n,t,`vec4`,r.aCornerRadius),this.borderColorBuffer=UY(n,t,`vec4`,r.aBorderColor),n.bindVertexArray(null),i}},{key:`buffers`,get:function(){var e=this;return this._buffers||=Object.keys(this).filter(function(e){return gF(e,`Buffer`)}).map(function(t){return e[t]}),this._buffers}},{key:`startFrame`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:lX.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:`startBatch`,value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:`endFrame`,value:function(){this.endBatch()}},{key:`_isVisible`,value:function(e,t){return e.visible()?t&&t.isVisible?t.isVisible(e):!0:!1}},{key:`drawTexture`,value:function(e,t,n){var r=this.atlasManager,i=this.batchManager,a=r.getRenderTypeOpts(n);if(this._isVisible(e,a)&&!(e.isEdge()&&!this._isValidEdge(e))){if(this.renderTarget.picking&&a.getTexPickingMode){var o=a.getTexPickingMode(e);if(o===uX.IGNORE)return;if(o==uX.USE_BB){this.drawPickingRectangle(e,t,n);return}}var s=OP(r.getAtlasInfo(e,n)),c;try{for(s.s();!(c=s.n()).done;){var l=c.value,u=l.atlas,d=l.tex1,f=l.tex2;i.canAddToCurrentBatch(u)||this.endBatch();for(var p=i.getAtlasIndexForBatch(u),m=0,h=[[d,!0],[f,!1]];m<h.length;m++){var g=PP(h[m],2),_=g[0],v=g[1];if(_.w!=0){var y=this.instanceCount;this.vertTypeBuffer.getView(y)[0]=dX,IY(t,this.indexBuffer.getView(y));var b=this.atlasIdBuffer.getView(y);b[0]=p;var x=this.texBuffer.getView(y);x[0]=_.x,x[1]=_.y,x[2]=_.w,x[3]=_.h;var S=this.transformBuffer.getMatrixView(y);this.setTransformMatrix(e,S,a,l,v),this.instanceCount++,v||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(e){s.e(e)}finally{s.f()}}}},{key:`setTransformMatrix`,value:function(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;if(n.shapeProps&&n.shapeProps.padding&&(a=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,c=r.tex2,l=s.w/(s.w+c.w);i||(l=1-l);var u=this._getAdjustedBB(o,a,i,l);this._applyTransformMatrix(t,u,n,e)}else{var d=n.getBoundingBox(e),f=this._getAdjustedBB(d,a,!0,1);this._applyTransformMatrix(t,f,n,e)}}},{key:`_applyTransformMatrix`,value:function(e,t,n,r){var i,a;JY(e);var o=n.getRotation?n.getRotation(r):0;if(o!==0){var s=n.getRotationPoint(r),c=s.x,l=s.y;XY(e,e,[c,l]),ZY(e,e,o);var u=n.getRotationOffset(r);i=u.x+(t.xOffset||0),a=u.y+(t.yOffset||0)}else i=t.x1,a=t.y1;XY(e,e,[i,a]),QY(e,e,[t.w,t.h])}},{key:`_getAdjustedBB`,value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h,c=e.yOffset;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(l=o-u,i+=l,o=u),{x1:i,y1:a,w:o,h:s,xOffset:l,yOffset:c}}},{key:`drawPickingRectangle`,value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=hX,IY(t,this.indexBuffer.getView(i)),FY([0,0,0],1,this.colorBuffer.getView(i));var a=this.transformBuffer.getMatrixView(i);this.setTransformMatrix(e,a,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:`drawNode`,value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var i=r.shapeProps,a=this._getVertTypeForShape(e,i.shape);if(a===void 0||r.isSimple&&!r.isSimple(e,this.renderTarget)){this.drawTexture(e,t,n);return}var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=a,a===gX||a===_X){var s=r.getBoundingBox(e),c=this._getCornerRadius(e,i.radius,s),l=this.cornerRadiusBuffer.getView(o);l[0]=c,l[1]=c,l[2]=c,l[3]=c,a===_X&&(l[0]=0,l[2]=0)}IY(t,this.indexBuffer.getView(o));var u=this.renderTarget.picking?1:n===`node-body`?e.effectiveOpacity():1,d=this.renderTarget.picking?1:e.pstyle(i.opacity).value*u,f=e.pstyle(i.color).value;FY(f,d,this.colorBuffer.getView(o));var p=this.lineWidthBuffer.getView(o);if(p[0]=0,p[1]=0,i.border){var m=e.pstyle(`border-width`).value;if(m>0){var h=e.pstyle(`border-color`).value;FY(h,u*e.pstyle(`border-opacity`).value,this.borderColorBuffer.getView(o));var g=e.pstyle(`border-position`).value;if(g===`inside`)p[0]=0,p[1]=-m;else if(g===`outside`)p[0]=m,p[1]=0;else{var _=m/2;p[0]=_,p[1]=-_}}}var v=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,v,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:`_getVertTypeForShape`,value:function(e,t){switch(e.pstyle(t).value){case`rectangle`:return hX;case`ellipse`:return vX;case`roundrectangle`:case`round-rectangle`:return gX;case`bottom-round-rectangle`:return _X;default:return}}},{key:`_getCornerRadius`,value:function(e,t,n){var r=n.w,i=n.h;if(e.pstyle(t).value===`auto`)return JR(r,i);var a=e.pstyle(t).pfValue,o=r/2,s=i/2;return Math.min(a,s,o)}},{key:`drawEdgeArrow`,value:function(e,t,n){if(e.visible()){var r=e._private.rscratch,i,a,o;if(n===`source`?(i=r.arrowStartX,a=r.arrowStartY,o=r.srcArrowAngle):(i=r.arrowEndX,a=r.arrowEndY,o=r.tgtArrowAngle),!(isNaN(i)||i==null||isNaN(a)||a==null||isNaN(o)||o==null)&&e.pstyle(n+`-arrow-shape`).value!==`none`){var s=e.pstyle(n+`-arrow-color`).value,c=e.pstyle(`opacity`).value*e.pstyle(`line-opacity`).value,l=e.pstyle(`width`).pfValue,u=e.pstyle(`arrow-scale`).value,d=this.r.getArrowWidth(l,u),f=this.instanceCount,p=this.transformBuffer.getMatrixView(f);JY(p),XY(p,p,[i,a]),QY(p,p,[d,d]),ZY(p,p,o),this.vertTypeBuffer.getView(f)[0]=mX,IY(t,this.indexBuffer.getView(f)),FY(s,c,this.colorBuffer.getView(f)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:`drawEdgeLine`,value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle(`opacity`).value,i=e.pstyle(`line-opacity`).value,a=e.pstyle(`width`).pfValue,o=e.pstyle(`line-color`).value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=fX,IY(t,this.indexBuffer.getView(c)),FY(o,s,this.colorBuffer.getView(c));var l=this.lineWidthBuffer.getView(c);l[0]=a;var u=this.pointAPointBBuffer.getView(c);u[0]=n[0],u[1]=n[1],u[2]=n[2],u[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var d=0;d<n.length-2;d+=2){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=pX,IY(t,this.indexBuffer.getView(f)),FY(o,s,this.colorBuffer.getView(f));var p=this.lineWidthBuffer.getView(f);p[0]=a;var m=n[d-2],h=n[d-1],g=n[d],_=n[d+1],v=n[d+2],y=n[d+3],b=n[d+4],x=n[d+5];d==0&&(m=2*g-v+.001,h=2*_-y+.001),d==n.length-4&&(b=2*v-g+.001,x=2*y-_+.001);var S=this.pointAPointBBuffer.getView(f);S[0]=m,S[1]=h,S[2]=g,S[3]=_;var C=this.pointCPointDBuffer.getView(f);C[0]=v,C[1]=y,C[2]=b,C[3]=x,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:`_isValidEdge`,value:function(e){var t=e._private.rscratch;return!(t.badLine||t.allpts==null||isNaN(t.allpts[0]))}},{key:`_getEdgePoints`,value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(n.length==4)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:`_getNumSegments`,value:function(e){return Math.min(15,this.maxInstances)}},{key:`_getCurveSegmentPoints`,value:function(e,t){if(e.length==4)return e;for(var n=Array((t+1)*2),r=0;r<=t;r++)if(r==0)n[0]=e[0],n[1]=e[1];else if(r==t)n[r*2]=e[e.length-2],n[r*2+1]=e[e.length-1];else{var i=r/t;this._setCurvePoint(e,i,n,r*2)}return n}},{key:`_setCurvePoint`,value:function(e,t,n,r){if(e.length<=2)n[r]=e[0],n[r+1]=e[1];else{for(var i=Array(e.length-2),a=0;a<i.length;a+=2){var o=(1-t)*e[a]+t*e[a+2],s=(1-t)*e[a+1]+t*e[a+3];i[a]=o,i[a+1]=s}return this._setCurvePoint(i,t,n,r)}}},{key:`endBatch`,value:function(){var e=this.gl,t=this.vao,n=this.vertexCount,r=this.instanceCount;if(r!==0){var i=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(i),e.bindVertexArray(t);var a=OP(this.buffers),o;try{for(a.s();!(o=a.n()).done;)o.value.bufferSubData(r)}catch(e){a.e(e)}finally{a.f()}for(var s=this.batchManager.getAtlases(),c=0;c<s.length;c++)s[c].bufferIfNeeded(e);for(var l=0;l<s.length;l++)e.activeTexture(e.TEXTURE0+l),e.bindTexture(e.TEXTURE_2D,s[l].texture),e.uniform1i(i.uTextures[l],l);e.uniform1f(i.uZoom,jY(this.r)),e.uniformMatrix3fv(i.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(i.uAtlasSize,this.batchManager.getAtlasSize());var u=FY(this.bgColor,1);e.uniform4fv(i.uBGColor,u),e.drawArraysInstanced(e.TRIANGLES,0,n,r),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:r,atlasCount:s.length}),this.startBatch()}}},{key:`getDebugInfo`,value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce(function(e,t){return e+t.atlasCount},0),n=this.batchDebugInfo,r=n.reduce(function(e,t){return e+t.count},0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:r}}}])}(),bX={};bX.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=xX(n),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,n.pickingFrameBuffer=GY(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new yX(n,r,e);var i=function(e){return function(t){return n.getTextAngle(t,e)}},a=function(e){return function(t){var n=t.pstyle(e);return n&&n.value}},o=function(e){return function(t){return t.pstyle(`${e}-opacity`).value>0}},s=function(e){return e.pstyle(`text-events`).strValue===`yes`?uX.USE_BB:uX.IGNORE},c=function(e){var t=e.position(),n=t.x,r=t.y,i=e.outerWidth(),a=e.outerHeight();return{w:i,h:a,x1:n-i/2,y1:r-a/2}};n.drawing.addAtlasCollection(`node`,{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection(`label`,{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType(`node-body`,{collection:`node`,getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType(`node-body`,{getBoundingBox:c,isSimple:NY,shapeProps:{shape:`shape`,color:`background-color`,opacity:`background-opacity`,radius:`corner-radius`,border:!0}}),n.drawing.addSimpleShapeRenderType(`node-overlay`,{getBoundingBox:c,isVisible:o(`overlay`),shapeProps:{shape:`overlay-shape`,color:`overlay-color`,opacity:`overlay-opacity`,padding:`overlay-padding`,radius:`overlay-corner-radius`}}),n.drawing.addSimpleShapeRenderType(`node-underlay`,{getBoundingBox:c,isVisible:o(`underlay`),shapeProps:{shape:`underlay-shape`,color:`underlay-color`,opacity:`underlay-opacity`,padding:`underlay-padding`,radius:`underlay-corner-radius`}}),n.drawing.addTextureAtlasRenderType(`label`,{collection:`label`,getTexPickingMode:s,getKey:CX(t.getLabelKey,null),getBoundingBox:wX(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:a(`label`)}),n.drawing.addTextureAtlasRenderType(`edge-source-label`,{collection:`label`,getTexPickingMode:s,getKey:CX(t.getSourceLabelKey,`source`),getBoundingBox:wX(t.getSourceLabelBox,`source`),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:i(`source`),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:a(`source-label`)}),n.drawing.addTextureAtlasRenderType(`edge-target-label`,{collection:`label`,getTexPickingMode:s,getKey:CX(t.getTargetLabelKey,`target`),getBoundingBox:wX(t.getTargetLabelBox,`target`),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i(`target`),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a(`target-label`)});var l=TI(function(){console.log(`garbage collect flag set`),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(e,t){var r=!1;t&&t.length>0&&(r|=n.drawing.invalidate(t)),r&&l()}),TX(n)};function xX(e){var t=e.cy.container();return jF(t&&t.style&&t.style.backgroundColor||`white`)}function SX(e,t){var n=e._private.rscratch;return mL(n,`labelWrapCachedLines`,t)||[]}var CX=function(e,t){return function(n){var r=e(n),i=SX(n,t);return i.length>1?i.map(function(e,t){return`${r}_${t}`}):r}},wX=function(e,t){return function(n,r){var i=e(n);if(typeof r==`string`){var a=r.indexOf(`_`);if(a>0){var o=Number(r.substring(a+1)),s=SX(n,t),c=i.h/s.length,l=c*o,u=i.y1+l;return{x1:i.x1,w:i.w,y1:u,h:c,yOffset:l}}}return i}};function TX(e){var t=e.render;e.render=function(n){n||={};var r=e.cy;e.webgl&&(r.zoom()>yJ?(EX(e),t.call(e,n)):(DX(e),IX(e,n,lX.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,i){return PX(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var i=e.notify;e.notify=function(t,n){i.call(e,t,n),t===`viewport`||t===`bounds`?e.pickingFrameBuffer.needsDraw=!0:t===`background`&&e.drawing.invalidate(n,{type:`node-body`})}}function EX(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function DX(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function OX(e){var t=e.canvasWidth,n=e.canvasHeight,r=AY(e),i=r.pan,a=r.zoom,o=qY();XY(o,o,[i.x,i.y]),QY(o,o,[a,a]);var s=qY();$Y(s,t,n);var c=qY();return YY(c,s,o),c}function kX(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=AY(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function AX(e,t){e.drawSelectionRectangle(t,function(t){return kX(e,t)})}function jX(e){var t=e.data.contexts[e.NODE];t.save(),kX(e,t),t.strokeStyle=`rgba(0, 0, 0, 0.3)`,t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function MX(e){var t=function(t,n,r){for(var i=t.atlasManager.getAtlasCollection(n),a=e.data.contexts[e.NODE],o=i.atlases,s=0;s<o.length;s++){var c=o[s].canvas;if(c){var l=c.width,u=c.height,d=l*s,f=c.height*r,p=.4;a.save(),a.scale(p,p),a.drawImage(c,d,f),a.strokeStyle=`black`,a.rect(d,f,l,u),a.stroke(),a.restore()}}},n=0;t(e.drawing,`node`,n++),t(e.drawing,`label`,n++)}function NX(e,t,n,r,i){var a,o,s,c,l=AY(e),u=l.pan,d=l.zoom,f=PP(MY(e,u,d,t,n),2),p=f[0],m=f[1],h=6;if(a=p-h/2,o=m-h/2,s=h,c=h,s===0||c===0)return[];var g=e.data.contexts[e.WEBGL];g.bindFramebuffer(g.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(g.viewport(0,0,g.canvas.width,g.canvas.height),IX(e,null,lX.PICKING),e.pickingFrameBuffer.needsDraw=!1);var _=s*c,v=new Uint8Array(_*4);g.readPixels(a,o,s,c,g.RGBA,g.UNSIGNED_BYTE,v),g.bindFramebuffer(g.FRAMEBUFFER,null);for(var y=new Set,b=0;b<_;b++){var x=LY(v.slice(b*4,b*4+4))-1;x>=0&&y.add(x)}return y}function PX(e,t,n){var r=NX(e,t,n),i=e.getCachedZSortedEles(),a,o,s=OP(r),c;try{for(s.s();!(c=s.n()).done;){var l=i[c.value];if(!a&&l.isNode()&&(a=l),!o&&l.isEdge()&&(o=l),a&&o)break}}catch(e){s.e(e)}finally{s.f()}return[a,o].filter(Boolean)}function FX(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,`node-underlay`),r.drawNode(n,t,`node-body`),r.drawTexture(n,t,`label`),r.drawNode(n,t,`node-overlay`)):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,`source`),r.drawEdgeArrow(n,t,`target`),r.drawTexture(n,t,`label`),r.drawTexture(n,t,`edge-source-label`),r.drawTexture(n,t,`edge-target-label`))}function IX(e,t,n){var r;e.webglDebug&&(r=performance.now());var i=e.drawing,a=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&AX(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var o=e.data.contexts[e.WEBGL];n.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=OX(e),c=e.getCachedZSortedEles();if(a=c.length,i.startFrame(s,n),n.screen){for(var l=0;l<c.nondrag.length;l++)FX(e,l,c.nondrag[l]);for(var u=0;u<c.drag.length;u++)FX(e,u,c.drag[u])}else if(n.picking)for(var d=0;d<c.length;d++)FX(e,d,c[d]);i.endFrame(),n.screen&&e.webglDebugShowAtlases&&(jX(e),MX(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var f=performance.now(),p=!1,m=Math.ceil(f-r),h=i.getDebugInfo(),g=[`${a} elements`,`${h.totalInstances} instances`,`${h.batchCount} batches`,`${h.totalAtlases} atlases`,`${h.wrappedCount} wrapped textures`,`${h.simpleCount} simple shapes`].join(`, `);if(p)console.log(`WebGL (${n.name}) - time ${m}ms, ${g}`);else{console.log(`WebGL (${n.name}) - frame time ${m}ms`),console.log(`Totals:`),console.log(` ${g}`),console.log(`Texture Atlases Used:`);var _=h.atlasInfo,v=OP(_),y;try{for(v.s();!(y=v.n()).done;){var b=y.value;console.log(` ${b.type}: ${b.keyCount} keys, ${b.atlasCount} atlases`)}}catch(e){v.e(e)}finally{v.f()}console.log(``)}}e.data.gc&&(console.log(`Garbage Collect!`),e.data.gc=!1,i.gc())}var LX={};LX.drawPolygonPath=function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var c=1;c<a.length/2;c++)e.lineTo(t+o*a[c*2],n+s*a[c*2+1]);e.closePath()},LX.drawRoundPolygonPath=function(e,t,n,r,i,a,o){o.forEach(function(t){return Lq(e,t)}),e.closePath()},LX.drawRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?JR(r,i):Math.min(a,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,c),e.arcTo(t+o,n+s,t,n+s,c),e.arcTo(t-o,n+s,t-o,n,c),e.arcTo(t-o,n-s,t,n-s,c),e.lineTo(t,n-s),e.closePath()},LX.drawBottomRoundRectanglePath=function(e,t,n,r,i,a){var o=r/2,s=i/2,c=a===`auto`?JR(r,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,c),e.arcTo(t-o,n+s,t-o,n,c),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},LX.drawCutRectanglePath=function(e,t,n,r,i,a,o){var s=r/2,c=i/2,l=o===`auto`?XR():o;e.beginPath&&e.beginPath(),e.moveTo(t-s+l,n-c),e.lineTo(t+s-l,n-c),e.lineTo(t+s,n-c+l),e.lineTo(t+s,n+c-l),e.lineTo(t+s-l,n+c),e.lineTo(t-s+l,n+c),e.lineTo(t-s,n+c-l),e.lineTo(t-s,n-c+l),e.closePath()},LX.drawBarrelPath=function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,c=t+a,l=n-o,u=n+o,d=QR(r,i),f=d.widthOffset,p=d.heightOffset,m=d.ctrlPtOffsetPct*f;e.beginPath&&e.beginPath(),e.moveTo(s,l+p),e.lineTo(s,u-p),e.quadraticCurveTo(s+m,u,s+f,u),e.lineTo(c-f,u),e.quadraticCurveTo(c-m,u,c,u-p),e.lineTo(c,l+p),e.quadraticCurveTo(c-m,l,c-f,l),e.lineTo(s+f,l),e.quadraticCurveTo(s+m,l,s,l+p),e.closePath()};for(var RX=Math.sin(0),zX=Math.cos(0),BX={},VX={},HX=Math.PI/40,UX=0*Math.PI;UX<2*Math.PI;UX+=HX)BX[UX]=Math.sin(UX),VX[UX]=Math.cos(UX);LX.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,c=i/2,l=0*Math.PI;l<2*Math.PI;l+=HX)a=t-s*BX[l]*RX+s*VX[l]*zX,o=n+c*VX[l]*RX+c*BX[l]*zX,l===0?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var WX={};WX.createBuffer=function(e,t){var n=document.createElement(`canvas`);return n.width=e,n.height=t,[n,n.getContext(`2d`)]},WX.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=$(e.maxWidth)||$(e.maxHeight),s=this.getPixelRatio(),c=1;if(e.scale!==void 0)i*=e.scale,a*=e.scale,c=e.scale;else if(o){var l=1/0,u=1/0;$(e.maxWidth)&&(l=c*e.maxWidth/i),$(e.maxHeight)&&(u=c*e.maxHeight/a),c=Math.min(l,u),i*=c,a*=c}o||(i*=s,a*=s,c*=s);var d=document.createElement(`canvas`);d.width=i,d.height=a,d.style.width=i+`px`,d.style.height=a+`px`;var f=d.getContext(`2d`);if(i>0&&a>0){f.clearRect(0,0,i,a),f.globalCompositeOperation=`source-over`;var p=this.getCachedZSortedEles();if(e.full)f.translate(-n.x1*c,-n.y1*c),f.scale(c,c),this.drawElements(f,p),f.scale(1/c,1/c),f.translate(n.x1*c,n.y1*c);else{var m=t.pan(),h={x:m.x*c,y:m.y*c};c*=t.zoom(),f.translate(h.x,h.y),f.scale(c,c),this.drawElements(f,p),f.scale(1/c,1/c),f.translate(-h.x,-h.y)}e.bg&&(f.globalCompositeOperation=`destination-over`,f.fillStyle=e.bg,f.rect(0,0,i,a),f.fill())}return d};function GX(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}function KX(e){var t=e.indexOf(`,`);return e.substr(t+1)}function qX(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case`blob-promise`:return new kB(function(r,i){try{t.toBlob(function(e){e==null?i(Error("`canvas.toBlob()` sent a null value in its callback")):r(e)},n,e.quality)}catch(e){i(e)}});case`blob`:return GX(KX(r()),n);case`base64`:return KX(r());default:return r()}}WX.png=function(e){return qX(e,this.bufferCanvasImage(e),`image/png`)},WX.jpg=function(e){return qX(e,this.bufferCanvasImage(e),`image/jpeg`)};var JX={};JX.nodeShapeImpl=function(e,t,n,r,i,a,o,s){switch(e){case`ellipse`:return this.drawEllipsePath(t,n,r,i,a);case`polygon`:return this.drawPolygonPath(t,n,r,i,a,o);case`round-polygon`:return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case`roundrectangle`:case`round-rectangle`:return this.drawRoundRectanglePath(t,n,r,i,a,s);case`cutrectangle`:case`cut-rectangle`:return this.drawCutRectanglePath(t,n,r,i,a,o,s);case`bottomroundrectangle`:case`bottom-round-rectangle`:return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case`barrel`:return this.drawBarrelPath(t,n,r,i,a)}};var YX=ZX,XX=ZX.prototype;XX.CANVAS_LAYERS=3,XX.SELECT_BOX=0,XX.DRAG=1,XX.NODE=2,XX.WEBGL=3,XX.CANVAS_TYPES=[`2d`,`2d`,`2d`,`webgl2`],XX.BUFFER_COUNT=3,XX.TEXTURE_BUFFER=0,XX.MOTIONBLUR_BUFFER_NODE=1,XX.MOTIONBLUR_BUFFER_DRAG=2;function ZX(e){var t=this,n=t.cy.window().document;e.webgl&&(XX.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log(`webgl rendering enabled`)),t.data={canvases:Array(XX.CANVAS_LAYERS),contexts:Array(XX.CANVAS_LAYERS),canvasNeedsRedraw:Array(XX.CANVAS_LAYERS),bufferCanvases:Array(XX.BUFFER_COUNT),bufferContexts:Array(XX.CANVAS_LAYERS)};var r=`-webkit-tap-highlight-color`,i=`rgba(0,0,0,0)`;t.data.canvasContainer=n.createElement(`div`);var a=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=i,a.position=`relative`,a.zIndex=`0`,a.overflow=`hidden`;var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=i;var s={"-webkit-user-select":`none`,"-moz-user-select":`-moz-none`,"user-select":`none`,"-webkit-tap-highlight-color":`rgba(0,0,0,0)`,"outline-style":`none`};uF()&&(s[`-ms-touch-action`]=`none`,s[`touch-action`]=`none`);for(var c=0;c<XX.CANVAS_LAYERS;c++){var l=t.data.canvases[c]=n.createElement(`canvas`),u=XX.CANVAS_TYPES[c];t.data.contexts[c]=l.getContext(u),t.data.contexts[c]||tL(`Could not create canvas of type `+u),Object.keys(s).forEach(function(e){l.style[e]=s[e]}),l.style.position=`absolute`,l.setAttribute(`data-id`,`layer`+c),l.style.zIndex=String(XX.CANVAS_LAYERS-c),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[c]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[XX.NODE].setAttribute(`data-id`,`layer`+XX.NODE+`-node`),t.data.canvases[XX.SELECT_BOX].setAttribute(`data-id`,`layer`+XX.SELECT_BOX+`-selectbox`),t.data.canvases[XX.DRAG].setAttribute(`data-id`,`layer`+XX.DRAG+`-drag`),t.data.canvases[XX.WEBGL]&&t.data.canvases[XX.WEBGL].setAttribute(`data-id`,`layer`+XX.WEBGL+`-webgl`);for(var c=0;c<XX.BUFFER_COUNT;c++)t.data.bufferCanvases[c]=n.createElement(`canvas`),t.data.bufferContexts[c]=t.data.bufferCanvases[c].getContext(`2d`),t.data.bufferCanvases[c].style.position=`absolute`,t.data.bufferCanvases[c].setAttribute(`data-id`,`buffer`+c),t.data.bufferCanvases[c].style.zIndex=String(-c-1),t.data.bufferCanvases[c].style.visibility=`hidden`;t.pathsEnabled=!0;var d=lR(),f=function(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}},p=function(e){return{x:-e.w/2,y:-e.h/2}},m=function(e){var t=e[0]._private;return t.oldBackgroundTimestamp!==t.backgroundTimestamp},h=function(e){return e[0]._private.nodeKey},g=function(e){return e[0]._private.labelStyleKey},_=function(e){return e[0]._private.sourceLabelStyleKey},v=function(e){return e[0]._private.targetLabelStyleKey},y=function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},b=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`main`,a)},x=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`source`,a)},S=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,`target`,a)},C=function(e){return e.boundingBox(),e[0]._private.bodyBounds},w=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||d},T=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||d},E=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||d},D=function(e,t){return t},O=function(e){return f(C(e))},k=function(e,t,n){var r=e?e+`-`:``;return{x:t.x+n.pstyle(r+`text-margin-x`).pfValue,y:t.y+n.pstyle(r+`text-margin-y`).pfValue}},A=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},j=function(e){return k(``,A(e,`labelX`,`labelY`),e)},M=function(e){return k(`source`,A(e,`sourceLabelX`,`sourceLabelY`),e)},N=function(e){return k(`target`,A(e,`targetLabelX`,`targetLabelY`),e)},P=function(e){return p(C(e))},F=function(e){return p(T(e))},I=function(e){return p(E(e))},L=function(e){var t=w(e),n=p(w(e));if(e.isNode()){switch(e.pstyle(`text-halign`).value){case`left`:n.x=-t.w-(t.leftPad||0);break;case`right`:n.x=-(t.rightPad||0);break}switch(e.pstyle(`text-valign`).value){case`top`:n.y=-t.h-(t.topPad||0);break;case`bottom`:n.y=-(t.botPad||0);break}}return n},R=t.data.eleTxrCache=new FJ(t,{getKey:h,doesEleInvalidateKey:m,drawElement:y,getBoundingBox:C,getRotationPoint:O,getRotationOffset:P,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),ee=t.data.lblTxrCache=new FJ(t,{getKey:g,drawElement:b,getBoundingBox:w,getRotationPoint:j,getRotationOffset:L,isVisible:D}),z=t.data.slbTxrCache=new FJ(t,{getKey:_,drawElement:x,getBoundingBox:T,getRotationPoint:M,getRotationOffset:F,isVisible:D}),B=t.data.tlbTxrCache=new FJ(t,{getKey:v,drawElement:S,getBoundingBox:E,getRotationPoint:N,getRotationOffset:I,isVisible:D}),V=t.data.lyrTxrCache=new QJ(t);t.onUpdateEleCalcs(function(e,t){R.invalidateElements(t),ee.invalidateElements(t),z.invalidateElements(t),B.invalidateElements(t),V.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}});var H=function(e){for(var t=0;t<e.length;t++)V.enqueueElementRefinement(e[t].ele)};R.onDequeue(H),ee.onDequeue(H),z.onDequeue(H),B.onDequeue(H),e.webgl&&t.initWebgl(e,{getStyleKey:h,getLabelKey:g,getSourceLabelKey:_,getTargetLabelKey:v,drawElement:y,drawLabel:b,drawSourceLabel:x,drawTargetLabel:S,getElementBox:C,getLabelBox:w,getSourceLabelBox:T,getTargetLabelBox:E,getElementRotationPoint:O,getElementRotationOffset:P,getLabelRotationPoint:j,getSourceLabelRotationPoint:M,getTargetLabelRotationPoint:N,getLabelRotationOffset:L,getSourceLabelRotationOffset:F,getTargetLabelRotationOffset:I})}XX.redrawHint=function(e,t){var n=this;switch(e){case`eles`:n.data.canvasNeedsRedraw[XX.NODE]=t;break;case`drag`:n.data.canvasNeedsRedraw[XX.DRAG]=t;break;case`select`:n.data.canvasNeedsRedraw[XX.SELECT_BOX]=t;break;case`gc`:n.data.gc=!0;break}};var QX=typeof Path2D<`u`;XX.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},XX.usePaths=function(){return QX&&this.pathsEnabled},XX.setImgSmoothing=function(e,t){e.imageSmoothingEnabled==null?(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t):e.imageSmoothingEnabled=t},XX.getImgSmoothing=function(e){return e.imageSmoothingEnabled==null?e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled:e.imageSmoothingEnabled},XX.makeOffscreenCanvas=function(e,t){var n;return(typeof OffscreenCanvas>`u`?`undefined`:RP(OffscreenCanvas))===`undefined`?(n=this.cy.window().document.createElement(`canvas`),n.width=e,n.height=t):n=new OffscreenCanvas(e,t),n},[nY,lY,gY,vY,yY,SY,wY,bX,LX,WX,JX].forEach(function(e){EF(XX,e)});var $X=[{type:`layout`,extensions:cq},{type:`renderer`,extensions:[{name:`null`,impl:lq},{name:`base`,impl:uJ},{name:`canvas`,impl:YX}]}],eZ={},tZ={};function nZ(e,t,n){var r=n,i=function(n){rL("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if(e===`core`){if(bK.prototype[t])return i(t);bK.prototype[t]=n}else if(e===`collection`){if(PG.prototype[t])return i(t);PG.prototype[t]=n}else if(e===`layout`){for(var a=function(e){this.options=e,n.call(this,e),XP(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],c=0;c<s.length;c++){var l=s[c];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var u=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return u?u.call(this):this.emit(`layoutstop`),this},o.destroy||=function(){return this},o.cy=function(){return this._private.cy};var d=function(e){return e._private.cy},f={addEventFields:function(e,t){t.layout=e,t.cy=d(e),t.target=e},bubble:function(){return!0},parent:function(e){return d(e)}};EF(o,{createEmitter:function(){return this._private.emitter=new nG(f,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),kU.eventAliasesOn(o),r=a}else if(e===`renderer`&&t!==`null`&&t!==`base`){var p=rZ(`renderer`,`base`),m=p.prototype,h=n,g=n.prototype,_=function(){p.apply(this,arguments),h.apply(this,arguments)},v=_.prototype;for(var y in m){var b=m[y];if(g[y]!=null)return i(y);v[y]=b}for(var x in g)v[x]=g[x];m.clientFunctions.forEach(function(e){v[e]=v[e]||function(){tL("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=_}else if(e===`__proto__`||e===`constructor`||e===`prototype`)return tL(e+` is an illegal type to be registered, possibly lead to prototype pollutions`);return NF({map:eZ,keys:[e,t],value:r})}function rZ(e,t){return PF({map:eZ,keys:[e,t]})}function iZ(e,t,n,r,i){return NF({map:tZ,keys:[e,t,n,r],value:i})}function aZ(e,t,n,r){return PF({map:tZ,keys:[e,t,n,r]})}var oZ=function(){if(arguments.length===2)return rZ.apply(null,arguments);if(arguments.length===3)return nZ.apply(null,arguments);if(arguments.length===4)return aZ.apply(null,arguments);if(arguments.length===5)return iZ.apply(null,arguments);tL(`Invalid extension access syntax`)};bK.prototype.extension=oZ,$X.forEach(function(e){e.extensions.forEach(function(t){nZ(e.type,t.name,t.impl)})});var sZ=function(){if(!(this instanceof sZ))return new sZ;this.length=0},cZ=sZ.prototype;cZ.instanceString=function(){return`stylesheet`},cZ.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},cZ.css=function(e,t){var n=this.length-1;if(qP(e))this[n].properties.push({name:e,value:t});else if(XP(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(s!=null){var c=mK.properties[o]||mK.properties[pF(o)];if(c!=null){var l=c.name,u=s;this[n].properties.push({name:l,value:u})}}}return this},cZ.style=cZ.css,cZ.generateStyle=function(e){var t=new mK(e);return this.appendToStyle(t)},cZ.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var lZ=`3.33.3`,uZ=function(e){if(e===void 0&&(e={}),XP(e))return new bK(e);if(qP(e))return oZ.apply(oZ,arguments)};uZ.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(uZ),e.apply(null,t),this},uZ.warnings=function(e){return nL(e)},uZ.version=lZ,uZ.stylesheet=uZ.Stylesheet=sZ;var dZ=/^#{1,6}\s+/,fZ=/[*_`~]+/g,pZ=/\s+/g;function mZ(e){return e.replace(dZ,``).replace(fZ,``).replace(pZ,` `).trim()}var hZ={sage:`#abcfb8`,ochre:`#edbf7f`,terracotta:`#ffb4a1`,neutral:`#8b928c`,dimNeutral:`#6e7370`,onSurface:`#e5e2e1`,surface:`#111111`},gZ={concept:hZ.sage,component:hZ.ochre,bug:hZ.terracotta,tool:hZ.neutral,file:hZ.neutral,spore:hZ.sage,session:hZ.ochre,other:hZ.dimNeutral},_Z=hZ.dimNeutral,vZ=24,yZ=60,bZ=12,xZ=10,SZ=8,CZ=1.5,wZ=.25,TZ=.7,EZ=9,DZ=.7,OZ=4,kZ=.6,AZ=1e4,jZ=120,MZ=.2,NZ=600,PZ=300,FZ=.95,IZ=1.2,LZ=50,RZ=20,zZ={concept:`Concept`,component:`Component`,bug:`Bug`,tool:`Tool`,file:`File`,spore:`Spore`,session:`Session`,other:`Other`};function BZ(e,t){return t?yZ*1.2:vZ+Math.min(e/bZ,1)*(yZ-vZ)}function VZ(e){let t=mZ(e);return t.length<=RZ?t:t.slice(0,RZ-1)+`…`}function HZ(e){return gZ[e?.toLowerCase()]??_Z}function UZ(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)%360}function WZ(e){e.elements().removeClass(`faded`),e.elements().unselect(),e.edges().style({"line-opacity":wZ,"text-opacity":0,width:CZ})}function GZ(e,t){if(!t){WZ(e);return}let n=e.$id(t);if(n.length===0){WZ(e);return}WZ(e),n.select();let r=n.closedNeighborhood();e.elements().not(r).addClass(`faded`),n.connectedEdges().style({"line-opacity":TZ,"text-opacity":0,width:2})}function KZ({nodes:e,edges:t,onNodeSelect:n,centerId:r,centerNodeType:i,selectedNodeId:a}){let o=(0,W.useRef)(null),s=(0,W.useRef)(null),c=(0,W.useRef)(null),l=(0,W.useRef)(null),u=(0,W.useRef)(n);u.current=n;let d=(0,W.useMemo)(()=>new Map(e.map(e=>[e.id,e])),[e]),f=(0,W.useMemo)(()=>{let n=new Map;for(let t of e)n.set(t.id,0);for(let e of t)n.set(e.source_id,(n.get(e.source_id)??0)+1),n.set(e.target_id,(n.get(e.target_id)??0)+1);return n},[e,t]),p=(0,W.useMemo)(()=>[{selector:`node`,style:{label:`data(label)`,"background-color":e=>HZ(e.data(`type`)),"background-opacity":.9,color:hZ.onSurface,"font-size":xZ,"font-family":`Inter, system-ui, sans-serif`,"text-valign":`bottom`,"text-margin-y":SZ,"text-outline-color":hZ.surface,"text-outline-width":2,"text-outline-opacity":.8,"text-wrap":`wrap`,"text-max-width":`120px`,width:`data(nodeSize)`,height:`data(nodeSize)`,"border-width":0,"border-color":hZ.sage,"border-opacity":0,"overlay-opacity":0}},{selector:`node.center`,style:{"border-width":2,"border-color":hZ.onSurface,"border-opacity":.4,"text-outline-color":hZ.surface,"text-outline-width":3,"font-weight":`bold`}},{selector:`node:active`,style:{"overlay-opacity":.08,"overlay-color":hZ.sage}},{selector:`node:selected`,style:{"border-width":OZ,"border-color":e=>HZ(e.data(`type`)),"border-opacity":kZ,"background-opacity":1}},{selector:`edge`,style:{width:CZ,"line-color":hZ.neutral,"line-opacity":wZ,"curve-style":`unbundled-bezier`,"control-point-distances":[40],"control-point-weights":[.5],"target-arrow-shape":`triangle`,"target-arrow-color":hZ.neutral,"arrow-scale":DZ,label:`data(label)`,"font-size":EZ,"font-family":`Inter, system-ui, sans-serif`,color:hZ.neutral,"text-opacity":0,"text-rotation":`autorotate`,"text-margin-y":-8,"text-outline-color":hZ.surface,"text-outline-width":2,"text-outline-opacity":.7}},{selector:`edge:active`,style:{"text-opacity":1,"line-opacity":TZ}},{selector:`node.faded`,style:{opacity:.3}},{selector:`edge.faded`,style:{opacity:.1}}],[]),m=(0,W.useCallback)(n=>{let i=o.current?.getBoundingClientRect(),a={x:i?i.width/2:0,y:i?i.height/2:0};return[...e.map(e=>{let i=zZ[e.type?.toLowerCase()]??zZ.other,o=e.id===r,s=n?.get(e.id);if(!s){let i=t.find(t=>t.source_id===e.id||t.target_id===e.id),o=i?i.source_id===e.id?i.target_id:i.source_id:r,c=(o&&n?.get(o))??a,l=UZ(e.id)*Math.PI/180,u=o===r?150:110;s={x:c.x+Math.cos(l)*u,y:c.y+Math.sin(l)*u}}return{data:{id:e.id,label:`${VZ(e.name)}\n${i}`,fullLabel:e.name,type:e.type,isCenter:o,degree:f.get(e.id)??0,nodeSize:BZ(f.get(e.id)??0,o)},position:s,classes:o?`center`:``}}),...t.map((e,t)=>({data:{id:`edge-${t}`,source:e.source_id,target:e.target_id,label:e.label??``,weight:e.weight??1}}))]},[r,f,t,e]),h=(0,W.useCallback)((e,t)=>{if(!t){e.resize(),GZ(e,a??null);return}let n=r&&i===`session`?e.layout({name:`cose`,animate:!0,animationDuration:NZ,nodeRepulsion:()=>AZ*1.5,idealEdgeLength:()=>jZ*1.35,gravity:MZ*.75,nodeDimensionsIncludeLabels:!0,fit:!0,padding:LZ*1.2,randomize:!1}):r?e.layout({name:`concentric`,animate:!0,animationDuration:PZ,fit:!0,padding:LZ,spacingFactor:IZ,avoidOverlap:!0,concentric:e=>e.id()===r?3:e.closedNeighborhood().some(e=>e.isNode()&&e.id()===r)?2:1,levelWidth:()=>1,nodeDimensionsIncludeLabels:!0}):e.layout({name:`cose`,animate:!0,animationDuration:NZ,nodeRepulsion:()=>AZ,idealEdgeLength:()=>jZ,gravity:MZ,nodeDimensionsIncludeLabels:!0,fit:!0,padding:LZ});n.on(`layoutstop`,()=>{let e=s.current;if(!e)return;let t=e.$(`node.center`);if(t.length>0){let n=t.closedNeighborhood();e.fit(n,LZ*1.5),e.zoom()<FZ&&(e.zoom(FZ),e.center(t))}else e.fit(void 0,LZ);GZ(e,a??null)}),n.run()},[r,i,a]);return(0,W.useEffect)(()=>{let e=o.current;if(!e)return;function t(){let t=e.getBoundingClientRect();if(t.width===0||t.height===0||s.current)return;let n=uZ({container:e,elements:[],style:p,layout:{name:`preset`},userZoomingEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,minZoom:.3,maxZoom:3});n.on(`tap`,`node`,e=>{let t=e.target.data(),n=d.get(t.id);u.current?.(n??{id:t.id,name:t.fullLabel??t.label,type:t.type})}),n.on(`tap`,e=>{e.target===n&&u.current?.(null)}),n.on(`mouseover`,`edge`,e=>{e.target.style(`text-opacity`,1),e.target.style(`line-opacity`,TZ)}),n.on(`mouseout`,`edge`,e=>{let t=n.$(`node:selected`);t.length>0&&t.connectedEdges().contains(e.target)||(e.target.style(`text-opacity`,0),e.target.style(`line-opacity`,wZ))}),s.current=n}return t(),c.current?.disconnect(),c.current=new ResizeObserver(()=>{s.current?s.current.resize():t()}),c.current.observe(e),()=>{c.current?.disconnect(),c.current=null,s.current?.destroy(),s.current=null}},[d,p]),(0,W.useEffect)(()=>{let e=s.current;if(!e)return;let t=new Map;e.nodes().forEach(e=>{t.set(e.id(),{x:e.position(`x`),y:e.position(`y`)})}),e.elements().remove(),e.add(m(t));let n=l.current!==(r??null);l.current=r??null,h(e,n||t.size===0)},[m,r,h]),(0,W.useEffect)(()=>{let e=s.current;e&&GZ(e,a??null)},[a]),{containerRef:o,resetView:(0,W.useCallback)(()=>{let e=s.current;e&&(WZ(e),e.fit(void 0,LZ))},[])}}function qZ({nodes:e,edges:t,onNodeSelect:n,selectedNode:r,centerId:i,centerNodeType:a,isLoading:o}){let{containerRef:s,resetView:c}=KZ({nodes:e,edges:t,onNodeSelect:n,centerId:i,centerNodeType:a,selectedNodeId:r?.id??null});return(0,G.jsxs)(`div`,{className:`absolute inset-0`,children:[(0,G.jsx)(`div`,{className:`absolute inset-0 rounded-md bg-surface-container-lowest`,style:{backgroundImage:`radial-gradient(circle at 2px 2px, rgba(139, 146, 140, 0.05) 1px, transparent 0)`,backgroundSize:`40px 40px`}}),(0,G.jsx)(`div`,{ref:s,className:`absolute inset-0 rounded-md`,style:{width:`100%`,height:`100%`}}),(0,G.jsxs)(`div`,{className:`absolute bottom-3 left-3 z-10 flex items-center gap-3`,children:[e.length>0&&(0,G.jsxs)(`div`,{className:`flex items-center gap-3 font-mono text-[10px] text-on-surface-variant/60 mr-1`,children:[(0,G.jsxs)(`span`,{children:[e.length,` nodes`]}),(0,G.jsxs)(`span`,{children:[t.length,` edges`]})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:c,className:`gap-1.5 h-7 text-[10px] px-2 bg-surface-container-high/40 backdrop-blur-xs`,children:[(0,G.jsx)(ms,{className:`h-3 w-3`}),`Reset View`]})]}),!o&&e.length===0&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No nodes to display`})})]})}var JZ=400,YZ={concept:`default`,component:`warning`,bug:`destructive`,tool:`secondary`,file:`secondary`,spore:`default`,session:`warning`},XZ={concept:`bg-primary`,component:`bg-secondary`,bug:`bg-tertiary`,tool:`bg-outline`,file:`bg-outline`,spore:`bg-primary`,session:`bg-secondary`};function ZZ({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`flex justify-between items-baseline py-1`,children:[(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:e}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface text-right max-w-[160px] truncate`,children:t})]})}function QZ(e){return e.type===`session`?`/sessions/${e.id}`:e.type===`spore`?`/mycelium?tab=spores&spore=${e.id}`:null}function $Z({node:e,edges:t,nodes:n,metadata:r,markdownPreview:i,connectedSpores:a,onClose:o,onNodeSelect:s,onFocusNode:c,onNavigateToSpore:l,isConnectionsLoading:u}){let d=Nn();if(!e)return null;let f=e.type.toLowerCase(),p=YZ[f]??`secondary`,m=XZ[f]??`bg-outline`,h=new Map((n??[]).map(e=>[e.id,e])),g=[];for(let n of t??[])if(n.source_id===e.id){let e=h.get(n.target_id);e&&g.push({nodeId:e.id,nodeName:e.name,nodeType:e.type,edgeLabel:n.label??`connected`,direction:`outgoing`,status:e.status})}else if(n.target_id===e.id){let e=h.get(n.source_id);e&&g.push({nodeId:e.id,nodeName:e.name,nodeType:e.type,edgeLabel:n.label??`connected`,direction:`incoming`,status:e.status})}g.sort((e,t)=>e.nodeName.localeCompare(t.nodeName));let _=i??e.content,v=_&&_.length>JZ?_.slice(0,JZ)+`…`:_,y=e.type===`spore`?`Observation`:e.type===`session`?`Summary`:`Notes`;return(0,G.jsxs)(Q,{glass:!0,className:`absolute top-3 right-3 bottom-3 z-20 w-[320px] overflow-y-auto flex flex-col shadow-lg border border-outline-variant/15 rounded-md`,children:[(0,G.jsx)(`div`,{className:`p-4 pb-3`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[(0,G.jsx)(`div`,{className:`h-2 w-2 rounded-full ${m} shrink-0`}),(0,G.jsx)(X,{variant:p,className:`text-[10px] uppercase`,children:e.observation_type??e.type})]}),(0,G.jsx)(`h2`,{className:`font-serif text-lg text-on-surface leading-tight break-words`,children:mZ(e.name)}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-3 mt-2`,children:QZ(e)&&(0,G.jsxs)(`button`,{onClick:()=>{e.type===`spore`&&l?l(e.id):d(QZ(e))},className:`inline-flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-primary transition-colors group cursor-pointer`,children:[(0,G.jsxs)(`span`,{children:[`View `,e.type]}),(0,G.jsx)(Po,{className:`h-3 w-3 group-hover:translate-x-0.5 transition-transform`})]})})]}),o&&(0,G.jsx)(`button`,{onClick:o,className:`shrink-0 rounded-md p-1 text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high transition-colors`,children:(0,G.jsx)(Is,{className:`h-4 w-4`})})]})}),(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-0.5`,children:[(0,G.jsx)(Qj,{children:`Metadata`}),(0,G.jsxs)(`div`,{className:`mt-1.5`,children:[(0,G.jsx)(ZZ,{label:`Type`,value:e.observation_type??e.type}),(0,G.jsx)(ZZ,{label:`ID`,value:e.id.slice(0,12)+`…`}),e.status&&(0,G.jsx)(ZZ,{label:`Status`,value:e.status}),e.created_at!=null&&(0,G.jsx)(ZZ,{label:`Created`,value:new Date(e.created_at).toLocaleDateString()}),e.mention_count!=null&&e.mention_count>0&&(0,G.jsx)(ZZ,{label:`Mentions`,value:String(e.mention_count)}),(0,G.jsx)(ZZ,{label:`Connections`,value:String(g.length)}),e.depth!==void 0&&(0,G.jsx)(ZZ,{label:`Depth`,value:String(e.depth)}),r&&Object.entries(r).map(([e,t])=>(0,G.jsx)(ZZ,{label:e,value:t},e))]})]}),v&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-1.5`,children:[(0,G.jsx)(Qj,{children:y}),(0,G.jsx)(Q,{level:`lowest`,className:`p-3`,children:(0,G.jsx)(uO,{content:v,className:`text-xs leading-relaxed text-on-surface-variant`})})]})]}),(g.length>0||u)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(Qj,{children:[`Connections (`,g.length,`)`]}),u&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] uppercase tracking-wider text-on-surface-variant`,children:[(0,G.jsx)(es,{className:`h-3 w-3 animate-spin`}),`Updating`]})]}),(0,G.jsx)(`div`,{className:`space-y-1`,children:g.map((e,t)=>(0,G.jsxs)(`div`,{className:`group w-full rounded-md border border-transparent px-2 py-2 transition-colors hover:border-outline-variant/10 hover:bg-surface-container-high/50`,children:[(0,G.jsx)(`button`,{type:`button`,className:`w-full text-left`,onClick:()=>{let t=h.get(e.nodeId);s?.(t??{id:e.nodeId,name:e.nodeName,type:e.nodeType,status:e.status},`inspector`)},children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`div`,{className:`mt-1 h-2 w-2 rounded-full ${XZ[e.nodeType.toLowerCase()]??`bg-outline`} shrink-0`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate font-sans text-xs text-on-surface transition-colors group-hover:text-primary`,children:mZ(e.nodeName)}),(0,G.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 text-[9px] uppercase tracking-wider text-on-surface-variant/60`,children:[(0,G.jsx)(`span`,{children:e.nodeType}),(0,G.jsx)(`span`,{children:`•`}),(0,G.jsx)(`span`,{children:e.edgeLabel})]})]}),(0,G.jsx)(co,{className:`mt-0.5 h-3 w-3 shrink-0 text-on-surface-variant/50 ${e.direction===`incoming`?`rotate-180`:``}`})]})}),(0,G.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 px-2 text-[10px] uppercase tracking-wide`,onClick:()=>{let t=h.get(e.nodeId);c?.(t??{id:e.nodeId,name:e.nodeName,type:e.nodeType,status:e.status})},children:`Focus`})})]},`${e.nodeId}-${e.edgeLabel}-${t}`))})]})]}),a&&a.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-px bg-surface-container-high/50`}),(0,G.jsxs)(`div`,{className:`px-4 py-3 space-y-1.5`,children:[(0,G.jsx)(Qj,{children:`Connected Spores`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:a.map(e=>(0,G.jsx)(X,{variant:`secondary`,className:`cursor-pointer text-[10px] hover:bg-surface-container-highest transition-colors`,children:e.name},e.id))})]})]})]})}function eQ({searchPlaceholder:e=`Search...`,searchValue:t,onSearchChange:n,filters:r=[],filterValues:i={},onFilterChange:a,inputRef:o}){return(0,G.jsxs)(Q,{level:`bright`,className:`flex items-center gap-3 px-4 py-2 rounded-md`,children:[(0,G.jsx)(_s,{className:`h-3.5 w-3.5 text-on-surface-variant shrink-0`}),(0,G.jsx)(cp,{ref:o,placeholder:e,value:t,onChange:e=>n(e.target.value),className:`bg-transparent border-none shadow-none focus-visible:ring-0 px-0 h-auto py-0 font-sans text-sm flex-1`,"aria-label":e}),r.map(e=>(0,G.jsx)(`div`,{className:`w-40 shrink-0`,children:(0,G.jsxs)(w_,{value:i[e.key]??`all`,onValueChange:t=>a?.(e.key,t),children:[(0,G.jsx)(E_,{children:(0,G.jsx)(T_,{placeholder:e.label})}),(0,G.jsx)(D_,{children:e.options.map(e=>(0,G.jsx)(O_,{value:e.value,children:e.label},e.value))})]})},e.key))]})}function tQ(e){switch(e){case`wisdom`:return`bg-primary/15 text-primary`;case`discovery`:return`bg-primary/15 text-primary`;case`decision`:return`bg-secondary/15 text-secondary`;case`trade_off`:return`bg-secondary/15 text-secondary`;case`gotcha`:return`bg-tertiary/15 text-tertiary`;case`bug_fix`:return`bg-tertiary/15 text-tertiary`;default:return`bg-surface-container text-on-surface-variant`}}function nQ(e){switch(e){case`active`:return`bg-primary/15 text-primary`;case`consolidated`:return`bg-surface-container-high text-on-surface-variant`;case`superseded`:return`bg-tertiary/10 text-tertiary/70`;default:return`bg-surface-container text-on-surface-variant`}}function rQ(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}var iQ=120,aQ=1e3,oQ=[{key:`type`,label:`Type`,options:[`all`,`gotcha`,`decision`,`discovery`,`trade_off`,`bug_fix`].map(e=>({value:e,label:e===`all`?`All types`:rQ(e)}))},{key:`status`,label:`Status`,options:[`all`,`active`,`superseded`,`consolidated`].map(e=>({value:e,label:e===`all`?`All statuses`:rQ(e)}))}];function sQ(e){return new Date(e*aQ).toLocaleDateString()}function cQ({spore:e,onClick:t,isSelected:n}){return(0,G.jsx)(Q,{level:n?`high`:`low`,className:J(`p-4 cursor-pointer transition-all duration-150 hover:bg-surface-container-high hover:shadow-[inset_3px_0_0_var(--primary)] rounded-lg`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,n&&`ring-1 ring-primary/30`),onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},tabIndex:0,role:`button`,"aria-label":`${rQ(e.observation_type)} spore: ${KA(e.content,iQ)}`,"aria-pressed":n,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold`,tQ(e.observation_type)),children:rQ(e.observation_type)}),(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2 py-0.5 text-xs font-semibold`,nQ(e.status)),children:rQ(e.status)}),e.importance!==null&&(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:e.importance.toFixed(1)}),(0,G.jsx)(Vj,{annotation:e.release_state})]}),(0,G.jsx)(uO,{content:e.content,compact:!0,className:`text-on-surface line-clamp-2`})]}),(0,G.jsxs)(`div`,{className:`shrink-0 text-right space-y-1`,children:[e.session_id&&(0,G.jsx)(`div`,{className:`font-mono text-xs text-on-surface-variant`,children:qA(e.session_id)}),(0,G.jsx)(`div`,{className:`font-sans text-xs text-on-surface-variant`,children:sQ(e.created_at)})]})]})})}function lQ(){return(0,G.jsx)(Q,{level:`low`,className:`p-4 rounded-lg`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`div`,{className:`h-5 w-16 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-5 w-14 animate-pulse rounded bg-surface-container`})]}),(0,G.jsx)(`div`,{className:`h-4 w-3/4 animate-pulse rounded bg-surface-container`})]}),(0,G.jsxs)(`div`,{className:`shrink-0 space-y-1`,children:[(0,G.jsx)(`div`,{className:`h-3 w-14 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-16 animate-pulse rounded bg-surface-container`})]})]})})}function uQ({onSelectSpore:e,selectedSporeId:t}){let{searchInput:n,debouncedSearch:r,filterValues:i,offset:a,setOffset:o,handleSearchChange:s,handleFilterChange:c,activeFilter:l}=aN({initialFilters:{type:`all`,status:`all`}}),u=l(`type`),d=l(`status`),{data:f,isLoading:p,isError:m,error:h}=kM({type:u,status:d,search:r,limit:50,offset:a}),g=f?.spores??[],_=f?.total??0;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(eQ,{searchPlaceholder:`Search spores...`,searchValue:n,onSearchChange:s,filters:oQ,filterValues:i,onFilterChange:c}),m?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-destructive`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load spores`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:h instanceof Error?h.message:`Unknown error`})]}):(0,G.jsx)(`div`,{className:`space-y-2`,children:p?[1,2,3,4,5].map(e=>(0,G.jsx)(lQ,{},e)):g.length===0?(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(ws,{className:`h-8 w-8 opacity-30`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:_===0&&!r&&!u&&!d?`No spores yet`:`No matching spores`}),_===0&&!r&&!u&&!d&&(0,G.jsx)(`span`,{className:`font-sans text-xs`,children:`Spores are extracted from session activity by the agent`})]}):g.map(n=>(0,G.jsx)(cQ,{spore:n,onClick:()=>e(n),isSelected:n.id===t},n.id))}),(0,G.jsx)(Mj,{total:_,offset:a,limit:50,onPageChange:o})]})}var dQ=12,fQ=8;function pQ({type:e}){return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold`,tQ(e)),children:rQ(e)})}function mQ({status:e}){return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold`,nQ(e)),children:rQ(e)})}function hQ({label:e,value:t,children:n}){return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 py-1.5`,children:[(0,G.jsx)(`span`,{className:`shrink-0 font-sans text-xs text-on-surface-variant`,children:e}),n??(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface text-right break-all`,children:t})]})}function gQ({id:e,onBack:t,onNavigateToSpore:n,onNavigateToGraph:r}){let i=Nn(),{data:a,isLoading:o,isError:s,error:c}=AM(e);if(o)return(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(es,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans`,children:`Loading spore...`})]});if(s||!a)return(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-destructive`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Spore not found`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:c instanceof Error?c.message:`Unknown error`})]});let l=(()=>{if(!a.tags)return[];if(a.tags.startsWith(`[`))try{return JSON.parse(a.tags)}catch{}return a.tags.split(`,`).map(e=>e.trim()).filter(Boolean)})();return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),`Spores`]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,G.jsx)(pQ,{type:a.observation_type}),(0,G.jsx)(mQ,{status:a.status}),(0,G.jsx)(Vj,{annotation:a.release_state}),a.importance!==null&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Importance: `,(0,G.jsx)(`span`,{className:`text-on-surface font-medium`,children:a.importance.toFixed(1)})]}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant ml-auto`,children:WA(a.created_at)})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-5`,children:[(0,G.jsx)(Qj,{className:`mb-2`,children:`Observation`}),(0,G.jsx)(uO,{content:a.content})]}),a.context&&(0,G.jsxs)(Q,{level:`low`,className:`p-5`,children:[(0,G.jsx)(Qj,{className:`mb-2`,children:`Context`}),(0,G.jsx)(uO,{content:a.context})]}),l.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:l.map(e=>(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-surface-container px-2.5 py-0.5 font-sans text-xs text-on-surface-variant`,children:e},e))}),(a.predecessor_id||a.successor_id)&&(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-2`,children:[(0,G.jsx)(Qj,{children:`Resolution History`}),a.predecessor_id&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{children:`Supersedes`}),(0,G.jsxs)(`button`,{className:`font-mono text-primary hover:underline flex items-center gap-1`,onClick:()=>n?.(a.predecessor_id),children:[a.predecessor_id.slice(0,fQ),(0,G.jsx)(co,{className:`h-3 w-3`})]})]}),a.successor_id&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{children:`Superseded by`}),(0,G.jsxs)(`button`,{className:`font-mono text-primary hover:underline flex items-center gap-1`,onClick:()=>n?.(a.successor_id),children:[a.successor_id.slice(0,fQ),(0,G.jsx)(co,{className:`h-3 w-3`})]})]})]}),(0,G.jsxs)(Q,{glass:!0,className:`p-5`,children:[(0,G.jsx)(Qj,{className:`mb-2`,children:`Metadata`}),(0,G.jsxs)(`div`,{className:`text-sm`,children:[(0,G.jsx)(hQ,{label:`ID`,value:a.id}),(0,G.jsx)(hQ,{label:`Created`,value:GA(a.created_at)}),(0,G.jsx)(hQ,{label:`Updated`,value:GA(a.updated_at)}),a.session_id&&(0,G.jsx)(hQ,{label:`Session`,children:(0,G.jsxs)(`button`,{className:`font-mono text-xs text-primary hover:underline flex items-center gap-1`,onClick:()=>i(`/sessions/${a.session_id}`),children:[a.session_id.slice(0,dQ),(0,G.jsx)(Po,{className:`h-3 w-3`})]})}),a.agent_id&&(0,G.jsx)(hQ,{label:`Agent`,value:a.agent_id})]})]})]})}var _Q=new Set([`spore`,`session`,`other`]),vQ=200,yQ=`right-[332px]`,bQ=6,xQ=3,SQ=`h-[calc(100vh-285px)]`,CQ=[{id:`graph`,label:`Graph`,description:`connection map`},{id:`spores`,label:`Spores`,description:`captured knowledge`}],wQ=`tab`,TQ=`spore`,EQ=new Set([`graph`,`spores`]);function DQ(){let e=new URLSearchParams(window.location.search),t=e.get(wQ),n=e.get(TQ)??void 0;return{tab:n?`spores`:t&&EQ.has(t)?t:`graph`,sporeId:n}}function OQ(e,t){let n=new URLSearchParams;e!==`graph`&&n.set(wQ,e),t&&n.set(TQ,t);let r=n.toString(),i=r?`${window.location.pathname}?${r}`:window.location.pathname;window.history.pushState(null,``,i)}function kQ(e){if(!e)return[];let t=[];return`center`in e&&e.center&&t.push(e.center),e.nodes&&t.push(...e.nodes),t}function AQ(e,t){let n=e.findIndex(e=>e.id===t.id);return n>=0?[...e.slice(0,n),t].slice(-xQ):[...e,t].slice(-xQ)}function jQ({onNavigateToSpore:e}){let[t,n]=(0,W.useState)(`focus`),[r,i]=(0,W.useState)(null),[a,o]=(0,W.useState)(1),[s]=(0,W.useState)(new Set(_Q)),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)([]),{data:m,isLoading:h}=NM(),g=t===`focus`&&r!==null,{data:_,isLoading:v}=MM(t===`global`||c.length>0),{data:y,isLoading:b}=jM(r??void 0,a,g),x=u!==null&&u.id!==r,{data:S,isLoading:C}=jM(u?.id,1,x),w=t===`global`?_:y,T=t===`global`?v:h||g&&b,E=(_?.nodes?.length??0)>vQ;(0,W.useEffect)(()=>{if(!r&&m?.recommended_id){let e=m.seeds.find(e=>e.id===m.recommended_id),t=(e?.type===`session`?m.seeds.find(e=>e.type!==`session`):null)??e??m.seeds[0];t&&(i(t.id),d(t),p(e=>AQ(e,t)))}},[r,m]),(0,W.useEffect)(()=>{t===`focus`&&r&&y?.center?.id===r&&(d(y.center),p(e=>e.length===0?[y.center]:AQ(e,y.center)))},[r,y,t]);let D=u?.id===r?y:S,O=u?.id===r?b:C,k=(0,W.useMemo)(()=>kQ(D),[D]),A=D?.edges??[],j=(0,W.useMemo)(()=>kQ(w),[w]),M=(0,W.useMemo)(()=>j.filter(e=>{let t=e.type.toLowerCase(),n=_Q.has(t)?t:`other`;return!!s.has(n)}),[j,s]),N=(0,W.useMemo)(()=>{let e=w?.edges??[],t=new Set(M.map(e=>e.id));return e.filter(e=>t.has(e.source_id)&&t.has(e.target_id))},[w?.edges,M]),P=(0,W.useCallback)((e,t=`canvas`)=>{d(e)},[t]),F=(0,W.useCallback)(e=>{p(t=>AQ(t,e)),i(e.id),d(e),n(`focus`)},[]),I=(0,W.useCallback)(()=>{n(`global`)},[]),L=(0,W.useCallback)(()=>{!r&&u&&(p(e=>AQ(e,u)),i(u.id)),n(`focus`)},[r,u]),R=(0,W.useCallback)(e=>{p(t=>{let n=t.findIndex(t=>t.id===e.id);return n>=0?t.slice(0,n+1):t}),i(e.id),d(e),n(`focus`)},[]),ee=(0,W.useCallback)(()=>{p(e=>{if(e.length<=1)return e;let t=e.slice(0,-1),r=t[t.length-1];return r&&(i(r.id),d(r),n(`focus`)),t})},[]),z=(0,W.useMemo)(()=>{let e=_?.nodes??[];return e.length>0?e:j},[_?.nodes,j]),B=c?z.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t).filter(e=>mZ(e.name).toLowerCase().includes(c.toLowerCase())).slice(0,bQ):[];return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`rounded-lg border border-outline-variant/20 bg-surface-container/72 px-4 py-3 shadow-xs`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative min-w-[260px] flex-1 max-w-[420px]`,children:[(0,G.jsx)(_s,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-on-surface-variant/60`}),(0,G.jsx)(cp,{placeholder:`Find a node or idea...`,value:c,onChange:e=>l(e.target.value),className:`h-9 pl-9`})]}),(0,G.jsxs)(`div`,{className:`flex rounded-lg border border-outline-variant/10 bg-surface-container-high p-1 shadow-xs`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:J(`h-8 px-3 gap-1.5 transition-all`,t===`global`?`bg-surface-container-lowest text-primary shadow-xs`:`text-on-surface-variant hover:text-on-surface`),onClick:I,children:[(0,G.jsx)(ss,{className:`h-3.5 w-3.5`}),(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:`Overview`})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!r&&!u,className:J(`h-8 px-3 gap-1.5 transition-all`,t===`focus`?`bg-surface-container-lowest text-primary shadow-xs`:`text-on-surface-variant hover:text-on-surface`,!r&&!u&&`cursor-not-allowed opacity-50`),onClick:L,children:[(0,G.jsx)(Ds,{className:`h-3.5 w-3.5`}),(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:`Focus`})]})]}),t===`focus`&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1 rounded-lg border border-outline-variant/10 bg-surface-container-high p-1 shadow-xs`,children:[(0,G.jsx)(`span`,{className:`px-2 font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`Depth`}),[1,2,3].map(e=>(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:J(`h-7 min-w-7 rounded-md border px-2 font-mono text-[10px] transition-all`,a===e?`border-primary/40 bg-primary/15 text-primary shadow-xs font-bold`:`border-transparent text-on-surface-variant hover:border-outline-variant/20 hover:text-on-surface`),onClick:()=>o(e),children:e},e))]})]}),B.length>0&&(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 pt-1`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.16em] text-on-surface-variant`,children:`Jump To`}),B.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>F(e),className:J(`max-w-[220px] truncate rounded-full border px-3 py-1 text-[11px] transition-colors`,u?.id===e.id?`border-primary/40 bg-primary/10 text-on-surface`:`border-outline-variant/20 bg-surface-container-low/50 text-on-surface-variant hover:text-on-surface`),title:mZ(e.name),children:mZ(e.name)},e.id))]}),c&&B.length===0&&_&&(0,G.jsxs)(`div`,{className:`mt-3 border-t border-outline-variant/10 pt-3 text-sm text-on-surface-variant`,children:['No graph nodes matched `"',c,'"`.']}),f.length>0&&(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-outline-variant/10 pt-3`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-[0.16em] text-on-surface-variant`,children:`Trail`}),f.length>1&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:`h-7 shrink-0 px-2 text-[10px]`,onClick:ee,children:`Back`}),f.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>R(e),className:J(`max-w-[180px] truncate rounded-full border px-3 py-1 text-[11px] transition-colors`,r===e.id?`border-primary/40 bg-primary/10 text-on-surface`:`border-outline-variant/20 bg-surface-container-low/50 text-on-surface-variant hover:text-on-surface`),title:mZ(e.name),children:mZ(e.name)},e.id))]})]}),(0,G.jsxs)(`div`,{className:J(`relative`,SQ),children:[T&&(0,G.jsx)(`div`,{className:`absolute inset-0 z-30 flex items-center justify-center rounded-md bg-surface-container-lowest/50 backdrop-blur-[2px] transition-opacity`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-primary border-t-transparent`}),(0,G.jsxs)(`span`,{className:`text-xs font-mono animate-pulse text-on-surface-variant`,children:[`Cultivating `,t,` graph...`]})]})}),(0,G.jsx)(`div`,{className:J(`absolute inset-y-3 left-3`,u?yQ:`right-3`),children:(0,G.jsx)(qZ,{nodes:M,edges:N,onNodeSelect:P,selectedNode:u,centerId:t===`focus`?r:null,centerNodeType:t===`focus`?y?.center?.type??null:null,isLoading:T})}),t===`global`&&E&&(0,G.jsxs)(`div`,{className:J(`absolute bottom-3 left-3 z-10 flex max-w-[280px] flex-col items-start gap-2 rounded-lg border border-warning/20 bg-warning-container/80 p-3 text-on-warning-container shadow-lg backdrop-blur-xs`,u?yQ:`right-3`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Jo,{className:`h-4 w-4 shrink-0 text-warning`}),(0,G.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-wider`,children:`Overview Snapshot`})]}),(0,G.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-on-warning-container/80`,children:[`This overview still contains `,_?.nodes?.length,` nodes. Use Focus mode for navigation and step through connections from the drawer.`]}),(0,G.jsx)(Y,{variant:`destructive`,size:`sm`,className:`mt-1 h-7 w-full px-3 text-[10px]`,onClick:L,children:`Return to Focus`})]}),(0,G.jsx)($Z,{node:u,edges:A,nodes:k,onClose:()=>{d(null)},onNodeSelect:P,onFocusNode:F,onNavigateToSpore:e,isConnectionsLoading:O})]})]})}function MQ(){let e=An(),t=DQ(),[n,r]=(0,W.useState)(t.tab),[i,a]=(0,W.useState)(t.sporeId?{id:t.sporeId}:null),o=(0,W.useRef)(!1),s=(0,W.useRef)(!1);(0,W.useEffect)(()=>{if(!o.current){o.current=!0;return}if(s.current){s.current=!1;return}OQ(n,i?.id)},[n,i?.id]),(0,W.useEffect)(()=>{s.current=!0;let e=DQ();r(e.tab),a(e.sporeId?{id:e.sporeId}:null)},[e.search,e.key]);function c(e){a(e)}function l(){a(null)}function u(e){a({id:e})}function d(e){r(e),e!==`spores`&&a(null)}return(0,G.jsxs)(`div`,{className:`p-6 space-y-6`,children:[(0,G.jsx)(cN,{title:`Mycelium`,subtitle:`Derived intelligence — spores, entity graph, and synthesized context.`}),(0,G.jsx)(qN,{tabs:CQ.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:n,onTabChange:e=>d(e),columns:2}),n===`graph`&&(0,G.jsx)(jQ,{onNavigateToSpore:e=>{r(`spores`),a({id:e})}}),n===`spores`&&(i?(0,G.jsx)(gQ,{id:i.id,onBack:l,onNavigateToSpore:u}):(0,G.jsx)(uQ,{onSelectSpore:c}))]})}function NQ({selectedCount:e,onClear:t,onCompare:n,minSelected:r=2,primaryLabel:i=`Compare`,nounSingular:a=`run`,nounPlural:o=`runs`,className:s}){if(e===0)return null;let c=e===1?a:o;return(0,G.jsxs)(`div`,{role:`region`,"aria-label":`Selection actions`,className:J(`fixed bottom-6 left-1/2 -translate-x-1/2 z-40 flex items-center gap-3 rounded-full bg-surface-container-high px-4 py-2 shadow-lg border border-outline-variant/30`,s),children:[(0,G.jsxs)(`span`,{className:`font-sans text-sm text-on-surface`,children:[e,` selected`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`default`,className:`gap-2`,disabled:e<r,onClick:n,children:[(0,G.jsx)(Ko,{className:`h-3.5 w-3.5`}),i,` `,e,` `,c]}),(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`gap-2 text-on-surface-variant`,onClick:t,children:[(0,G.jsx)(Is,{className:`h-3.5 w-3.5`}),`Clear selection`]})]})}var PQ=/[\s/_.:-]+/,FQ=/[\s/_.:-]+/g,IQ=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function LQ(e){return e.trim().toLowerCase()}function RQ(e){return LQ(e).split(PQ).filter(Boolean)}function zQ(e){return e.length>1&&e.every(e=>e.length>=2)}function BQ(e,t){let n=LQ(t);if(n===``)return 0;let r=LQ(e.label),i=LQ(e.value),a=LQ(`${e.label} ${e.value} ${e.searchText??``}`),o=RQ(n),s=RQ(a),c=n.replace(FQ,``),l=a.replace(FQ,``);return r===n||i===n?0:r.startsWith(n)||i.startsWith(n)?1:r.includes(n)||i.includes(n)||a.includes(n)?2:s.some(e=>e.startsWith(n))?3:zQ(o)&&o.every(e=>a.includes(e))?4:c!==``&&l.includes(c)?5:null}function VQ({options:e,value:t,onValueChange:n,placeholder:r=`Select an option`,searchPlaceholder:i=`Search...`,emptyMessage:a=`No matching options.`,disabled:o=!1,sortOptions:s=!1,className:c,triggerClassName:l,contentClassName:u,monospace:d=!1,renderOption:f,renderValue:p}){let[m,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(``),v=(0,W.useDeferredValue)(g),y=(0,W.useRef)(null),b=(0,W.useRef)(null),x=(0,W.useRef)(null),S=(0,W.useId)(),C=(0,W.useMemo)(()=>{let t=[...e];return s&&t.sort((e,t)=>IQ.compare(e.label,t.label)||IQ.compare(e.value,t.value)),t},[e,s]),w=(0,W.useMemo)(()=>{let e=C.map(e=>({option:e,rank:BQ(e,v)})).filter(e=>e.rank!==null);return e.sort((e,t)=>e.rank-t.rank||IQ.compare(e.option.label,t.option.label)||IQ.compare(e.option.value,t.option.value)),e.map(e=>e.option)},[v,C]),T=C.find(e=>e.value===t)??(t?{value:t,label:t}:void 0);return(0,W.useEffect)(()=>{if(!m){_(``);return}let e=window.requestAnimationFrame(()=>{x.current?.focus(),x.current?.select()});return()=>window.cancelAnimationFrame(e)},[m]),(0,W.useEffect)(()=>{if(!m)return;let e=e=>{y.current?.contains(e.target)||h(!1)},t=e=>{e.key===`Escape`&&(h(!1),b.current?.focus())};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[m]),(0,G.jsxs)(`div`,{ref:y,className:J(`relative`,c),children:[(0,G.jsxs)(`button`,{ref:b,type:`button`,disabled:o,"aria-expanded":m,"aria-controls":S,className:J(`flex h-9 w-full items-center justify-between rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-left text-sm shadow-xs transition-colors focus-visible:outline-hidden focus-visible:border-primary/40 disabled:cursor-not-allowed disabled:opacity-50`,l),onClick:()=>h(e=>!e),children:[(0,G.jsx)(`span`,{className:J(`truncate text-on-surface`,!T&&`text-on-surface-variant/60`),children:T?p?.(T)??(0,G.jsx)(`span`,{className:J(d&&`font-mono`),children:T.label}):r}),(0,G.jsx)(ho,{className:`h-4 w-4 shrink-0 opacity-50`})]}),m?(0,G.jsxs)(`div`,{className:J(`absolute left-0 right-0 z-50 mt-1 rounded-md border border-[var(--ghost-border)] bg-surface-container-highest shadow-ambient`,u),children:[(0,G.jsx)(`div`,{className:`border-b border-[var(--ghost-border)] p-2`,children:(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(_s,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-on-surface-variant/70`}),(0,G.jsx)(cp,{ref:x,value:g,onChange:e=>_(e.target.value),placeholder:i,className:`pl-9`})]})}),(0,G.jsx)(`div`,{id:S,role:`listbox`,className:`max-h-72 overflow-y-auto p-1`,children:w.length>0?w.map(e=>{let r=e.value===t;return(0,G.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":r,className:J(`flex w-full items-center justify-between rounded-xs px-2 py-1.5 text-left text-sm text-on-surface outline-hidden transition-colors hover:bg-surface-bright focus-visible:bg-surface-bright`,r&&`bg-surface-bright`),onClick:()=>{n(e.value),h(!1),b.current?.focus()},children:[(0,G.jsx)(`span`,{className:J(`truncate`,d&&`font-mono`),children:f?.(e)??e.label}),r?(0,G.jsx)(mo,{className:`ml-2 h-4 w-4 shrink-0`}):null]},e.value)}):(0,G.jsx)(`div`,{className:`px-2 py-3 text-sm text-on-surface-variant`,children:a})})]}):null]})}var HQ=`claude-sdk`,UQ=`openai-agents`,WQ=[`anthropic`,`ollama`,`lmstudio`,`openai`,`openrouter`,`openai-compatible`],GQ=32768,KQ=2e5,qQ={anthropic:{harness:HQ,supportedHarnesses:[HQ],defaultContextWindowTokens:KQ},ollama:{harness:HQ,supportedHarnesses:[HQ,UQ],defaultContextWindowTokens:GQ},lmstudio:{harness:HQ,supportedHarnesses:[HQ,UQ],defaultContextWindowTokens:GQ},openai:{harness:UQ,supportedHarnesses:[UQ],defaultContextWindowTokens:KQ},openrouter:{harness:UQ,supportedHarnesses:[UQ],defaultContextWindowTokens:KQ},"openai-compatible":{harness:UQ,supportedHarnesses:[UQ],defaultContextWindowTokens:128e3}};function JQ(e){if(e)return qQ[e]}function YQ(e){return JQ(e)?.harness}function XQ(e){return JQ(e)?.supportedHarnesses??[]}function ZQ(e,t){return!e||!t?!1:XQ(e).includes(t)}var QQ=3e4,$Q=Array.from(new Set(Object.values(qQ).flatMap(e=>e.supportedHarnesses)));function e$(e){return $Q.includes(e)?e:``}function t$(e){return WQ.includes(e)?e:``}var n$={ollama:`http://localhost:11434`,lmstudio:`http://localhost:1234`};function r$(e,t,n){return e===`openai-compatible`&&t?n$[t]:n??``}function i$(e){return e?YQ(e)??``:``}function a$(e){return e?YQ(e):void 0}function o$(e,t){return ZQ(e||void 0,t||void 0)}function s$(e,t,n){let r=e??`default`;return t?.reasoning_map?.[r]??t?.model??n??``}function c$(e,t,n){let r=t.find(t=>t.type===e),i=new Set(r?.models??[]),a=r?.models?.[0]??``,o=(...e)=>r?.models?.find(t=>e.some(e=>t.includes(e)))??``;return{harness:n&&o$(e,n)?n:r?.harness??i$(e),type:e,localBackend:``,model:a,reasoningLow:i.size>0?e===`anthropic`?o(`haiku`):e===`openai`?o(`nano`):a:``,reasoningDefault:i.size>0?(e===`anthropic`?o(`sonnet`):e===`openai`?o(`mini`):a)||a:``,reasoningHigh:i.size>0?e===`anthropic`?o(`opus`):e===`openai`?(e=>r?.models?.find(t=>t===e)??``)(`gpt-5.4`):``:``,baseUrl:r?.baseUrl??``,contextLength:``}}function l$(e){if(e.type===``)return;let t=e.type===`ollama`||e.type===`lmstudio`||e.type===`openai-compatible`,n={...e.reasoningLow?{low:e.reasoningLow}:{},...e.reasoningDefault?{default:e.reasoningDefault}:{},...e.reasoningHigh?{high:e.reasoningHigh}:{}};return{type:e.type,...e.type===`openai-compatible`&&e.localBackend?{local_backend:e.localBackend}:{},...e.model?{model:e.model}:{},...Object.keys(n).length>0?{reasoning_map:n}:{},...t&&e.baseUrl?{base_url:e.baseUrl}:{},...t&&e.contextLength?{context_length:Number(e.contextLength)}:{}}}function u$(e){return ot({queryKey:Ta([`task-config`,e]),queryFn:({signal:t})=>$i(`/agent/tasks/${e}/config`,{signal:t}),enabled:e!==void 0,staleTime:QQ})}function d$(){return ot({queryKey:Ta([`providers`]),queryFn:({signal:e})=>$i(`/providers`,{signal:e}),staleTime:QQ})}function f$(){return st({mutationFn:e=>sa(`/providers/test`,e)})}function p$(){let e=We();return st({mutationFn:({taskId:e,config:t})=>ca(`/agent/tasks/${e}/config`,t),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`task-config`,n.taskId]})}})}var m$=new Set([`openai-compatible`]);function h$(e,t,n,r){let i=e?m$.has(e):!1,a=!!e&&(!i||!!t);return ot({queryKey:Ta([`models`,e,t,n,r]),queryFn:({signal:i})=>{let a=new URLSearchParams({provider:e});return t&&a.set(`base_url`,t),n&&a.set(`type`,n),r&&a.set(`local_backend`,r),$i(`/models?${a.toString()}`,{signal:i})},enabled:a,staleTime:Ws})}var g$={"claude-sdk":`Claude Agents`,"openai-agents":`OpenAI Agents`},_$={anthropic:`Anthropic`,ollama:`Ollama`,lmstudio:`LM Studio`,openai:`OpenAI`,openrouter:`OpenRouter`,"openai-compatible":`OpenAI-compatible`},v$={anthropic:Do,ollama:vs,lmstudio:Ao,openai:Do,openrouter:Do,"openai-compatible":vs},y$=new Set([`ollama`,`lmstudio`,`openai-compatible`]),b$=[{value:`lmstudio`,label:`LM Studio`},{value:`ollama`,label:`Ollama`}];function x$({harness:e,providerType:t,localBackend:n=``,model:r,baseUrl:i,contextLength:a,modelPlaceholder:o,providers:s,isLoadingProviders:c,showHarnessSelector:l=!0,onHarnessChange:u,onProviderChange:d,onLocalBackendChange:f,onModelChange:p,onBaseUrlChange:m,onContextLengthChange:h,onBaseUrlBlur:g,onContextLengthBlur:_}){let v=s.filter(t=>o$(t.type,e)),y=s.find(e=>e.type===t),b=t===`ollama`||t===`lmstudio`||t===`openai-compatible`,x=t!==``,S=i||r$(t,n,y?.baseUrl),C=h$(t||null,S,`llm`,n||null),w=C.data?.models??y?.models??[],T=y$.has(t),E=w.length>0,D=C.isPending&&x,O=y?.authConfigured===!1?`Configure an API key to load models.`:y?.available===!1?`Provider unavailable.`:`No models returned.`,k=o??`Select a model`;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[l&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Runtime`}),(0,G.jsxs)(w_,{value:e,onValueChange:u,children:[(0,G.jsx)(E_,{children:(0,G.jsx)(T_,{placeholder:`Select a runtime`})}),(0,G.jsx)(D_,{children:Object.entries(g$).map(([e,t])=>(0,G.jsx)(O_,{value:e,children:t},e))})]})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:v.map(e=>{let n=v$[e.type];return n?(0,G.jsxs)(`button`,{onClick:()=>d(e.type),className:`
|
|
405
|
-
flex flex-col items-center gap-1.5 rounded-md border px-3 py-2.5 transition-colors
|
|
406
|
-
${t===e.type?`border-primary/40 bg-primary/5 text-on-surface`:`border-[var(--ghost-border)] bg-surface-container-lowest text-on-surface-variant hover:border-primary/20`}
|
|
407
|
-
`,children:[(0,G.jsx)(n,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-xs font-medium`,children:_$[e.type]??e.type}),!c&&(0,G.jsx)(X,{variant:e.authConfigured===!1||!e.available?`destructive`:`secondary`,className:`text-[10px] px-1.5 py-0`,children:e.authConfigured===!1?`key required`:e.available?`online`:`offline`})]},e.type):null})}),b&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Base URL`}),(0,G.jsx)(cp,{value:i,onChange:e=>m(e.target.value),onBlur:g,placeholder:S})]}),t===`openai-compatible`&&f&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Local Backend`}),(0,G.jsxs)(w_,{value:n||`lmstudio`,onValueChange:e=>f(e),children:[(0,G.jsx)(E_,{children:(0,G.jsx)(T_,{placeholder:`Select a backend`})}),(0,G.jsx)(D_,{children:b$.map(e=>(0,G.jsx)(O_,{value:e.value,children:e.label},e.value))})]}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant/70`,children:`OpenAI-compatible chat endpoints look the same, but local backends still need different model-loading and context handling.`})]}),b&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Context Length`}),(0,G.jsx)(cp,{type:`number`,value:a,onChange:e=>h(e.target.value),onBlur:_,placeholder:`32768 (default)`}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant/70`,children:`Leave blank to use the 32K default. Myco creates a Modelfile variant at this size so the model loads at the size you asked for, not its (much larger) native default.`})]}),x&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Model`}),D?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2 text-sm text-on-surface-variant`,children:[(0,G.jsx)(es,{className:`h-4 w-4 animate-spin`}),`Loading models...`]}):E?(0,G.jsx)(VQ,{value:r,onValueChange:p,placeholder:k,searchPlaceholder:`Search models...`,emptyMessage:`No models match that search.`,options:w.map(e=>({value:e,label:e})),sortOptions:!0,monospace:!0}):T?(0,G.jsx)(cp,{value:r,onChange:e=>p(e.target.value),placeholder:y?.available===!1?`Provider offline`:`Enter model name`,disabled:y?.available===!1}):(0,G.jsx)(`div`,{className:`rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 py-2`,children:(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:O})})]})]})}function S$({phase:e,override:t,taskHarness:n,taskProviderType:r,taskModel:i,taskReasoningMap:a,providers:o,isLoadingProviders:s,onChange:c}){let[l,u]=(0,W.useState)(!1),d=t.provider!==void 0||t.model!==void 0||t.maxTurns!==void 0,f=e.model??s$(e.reasoningLevel,{model:i||void 0,reasoning_map:a},i);return(0,G.jsxs)(`div`,{className:`border border-[var(--ghost-border)] rounded-md`,children:[(0,G.jsxs)(`button`,{onClick:()=>u(!l),className:`flex items-center gap-2 w-full px-3 py-2 text-left hover:bg-surface-container-low/50 transition-colors rounded-md`,children:[l?(0,G.jsx)(ho,{className:`h-3.5 w-3.5 text-on-surface-variant`}):(0,G.jsx)(_o,{className:`h-3.5 w-3.5 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface`,children:e.name}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[`max `,t.maxTurns??e.maxTurns,` turns`]}),d&&(0,G.jsx)(X,{variant:`secondary`,className:`text-[10px] ml-auto`,children:`override`})]}),l&&(0,G.jsxs)(`div`,{className:`px-3 pb-3 space-y-3 border-t border-[var(--ghost-border)]`,children:[(0,G.jsx)(`div`,{className:`pt-3`,children:(0,G.jsx)(x$,{harness:n,providerType:t.provider?.type??r,localBackend:t.provider?.local_backend??``,model:t.provider?.model??t.model??``,baseUrl:t.provider?.base_url??``,contextLength:t.provider?.context_length==null?``:String(t.provider.context_length),modelPlaceholder:f,providers:o,isLoadingProviders:s,showHarnessSelector:!1,onHarnessChange:()=>{},onProviderChange:e=>{let n=o.find(t=>t.type===e)?.baseUrl;c({...t,provider:{type:e,base_url:n},model:void 0})},onLocalBackendChange:e=>c({...t,provider:{...t.provider??{type:r},local_backend:e||void 0}}),onModelChange:e=>c({...t,provider:{...t.provider??{type:r},model:e},model:void 0}),onBaseUrlChange:e=>c({...t,provider:{...t.provider??{type:r},base_url:e}}),onContextLengthChange:e=>c({...t,provider:{...t.provider??{type:r},context_length:e?Number(e):void 0}})})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Max Turns`}),(0,G.jsx)(cp,{type:`number`,value:t.maxTurns??``,onChange:e=>c({...t,maxTurns:e.target.value?Number(e.target.value):void 0}),placeholder:String(e.maxTurns)})]}),d&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>c(null),className:`text-xs text-on-surface-variant`,children:`Clear Phase Override`})]})]})}var C$=/\b(session_id|batch_id|target_session)\s*[:=]\s*(?:"([^"]+)"|'([^']+)'|([A-Za-z0-9_-]+))/gi;function w$(e){let t={};if(!e)return t;let n=new RegExp(C$.source,`gi`),r;for(;(r=n.exec(e))!==null;){let e=r[1].toLowerCase(),n=r[2]??r[3]??r[4];n&&t[e]===void 0&&(t[e]=n)}return t}var T$=new Set([`instruction`]);function E$(e,t={}){if(!e)return[];let{includeAutoResolved:n=!1}=t,r=new Set,i=[];for(let t of e.matchAll(/\{\{(\w+)\}\}/g)){let e=t[1];!n&&T$.has(e)||r.has(e)||(r.add(e),i.push(e))}return i}var D$=[`anthropic`,`ollama`,`lmstudio`,`openai`,`openrouter`,`openai-compatible`];function O$(e){return D$.includes(e)?e:`openai-compatible`}function k$(e){if(!e)return;let t={type:e.type};return e.local_backend&&(t.localBackend=e.local_backend),e.base_url&&(t.baseUrl=e.base_url),e.model&&(t.model=e.model),e.reasoning_map&&(t.reasoningMap=e.reasoning_map),e.context_length&&(t.contextLength=e.context_length),t}function A$(e){if(!e)return;let t={type:O$(e.type)};return e.localBackend&&(t.local_backend=e.localBackend),e.baseUrl&&(t.base_url=e.baseUrl),e.model&&(t.model=e.model),e.reasoningMap&&(t.reasoning_map=e.reasoningMap),typeof e.contextLength==`number`&&(t.context_length=e.contextLength),t}function j$(e){if(!e)return;let t={type:O$(e.type)};return e.model&&(t.model=e.model),e.reasoning_map&&(t.reasoning_map=e.reasoning_map),t}var M$=[`low`,`default`,`high`];function N$(e){if(e)return M$.includes(e)?e:void 0}var P$=[`claude-sdk`,`openai-agents`];function F$(e){if(e)return P$.includes(e)?e:void 0}function I$(e,t){let n=e.task??``,r=t.find(e=>e.name===n),i=n!==``&&r===void 0,a=e.instruction??``,o=w$(a),s={};if(r){let e=new Set(E$(r.prompt,{includeAutoResolved:!0}));for(let[t,n]of Object.entries(o))e.has(t)&&(s[t]=n)}else for(let[e,t]of Object.entries(o))s[e]=t;let c=e.execution_overrides??null,l=F$(c?.harness),u=N$(c?.reasoningLevel),d=c?.model||void 0,f=A$(c?.provider),p={};if(c?.phases)for(let[e,t]of Object.entries(c.phases)){let n=A$(t.provider),r=t.model&&t.model.length>0?t.model:void 0,i=typeof t.maxTurns==`number`?t.maxTurns:void 0;if(n!==void 0||r!==void 0||i!==void 0){let t={};n&&(t.provider=n),r&&(t.model=r),i!==void 0&&(t.maxTurns=i),p[e]=t}}let m=l!==void 0||u!==void 0||d!==void 0||f!==void 0||Object.keys(p).length>0;return{taskName:n,taskMissing:i,instruction:a,dryRun:e.dry_run===!0,varValues:s,harness:l,reasoningLevel:u,model:d,provider:f,phaseOverrides:p,hasAnyOverride:m}}function L$(){return{harness:``,type:``,localBackend:``,model:``,reasoningLow:``,reasoningDefault:``,reasoningHigh:``,baseUrl:``,contextLength:``}}function R$(e,t){return(e?.harness?e$(e.harness):``)||(e?.provider?.type?a$(t$(e.provider.type)||void 0):void 0)||(t?.harness?e$(t.harness):``)||((t?.providerType?a$(t$(t.providerType)||void 0):void 0)??``)}function z$(e,t){let n=e?.provider?.type?t$(e.provider.type):``;return n===``?{harness:R$(e,t),type:t?.providerType?t$(t.providerType):``,localBackend:t?.localBackend??``,model:e?.model??t?.model??``,reasoningLow:t?.reasoningMap?.low??``,reasoningDefault:t?.reasoningMap?.default??e?.model??t?.model??``,reasoningHigh:t?.reasoningMap?.high??``,baseUrl:t?.baseUrl??``,contextLength:t?.contextLength==null?``:String(t.contextLength)}:{harness:R$(e,t),type:n,localBackend:e?.provider?.local_backend??t?.localBackend??``,model:e?.provider?.model??e?.model??``,reasoningLow:e?.provider?.reasoning_map?.low??``,reasoningDefault:e?.provider?.reasoning_map?.default??e?.provider?.model??e?.model??``,reasoningHigh:e?.provider?.reasoning_map?.high??``,baseUrl:e?.provider?.base_url??``,contextLength:e?.provider?.context_length?.toString()??``}}function B$(e,t){return e.harness===t.harness&&e.type===t.type&&e.localBackend===t.localBackend&&e.model===t.model&&e.reasoningLow===t.reasoningLow&&e.reasoningDefault===t.reasoningDefault&&e.reasoningHigh===t.reasoningHigh&&e.baseUrl===t.baseUrl&&e.contextLength===t.contextLength}function V$(e,t){return e===``||t.length===0||t.includes(e)?e:``}function H$(e,t){return l$({...e,reasoningLow:V$(e.reasoningLow,t),reasoningDefault:V$(e.reasoningDefault,t),reasoningHigh:V$(e.reasoningHigh,t)})}function U$(e){return e===``||e===r$(`openai-compatible`,`ollama`)||e===r$(`openai-compatible`,`lmstudio`)}function W$(e,t){let n=e$(e),r=t.find(e=>o$(e.type,n));return r?c$(r.type,t,n||void 0):{...L$(),harness:n}}function G$({source:e,defaults:t,providers:n}){let r=(0,W.useMemo)(()=>z$(e,t),[e?.harness,e?.model,e?.provider?.type,e?.provider?.local_backend,e?.provider?.model,e?.provider?.reasoning_map?.low,e?.provider?.reasoning_map?.default,e?.provider?.reasoning_map?.high,e?.provider?.base_url,e?.provider?.context_length,t?.harness,t?.providerType,t?.localBackend,t?.model,t?.reasoningMap?.low,t?.reasoningMap?.default,t?.reasoningMap?.high,t?.baseUrl,t?.contextLength]),[i,a]=(0,W.useState)(r),[o,s]=(0,W.useState)(r),c=(0,W.useRef)(i);c.current=i,(0,W.useEffect)(()=>{a(r),s(e=>B$(e,c.current)?r:e)},[r]);let l=!B$(o,i),u=(0,W.useCallback)(e=>{let t=e$(e);s(r=>o$(r.type,t)?{...r,harness:t}:W$(e,n))},[n]),d=(0,W.useCallback)(e=>{let t=t$(e);s(r=>c$(e,n,o$(t,r.harness)?r.harness:void 0))},[n]),f=(0,W.useCallback)(e=>{s(t=>({...t,model:e,reasoningDefault:t.reasoningDefault||e}))},[]),p=(0,W.useCallback)(e=>{s(t=>({...t,localBackend:e,...t.type===`openai-compatible`&&e&&U$(t.baseUrl)?{baseUrl:r$(t.type,e)}:{},...t.type===`openai-compatible`?{model:``,reasoningLow:``,reasoningDefault:``,reasoningHigh:``}:{}}))},[]),m=(0,W.useCallback)((e,t)=>{s(n=>({...n,...e===`low`?{reasoningLow:t}:{},...e===`default`?{reasoningDefault:t}:{},...e===`high`?{reasoningHigh:t}:{}}))},[]),h=(0,W.useCallback)(e=>{s(t=>({...t,baseUrl:e}))},[]),g=(0,W.useCallback)(e=>{s(t=>({...t,contextLength:e}))},[]),_=(0,W.useCallback)(()=>{s(i)},[i]);return{draft:o,savedDraft:i,isDirty:l,setDraft:s,commitDraft:(0,W.useCallback)(e=>{let t=e??o;a(t),s(t)},[o]),resetDraft:_,clearDraft:(0,W.useCallback)(()=>{s(L$())},[]),handleHarnessChange:u,handleProviderChange:d,handleModelChange:f,handleLocalBackendChange:p,handleReasoningChange:m,handleBaseUrlChange:h,handleContextLengthChange:g}}function K$(e){let{data:t}=Jk(),n=t?.tasks??[],r=e?n.find(t=>t.name===e):void 0,{effective:i}=Na(),a=i?.agent?.provider,o=a?.type&&t$(a.type)||void 0,s=i?.agent?.harness,{data:c}=u$(e),l=c?.config,u=r?.execution,d=u?.provider?.type&&t$(u.provider.type)||void 0,f=l?.harness??u?.harness??s??a$(l?.provider?.type)??a$(o)??a$(d)??`claude-sdk`,p=u?.reasoningLevel??r?.reasoningLevel,m=l?.provider??j$(u?.provider)??a,h=m?.type??`anthropic`,g=l?.provider?.model??l?.model??u?.model??r?.model??a?.model;return{taskRow:r,harness:f,provider:m,providerType:h,modelFallback:g,reasoning:p,resolvedModel:s$(p,m,g),draftSource:(0,W.useMemo)(()=>({harness:l?.harness??u?.harness,provider:m,model:g}),[l?.harness,u?.harness,m,g]),draftDefaults:{harness:f,providerType:h,localBackend:m?.local_backend,model:g,reasoningMap:m?.reasoning_map,baseUrl:m?.base_url,contextLength:m?.context_length}}}function q$(e){if(e===void 0)return;let t=e.trim();return t.length>0?t:void 0}function J$(e,t){return e===t?!0:!e||!t?!1:Y$(e)===Y$(t)}function Y$(e){if(typeof e!=`object`||!e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(Y$).join(`,`)}]`;let t=e;return`{${Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${Y$(t[e])}`).join(`,`)}}`}function X$(e,t){let n={};e.harness&&e.harness!==t.harness&&(n.harness=e.harness),e.reasoningLevel&&e.reasoningLevel!==t.reasoningLevel&&(n.reasoningLevel=e.reasoningLevel);let r=q$(e.model);r&&r!==t.model&&(n.model=r),e.provider&&!J$(e.provider,t.provider)&&(n.provider=k$(e.provider));let i=new Map;for(let e of t.phases??[])i.set(e.name,{reasoningLevel:e.reasoningLevel,model:e.model,provider:e.provider,maxTurns:e.maxTurns});let a={};for(let[t,n]of Object.entries(e.phases)){let e=i.get(t)??{},r={};n.reasoningLevel&&n.reasoningLevel!==e.reasoningLevel&&(r.reasoningLevel=n.reasoningLevel);let o=q$(n.model);o&&o!==e.model&&(r.model=o),n.provider&&!J$(n.provider,e.provider)&&(r.provider=k$(n.provider)),n.maxTurns!==void 0&&n.maxTurns!==e.maxTurns&&(r.maxTurns=n.maxTurns),(r.reasoningLevel!==void 0||r.model!==void 0||r.provider!==void 0||r.maxTurns!==void 0)&&(a[t]=r)}if(Object.keys(a).length>0&&(n.phases=a),!(n.harness===void 0&&n.reasoningLevel===void 0&&n.model===void 0&&n.provider===void 0&&n.phases===void 0))return n}function Z$(e,t){let n=X$(e,t);if(!n)return 0;let r=0;if(n.harness!==void 0&&r++,n.reasoningLevel!==void 0&&r++,n.model!==void 0&&r++,n.provider!==void 0&&r++,n.phases)for(let e of Object.values(n.phases))e.reasoningLevel!==void 0&&r++,e.model!==void 0&&r++,e.provider!==void 0&&r++,e.maxTurns!==void 0&&r++;return r}var Q$={session_id:`Session ID`},$$={session_id:`e.g. 36858a44-4ef7-4448-96e8-382e992e8ba4`},e1=[`low`,`default`,`high`],t1=`__task_default__`,n1=`skill-survey`;function r1(e){return Q$[e]??e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function i1(e){return e.displayName??e.name}function a1({open:e,onOpenChange:t,preselectedTask:n,onTriggered:r,sourceRun:i}){let[a,o]=(0,W.useState)(void 0),[s,c]=(0,W.useState)({}),[l,u]=(0,W.useState)(``),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(null),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(void 0),[y,b]=(0,W.useState)({}),{data:x,isLoading:S}=Jk(),{mutate:C,isPending:w,error:T}=eA(),{data:E,isPending:D}=d$(),O=E?.providers??[],k=x?.tasks??[],A=k.find(e=>e.isDefault),j=n?.name??a??A?.name??k[0]?.name??``,{taskRow:M,harness:N,provider:P,providerType:F,modelFallback:I,reasoning:L,resolvedModel:R,draftSource:ee,draftDefaults:z}=K$(j||void 0),B=n??M,{draft:V,isDirty:H,handleHarnessChange:te,handleProviderChange:ne,handleModelChange:U,handleLocalBackendChange:re,handleBaseUrlChange:ie,handleContextLengthChange:ae,setDraft:oe}=G$({source:ee,defaults:z,providers:O}),se=V.baseUrl||O.find(e=>e.type===V.type)?.baseUrl||``,ce=h$(V.type||null,se||void 0,`llm`,V.localBackend||null).data?.models??O.find(e=>e.type===V.type)?.models??[],le=(0,W.useRef)(null);(0,W.useEffect)(()=>{e||(o(void 0),c({}),u(``),f(!1),m(null),g(!1),v(void 0),b({}),le.current=null)},[e]),(0,W.useEffect)(()=>{if(!e||!i||k.length===0&&S||le.current===i.id)return;let t=I$(i,k);o(t.taskName||void 0),c(t.varValues),u(t.instruction),f(t.dryRun),v(t.reasoningLevel),b(t.phaseOverrides),t.provider?oe({harness:e$(t.harness??z.harness??`claude-sdk`)||`claude-sdk`,type:t$(t.provider.type),localBackend:t.provider.local_backend??``,model:t.provider.model??``,reasoningLow:t.provider.reasoning_map?.low??``,reasoningDefault:t.provider.reasoning_map?.default??``,reasoningHigh:t.provider.reasoning_map?.high??``,baseUrl:t.provider.base_url??``,contextLength:t.provider.context_length==null?``:String(t.provider.context_length)}):t.harness&&oe(e=>({...e,harness:t.harness})),t.hasAnyOverride&&g(!0),le.current=i.id},[e,i,k.length,S]);let ue=(0,W.useRef)(j);(0,W.useEffect)(()=>{ue.current!==j&&(ue.current=j,!(i&&le.current===i.id)&&(v(void 0),b({})))},[j,i]);let de=(0,W.useMemo)(()=>E$(B?.prompt),[B?.prompt]),fe=(0,W.useMemo)(()=>{if(H)return H$(V,ce)},[V,ce,H]),pe=(0,W.useMemo)(()=>{if(H&&V.harness)return V.harness===N?void 0:V.harness},[V.harness,N,H]),me=(0,W.useMemo)(()=>{let e=B?.phases??[];return{harness:N,reasoningLevel:L,model:R||void 0,provider:P,phases:e.map(e=>({name:e.name,reasoningLevel:e.reasoningLevel,model:e.model,maxTurns:e.maxTurns}))}},[B?.phases,N,L,R,P]),he=(0,W.useMemo)(()=>({harness:pe,reasoningLevel:_,model:void 0,provider:fe,phases:y}),[pe,_,fe,y]),ge=Z$(he,me),_e=pe??N,ve=_??L,ye=fe??P,be=ye?.type??F,xe=s$(ve,ye,fe?.model??I),Se=i!==void 0&&i.task!==null&&!k.some(e=>e.name===i.task),Ce=B?i1(B):i?.task??``,we=i?Se?`Rerun ${Ce} (task definition not found)`:`Rerun ${Ce}`:n?`Run ${i1(n)}`:`Trigger Agent Run`,Te=i?`Starts a new run with the same settings as the source. The source run is untouched.`:n?void 0:`Run the Myco agent now. It will process unprocessed sessions and update the vault.`;function Ee(e,t){c(n=>({...n,[e]:t}))}function De(e,t){b(n=>{let r={...n};return t===null?delete r[e]:r[e]=t,r})}function Oe(){m(null);let e=[];for(let t of de){let n=s[t]?.trim();n&&e.push(`${t}: ${n}`)}let n=l.trim();n&&e.push(n);let i=e.length>0?e.join(`
|
|
408
|
-
`):void 0,a=X$(he,me);C({task:j||void 0,instruction:i,...d?{dryRun:!0}:{},...j===n1?{force:!0}:{},...a?{executionOverrides:a}:{}},{onSuccess:e=>{if(e?.status===`skipped`||!e?.runId){m(e?.message??`Task skipped — no work to do.`);return}t(!1),r?.(e.runId)}})}let ke=B?.phases??[];return(0,G.jsx)($f,{open:e,onOpenChange:t,children:(0,G.jsxs)(rp,{className:`sm:max-w-4xl max-h-[90vh] overflow-y-auto`,children:[(0,G.jsxs)(ip,{children:[(0,G.jsx)(op,{children:we}),Te&&(0,G.jsx)(sp,{children:Te})]}),(0,G.jsxs)(`div`,{className:`space-y-4 py-2`,children:[!n&&(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Task`}),S?(0,G.jsxs)(`div`,{className:`flex h-9 items-center gap-2 text-on-surface-variant font-sans text-sm`,children:[(0,G.jsx)(es,{className:`h-4 w-4 animate-spin`}),`Loading tasks...`]}):(0,G.jsxs)(w_,{value:j,onValueChange:o,children:[(0,G.jsx)(E_,{children:(0,G.jsx)(T_,{})}),(0,G.jsx)(D_,{children:k.map(e=>(0,G.jsxs)(O_,{value:e.name,children:[i1(e),e.isDefault&&(0,G.jsx)(`span`,{className:`ml-1 font-sans text-xs text-on-surface-variant`,children:`(default)`})]},e.name))})]})]}),i&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-surface-container-lowest px-3 py-2 text-on-surface-variant`,children:[(0,G.jsx)(ms,{className:`h-3.5 w-3.5 mt-0.5 shrink-0`,"aria-hidden":`true`}),(0,G.jsxs)(`p`,{className:`font-sans text-xs`,children:[`Pre-filled from run`,` `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:i.id.slice(0,8)}),`… — this will start a new run.`]})]}),B&&(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-low p-3`,children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Effective execution`}),(0,G.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-4 font-mono text-xs text-on-surface`,children:[(0,G.jsxs)(`span`,{children:[`harness: `,_e]}),(0,G.jsxs)(`span`,{children:[`provider: `,be]}),ve&&(0,G.jsxs)(`span`,{children:[`reasoning: `,ve]}),xe&&(0,G.jsxs)(`span`,{children:[`model: `,xe]})]})]}),de.map((e,t)=>(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:r1(e)}),(0,G.jsx)(cp,{value:s[e]??``,onChange:t=>Ee(e,t.target.value),placeholder:$$[e]??`Enter ${r1(e).toLowerCase()}`,className:`font-mono`,autoFocus:t===0})]},e)),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:[`Instruction`,(0,G.jsx)(`span`,{className:`ml-1 font-sans text-xs text-on-surface-variant font-normal`,children:`(optional)`})]}),(0,G.jsx)(`textarea`,{className:`w-full rounded-md bg-surface-container-lowest px-3 py-2 font-sans text-sm text-on-surface placeholder:text-on-surface-variant/50 focus:outline-hidden focus:ring-2 focus:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50 resize-none`,rows:3,placeholder:`Additional instructions for this run...`,value:l,onChange:e=>u(e.target.value),disabled:w})]}),B&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>g(e=>!e),className:`flex items-center gap-2 font-sans text-sm font-medium text-on-surface hover:text-on-surface focus:outline-hidden focus:ring-2 focus:ring-primary/40 rounded`,children:[(0,G.jsx)(ho,{className:`h-4 w-4 transition-transform ${h?`rotate-180`:``}`}),`Override execution for this run`,ge>0&&(0,G.jsx)(X,{variant:`default`,className:`px-1.5 py-0 text-xs`,children:ge})]}),h&&(0,G.jsxs)(`div`,{className:`rounded-md border border-[var(--ghost-border)] bg-surface-container-low p-3`,children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant mb-4`,children:`Customize provider, model, and reasoning without modifying the task definition.`}),(0,G.jsxs)(`div`,{className:ke.length>0?`grid gap-6 md:grid-cols-2`:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(x$,{harness:V.harness||N,providerType:V.type||``,localBackend:V.localBackend,model:V.model,baseUrl:V.baseUrl,contextLength:V.contextLength,modelPlaceholder:R||void 0,providers:O,isLoadingProviders:D,showHarnessSelector:!0,onHarnessChange:te,onProviderChange:ne,onLocalBackendChange:re,onModelChange:U,onBaseUrlChange:ie,onContextLengthChange:ae}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs font-medium text-on-surface-variant`,children:`Reasoning level`}),(0,G.jsxs)(w_,{value:_??t1,onValueChange:e=>v(e===t1?void 0:e),children:[(0,G.jsx)(E_,{children:(0,G.jsx)(T_,{})}),(0,G.jsxs)(D_,{children:[(0,G.jsxs)(O_,{value:t1,children:[`Use task default (`,L??`default`,`)`]}),e1.map(e=>(0,G.jsx)(O_,{value:e,children:e},e))]})]}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant/70`,children:`Maps to the provider's reasoning profile for this run only.`})]}),ge>0&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>{v(void 0),b({}),oe({harness:e$(z.harness??`claude-sdk`)||`claude-sdk`,type:t$(z.providerType??``),localBackend:z.localBackend??``,model:z.model??``,reasoningLow:z.reasoningMap?.low??``,reasoningDefault:z.reasoningMap?.default??``,reasoningHigh:z.reasoningMap?.high??``,baseUrl:z.baseUrl??``,contextLength:z.contextLength==null?``:String(z.contextLength)})},className:`text-xs text-on-surface-variant`,children:`Reset to task defaults`})]}),ke.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide`,children:`Per-phase overrides`}),ke.map(e=>(0,G.jsx)(S$,{phase:e,override:y[e.name]??{},taskHarness:V.harness||N,taskProviderType:V.type||F,taskModel:V.model||I||``,taskReasoningMap:{...P?.reasoning_map??{},...V.reasoningLow?{low:V.reasoningLow}:{},...V.reasoningDefault?{default:V.reasoningDefault}:{},...V.reasoningHigh?{high:V.reasoningHigh}:{}},providers:O,isLoadingProviders:D,onChange:t=>De(e.name,t)},e.name))]})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`input`,{id:`run-task-dialog-dry-run`,type:`checkbox`,checked:d,onChange:e=>f(e.target.checked),disabled:w,className:`mt-0.5 h-4 w-4 rounded accent-primary`}),(0,G.jsxs)(`label`,{htmlFor:`run-task-dialog-dry-run`,className:`space-y-0.5`,children:[(0,G.jsx)(`span`,{className:`block font-sans text-sm font-medium text-on-surface`,children:`Dry run`}),(0,G.jsx)(`span`,{className:`block font-sans text-xs text-on-surface-variant`,children:`Intercept writes and record them as intents — no vault mutations.`})]})]}),T&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-tertiary`,children:T instanceof Error?T.message:`Failed to trigger run`}),p&&(0,G.jsx)(`p`,{className:`rounded-md bg-surface-container-low px-3 py-2 font-sans text-xs text-on-surface-variant`,children:p})]}),(0,G.jsxs)(ap,{children:[(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>t(!1),disabled:w,children:`Cancel`}),(0,G.jsx)(Y,{size:`sm`,className:`gap-2`,onClick:Oe,disabled:w,children:w?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(es,{className:`h-3.5 w-3.5 animate-spin`}),`Starting...`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(us,{className:`h-3.5 w-3.5`}),`Run`]})})]})]})})}function o1(e,t){return t===`unavailable`||e===null?`—`:`${t===`estimated`?`~`:``}$${e.toFixed(4)}`}function s1(e){return e===null?`—`:e.toLocaleString()}function c1(e){switch(e){case`completed`:return`default`;case`running`:return`warning`;case`failed`:return`destructive`;default:return`secondary`}}function l1(e){return e===`user`?`warning`:`secondary`}var u1=`Default task`;function d1(e,t){return e?t.find(t=>t.name===e)?.displayName??e:u1}var f1=[{value:`all`,label:`All statuses`},{value:`running`,label:`Running`},{value:`completed`,label:`Completed`},{value:`failed`,label:`Failed`},{value:`cancelled`,label:`Cancelled`}];function p1(e){return e===`running`?`sage`:e===`completed`?`outline`:e===`failed`||e===`cancelled`?`terracotta`:`ochre`}function m1({status:e}){let t=c1(e);return(0,G.jsx)(`span`,{className:J(`inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-semibold`,t===`default`?`bg-primary-container/20 text-primary`:t===`destructive`?`bg-tertiary-container/20 text-tertiary`:t===`warning`?`bg-secondary-container/20 text-secondary`:`bg-surface-container-high text-on-surface-variant`),children:YA(e)})}function h1(){return(0,G.jsx)(`div`,{className:`border-b border-outline-variant/20 px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`h-4 w-4 animate-pulse rounded bg-surface-container shrink-0`}),(0,G.jsx)(`div`,{className:`h-4 w-4 animate-pulse rounded bg-surface-container shrink-0`}),(0,G.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,G.jsx)(`div`,{className:`h-4 w-2/3 animate-pulse rounded bg-surface-container`}),(0,G.jsx)(`div`,{className:`h-3 w-1/2 animate-pulse rounded bg-surface-container`})]})]})})}var g1=(0,W.memo)((0,W.forwardRef)(function({run:e,onSelectRun:t,taskNameMap:n,selected:r,onToggleSelected:i,onRerun:a,isActive:o,isCursor:s},c){let l=(0,W.useCallback)(()=>t(e.id),[t,e.id]),u=e.task?n.get(e.task)??e.task:u1,d=[];if(e.started_at!==null&&e.completed_at!==null&&d.push(XA(e.started_at,e.completed_at)),e.tokens_used!==null&&e.tokens_used>0&&d.push(`${e.tokens_used.toLocaleString()} tok`),e.cost_source!==`unavailable`&&e.cost_usd!==null&&e.cost_usd>0){let t=e.cost_source===`estimated`?`~`:``;d.push(`${t}$${e.cost_usd.toFixed(4)}`)}return(0,G.jsxs)(`div`,{ref:c,"data-selected":o||void 0,"data-cursor":s||void 0,className:J(`group relative border-b border-[var(--ghost-border)] last:border-b-0 px-4 py-3 cursor-pointer transition-colors duration-100`,`hover:bg-surface-container`,`focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sage/40`,o&&`bg-sage/[0.08] shadow-[inset_2px_0_0_var(--sage)]`,s&&!o&&`bg-surface-container/60 ring-1 ring-inset ring-sage/30`),onClick:l,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l())},tabIndex:0,role:`row`,"aria-selected":o,"aria-label":`Agent run: ${u}, status ${e.status}`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`pt-1 shrink-0`,onClick:e=>e.stopPropagation(),children:(0,G.jsx)(`input`,{type:`checkbox`,"aria-label":`Select run ${e.id.slice(0,8)}`,checked:r,onChange:()=>i(e.id),onClick:e=>e.stopPropagation(),className:`h-4 w-4 rounded accent-primary cursor-pointer`})}),(0,G.jsx)(BO,{tone:p1(e.status),pulse:e.status===`running`,className:`mt-1.5 shrink-0`}),(0,G.jsx)(`h3`,{className:`font-serif italic text-sm text-on-surface truncate leading-snug`,children:u}),e.dry_run&&(0,G.jsx)(`span`,{className:`inline-flex items-center rounded-xs bg-secondary/15 px-1.5 py-0.5 font-sans text-[10px] uppercase tracking-wide text-secondary shrink-0`,title:`Dry run — writes were intercepted, no vault mutations`,children:`Dry`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[e.started_at!==null&&(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant whitespace-nowrap`,children:WA(e.started_at)}),(0,G.jsx)(IA,{data:e.activity_buckets??[],widthPx:48,heightPx:14}),(0,G.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,G.jsx)(Y,{size:`icon`,variant:`ghost`,className:`h-7 w-7 text-on-surface-variant hover:text-on-surface opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity`,onClick:t=>{t.stopPropagation(),a(e)},title:`Rerun with same settings`,"aria-label":`Rerun ${e.id.slice(0,8)} with same settings`,children:(0,G.jsx)(ms,{className:`h-3.5 w-3.5`})})})]})]}),(0,G.jsxs)(`div`,{className:`mt-1.5 ml-11 flex items-center gap-2`,children:[(0,G.jsx)(m1,{status:e.status}),e.resumable&&e.status===`failed`&&(0,G.jsx)(`span`,{className:`font-sans text-[10px] uppercase tracking-wide text-secondary`,children:`resumable`}),e.cost_source===`estimated`&&(0,G.jsx)(`span`,{className:`font-sans text-[10px] uppercase tracking-wide text-secondary`,children:`est`})]}),d.length>0&&(0,G.jsx)(`div`,{className:`mt-1 ml-11 font-mono text-[11px] text-on-surface-variant truncate`,children:d.join(` · `)}),e.branch&&(0,G.jsxs)(`div`,{className:`mt-0.5 ml-11 inline-flex items-center gap-1 font-mono text-[10px] italic text-on-surface-variant`,children:[(0,G.jsx)(Go,{className:`h-2.5 w-2.5`}),e.branch]})]})}));function _1({selectedId:e,onSelectRun:t,onTriggerRun:n,onCompareRuns:r}){let i=(0,W.useRef)(null),{searchInput:a,debouncedSearch:o,filterValues:s,offset:c,setOffset:l,handleSearchChange:u,handleFilterChange:d,activeFilter:f}=aN({initialFilters:{status:`all`,task:`all`}}),[p,m]=(0,W.useState)(new Set),h=(0,W.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),g=(0,W.useCallback)(()=>m(new Set),[]),[_,v]=(0,W.useState)(null),{data:y}=Jk(),b=(0,W.useMemo)(()=>{let e=new Map;for(let t of y?.tasks??[])e.set(t.name,t.displayName);return e},[y]),x=(0,W.useMemo)(()=>{let e=[{value:`all`,label:`All tasks`}];for(let t of y?.tasks??[])e.push({value:t.name,label:t.displayName});return e},[y]),S=(0,W.useMemo)(()=>[{key:`status`,label:`Status`,options:f1},{key:`task`,label:`Task`,options:x}],[x]),C=f(`status`),w=f(`task`),{data:T,isLoading:E,isError:D,error:O}=Wk({limit:50,offset:c,search:o,status:C,task:w}),k=T?.runs??[],A=T?.total??0,j=(0,W.useRef)(!1);(0,W.useEffect)(()=>{j.current||!e&&!E&&k.length>0&&(j.current=!0,t(k[0].id,{replace:!0}))},[e,E,k,t]);let M=Kj({items:k,getId:e=>e.id,selectedId:e,onActivate:e=>t(e),filterInputRef:i}),N=k.filter(e=>e.status===`running`).length,P=k.reduce((e,t)=>e+(t.tokens_used??0),0),F=(0,G.jsxs)(`div`,{className:`px-4 py-3 border-b border-outline-variant/20`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-2`,children:[(0,G.jsx)(`h2`,{className:`font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:`Runs`}),(0,G.jsx)(`span`,{className:`font-serif italic text-sm text-on-surface`,children:`History`})]}),(0,G.jsxs)(`div`,{className:`font-mono text-[11px] text-on-surface-variant inline-flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:A.toLocaleString()}),` TOTAL`]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:N.toLocaleString()}),` RUNNING`]}),(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`text-on-surface font-semibold`,children:P.toLocaleString()}),` TOKENS`]})]})]}),I=(0,G.jsx)(eQ,{searchPlaceholder:`Search runs...`,searchValue:a,onSearchChange:u,filters:S,filterValues:s,onFilterChange:d,inputRef:i});return D?(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[F,I,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load runs`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:O instanceof Error?O.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{className:`p-4 space-y-4`,children:[F,I,E?(0,G.jsx)(`div`,{className:`rounded-md bg-surface-container-low overflow-hidden`,children:[1,2,3].map(e=>(0,G.jsx)(h1,{},e))}):k.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-3 rounded-md bg-surface-container-low text-on-surface-variant`,children:[(0,G.jsx)(fo,{className:`h-10 w-10 opacity-30`}),(0,G.jsxs)(`div`,{className:`text-center font-sans`,children:[(0,G.jsx)(`p`,{className:`text-sm`,children:A===0&&!o&&!C&&!w?`No agent runs yet`:`No matching runs`}),A===0&&!o&&!C&&!w&&(0,G.jsx)(`p`,{className:`text-xs mt-1`,children:`Trigger the first run to see the agent at work`})]}),A===0&&!o&&!C&&!w&&(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,className:`gap-2 mt-2`,onClick:n,children:[(0,G.jsx)(us,{className:`h-3.5 w-3.5`}),`Run Now`]})]}):(0,G.jsx)(`div`,{...M.containerProps,role:`group`,"aria-label":`Agent run list keyboard navigation`,className:`rounded-md bg-surface-container-low overflow-hidden outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40`,children:(()=>{let n=Wj(k,{isActive:e=>e.status===`running`,startedAtEpochSec:e=>e.started_at}),r=0;return n.map(n=>(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{role:`separator`,className:`flex items-center justify-between px-4 py-2 border-b border-outline-variant/20 bg-surface-container/30`,children:[(0,G.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:n.label}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:n.rows.length})]}),n.rows.map(n=>{let i=r++;return(0,G.jsx)(g1,{ref:M.setRowRef(i),run:n,taskNameMap:b,selected:p.has(n.id),onToggleSelected:h,onSelectRun:t,onRerun:v,isActive:e===n.id,isCursor:M.cursorIndex===i},n.id)})]},n.label))})()}),(0,G.jsx)(Mj,{total:A,offset:c,limit:50,onPageChange:l}),(0,G.jsx)(NQ,{selectedCount:p.size,onClear:g,onCompare:()=>r([...p])}),_!==null&&(0,G.jsx)(a1,{open:!0,onOpenChange:e=>{e||v(null)},sourceRun:_})]})}function v1(e){return!Number.isFinite(e)||e<=0?null:e<1e3?`${e}ms`:e<6e4?`${Math.round(e/1e3)}s`:`${Math.round(e/6e4)}m`}function y1({intervalMs:e,isFetching:t,onManualRefresh:n,lastUpdatedAt:r,className:i}){let a=e===void 0?null:v1(e);return(0,G.jsxs)(`div`,{className:J(`flex items-center gap-2 text-on-surface-variant`,i),"aria-busy":t,children:[(0,G.jsx)(`span`,{"data-testid":`refresh-indicator-dot`,className:J(`h-1.5 w-1.5 rounded-full bg-primary`,t&&`animate-pulse`),"aria-hidden":!0}),a?(0,G.jsxs)(`span`,{className:`font-sans text-xs`,children:[`every `,a]}):null,(0,G.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Refresh now`,className:`rounded-md p-1 hover:bg-surface-container-high hover:text-on-surface transition-colors`,children:(0,G.jsx)(ps,{className:J(`h-3 w-3`,t&&`animate-spin`)})})]})}function b1(e,t){if(typeof e!=`string`||e.length===0)return null;let n;try{n=JSON.parse(e)}catch{return null}return t?t(n)?n:null:n}var x1=80;function S1(e){switch(e){case`completed`:return`default`;case`failed`:return`destructive`;case`skipped`:return`secondary`;default:return`warning`}}function C1(e,t){return e.length<=t?e:`${e.slice(0,t)}…`}function w1({entry:e}){let[t,n]=(0,W.useState)(!1),r=Object.entries(e.toolCalls),i=e.writeIntents?Object.entries(e.writeIntents.byTool):[];return(0,G.jsxs)(Q,{level:`low`,className:`overflow-hidden`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 px-4 py-3 text-left hover:bg-surface-container-high/30 transition-colors`,onClick:()=>n(!t),"aria-expanded":t,children:[t?(0,G.jsx)(ho,{className:`h-3.5 w-3.5 mt-1 shrink-0 text-on-surface-variant`}):(0,G.jsx)(_o,{className:`h-3.5 w-3.5 mt-1 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:e.phaseName}),(0,G.jsx)(X,{variant:S1(e.status),children:e.status}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[e.turnsUsed,` turn`,e.turnsUsed===1?``:`s`,e.maxTurns?` / ${e.maxTurns}`:``]}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[s1(e.tokensUsed),` tok`]}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:o1(e.costUsd,e.costSource??null)}),e.durationMs!==null&&(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[(e.durationMs/1e3).toFixed(1),`s`]})]}),e.skipReason&&(0,G.jsxs)(`p`,{className:`font-sans text-xs text-secondary mt-1`,children:[`Skipped: `,e.skipReason]})]})]}),t&&(0,G.jsxs)(`div`,{className:`space-y-3 border-t border-outline-variant/20 px-4 py-3`,children:[r.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wide text-on-surface-variant mb-1.5`,children:`Tool calls`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.map(([e,t])=>(0,G.jsxs)(X,{variant:`secondary`,className:`font-mono`,children:[e,` × `,t]},e))})]}),e.writeIntents&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`font-sans text-[11px] uppercase tracking-wide text-on-surface-variant mb-1.5`,children:[`Write intents (`,e.writeIntents.total,`)`]}),i.length===0?(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:`None attributed to this phase.`}):(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.map(([e,t])=>(0,G.jsxs)(X,{variant:`warning`,className:`font-mono`,children:[e,` × `,t]},e))})]}),e.summary&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wide text-on-surface-variant mb-1.5`,children:`Summary`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface whitespace-pre-wrap`,children:e.summary})]})]})]})}function T1({turn:e}){let[t,n]=(0,W.useState)(!1),r=e.tool_input?b1(e.tool_input)??e.tool_input:null,i=e.tool_input?C1(e.tool_input,x1):`—`,a=e.tool_input!==null&&e.tool_input.length>x1;return(0,G.jsx)(`div`,{role:`button`,tabIndex:0,className:`px-4 py-2.5 hover:bg-surface-container-high/30 transition-colors border-b border-outline-variant/10 last:border-b-0 cursor-pointer`,onClick:()=>n(!t),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(!t))},"aria-expanded":t,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant w-5 shrink-0 pt-0.5 text-right`,children:e.turn_number}),(0,G.jsx)(`span`,{className:`font-mono text-xs font-medium text-on-surface shrink-0 pt-0.5 min-w-[140px]`,children:e.tool_name}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[a?(0,G.jsxs)(`div`,{className:`flex items-start gap-1 font-mono text-xs text-on-surface-variant w-full`,children:[t?(0,G.jsx)(ho,{className:`h-3 w-3 mt-0.5 shrink-0`}):(0,G.jsx)(_o,{className:`h-3 w-3 mt-0.5 shrink-0`}),(0,G.jsx)(`span`,{className:t?void 0:`truncate`,children:i})]}):(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant truncate block`,children:i}),t&&r!==null&&(0,G.jsx)(`pre`,{className:`mt-1.5 ml-4 rounded-md bg-surface-container-lowest p-2.5 font-mono text-xs whitespace-pre-wrap overflow-x-auto max-h-48 text-on-surface-variant`,children:typeof r==`string`?r:JSON.stringify(r,null,2)}),t&&e.tool_output_summary&&(0,G.jsxs)(`div`,{className:`mt-1.5 ml-4`,children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wide text-on-surface-variant mb-1`,children:`Output`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface whitespace-pre-wrap`,children:e.tool_output_summary})]})]})]})})}function E1(e){return e.slice().sort((e,t)=>(e.startedAt??e.completedAt??2**53-1)-(t.startedAt??t.completedAt??2**53-1))}function D1(e,t){let n=new Map;for(let e of t)n.set(e.phaseName,[]);n.set(`_unphased`,[]);for(let r of e){let e=r.started_at,i=null;if(e!==null){let n=-1/0;for(let r of t){let t=r.completedAt??1/0;if(e>n&&e<=t){i=r.phaseName;break}r.completedAt!==null&&(n=r.completedAt)}}i===null?n.get(`_unphased`).push(r):n.get(i).push(r)}for(let e of n.values())e.sort((e,t)=>e.turn_number-t.turn_number);let r=[];for(let e of t)r.push({phaseName:e.phaseName,turns:n.get(e.phaseName)});let i=n.get(`_unphased`);return i.length>0&&r.push({phaseName:`_unphased`,turns:i}),r}function O1({runId:e,runStatus:t,className:n}){let r=rA(e),i=qk(e,t),a=r.data?.audit.phases??[],o=i.data??[],s=r.isPending||i.isPending,c=!s&&a.length===0&&o.length===0;if(s)return(0,G.jsxs)(`div`,{className:J(`flex items-center gap-2 text-on-surface-variant py-4`,n),children:[(0,G.jsx)(es,{className:`h-4 w-4 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Loading audit trail...`})]});if(c)return(0,G.jsx)(Q,{level:`low`,className:J(`flex h-20 items-center justify-center`,n),children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface-variant italic`,children:`This run had no recorded tool calls.`})});let l=E1(a),u=D1(o,l),d=new Map(l.map(e=>[e.phaseName,e]));return(0,G.jsxs)(`div`,{className:J(`space-y-3`,n),children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wide text-on-surface-variant`,children:`Audit Trail`}),u.map(e=>{let t=d.get(e.phaseName);return(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[t?(0,G.jsx)(w1,{entry:t}):(0,G.jsx)(`div`,{className:`px-4 py-2 rounded-md bg-surface-container/30`,children:(0,G.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:[`misc (`,e.turns.length,`)`]})}),e.turns.length>0&&(0,G.jsx)(Q,{level:`low`,className:`overflow-hidden ml-3`,children:e.turns.map(e=>(0,G.jsx)(T1,{turn:e},e.id))})]},e.phaseName)})]})}function k1({text:e}){let[t,n]=(0,W.useState)(!1),r=e.length>200||e.includes(`
|
|
409
|
-
`);return(0,G.jsxs)(`div`,{className:`mt-1`,children:[(0,G.jsx)(`div`,{className:!t&&r?`line-clamp-2`:void 0,children:(0,G.jsx)(uO,{content:e,className:`text-on-surface-variant [&>*]:text-on-surface-variant`})}),r&&(0,G.jsx)(`button`,{className:`flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors mt-1`,onClick:()=>n(!t),children:t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ho,{className:`h-3 w-3`}),` Show less`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_o,{className:`h-3 w-3`}),` Show more`]})})]})}function A1({phases:e}){return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`h3`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Phase Execution`}),e.map((e,t)=>(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-surface-container-high font-mono text-sm font-medium text-on-surface-variant shrink-0`,children:t+1}),(0,G.jsxs)(Q,{level:`default`,className:`flex-1 p-3`,children:[(0,G.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:e.name}),(0,G.jsx)(X,{variant:c1(e.status),children:e.status})]}),(0,G.jsxs)(`div`,{className:`flex gap-3 font-mono text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{children:[e.turnsUsed,` turns`]}),(0,G.jsx)(`span`,{children:s1(e.tokensUsed)}),(0,G.jsx)(`span`,{children:o1(e.costUsd,e.costSource??null)})]})]}),e.summary&&(0,G.jsx)(k1,{text:e.summary})]})]},e.name))]})}function j1(e){let t=e.toLowerCase();return t.includes(`extract`)||t.includes(`create`)||t.includes(`supersed`)||t.includes(`update`)?`default`:t.includes(`skip`)||t.includes(`no-op`)?`secondary`:t.includes(`error`)||t.includes(`fail`)?`destructive`:`default`}function M1(e){return e===null?`—`:new Date(e*Js).toLocaleTimeString()}function N1(e){if(!e)return`—`;switch(e){case`provider-config`:return`provider config`;case`provider-metadata`:return`provider metadata`;case`provider-default`:return`inferred provider default`;default:return e}}function P1(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function F1(e){return P1(e)}function I1(e){return P1(e)}function L1({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-lowest px-3 py-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wide text-on-surface-variant`,children:e}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface`,children:t})]})}function R1({report:e}){let[t,n]=(0,W.useState)(!1),[r,i]=(0,W.useState)(!1),a=e.details!==null&&e.details.length>0,o=e.summary.length>200||e.summary.includes(`
|
|
410
|
-
`),s=a?b1(e.details)??e.details:null;return(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(X,{variant:j1(e.action),children:e.action}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`div`,{className:!r&&o?`line-clamp-3`:void 0,children:(0,G.jsx)(uO,{content:e.summary})}),o&&(0,G.jsx)(`button`,{className:`flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors mt-1`,onClick:()=>i(!r),children:r?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ho,{className:`h-3 w-3`}),` Show less`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_o,{className:`h-3 w-3`}),` Show more`]})})]}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant shrink-0`,children:M1(e.created_at)})]}),a&&(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`button`,{className:`flex items-center gap-1 font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors`,onClick:()=>n(!t),children:[t?(0,G.jsx)(ho,{className:`h-3.5 w-3.5`}):(0,G.jsx)(_o,{className:`h-3.5 w-3.5`}),t?`Hide details`:`Show details`]}),t&&(0,G.jsx)(`pre`,{className:`mt-2 rounded-md bg-surface-container-lowest p-3 font-mono text-xs overflow-auto max-h-48 text-on-surface-variant`,children:typeof s==`string`?s:JSON.stringify(s,null,2)})]})]})}function z1(e){let t=new Map;for(let n of e){let e=t.get(n.tool_name)??[];e.push(n),t.set(n.tool_name,e)}return Array.from(t.entries()).map(([e,t])=>({tool:e,items:t}))}function B1({tool:e,items:t}){let[n,r]=(0,W.useState)(!1);return(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-lowest`,children:[(0,G.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-surface-container-high/30 transition-colors`,onClick:()=>r(!n),children:[n?(0,G.jsx)(ho,{className:`h-3.5 w-3.5 text-on-surface-variant`}):(0,G.jsx)(_o,{className:`h-3.5 w-3.5 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface`,children:e}),(0,G.jsx)(X,{variant:`secondary`,className:`ml-auto`,children:t.length})]}),n&&(0,G.jsx)(`div`,{className:`space-y-2 border-t border-outline-variant/20 px-3 py-3`,children:t.map(e=>(0,G.jsxs)(`div`,{className:`space-y-1`,children:[e.stub_id&&(0,G.jsxs)(`p`,{className:`font-mono text-[11px] text-on-surface-variant`,children:[`stub: `,(0,G.jsx)(`span`,{className:`text-on-surface`,children:e.stub_id})]}),(0,G.jsx)(`pre`,{className:`rounded-md bg-surface-container p-2 font-mono text-[11px] overflow-auto max-h-40 text-on-surface-variant`,children:JSON.stringify(e.tool_input,null,2)})]},e.id))})]})}function V1({runId:e}){let{data:t,isLoading:n,isError:r}=nA(e),i=t?.intents??[],a=(0,W.useMemo)(()=>z1(i),[i]);return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:[`Intended Writes`,i.length>0&&(0,G.jsxs)(`span`,{className:`ml-2 text-on-surface normal-case font-normal`,children:[i.length,` `,i.length===1?`intent`:`intents`]})]}),n?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant py-4`,children:[(0,G.jsx)(es,{className:`h-4 w-4 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Loading write intents...`})]}):r?(0,G.jsx)(Q,{level:`low`,className:`flex h-20 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-tertiary`,children:`Failed to load write intents`})}):i.length===0?(0,G.jsx)(Q,{level:`low`,className:`flex h-24 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface-variant`,children:`No writes attempted`})}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`space-y-2`,children:a.map(e=>(0,G.jsx)(B1,{tool:e.tool,items:e.items},e.tool))}),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant italic`,children:[i.length,` `,i.length===1?`write`:`writes`,` would have been performed — no vault data was mutated.`]})]})]})}var H1=5e3;function U1({revision:e,onRestore:t,isPending:n}){let[r,i]=(0,W.useState)(!1),a=e.content.length>240?e.content.slice(0,240)+`…`:e.content;return(0,G.jsx)(Q,{level:`low`,className:`p-3 space-y-2`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface`,children:[`#`,e.id]}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:QA(e.created_at)}),e.run_id&&(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:[`run: `,e.run_id.slice(0,8)]})]}),(0,G.jsx)(`button`,{className:`mt-1 text-left font-sans text-xs text-on-surface-variant hover:text-on-surface transition-colors whitespace-pre-wrap`,onClick:()=>i(!r),children:r?e.content:a})]}),(0,G.jsx)(Y,{size:`sm`,variant:`outline`,onClick:t,disabled:n,className:`shrink-0`,children:n?(0,G.jsx)(es,{className:`h-3.5 w-3.5 animate-spin`}):`Restore`})]})})}function W1({agentId:e,tier:t}){let[n,r]=(0,W.useState)(!1),{data:i,isLoading:a}=iA(n?e:``,t),o=aA(),s=i?.revisions??[],c=e=>{window.confirm(`Restore revision #${e}? The current digest content will be preserved as a new revision.`)&&o.mutate({revisionId:e})};return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`button`,{className:`flex items-center gap-2 font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide hover:text-on-surface transition-colors`,onClick:()=>r(!n),children:[n?(0,G.jsx)(ho,{className:`h-4 w-4`}):(0,G.jsx)(_o,{className:`h-4 w-4`}),`Digest Revisions`,(0,G.jsxs)(`span`,{className:`normal-case font-normal text-xs`,children:[`(tier `,t,`)`]})]}),n&&(a?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant py-4`,children:[(0,G.jsx)(es,{className:`h-4 w-4 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Loading revisions...`})]}):s.length===0?(0,G.jsx)(Q,{level:`low`,className:`flex h-20 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface-variant`,children:`No revisions recorded`})}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[o.isError&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-tertiary`,children:o.error instanceof Error?o.error.message:`Restore failed`}),s.map(e=>(0,G.jsx)(U1,{revision:e,onRestore:()=>c(e.id),isPending:o.isPending},e.id))]}))]})}function G1({runId:e,onBack:t}){let[n,r]=(0,W.useState)(!1),{data:i,isLoading:a,isError:o,isFetching:s,refetch:c}=Gk(e),l=i?.run?.status,{data:u,isLoading:d}=Kk(e,l),{data:f}=Jk(),p=tA(),m=(0,W.useMemo)(()=>f?.tasks??[],[f]),h=(0,W.useMemo)(()=>b1(i?.run?.cost_data,F1),[i?.run?.cost_data]),g=(0,W.useMemo)(()=>b1(i?.run?.usage_data,I1),[i?.run?.usage_data]),_=(0,W.useMemo)(()=>{let e=b1(i?.run?.actions_taken,P1);return e?.phases&&Array.isArray(e.phases)?e.phases:null},[i?.run?.actions_taken]);if(a)return(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(es,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans`,children:`Loading run...`})]});if(o||!i?.run)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),`Runs`]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Run not found`})]})]});let v=i.run,y=u?.reports??[],b=v.cost_source===`estimated`?`Estimated Cost`:`Cost`,x=v.dry_run===!0,S=[`completed`,`failed`,`skipped`].includes(v.status),C=!x&&v.task===`vault-evolve`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),`Runs`]}),x&&(0,G.jsx)(X,{variant:`warning`,title:`Writes were intercepted and recorded as intents`,children:`Dry Run`}),!S&&(0,G.jsx)(y1,{className:`ml-auto`,intervalMs:Hs.RUN_DETAIL,isFetching:s,onManualRefresh:()=>{c()}})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4`,children:[(0,G.jsx)(RA,{label:`Status`,value:YA(v.status),tone:`sage`}),(0,G.jsx)(RA,{label:`Task`,value:d1(v.task,m),mono:!0}),(0,G.jsx)(RA,{label:`Started`,value:QA(v.started_at),mono:!0}),(0,G.jsx)(RA,{label:`Duration`,value:XA(v.started_at,v.completed_at),mono:!0}),(0,G.jsx)(RA,{label:`Tokens`,value:s1(v.tokens_used),tone:`ochre`,mono:!0}),(0,G.jsx)(RA,{label:b,value:o1(v.cost_usd,v.cost_source),tone:`ochre`,mono:!0})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[v.resumable&&v.status===`failed`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{size:`sm`,onClick:()=>p.mutate({runId:v.id,mode:`manual`}),disabled:p.isPending,children:[p.isPending?(0,G.jsx)(es,{className:`h-3.5 w-3.5 animate-spin`}):null,`Resume Run`]}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Resume status: `,v.resume_status??`ready`]})]}),(0,G.jsxs)(Y,{size:`sm`,variant:`outline`,className:`gap-2`,onClick:()=>r(!0),title:`Start a new run with the same settings as this one`,children:[(0,G.jsx)(ms,{className:`h-3.5 w-3.5`}),`Rerun with same settings`]})]}),(v.harness||v.provider||v.model)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 px-1`,children:[v.harness&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Harness: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:v.harness})]}),v.provider&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Provider: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:v.provider})]}),v.model&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Model: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:v.model})]}),v.cost_source&&v.cost_source!==`unavailable`&&(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Cost source: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:v.cost_source})]})]}),(h||g?.run)&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-3`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Cost Diagnostics`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-3`,children:[(0,G.jsx)(L1,{label:`Input`,value:s1(h?.breakdown.inputTokens??g?.run?.inputTokens??null)}),(0,G.jsx)(L1,{label:`Cached Input`,value:s1(h?.breakdown.cachedInputTokens??g?.run?.cachedTokens??null)}),(0,G.jsx)(L1,{label:`Uncached Input`,value:s1(h?.breakdown.uncachedInputTokens??null)}),(0,G.jsx)(L1,{label:`Output`,value:s1(h?.breakdown.outputTokens??g?.run?.outputTokens??null)}),(0,G.jsx)(L1,{label:`Requests`,value:s1(h?.breakdown.requestCount??g?.run?.requests??null)}),(0,G.jsx)(L1,{label:`Cache Savings`,value:o1(h?.breakdown.cacheSavingsUsd??null,`estimated`)})]}),h?.message&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:h.message})]}),g?.runBudget&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-3`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Token Budget`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-3`,children:[(0,G.jsx)(L1,{label:`Context Window`,value:s1(g.runBudget.contextWindowTokens)}),(0,G.jsx)(L1,{label:`Peak Request`,value:s1(g.runBudget.peakRequestTotalTokens)}),(0,G.jsx)(L1,{label:`Peak Input`,value:s1(g.runBudget.peakRequestInputTokens)}),(0,G.jsx)(L1,{label:`Peak Output`,value:s1(g.runBudget.peakRequestOutputTokens)}),(0,G.jsx)(L1,{label:`Budget Used`,value:g.runBudget.utilizationPercent==null?`—`:`${g.runBudget.utilizationPercent}%`}),(0,G.jsx)(L1,{label:`Headroom`,value:s1(g.runBudget.headroomTokens)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 px-1`,children:[(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Budget status: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:g.runBudget.status})]}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Context source: `,(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:N1(g.runBudget.contextWindowSource)})]})]}),g.runBudget.message&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:g.runBudget.message})]}),v.error&&(0,G.jsx)(`div`,{className:`rounded-md bg-tertiary/10 px-3 py-2`,children:(0,G.jsx)(`p`,{className:`font-mono text-xs text-tertiary`,children:v.error})}),_&&_.length>0&&(0,G.jsx)(Q,{level:`low`,className:`p-4`,children:(0,G.jsx)(A1,{phases:_})}),v.phase_checkpoints&&v.phase_checkpoints.length>0&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-2`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Checkpoints`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:v.phase_checkpoints.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md bg-surface-container-lowest px-3 py-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface`,children:e.name}),(0,G.jsxs)(`p`,{className:`font-mono text-xs text-on-surface-variant`,children:[e.status,e.costSource?` • ${e.costSource}`:``]})]}),(0,G.jsx)(`p`,{className:`font-mono text-xs text-on-surface-variant`,children:QA(Math.floor(e.updatedAt))})]},e.name))})]}),x&&(0,G.jsx)(V1,{runId:v.id}),C&&(0,G.jsx)(W1,{agentId:v.agent_id,tier:H1}),(0,G.jsx)(O1,{runId:v.id,runStatus:v.status}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:[`Decisions`,y.length>0&&(0,G.jsxs)(`span`,{className:`ml-2 text-on-surface normal-case font-normal`,children:[y.length,` `,y.length===1?`action`:`actions`]})]}),d?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-on-surface-variant py-4`,children:[(0,G.jsx)(es,{className:`h-4 w-4 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Loading decisions...`})]}):y.length===0?(0,G.jsx)(Q,{level:`low`,className:`flex h-24 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface-variant`,children:`No decisions recorded for this run`})}):(0,G.jsx)(`div`,{className:`space-y-2`,children:y.map(e=>(0,G.jsx)(R1,{report:e},e.id))})]}),(0,G.jsx)(a1,{open:n,onOpenChange:r,sourceRun:v})]})}function K1(e){return!e.phases||e.phases.length===0?`Single query`:`${e.phases.length} phases`}function q1(e){return e===`user`?`User`:`Built-in`}function J1({task:e,onClick:t}){return(0,G.jsxs)(Q,{level:`low`,interactive:!0,className:J(`p-4 space-y-2 transition-all`,e.isDefault&&`ring-1 ring-primary/20 shadow-[inset_0_0_12px_rgba(171,207,184,0.08)]`),onClick:t,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface truncate`,children:e.displayName}),e.isDefault&&(0,G.jsx)(Ts,{className:`h-3.5 w-3.5 text-primary shrink-0 fill-primary/30`})]}),e.description&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant mt-1 line-clamp-2`,children:e.description})]}),(0,G.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:(0,G.jsx)(X,{variant:l1(e.source),children:q1(e.source)})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-on-surface-variant`,children:[(0,G.jsx)(Xo,{className:`h-3 w-3`}),(0,G.jsx)(`span`,{className:`font-mono text-xs`,children:K1(e)})]}),e.reasoningLevel&&(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant/70 truncate max-w-[160px]`,children:[`reasoning `,e.reasoningLevel]}),e.maxTurns!==void 0&&(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant/70`,children:[`max `,e.maxTurns,` turns`]})]})]})}function Y1({onSelect:e}){let{data:t,isLoading:n}=Jk(),r=t?.tasks??[];return n?(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:Array.from({length:3}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-28 rounded-md animate-pulse bg-surface-container-low`},t))}):r.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No tasks found.`}):(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:r.map(t=>(0,G.jsx)(J1,{task:t,onClick:()=>e(t.name)},t.name))})}function X1({task:e,onRunTriggered:t,onDeleted:n,onCustomized:r}){let i=Xk(),a=Zk(),[o,s]=(0,W.useState)(!1);return(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Y,{size:`sm`,onClick:()=>s(!0),children:`Run Now`}),e.source===`built-in`&&(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>i.mutate({taskId:e.name},{onSuccess:e=>{let t=e?.task?.name;t&&r&&r(t)}}),children:`Customize`}),e.source===`user`&&(0,G.jsx)(Y,{variant:`destructive`,size:`sm`,onClick:()=>{a.mutate(e.name,{onSuccess:()=>n?.()})},children:`Delete`}),(0,G.jsx)(a1,{open:o,onOpenChange:s,preselectedTask:e,onTriggered:t})]})}var Z1=20;function Q1({taskId:e,onSaved:t}){let{data:n,isLoading:r,isError:i}=Qk(e),a=$k(),[o,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(!1);(0,W.useEffect)(()=>{n?.yaml&&(s(n.yaml),l(!1))},[n?.yaml]);function u(e){s(e),l(!0)}function d(){a.mutate({taskId:e,yaml:o},{onSuccess:()=>{l(!1),t?.()}})}function f(){n?.yaml&&(s(n.yaml),l(!1))}if(r)return(0,G.jsx)(`div`,{className:`h-64 animate-pulse rounded-md bg-surface-container-low`});if(i)return(0,G.jsx)(`div`,{className:`rounded-md bg-tertiary-container/20 p-4 font-sans text-sm text-tertiary`,children:`Failed to load task YAML.`});let p=n?.source!==`user`;return(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:[`Task Definition `,p&&`(read-only)`]}),!p&&(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:f,disabled:!c,children:`Reset`}),(0,G.jsx)(Y,{size:`sm`,onClick:d,disabled:!c||a.isPending,children:a.isPending?`Saving...`:`Save`})]})]}),(0,G.jsx)(`textarea`,{value:o,onChange:e=>u(e.target.value),readOnly:p,rows:Z1,spellCheck:!1,className:`w-full rounded-md bg-surface-container-lowest p-4 font-mono text-sm text-on-surface leading-relaxed resize-y focus:outline-hidden focus:ring-2 focus:ring-primary/40 ${p?`opacity-75 cursor-not-allowed`:``}`}),a.isError&&(0,G.jsx)(`div`,{className:`rounded-md bg-tertiary-container/20 p-3 font-sans text-sm text-tertiary`,children:a.error.message}),a.isSuccess&&!c&&(0,G.jsx)(`div`,{className:`rounded-md bg-primary-container/20 p-3 font-sans text-sm text-primary`,children:`Task saved successfully.`})]})}var $1=[[`low`,`Reasoning Low`],[`default`,`Reasoning Default`],[`high`,`Reasoning High`]];function e0({description:e,values:t,onChange:n,models:r,fallbackModel:i,fallbackReasoningMap:a,placeholderWhenEmpty:o=`Use default model`}){let s={...t.low?{low:t.low}:{},...t.default?{default:t.default}:{},...t.high?{high:t.high}:{}};return(0,G.jsxs)(`div`,{className:`space-y-3 rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest p-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant uppercase tracking-wide`,children:`Reasoning Profiles`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant/80 mt-1`,children:e})]}),$1.map(([e,c])=>{let l=t[e],u=s$(e,{reasoning_map:s},a?.[e]??i)||o;return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:c}),r.length>0?(0,G.jsx)(VQ,{value:l,onValueChange:t=>n(e,t),placeholder:u,searchPlaceholder:`Search models...`,emptyMessage:`No models match that search.`,options:r.map(e=>({value:e,label:e})),sortOptions:!0,monospace:!0}):(0,G.jsx)(cp,{value:l,onChange:t=>n(e,t.target.value),placeholder:u})]},e)})]})}var t0=[`active`,`idle`,`sleep`],n0={active:`Active`,idle:`Idle`,sleep:`Sleep`};function r0(e){return JSON.stringify(e??null)}function i0(e){return{maxTurns:e?.maxTurns==null?``:String(e.maxTurns),timeoutSeconds:e?.timeoutSeconds==null?``:String(e.timeoutSeconds),phaseOverrides:e?.phases??{},scheduleOverride:e?.schedule??{},paramsOverride:e?.params??{}}}function a0({taskId:e,phases:t,defaults:n,schedule:r,params:i}){let{data:a,isPending:o}=d$(),{data:s}=u$(e),c=f$(),l=p$(),u=s?.config,d=i0(u),[f,p]=(0,W.useState)(d.maxTurns),[m,h]=(0,W.useState)(d.timeoutSeconds),[g,_]=(0,W.useState)(d.phaseOverrides),[v,y]=(0,W.useState)(d.scheduleOverride),[b,x]=(0,W.useState)(d.paramsOverride),[S,C]=(0,W.useState)(d),w=a?.providers??[],T={harness:n?.harness,providerType:n?.providerType,localBackend:n?.localBackend,model:n?.model,reasoningMap:n?.reasoningMap,baseUrl:n?.baseUrl,contextLength:n?.contextLength},{draft:E,isDirty:D,commitDraft:O,handleHarnessChange:k,handleProviderChange:A,handleModelChange:j,handleLocalBackendChange:M,handleReasoningChange:N,handleBaseUrlChange:P,handleContextLengthChange:F}=G$({source:{harness:u?.harness,provider:u?.provider,model:u?.model},defaults:T,providers:w}),I=E.harness,L=E.type,R=E.model,ee=E.reasoningLow,z=E.reasoningDefault,B=E.reasoningHigh,V=E.baseUrl,H=E.contextLength,te=V||r$(L,E.localBackend),ne=h$(L||null,te||void 0,`llm`,E.localBackend||null).data?.models??w.find(e=>e.type===L)?.models??[],U=I||a$(L)||n?.harness||a$(n?.providerType)||`claude-sdk`,re=D||f!==S.maxTurns||m!==S.timeoutSeconds||r0(g)!==r0(S.phaseOverrides)||r0(v)!==r0(S.scheduleOverride)||r0(b)!==r0(S.paramsOverride);(0,W.useEffect)(()=>{if(!s)return;let e=i0(u);p(e.maxTurns),h(e.timeoutSeconds),_(e.phaseOverrides),y(e.scheduleOverride),x(e.paramsOverride),C(e)},[u,s,n?.maxTurns,n?.timeoutSeconds]);let ie=v.enabled??r?.enabled??!1,ae=v.runIn??r?.runIn??[];function oe(e){A(e),c.reset()}function se(e,t){_(n=>{let r={...n};return t===null?delete r[e]:r[e]=t,r})}function ce(){let t=H$({...E,harness:U},ne);if(!t)return;let n=r?Object.keys(v).length>0?{schedule:v}:{schedule:null}:{},a=i&&Object.keys(b).length>0?{params:b}:{};l.mutate({taskId:e,config:{harness:U,provider:t,maxTurns:f?Number(f):null,timeoutSeconds:m?Number(m):null,phases:Object.keys(g).length>0?g:null,...n,...a}},{onSuccess:()=>{O(z$({harness:U,provider:t},T)),C({maxTurns:f,timeoutSeconds:m,phaseOverrides:g,scheduleOverride:v,paramsOverride:b})}})}function le(){l.mutate({taskId:e,config:{harness:null,provider:null,model:null,maxTurns:null,timeoutSeconds:null,phases:null,schedule:null,params:null}},{onSuccess:()=>{let e=i0(null);O(z$(null,T)),p(e.maxTurns),h(e.timeoutSeconds),_(e.phaseOverrides),y(e.scheduleOverride),x(e.paramsOverride),C(e)}})}function ue(){let e=L===`ollama`||L===`lmstudio`||L===`openai-compatible`,t={type:L,...L===`openai-compatible`&&E.localBackend?{local_backend:E.localBackend}:{},...e&&V?{base_url:V}:{}};c.mutate(t)}return(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Task Config`}),u&&(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:le,className:`text-xs text-on-surface-variant`,children:`Clear All Overrides`})]}),(0,G.jsx)(x$,{harness:U,providerType:L,localBackend:E.localBackend,model:R,baseUrl:V,contextLength:H,modelPlaceholder:n?.model,providers:w,isLoadingProviders:o,onHarnessChange:e=>{k(e)},onProviderChange:oe,onLocalBackendChange:M,onModelChange:j,onBaseUrlChange:P,onContextLengthChange:F}),L!==``&&(0,G.jsx)(e0,{description:`Built-in task reasoning levels resolve through these task-level model mappings before falling back to the inherited defaults.`,values:{low:ee,default:z,high:B},onChange:N,models:ne,fallbackModel:R||n?.model,fallbackReasoningMap:n?.reasoningMap,placeholderWhenEmpty:`Use inherited model`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Max Turns`}),(0,G.jsx)(cp,{type:`number`,value:f,onChange:e=>{p(e.target.value)},placeholder:n?.maxTurns==null?`—`:String(n.maxTurns)})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Timeout (seconds)`}),(0,G.jsx)(cp,{type:`number`,value:m,onChange:e=>{h(e.target.value)},placeholder:n?.timeoutSeconds==null?`—`:String(n.timeoutSeconds)})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:ue,disabled:c.isPending,className:`gap-1.5 text-on-surface-variant`,children:[c.isPending?(0,G.jsx)(es,{className:`h-3.5 w-3.5 animate-spin`}):(0,G.jsx)(Ls,{className:`h-3.5 w-3.5`}),`Test`]}),c.isSuccess&&(0,G.jsx)(`span`,{className:`flex items-center gap-1 text-xs`,children:c.data.ok?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(So,{className:`h-3.5 w-3.5 text-green-500`}),(0,G.jsxs)(`span`,{className:`text-green-500 font-mono`,children:[c.data.latency_ms,`ms`]})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(wo,{className:`h-3.5 w-3.5 text-red-400`}),(0,G.jsx)(`span`,{className:`text-red-400`,children:c.data.error})]})}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsxs)(Y,{size:`sm`,onClick:ce,disabled:!re||l.isPending,className:`gap-1.5`,children:[l.isPending&&(0,G.jsx)(es,{className:`h-3.5 w-3.5 animate-spin`}),`Save`]})]}),r&&(0,G.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-[var(--ghost-border)]`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Eo,{className:`h-3.5 w-3.5 text-on-surface-variant`}),(0,G.jsx)(`h3`,{className:`font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide`,children:`Scheduling`}),(0,G.jsx)(X,{variant:ie?`secondary`:`outline`,className:`text-[10px] px-1.5 py-0`,children:ie?`active`:`off`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface`,children:`Auto-run`}),(0,G.jsx)(`p`,{className:`font-sans text-[11px] text-on-surface-variant`,children:`Automatically run this task on a schedule`})]}),(0,G.jsx)(lN,{checked:ie,onCheckedChange:e=>{y(t=>({...t,enabled:e}))}})]}),ie&&(0,G.jsxs)(`div`,{className:`space-y-3 pl-0.5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Run every (seconds)`}),(0,G.jsx)(cp,{type:`number`,min:10,value:v.intervalSeconds??``,onChange:e=>{let t=e.target.value;y(e=>({...e,intervalSeconds:t?Number(t):void 0}))},placeholder:r.intervalSeconds==null?`300`:String(r.intervalSeconds)})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:`Run in states`}),(0,G.jsx)(`div`,{className:`flex gap-2`,children:t0.map(e=>{let t=ae.includes(e);return(0,G.jsx)(`button`,{onClick:()=>{let n=t?ae.filter(t=>t!==e):[...ae,e];y(e=>({...e,runIn:n.length>0?n:void 0}))},className:`
|
|
411
|
-
rounded-md border px-3 py-1.5 font-sans text-xs font-medium transition-colors
|
|
412
|
-
${t?`border-primary/40 bg-primary/5 text-on-surface`:`border-[var(--ghost-border)] bg-surface-container-lowest text-on-surface-variant hover:border-primary/20`}
|
|
413
|
-
`,children:n0[e]},e)})})]})]})]}),i&&Object.keys(i).length>0&&(0,G.jsxs)(`div`,{className:`space-y-3 pt-2 border-t border-[var(--ghost-border)]`,children:[(0,G.jsx)(`h3`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Parameters`}),Object.entries(i).map(([e,t])=>{let n=b[e],r=n??t,i=e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase());return typeof t==`boolean`?(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm text-on-surface`,children:i}),(0,G.jsx)(lN,{checked:r,onCheckedChange:t=>{x(n=>({...n,[e]:t}))}})]},e):(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm text-on-surface`,children:i}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(cp,{type:typeof t==`number`?`number`:`text`,value:n==null?``:String(n),placeholder:String(t),onChange:n=>{let r=typeof t==`number`?n.target.value===``?void 0:Number(n.target.value):n.target.value;x(r===void 0?t=>{let n={...t};return delete n[e],n}:t=>({...t,[e]:r}))},className:`w-40 font-mono`}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`default: `,String(t)]})]})]},e)})]}),t&&t.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2 pt-2 border-t border-[var(--ghost-border)]`,children:[(0,G.jsx)(`h3`,{className:`font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide`,children:`Per-Phase Overrides`}),t.map(e=>(0,G.jsx)(S$,{phase:e,override:g[e.name]??{},taskHarness:U,taskProviderType:L,taskModel:R||n?.model||``,taskReasoningMap:{...n?.reasoningMap??{},...ee?{low:ee}:{},...z?{default:z}:{},...B?{high:B}:{}},providers:w,isLoadingProviders:o,onChange:t=>se(e.name,t)},e.name))]})]})}var o0=3;function s0(e){return{harness:e.execution?.harness,provider:e.execution?.provider?.type,model:e.execution?.model??e.model,reasoningLevel:e.execution?.reasoningLevel??e.reasoningLevel,maxTurns:e.execution?.maxTurns??e.maxTurns,timeoutSeconds:e.execution?.timeoutSeconds??e.timeoutSeconds}}function c0(e,t){let n=t?.agent?.provider,r=e.execution?.provider,i=e.execution?.reasoningLevel??e.reasoningLevel,a=e.execution?.model??e.model??n?.model;return{harness:e.execution?.harness??t?.agent?.harness??a$(r?.type)??a$(n?.type),providerType:r?.type??n?.type,localBackend:r?.local_backend??n?.local_backend,reasoningLevel:i,model:s$(i,r??n,a),reasoningMap:r?.reasoning_map??n?.reasoning_map,baseUrl:r?.base_url??n?.base_url,contextLength:r?.context_length??n?.context_length,maxTurns:e.execution?.maxTurns??e.maxTurns,timeoutSeconds:e.execution?.timeoutSeconds??e.timeoutSeconds}}function l0(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(`div`,{className:`h-8 w-24 animate-pulse rounded bg-surface-container-high`}),(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-low p-4 space-y-3`,children:[(0,G.jsx)(`div`,{className:`h-6 w-48 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-64 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-8 w-32 animate-pulse rounded bg-surface-container-high`})]}),(0,G.jsx)(`div`,{className:`rounded-md bg-surface-container-low p-4 space-y-2`,children:Array.from({length:o0}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-5 animate-pulse rounded bg-surface-container-high`},t))})]})}function u0({phase:e,index:t}){return(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`flex h-6 w-6 items-center justify-center rounded-full bg-surface-container-high font-mono text-xs font-semibold text-on-surface-variant shrink-0`,children:t+1}),(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:e.name}),!e.required&&(0,G.jsx)(X,{variant:`secondary`,children:`optional`})]}),(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant shrink-0`,children:[`max `,e.maxTurns,` turns`]})]}),e.reasoningLevel&&(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsxs)(X,{variant:`secondary`,children:[`reasoning `,e.reasoningLevel]})}),e.tools.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.tools.map(e=>(0,G.jsx)(`span`,{className:`font-mono text-xs px-1.5 py-0.5 rounded-xs bg-surface-container-high text-on-surface-variant`,children:e},e))}),(0,G.jsx)(Q,{level:`lowest`,className:`p-3 overflow-auto max-h-40`,children:(0,G.jsx)(uO,{content:e.prompt})})]})}function d0({taskId:e,onBack:t,onNavigate:n,onRunTriggered:r}){let{data:i,isPending:a,isError:o}=Yk(e),{effective:s}=Na(),c=i?.task,l=c?.phases??[],u=c?s0(c):{},d=c?c0(c,s):{},f=(0,W.useMemo)(()=>({harness:d.harness,providerType:d.providerType,localBackend:d.localBackend,reasoningLevel:d.reasoningLevel,reasoningMap:d.reasoningMap,model:d.model,baseUrl:d.baseUrl,contextLength:d.contextLength,maxTurns:d.maxTurns,timeoutSeconds:d.timeoutSeconds}),[d.harness,d.providerType,d.localBackend,d.reasoningLevel,d.reasoningMap,d.model,d.baseUrl,d.contextLength,d.maxTurns,d.timeoutSeconds]);return a?(0,G.jsx)(l0,{}):o||!i?.task?(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),`Tasks`]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Task not found`})]})]}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),`Tasks`]}),(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 space-y-1 min-w-0`,children:[(0,G.jsx)(`h1`,{className:`font-serif text-lg text-on-surface`,children:c.displayName}),c.description&&(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:c.description})]}),(0,G.jsx)(X,{variant:l1(c.source),className:`shrink-0`,children:YA(c.source??`built-in`)})]}),(0,G.jsx)(X1,{task:c,onDeleted:t,onCustomized:e=>n?.(e),onRunTriggered:r})]}),(0,G.jsx)(a0,{taskId:e,phases:l,defaults:f,schedule:c.schedule,params:c.params}),(u.model!==void 0||u.reasoningLevel!==void 0||u.maxTurns!==void 0||u.timeoutSeconds!==void 0)&&(0,G.jsxs)(Q,{level:`low`,className:`p-4 space-y-3`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Task Definition`}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[u.harness!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Runtime`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.harness})]}),u.provider!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Provider`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.provider})]}),u.model!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Model`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.model})]}),u.reasoningLevel!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Reasoning`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.reasoningLevel})]}),u.maxTurns!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Max Turns`}),(0,G.jsx)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:u.maxTurns})]}),u.timeoutSeconds!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Timeout`}),(0,G.jsxs)(`p`,{className:`font-mono text-sm text-on-surface mt-0.5`,children:[u.timeoutSeconds,`s`]})]})]})]}),l.length>0?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:[`Phases`,(0,G.jsxs)(`span`,{className:`ml-2 text-on-surface normal-case font-normal`,children:[l.length,` `,l.length===1?`phase`:`phases`]})]}),l.map((e,t)=>(0,G.jsx)(u0,{phase:e,index:t},e.name))]}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Prompt`}),(0,G.jsx)(Q,{level:`lowest`,className:`p-4 overflow-auto max-h-96`,children:(0,G.jsx)(uO,{content:c.prompt??``})})]}),(0,G.jsx)(Q1,{taskId:e})]})}function f0({label:e,value:t,max:n,color:r}){let i=n>0?Math.round(t/n*100):0,a=2*Math.PI*36,o=a-i/100*a;return(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,G.jsxs)(`div`,{className:`relative h-20 w-20`,children:[(0,G.jsxs)(`svg`,{className:`h-20 w-20 -rotate-90`,viewBox:`0 0 80 80`,children:[(0,G.jsx)(`circle`,{cx:`40`,cy:`40`,r:`36`,fill:`none`,stroke:`currentColor`,className:`text-surface-container/30`,strokeWidth:`6`}),(0,G.jsx)(`circle`,{cx:`40`,cy:`40`,r:`36`,fill:`none`,stroke:r,strokeWidth:`6`,strokeLinecap:`round`,strokeDasharray:a,strokeDashoffset:o,className:`transition-all duration-700`})]}),(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,G.jsxs)(`span`,{className:`text-sm font-semibold font-mono text-on-surface`,children:[i,`%`]})})]}),(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant text-center font-sans`,children:e})]})}function p0({label:e,value:t}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant font-sans`,children:e}),(0,G.jsx)(`span`,{className:`text-xs font-mono text-on-surface`,children:t})]})}function m0({stats:e}){let t=e.embedding.total_embeddable>0?e.embedding.embedded_count:0,n=e.embedding.total_embeddable;return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(`h2`,{className:`text-xs font-semibold text-on-surface-variant uppercase tracking-widest flex items-center gap-2 font-sans`,children:[(0,G.jsx)(oo,{className:`h-3.5 w-3.5`}),`System Health`]}),(0,G.jsxs)(`div`,{className:`flex justify-center gap-8 py-2`,children:[(0,G.jsx)(f0,{label:`Embedding Coverage`,value:t,max:n,color:`#abcfb8`}),(0,G.jsx)(f0,{label:`Queue Health`,value:Math.max(0,n-e.embedding.queue_depth),max:n,color:`#edbf7f`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-6 gap-y-0`,children:[(0,G.jsx)(p0,{label:`Sessions`,value:String(e.vault.session_count)}),(0,G.jsx)(p0,{label:`Spores`,value:String(e.vault.spore_count)}),(0,G.jsx)(p0,{label:`Entities`,value:String(e.vault.entity_count)}),(0,G.jsx)(p0,{label:`Graph edges`,value:String(e.vault.edge_count)}),(0,G.jsx)(p0,{label:`Uptime`,value:HA(e.daemon.uptime_seconds)}),(0,G.jsx)(p0,{label:`Daemon`,value:`v${e.daemon.version} :${e.daemon.port}`}),e.agent.last_run_at!==null&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(p0,{label:`Last run`,value:WA(e.agent.last_run_at)}),(0,G.jsx)(p0,{label:`Total runs`,value:String(e.agent.total_runs)})]}),e.digest.freshest_tier!==null&&(0,G.jsx)(p0,{label:`Digest tier`,value:`T${e.digest.freshest_tier}`})]})]})}function h0(){let{effective:e,isLoading:t}=Na(),{data:n,isLoading:r}=Zs(),{data:i,isLoading:a}=Jk(),o=i?.tasks??[],[s,c]=(0,W.useState)(null),l=o.find(e=>e.isDefault)?.name??``,u=s??l,d=(0,W.useCallback)(e=>{c(e)},[]),f=!!e?.agent?.provider;return t||!e?(0,G.jsx)(`div`,{className:`space-y-4`,children:[1,2,3].map(e=>(0,G.jsx)(`div`,{className:`h-32 rounded-md animate-pulse bg-surface-container-low`},e))}):(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Q,{id:Ya.agentOperations,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300`,children:[(0,G.jsx)(Qj,{children:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ys,{className:`h-4 w-4 text-primary`}),`Agent Operations`]})}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(_N,{path:`agent.scheduled_tasks_enabled`,label:`Scheduled Tasks`,defaultScope:`grove`,allowPersonal:!1,hint:`runs intelligence/skill-survey/skill-evolve on a cron`,children:({value:e,onChange:t})=>(0,G.jsx)(lN,{checked:e??!0,onCheckedChange:t,disabled:!f})}),(0,G.jsx)(_N,{path:`agent.event_tasks_enabled`,label:`Event-Driven Tasks`,defaultScope:`grove`,allowPersonal:!1,hint:`titles + summaries on session end`,children:({value:e,onChange:t})=>(0,G.jsx)(lN,{checked:e??!0,onCheckedChange:t,disabled:!f})})]}),!f&&(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant/70`,children:[`Configure an agent provider in`,` `,(0,G.jsx)(ri,{to:`/settings`,className:`underline hover:text-on-surface transition-colors`,children:`Settings`}),` `,`to enable agent tasks.`]}),(0,G.jsx)(`div`,{className:`border-t border-outline-variant/20`}),(0,G.jsx)(_N,{path:`agent.summary_batch_interval`,label:`Title & Summary Batch Interval`,defaultScope:`grove`,commitOn:`blur`,hint:`batches between event-driven summary triggers; 0 disables`,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(cp,{type:`number`,min:0,placeholder:`5`,value:e??``,onChange:e=>t(Number(e.target.value)),onBlur:n,className:`w-32 font-mono`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:`batches`})]})}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Default Task`}),a?(0,G.jsxs)(`div`,{className:`flex h-9 items-center gap-2 text-on-surface-variant font-sans text-sm`,children:[(0,G.jsx)(es,{className:`h-4 w-4 animate-spin`}),`Loading tasks...`]}):(0,G.jsxs)(w_,{value:u,onValueChange:d,children:[(0,G.jsx)(E_,{children:(0,G.jsx)(T_,{placeholder:`Select default task`})}),(0,G.jsx)(D_,{children:o.map(e=>(0,G.jsx)(O_,{value:e.name,children:e.displayName},e.name))})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`The task used when Run Now is clicked or no task is specified.`})]})]}),r?(0,G.jsx)(Q,{level:`low`,className:`p-6`,children:(0,G.jsx)(`div`,{className:`h-32 animate-pulse rounded-md bg-surface-container`})}):n?(0,G.jsx)(Q,{level:`low`,className:`p-6`,children:(0,G.jsx)(m0,{stats:n})}):null]})}var g0={sage:`border-t-sage`,ochre:`border-t-ochre`,terracotta:`border-t-terracotta`,outline:`border-t-outline`},_0={sage:`text-sage`,ochre:`text-ochre`,terracotta:`text-terracotta`,outline:`text-on-surface`};function v0({label:e,value:t,sublabel:n,accent:r,sparklineData:i,className:a,href:o}){let s=J(`rounded-lg border border-outline-variant/10 bg-surface-container/60 p-4 border-t-2 transition-[border-color,background-color] duration-200 hover:border-outline-variant/25 hover:bg-surface-container/80`,o&&`cursor-pointer`,g0[r],a),c=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-wider text-outline mb-2`,children:e}),(0,G.jsxs)(`div`,{className:`flex items-end justify-between gap-2`,children:[(0,G.jsx)(`p`,{className:J(`font-serif text-2xl font-bold`,_0[r]),children:t}),i&&i.length>=2&&(0,G.jsx)(IA,{data:i,widthPx:80,heightPx:28,className:`opacity-60`})]}),n&&(0,G.jsx)(`p`,{className:`font-mono text-[10px] text-outline mt-1`,children:n})]});return o?(0,G.jsx)(ri,{to:o,className:J(s,`block no-underline`),children:c}):(0,G.jsx)(`div`,{className:s,children:c})}var y0=`(task default)`;function b0(e){return e.reasoning_level??`(task default)`}function x0(e){let t=[];return S0(e.harness)&&t.push(String(e.harness)),S0(e.reasoningLevel)&&t.push(String(e.reasoningLevel)),S0(e.model)&&t.push(String(e.model)),t.length===0?`default`:t.join(` / `)}function S0(e){return!(e==null||e===``||e===`(task default)`)}function C0(e,t){return e==null||!Number.isFinite(e)||t<=0?null:Math.round(e/t*1e4)/1e4}function w0(e,t){let n=null,r=null,i=null,a=null;for(let o=0;o<e.length;o++){let s=e[o],c=x0({harness:s.harness,reasoningLevel:t[o],model:s.model});s.cost_usd!==null&&s.cost_usd!==void 0&&Number.isFinite(s.cost_usd)&&((n===null||s.cost_usd<n.run.cost_usd)&&(n={run:s,label:c}),(r===null||s.cost_usd>r)&&(r=s.cost_usd));let l=s.write_intents?.total??0;l>0&&(i===null||l>(i.run.write_intents?.total??0))&&(i={run:s,label:c}),s.duration_ms!==null&&s.duration_ms!==void 0&&Number.isFinite(s.duration_ms)&&(a===null||s.duration_ms<a.run.duration_ms)&&(a={run:s,label:c})}let o=n&&r!==null&&r>0?Math.round((n.run.cost_usd??0)/r*100):null;return{cheapest:n,cheapestPct:o,mostWrites:i,fastest:a}}function T0(e){let t=Object.entries(e);return t.length===0?``:(t.sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])),t.map(([e,t])=>`${E0(e)}×${t}`).join(`, `))}function E0(e){let t=e.split(`_`);if(t.length<=1)return e;let n=t[t.length-1];return n.length<3?e:n}function D0(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function O0(e){let t=b1(e,D0)?.phases;if(!Array.isArray(t)||t.length===0)return null;let n=0,r=!1;for(let e of t)typeof e.turnsUsed==`number`&&Number.isFinite(e.turnsUsed)&&(n+=e.turnsUsed,r=!0);return r?n:null}var k0=new Set([`status`]);function A0(e,t){switch(t){case`harness`:return e.harness??`__missing__`;case`reasoning`:return e.reasoning_level??`__missing__`;case`model`:return e.model??`__missing__`;case`status`:return e.status;case`turns`:{let t=O0(e.usage_data);return t===null?`__missing__`:String(t)}case`tokens`:return e.tokens_used===null||e.tokens_used===void 0?`__missing__`:String(e.tokens_used);case`cost`:return e.cost_usd===null||e.cost_usd===void 0?`__missing__`:e.cost_usd.toFixed(6);case`duration`:return e.duration_ms===null||e.duration_ms===void 0?`__missing__`:String(e.duration_ms);case`writes`:return String(e.write_intents?.total??0);case`costPerWrite`:{let t=C0(e.cost_usd,e.write_intents?.total??0);return t===null?`__missing__`:t.toFixed(4)}}}function j0(e,t){if(e.length<2)return new Set(t);let n=new Set;for(let r of t){if(k0.has(r)){n.add(r);continue}let t=A0(e[0],r),i=!1;for(let n=1;n<e.length;n++)if(A0(e[n],r)!==t){i=!0;break}i&&n.add(r)}return n}var M0=`run`;function N0(e){let t=P0(e.usage_data),n=e.execution_overrides?.phases??{},r=e.reasoning_level??null,i=e.model??null;return t.length===0?[{name:M0,reasoning:r,model:i,turnsUsed:O0(e.usage_data),tokensUsed:e.tokens_used??null,costUsd:e.cost_usd??null,durationMs:e.duration_ms??null}]:t.map(e=>{let t=n[e.name];return{name:e.name,reasoning:t?.reasoningLevel??r,model:t?.model??i,turnsUsed:typeof e.turnsUsed==`number`&&Number.isFinite(e.turnsUsed)?e.turnsUsed:null,tokensUsed:typeof e.tokensUsed==`number`&&Number.isFinite(e.tokensUsed)?e.tokensUsed:null,costUsd:typeof e.costUsd==`number`&&Number.isFinite(e.costUsd)?e.costUsd:null,durationMs:typeof e.usage?.durationMs==`number`&&Number.isFinite(e.usage.durationMs)?e.usage.durationMs:null}})}function P0(e){let t=b1(e,D0)?.phases;return Array.isArray(t)?t.filter(e=>typeof e?.name==`string`):[]}function F0(e){let t=e.execution_overrides?.phases;return t?Object.keys(t).length:0}function I0(e){let t=e.execution_overrides?.phases;if(!t)return``;let n=[];for(let[e,r]of Object.entries(t)){let t=[];r?.reasoningLevel&&t.push(r.reasoningLevel),r?.model&&t.push(`model=${r.model}`),n.push(`${e}: ${t.length>0?t.join(`, `):`(no override)`}`)}return n.join(` · `)}function L0(e){let t=0,n=0,r=0,i=0,a=0;for(let o of e)o.status===`completed`?t+=1:o.status===`failed`?n+=1:o.status===`skipped`&&(r+=1),typeof o.tokens_used==`number`&&Number.isFinite(o.tokens_used)&&(i+=o.tokens_used),typeof o.cost_usd==`number`&&Number.isFinite(o.cost_usd)&&(a+=o.cost_usd);return{total:e.length,completed:t,failed:n,skipped:r,totalTokens:i,totalCostUsd:a}}function R0(e){if(e.length<2)return{show:!1,spanMinutes:0,differentTasks:!1};let t=null,n=null,r=new Set;for(let i of e){i.task!==null&&i.task!==void 0?r.add(i.task):r.add(`__null_task__`);let e=i.started_at;typeof e==`number`&&Number.isFinite(e)&&((t===null||e<t)&&(t=e),(n===null||e>n)&&(n=e))}let i=t!==null&&n!==null?n-t:0,a=Math.floor(i/60),o=r.size>1;return{show:a>5||o,spanMinutes:a,differentTasks:o}}function z0(e){let t=Math.max(0,Math.floor(e));if(t<60)return`${t} ${t===1?`minute`:`minutes`}`;let n=Math.floor(t/60);if(n<24)return`${n} ${n===1?`hour`:`hours`}`;let r=Math.floor(n/24);return`${r} ${r===1?`day`:`days`}`}function B0(e){if(e.length===0)return{sameInput:null};let t=e.map(e=>({runId:e.id,inputs:w$(e.instruction)}));if(!t.some(e=>Object.keys(e.inputs).length>0))return{sameInput:null};let n=t[0].inputs,r=t.every(e=>V0(e.inputs,n)),i=Object.keys(n).length>0;return r&&i?{sameInput:!0,inputs:n}:{sameInput:!1,perRun:t}}function V0(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}var H0=[`harness`,`reasoning`,`model`,`status`,`turns`,`tokens`,`cost`,`duration`,`writes`,`costPerWrite`],U0={harness:`Runtime`,reasoning:`Reasoning`,model:`Model`,status:`Status`,turns:`Turns`,tokens:`Tokens`,cost:`Cost`,duration:`Duration`,writes:`Writes`,costPerWrite:`$/write`},W0=32;function G0({runs:e,isLoading:t,isError:n,errorMessage:r,onBack:i,onOpenRun:a,title:o=`Comparison`,subtitle:s,aggregate:c,metadataSlot:l,backLabel:u=`Back`}){let d=(0,W.useMemo)(()=>c??L0(e),[c,e]),f=(0,W.useMemo)(()=>e.map(e=>b0(e)),[e]),p=(0,W.useMemo)(()=>w0(e,f),[e,f]),m=(0,W.useMemo)(()=>R0(e),[e]),h=(0,W.useMemo)(()=>B0(e),[e]),{data:g}=Jk(),_=(0,W.useMemo)(()=>{let e=new Map;for(let t of g?.tasks??[])e.set(t.name,t.displayName);return e},[g]),v=(0,W.useMemo)(()=>Z0(e,_),[e,_]),[y,b]=(0,W.useState)(!1),[x,S]=(0,W.useState)(new Set),C=(0,W.useCallback)(e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),w=(0,W.useMemo)(()=>y?j0(e,H0):new Set(H0),[y,e]),T=(0,W.useMemo)(()=>e.some(e=>F0(e)>0),[e]);if(t&&e.length===0)return(0,G.jsxs)(`div`,{className:`flex h-64 items-center justify-center gap-2 text-on-surface-variant`,children:[(0,G.jsx)(es,{className:`h-5 w-5 animate-spin`}),(0,G.jsx)(`span`,{className:`font-sans`,children:`Loading runs...`})]});if(n)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),u]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load runs`}),r&&(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:r})]})]});let E=e.length>1,D=e.length>1,O=s??`${e.length} ${e.length===1?`run`:`runs`}`,k=w.size+2;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),u]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h1`,{className:`font-serif text-xl text-on-surface`,children:o}),O&&(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:O})]}),m.show&&m.spanMinutes>5&&(0,G.jsxs)(Q,{level:`low`,className:`flex items-start gap-2 p-3 border border-outline-variant/40`,children:[(0,G.jsx)(js,{className:`h-4 w-4 mt-0.5 text-secondary shrink-0`,"aria-hidden":!0}),(0,G.jsxs)(`div`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Runs span `,z0(m.spanMinutes),` of vault activity — results may reflect different vault states. Consider running with the same input (session_id, batch_id) for apples-to-apples comparison.`]})]}),(v.kind!==`none`||h.sameInput!==null)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v.kind===`single`&&(0,G.jsxs)(X,{variant:`outline`,className:`text-xs`,children:[`Task: `,v.label]}),v.kind===`mixed`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(X,{variant:`warning`,className:`text-xs`,title:v.tooltip,children:[`Tasks: `,v.count]}),(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(js,{className:`h-3 w-3 inline`,"aria-hidden":!0}),`Runs span multiple tasks — mechanical metrics are still comparable but output semantics differ.`]})]}),h.sameInput===!0&&(0,G.jsxs)(X,{variant:`default`,className:`gap-1 text-xs`,title:$0(h.inputs),children:[(0,G.jsx)(So,{className:`h-3 w-3`,"aria-hidden":!0}),`Same input: `,Q0(h.inputs)]}),h.sameInput===!1&&(0,G.jsxs)(X,{variant:`warning`,className:`gap-1 text-xs`,children:[(0,G.jsx)(js,{className:`h-3 w-3 inline`,"aria-hidden":!0}),`Different inputs — each run targeted different data`]})]}),l,(0,G.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4`,children:[(0,G.jsx)(v0,{label:`Runs`,value:String(d.total),accent:`outline`}),(0,G.jsx)(v0,{label:`Completed`,value:String(d.completed),accent:`sage`}),(0,G.jsx)(v0,{label:`Failed`,value:String(d.failed),accent:`terracotta`}),(0,G.jsx)(v0,{label:`Skipped`,value:String(d.skipped),accent:`outline`}),(0,G.jsx)(v0,{label:`Tokens`,value:s1(d.totalTokens),accent:`ochre`}),(0,G.jsx)(v0,{label:`Cost`,value:o1(d.totalCostUsd,`actual`),accent:`ochre`})]}),E&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[p.cheapest?(0,G.jsx)(t2,{label:`Cheapest`,cell:p.cheapest.label,value:`${o1(p.cheapest.run.cost_usd,`actual`)}${p.cheapestPct===null?``:` (${p.cheapestPct}% of most expensive)`}`}):null,p.mostWrites?(0,G.jsx)(t2,{label:`Most writes`,cell:p.mostWrites.label,value:`${p.mostWrites.run.write_intents.total} intents`}):null,p.fastest?(0,G.jsx)(t2,{label:`Fastest`,cell:p.fastest.label,value:ZA(p.fastest.run.duration_ms)}):null]}),T&&(0,G.jsx)(`p`,{className:`font-sans text-xs italic text-on-surface-variant`,children:`Some runs use phase-level overrides — expand rows to see per-phase differences.`}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,G.jsx)(`h2`,{className:`font-sans text-sm font-medium text-on-surface-variant uppercase tracking-wide`,children:`Run comparison`}),D&&(0,G.jsx)(Y,{variant:y?`secondary`:`ghost`,size:`sm`,onClick:()=>b(e=>!e),className:`gap-2 text-xs`,"aria-pressed":y,children:`Show only varying dimensions`})]}),e.length===0?(0,G.jsx)(Q,{level:`low`,className:`flex h-24 items-center justify-center`,children:(0,G.jsx)(`span`,{className:`font-sans text-sm text-on-surface-variant`,children:t?`Loading runs...`:`No runs to compare`})}):(0,G.jsx)(`div`,{className:`rounded-md bg-surface-container-low overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full`,"aria-label":`Run comparison`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/20 bg-surface-container/50`,children:[(0,G.jsx)(K0,{}),H0.filter(e=>w.has(e)).map(e=>(0,G.jsx)(K0,{children:U0[e]},e)),(0,G.jsx)(K0,{children:``})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsx)(q0,{run:e,expanded:x.has(e.id),onToggleExpanded:C,onOpenRun:a,visibleColumns:w,colSpan:k},e.id))})]})})]})]})}function K0({children:e}){return(0,G.jsx)(`th`,{className:`px-3 py-2 text-left text-[11px] font-medium text-on-surface-variant uppercase tracking-widest font-sans whitespace-nowrap`,children:e})}var q0=(0,W.memo)(function({run:e,expanded:t,onToggleExpanded:n,onOpenRun:r,visibleColumns:i,colSpan:a}){let o=(0,W.useMemo)(()=>({turnsTotal:O0(e.usage_data),costPerWrite:C0(e.cost_usd,e.write_intents.total),byToolLabel:T0(e.write_intents.by_tool),reasoning:b0(e),phaseOverrideCount:F0(e),phaseOverrideTooltip:I0(e)}),[e]),s=(0,W.useMemo)(()=>t?N0(e):[],[t,e]),c=(0,W.useCallback)(()=>n(e.id),[n,e.id]),l=(0,W.useCallback)(()=>r(e.id),[r,e.id]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/10 last:border-0 hover:bg-surface-container-high/40 transition-colors`,children:[(0,G.jsx)(Y0,{children:(0,G.jsx)(`button`,{type:`button`,onClick:c,"aria-expanded":t,"aria-label":t?`Collapse phase breakdown`:`Expand phase breakdown`,className:`flex items-center justify-center text-on-surface-variant hover:text-on-surface transition-colors`,children:t?(0,G.jsx)(ho,{className:`h-4 w-4`}):(0,G.jsx)(_o,{className:`h-4 w-4`})})}),i.has(`harness`)&&(0,G.jsx)(Y0,{children:e.harness||(0,G.jsx)(X0,{})}),i.has(`reasoning`)&&(0,G.jsx)(Y0,{children:o.reasoning===`(task default)`?(0,G.jsx)(X0,{}):o.reasoning}),i.has(`model`)&&(0,G.jsx)(Y0,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{children:e.model||(0,G.jsx)(X0,{})}),o.phaseOverrideCount>0&&(0,G.jsxs)(X,{variant:`secondary`,className:`text-[10px]`,title:o.phaseOverrideTooltip||void 0,children:[`Phases: `,o.phaseOverrideCount]})]})}),i.has(`status`)&&(0,G.jsx)(Y0,{children:(0,G.jsx)(X,{variant:c1(e.status),children:YA(e.status)})}),i.has(`turns`)&&(0,G.jsx)(Y0,{children:o.turnsTotal===null?`—`:o.turnsTotal}),i.has(`tokens`)&&(0,G.jsx)(Y0,{children:s1(e.tokens_used)}),i.has(`cost`)&&(0,G.jsx)(Y0,{children:o1(e.cost_usd,`actual`)}),i.has(`duration`)&&(0,G.jsx)(Y0,{children:ZA(e.duration_ms)}),i.has(`writes`)&&(0,G.jsx)(Y0,{children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{children:e.write_intents.total}),o.byToolLabel&&(0,G.jsx)(`span`,{className:`font-sans text-[10px] text-on-surface-variant`,children:o.byToolLabel})]})}),i.has(`costPerWrite`)&&(0,G.jsx)(Y0,{children:o.costPerWrite===null?`—`:`$${o.costPerWrite.toFixed(4)}`}),(0,G.jsx)(Y0,{children:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`gap-1 h-7 text-on-surface-variant`,onClick:l,children:[(0,G.jsx)(Po,{className:`h-3 w-3`}),`View run`]})})]}),t&&(0,G.jsx)(`tr`,{className:`bg-surface-container/30 border-b border-outline-variant/10 last:border-0`,children:(0,G.jsx)(`td`,{colSpan:a,className:`px-3 py-3`,children:(0,G.jsx)(J0,{phases:s})})})]})},(e,t)=>e.run===t.run&&e.expanded===t.expanded&&e.visibleColumns===t.visibleColumns&&e.colSpan===t.colSpan&&e.onToggleExpanded===t.onToggleExpanded&&e.onOpenRun===t.onOpenRun);function J0({phases:e}){return e.length===0?(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant italic`,children:`No phase data available.`}):(0,G.jsx)(`div`,{className:`rounded-xs bg-surface-container-low/60 overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full`,"aria-label":`Phase breakdown`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/20`,children:[(0,G.jsx)(K0,{children:`Phase`}),(0,G.jsx)(K0,{children:`Reasoning`}),(0,G.jsx)(K0,{children:`Model`}),(0,G.jsx)(K0,{children:`Turns`}),(0,G.jsx)(K0,{children:`Tokens`}),(0,G.jsx)(K0,{children:`Cost`}),(0,G.jsx)(K0,{children:`Duration`})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/10 last:border-0`,children:[(0,G.jsx)(Y0,{children:e.name}),(0,G.jsx)(Y0,{children:e.reasoning??(0,G.jsx)(X0,{})}),(0,G.jsx)(Y0,{children:e.model??(0,G.jsx)(X0,{})}),(0,G.jsx)(Y0,{children:e.turnsUsed===null?`—`:e.turnsUsed}),(0,G.jsx)(Y0,{children:s1(e.tokensUsed)}),(0,G.jsx)(Y0,{children:o1(e.costUsd,`actual`)}),(0,G.jsx)(Y0,{children:ZA(e.durationMs)})]},e.name))})]})})}function Y0({children:e}){return(0,G.jsx)(`td`,{className:`px-3 py-2 font-mono text-xs text-on-surface whitespace-nowrap`,children:e})}function X0(){return(0,G.jsx)(`span`,{className:`font-sans text-[11px] italic text-on-surface-variant`,children:y0})}function Z0(e,t){let n=new Set;for(let t of e)t.task&&n.add(t.task);if(n.size===0)return{kind:`none`};if(n.size===1){let[e]=n;return{kind:`single`,label:t.get(e)??e}}let r=[...n].map(e=>t.get(e)??e).sort();return{kind:`mixed`,count:n.size,tooltip:r.join(`, `)}}function Q0(e){let t=Object.entries(e).filter(e=>!!e[1]);return t.length===0?``:t.map(([e,t])=>`${e}=${e2(t)}`).join(`, `)}function $0(e){return Object.entries(e).filter(e=>!!e[1]).map(([e,t])=>`${e}=${t}`).join(`, `)}function e2(e){return e.length<=W0?e:`${e.slice(0,W0-1)}…`}function t2({label:e,cell:t,value:n}){return(0,G.jsxs)(Q,{level:`low`,className:`px-3 py-2 flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`span`,{className:`font-sans font-medium text-on-surface-variant uppercase tracking-wide text-[10px]`,children:e}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:t}),(0,G.jsxs)(`span`,{className:`font-mono text-on-surface-variant`,children:[`— `,n]})]})}var n2=`tab`,r2=`task`,i2=`runs`,a2=new Set([`runs`,`tasks`,`config`,`comparisons`]),o2={evaluations:`comparisons`};function s2(e){if(!e)return;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return t.length>0?t:void 0}function c2(e){let t=e.get(n2),n=`runs`;return t&&(a2.has(t)?n=t:o2[t]&&(n=o2[t])),{tab:n,taskId:e.get(r2)??void 0,compareRunIds:s2(e.get(i2))}}function l2({tab:e,taskId:t,compareRunIds:n}){let r=new URLSearchParams;return e!==`runs`&&r.set(n2,e),t&&r.set(r2,t),n&&n.length>0&&r.set(i2,n.join(`,`)),r}var u2=[{id:`runs`,label:`Runs`,description:`execution log`},{id:`tasks`,label:`Tasks`,description:`task library`},{id:`comparisons`,label:`Comparisons`,description:`side-by-side`},{id:`config`,label:`Config`,description:`agent settings`}];function d2({runIds:e,onBack:t,onOpenRun:n}){let{runs:r,isLoading:i,isError:a,errors:o}=sA(e);return(0,G.jsx)(G0,{runs:r,isLoading:i,isError:a,errorMessage:o[0]?.message,onBack:t,onOpenRun:n,title:`Comparison`,subtitle:`${e.length} ${e.length===1?`run`:`runs`}`,backLabel:`Comparisons`})}function f2(){let{id:e}=Ln(),t=Nn(),n=An(),[r]=di(),i=(0,W.useMemo)(()=>c2(r),[r]),a=e?`runs`:i.tab,{taskId:o,compareRunIds:s}=i,[c,l]=(0,W.useState)(!1),u=(0,W.useMemo)(()=>{if(e){let t=`/${e}`;if(n.pathname.endsWith(t))return n.pathname.slice(0,-t.length)}return n.pathname},[n.pathname,e]);(0,W.useEffect)(()=>{let r=new URLSearchParams(n.search),i=r.get(`run`),a=r.get(n2),o=a?o2[a]:void 0,s=n.pathname,c=!1;if(i&&!e&&(r.delete(`run`),s=`${u}/${i}`,c=!0),o&&(o===`runs`?r.delete(n2):r.set(n2,o),c=!0),c){let e=r.toString();t(`${s}${e?`?${e}`:``}`,{replace:!0})}},[]);let d=(0,W.useCallback)((e,n,r)=>{let i=l2({tab:e,taskId:n,compareRunIds:r}).toString();t(i?`${u}?${i}`:u)},[u,t]),f=(0,W.useCallback)((e,n)=>{t(`${u}/${e}`,n)},[u,t]),p=(0,W.useCallback)(e=>{d(e)},[d]),m;return a===`runs`&&(m=(0,G.jsxs)(Y,{variant:`outline`,size:`sm`,className:`gap-2`,onClick:()=>l(!0),children:[(0,G.jsx)(us,{className:`h-3.5 w-3.5`}),`Run Now`]})),(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsxs)(`div`,{className:`shrink-0 p-6 pb-0 space-y-6`,children:[(0,G.jsx)(cN,{title:`Agent`,subtitle:`Intelligence runs, task configuration, and operational settings`,actions:m}),(0,G.jsx)(qN,{tabs:u2.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:a,onTabChange:p,columns:4})]}),a===`runs`&&(0,G.jsx)(`div`,{className:`flex-1 min-h-0 mt-4`,children:(0,G.jsx)(wj,{hasSelection:!!e,onCloseMobileDetail:()=>t(u),masterAriaLabel:`Agent runs`,detailAriaLabel:`Run details`,master:(0,G.jsx)(_1,{selectedId:e,onSelectRun:f,onTriggerRun:()=>l(!0),onCompareRuns:e=>d(`comparisons`,void 0,e)}),detail:e?(0,G.jsx)(G1,{runId:e,onBack:()=>t(u)}):(0,G.jsx)(Tj,{message:`Select a run to see its details.`})})}),a===`tasks`&&(0,G.jsx)(`div`,{className:`p-6 pt-4 space-y-4`,children:o?(0,G.jsx)(d0,{taskId:o,onBack:()=>d(`tasks`),onNavigate:e=>d(`tasks`,e),onRunTriggered:e=>{e&&f(e)}}):(0,G.jsx)(Y1,{onSelect:e=>d(`tasks`,e)})}),a===`comparisons`&&(0,G.jsx)(`div`,{className:`p-6 pt-4 space-y-4`,children:s&&s.length>0?(0,G.jsx)(d2,{runIds:s,onBack:()=>d(`comparisons`),onOpenRun:e=>f(e)}):(0,G.jsxs)(Q,{level:`low`,className:`p-8 text-center space-y-2`,children:[(0,G.jsx)(`h2`,{className:`font-serif text-lg text-on-surface`,children:`Compare selected runs`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Select two or more runs in the Runs tab and use "Compare selected" to see them side by side here.`}),(0,G.jsx)(Y,{variant:`outline`,size:`sm`,className:`mt-2`,onClick:()=>d(`runs`),children:`Go to Runs`})]})}),a===`config`&&(0,G.jsx)(`div`,{className:`p-6 pt-4 space-y-4`,children:(0,G.jsx)(h0,{})}),(0,G.jsx)(a1,{open:c,onOpenChange:l,onTriggered:e=>{e&&f(e)}})]})}var p2={IDENTIFIED:`identified`,APPROVED:`approved`,GENERATED:`generated`,DISMISSED:`dismissed`,DEFERRED:`deferred`},m2=`${p2.APPROVED},${p2.GENERATED}`,h2=[{key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:p2.IDENTIFIED,label:`Identified`},{value:m2,label:`Approved & generated`},{value:p2.APPROVED,label:`Awaiting generation`},{value:p2.GENERATED,label:`Generated`},{value:p2.DEFERRED,label:`Deferred`},{value:p2.DISMISSED,label:`Dismissed`}]}];function g2(e){let t=`${(e*100).toFixed(0)}%`;return e>=.85?{text:t,variant:`default`}:e>=.7?{text:t,variant:`secondary`}:{text:t,variant:`outline`}}function _2(e){let t=Math.floor(Date.now()/1e3)-e;return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function v2(e){switch(e){case p2.IDENTIFIED:return(0,G.jsx)(X,{variant:`outline`,children:`Identified`});case p2.APPROVED:return(0,G.jsx)(X,{variant:`secondary`,children:`Awaiting generation`});case p2.GENERATED:return(0,G.jsx)(X,{variant:`default`,children:`Generated`});case p2.DEFERRED:return(0,G.jsx)(X,{variant:`outline`,children:`Deferred`});case p2.DISMISSED:return(0,G.jsx)(X,{variant:`outline`,className:`opacity-50`,children:`Dismissed`});default:return(0,G.jsx)(X,{variant:`outline`,children:e})}}function y2(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function b2(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||typeof t.type!=`string`?null:`${t.type}:${t.id}`}function x2({label:e,values:t}){return t.length===0?null:(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`dt`,{className:`text-on-surface-variant`,children:e}),(0,G.jsx)(`dd`,{className:`mt-1 flex flex-wrap gap-1.5`,children:t.map(e=>(0,G.jsx)(`code`,{className:`max-w-full truncate rounded border border-outline-variant/40 bg-surface-container px-1.5 py-0.5 font-mono text-[11px] text-on-surface`,title:e,children:e},e))})]})}function S2({candidate:e}){let t=y2(e.source_ids).map(b2).filter(e=>!!e),n=y2(e.quality_failures).filter(e=>typeof e==`string`),r=y2(e.coverage_matches).filter(e=>typeof e==`string`),i=typeof e.quality_score==`number`&&Number.isFinite(e.quality_score)?e.quality_score:null;return e.evidence_bundle_id||i!==null||n.length>0||r.length>0||t.length>0||e.reconciliation_reason?(0,G.jsxs)(`details`,{className:`group font-sans text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`summary`,{className:`flex cursor-pointer list-none flex-wrap items-center gap-2 [&::-webkit-details-marker]:hidden`,children:[i!==null&&(0,G.jsxs)(X,{variant:i>=.7?`secondary`:`outline`,children:[`Quality `,(i*100).toFixed(0),`%`]}),e.evidence_bundle_id&&(0,G.jsxs)(X,{variant:`outline`,className:`max-w-[240px] truncate`,title:e.evidence_bundle_id,children:[`Bundle `,e.evidence_bundle_id]}),t.length>0&&(0,G.jsxs)(X,{variant:`outline`,title:t.join(`, `),children:[t.length,` source`,t.length===1?``:`s`]}),r.length>0&&(0,G.jsxs)(X,{variant:`outline`,title:r.join(`, `),children:[r.length,` overlap`,r.length===1?``:`s`]}),n.slice(0,3).map(e=>(0,G.jsx)(X,{variant:`outline`,className:`opacity-70`,children:e},e)),n.length>3&&(0,G.jsxs)(X,{variant:`outline`,className:`opacity-70`,children:[`+`,n.length-3,` more`]}),(0,G.jsx)(`span`,{className:`text-on-surface-variant underline-offset-2 group-open:underline`,children:`Evidence details`})]}),(0,G.jsxs)(`dl`,{className:`mt-3 grid gap-3 border-l border-outline-variant/40 pl-3 sm:grid-cols-2`,children:[e.evidence_bundle_id&&(0,G.jsx)(x2,{label:`Bundle`,values:[e.evidence_bundle_id]}),(0,G.jsx)(x2,{label:`Sources`,values:t}),(0,G.jsx)(x2,{label:`Coverage matches`,values:r}),(0,G.jsx)(x2,{label:`Quality failures`,values:n}),e.reconciliation_reason&&(0,G.jsxs)(`div`,{className:`min-w-0 sm:col-span-2`,children:[(0,G.jsx)(`dt`,{className:`text-on-surface-variant`,children:`Latest reconciliation`}),(0,G.jsx)(`dd`,{className:`mt-1 leading-relaxed text-on-surface`,children:e.reconciliation_reason})]})]})]}):null}function C2({candidate:e,onApprove:t,onDefer:n,onDismiss:r,isApproving:i,isDeferring:a,isDismissing:o}){let s=g2(e.confidence),c=e.status===p2.IDENTIFIED||e.status===p2.APPROVED;return(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(`h3`,{className:`font-serif text-lg text-on-surface leading-tight`,children:e.topic}),e.approved_at!==null&&(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant mt-1`,children:[`Approved `,_2(e.approved_at),e.status===p2.GENERATED&&` · generated`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[v2(e.status),(0,G.jsx)(X,{variant:s.variant,children:s.text}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:_2(e.created_at)})]})]}),(0,G.jsx)(uO,{content:e.rationale,className:`text-sm text-on-surface-variant`}),(0,G.jsx)(S2,{candidate:e}),c&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[e.status===p2.IDENTIFIED&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{size:`sm`,variant:`default`,onClick:t,disabled:i,children:[(0,G.jsx)(mo,{className:`h-3.5 w-3.5 mr-1.5`}),i?`Approving...`:`Approve`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,onClick:n,disabled:a,className:`text-on-surface-variant`,children:[(0,G.jsx)(Eo,{className:`h-3.5 w-3.5 mr-1.5`}),a?`Deferring...`:`Defer`]}),(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,onClick:r,disabled:o,className:`text-on-surface-variant`,children:[(0,G.jsx)(wo,{className:`h-3.5 w-3.5 mr-1.5`}),o?`Dismissing...`:`Dismiss`]})]}),e.status===p2.APPROVED&&(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:`Awaiting generation`})]})]})}function w2(){return(0,G.jsxs)(Q,{level:`low`,className:`p-5 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,G.jsx)(`div`,{className:`h-5 w-64 rounded bg-surface-container-high animate-pulse`}),(0,G.jsx)(`div`,{className:`h-5 w-20 rounded bg-surface-container-high animate-pulse`})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`div`,{className:`h-3 w-full rounded bg-surface-container-high animate-pulse`}),(0,G.jsx)(`div`,{className:`h-3 w-3/4 rounded bg-surface-container-high animate-pulse`})]}),(0,G.jsx)(`div`,{className:`h-8 w-32 rounded bg-surface-container-high animate-pulse`})]})}function T2(){let e=lA(),{searchInput:t,debouncedSearch:n,filterValues:r,offset:i,setOffset:a,handleSearchChange:o,handleFilterChange:s,activeFilter:c}=aN({initialFilters:{status:p2.IDENTIFIED}}),l=c(`status`),{data:u,isLoading:d,isError:f,error:p}=cA({status:l,limit:50,offset:i}),m=u?.candidates??[],h=u?.total??0,g=(0,W.useMemo)(()=>{if(!n)return m;let e=n.toLowerCase();return m.filter(t=>t.topic.toLowerCase().includes(e)||t.rationale.toLowerCase().includes(e))},[m,n]);function _(t){e.mutate({id:t.id,status:p2.APPROVED})}function v(t){e.mutate({id:t.id,status:p2.DEFERRED})}function y(t){e.mutate({id:t.id,status:p2.DISMISSED})}let b=(0,G.jsx)(Ej,{searchPlaceholder:`Search candidates by title or rationale...`,searchValue:t,onSearchChange:o,filters:h2,filterValues:r,onFilterChange:s});return f?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[b,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load candidates`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:p instanceof Error?p.message:`Unknown error`})]})]}):d?(0,G.jsxs)(`div`,{className:`space-y-3`,children:[b,Array.from({length:3}).map((e,t)=>(0,G.jsx)(w2,{},t))]}):(0,G.jsxs)(`div`,{className:`space-y-3`,children:[b,g.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-3 text-on-surface-variant`,children:[(0,G.jsx)($o,{className:`h-10 w-10 opacity-20`}),h===0&&!l&&!n?(0,G.jsxs)(`div`,{className:`text-center space-y-2 max-w-md`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`No skill candidates discovered yet`}),(0,G.jsx)(`p`,{className:`font-sans text-xs leading-relaxed`,children:`Candidates are procedural patterns discovered from your vault knowledge. Review and approve them here, then Myco generates full skills from them.`}),(0,G.jsxs)(`div`,{className:`font-sans text-xs space-y-1 pt-1`,children:[(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Automatic:`}),` `,`The`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-survey`,className:`text-primary hover:underline`,children:`Skill Survey`}),` `,`task runs automatically during idle periods and discovers candidates from session history, decisions, and gotchas.`]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Manual:`}),` `,`Run`,` `,(0,G.jsxs)(ri,{to:`/agent?tab=tasks&task=skill-survey`,className:`inline-flex items-center gap-1 text-primary hover:underline`,children:[(0,G.jsx)(Po,{className:`h-3 w-3`}),`Skill Survey`]}),` `,`from the Agent page to discover candidates on demand.`]})]})]}):(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No matching candidates`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:n?`${g.length} of ${h} candidate${h===1?``:`s`}`:`${h} candidate${h===1?``:`s`}`}),g.map(t=>(0,G.jsx)(C2,{candidate:t,onApprove:()=>_(t),onDefer:()=>v(t),onDismiss:()=>y(t),isApproving:e.isPending&&e.variables?.id===t.id&&e.variables?.status===p2.APPROVED,isDeferring:e.isPending&&e.variables?.id===t.id&&e.variables?.status===p2.DEFERRED,isDismissing:e.isPending&&e.variables?.id===t.id&&e.variables?.status===p2.DISMISSED},t.id))]}),(0,G.jsx)(Mj,{total:n?g.length:h,offset:i,limit:50,onPageChange:a})]})}var E2=5,D2=[{key:`status`,label:`Status`,options:[{value:`all`,label:`All statuses`},{value:`active`,label:`Active`},{value:`stale`,label:`Stale`},{value:`retired`,label:`Retired`}]}];function O2(e){return e===`active`?`default`:e===`stale`?`secondary`:`outline`}function k2({children:e,className:t}){return(0,G.jsx)(`th`,{className:J(`px-4 py-3 text-left font-sans text-[10px] font-medium uppercase tracking-widest text-on-surface-variant`,t),children:e})}function A2(){return(0,G.jsxs)(`tr`,{className:`border-b border-[var(--ghost-border)]`,children:[(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-40 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-12 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-16 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-10 rounded bg-surface-container-high animate-pulse`})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`div`,{className:`h-3 w-20 rounded bg-surface-container-high animate-pulse`})})]})}function j2({record:e,onClick:t}){return(0,G.jsxs)(`tr`,{className:`border-b border-[var(--ghost-border)] last:border-0 hover:bg-surface-container/60 cursor-pointer transition-all duration-150 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/40 hover:shadow-[inset_3px_0_0_var(--primary)]`,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},tabIndex:0,role:`row`,"aria-label":`Skill: ${e.display_name}`,children:[(0,G.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface block`,children:e.display_name}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant block mt-0.5`,children:e.name})]}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsxs)(X,{variant:`outline`,className:`font-mono text-[10px] px-1.5 py-0`,children:[`gen `,e.generation]})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(X,{variant:O2(e.status),children:e.status})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:e.usage_count})}),(0,G.jsx)(`td`,{className:`px-4 py-3`,children:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:QA(e.updated_at)})})]})}function M2({onSelectSkill:e}){let{searchInput:t,debouncedSearch:n,filterValues:r,offset:i,setOffset:a,handleSearchChange:o,handleFilterChange:s,activeFilter:c}=aN({initialFilters:{status:`all`}}),l=c(`status`),{data:u,isLoading:d,isError:f,error:p}=uA({status:l,limit:50,offset:i}),m=u?.records??[],h=u?.total??0,g=n?m.filter(e=>e.display_name.toLowerCase().includes(n.toLowerCase())||e.name.toLowerCase().includes(n.toLowerCase())||e.description.toLowerCase().includes(n.toLowerCase())):m,_=(0,G.jsx)(Ej,{searchPlaceholder:`Search skills by name, slug, or description...`,searchValue:t,onSearchChange:o,filters:D2,filterValues:r,onFilterChange:s,count:h>0?`${h} ${h===1?`skill`:`skills`}`:void 0}),v=(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`border-b border-[var(--ghost-border)] bg-surface-container/50`,children:[(0,G.jsx)(k2,{children:`Name`}),(0,G.jsx)(k2,{children:`Generation`}),(0,G.jsx)(k2,{children:`Status`}),(0,G.jsx)(k2,{children:`Usage`}),(0,G.jsx)(k2,{children:`Last Evolved`})]})});return f?(0,G.jsxs)(`div`,{children:[_,(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary mt-4`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Failed to load skills`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:p instanceof Error?p.message:`Unknown error`})]})]}):(0,G.jsxs)(`div`,{children:[_,d?(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsxs)(`table`,{className:`w-full`,children:[v,(0,G.jsx)(`tbody`,{children:Array.from({length:E2}).map((e,t)=>(0,G.jsx)(A2,{},t))})]})}):g.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-3 text-on-surface-variant mt-4`,children:[(0,G.jsx)(uo,{className:`h-10 w-10 opacity-20`}),h===0&&!n&&!l?(0,G.jsxs)(`div`,{className:`text-center space-y-2 max-w-md`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`No skills generated yet`}),(0,G.jsx)(`p`,{className:`font-sans text-xs leading-relaxed`,children:`Skills are project-specific procedural guides generated from your vault knowledge. They teach agents how to accomplish tasks in this codebase.`}),(0,G.jsxs)(`div`,{className:`font-sans text-xs space-y-1 pt-1`,children:[(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Automatic:`}),` `,`The`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-survey`,className:`text-primary hover:underline`,children:`Skill Survey`}),` `,`task runs automatically and discovers candidates from your vault. Approve candidates in the`,` `,(0,G.jsx)(ri,{to:`/skills?tab=candidates`,className:`text-primary hover:underline`,children:`Candidates tab`}),`, then enable the`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-generate`,className:`text-primary hover:underline`,children:`Skill Generate`}),` `,`task to produce skills automatically.`]}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Manual:`}),` `,`Run`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-generate`,className:`text-primary hover:underline`,children:`Skill Generate`}),` `,`from the Agent page to generate a skill on demand.`]})]})]}):(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`No matching skills`})]}):(0,G.jsx)(Q,{level:`low`,className:`rounded-md overflow-hidden mt-4`,children:(0,G.jsxs)(`table`,{className:`w-full`,"aria-label":`Skills`,children:[v,(0,G.jsx)(`tbody`,{children:g.map(t=>(0,G.jsx)(j2,{record:t,onClick:()=>e(t.name)},t.id))})]})}),(0,G.jsx)(Mj,{total:h,offset:i,limit:50,onPageChange:a})]})}var N2={created:`default`,updated:`secondary`,split:`warning`,retired:`outline`};function P2({entry:e}){let[t,n]=(0,W.useState)(!1);return(0,G.jsxs)(`div`,{className:`relative pl-6`,children:[(0,G.jsx)(`div`,{className:`absolute left-0 top-2 h-2.5 w-2.5 rounded-full border-2 border-outline-variant bg-surface-container`}),(0,G.jsxs)(`button`,{type:`button`,className:`w-full text-left group cursor-pointer`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(X,{variant:`outline`,className:`font-mono text-[10px] px-1.5 py-0`,children:[`v`,e.generation]}),(0,G.jsx)(X,{variant:N2[e.action]??`outline`,children:e.action}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant ml-auto shrink-0`,children:QA(e.created_at)}),(0,G.jsx)(_o,{className:J(`h-3.5 w-3.5 text-on-surface-variant transition-transform duration-150`,t&&`rotate-90`)})]}),e.rationale&&(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant mt-1 leading-relaxed`,children:e.rationale})]}),t&&e.content_snapshot&&(0,G.jsx)(Q,{level:`lowest`,className:`mt-2 p-3 overflow-auto max-h-96`,children:(0,G.jsx)(`pre`,{className:`font-mono text-xs text-on-surface whitespace-pre-wrap break-words`,children:e.content_snapshot})})]})}function F2({entries:e}){return e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant py-4`,children:`No evolution history.`}):(0,G.jsxs)(`div`,{className:`relative space-y-4`,children:[(0,G.jsx)(`div`,{className:`absolute left-[4.5px] top-2 bottom-2 w-px bg-outline-variant/30`}),e.map(e=>(0,G.jsx)(P2,{entry:e},e.id))]})}function I2(e){return e===`active`?`default`:e===`stale`?`secondary`:`outline`}function L2(e){if(!e)return 0;try{let t=JSON.parse(e);return Array.isArray(t)?t.length:0}catch{return 0}}function R2(){return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsx)(`div`,{className:`h-8 w-24 animate-pulse rounded bg-surface-container-high`}),(0,G.jsxs)(`div`,{className:`rounded-md bg-surface-container-low p-4 space-y-3`,children:[(0,G.jsx)(`div`,{className:`h-6 w-48 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-4 w-64 animate-pulse rounded bg-surface-container-high`}),(0,G.jsx)(`div`,{className:`h-5 w-32 animate-pulse rounded bg-surface-container-high`})]}),(0,G.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:Array.from({length:3}).map((e,t)=>(0,G.jsx)(`div`,{className:`h-20 animate-pulse rounded-lg bg-surface-container-high`},t))})]})}function z2({skillName:e,onBack:t}){let{data:n,isPending:r,isError:i}=dA(e),a=fA(),[o,s]=(0,W.useState)(!1);if(r)return(0,G.jsx)(R2,{});if(i||!n)return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),`Skills`]}),(0,G.jsxs)(`div`,{className:`flex h-40 flex-col items-center justify-center gap-2 text-tertiary`,children:[(0,G.jsx)(yo,{className:`h-5 w-5`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Skill not found`})]})]});let c=L2(n.source_ids),l=n.lineage?.[0]?.content_snapshot??null,u=n.frontmatter??{},d=l?.replace(/^---\n[\s\S]*?\n---\n*/,``)??null;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`gap-2 text-on-surface-variant`,children:[(0,G.jsx)(so,{className:`h-4 w-4`}),`Skills`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,className:`gap-2 text-tertiary hover:text-tertiary hover:bg-tertiary/10`,onClick:()=>s(!0),children:[(0,G.jsx)(ks,{className:`h-4 w-4`}),`Delete`]})]}),(0,G.jsx)(Q,{level:`low`,accent:`sage`,className:`p-5 space-y-3`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex-1 space-y-1 min-w-0`,children:[(0,G.jsxs)(PA,{tone:`sage`,children:[`Skill · `,n.name]}),(0,G.jsx)(`h1`,{className:`myco-display-md text-on-surface m-0`,children:n.display_name}),n.description&&(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:n.description}),n.path&&(0,G.jsx)(`p`,{className:`font-mono text-[10px] text-on-surface-variant mt-1`,children:n.path}),Object.keys(u).length>0&&(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 mt-2`,children:[u[`user-invocable`]===`true`&&(0,G.jsx)(X,{variant:`secondary`,children:`user-invocable`}),u[`allowed-tools`]&&(0,G.jsxs)(X,{variant:`outline`,children:[`tools: `,u[`allowed-tools`]]})]})]}),(0,G.jsx)(X,{variant:I2(n.status),className:`shrink-0`,children:n.status})]})}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,G.jsx)(RA,{label:`Generation`,value:`v${n.generation}`,tone:`sage`,mono:!0}),(0,G.jsx)(RA,{label:`Usage`,value:`${n.usage_total??n.usage_count??0}`,sub:`sessions`,tone:`ochre`}),(0,G.jsx)(RA,{label:`Sources`,value:`${c}`})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(Qj,{children:`Evolution History`}),(0,G.jsx)(F2,{entries:n.lineage??[]})]}),(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsx)(Qj,{children:`Current Content`}),d?(0,G.jsx)(uO,{content:d}):(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant py-4`,children:`No content snapshot available.`})]}),(0,G.jsx)(jj,{open:o,onOpenChange:s,title:`Delete Skill`,description:`This will permanently delete the skill record, evolution history, and the SKILL.md file from disk.`,icon:(0,G.jsx)(ks,{className:`h-4 w-4 text-tertiary`}),meta:n?[{label:`Name`,value:n.name},{label:`Title`,value:n.display_name}]:[],confirmLabel:`Delete Skill`,variant:`destructive`,onConfirm:()=>{a.mutate(n.name,{onSuccess:()=>{s(!1),t()}})},isPending:a.isPending})]})}var B2=`tab`,V2=`skill`,H2=new Set([`candidates`,`skills`]);function U2(e){let t=new URLSearchParams(e),n=t.get(B2);return{tab:n&&H2.has(n)?n:`skills`,skill:t.get(V2)??void 0}}function W2(e,t){let n=new URLSearchParams;e!==`skills`&&n.set(B2,e),t&&n.set(V2,t);let r=n.toString(),i=r?`${window.location.pathname}?${r}`:window.location.pathname;window.history.replaceState(null,``,i)}var G2=[{id:`skills`,label:`Skills`,description:`promoted records`},{id:`candidates`,label:`Candidates`,description:`approval queue`}];function K2(){return(0,G.jsxs)($f,{children:[(0,G.jsx)(ep,{asChild:!0,children:(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,className:`text-on-surface-variant`,children:(0,G.jsx)(Co,{className:`h-4 w-4`})})}),(0,G.jsxs)(rp,{className:`max-w-lg`,children:[(0,G.jsxs)(ip,{children:[(0,G.jsx)(op,{children:`How Skills Work`}),(0,G.jsx)(sp,{children:`Skills are project-specific procedural guides generated from your vault knowledge. They teach agents how to accomplish tasks in your codebase.`})]}),(0,G.jsxs)(`div`,{className:`space-y-4 font-sans text-sm text-on-surface-variant`,children:[(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`h4`,{className:`font-medium text-on-surface`,children:`The Pipeline`}),(0,G.jsxs)(`ol`,{className:`list-decimal pl-5 space-y-1`,children:[(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Survey`}),` — discovers candidate skills from vault knowledge (sessions, decisions, gotchas)`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Approve`}),` — you review candidates and approve the ones worth generating`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Generate`}),` — produces a SKILL.md file from the approved candidate's source material`]}),(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Evolve`}),` — updates existing skills when new knowledge makes them stale`]})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`h4`,{className:`font-medium text-on-surface`,children:`Scheduling`}),(0,G.jsxs)(`p`,{children:[(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:`Skill Survey`}),` runs automatically during idle periods. Skill Generate and Skill Evolve are off by default — enable them in the`,` `,(0,G.jsxs)(ri,{to:`/agent?tab=tasks`,className:`text-primary hover:underline inline-flex items-center gap-0.5`,children:[`Agent Tasks`,(0,G.jsx)(Po,{className:`h-3 w-3`})]}),` `,`page for fully automatic operation, or trigger them manually with Run Now.`]})]}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsx)(`h4`,{className:`font-medium text-on-surface`,children:`Quick Start`}),(0,G.jsxs)(`ol`,{className:`list-decimal pl-5 space-y-1`,children:[(0,G.jsx)(`li`,{children:`Wait for the survey to discover candidates (or run it manually)`}),(0,G.jsx)(`li`,{children:`Review candidates in the Candidates tab and approve the best ones`}),(0,G.jsxs)(`li`,{children:[`Run`,` `,(0,G.jsx)(ri,{to:`/agent?tab=tasks&task=skill-generate`,className:`text-primary hover:underline`,children:`Skill Generate`}),` `,`to produce skills from approved candidates`]})]})]})]})]})]})}function q2(){let e=An(),t=U2(e.search),[n,r]=(0,W.useState)(t.tab),[i,a]=(0,W.useState)(t.skill),{data:o}=cA({status:`identified`}),{data:s}=uA({status:`active`}),c=o?.total??0,l=s?.total??0;(0,W.useEffect)(()=>{W2(n,i)},[n,i]),(0,W.useEffect)(()=>{let t=U2(e.search);r(t.tab),a(t.skill)},[e.search,e.key]);let u=(0,W.useCallback)(e=>{let t=e;r(t),t!==`skills`&&a(void 0)},[]),d=(0,W.useCallback)(e=>{r(`skills`),a(e)},[]);return(0,G.jsxs)(AA,{children:[(0,G.jsx)(cN,{title:`Skills`,subtitle:`Discovered skill candidates and promoted skill records`,actions:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c>0&&(0,G.jsxs)(X,{variant:`secondary`,children:[c,` pending`]}),l>0&&(0,G.jsxs)(X,{variant:`default`,children:[l,` active`]}),(0,G.jsx)(K2,{})]})}),(0,G.jsx)(qN,{tabs:G2.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:n,onTabChange:u,columns:2}),n===`candidates`&&(0,G.jsx)(T2,{}),n===`skills`&&!i&&(0,G.jsx)(M2,{onSelectSkill:d}),n===`skills`&&i&&(0,G.jsx)(z2,{skillName:i,onBack:()=>a(void 0)})]})}function J2({id:e,value:t,onChange:n,disabled:r,readonly:i}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,id:e,children:[(0,G.jsx)(lN,{checked:t,onCheckedChange:e=>n(e),disabled:r||i}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:t?`On`:`Off`})]})}function Y2({id:e,value:t,onChange:n,disabled:r,readonly:i,options:a,optionLabels:o,placeholder:s}){return i?(0,G.jsx)(`div`,{id:e,className:`flex h-9 items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:o?.[t]??t}):(0,G.jsxs)(w_,{value:t,onValueChange:n,disabled:r,children:[(0,G.jsx)(E_,{id:e,children:(0,G.jsx)(T_,{placeholder:s})}),(0,G.jsx)(D_,{children:a.map(e=>(0,G.jsx)(O_,{value:e,children:o?.[e]??e},e))})]})}function X2(e,t,n){let r=e;return typeof t==`number`&&(r=Math.max(t,r)),typeof n==`number`&&(r=Math.min(n,r)),r}function Z2({id:e,value:t,onChange:n,disabled:r,readonly:i,min:a,max:o,step:s,suffix:c,placeholder:l}){let[u,d]=(0,W.useState)(String(t));(0,W.useEffect)(()=>{d(String(t))},[t]);function f(){let e=Number(u);if(Number.isNaN(e)){d(String(t));return}let r=X2(e,a,o);r!==t&&n(r),d(String(r))}function p(e){e.key===`Enter`?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),d(String(t)))}return i?(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{id:e,className:`flex h-9 w-32 items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:t}),c&&(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:c})]}):(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(cp,{id:e,type:`number`,value:u,min:a,max:o,step:s??1,disabled:r,placeholder:l,onChange:e=>d(e.target.value),onBlur:f,onKeyDown:p,className:`w-32 font-mono`}),c&&(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:c})]})}function Q2({id:e,value:t,onChange:n,disabled:r,readonly:i,placeholder:a,trim:o=!0}){let[s,c]=(0,W.useState)(t);(0,W.useEffect)(()=>{c(t)},[t]);function l(){let e=o?s.trim():s;e!==t&&n(e),c(e)}function u(e){e.key===`Enter`?(e.preventDefault(),l()):e.key===`Escape`&&(e.preventDefault(),c(t))}return i?(0,G.jsx)(`div`,{id:e,className:`flex h-9 w-full items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:t}):(0,G.jsx)(cp,{id:e,type:`text`,value:s,placeholder:a,disabled:r,onChange:e=>c(e.target.value),onBlur:l,onKeyDown:u,className:`font-mono`})}function $2(e){return e.split(/\r?\n|,/).map(e=>e.trim()).filter(e=>e.length>0)}function e4({id:e,value:t,onChange:n,disabled:r,readonly:i,placeholder:a,allowDuplicates:o=!1}){let[s,c]=(0,W.useState)(``);function l(e){if(e.length===0)return;let r=new Set(o?[]:t),i=t.slice();for(let t of e)!o&&r.has(t)||(r.add(t),i.push(t));i.length!==t.length&&n(i)}function u(){l($2(s)),c(``)}function d(e){let r=t.slice();r.splice(e,1),n(r)}function f(e){e.key===`Enter`&&(e.preventDefault(),u())}function p(e){let t=e.clipboardData.getData(`text`);t&&/[\r\n,]/.test(t)&&(e.preventDefault(),l($2(s+t)),c(``))}return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[t.length>0&&(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map((e,t)=>(0,G.jsxs)(X,{variant:`secondary`,className:`gap-1 pr-1`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e}),!i&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e}`,disabled:r,onClick:()=>d(t),className:`rounded-xs p-0.5 text-on-surface-variant hover:bg-surface-container-highest hover:text-on-surface disabled:opacity-50`,children:(0,G.jsx)(Is,{className:`h-3 w-3`})})]},`${e}-${t}`))}),!i&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(cp,{id:e,type:`text`,value:s,placeholder:a,disabled:r,onChange:e=>c(e.target.value),onKeyDown:f,onPaste:p,onBlur:()=>{s.trim().length>0&&u()},className:`font-mono`}),(0,G.jsx)(Y,{type:`button`,variant:`outline`,size:`sm`,disabled:r||s.trim().length===0,onClick:u,children:`Add`})]})]})}function t4({id:e,value:t,onChange:n,disabled:r,readonly:i,configured:a,source:o,placeholder:s}){let[c,l]=(0,W.useState)(t),[u,d]=(0,W.useState)(!1);(0,W.useEffect)(()=>{l(t)},[t]);function f(){c!==t&&n(c)}function p(e){e.key===`Enter`?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),l(t))}let m=o?`stored in ${o}`:`stored in keychain`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(cp,{id:e,type:u?`text`:`password`,value:c,placeholder:s,disabled:r||i,readOnly:i,autoComplete:`off`,onChange:e=>l(e.target.value),onBlur:f,onKeyDown:p,className:`font-mono`}),(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":u?`Hide secret`:`Reveal secret`,"aria-pressed":u,disabled:r,onClick:()=>d(e=>!e),children:u?(0,G.jsx)(Fo,{className:`h-4 w-4`}):(0,G.jsx)(Io,{className:`h-4 w-4`})})]}),a&&(0,G.jsx)(`div`,{children:(0,G.jsx)(X,{variant:`default`,className:`bg-primary/15 text-primary`,children:m})})]})}function n4(){let[e,t]=(0,W.useState)({}),[n,r]=(0,W.useState)(``),[i,a]=(0,W.useState)(!0);(0,W.useEffect)(()=>{$i(`/config/plan-dirs`).then(e=>t(e.symbiont)).catch(()=>{}).finally(()=>a(!1))},[]);let o=Object.entries(e);return(0,G.jsxs)(Q,{id:Ya.settingsPlanCapture,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-amber-500 transition-all duration-300`,children:[(0,G.jsx)(Qj,{children:`Plan Capture`}),i?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading...`}):(0,G.jsxs)(`div`,{className:`space-y-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Agent Directories`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Directories monitored by connected agents. Managed by symbiont manifests.`}),o.length===0?(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant italic`,children:`No agent directories configured.`}):(0,G.jsx)(`div`,{className:`space-y-3`,children:o.map(([e,t])=>(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`p`,{className:`font-sans text-xs font-medium text-on-surface-variant uppercase tracking-wide`,children:e}),(0,G.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,G.jsx)(`div`,{className:`rounded bg-surface-container px-3 py-1.5 font-mono text-xs text-on-surface-variant`,children:e},e))})]},e))})]}),(0,G.jsx)(_N,{path:`capture.ignore_plan_dirs_in_git`,label:`Ignore Custom Plan Dirs In Git`,lockScope:`project`,hint:`.gitignore is rewritten on every change`,children:({value:e,onChange:t})=>(0,G.jsx)(lN,{checked:e??!1,onCheckedChange:t})}),(0,G.jsx)(_N,{path:`capture.plan_dirs`,label:`Custom Directories`,lockScope:`project`,hint:`extra paths to watch for plan files`,children:({value:e,onChange:t})=>{let i=e??[];return(0,G.jsxs)(`div`,{className:`space-y-2`,children:[i.length>0&&(0,G.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 rounded bg-surface-container px-3 py-1.5`,children:[(0,G.jsx)(`span`,{className:`flex-1 font-mono text-xs text-on-surface`,children:e}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(i.filter(t=>t!==e)),className:`font-sans text-xs text-on-surface-variant hover:text-tertiary transition-colors leading-none`,"aria-label":`Remove ${e}`,children:`x`})]},e))}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(cp,{placeholder:`/path/to/plans`,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{if(e.key!==`Enter`)return;let a=n.trim();!a||i.includes(a)||(t([...i,a]),r(``))},className:`flex-1 font-mono text-xs`}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:()=>{let e=n.trim();!e||i.includes(e)||(t([...i,e]),r(``))},disabled:!n.trim(),children:`Add`})]})]})}})]})]})}var r4={banner:`Banner`,summary:`Summary`};function i4({children:e}){return(0,G.jsx)(`div`,{className:`rounded-lg border border-outline-variant/20 bg-surface-container/40 p-4`,children:e})}function a4(){let{effective:e,setField:t,resetField:n,promoteField:r,isLocalOverride:i}=Na(),{data:a}=fv(),o=a?.domains??[],s=e?.notifications?.enabled??!0,c=e?.notifications?.default_mode??`summary`,l=!s,u=(0,W.useCallback)(async(e,r)=>{let i=`notifications.domains.${e}.mode`;r===`default`?await n(i):await t(i,r,`local`)},[n,t]),d=(0,W.useCallback)(async(e,n)=>{await t(`notifications.domains.${e}.enabled`,n,`local`)},[t]);return e?(0,G.jsxs)(Q,{id:Ya.settingsNotifications,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300`,children:[(0,G.jsx)(Qj,{children:`Notifications`}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(i4,{children:(0,G.jsx)(_N,{path:`notifications.enabled`,label:`Notifications`,hint:`master switch for this project`,defaultScope:`local`,children:({value:e,onChange:t})=>(0,G.jsx)(lN,{checked:e??!0,onCheckedChange:t})})}),(0,G.jsxs)(`div`,{className:l?`space-y-4 opacity-60`:`space-y-4`,children:[(0,G.jsx)(i4,{children:(0,G.jsx)(_N,{path:`notifications.default_mode`,label:`Default Display`,hint:`summary = panel only; banner = temporary popup`,defaultScope:`local`,children:({value:e,onChange:t})=>(0,G.jsxs)(w_,{value:e??`summary`,onValueChange:e=>t(e),disabled:l,children:[(0,G.jsx)(E_,{className:`w-40`,children:(0,G.jsx)(T_,{})}),(0,G.jsxs)(D_,{children:[(0,G.jsx)(O_,{value:`summary`,children:`Summary`}),(0,G.jsx)(O_,{value:`banner`,children:`Banner`})]})]})})}),(0,G.jsx)(i4,{children:(0,G.jsx)(_N,{path:`notifications.system_notifications`,label:`Browser Notifications`,hint:`OS popups when tab unfocused; only for banner mode`,defaultScope:`local`,children:({value:e,onChange:t})=>(0,G.jsx)(lN,{checked:e??!1,onCheckedChange:t,disabled:l})})}),o.length>0&&(0,G.jsx)(i4,{children:(0,G.jsxs)(`div`,{className:`space-y-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Per-Domain Overrides`}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:"Leave on `Default` unless a domain should behave differently from the project-wide setting."})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:o.map(t=>{let a=e.notifications?.domains?.[t.domain]??{enabled:!0},o=a.enabled,s=a.mode??c,f=a.mode??`default`,p=`notifications.domains.${t.domain}`,m=i(p);return(0,G.jsx)(`div`,{className:`rounded-md border border-outline-variant/20 bg-surface-container-low/40 px-3 py-3`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-on-surface`,children:t.label}),(0,G.jsx)(`span`,{className:`rounded-full bg-surface-container-high px-2 py-0.5 text-[11px] text-on-surface-variant`,children:o?r4[s]:`Off`}),m?(0,G.jsx)(kO,{mode:`local-default`,onPromote:()=>r(p),onReset:()=>n(p)}):(0,G.jsx)(OO,{scope:`project`})]}),(0,G.jsx)(`p`,{className:`text-[11px] text-on-surface-variant`,children:t.types.map(e=>e.label).join(`, `)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 self-start`,children:[(0,G.jsxs)(w_,{value:f,onValueChange:e=>{u(t.domain,e)},disabled:l||!o,children:[(0,G.jsx)(E_,{className:`h-8 w-[120px] text-xs`,children:(0,G.jsx)(T_,{})}),(0,G.jsxs)(D_,{children:[(0,G.jsx)(O_,{value:`default`,children:`Default`}),(0,G.jsx)(O_,{value:`summary`,children:`Summary`}),(0,G.jsx)(O_,{value:`banner`,children:`Banner`})]})]}),(0,G.jsx)(lN,{checked:o,onCheckedChange:e=>{d(t.domain,e)},disabled:l})]})]})},t.domain)})})]})}),l&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Notifications are currently disabled, so display and domain settings are inactive.`})]})]})]}):null}var o4=[`provider-secrets`],s4=[`providers`],c4=[`models`];function l4(){return ot({queryKey:Ta([...o4]),queryFn:({signal:e})=>$i(`/providers/secrets`,{signal:e})})}function u4(e){e.invalidateQueries({queryKey:o4}),e.invalidateQueries({queryKey:s4}),e.invalidateQueries({queryKey:c4})}function d4(){let e=We();return st({mutationFn:({provider:e,apiKey:t,scope:n})=>ca(`/providers/secrets/${e}`,{api_key:t,scope:n}),onSuccess:()=>u4(e)})}function f4(){let e=We();return st({mutationFn:({provider:e,scope:t})=>la(`/providers/secrets/${e}${t?`?scope=${encodeURIComponent(t)}`:``}`),onSuccess:()=>u4(e)})}var p4={openai:`OpenAI API Key`,openrouter:`OpenRouter API Key`};function m4(e){return e===`openai`||e===`openrouter`}function h4(){let{effective:e,setFields:t,isLocalOverride:n,resetFields:r}=Na(),{data:i,isPending:a}=d$(),{data:o}=l4(),s=d4(),c=f4(),l=f$(),u=i?.providers??[],d=e?.agent?.provider,f=e?.agent?.harness,{draft:p,savedDraft:m,isDirty:h,clearDraft:g,resetDraft:_,handleHarnessChange:v,handleProviderChange:y,handleModelChange:b,handleLocalBackendChange:x,handleReasoningChange:S,handleBaseUrlChange:C,handleContextLengthChange:w}=G$({source:{harness:f,provider:d},providers:u}),[T,E]=(0,W.useState)(``),D=m4(p.type)?p.type:null,O=D?o?.secrets[D]:void 0,k=p.baseUrl||r$(p.type,p.localBackend),A=h$(p.type||null,k||void 0,`llm`,p.localBackend||null).data?.models??u.find(e=>e.type===p.type)?.models??[],j=p.type!==``;(0,W.useEffect)(()=>{E(``)},[p.type]);let M=n(`agent.provider`)||n(`agent.harness`),N=(0,W.useCallback)(async()=>{let e=n(`agent.harness`),t=n(`agent.provider`);if(e&&t){await r([`agent.harness`,`agent.provider`]);return}if(e){await r([`agent.harness`]);return}t&&await r([`agent.provider`])},[n,r]),P=(0,W.useCallback)(async()=>{let e=H$(p,A);await t([{path:`agent.harness`,value:p.harness||a$(p.type)},{path:`agent.provider`,value:e}],`local`)},[p,A,t]),F=(0,W.useCallback)((e,n)=>{let r=H$(e,A),i=[{path:`agent.harness`,value:e.harness||a$(e.type)},{path:`agent.provider`,value:r}];n&&i.push({path:`agent.scheduled_tasks_enabled`,value:!0},{path:`agent.event_tasks_enabled`,value:!0}),t(i,M?`local`:`grove`)},[M,A,t]),I=(0,W.useCallback)(()=>{g(),l.reset()},[l,g]),L=(0,W.useCallback)(()=>{_(),l.reset()},[l,_]),R=(0,W.useCallback)(async()=>{if(p.type===``){try{await t([{path:`agent.scheduled_tasks_enabled`,value:!1},{path:`agent.event_tasks_enabled`,value:!1}],M?`local`:`grove`,[`agent.provider`,`agent.harness`])}catch(e){console.error(`[agent-card] clear provider failed`,e)}return}F(p,m.type===``&&p.type!==``)},[p,M,m.type,t,F]),ee=(0,W.useCallback)(()=>{!D||T.trim()===``||s.mutate({provider:D,apiKey:T.trim()},{onSuccess:()=>{E(``),l.reset()}})},[l,T,s,D]),z=(0,W.useCallback)(()=>{D&&c.mutate({provider:D},{onSuccess:()=>{E(``),l.reset()}})},[l,c,D]),B=(0,W.useCallback)(()=>{p.type!==``&&l.mutate({type:p.type,...p.type===`openai-compatible`&&p.localBackend?{local_backend:p.localBackend}:{},...p.baseUrl?{base_url:p.baseUrl}:{}})},[p.baseUrl,p.localBackend,p.type,l]);return(0,G.jsxs)(Q,{id:Ya.settingsAgent,"data-config-field":`agent.provider`,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-sage transition-all duration-300`,children:[(0,G.jsx)(Qj,{children:(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[`Myco Agent`,(0,G.jsx)(kO,{mode:`shared-default`,hasLocalOverride:M,defaultScopeBadge:`grove`,onSavePersonal:P,onReset:N})]})}),p.type===``?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No provider configured -- data collection is active. Configure a provider to enable the intelligence pipeline.`}):null,(0,G.jsx)(x$,{harness:p.harness,providerType:p.type,localBackend:p.localBackend,model:p.model,baseUrl:p.baseUrl,contextLength:p.contextLength,providers:u,isLoadingProviders:a,onHarnessChange:e=>{v(e),l.reset()},onProviderChange:e=>{y(e),l.reset()},onLocalBackendChange:e=>{x(e),l.reset()},onModelChange:b,onBaseUrlChange:C,onContextLengthChange:w}),j&&(0,G.jsx)(e0,{description:"Built-in tasks resolve `low`, `default`, and `high` reasoning phases through these model mappings.",values:{low:p.reasoningLow,default:p.reasoningDefault,high:p.reasoningHigh},onChange:S,models:A,fallbackModel:p.model,placeholderWhenEmpty:`Use default model`}),D&&(0,G.jsxs)(`div`,{className:`space-y-2 rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest p-3`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`label`,{className:`font-sans text-xs text-on-surface-variant`,children:p4[D]}),(0,G.jsx)(cp,{type:`password`,value:T,onChange:e=>E(e.target.value),placeholder:O?.configured?`Replace saved key`:`Paste API key`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:ee,disabled:s.isPending||T.trim()===``,children:`Save key`}),O?.configured&&(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:z,disabled:c.isPending,children:`Clear key`}),(0,G.jsx)(`span`,{className:`font-sans text-xs text-on-surface-variant break-all`,children:O?.configured?`${O.maskedValue} from ${O.source===`env`?`environment`:`${O.source} secrets`}`:`Key is required for model discovery and connection tests.`})]})]}),(p.type!==``||h)&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:R,disabled:!h,children:`Save Changes`}),h?(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:L,children:`Reset`}):null,p.type===``?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:B,disabled:l.isPending,children:[l.isPending?(0,G.jsx)(es,{className:`mr-2 h-4 w-4 animate-spin`}):null,`Test Connection`]}),l.isSuccess&&l.data.ok&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-primary`,children:[(0,G.jsx)(xo,{className:`h-4 w-4`}),`Connected — `,l.data.latency_ms,`ms`]}),l.isSuccess&&!l.data.ok&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-tertiary`,children:[(0,G.jsx)(wo,{className:`h-4 w-4`}),l.data.error??`Connection failed.`]}),l.isError&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-tertiary`,children:[(0,G.jsx)(wo,{className:`h-4 w-4`}),l.error.message]})]})]}),p.type!==``||m.type!==``?(0,G.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:I,className:`text-xs text-on-surface-variant`,children:`Clear provider`}):null]})]})}var g4=[{value:`ollama`,label:`Ollama`},{value:`openai-compatible`,label:`OpenAI-compatible`}];function _4(){let{effective:e}=Na(),t=e?.embedding.provider??`ollama`,n=e?.embedding.base_url??``,{data:r}=h$(t,n||void 0,`embedding`),i=r?.models??[],[a,o]=(0,W.useState)(`idle`),[s,c]=(0,W.useState)(``),l=(0,W.useCallback)(async()=>{o(`testing`),c(``);try{let e=new URLSearchParams({provider:t,type:`embedding`});n&&e.set(`base_url`,n);let r=(await $i(`/models?${e.toString()}`)).models.length;o(`success`),c(`Connected -- ${r} model${r===1?``:`s`} available.`)}catch(e){o(`error`),c(e instanceof Error?e.message:`Connection failed.`)}},[t,n]);return(0,G.jsxs)(Q,{id:Ya.settingsEmbedding,level:`low`,className:`rounded-lg p-6 space-y-5 border-t-2 border-t-ochre transition-all duration-300`,children:[(0,G.jsx)(Qj,{children:`Embedding`}),(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(_N,{path:`embedding.provider`,label:`Provider`,defaultScope:`grove`,allowPersonal:!1,requiresRestart:!0,children:({value:e,onChange:t})=>(0,G.jsxs)(w_,{value:e??`ollama`,onValueChange:e=>{t(e),o(`idle`)},children:[(0,G.jsx)(E_,{children:(0,G.jsx)(T_,{})}),(0,G.jsx)(D_,{children:g4.map(e=>(0,G.jsx)(O_,{value:e.value,children:e.label},e.value))})]})}),(0,G.jsx)(_N,{path:`embedding.model`,label:`Model`,defaultScope:`grove`,allowPersonal:!1,requiresRestart:!0,commitOn:i.length>0?`change`:`blur`,children:({value:e,onChange:t,onBlur:n})=>i.length>0?(0,G.jsx)(VQ,{value:e??``,onValueChange:t,placeholder:`Select a model`,searchPlaceholder:`Search embedding models...`,emptyMessage:`No embedding models match that search.`,options:i.map(e=>({value:e,label:e})),sortOptions:!0,monospace:!0}):(0,G.jsx)(cp,{placeholder:`bge-m3`,value:e??``,onChange:e=>t(e.target.value),onBlur:n})}),(0,G.jsx)(_N,{path:`embedding.base_url`,label:`Base URL`,hint:`optional`,defaultScope:`grove`,allowPersonal:!1,requiresRestart:!0,commitOn:`blur`,parse:e=>e===``?void 0:e,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsx)(cp,{type:`url`,placeholder:`http://localhost:11434`,value:e??``,onChange:e=>{t(e.target.value),o(`idle`)},onBlur:n})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,G.jsxs)(Y,{type:`button`,variant:`ghost`,size:`sm`,onClick:l,disabled:a===`testing`,children:[a===`testing`?(0,G.jsx)(es,{className:`mr-2 h-4 w-4 animate-spin`}):null,`Test Connection`]}),a===`success`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-primary`,children:[(0,G.jsx)(xo,{className:`h-4 w-4`}),s]}),a===`error`&&(0,G.jsxs)(`span`,{className:`flex items-center gap-1 font-sans text-sm text-tertiary`,children:[(0,G.jsx)(wo,{className:`h-4 w-4`}),s]})]})]})]})}function v4(e){return e.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean)}function y4({value:e,onChange:t,placeholder:n}){let r=(e??[]).join(`
|
|
414
|
-
`),[i,a]=(0,W.useState)(r);return(0,W.useEffect)(()=>{a(r)},[r]),(0,G.jsx)(`textarea`,{className:`min-h-24 w-full rounded-md border border-border bg-surface px-3 py-2 font-mono text-sm text-on-surface shadow-xs focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,value:i,placeholder:n,onChange:e=>a(e.target.value),onBlur:()=>t(v4(i))})}function b4(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map(e=>{let[t,n]=e.split(/\s*(?:=>|=)\s*/,2);return{path_glob:t?.trim()??``,tag_pattern:n?.trim()??``}}).filter(e=>e.path_glob&&e.tag_pattern)}function x4({value:e,onChange:t}){let n=(e??[]).map(e=>`${e.path_glob} => ${e.tag_pattern}`).join(`
|
|
415
|
-
`),[r,i]=(0,W.useState)(n);return(0,W.useEffect)(()=>{i(n)},[n]),(0,G.jsx)(`textarea`,{className:`min-h-20 w-full rounded-md border border-border bg-surface px-3 py-2 font-mono text-sm text-on-surface shadow-xs focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,value:r,placeholder:`packages/api/ => refs/tags/api/v*`,onChange:e=>i(e.target.value),onBlur:()=>t(b4(r))})}function S4({children:e}){return(0,G.jsx)(`p`,{className:`font-sans text-xs leading-5 text-on-surface-variant`,children:e})}function C4({title:e,description:t,children:n}){return(0,G.jsxs)(`section`,{className:`space-y-4 border-t border-outline-variant/20 pt-5`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`h3`,{className:`font-sans text-xs font-semibold uppercase tracking-wider text-on-surface-variant`,children:e}),(0,G.jsx)(S4,{children:t})]}),n]})}function w4(){let{effective:e,setFields:t}=Na(),{data:n}=l4(),r=d4(),i=f4(),[a,o]=(0,W.useState)(``),s=`refs/tags/${e?.release_provenance.github.repo.split(`/`).pop()?.replace(/\.git$/,``)||`project`}/v*`,c=n?.secrets.github,l=c?.configured?`${c.maskedValue??`GitHub access`} connected for PR evidence.`:`Required for private repos and reliable squash-merge matches.`,u=(0,W.useCallback)((e,n)=>{t([{path:`release_provenance.production_refs`,value:e},{path:`release_provenance.integration_refs`,value:n}],`project`).catch(e=>console.error(`[settings] release provenance preset failed`,e))},[t]),d=(0,W.useCallback)(()=>{let e=a.trim();e&&r.mutate({provider:`github`,apiKey:e},{onSuccess:()=>o(``)})},[a,r]),f=(0,W.useCallback)(()=>{i.mutate({provider:`github`})},[i]);return(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg p-6 space-y-6`,children:[(0,G.jsxs)(`div`,{className:`max-w-4xl space-y-2`,children:[(0,G.jsx)(Qj,{children:`Release provenance`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Myco uses Git evidence to tell whether captured knowledge is released, merged but unreleased, or still only local.`})]}),(0,G.jsxs)(C4,{title:`Release model`,description:`Define what counts as released and what counts as merged for this project.`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>u([`refs/tags/v*`],[`origin/main`]),children:`Semver tags`}),(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>u([s],[`origin/main`]),children:`Project tag family`}),(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>u([`origin/main`],[]),children:`Main branch deploys`})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,G.jsx)(_N,{path:`release_provenance.production_refs`,label:`Production refs`,hint:`one per line`,lockScope:`project`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(y4,{value:e??[],onChange:t,placeholder:`refs/tags/v*`}),(0,G.jsx)(S4,{children:`Refs that mean code is released. Use release tags, project tag families, or the branch that deploys directly.`})]})}),(0,G.jsx)(_N,{path:`release_provenance.integration_refs`,label:`Integration refs`,hint:`one per line`,lockScope:`project`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(y4,{value:e??[],onChange:t,placeholder:`origin/main`}),(0,G.jsx)(S4,{children:`Refs that mean work is merged but not necessarily released. For GitHub projects this is usually the default branch.`})]})})]})]}),(0,G.jsx)(C4,{title:`GitHub evidence`,description:`Optional PR evidence improves reconciliation when squash merges hide direct commit ancestry.`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(20rem,1fr)_12rem]`,children:[(0,G.jsx)(_N,{path:`release_provenance.github.repo`,label:`Repository`,hint:`owner/name`,lockScope:`project`,commitOn:`blur`,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(cp,{value:e??``,placeholder:`owner/name`,onChange:e=>t(e.target.value),onBlur:n}),(0,G.jsx)(S4,{children:`Detected from the GitHub remote when possible. Leave blank to disable GitHub PR evidence.`})]})}),(0,G.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`label`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Access token`}),(0,G.jsx)(OO,{scope:`machine`})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,G.jsx)(cp,{className:`min-w-0 flex-1`,type:`password`,value:a,placeholder:c?.configured?`Paste new GitHub token`:`Paste GitHub token`,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())}}),(0,G.jsx)(Y,{type:`button`,size:`sm`,onClick:d,disabled:r.isPending||a.trim()===``,children:r.isPending?`Saving`:c?.configured?`Update`:`Connect`}),c?.configured&&c.source!==`env`&&(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:f,disabled:i.isPending,children:`Clear`})]}),(0,G.jsx)(S4,{children:l})]}),(0,G.jsx)(_N,{path:`release_provenance.github.max_lookups_per_run`,label:`PR lookups`,lockScope:`project`,commitOn:`blur`,parse:e=>Number(e),children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(cp,{type:`number`,min:0,max:200,value:String(e??20),onChange:e=>t(Number(e.target.value)),onBlur:n}),(0,G.jsx)(S4,{children:`Maximum GitHub PR searches per reconcile run. Higher values can improve older squash-merge matches but use more API quota.`})]})})]})}),(0,G.jsx)(C4,{title:`Reconciliation behavior`,description:`Control whether provenance runs, how often it refreshes, and how unknown Git states are treated.`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-3`,children:[(0,G.jsx)(_N,{path:`release_provenance.enabled`,label:`Enabled`,lockScope:`project`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(lN,{checked:e??!0,onCheckedChange:t}),(0,G.jsx)(S4,{children:`Enabled by default for Git projects. Missing refs leave records unreconciled instead of guessed.`})]})}),(0,G.jsx)(_N,{path:`release_provenance.reconcile_interval_minutes`,label:`Reconcile interval`,hint:`minutes`,defaultScope:`project`,commitOn:`blur`,parse:e=>Number(e),children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(cp,{type:`number`,min:1,max:1440,value:String(e??15),onChange:e=>t(Number(e.target.value)),onBlur:n}),(0,G.jsx)(S4,{children:`How often the daemon rechecks captured Git evidence against the release model.`})]})}),(0,G.jsx)(_N,{path:`release_provenance.production_debug_include_unknown`,label:`Include unknown debug`,lockScope:`project`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(lN,{checked:e??!0,onCheckedChange:t}),(0,G.jsx)(S4,{children:`Include dirty worktrees and other unknown Git states in production-scoped debug context.`})]})})]})}),(0,G.jsx)(C4,{title:`Advanced monorepo releases`,description:`Use this only when different paths in one repository release through different tag families.`,children:(0,G.jsx)(_N,{path:`release_provenance.package_map`,label:`Monorepo release mapping`,hint:`path => release tag ref`,lockScope:`project`,children:({value:e,onChange:t})=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(x4,{value:e??[],onChange:t}),(0,G.jsx)(S4,{children:`Map a path prefix to the tag pattern that releases that part of the repository.`})]})})})]})}function T4(e){if(e instanceof Error)return e.message||e.constructor.name||`Error`;if(typeof e==`string`)return e||`Empty string error`;try{return JSON.stringify(e)}catch{return`Unserializable error`}}var E4=[`update-status`];function D4(){return Vs({queryKey:[...E4],queryFn:({signal:e})=>$i(`/update/status`,{signal:e}),refetchInterval:Hs.UPDATE,pollCategory:`standard`,contextFree:!0})}function O4(){let e=We();return st({mutationFn:()=>sa(`/update/check`),onSuccess:()=>{e.invalidateQueries({queryKey:[...E4]})}})}function k4(){return st({mutationFn:()=>sa(`/update/apply`)})}function A4(){let e=We();return st({mutationFn:e=>ca(`/update/channel`,{channel:e}),onSuccess:()=>{e.invalidateQueries({queryKey:[...E4]})}})}var j4=500,M4=6e4;function N4(e){return e?new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):`Never`}function P4(e,t){return e<=0?null:e===1&&t?t:`${e} packages`}function F4(){let{data:e}=D4(),t=O4(),n=k4(),r=A4(),[i,a]=(0,W.useState)(`idle`),[o,s]=(0,W.useState)(null);(0,W.useEffect)(()=>{if(!e?.restarting||i!==`idle`)return;a(`restarting`);let t=Date.now()+M4,n=!1,r=async()=>{if(!(n||Date.now()>t)){try{if((await fetch(Mi(`/health`))).ok){window.location.reload();return}}catch{}n||setTimeout(r,j4)}},o=setTimeout(r,j4);return()=>{n=!0,clearTimeout(o)}},[e?.restarting,i]);let c=(0,W.useCallback)(async()=>{a(`applying`),s(null);try{let e=(await n.mutateAsync()).version;a(`restarting`);let t=Date.now()+M4;await new Promise((n,r)=>{let i=async()=>{if(Date.now()>t){r(Error(`timeout`));return}try{let t=await fetch(Mi(`/health`));if(t.ok&&(await t.json().catch(()=>null))?.version===e){n();return}}catch{}setTimeout(i,j4)};setTimeout(i,j4)}),window.location.reload()}catch(e){a(`error`),s(T4(e)===`timeout`?`Daemon did not restart within the expected time. Check the terminal.`:T4(e))}},[n]),l=(0,W.useCallback)(()=>{t.mutate()},[t]),u=(0,W.useCallback)(e=>{r.mutate(e)},[r]);if(!e)return null;let d=t.isPending,f=i===`applying`||i===`restarting`,p=e.update_available===!0,m=e.revert_available===!0,h=p||m,g=e.channel??`stable`,_=(e.packages??[]).filter(e=>e.installed),v=_.filter(e=>e.update_available),y=v.length,b=P4(y,v[0]?.latest_version??void 0),x=(e.runtime_scope??`machine`)===`managed`?`This machine is using a managed Myco runtime under ~/.myco/runtime/. Switching back to Stable removes the managed runtime and falls back to the global install on PATH.`:`This machine is using the global Myco install on PATH. Switching to Beta installs a managed runtime under ~/.myco/runtime/.`;return e.exempt?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ss,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(Qj,{children:`Updates`})]}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Updates are disabled in development mode.`,` `,(0,G.jsx)(`span`,{className:`font-mono text-xs text-outline`,children:e.running_version})]})]}):(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(bo,{className:J(`h-4 w-4`,h?`text-secondary`:`text-primary`)}),(0,G.jsx)(Qj,{children:`Updates`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-xs text-outline`,children:e.running_version}),p&&b&&(0,G.jsx)(X,{variant:`warning`,children:b})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[h?(0,G.jsx)(Y,{variant:`default`,size:`sm`,onClick:c,disabled:f,children:f?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ps,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}),i===`restarting`?`Restarting…`:m&&!p?`Reverting…`:`Updating…`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(bo,{className:`mr-1.5 h-3.5 w-3.5`}),m&&!p?`Revert to Stable & Restart`:y>1?`Update ${y} Packages & Restart`:`Update & Restart`]})}):(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-primary`,children:[(0,G.jsx)(So,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:`Up to date`})]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:l,disabled:d||f,children:[(0,G.jsx)(ps,{className:J(`mr-1.5 h-3.5 w-3.5`,d&&`animate-spin`)}),`Check Now`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:qs.map(e=>(0,G.jsx)(Y,{variant:g===e?`default`:`ghost`,className:`text-xs capitalize h-6 px-2`,onClick:()=>u(e),disabled:r.isPending||f,children:e},e))}),(0,G.jsxs)(`span`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Checked: `,N4(e.last_check)]})]}),_.length>0&&(0,G.jsxs)(`div`,{className:`space-y-2`,children:[_.map(e=>{let t=e.revert_available&&!e.update_available;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-outline/20 px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-sans text-sm text-on-surface`,children:e.display_name}),(0,G.jsxs)(`div`,{className:`font-mono text-xs text-on-surface-variant`,children:[e.installed_version??`not installed`,(e.update_available||t)&&e.latest_version?` → ${e.latest_version}`:``]})]}),(0,G.jsx)(X,{variant:e.update_available||t?`warning`:`secondary`,children:e.update_available?`Update available`:t?`Revert pending`:`Installed`})]},e.id)}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:x})]}),(i===`error`||e.error)&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-tertiary`,children:[(0,G.jsx)(yo,{className:`h-4 w-4 mt-0.5 shrink-0`}),(0,G.jsx)(`span`,{className:`font-sans text-sm`,children:o??e.error})]})]})}var I4=[`project`,`grove`,`all-groves`],L4={project:`Project`,grove:`Grove`,"all-groves":`All Groves`},R4={project:`Operate on the active project only`,grove:`Operate on every project in this Grove`,"all-groves":`Operate across every Grove on this machine`},z4={project:`border-outline-variant/30 bg-on-surface-variant/15 text-on-surface`,grove:`border-secondary/50 bg-secondary/10 text-secondary`,"all-groves":`border-tertiary/50 bg-tertiary/10 text-tertiary`},B4={project:`border-outline-variant/20 text-on-surface-variant hover:bg-on-surface-variant/5`,grove:`border-outline-variant/20 text-on-surface-variant hover:bg-secondary/5`,"all-groves":`border-outline-variant/20 text-on-surface-variant hover:bg-tertiary/5`};function V4({value:e,onChange:t,available:n=I4,helperText:r}){let i=I4.filter(e=>n.includes(e));return i.length===0?null:(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`div`,{role:`group`,"aria-label":`Operation scope`,className:`inline-flex items-center gap-1`,children:i.map(n=>{let r=e===n;return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n),title:R4[n],"aria-pressed":r,className:J(`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] uppercase tracking-wider transition-colors`,r?z4[n]:B4[n]),children:[(0,G.jsx)(`span`,{className:J(`inline-block h-1.5 w-1.5 rounded-full`,r&&n===`grove`&&`bg-secondary`,r&&n===`all-groves`&&`bg-tertiary`,r&&n===`project`&&`bg-on-surface-variant`,!r&&`bg-outline-variant/60`),"aria-hidden":!0}),L4[n]]},n)})}),r&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:r})]})}var H4={grove:`Aggregated for this Grove. Switch projects via the upper-left switcher to view a different Grove.`,"all-groves":`Aggregates every Grove on this machine.`,project:`Filtered to the active project.`},U4={project:`Action targets the active project only.`,grove:`Action targets every project in this Grove.`,"all-groves":`Action targets every Grove on this machine.`};function W4(e,t){if(e===`all-groves`)return{kind:`all-groves`};if(t)return e===`grove`?{kind:`grove`,grove_id:t.grove.id}:{kind:`project`,grove_id:t.grove.id,project_id:t.project.project_id}}function G4(e){switch(e.kind){case`project`:return`the active project only`;case`grove`:return`every project in this Grove`;case`all-groves`:return`every Grove on this machine`}}function K4(e){switch(e.kind){case`project`:return`Project`;case`grove`:return`Grove`;case`all-groves`:return`All Groves`}}function q4({open:e,onOpenChange:t,action:n,scope:r,costEstimate:i,variant:a=`destructive`,onConfirm:o,isPending:s=!1}){let c=`${n} will run against ${G4(r)}. ${i?`Estimated cost: ${i}.`:``} This cannot be undone automatically.`,l=[{label:`Scope`,value:K4(r)}];return(0,G.jsx)(jj,{open:e,onOpenChange:t,title:n,description:c.trim(),icon:(0,G.jsx)(js,{className:`h-5 w-5 text-tertiary`}),meta:l,confirmLabel:n,variant:a,onConfirm:o,isPending:s})}function J4(e,t){return t.kind===`all-groves`||e===`rebuild`||e===`vacuum`||e===`reindex`||e===`reembed-stale`&&t.kind===`grove`}var Y4=[`grove`,`all-groves`];function X4(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Z4(e){let t=new Map;for(let n of e){let e=new Date(n.modified_at).toISOString().slice(0,10),r=t.get(e)??[];r.push(n),t.set(e,r)}return t}function Q4(e){let t=new Date().toISOString().slice(0,10),n=new Date(e),r=new Date(Date.now()-24*36e5).toISOString().slice(0,10);return e===t?`Today`:e===r?`Yesterday`:n.toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`})}function $4({embedded:e=!1}={}){let[t,n]=(0,W.useState)([]),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(`grove`),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(!1),_=xa(),v=(0,W.useCallback)(async()=>{try{n((await $i(`/backups`)).backups),i(!0)}catch(e){c({type:`error`,text:`Failed to load backups: ${T4(e)}`})}},[]);!r&&!a&&(o(!0),v().finally(()=>o(!1)));async function y(){g(!0),c(null),u(null);try{let e=await sa(`/backup`,{scope:W4(d,_)});e.summary?c({type:e.summary.failed>0?`error`:`success`,text:`Backed up ${e.summary.ok} Grove(s); ${e.summary.failed} failed`}):c({type:`success`,text:`Backup created: ${e.machine_id} (${tj(e.size_bytes)})`}),await v()}catch(e){c({type:`error`,text:`Backup failed: ${T4(e)}`})}finally{g(!1)}}function b(){let e=W4(d,_);if(e&&J4(`backup`,e)){m(!0);return}y()}async function x(e){c(null),u(null);try{u(await sa(`/restore/preview`,{file_name:e}))}catch(e){c({type:`error`,text:`Preview failed: ${T4(e)}`})}}async function S(e){c(null),u(null);try{let t=await sa(`/restore`,{file_name:e});c({type:`success`,text:`Restored ${t.total_restored} records, skipped ${t.total_skipped} duplicates`})}catch(e){c({type:`error`,text:`Restore failed: ${T4(e)}`})}}let C=(0,G.jsxs)(G.Fragment,{children:[!e&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(qo,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(Qj,{children:`Backup & Restore`}),(0,G.jsx)(V4,{value:d,onChange:f,available:Y4})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:v,children:[(0,G.jsx)(ps,{className:`mr-1.5 h-3.5 w-3.5`}),`Refresh`]}),(0,G.jsxs)(Y,{variant:`default`,size:`sm`,onClick:b,disabled:h,children:[(0,G.jsx)(Mo,{className:`mr-1.5 h-3.5 w-3.5`}),`Backup Now`]})]})]}),e&&(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:v,children:[(0,G.jsx)(ps,{className:`mr-1.5 h-3.5 w-3.5`}),`Refresh`]}),(0,G.jsxs)(Y,{variant:`default`,size:`sm`,onClick:b,disabled:h,children:[(0,G.jsx)(Mo,{className:`mr-1.5 h-3.5 w-3.5`}),`Backup Now`]})]}),(0,G.jsx)(q4,{open:p,onOpenChange:m,action:`Create backup`,scope:W4(d,_)??{kind:`all-groves`},isPending:h,onConfirm:async()=>{await y(),m(!1)}}),!e&&(0,G.jsx)(_N,{path:`backup.dir`,label:`Backup Directory`,defaultScope:`local`,commitOn:`blur`,requiresRestart:!0,hint:`leave blank for default .myco/backups; ~ supported`,parse:e=>e===``?void 0:e,children:({value:e,onChange:t,onBlur:n})=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Uo,{className:`h-3.5 w-3.5 text-on-surface-variant shrink-0`}),(0,G.jsx)(`input`,{type:`text`,value:e??``,onChange:e=>t(e.target.value),onBlur:n,placeholder:`.myco/backups`,className:`flex-1 bg-surface-container text-on-surface font-mono text-sm rounded px-3 py-1.5 outline-hidden border border-outline-variant/15 focus:border-primary/40 placeholder:text-on-surface-variant/50`})]})}),s&&(0,G.jsx)(`p`,{className:J(`font-sans text-sm`,s.type===`success`?`text-primary`:`text-tertiary`),children:s.text}),t.length>0?(0,G.jsx)(`div`,{className:`space-y-4`,children:Array.from(Z4(t).entries()).map(([e,t])=>(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`p`,{className:`font-sans text-[11px] uppercase tracking-wider text-on-surface-variant`,children:Q4(e)}),t.map(e=>(0,G.jsxs)(`div`,{className:J(`flex items-center justify-between rounded-md px-4 py-3`,`bg-surface-container-lowest transition-colors`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface`,children:X4(e.modified_at)}),(0,G.jsx)(X,{variant:`secondary`,children:tj(e.size_bytes)}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant truncate`,children:e.machine_id})]}),(0,G.jsxs)(`div`,{className:`flex gap-2 shrink-0 ml-3`,children:[(0,G.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>x(e.file_name),children:`Preview`}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>S(e.file_name),children:[(0,G.jsx)(Ms,{className:`mr-1.5 h-3.5 w-3.5`}),`Restore`]})]})]},e.file_name))]},e))}):r?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No backups yet. Click "Backup Now" to create one.`}):null,l&&(0,G.jsxs)(Q,{level:`lowest`,className:`p-4 space-y-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Qj,{children:`Restore Preview`}),(0,G.jsx)(X,{variant:`outline`,children:l.machine_id})]}),(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full font-mono text-sm`,"aria-label":`Restore preview`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-left text-on-surface-variant`,children:[(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Table`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`New`}),(0,G.jsx)(`th`,{className:`pb-2 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Existing`})]})}),(0,G.jsx)(`tbody`,{children:l.tables.map((e,t)=>(0,G.jsxs)(`tr`,{className:J(`transition-colors hover:bg-surface-container-high/50`,t%2==1?`bg-surface-container-low/30`:``),children:[(0,G.jsx)(`td`,{className:`py-2 pr-4`,children:e.table}),(0,G.jsx)(`td`,{className:`py-2 pr-4 text-right`,children:e.new>0?(0,G.jsx)(`span`,{className:`text-primary`,children:e.new}):0}),(0,G.jsx)(`td`,{className:`py-2 text-right text-on-surface-variant`,children:e.existing})]},e.table))})]})}),(0,G.jsxs)(`div`,{className:`flex gap-4 font-sans text-sm text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{children:[`New: `,(0,G.jsx)(`strong`,{className:`text-primary`,children:l.total_new})]}),(0,G.jsxs)(`span`,{children:[`Existing: `,(0,G.jsx)(`strong`,{children:l.total_existing})]})]})]})]});return e?(0,G.jsx)(`div`,{className:`space-y-4`,children:C}):(0,G.jsx)(Q,{id:Ya.operationsBackup,level:`low`,className:`rounded-lg p-6 space-y-4 transition-all duration-300`,children:C})}var e3=[{id:`agent`,label:`Agent`,desc:`Default provider, runtime, and scheduled-task gates that drive the agent pipeline.`,category:`Agent`,icon:`Bot`,fields:[{key:`agent.provider.type`,label:`Provider`,scope:`grove`,kind:`select`,category:`Agent`,icon:`Bot`,options:[`anthropic`,`ollama`,`lmstudio`,`openai`,`openrouter`,`openai-compatible`],note:`Default provider for agent tasks. Individual tasks may override.`,customRender:`card-owns`},{key:`agent.provider.model`,label:`Model`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Provider-specific model identifier (e.g. claude-opus-4-7, gpt-oss:20b).`,customRender:`card-owns`},{key:`agent.provider.base_url`,label:`Base URL`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Override for self-hosted or OpenAI-compatible endpoints.`,customRender:`card-owns`},{key:`agent.provider.context_length`,label:`Context length`,scope:`grove`,kind:`number`,category:`Agent`,icon:`Bot`,note:`Context window size for local models (Ollama num_ctx, LM Studio context_length).`,customRender:`card-owns`},{key:`agent.model`,label:`Default model`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Grove-wide default model used when neither the provider block nor a per-task override sets one.`,customRender:`card-owns`},{key:`agent.harness`,label:`Runtime`,scope:`grove`,kind:`text`,category:`Agent`,icon:`Bot`,note:`Runtime id (e.g. claude-sdk, openai-agents). Picked from the installed runtime registry.`,customRender:`card-owns`}]},{id:`scheduled-tasks`,label:`Scheduled tasks`,desc:`Master switches and freshness gates for the agent pipeline's scheduled and event-driven tasks.`,category:`Scheduled tasks`,icon:`Activity`,fields:[{key:`agent.scheduled_tasks_enabled`,label:`Scheduled tasks`,scope:`grove`,kind:`toggle`,category:`Scheduled tasks`,icon:`Activity`,note:`Master switch for all scheduled agent tasks (canopy-describe, intelligence-skill, etc.).`},{key:`agent.event_tasks_enabled`,label:`Event-driven tasks`,scope:`grove`,kind:`toggle`,category:`Scheduled tasks`,icon:`Activity`,note:`Master switch for tasks fired by capture events (e.g., end-of-session summaries).`},{key:`agent.scheduled_tasks_active_window_days`,label:`Active project window`,scope:`grove`,kind:`number`,category:`Scheduled tasks`,icon:`Activity`,min:0,max:365,suffix:`days`,note:`Only run scheduled tasks against projects touched within this window. 0 disables the gate (all projects always considered active).`}]},{id:`embedding`,label:`Embedding`,desc:`Vector embedding provider for spores, sessions, and semantic recall.`,category:`Embedding`,icon:`Brain`,fields:[{key:`embedding.provider`,label:`Provider`,scope:`grove`,kind:`select`,category:`Embedding`,icon:`Brain`,options:[`ollama`,`openai-compatible`,`openrouter`,`openai`],customRender:`card-owns`},{key:`embedding.model`,label:`Model`,scope:`grove`,kind:`text`,category:`Embedding`,icon:`Brain`,note:`Default is bge-m3. Must match the provider's embedding-model id.`,customRender:`card-owns`},{key:`embedding.base_url`,label:`Base URL`,scope:`grove`,kind:`text`,category:`Embedding`,icon:`Brain`,note:`Override for self-hosted or OpenAI-compatible endpoints.`,customRender:`card-owns`},{key:`embedding.run_in_deep_sleep`,label:`Keep embedding while deep-sleeping`,scope:`grove`,kind:`toggle`,category:`Embedding`,icon:`Brain`,note:`Keep draining the embedding queue when the daemon would otherwise enter deep sleep. Recommended when the backlog is large.`,customRender:`card-owns`}]},{id:`capture`,label:`Capture`,desc:`Where Myco picks up transcripts, plans, and other artifacts.`,category:`Capture`,icon:`MessageSquare`,fields:[{key:`capture.transcript_paths`,label:`Transcript paths`,scope:`project`,kind:`list`,category:`Capture`,icon:`MessageSquare`,note:`Additional directories scanned for agent transcripts. Empty uses the agent symbionts' defaults.`},{key:`capture.plan_dirs`,label:`Plan directories`,scope:`project`,kind:`list`,category:`Capture`,icon:`MessageSquare`,note:`Directories Myco watches for agent-authored plans.`,customRender:`card-owns`},{key:`capture.ignore_plan_dirs_in_git`,label:`Add plan dirs to .gitignore`,scope:`project`,kind:`toggle`,category:`Capture`,icon:`MessageSquare`,note:`When on, Myco maintains a managed block in .gitignore covering the configured plan directories.`,customRender:`card-owns`},{key:`capture.artifact_extensions`,label:`Artifact extensions`,scope:`project`,kind:`list`,category:`Capture`,icon:`MessageSquare`,note:`File extensions captured as artifacts (e.g. .md, .py).`},{key:`capture.buffer_max_events`,label:`Event buffer size`,scope:`project`,kind:`number`,category:`Capture`,icon:`MessageSquare`,min:100,step:100,note:`In-memory cap on pending capture events before backpressure kicks in.`}]},{id:`release-provenance`,label:`Release Provenance`,desc:`How Myco classifies session work against shipped, integrated, and unreleased refs.`,category:`Release Provenance`,icon:`GitBranch`,fields:[{key:`release_provenance.enabled`,label:`Enable release provenance`,scope:`project`,kind:`toggle`,category:`Release Provenance`,icon:`GitBranch`,customRender:`card-owns`},{key:`release_provenance.production_refs`,label:`Production refs`,scope:`project`,kind:`list`,category:`Release Provenance`,icon:`GitBranch`,note:`Refs that represent shipped code (e.g. tags v*, refs/tags/release-*). Empty keeps state unreconciled rather than guessing.`,customRender:`card-owns`},{key:`release_provenance.integration_refs`,label:`Integration refs`,scope:`project`,kind:`list`,category:`Release Provenance`,icon:`GitBranch`,note:`Refs that represent merged-but-not-yet-shipped code (e.g. main, develop).`,customRender:`card-owns`},{key:`release_provenance.github.repo`,label:`GitHub repo`,scope:`project`,kind:`text`,category:`Release Provenance`,icon:`GitBranch`,note:`owner/name. Empty disables PR-evidence lookup.`,customRender:`card-owns`},{key:`release_provenance.github.token_env`,label:`GitHub token env var`,scope:`project`,kind:`text`,category:`Release Provenance`,icon:`GitBranch`,note:`Name of the environment variable holding the GitHub token. Token values must never be stored in config.`,customRender:`card-owns`},{key:`release_provenance.github.max_lookups_per_run`,label:`Max PR lookups per run`,scope:`project`,kind:`number`,category:`Release Provenance`,icon:`GitBranch`,min:0,max:200,note:`Caps per-reconcile GitHub API calls so a noisy backlog can't drain the rate limit.`,customRender:`card-owns`},{key:`release_provenance.reconcile_interval_minutes`,label:`Reconcile interval (minutes)`,scope:`grove`,kind:`number`,category:`Release Provenance`,icon:`GitBranch`,min:1,max:1440,note:`How often the PowerManager-driven reconciler refreshes provenance state.`,customRender:`card-owns`},{key:`release_provenance.production_debug_include_unknown`,label:`Include unknown clues in production-debug`,scope:`project`,kind:`toggle`,category:`Release Provenance`,icon:`GitBranch`,note:`Lets production-debug retrieval surface unclassified clues alongside released hits.`,customRender:`card-owns`},{key:`release_provenance.package_map`,label:`Package map`,scope:`project`,kind:`list`,category:`Release Provenance`,icon:`GitBranch`,note:`Monorepo path-glob → tag-pattern entries. Records outside any mapping fall back to the umbrella refs.`,customRender:`card-owns`}]},{id:`notifications`,label:`Notifications`,desc:`What Myco surfaces in the daemon UI and which channels it uses.`,category:`Notifications`,icon:`Bell`,fields:[{key:`notifications.enabled`,label:`Enable notifications`,scope:`project`,kind:`toggle`,category:`Notifications`,icon:`Bell`,note:`Master switch — disables every notification channel when off.`,customRender:`card-owns`},{key:`notifications.default_mode`,label:`Default mode`,scope:`project`,kind:`select`,category:`Notifications`,icon:`Bell`,options:[`banner`,`summary`],note:`How new notification types display until you customize them per-domain.`,customRender:`card-owns`},{key:`notifications.system_notifications`,label:`Browser system notifications`,scope:`project`,kind:`toggle`,category:`Notifications`,icon:`Bell`,note:`Pipe banner-mode notifications through the browser Notification API.`,customRender:`card-owns`}]},{id:`skills`,label:`Skills`,desc:`Thresholds the skill-lifecycle pipeline uses to surface, promote, and retire skills.`,category:`Skills`,icon:`Sparkles`,fields:[{key:`skills.confidence_threshold`,label:`Auto-promote confidence`,scope:`project`,kind:`number`,category:`Skills`,icon:`Sparkles`,min:0,max:1,step:.05,note:`Survey candidates above this score auto-promote without a manual approve.`},{key:`skills.usage_stale_days`,label:`Stale-skill window (days)`,scope:`project`,kind:`number`,category:`Skills`,icon:`Sparkles`,min:0,suffix:`days`,note:`Skills with no usage in this many days get flagged for review.`}]},{id:`maintenance`,label:`Maintenance`,desc:`Background database hygiene jobs the daemon runs against this Grove.`,category:`Maintenance`,icon:`Wrench`,fields:[{key:`maintenance.auto_optimize`,label:`Auto-run PRAGMA optimize`,scope:`grove`,kind:`toggle`,category:`Maintenance`,icon:`Wrench`},{key:`maintenance.auto_optimize_interval_hours`,label:`Optimize interval (hours)`,scope:`grove`,kind:`number`,category:`Maintenance`,icon:`Wrench`,min:1,max:720,suffix:`hours`,dependsOn:{key:`maintenance.auto_optimize`,value:!0}},{key:`maintenance.auto_integrity_check`,label:`Auto-run integrity check`,scope:`grove`,kind:`toggle`,category:`Maintenance`,icon:`Wrench`,note:`Runs integrity + foreign-key checks on a slow cadence; failures surface in the Database panel.`},{key:`maintenance.auto_integrity_check_interval_hours`,label:`Integrity-check interval (hours)`,scope:`grove`,kind:`number`,category:`Maintenance`,icon:`Wrench`,min:1,max:8760,suffix:`hours`,dependsOn:{key:`maintenance.auto_integrity_check`,value:!0},note:`Default is 168 hours (weekly).`}]},{id:`backup`,label:`Backup`,desc:`Where Grove backups land and how many are kept.`,category:`Backup`,icon:`Save`,fields:[{key:`backup.dir`,label:`Backup directory`,scope:`grove`,kind:`text`,category:`Backup`,icon:`Save`,nullableEmpty:!0,note:`Override for the backup root. Supports ~. Defaults to <groveHome>/backups when empty.`},{key:`backup.auto_interval_hours`,label:`Auto-backup interval (hours)`,scope:`grove`,kind:`number`,category:`Backup`,icon:`Save`,min:1,max:720,suffix:`hours`,note:`Minimum hours between auto-backups. Default is 24 (one per day per machine).`},{key:`backup.retention.keep_daily`,label:`Daily backups to keep`,scope:`grove`,kind:`number`,category:`Backup`,icon:`Save`,min:1,max:365,suffix:`days`},{key:`backup.retention.keep_weekly`,label:`Weekly backups to keep`,scope:`grove`,kind:`number`,category:`Backup`,icon:`Save`,min:0,max:52,suffix:`weeks`,note:`Kept beyond the daily window for longer-term restore points.`}]},{id:`sessions`,label:`Sessions`,desc:`Session lifecycle thresholds the daemon uses for staleness detection.`,category:`Sessions`,icon:`Activity`,fields:[{key:`daemon.stale_session_threshold_ms`,label:`Stale-session threshold (ms)`,scope:`grove`,kind:`number`,category:`Sessions`,icon:`Activity`,min:1,max:10080,unit:{displayUnit:`minutes`,factor:6e4},note:`How long an idle session waits before it's auto-completed (display in minutes; daemon stores milliseconds).`}]},{id:`logging`,label:`Logging`,desc:`Daemon-process log verbosity and retention.`,category:`Logging`,icon:`ScrollText`,fields:[{key:`daemon.log_level`,label:`Log level`,scope:`machine`,kind:`select`,category:`Logging`,icon:`ScrollText`,options:[`debug`,`info`,`warn`,`error`]},{key:`daemon.log_retention_days`,label:`Log retention (days)`,scope:`machine`,kind:`number`,category:`Logging`,icon:`ScrollText`,min:1,max:365,suffix:`days`,note:`Window for log_entries rows. One daemon, one retention policy across every Grove it serves.`}]},{id:`update`,label:`Update`,desc:`Which release stream the daemon pulls updates from.`,category:`Update`,icon:`RotateCcw`,fields:[{key:`daemon.update_channel`,label:`Update channel`,scope:`machine`,kind:`select`,category:`Update`,icon:`RotateCcw`,options:[`stable`,`beta`],note:`Use beta for dogfood/preview builds. Project local.yaml can override per-project.`,customRender:`card-owns`}]}],t3=[`machine-config`];function n3(){return Vs({queryKey:[...t3],queryFn:({signal:e})=>$i(`/machine-config`,{signal:e}),refetchInterval:!1,pollCategory:`standard`,contextFree:!0})}function r3(){let e=We();return st({mutationFn:e=>ca(`/machine-config`,{patch:e}),onSuccess:t=>{e.setQueryData([...t3],{config:t}),e.invalidateQueries({queryKey:[`config`,`merged`]})}})}function i3(){let e=Na(),t=Oa(),n=n3(),r=ka(),i=r3(),a=t.data?.config,o=n.data?.config;return{readField:(0,W.useCallback)(t=>{switch(t.scope){case`project`:{let n=e.effective;return n==null?void 0:ga(n,t.key)}case`grove`:return a?ga(a,t.key):void 0;case`machine`:return o?ga(o,t.key):void 0}},[e.effective,a,o]),writeField:(0,W.useCallback)(async(t,n)=>{switch(t.scope){case`project`:await e.setField(t.key,n,`project`);return;case`grove`:{let e={};_a(e,t.key,n),await r.mutateAsync(e);return}case`machine`:{let e={};_a(e,t.key,n),await i.mutateAsync(e);return}}},[e,r,i]),isLoading:e.isLoading||!!t.isLoading||!!n.isLoading,error:t.error??n.error??null,scopeCounts:(0,W.useMemo)(()=>{let e={project:0,grove:0,machine:0};for(let t of e3)for(let n of t.fields)n.customRender!==`card-owns`&&(e[n.scope]+=1);return e},[])}}var a3={Activity:oo,Bell:lo,Bot:fo,Brain:po,GitBranch:Go,MessageSquare:is,RotateCcw:ms,Save:hs,ScrollText:gs,Sparkles:Cs,Users:Ns,Wrench:Fs};function o3({name:e,className:t}){return(0,G.jsx)(a3[e]??fo,{className:t})}var s3={toggle:J2,select:Y2,number:Z2,text:Q2,list:e4,secret:t4},c3={project:`project`,grove:`grove`,machine:`machine`};function l3(e,t){let[n,r]=(0,W.useState)(e);return(0,W.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function u3(e,t){return t?`${e.label} ${e.key} ${e.category}`.toLowerCase().includes(t.toLowerCase()):!0}function d3(e){return e.customRender!==`card-owns`}function f3(e){return e.fields.filter(d3)}function p3(e,t,n){return f3(e).filter(e=>t!==`all`&&e.scope!==t?!1:u3(e,n))}function m3(e,t){for(let n of e3)for(let r of n.fields)if(r.key===e&&r.scope===t)return r}function h3(e,t,n,r,i){if(i){let t=r.trim(),i=e=>n===`all`||e.scope===n;return t.length>0?e.fields.some(e=>i(e)&&u3(e,t)):n===`all`?!0:e.fields.some(e=>i(e))}return t.length>0}var g3=new Set([`agent`,`embedding`,`capture`,`release-provenance`,`notifications`,`update`,`backup`,`logging`]),_3={agent:()=>(0,G.jsx)(h4,{}),embedding:()=>(0,G.jsx)(_4,{}),capture:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(n4,{}),e.length>0&&(0,G.jsx)(E3,{fields:e,hasProject:t,unified:n})]}),"release-provenance":()=>(0,G.jsx)(w4,{}),notifications:()=>(0,G.jsx)(a4,{}),update:()=>(0,G.jsx)(F4,{}),backup:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(E3,{fields:e,hasProject:t,unified:n}),(0,G.jsx)($4,{embedded:!0})]}),logging:({fields:e,hasProject:t,unified:n})=>(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(E3,{fields:e,hasProject:t,unified:n}),(0,G.jsx)(v3,{})]})};function v3(){let e=Zs().data?.context?.request?.machine_id??`—`;return(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 py-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] md:items-start`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-sans text-sm font-medium text-on-surface`,children:`Machine ID`}),(0,G.jsx)(OO,{scope:c3.machine})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:`Stable identifier this daemon uses when speaking to the team worker. Read-only.`})]}),(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(`div`,{className:`flex h-9 w-full items-center rounded-md border border-[var(--ghost-border)] bg-surface-container-lowest px-3 font-mono text-sm text-on-surface`,children:e})})]})}function y3(){return(0,G.jsx)(dN,{children:(0,G.jsx)(b3,{})})}function b3(){let e=xa()!==null,t=i3(),[n,r]=(0,W.useState)(`all`),[i,a]=(0,W.useState)(``),o=l3(i,150),[s,c]=(0,W.useState)(e3[0]?.id??``),l=(0,W.useRef)(null),u=(0,W.useMemo)(()=>e3.map(e=>{let t=g3.has(e.id),r=p3(e,n,o);return{group:e,isCustom:t,visibleFields:r,visible:h3(e,r,n,o,t),mixedScopes:new Set(e.fields.map(e=>e.scope)).size>1}}),[n,o]),d=u.some(e=>e.visible);(0,W.useEffect)(()=>{let e=typeof window<`u`?window.location.hash.replace(`#`,``):``;if(!e||!e3.some(t=>t.id===e))return;c(e);let t=document.getElementById(e);t&&requestAnimationFrame(()=>t.scrollIntoView({behavior:`auto`,block:`start`}))},[]),(0,W.useEffect)(()=>{if(t.isLoading)return;let e=new URLSearchParams(window.location.search),n=e.get(`configField`),r=e.get(`configSection`);if(!n&&!r)return;let i=[`ring-2`,`ring-primary/40`,`bg-primary/5`],a=(()=>{if(n){let e=n;for(;e.length>0;){let t=document.getElementById(Xa(e));if(t)return t;let n=e.lastIndexOf(`.`);if(n===-1)break;e=e.slice(0,n)}}if(r){let e=document.getElementById(r);if(e)return e}return null})();a&&requestAnimationFrame(()=>{a.scrollIntoView({behavior:`smooth`,block:`center`}),a.classList.add(...i),window.setTimeout(()=>a.classList.remove(...i),2e3)})},[t.isLoading]);let f=(0,W.useCallback)(e=>{c(e);let t=document.getElementById(e);t&&t.scrollIntoView({behavior:`smooth`,block:`start`})},[]);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsxs)(`div`,{className:`px-6 pt-6`,children:[(0,G.jsx)(cN,{title:`Settings`,subtitle:`Project, Grove, and Machine settings in one place. Use the filter bar to narrow by scope.`}),!e&&(0,G.jsx)(`div`,{className:`mb-3 rounded-md border border-outline-variant/30 bg-surface-container/40 px-3 py-2 font-sans text-sm text-on-surface-variant`,children:`Select a project to edit Project and Grove settings. Machine-scoped settings are still editable below.`}),(0,G.jsx)(mN,{}),(0,G.jsx)(S3,{scope:n,onScopeChange:r,searchInput:i,onSearchChange:a,scopeCounts:t.scopeCounts})]}),(0,G.jsx)(`div`,{ref:l,className:`flex-1 overflow-auto px-6 pb-6`,children:(0,G.jsxs)(`div`,{className:`flex gap-6`,children:[(0,G.jsx)(C3,{summaries:u,activeId:s,onSelect:f}),(0,G.jsxs)(`main`,{className:`flex-1 space-y-4`,children:[!d&&(0,G.jsx)(`div`,{className:`flex h-64 items-center justify-center font-sans text-sm text-on-surface-variant`,children:`No settings match your filters.`}),u.map(n=>n.visible?(0,G.jsx)(w3,{group:n.group,isCustom:n.isCustom,visibleFields:n.visibleFields,mixedScopes:n.mixedScopes,hasProject:e,unified:t},n.group.id):null)]})]})})]})}var x3=[{value:`all`,label:`All`},{value:`project`,label:`Project`},{value:`grove`,label:`Grove`},{value:`machine`,label:`Machine`}];function S3({scope:e,onScopeChange:t,searchInput:n,onSearchChange:r,scopeCounts:i}){let a=i.project+i.grove+i.machine;return(0,G.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,G.jsx)(`div`,{role:`tablist`,"aria-label":`Filter settings by scope`,className:`inline-flex overflow-hidden rounded-md border border-[var(--ghost-border)] bg-surface-container-low`,children:x3.map(n=>{let r=n.value===`all`?a:i[n.value],o=n.value===e;return(0,G.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o,onClick:()=>t(n.value),className:J(`relative flex items-center gap-1.5 px-3 py-1.5 transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sage/40`,o?`bg-sage/10 text-on-surface`:`text-on-surface-variant hover:bg-surface-container hover:text-on-surface`),children:[o&&(0,G.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-[2px] bg-sage`}),(0,G.jsx)(`span`,{className:J(`myco-display-xs`,!o&&`text-on-surface-variant`),children:n.label}),(0,G.jsx)(X,{variant:`outline`,className:`px-1 py-0 text-[10px] font-mono`,children:r})]},n.value)})}),(0,G.jsxs)(`div`,{className:`relative flex-1 min-w-[16rem] max-w-md`,children:[(0,G.jsx)(_s,{className:`pointer-events-none absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-on-surface-variant`}),(0,G.jsx)(cp,{type:`search`,value:n,placeholder:`Search settings...`,onChange:e=>r(e.target.value),className:`pl-8 pr-8`}),n&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`Clear search`,onClick:()=>r(``),className:`absolute right-1.5 top-1/2 -translate-y-1/2 rounded-sm p-1 text-on-surface-variant hover:bg-surface-container-high/40 hover:text-on-surface`,children:(0,G.jsx)(Is,{className:`h-4 w-4`})})]})]})}function C3({summaries:e,activeId:t,onSelect:n}){return(0,G.jsx)(`nav`,{"aria-label":`Settings sections`,className:`sticky top-0 hidden h-fit w-[200px] shrink-0 self-start lg:block`,children:(0,G.jsx)(`ul`,{className:`space-y-0.5 py-2`,children:e.map(({group:e,visible:r,isCustom:i,visibleFields:a})=>{let o=e.id===t,s=i?f3(e).length:a.length;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:J(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left font-sans text-sm transition-colors`,o?`bg-surface-container-high/60 text-on-surface`:`text-on-surface-variant hover:bg-surface-container/40 hover:text-on-surface`,!r&&`opacity-40`),children:[(0,G.jsx)(o3,{name:e.icon,className:`h-4 w-4 shrink-0`}),(0,G.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant`,children:s})]})},e.id)})})})}function w3({group:e,isCustom:t,visibleFields:n,mixedScopes:r,hasProject:i,unified:a}){return(0,G.jsx)(Q,{level:`low`,className:`rounded-md p-4`,children:(0,G.jsxs)(`section`,{id:e.id,className:`scroll-mt-4`,children:[(0,G.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(o3,{name:e.icon,className:`h-4 w-4 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`font-mono text-[10px] uppercase tracking-wider text-on-surface-variant`,children:e.category}),(0,G.jsx)(`h2`,{className:`font-sans text-base text-on-surface`,children:e.label}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-outline`,children:e.desc})]}),r&&(0,G.jsx)(X,{variant:`outline`,className:`text-[10px]`,children:`Mixed scopes`})]}),t?(0,G.jsx)(T3,{groupId:e.id,fields:n,hasProject:i,unified:a}):(0,G.jsx)(E3,{fields:n,hasProject:i,unified:a})]})})}function T3({groupId:e,fields:t,hasProject:n,unified:r}){let i=_3[e];return i?(0,G.jsx)(`div`,{children:i({fields:t,hasProject:n,unified:r})}):null}function E3({fields:e,hasProject:t,unified:n}){return e.length===0?(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`No fields match the current filters.`}):(0,G.jsx)(`div`,{className:`divide-y divide-outline-variant/20`,children:e.map(e=>(0,G.jsx)(D3,{field:e,hasProject:t,unified:n},e.key))})}function D3({field:e,hasProject:t,unified:n}){let r=Xa(e.key),i=`setting-${e.key.replace(/\./g,`-`)}`,a=n.readField(e),o=e.scope===`grove`&&!t||e.scope===`project`&&!t,s=(()=>{if(!e.dependsOn)return!1;let t=m3(e.dependsOn.key,e.scope);return t?n.readField(t)!==e.dependsOn.value:!1})(),c=o||s,l=(0,W.useCallback)(t=>{n.writeField(e,t).catch(t=>{console.error(`[settings] writeField failed: ${e.key}`,t)})},[n,e]);return(0,G.jsxs)(`div`,{id:r,className:`grid grid-cols-1 gap-3 py-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] md:items-start scroll-mt-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:i,className:`font-sans text-sm font-medium text-on-surface`,children:e.label}),(0,G.jsx)(OO,{scope:c3[e.scope]}),(0,G.jsx)(`code`,{className:`font-mono text-[10px] text-on-surface-variant`,children:e.key})]}),e.note&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:e.note})]}),(0,G.jsx)(`div`,{className:`min-w-0`,children:(0,G.jsx)(O3,{inputId:i,field:e,value:a,onChange:l,disabled:c})})]})}function O3({inputId:e,field:t,value:n,onChange:r,disabled:i}){if(!s3[t.kind])return null;switch(t.kind){case`toggle`:return(0,G.jsx)(J2,{id:e,value:n??!1,onChange:e=>r(e),disabled:i,readonly:t.readonly});case`select`:return(0,G.jsx)(Y2,{id:e,value:n??``,onChange:e=>r(e),options:t.options??[],disabled:i,readonly:t.readonly});case`number`:{let a=t.unit?.factor??1,o=typeof n==`number`?n:0;return(0,G.jsx)(Z2,{id:e,value:a===1?o:o/a,onChange:e=>r(a===1?e:e*a),min:t.min,max:t.max,step:t.step,suffix:t.unit?.displayUnit??t.suffix,disabled:i,readonly:t.readonly})}case`text`:return(0,G.jsx)(Q2,{id:e,value:typeof n==`string`?n:``,onChange:e=>{let n=typeof e==`string`?e:``;t.nullableEmpty&&n.length===0?r(null):r(e)},disabled:i,readonly:t.readonly});case`list`:return(0,G.jsx)(e4,{id:e,value:Array.isArray(n)?n:[],onChange:e=>r(e),disabled:i,readonly:t.readonly});case`secret`:return(0,G.jsx)(t4,{id:e,value:typeof n==`string`?n:``,onChange:e=>r(e),disabled:i,readonly:t.readonly});default:return null}}function k3({Icon:e,children:t,...n}){return(0,G.jsxs)(PA,{...n,children:[(0,G.jsx)(e,{className:`h-3 w-3 mr-1.5`,"aria-hidden":!0}),t]})}function A3({term:e,children:t}){return(0,G.jsxs)(`div`,{className:`flex justify-between gap-2 text-xs`,children:[(0,G.jsx)(`dt`,{className:`text-on-surface-variant`,children:e}),(0,G.jsx)(`dd`,{className:`text-on-surface`,children:t})]})}function j3({name:e,slug:t,projectCount:n,machineId:r}){return(0,G.jsx)(FA,{tone:`sage`,eyebrow:(0,G.jsx)(k3,{Icon:As,tone:`sage`,children:`Grove`}),title:e,children:(0,G.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(A3,{term:`Slug`,children:(0,G.jsx)(`code`,{className:`font-mono`,children:t})}),(0,G.jsx)(A3,{term:`Projects`,children:(0,G.jsx)(`span`,{children:n})}),(0,G.jsx)(A3,{term:`Machine`,children:(0,G.jsx)(`code`,{className:`font-mono`,children:r})})]})})}function M3({uptimeSeconds:e,port:t,version:n}){return(0,G.jsx)(FA,{tone:`sage`,eyebrow:(0,G.jsx)(k3,{Icon:Os,tone:`sage`,children:`Daemon`}),title:VO(e),children:(0,G.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(A3,{term:`Port`,children:(0,G.jsxs)(`code`,{className:`font-mono`,children:[`:`,t]})}),(0,G.jsx)(A3,{term:`Version`,children:(0,G.jsx)(`code`,{className:`font-mono`,children:n})}),(0,G.jsx)(A3,{term:`Status`,children:(0,G.jsx)(X,{variant:`default`,children:`running`})})]})})}function N3(){return Vs({queryKey:[`team-status`],queryFn:({signal:e})=>$i(`/team/status`,{signal:e}),refetchInterval:Hs.STATS,pollCategory:`standard`})}function P3(e){return typeof e==`object`&&!!e&&e.error===`cf_api_token_not_configured`}function F3(e){return Vs({queryKey:[`team-queue-stats`],queryFn:({signal:e})=>$i(`/team/queue-stats`,{signal:e}),refetchInterval:Hs.UPDATE,pollCategory:`standard`,enabled:e,placeholderData:H})}function I3(e){return Vs({queryKey:[`team-sync-summary`],queryFn:({signal:e})=>$i(`/team/sync-summary`,{signal:e}),refetchInterval:Hs.UPDATE,pollCategory:`standard`,enabled:e,placeholderData:H})}function L3(e){return Vs({queryKey:[`team-dlq`],queryFn:({signal:e})=>$i(`/team/dlq`,{signal:e}),pollCategory:`standard`,enabled:e,placeholderData:H})}function R3(){return Vs({queryKey:[`team-members`],queryFn:({signal:e})=>$i(`/team/members`,{signal:e}),refetchInterval:Hs.STATS,pollCategory:`standard`})}function z3({groveSlug:e}){let{data:t}=N3(),{data:n}=R3(),r=t?.enabled??!1,i=t?.healthy??!1,a=r?i?`default`:`destructive`:`outline`,o=r?i?`synced`:`unhealthy`:`not connected`,s=n?.members.length??0;return(0,G.jsx)(ri,{to:`/g/${e}/team`,className:`block transition-opacity hover:opacity-90`,children:(0,G.jsx)(FA,{tone:`ochre`,eyebrow:(0,G.jsx)(k3,{Icon:Ns,tone:`ochre`,children:`Team`}),title:`${s} member${s===1?``:`s`}`,children:(0,G.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(A3,{term:`Status`,children:(0,G.jsx)(X,{variant:a,children:o})}),(0,G.jsx)(A3,{term:`Pending sync`,children:(0,G.jsx)(`span`,{children:t?.pending_sync_count??0})})]})})})}function B3(){return Vs({queryKey:[`maintenance-summary`],queryFn:({signal:e})=>$i(`/maintenance/summary`,{signal:e}),refetchInterval:Hs.STATS,pollCategory:`standard`})}function V3(){return Vs({queryKey:[`projects-activity`],queryFn:({signal:e})=>$i(`/projects/activity`,{signal:e}),refetchInterval:Hs.STATS,pollCategory:`standard`})}function H3({groveSlug:e}){let{data:t,isLoading:n}=V3(),r=(t?.projects??[]).filter(t=>t.grove_slug===e);return(0,G.jsx)(FA,{tone:`sage`,eyebrow:`Projects`,title:`In this Grove`,actions:(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:r.length}),padded:!1,children:n&&r.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`Loading…`}):r.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`No projects yet.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:r.map(t=>(0,G.jsx)(`li`,{children:(0,G.jsx)(Aj,{accent:`sage`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(Qo,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(ri,{to:`/g/${e}/p/${t.project_id}`,className:`block truncate text-sm text-on-surface hover:text-sage`,children:t.project_name}),(0,G.jsxs)(`div`,{className:`flex gap-x-3 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{children:[t.scheduled_runs_last_24h,` run`,t.scheduled_runs_last_24h===1?``:`s`,` / 24h`]}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[`last activity`,` `,t.last_activity_at?UA(t.last_activity_at):`never`]})]})]}),(0,G.jsx)(X,{variant:t.is_active?`default`:`outline`,children:t.is_active?`active`:`cold`})]})})},t.project_id))})})}function U3(e){let t=Nn(),{data:n,isLoading:r}=Dk({status:`active`,limit:10}),i=n?.sessions??[];return(0,G.jsx)(FA,{tone:`sage`,eyebrow:`Active now`,title:`${i.length} ${i.length===1?`live session`:`live sessions`}`,padded:!1,children:r&&i.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`Loading…`}):i.length===0?(0,G.jsxs)(`div`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:[(0,G.jsx)(`p`,{className:`font-medium m-0`,children:`Nothing active`}),(0,G.jsx)(`p`,{className:`text-xs m-0`,children:`No symbiont sessions are running right now in this Grove.`})]}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:i.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(Aj,{accent:`sage`,onClick:()=>t(`/sessions/${e.id}`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(BO,{tone:`sage`,pulse:!0}),(0,G.jsx)(`span`,{className:`truncate text-sm text-on-surface flex-1 min-w-0`,children:e.title||`Untitled session`}),(0,G.jsx)(X,{variant:`outline`,children:e.agent}),(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-on-surface-variant whitespace-nowrap`,children:WA(e.started_at)})]}),e.branch&&(0,G.jsxs)(`div`,{className:`mt-1 ml-5 flex items-center gap-1 font-mono text-[10px] italic text-on-surface-variant`,children:[(0,G.jsx)(Go,{className:`h-2.5 w-2.5`}),e.branch]})]})},e.id))})})}function W3(e=`project`){let t=e===`all-groves`?`grove`:e;return Vs({queryKey:[`embedding-details`,t],queryFn:({signal:e})=>$i(`/embedding/details?scope=${t}`,{signal:e}),refetchInterval:Hs.STATS,pollCategory:`standard`})}function G3(){return Vs({queryKey:[`database-details`],queryFn:({signal:e})=>$i(`/database/details`,{signal:e}),refetchInterval:Hs.STATS,pollCategory:`standard`})}function K3({groveSlug:e}){let{data:t}=W3(`grove`),{data:n}=G3(),r=t?Object.values(t.pending).reduce((e,t)=>e+t,0):0;return(0,G.jsx)(FA,{tone:`sage`,eyebrow:(0,G.jsx)(k3,{Icon:Ao,tone:`sage`,children:`Grove`}),title:`Vault`,actions:(0,G.jsxs)(ri,{to:`/g/${e}/operations`,className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Operations `,(0,G.jsx)(co,{className:`h-3 w-3`})]}),children:(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,G.jsx)(RA,{label:`Vectors`,value:t?String(t.total):`—`,tone:`sage`,mono:!0}),(0,G.jsx)(RA,{label:`Pending`,value:String(r),tone:r>0?`ochre`:`default`,mono:!0}),(0,G.jsx)(RA,{label:`DB size`,value:n?tj(n.file.size_bytes):`—`,tone:`sage`,mono:!0}),(0,G.jsx)(RA,{label:`Fragmentation`,value:n?`${n.file.fragmentation_pct.toFixed(1)}%`:`—`,tone:n&&n.file.fragmentation_pct>25?`ochre`:`default`,mono:!0})]})})}function q3({error:e,isLoading:t,backups:n,last:r}){return e?`Snapshot unavailable`:t||!n?`—`:r?UA(r.modified_at):`No backups yet`}function J3(){let{data:e,error:t,isLoading:n}=ot({queryKey:[`backups`],queryFn:({signal:e})=>$i(`/backups`,{signal:e})}),r=e?.backups??null,i=r&&r.length>0?r[0]:null,a=r?r.slice(1,5):[];return(0,G.jsx)(FA,{tone:`sage`,eyebrow:`Backup`,title:q3({error:t??null,isLoading:n,backups:r,last:i}),actions:(0,G.jsxs)(ri,{to:`/settings#backup`,className:`inline-flex items-center gap-1 text-xs font-sans text-on-surface-variant hover:text-on-surface`,children:[`Settings `,(0,G.jsx)(co,{className:`h-3 w-3`})]}),children:t?(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0`,children:t.message}):n||!r?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`Loading…`}):i===null?(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:[`Run `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco backup`}),` to create the first snapshot.`]}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-on-surface`,children:[(0,G.jsx)(Vo,{className:`h-3.5 w-3.5 shrink-0 text-on-surface-variant`}),(0,G.jsx)(`code`,{className:`font-mono truncate`,children:i.file_name})]}),(0,G.jsxs)(`div`,{className:`mt-1 flex gap-x-3 text-xs text-on-surface-variant`,children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,G.jsx)(Eo,{className:`h-3 w-3`}),UA(i.modified_at)]}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsx)(`span`,{children:tj(i.size_bytes)})]})]}),a.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`myco-eyebrow-sm text-outline`,children:`Recent`}),(0,G.jsx)(`ul`,{className:`mt-1 m-0 p-0 list-none flex flex-col gap-0.5`,children:a.map(e=>(0,G.jsxs)(`li`,{className:`flex justify-between text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{children:UA(e.modified_at)}),(0,G.jsx)(`span`,{children:tj(e.size_bytes)})]},e.file_name))})]})]})})}function Y3({currentGroveSlug:e}){let{data:t,isLoading:n}=tc(),r=(t?.groves??[]).filter(t=>t.slug!==e);return n&&r.length===0?(0,G.jsx)(FA,{tone:`ochre`,eyebrow:`Other Groves`,title:`Loading…`}):r.length===0?(0,G.jsx)(FA,{tone:`ochre`,eyebrow:`Other Groves`,title:`Just this one`,children:(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:[`Create another with `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco grove create`}),`.`]})}):(0,G.jsx)(FA,{tone:`ochre`,eyebrow:`Other Groves`,title:`${r.length} ${r.length===1?`sibling Grove`:`sibling Groves`}`,children:(0,G.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:r.map(e=>(0,G.jsxs)(ri,{to:`/g/${e.slug}`,className:`block rounded-md border border-[var(--ghost-border)] p-3 transition-colors hover:bg-surface-container`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(As,{className:`h-3.5 w-3.5 text-ochre`}),(0,G.jsx)(`span`,{className:`truncate text-sm font-medium text-on-surface`,children:e.name}),e.is_default&&(0,G.jsx)(X,{variant:`outline`,children:`default`})]}),(0,G.jsxs)(`div`,{className:`mt-1 flex gap-x-3 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e.slug}),(0,G.jsx)(`span`,{children:`·`}),(0,G.jsxs)(`span`,{children:[e.project_count,` project`,e.project_count===1?``:`s`]})]})]},e.slug))})})}function X3(){let e=xa(),{data:t}=Zs();if(!e||!t)return(0,G.jsx)(OA,{isLoading:!0,error:null,loadingText:`Loading Grove…`,children:(0,G.jsx)(`span`,{})});let n=e.grove;return(0,G.jsxs)(AA,{children:[(0,G.jsx)(cN,{title:n.name,subtitle:`Database boundary for this set of projects. Embedding, vault, backups, and team sync are all Grove-scoped.`}),(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,G.jsx)(j3,{name:n.name,slug:n.slug,projectCount:n.project_count??0,machineId:t.context.request.machine_id}),(0,G.jsx)(M3,{uptimeSeconds:t.daemon.uptime_seconds,port:t.daemon.port,version:t.daemon.version}),(0,G.jsx)(z3,{groveSlug:n.slug})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,G.jsx)(H3,{groveSlug:n.slug}),(0,G.jsx)(U3,{groveSlug:n.slug})]}),(0,G.jsxs)(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:[(0,G.jsx)(K3,{groveSlug:n.slug}),(0,G.jsx)(J3,{})]}),(0,G.jsx)(Y3,{currentGroveSlug:n.slug})]})}var Z3=[`sessions`,`spores`,`plans`,`artifacts`,`skill_records`,`canopy_entries`],Q3={},$3=20;function e6(e){return e.provider.available?Object.values(e.pending).some(e=>e>0)?`processing`:`idle`:`unavailable`}function t6(e){return e.provider.available?Object.values(e.pending).some(e=>e>0)?`bg-secondary`:`bg-primary`:`bg-tertiary`}function n6({data:e}){return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full font-mono text-sm`,"aria-label":`Embedding namespace breakdown`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-left text-on-surface-variant`,children:[(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Namespace`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Embedded`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Pending`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Stale`}),(0,G.jsx)(`th`,{className:`pb-2 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Total`})]})}),(0,G.jsx)(`tbody`,{children:Z3.map((t,n)=>{let r=e.by_namespace[t],i=r?.embedded??0,a=r?.stale??0,o=e.pending[t]??0,s=i+o;return(0,G.jsxs)(`tr`,{className:J(`transition-colors hover:bg-surface-container-high/50`,n%2==1?`bg-surface-container-low/30`:``),children:[(0,G.jsx)(`td`,{className:`py-2.5 pr-4`,children:Q3[t]??t}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:i}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:o>0?(0,G.jsx)(`span`,{className:`text-secondary`,children:o}):o}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:a>0?(0,G.jsx)(`span`,{className:`text-tertiary`,children:a}):a}),(0,G.jsx)(`td`,{className:`py-2.5 text-right`,children:s})]},t)})})]})})}function r6(){let e=We(),t=xa(),[n,r]=(0,W.useState)(null),i=`grove`,{data:a,isLoading:o,isError:s,error:c}=W3(`grove`),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!1);function p(e,n,r,a){let o=W4(i,t);if(!(o&&J4(e,o))){r();return}u({action:n,scopeKind:i,run:r,variant:a})}let[m,h]=(0,W.useState)([]),g=a?.total??null;(0,W.useEffect)(()=>{g!==null&&h(e=>{let t=[...e,g];return t.length>$3?t.slice(-$3):t})},[g]);async function _(){r(null);try{let n=await sa(`/embedding/reembed-stale`,{scope:W4(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Re-embed dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Re-embedded ${n.reembedded??0} stale vectors in ${n.passes??0} pass(es)`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${T4(e)}`})}}function v(){p(`reembed-stale`,`Re-embed stale vectors`,_)}async function y(){r(null);try{let n=await sa(`/embedding/rebuild`,{scope:W4(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Rebuild dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Rebuild cleared ${n.queued??0} vectors and re-embedded ${n.embedded??0} records (passes ${n.passes??0}, remaining ${n.remaining_queue_depth??0})`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${T4(e)}`})}}function b(){p(`rebuild`,`Rebuild all vectors`,y,`destructive`)}async function x(){r(null);try{let n=await sa(`/embedding/clean-orphans`,{scope:W4(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Clean orphans dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Cleaned ${n.orphans_cleaned??0} orphan vectors`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${T4(e)}`})}}function S(){p(`clean-orphans`,`Clean orphan vectors`,x)}async function C(){r(null);try{let n=await sa(`/embedding/reconcile`,{scope:W4(i,t)});n.summary?r({type:n.summary.failed>0?`error`:`success`,text:`Reconcile dispatched across ${n.summary.ok+n.summary.failed} Grove(s); ${n.summary.failed} failed`}):r({type:`success`,text:`Reconcile complete: ${n.embedded??0} embedded, ${n.orphans_cleaned??0} orphans cleaned (${n.duration_ms??0}ms)`}),e.invalidateQueries({queryKey:[`embedding-details`]})}catch(e){r({type:`error`,text:`Error: ${T4(e)}`})}}function w(){p(`reconcile`,`Force reconcile embeddings`,C)}if(!a)return(0,G.jsx)(OA,{isLoading:o,error:s?c instanceof Error?c:Error(`Unable to reach daemon`):null,loadingText:`Loading embedding details...`,children:(0,G.jsx)(`div`,{})});let T=Object.values(a.pending).reduce((e,t)=>e+t,0),E=Object.values(a.by_namespace).reduce((e,t)=>e+t.stale,0);return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-sans text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Ao,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Provider`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:a.provider.name})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Model`}),(0,G.jsx)(`span`,{className:`font-mono text-xs text-on-surface truncate max-w-[200px]`,title:a.provider.model,children:a.provider.model})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:J(`h-2 w-2 rounded-full`,t6(a))}),(0,G.jsx)(`span`,{className:`text-on-surface-variant capitalize`,children:e6(a)})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-3`,children:[(0,G.jsx)(v0,{label:`Total Vectors`,value:String(a.total),sparklineData:m,accent:`sage`}),(0,G.jsx)(v0,{label:`Pending`,value:String(T),accent:T>0?`ochre`:`outline`}),(0,G.jsx)(v0,{label:`Stale`,value:String(E),accent:E>0?`terracotta`:`outline`})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsx)(Qj,{children:`Namespace Breakdown`}),(0,G.jsx)(n6,{data:a})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[(0,G.jsx)(Qj,{children:`Actions`}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:v,children:[(0,G.jsx)(ps,{className:`mr-2 h-4 w-4`}),`Re-embed stale`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:S,children:[(0,G.jsx)(ks,{className:`mr-2 h-4 w-4`}),`Clean orphans`]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:w,children:[(0,G.jsx)(us,{className:`mr-2 h-4 w-4`}),`Force reconcile`]}),(0,G.jsxs)(Y,{variant:`destructive`,size:`sm`,onClick:b,children:[(0,G.jsx)(ms,{className:`mr-2 h-4 w-4`}),`Rebuild all`]})]}),n&&(0,G.jsx)(`p`,{className:J(`font-sans text-sm`,n.type===`success`?`text-primary`:`text-tertiary`),children:n.text})]}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(ri,{to:`/logs?component=embedding`,className:`font-sans text-xs text-primary hover:text-primary/80 transition-colors flex items-center gap-1`,children:`View embedding activity in Logs →`})}),l&&(0,G.jsx)(q4,{open:!0,onOpenChange:e=>{e||u(null)},action:l.action,scope:W4(l.scopeKind,t)??{kind:`all-groves`},variant:l.variant,isPending:d,onConfirm:async()=>{f(!0);try{await l.run()}finally{f(!1),u(null)}}})]})}var i6=15,a6=`insufficient_disk_space`,o6=20,s6=[`grove`,`all-groves`];function c6(e){if(e<=0)return`now`;let t=Math.floor(e/1e3);if(t<60)return t+`s`;let n=Math.floor(t/60);return n<60?n+`m`:Math.floor(n/60)+`h`}function l6({title:e,value:t,onChange:n,available:r}){return(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(Qj,{children:e}),(0,G.jsx)(V4,{value:t,onChange:n,available:r})]})}function u6({scope:e}){return(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:U4[e]})}function d6({tables:e}){let t=[...e].sort((e,t)=>t.rows-e.rows);return(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`table`,{className:`w-full font-mono text-sm`,"aria-label":`Database table breakdown`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{className:`text-left text-on-surface-variant`,children:[(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Table`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Rows`}),(0,G.jsx)(`th`,{className:`pb-2 pr-4 font-sans font-medium text-xs uppercase tracking-widest text-right`,scope:`col`,children:`Indexes`}),(0,G.jsx)(`th`,{className:`pb-2 font-sans font-medium text-xs uppercase tracking-widest`,scope:`col`,children:`Type`})]})}),(0,G.jsx)(`tbody`,{children:t.map((e,t)=>(0,G.jsxs)(`tr`,{className:J(`transition-colors hover:bg-surface-container-high/50`,t%2==1?`bg-surface-container-low/30`:``),children:[(0,G.jsx)(`td`,{className:`py-2.5 pr-4`,children:e.name}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:e.rows.toLocaleString()}),(0,G.jsx)(`td`,{className:`py-2.5 pr-4 text-right`,children:e.index_count}),(0,G.jsx)(`td`,{className:`py-2.5`,children:e.is_fts?(0,G.jsx)(X,{variant:`outline`,className:`px-1.5 py-0 text-[10px] uppercase`,children:`FTS5`}):(0,G.jsx)(`span`,{className:`text-on-surface-variant/60`,children:`btree`})})]},e.name))})]})})}function f6({details:e,onActionResult:t}){let{effective:n}=Na(),r=We(),i=xa(),[a,o]=(0,W.useState)(!1),[s,c]=(0,W.useState)(`grove`),[l,u]=(0,W.useState)(!1);if(!n)return null;let d=n.maintenance.auto_optimize,f=n.maintenance.auto_optimize_interval_hours,p=e.last_optimize_at?new Date(e.last_optimize_at).getTime():null,m=p===null?0:p+f*zA*1e3-Date.now();async function h(){o(!0);try{let e=await sa(`/database/optimize`,{scope:W4(s,i)});if(e.summary)t({type:e.summary.failed>0?`error`:`success`,text:`Optimize dispatched across ${e.summary.ok+e.summary.failed} Grove(s); ${e.summary.failed} failed`});else{let n=e.actions_failed?.length??0;t({type:n>0?`error`:`success`,text:`Optimize complete: `+(e.actions_completed?.length??0)+` steps, `+n+` failed (`+(e.duration_ms??0)+`ms)`})}r.invalidateQueries({queryKey:[`database-details`]})}catch(e){t({type:`error`,text:`Error: `+T4(e)})}finally{o(!1)}}function g(){let e=W4(s,i);if(e&&J4(`optimize`,e)){u(!0);return}h()}return(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsx)(l6,{title:`Scheduled Maintenance`,value:s,onChange:c,available:s6}),(0,G.jsx)(u6,{scope:s}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Auto-optimize`}),` `,d?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`text-primary`,children:`on`}),`, every `,f,`h.`]}):(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`off.`}),` `,(0,G.jsx)(ri,{to:`/settings#maintenance`,className:`text-primary hover:text-primary/80 transition-colors text-xs`,children:`Configure in Settings →`})]}),(0,G.jsxs)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:[`Last run: `,e.last_optimize_at?UA(e.last_optimize_at):`never`,d&&p!==null&&(0,G.jsxs)(G.Fragment,{children:[` · Next: `,c6(m)]})]}),(0,G.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:g,disabled:a,children:[(0,G.jsx)(us,{className:`mr-2 h-4 w-4`}),a?`Running...`:`Run now`]}),(0,G.jsx)(q4,{open:l,onOpenChange:u,action:`Optimize database`,scope:W4(s,i)??{kind:`all-groves`},isPending:a,onConfirm:async()=>{await h(),u(!1)}})]})}function p6({onActionResult:e}){let[t,n]=(0,W.useState)(!1);async function r(){n(!0);try{let t=await sa(`/api/maintenance/release-provenance/reconcile`,{});if(t.disabled){e({type:`success`,text:`Release provenance reconciliation is disabled in config.`});return}let n=t.results??[],r=n.reduce((e,t)=>({reconciled:e.reconciled+t.reconciled,unchanged:e.unchanged+t.unchanged,failed:e.failed+t.failed,errors:e.errors+ +!!t.error}),{reconciled:0,unchanged:0,failed:0,errors:0}),i=`Release reconcile: ${n.length} project(s), ${r.reconciled} updated, ${r.unchanged} unchanged${r.failed?`, ${r.failed} rows failed`:``}${r.errors?`, ${r.errors} project errors`:``}.`;e({type:r.errors>0?`error`:`success`,text:i})}catch(t){e({type:`error`,text:`Error: `+T4(t)})}finally{n(!1)}}return(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[(0,G.jsx)(Qj,{children:`Release provenance`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Re-runs ancestry, patch-id, and (when configured) GitHub PR squash evidence checks for every served project. Reconciliation is idempotent — safe to invoke repeatedly. Status counts surface in each Grove's maintenance summary.`}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{onClick:r,disabled:t,variant:`outline`,size:`sm`,children:t?`Reconciling...`:`Reconcile now`})})]})}function m6({onActionResult:e}){let t=We(),n=xa(),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(`grove`),[s,c]=(0,W.useState)(null);function l(e,t,r,i){let o=W4(a,n);if(!(o&&J4(e,o))){r();return}c({action:t,run:r,variant:i})}async function u(){i(!0);try{let r=await sa(`/database/integrity-check`,{scope:W4(a,n)});r.summary?e({type:r.summary.failed>0?`error`:`success`,text:`Integrity check across ${r.summary.ok+r.summary.failed} Grove(s); ${r.summary.failed} failed`}):r.status===`ok`?e({type:`success`,text:`Integrity check OK (`+(r.duration_ms??0)+`ms)`}):e({type:`error`,text:`Integrity issues: `+(r.issues?.length??0)+` problems, `+(r.fk_violations??0)+` FK violations`}),t.invalidateQueries({queryKey:[`database-details`]})}catch(t){e({type:`error`,text:`Error: `+T4(t)})}finally{i(!1)}}function d(){l(`integrity-check`,`Run integrity check`,u)}async function f(){i(!0);try{let r=await sa(`/database/vacuum`,{scope:W4(a,n)});r.summary?e({type:r.summary.failed>0?`error`:`success`,text:`Vacuum across ${r.summary.ok+r.summary.failed} Grove(s); ${r.summary.failed} failed`}):e({type:`success`,text:`Vacuum complete: freed `+tj(r.freed_bytes??0)+` in `+(r.duration_ms??0)+`ms`}),t.invalidateQueries({queryKey:[`database-details`]})}catch(t){if(t instanceof ma){let n=t.body;if(n?.error===a6){e({type:`error`,text:`Insufficient disk: need `+tj(n.required_bytes??0)+`, have `+tj(n.free_bytes??0)});return}}e({type:`error`,text:`Error: `+T4(t)})}finally{i(!1)}}function p(){l(`vacuum`,`Vacuum database`,f,`destructive`)}async function m(){i(!0);try{let r=await sa(`/database/reindex`,{scope:W4(a,n)});r.summary?e({type:r.summary.failed>0?`error`:`success`,text:`Reindex across ${r.summary.ok+r.summary.failed} Grove(s); ${r.summary.failed} failed`}):e({type:`success`,text:`Reindex complete (`+(r.duration_ms??0)+`ms)`}),t.invalidateQueries({queryKey:[`database-details`]})}catch(t){e({type:`error`,text:`Error: `+T4(t)})}finally{i(!1)}}function h(){l(`reindex`,`Reindex database`,m)}return(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[(0,G.jsx)(l6,{title:`Actions`,value:a,onChange:o,available:s6}),(0,G.jsx)(u6,{scope:a}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:d,disabled:r,children:[(0,G.jsx)(ps,{className:`mr-2 h-4 w-4`}),`Integrity check`]}),(0,G.jsxs)(Y,{variant:`destructive`,size:`sm`,onClick:p,disabled:r,children:[(0,G.jsx)(ks,{className:`mr-2 h-4 w-4`}),`Vacuum`]}),(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:h,disabled:r,children:[(0,G.jsx)(ms,{className:`mr-2 h-4 w-4`}),`Reindex`]})]}),s&&(0,G.jsx)(q4,{open:!0,onOpenChange:e=>{e||c(null)},action:s.action,scope:W4(a,n)??{kind:`all-groves`},variant:s.variant,isPending:r,onConfirm:async()=>{await s.run(),c(null)}})]})}function h6(){let{data:e,isLoading:t,isError:n,error:r}=G3(),[i,a]=(0,W.useState)([]),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(`grove`);if((0,W.useEffect)(()=>{e&&a(t=>{let n=[...t,e.file.size_bytes];return n.length>o6?n.slice(-o6):n})},[e]),t)return(0,G.jsx)(`div`,{className:`text-on-surface-variant`,children:`Loading database details...`});if(n)return(0,G.jsxs)(`div`,{className:`text-tertiary`,children:[`Error: `,r.message]});if(!e)return null;let u=e.file.fragmentation_pct.toFixed(1)+`%`,d=e.file.fragmentation_pct>i6?`ochre`:`outline`;return(0,G.jsxs)(`div`,{className:`space-y-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-sans text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(jo,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Database`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:`myco.db`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Schema`}),(0,G.jsxs)(`span`,{className:`font-mono text-on-surface`,children:[`v`,e.schema.version]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Journal`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface uppercase`,children:e.schema.journal_mode})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`h-2 w-2 rounded-full bg-primary`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`healthy`})]})]}),(0,G.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-3`,children:[(0,G.jsx)(v0,{label:`Database Size`,value:tj(e.file.size_bytes),sparklineData:i,accent:`sage`}),(0,G.jsx)(v0,{label:`Fragmentation`,value:u,accent:d}),(0,G.jsx)(v0,{label:`WAL Size`,value:tj(e.file.wal_size_bytes),accent:`outline`})]}),(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsx)(l6,{title:`Schema Breakdown`,value:c,onChange:l,available:s6}),(0,G.jsx)(u6,{scope:c}),(0,G.jsx)(d6,{tables:e.tables})]}),(0,G.jsx)(f6,{details:e,onActionResult:s}),(0,G.jsx)(p6,{onActionResult:s}),(0,G.jsx)(m6,{onActionResult:s}),o&&(0,G.jsx)(`p`,{className:J(`font-sans text-sm`,o.type===`success`?`text-primary`:`text-tertiary`),children:o.text}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(ri,{to:`/logs?component=database`,className:`font-sans text-xs text-primary hover:text-primary/80 transition-colors flex items-center gap-1`,children:`View database activity in Logs →`})})]})}var g6=[{id:`embedding`,label:`Embedding`,description:`queues + namespaces`},{id:`database`,label:`Database`,description:`file health + maintenance`}],_6=new Set([`embedding`,`database`]),v6={embedding:`Provider, queues, namespaces. Each action runs against the active Grove.`,database:`File health, tables, schedule, and on-demand maintenance for this Grove’s SQLite store.`},y6=`tab`;function b6(){let e=new URLSearchParams(window.location.search).get(y6);return e&&_6.has(e)?e:`embedding`}function x6(e){let t=new URLSearchParams;e!==`embedding`&&t.set(y6,e);let n=t.toString(),r=n?`${window.location.pathname}?${n}`:window.location.pathname;window.history.replaceState(null,``,r)}function S6(){let e=We(),[t,n]=(0,W.useState)(b6),r=(0,W.useCallback)(e=>{let t=e;n(t),x6(t)},[]),i=(0,W.useCallback)(()=>{e.invalidateQueries({queryKey:[`embedding-details`]}),e.invalidateQueries({queryKey:[`database-details`]})},[e]);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsxs)(`div`,{className:`px-6 pt-6 space-y-6`,children:[(0,G.jsx)(cN,{title:`Operations`,subtitle:v6[t],actions:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:i,children:[(0,G.jsx)(ps,{size:14}),`Refresh`]})}),(0,G.jsx)(qN,{tabs:g6.map(e=>({id:e.id,label:e.label,description:e.description})),activeTab:t,onTabChange:r,columns:2})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,G.jsxs)(`div`,{className:`px-6 pb-6`,children:[t===`embedding`&&(0,G.jsx)(r6,{}),t===`database`&&(0,G.jsx)(h6,{})]})})]})}var C6=[{value:`15m`,label:`15m`},{value:`1h`,label:`1h`},{value:`6h`,label:`6h`},{value:`24h`,label:`24h`},{value:`7d`,label:`7d`},{value:`30d`,label:`30d`}];function w6({mode:e,onModeChange:t,searchValue:n,onSearchChange:r,onSearchSubmit:i,activeLevel:a,onLevelChange:o,components:s,activeComponents:c,onComponentToggle:l,onComponentsClear:u,timeRange:d,onTimeRangeChange:f,totalResults:p,paused:m=!1,onPausedToggle:h}){return(0,G.jsxs)(Q,{level:`default`,className:`rounded-md p-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center rounded-md bg-surface-container-low`,children:[(0,G.jsxs)(Y,{size:`sm`,variant:e===`live`?`default`:`ghost`,className:`h-7 gap-1.5 px-2.5 text-xs rounded-r-none`,onClick:()=>t(`live`),children:[(0,G.jsx)(fs,{className:`h-3 w-3`}),`Live`]}),(0,G.jsxs)(Y,{size:`sm`,variant:e===`search`?`default`:`ghost`,className:`h-7 gap-1.5 px-2.5 text-xs rounded-l-none`,onClick:()=>t(`search`),children:[(0,G.jsx)(_s,{className:`h-3 w-3`}),`Search`]})]}),e===`live`&&h&&(0,G.jsxs)(Y,{size:`sm`,variant:`ghost`,className:`h-7 gap-1.5 px-2.5 text-xs`,onClick:h,"aria-label":m?`Resume log stream`:`Pause log stream`,title:m?`Resume`:`Pause`,children:[m?(0,G.jsx)(us,{className:`h-3 w-3`}):(0,G.jsx)(ls,{className:`h-3 w-3`}),m?`Resume`:`Pause`]}),e===`search`&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-5 w-px bg-outline-variant/30`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Eo,{className:`h-3 w-3 text-on-surface-variant/50`}),C6.map(e=>(0,G.jsx)(Y,{size:`sm`,variant:d===e.value?`default`:`ghost`,className:`h-6 px-1.5 text-[10px]`,onClick:()=>f(e.value),children:e.label},e.value))]})]}),(0,G.jsx)(`form`,{className:`ml-auto flex items-center gap-1.5`,onSubmit:e=>{e.preventDefault(),i()},children:(0,G.jsx)(cp,{className:`h-7 w-56 text-xs`,placeholder:e===`search`?`Search logs...`:`Filter messages...`,value:n,onChange:e=>r(e.target.value),"aria-label":`Search log messages`})}),e===`search`&&p!==void 0&&(0,G.jsxs)(`span`,{className:`text-[10px] font-mono text-on-surface-variant/50 tabular-nums whitespace-nowrap`,children:[p.toLocaleString(),` results`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:Gs.map(e=>(0,G.jsxs)(Y,{size:`sm`,variant:a===e?`default`:`ghost`,className:`h-6 px-2 text-[10px] capitalize gap-1.5`,onClick:()=>o(e),children:[(0,G.jsx)(`div`,{className:J(`h-1.5 w-1.5 rounded-full`,Xs(e))}),e]},e))}),s.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`h-4 w-px bg-outline-variant/20`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 flex-wrap`,children:[s.map(e=>(0,G.jsx)(Y,{size:`sm`,variant:c.has(e)?`default`:`ghost`,className:`h-5 px-1.5 text-[10px]`,onClick:()=>l(e),children:e},e)),c.size>0&&(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-5 px-1.5 text-[10px] text-on-surface-variant`,onClick:u,children:`clear`})]})]})]})]})}var T6={debug:`border-l-outline/30`,info:`border-l-primary/50`,warn:`border-l-secondary/70`,error:`border-l-tertiary/80`},E6={context:`text-primary/70`,hooks:`text-on-surface-variant/70`,agent:`text-secondary/80`,daemon:`text-on-surface-variant/60`,capture:`text-primary/60`,processor:`text-on-surface-variant/70`,lifecycle:`text-primary/50`,embedding:`text-on-surface-variant/60`,power:`text-on-surface-variant/50`,server:`text-on-surface-variant/60`};function D6(e,t){if(t)return UA(e);let n=new Date(e);return`${String(n.getHours()).padStart(2,`0`)}:${String(n.getMinutes()).padStart(2,`0`)}:${String(n.getSeconds()).padStart(2,`0`)}`}var O6=40,k6=60;function A6(e){return typeof e==`string`&&e.length>0?e:null}var j6=[{pick:e=>A6(e.tool_name)},{pick:e=>A6(e.type)},{pick:e=>A6(e.agent_type)},{pick:e=>A6(e.task_subject),format:e=>KA(e,O6)},{pick:e=>A6(e.filename)},{pick:e=>A6(e.source_path)??A6(e.path),format:JA},{pick:e=>A6(e.error),format:e=>KA(e,k6)},{pick:e=>typeof e.pid==`number`?`pid ${e.pid}`:null}];function M6(e){if(!e)return``;for(let{pick:t,format:n}of j6){let r=t(e);if(r)return n?n(r):r}return``}function N6({entries:e,selectedId:t,onSelect:n,autoScroll:r=!1,relativeTime:i=!1,compact:a=!0}){let o=(0,W.useRef)(null);return(0,W.useEffect)(()=>{!r||!o.current||(o.current.scrollTop=o.current.scrollHeight)},[e,r]),(0,G.jsx)(`div`,{ref:o,className:`flex-1 overflow-y-auto bg-surface-container-lowest font-mono text-xs`,children:e.length===0?(0,G.jsx)(`div`,{className:`flex h-full min-h-[200px] items-center justify-center text-on-surface-variant/50 font-sans text-sm`,children:`No log entries`}):(0,G.jsxs)(`table`,{className:`w-full border-collapse`,"aria-label":`Log entries`,children:[(0,G.jsx)(`thead`,{className:`sticky top-0 z-10 bg-surface-container-lowest/95 backdrop-blur supports-[backdrop-filter]:bg-surface-container-lowest/80`,children:(0,G.jsxs)(`tr`,{className:`border-b border-outline-variant/10 text-[10px] uppercase tracking-[0.16em] text-on-surface-variant/50`,children:[(0,G.jsx)(`th`,{className:`w-[68px] px-3 py-2 text-left font-medium`,children:`Time`}),(0,G.jsx)(`th`,{className:`w-[12px] px-0 py-2`,"aria-hidden":`true`}),(0,G.jsx)(`th`,{className:`w-[48px] px-0 py-2 text-left font-medium`,children:`Level`}),(0,G.jsx)(`th`,{className:`w-[90px] px-0 py-2 text-left font-medium`,children:`Area`}),(0,G.jsx)(`th`,{className:`w-[72px] px-0 py-2 text-left font-medium`,children:`Session`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:`Message`})]})}),(0,G.jsx)(`tbody`,{children:e.map(e=>(0,G.jsx)(P6,{entry:e,selected:e.id===t,onSelect:n,relativeTime:i,compact:a},e.id))})]})})}var P6=(0,W.memo)(function({entry:e,selected:t,onSelect:n,relativeTime:r,compact:i}){let a=i?`py-0.5`:`py-1.5`,o=qA(e.session_id),s=M6(e.data);return(0,G.jsxs)(`tr`,{className:J(`cursor-pointer transition-colors border-l-2`,T6[e.level],t?`bg-primary/10`:`hover:bg-surface-container-high/30`),onClick:()=>n(e),children:[(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pl-3 pr-2 text-on-surface-variant/50 align-top w-[68px] tabular-nums`,a),children:D6(e.timestamp,r)}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-1 align-top w-[12px]`,a),children:(0,G.jsx)(`div`,{className:J(`h-1.5 w-1.5 rounded-full mt-1`,Xs(e.level))})}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-2 align-top w-[48px]`,a),children:(0,G.jsx)(X,{variant:Ys(e.level),className:`px-1 py-0 text-[9px] uppercase`,children:e.level})}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-2 align-top w-[90px] truncate max-w-[90px]`,a,E6[e.component]??`text-on-surface-variant/60`),children:e.component}),(0,G.jsx)(`td`,{className:J(`whitespace-nowrap pr-2 align-top w-[72px] tabular-nums text-on-surface-variant/40`,a),title:e.session_id??``,children:o}),(0,G.jsxs)(`td`,{className:J(`pr-3 text-on-surface align-top break-words`,a),children:[(0,G.jsx)(`span`,{children:e.message}),s&&(0,G.jsxs)(`span`,{className:`ml-2 text-on-surface-variant/50`,children:[`· `,s]})]})]})});function F6({value:e}){let t=String(e),n=t.slice(0,8);return(0,G.jsxs)(ri,{to:`/sessions/${t}`,className:`font-mono text-primary hover:underline`,children:[n,`...`]})}function I6({value:e}){return Array.isArray(e)?(0,G.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.map((e,t)=>(0,G.jsx)(X,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:String(e)},t))}):(0,G.jsx)(`span`,{children:String(e)})}function L6({value:e}){return Array.isArray(e)?(0,G.jsx)(`span`,{className:`flex gap-1`,children:e.map((e,t)=>(0,G.jsx)(X,{variant:`outline`,className:`text-[10px] px-1.5 py-0 tabular-nums`,children:String(e)},t))}):(0,G.jsx)(`span`,{children:String(e)})}function R6({value:e}){return(0,G.jsx)(`span`,{className:`rounded bg-tertiary/10 px-2 py-0.5 text-tertiary font-mono text-[11px]`,children:String(e)})}function z6({value:e}){return(0,G.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded bg-surface-container-lowest px-2 py-1 text-[11px] font-mono text-on-surface-variant whitespace-pre-wrap`,children:String(e)})}function B6({value:e}){let t=new Date(String(e)),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4),i=Math.floor(r/60),a=Math.floor(i/24),o;return o=r<1?`just now`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${a}d ago`,(0,G.jsx)(`span`,{className:`tabular-nums`,title:t.toISOString(),children:o})}function V6({value:e}){return typeof e==`object`&&e?(0,G.jsx)(`pre`,{className:`text-[11px] font-mono text-on-surface-variant whitespace-pre-wrap`,children:JSON.stringify(e,null,2)}):(0,G.jsx)(`span`,{children:String(e)})}var H6={session_id:F6,spore_titles:I6,scores:L6,error:R6,preview:z6,generated_at:B6,text:z6},U6=new Set([`id`,`timestamp`,`level`,`kind`,`component`,`message`]);function W6(e,t){return(0,G.jsx)(H6[e]??V6,{value:t})}function G6(e){return U6.has(e)}function K6(e){return e?Object.entries(e).filter(([e])=>!G6(e)):[]}var q6={debug:`text-on-surface-variant/60`,info:`text-primary`,warn:`text-secondary`,error:`text-tertiary`};function J6({entry:e,resolved:t,onClose:n}){let r=K6(e.data);return(0,G.jsxs)(`div`,{className:`flex h-full flex-col bg-surface-container-low`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-outline-variant/10`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(X,{variant:`outline`,className:`text-[10px] px-1.5 py-0 font-mono`,children:e.kind}),(0,G.jsx)(`span`,{className:J(`text-xs font-medium`,q6[e.level]),children:e.level.toUpperCase()})]}),(0,G.jsx)(Y,{size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0`,onClick:n,"aria-label":`Close detail panel`,children:(0,G.jsx)(Is,{className:`h-3.5 w-3.5`})})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-3 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5`,children:`Timestamp`}),(0,G.jsx)(`div`,{className:`font-mono text-xs tabular-nums`,children:new Date(e.timestamp).toLocaleString()})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5`,children:`Message`}),(0,G.jsx)(`div`,{className:`text-sm text-on-surface leading-relaxed`,children:e.message})]}),e.session_id&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-0.5`,children:`Session`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[W6(`session_id`,e.session_id),!!t?.session_title&&(0,G.jsx)(`span`,{className:`text-on-surface-variant/70`,children:String(t.session_title)})]})]}),r.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-on-surface-variant/50 mb-1.5`,children:`Metadata`}),(0,G.jsx)(`div`,{className:`space-y-2`,children:r.map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-[10px] text-on-surface-variant/40 mb-0.5`,children:e}),(0,G.jsx)(`div`,{className:`text-xs`,children:W6(e,t)})]},e))})]})]}),(0,G.jsx)(`div`,{className:`px-4 py-2 border-t border-outline-variant/10`,children:(0,G.jsxs)(`span`,{className:`font-mono text-[10px] text-on-surface-variant/40 tabular-nums`,children:[`id: `,e.id]})})]})}var Y6=5e3;function X6(e=!1){let[t,n]=(0,W.useState)([]),r=(0,W.useRef)(null),{data:i,refetch:a}=ot({queryKey:[`logs-stream`],queryFn:({signal:e})=>$i(r.current===null?`/logs/stream`:`/logs/stream?since=${r.current}`,{signal:e}),refetchInterval:e?!1:Hs.LOGS}),o=(0,W.useRef)(e);return(0,W.useEffect)(()=>{o.current&&!e&&a(),o.current=e},[e,a]),(0,W.useEffect)(()=>{if(!i?.entries.length){i&&r.current===null&&(r.current=i.cursor);return}r.current=i.cursor,n(e=>{let t=[...e,...i.entries];return t.length>Y6?t.slice(-Y6):t})},[i]),{entries:t,clear:(0,W.useCallback)(()=>{n([]),r.current=null},[])}}function Z6(e,t){let n=new URLSearchParams;return e.q&&n.set(`q`,e.q),e.level&&n.set(`level`,e.level),e.component&&n.set(`component`,e.component),e.kind&&n.set(`kind`,e.kind),e.session_id&&n.set(`session_id`,e.session_id),e.from&&n.set(`from`,e.from),e.to&&n.set(`to`,e.to),e.page&&n.set(`page`,String(e.page)),e.page_size&&n.set(`page_size`,String(e.page_size)),ot({queryKey:[`logs-search`,Object.fromEntries(n)],queryFn:({signal:e})=>$i(`/logs/search?${n.toString()}`,{signal:e}),enabled:t})}function Q6(e){return ot({queryKey:[`log-detail`,e],queryFn:({signal:t})=>$i(`/logs/${e}`,{signal:t}),enabled:e!==null})}function $6(e){return new Date(Date.now()-({"15m":15*6e4,"1h":60*6e4,"6h":360*6e4,"24h":1440*6e4,"7d":10080*6e4,"30d":720*60*6e4}[e]??1440*6e4)).toISOString()}function e8(){let e=(0,W.useMemo)(()=>{let e=new URLSearchParams(window.location.search),t=e.get(`component`)?.split(`,`).filter(Boolean)??[],n=e.get(`level`),r=e.get(`q`)??``;return{components:t,level:n,q:r,hasFilters:t.length>0||!!n||!!r}},[]),[t,n]=(0,W.useState)(e.hasFilters?`search`:`live`),[r,i]=(0,W.useState)(e.q),[a,o]=(0,W.useState)(e.q),[s,c]=(0,W.useState)(e.level??`debug`),[l,u]=(0,W.useState)(new Set(e.components)),[d,f]=(0,W.useState)(`24h`),[p,m]=(0,W.useState)(1),[h,g]=(0,W.useState)(null),[_,v]=(0,W.useState)(!1),{entries:y,clear:b}=X6(_),{data:x}=Z6((0,W.useMemo)(()=>({q:a||void 0,level:s===`debug`?void 0:s,component:l.size>0?Array.from(l).join(`,`):void 0,from:$6(d),page:p,page_size:50}),[a,s,l,d,p]),t===`search`),{data:S}=Q6(h?.id??null),[C,w]=(0,W.useState)(e.components);(0,W.useEffect)(()=>{let e=t===`live`?y:x?.entries??[];w(t=>{let n=new Set(t),r=!1;for(let t of e)n.has(t.component)||(n.add(t.component),r=!0);return r?Array.from(n).sort():t})},[y,x,t]);let T=(0,W.useMemo)(()=>{let e=Ks[s]??0,t=r.trim().toLowerCase();return y.filter(n=>!((Ks[n.level]??0)<e||l.size>0&&!l.has(n.component)||t&&!n.message.toLowerCase().includes(t)))},[y,s,l,r]),E=t===`live`?T:x?.entries??[],D=(0,W.useCallback)(e=>{n(e),g(null),e===`live`&&(b(),v(!1))},[b]),O=(0,W.useCallback)(()=>{o(r),m(1)},[r]),k=(0,W.useCallback)(e=>{g(t=>t?.id===e.id?null:e)},[]),A=(0,W.useCallback)(e=>{u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),m(1)},[]),j=(0,W.useCallback)(e=>{c(e),m(1)},[]),M=h!==null;return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsx)(`div`,{className:`px-6 pt-6`,children:(0,G.jsx)(cN,{title:`Logs`,subtitle:`Daemon log explorer`})}),(0,G.jsx)(`div`,{className:`px-6 mb-3`,children:(0,G.jsx)(w6,{mode:t,onModeChange:D,searchValue:r,onSearchChange:i,onSearchSubmit:O,activeLevel:s,onLevelChange:j,components:C,activeComponents:l,onComponentToggle:A,onComponentsClear:()=>{u(new Set),m(1)},timeRange:d,onTimeRangeChange:e=>{f(e),m(1)},totalResults:t===`search`?x?.total:void 0,paused:_,onPausedToggle:()=>v(e=>!e)})}),(0,G.jsx)(`div`,{className:`flex flex-1 overflow-hidden mx-6 mb-6 rounded-lg border border-outline-variant/10`,children:(0,G.jsxs)(`div`,{className:`flex flex-col w-full`,children:[(0,G.jsx)(N6,{entries:E,selectedId:h?.id??null,onSelect:k,autoScroll:t===`live`&&!_,relativeTime:t===`live`,compact:!0}),t===`search`&&x&&(0,G.jsx)(`div`,{className:`border-t border-outline-variant/10 px-3 py-2 bg-surface-container-low`,children:(0,G.jsx)(Mj,{total:x.total,offset:(p-1)*50,limit:50,onPageChange:e=>m(Math.floor(e/50)+1)})})]})}),(0,G.jsx)(FN,{open:M&&!!h,onClose:()=>g(null),ariaLabel:`Log entry detail`,children:h&&(0,G.jsx)(J6,{entry:h,resolved:S?.resolved,onClose:()=>g(null)})})]})}function t8({title:e,scope:t,meta:n,loading:r,error:i,empty:a,emptyText:o,children:s}){let c=(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Qj,{children:e}),t&&(0,G.jsx)(OO,{scope:t})]});return r?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[c,(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading…`})]}):i?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[c,(0,G.jsxs)(`p`,{className:`font-sans text-sm text-tertiary`,children:[`Failed to load: `,i.message]})]}):a?(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-3`,children:[c,(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:o})]}):(0,G.jsxs)(Q,{level:`low`,className:`p-6 space-y-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[c,n]}),t&&(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:H4[t]}),s]})}function n8({primary:e,meta:t}){return(0,G.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-3 rounded-md bg-surface-container-low/40 p-3`,children:[(0,G.jsx)(`div`,{className:`min-w-0 space-y-1`,children:e}),(0,G.jsx)(`div`,{className:`flex flex-col items-end gap-0.5 text-right font-sans text-xs`,children:t})]})}function r8(e,t){if(!e)return!0;let n=Date.parse(e);return Number.isFinite(n)?Date.now()-n>t*60*60*1e3:!0}function i8(e){let{flags:t}=e;return t.error_count>0||t.integrity_issues>0?{label:`Issues detected`,icon:xs,tone:`error`}:t.backup_overdue>0||t.optimize_overdue>0?{label:`Maintenance overdue`,icon:yo,tone:`warn`}:{label:`All Groves healthy`,icon:So,tone:`ok`}}function a8({row:e,thresholds:t}){let n=!e.error&&r8(e.last_backup_at,t.backup_overdue_hours),r=!e.error&&r8(e.last_optimize_at,t.optimize_overdue_hours),i=e.last_integrity_check?.status===`issues`;return(0,G.jsx)(n8,{primary:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface truncate`,children:e.grove.name}),(0,G.jsx)(X,{variant:`outline`,className:`px-1.5 py-0 text-[10px] uppercase`,children:e.grove.mode}),e.error&&(0,G.jsx)(X,{variant:`outline`,className:`border-tertiary px-1.5 py-0 text-[10px] uppercase text-tertiary`,children:`error`})]}),e.error?(0,G.jsx)(`p`,{className:`font-sans text-xs text-tertiary truncate`,title:e.error,children:e.error}):(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[e.project_count,` project`,e.project_count===1?``:`s`,` · `,tj(e.db_size_bytes),e.embedding_pending===null?(0,G.jsxs)(G.Fragment,{children:[` · `,(0,G.jsx)(`span`,{className:`text-tertiary`,children:`embedding signal unavailable`})]}):e.embedding_pending>0?(0,G.jsxs)(G.Fragment,{children:[` · `,(0,G.jsxs)(`span`,{className:`text-secondary`,children:[e.embedding_pending,` pending`]})]}):null]})]}),meta:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:J(`text-on-surface-variant`,n&&`text-secondary`),children:[`backup: `,e.last_backup_at?UA(e.last_backup_at):`never`]}),(0,G.jsxs)(`span`,{className:J(`text-on-surface-variant`,r&&`text-secondary`),children:[`optimize: `,e.last_optimize_at?UA(e.last_optimize_at):`never`]}),(0,G.jsxs)(`span`,{className:J(`text-on-surface-variant`,i&&`text-tertiary`),children:[`integrity:`,` `,e.last_integrity_check?`${e.last_integrity_check.status} · ${UA(e.last_integrity_check.at)}`:`never`]})]})})}function o8(){let{data:e,isLoading:t,isError:n,error:r}=B3(),i=n?r instanceof Error?r:Error(`unknown error`):null,a=e?i8(e):null,o=a?.icon;return(0,G.jsx)(t8,{title:`Groves Overview`,scope:`all-groves`,loading:t,error:i,empty:!!e&&e.groves.length===0,emptyText:`No Groves are registered yet.`,meta:a&&o&&(0,G.jsxs)(`div`,{className:J(`flex items-center gap-1.5 font-sans text-xs`,a.tone===`ok`&&`text-primary`,a.tone===`warn`&&`text-secondary`,a.tone===`error`&&`text-tertiary`),children:[(0,G.jsx)(o,{className:`h-3.5 w-3.5`}),a.label]}),children:e&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 font-sans text-xs`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(jo,{className:`h-3.5 w-3.5 text-on-surface-variant`}),(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Groves`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface`,children:e.groves.length})]}),e.flags.backup_overdue>0&&(0,G.jsxs)(`span`,{className:`text-secondary`,children:[e.flags.backup_overdue,` backup overdue`]}),e.flags.optimize_overdue>0&&(0,G.jsxs)(`span`,{className:`text-secondary`,children:[e.flags.optimize_overdue,` optimize overdue`]}),e.flags.integrity_issues>0&&(0,G.jsxs)(`span`,{className:`text-tertiary`,children:[e.flags.integrity_issues,` integrity issue`,e.flags.integrity_issues===1?``:`s`]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:e.groves.map(t=>(0,G.jsx)(a8,{row:t,thresholds:e.thresholds},t.grove.id))})]})})}function s8({row:e}){return(0,G.jsx)(n8,{primary:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`font-mono text-sm text-on-surface truncate`,children:e.project_name}),(0,G.jsx)(X,{variant:`outline`,className:J(`px-1.5 py-0 text-[10px] uppercase`,e.is_active?`border-primary text-primary`:`border-on-surface-variant text-on-surface-variant`),children:e.is_active?`active`:`cold`})]}),(0,G.jsx)(`p`,{className:`font-sans text-xs text-on-surface-variant truncate`,title:e.project_root,children:e.project_root})]}),meta:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[`last activity: `,e.last_activity_at?UA(e.last_activity_at):`never`]}),(0,G.jsxs)(`span`,{className:`text-on-surface-variant`,children:[e.scheduled_runs_last_24h,` run`,e.scheduled_runs_last_24h===1?``:`s`,` / 24h`]})]})})}function c8(){let{data:e,isLoading:t,isError:n,error:r}=V3(),i=n?r instanceof Error?r:Error(`unknown error`):null,a=e?.projects.filter(e=>e.is_active).length??0,o=(e?.projects.length??0)-a;return(0,G.jsx)(t8,{title:`Project Activity`,scope:`all-groves`,loading:t,error:i,empty:!!e&&e.projects.length===0,emptyText:`No projects are registered yet.`,meta:e&&(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 font-sans text-xs text-on-surface-variant`,children:[(0,G.jsx)(oo,{className:`h-3.5 w-3.5`}),`window: `,e.active_window_days,`d`]}),children:e&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-4 font-sans text-xs`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Active`}),(0,G.jsx)(`span`,{className:`font-mono text-primary`,children:a})]}),(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-on-surface-variant`,children:`Cold`}),(0,G.jsx)(`span`,{className:`font-mono text-on-surface-variant`,children:o})]})]}),(0,G.jsx)(`div`,{className:`space-y-2`,children:e.projects.map(e=>(0,G.jsx)(s8,{row:e},`${e.grove_id}:${e.project_id}`))}),(0,G.jsxs)(`p`,{className:`font-sans text-xs text-on-surface-variant`,children:[`Cold projects skip scheduled agent tasks. Configure the window in Settings under `,(0,G.jsx)(`span`,{className:`font-mono`,children:`agent.cold_project_threshold_days`}),`.`]})]})})}function l8(e){if(!Number.isFinite(e)||e<=0)return`—`;let t=Math.floor(e);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<48?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function u8(){let{data:e}=Zs();if(!e)return(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(vs,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(Qj,{children:`Daemon`})]}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant`,children:`Loading…`})]});let{pid:t,port:n,version:r,uptime_seconds:i,active_sessions:a}=e.daemon;return(0,G.jsxs)(Q,{level:`low`,className:`rounded-lg p-6 space-y-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(vs,{className:`h-4 w-4 text-primary`}),(0,G.jsx)(Qj,{children:`Daemon`})]}),(0,G.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-6 gap-y-3 sm:grid-cols-3`,children:[(0,G.jsx)(d8,{label:`PID`,value:String(t),mono:!0}),(0,G.jsx)(d8,{label:`Running port`,value:String(n),mono:!0}),(0,G.jsx)(d8,{label:`Version`,value:r,mono:!0}),(0,G.jsx)(d8,{label:`Uptime`,value:l8(i)}),(0,G.jsx)(d8,{label:`Active sessions`,value:String(a.length)})]})]})}function d8({label:e,value:t,mono:n=!1}){return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{className:`font-sans text-[11px] uppercase tracking-wider text-on-surface-variant`,children:e}),(0,G.jsx)(`dd`,{className:J(`mt-0.5 text-sm text-on-surface`,n&&`font-mono`),children:t})]})}function f8(){return(0,G.jsxs)(AA,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(Ao,{className:`h-5 w-5 text-primary`}),(0,G.jsx)(cN,{title:`Machine`,subtitle:`Status of the Myco daemon and every Grove on this machine.`,className:`flex-1 pb-0`})]}),(0,G.jsx)(u8,{}),(0,G.jsx)(o8,{}),(0,G.jsx)(c8,{})]})}function p8({label:e,value:t,mono:n=!0}){let[r,i]=(0,W.useState)(`idle`),a=(0,W.useRef)(null),o=(0,W.useCallback)(()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},[]);(0,W.useEffect)(()=>o,[o]);let s=(0,W.useCallback)(()=>{o(),navigator.clipboard.writeText(t).then(()=>{i(`copied`),a.current=setTimeout(()=>i(`idle`),2e3)},()=>{i(`failed`),a.current=setTimeout(()=>i(`idle`),2e3)})},[t,o]);return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:e}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 group`,children:[(0,G.jsx)(`span`,{className:`text-sm text-on-surface break-all ${n?`font-mono`:``}`,children:t}),(0,G.jsxs)(`button`,{type:`button`,onClick:s,className:`shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface opacity-0 group-hover:opacity-100 transition-opacity`,title:r===`failed`?`Copy failed — check clipboard permissions`:`Copy to clipboard`,"aria-live":`polite`,children:[r===`copied`&&(0,G.jsx)(mo,{className:`h-3.5 w-3.5 text-primary`}),r===`failed`&&(0,G.jsx)(Is,{className:`h-3.5 w-3.5 text-error`}),r===`idle`&&(0,G.jsx)(ko,{className:`h-3.5 w-3.5`})]})]})]})}var m8=16;function h8(e){return e.length<m8?`•`.repeat(Math.max(8,e.length)):`${e.slice(0,8)}${`•`.repeat(e.length-12)}${e.slice(-4)}`}function g8({label:e,value:t}){let[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(`idle`),o=(0,W.useRef)(null),s=(0,W.useCallback)(()=>{o.current!==null&&(clearTimeout(o.current),o.current=null)},[]);(0,W.useEffect)(()=>s,[s]);let c=(0,W.useCallback)(()=>{s(),navigator.clipboard.writeText(t).then(()=>{a(`copied`),o.current=setTimeout(()=>a(`idle`),2e3)},()=>{a(`failed`),o.current=setTimeout(()=>a(`idle`),2e3)})},[t,s]),l=h8(t);return(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:e}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 group`,children:[(0,G.jsx)(`span`,{className:`text-sm text-on-surface font-mono break-all`,children:n?t:l}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface transition-opacity`,title:n?`Hide`:`Reveal`,children:n?(0,G.jsx)(Fo,{className:`h-3.5 w-3.5`}):(0,G.jsx)(Io,{className:`h-3.5 w-3.5`})}),(0,G.jsxs)(`button`,{type:`button`,onClick:c,className:`shrink-0 p-1 rounded text-on-surface-variant hover:text-on-surface opacity-0 group-hover:opacity-100 transition-opacity`,title:i===`failed`?`Copy failed — check clipboard permissions`:`Copy to clipboard`,"aria-live":`polite`,children:[i===`copied`&&(0,G.jsx)(mo,{className:`h-3.5 w-3.5 text-primary`}),i===`failed`&&(0,G.jsx)(Is,{className:`h-3.5 w-3.5 text-error`}),i===`idle`&&(0,G.jsx)(ko,{className:`h-3.5 w-3.5`})]})]})]})}function _8({status:e}){let t=We(),[n,r]=(0,W.useState)(!1),[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(null);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(FA,{tone:`sage`,eyebrow:(0,G.jsx)(k3,{Icon:Yo,children:`Grove Credentials`}),title:`Share these to add a machine`,actions:(0,G.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:!0,title:`Coming soon`,children:[(0,G.jsx)(ps,{className:`h-3.5 w-3.5 mr-1.5`}),`Rotate team key`]}),children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mb-3`,children:`Use these to add a machine to this Grove team. The Team key is sensitive — share only with people who should write to this Grove.`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.worker_url&&(0,G.jsx)(p8,{label:`Worker URL`,value:e.worker_url}),e.team_key&&(0,G.jsx)(g8,{label:`Team key`,value:e.team_key})]})]}),e.mcp_token&&e.mcp_endpoint&&(0,G.jsxs)(FA,{tone:`sage`,eyebrow:(0,G.jsx)(k3,{Icon:Do,children:`Cloud MCP endpoint`}),title:`For cloud agents`,actions:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(X,{variant:e.mcp_healthy?`default`:`destructive`,children:e.mcp_healthy?`healthy`:`unhealthy`}),(0,G.jsxs)(`button`,{onClick:()=>s(!0),className:`text-xs text-on-surface-variant hover:text-terracotta-text transition-colors inline-flex items-center gap-1`,children:[(0,G.jsx)(ps,{className:`h-3.5 w-3.5`}),`Rotate token`]})]}),children:[(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mb-3`,children:`Configure cloud agents with this endpoint to access Grove team intelligence.`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(p8,{label:`MCP URL`,value:e.mcp_endpoint}),(0,G.jsx)(g8,{label:`MCP Access Token`,value:e.mcp_token})]}),(0,G.jsxs)(`details`,{className:`text-xs mt-3`,children:[(0,G.jsx)(`summary`,{onClick:e=>{e.preventDefault(),a(!i)},className:`myco-eyebrow-sm text-on-surface-variant cursor-pointer hover:text-on-surface transition-colors list-none`,children:i?`Hide snippet`:`Config snippet`}),i&&(()=>{let t=JSON.stringify({mcp_servers:[{type:`url`,url:e.mcp_endpoint,name:`myco`,authorization_token:e.mcp_token}]},null,2);return(0,G.jsxs)(`div`,{className:`relative mt-2`,children:[(0,G.jsx)(`pre`,{className:`text-xs bg-surface-container p-3 rounded-lg overflow-x-auto text-on-surface-variant`,children:t}),(0,G.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(t),className:`absolute top-2 right-2 p-1 rounded hover:bg-surface-container-high transition-colors`,children:(0,G.jsx)(ko,{className:`h-3.5 w-3.5 text-on-surface-variant`})})]})})()]})]}),(0,G.jsxs)(FA,{tone:`sage`,eyebrow:(0,G.jsx)(k3,{Icon:Os,children:`This node`}),title:`Identity of this machine in the team`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{size:`sm`,children:`Machine ID`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.machine_id})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{size:`sm`,children:`Package version`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.package_version})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{size:`sm`,children:`Protocol version`}),(0,G.jsxs)(`code`,{className:`text-xs font-mono text-on-surface`,children:[`v`,e.sync_protocol_version]})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{size:`sm`,children:`Schema version`}),(0,G.jsxs)(`code`,{className:`text-xs font-mono text-on-surface`,children:[`v`,e.schema_version]})]})]}),e.health_error&&(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0 mt-3`,children:e.health_error})]}),(0,G.jsx)(FA,{tone:`sage`,eyebrow:(0,G.jsx)(k3,{Icon:ss,children:`Collective`}),title:`Cross-team coordination`,actions:(0,G.jsx)(X,{variant:e.collective_connected?`default`:`outline`,children:e.collective_connected?`connected`:`not connected`}),children:e.collective_connected?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[e.collective_url&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{size:`sm`,children:`URL`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.collective_url})]}),e.collective_project_id&&(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{size:`sm`,children:`Project ID`}),(0,G.jsx)(`code`,{className:`text-xs font-mono text-on-surface break-all`,children:e.collective_project_id})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{size:`sm`,children:`Last settings sync`}),(0,G.jsx)(`p`,{className:`text-xs font-mono text-on-surface m-0`,children:e.collective_last_settings_sync?new Date(e.collective_last_settings_sync*1e3).toLocaleString():`Never`})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{size:`sm`,children:`Last heartbeat`}),(0,G.jsx)(`p`,{className:`text-xs font-mono text-on-surface m-0`,children:e.collective_last_heartbeat?new Date(e.collective_last_heartbeat*1e3).toLocaleString():`Never`})]})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{size:`sm`,children:`Capabilities`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.collective_capabilities.map(e=>(0,G.jsx)(X,{variant:`outline`,children:e},e))})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(PA,{size:`sm`,children:`Effective overrides`}),(0,G.jsx)(`pre`,{className:`text-xs bg-surface-container p-3 rounded-lg overflow-x-auto text-on-surface-variant`,children:JSON.stringify(e.collective_settings,null,2)})]})]}):(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`This team worker is not currently connected to a Myco Collective.`})}),(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(Y,{variant:`outline`,size:`sm`,onClick:async()=>{r(!0),p(null);try{await sa(`/team/disconnect`),t.invalidateQueries({queryKey:[`team-status`]})}catch(e){p(e instanceof Error?e.message:String(e))}finally{r(!1)}},disabled:n,children:n?`Disconnecting...`:`Disconnect`})}),(0,G.jsx)(jj,{open:o,onOpenChange:s,title:`Rotate MCP Access Token`,description:`This will invalidate the current MCP token. Any cloud agents using it will lose access until reconfigured with the new token.`,confirmLabel:`Rotate Token`,variant:`destructive`,isPending:c,onConfirm:async()=>{l(!0),d(null);try{await sa(`/team/rotate-mcp-token`),t.invalidateQueries({queryKey:[`team-status`]}),s(!1)}catch(e){d(e instanceof Error?e.message:String(e))}finally{l(!1)}},errorMessage:u}),f&&(0,G.jsxs)(`p`,{className:`text-sm text-terracotta text-right m-0`,"data-testid":`team-disconnect-error`,children:[`Disconnect failed: `,f]})]})}var v8={sage:`bg-primary/10 text-primary`,ochre:`bg-secondary/10 text-secondary`,terracotta:`bg-tertiary/10 text-tertiary`,outline:`bg-surface-container text-on-surface-variant`};function y8({label:e,value:t,tone:n,pulse:r,sub:i}){return(0,G.jsxs)(`div`,{className:J(`flex flex-col gap-1 rounded-md p-3`,v8[n]),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] uppercase tracking-wider`,children:[(0,G.jsx)(`span`,{className:J(`h-2 w-2 rounded-full bg-current`,r&&`animate-pulse`)}),e]}),(0,G.jsx)(`div`,{className:`font-mono text-2xl tabular-nums`,children:t}),i?(0,G.jsx)(`div`,{className:`text-[10px] text-on-surface-variant`,children:i}):null]})}var b8=60,x8=3600;function S8({title:e,actions:t,children:n}){return(0,G.jsx)(FA,{tone:`sage`,eyebrow:`Sync`,title:e,actions:t,children:n})}var C8={error:`destructive`,running:`outline`,ready:`default`};function w8(e){return e===`error`?C8.error:e===`running`?C8.running:C8.ready}function T8(e){return e===null?`—`:e<b8?`${e}s`:e<x8?`${Math.floor(e/b8)}m`:`${Math.floor(e/x8)}h`}function E8(e){return typeof e==`number`&&Number.isFinite(e)?e.toLocaleString():`—`}function D8(e){return e==null||!Number.isFinite(e)?`—`:e<1e3?`<1s`:`${(e/1e3).toFixed(+(e<1e4))}s`}function O8(e){if(!e)return`Never`;let t=new Date(e);return Number.isNaN(t.getTime())?`Never`:t.toLocaleTimeString(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`})}function k8(e){if(!e)return;let t=new Date(e);if(!Number.isNaN(t.getTime()))return t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function A8(e){return e.replace(/_/g,` `)}function j8(e,t){if(t===void 0)return`—`;let n=t-e;return n===0?`0`:n>0?`+${n.toLocaleString()}`:n.toLocaleString()}function M8({remote:e}){if(!e)return(0,G.jsx)(v0,{label:`Vectors`,value:`—`,accent:`outline`});if(!e.vector_index_healthy)return(0,G.jsx)(v0,{label:`Vectors`,value:`error`,sublabel:e.vector_index_error??`index unavailable`,accent:`terracotta`});let t=e.vector_count??0,n=e.embeddable_count,r=E8(t);if(n==null)return(0,G.jsx)(v0,{label:`Vectors`,value:r,accent:`sage`});let i=n+Math.ceil(n*.1);if(t>=n&&t<=i)return(0,G.jsx)(v0,{label:`Vectors`,value:r,sublabel:`indexed (target ${E8(n)})`,accent:`sage`});if(t>i)return(0,G.jsx)(v0,{label:`Vectors`,value:r,sublabel:`+${E8(t-n)} stale vs target ${E8(n)}`,accent:`ochre`});let a=n-t,o=n>0&&t<Math.max(1,n*.05);return(0,G.jsx)(v0,{label:`Vectors`,value:r,sublabel:o?`index empty — run reindex (target ${E8(n)})`:`${E8(a)} missing of ${E8(n)}`,accent:o?`terracotta`:`ochre`})}function N8({summary:e}){let t=e.remote?.tables??{},n=Array.from(new Set([...Object.keys(e.local.tables),...Object.keys(t)])).sort();return(0,G.jsx)(`div`,{className:`overflow-hidden rounded-md border border-outline-variant/10`,children:(0,G.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,G.jsx)(`thead`,{className:`bg-surface-container/40 text-xs uppercase text-outline`,children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{className:`px-3 py-2 text-left font-mono`,children:`Table`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-mono`,children:`Local`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-mono`,children:`Remote`}),(0,G.jsx)(`th`,{className:`px-3 py-2 text-right font-mono`,children:`Delta`})]})}),(0,G.jsx)(`tbody`,{children:n.map(n=>{let r=e.local.tables[n]??0,i=t[n];return(0,G.jsxs)(`tr`,{className:`border-t border-outline-variant/10`,children:[(0,G.jsx)(`td`,{className:`px-3 py-2 text-on-surface`,children:A8(n)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right tabular-nums text-on-surface`,children:E8(r)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right tabular-nums text-on-surface`,children:E8(i)}),(0,G.jsx)(`td`,{className:`px-3 py-2 text-right tabular-nums text-on-surface-variant`,children:j8(r,i)})]},n)})})]})})}function P8({message:e,onAction:t,busy:n}){let r=e.body;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2 border-b border-outline-variant/10 last:border-b-0`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-on-surface font-mono truncate`,children:[r.table??`?`,` / `,r.id??`?`]}),(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant truncate`,children:[`machine=`,r.machine_id??`?`,` attempts=`,e.attempts,` `,e.last_failure?`· ${e.last_failure}`:``]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:n,onClick:()=>t(`retry`,e.msg_id),children:`Retry`}),(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:n,onClick:()=>t(`discard`,e.msg_id),children:`Discard`})]})]})}function F8({status:e}){let t=We(),n=e.enabled&&e.healthy,{data:r,isLoading:i}=F3(n),{data:a,isLoading:o}=I3(n),{data:s}=Zs(),c=n&&!!r&&!P3(r),{data:l,isLoading:u}=L3(c),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(null),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(null),[y,b]=(0,W.useState)(!1),[x,S]=(0,W.useState)(null),C=!n||P3(r)||!i&&!r,w=i||c&&u,T=!n||P3(r)||P3(l)||!w&&c&&!l,E=n?`Not available from this node.`:`Team connection is unhealthy.`,D=(0,W.useCallback)(async()=>{g(!0),v(null);try{let e=await sa(`/team/backfill`,{mode:`all`}),n=e.vector_error?`; vector reindex failed: ${e.vector_error}`:e.vector_enqueued?` and queued ${E8(e.vector_enqueued)} vectors for reindex`:``;e.flush_error?v(`Backfilled ${e.enqueued} records, but sync failed: ${e.flush_error}`):e.enqueued>0||(e.flushed??0)>0?v(`Backfilled ${E8(e.enqueued)} records and handed off ${E8(e.flushed)} in ${e.batches??0} batches${n}.`):e.vector_enqueued?v(`No eligible Grove records found${n}.`):v(`No eligible Grove records found.`),t.invalidateQueries({queryKey:[`team-status`]}),t.invalidateQueries({queryKey:[`team-sync-summary`]}),t.invalidateQueries({queryKey:[`team-queue-stats`]}),t.invalidateQueries({queryKey:[`team-dlq`]})}catch{v(`Backfill failed.`)}finally{g(!1)}},[t]),O=(0,W.useCallback)(async(e,n)=>{f(!0),m(null);try{let r=await sa(`/team/dlq/${e}`,{lease_ids:[n]});m(((e===`retry`?r.retried:r.discarded)??0)>0?`${e===`retry`?`Retried`:`Discarded`} 1 message.`:`${e===`retry`?`Retry`:`Discard`} returned 0 — lease may have expired. Refresh and try again.`),await Promise.all([t.refetchQueries({queryKey:[`team-dlq`]}),t.refetchQueries({queryKey:[`team-queue-stats`]}),t.refetchQueries({queryKey:[`team-sync-summary`]})])}catch(t){m(`${e} failed: ${t instanceof Error?t.message:String(t)}`)}finally{f(!1)}},[t]),k=(0,W.useCallback)(async()=>{if(!(!l||P3(l)||l.messages.length===0)){f(!0),m(null);try{m(`Retried ${(await sa(`/team/dlq/retry`,{lease_ids:l.messages.map(e=>e.msg_id)})).retried??0} of ${l.messages.length} messages.`),await Promise.all([t.refetchQueries({queryKey:[`team-dlq`]}),t.refetchQueries({queryKey:[`team-queue-stats`]}),t.refetchQueries({queryKey:[`team-sync-summary`]})])}catch(e){m(`Retry failed: ${e instanceof Error?e.message:String(e)}`)}finally{f(!1)}}},[l,t]),A=(0,W.useCallback)(async()=>{f(!0),m(null);try{await t.refetchQueries({queryKey:[`team-dlq`]})}finally{f(!1)}},[t]),j=(0,W.useCallback)(async()=>{b(!0),S(null);try{let e=await sa(`/team/upgrade-worker`);e.success?(S(`Worker updated to v${e.version}`),t.invalidateQueries({queryKey:[`team-status`]})):S(e.error??`Upgrade failed`)}catch(e){e instanceof ma&&typeof e.body==`object`&&e.body!==null&&`error`in e.body&&e.body.error===`myco_team_not_installed`?S((`message`in e.body?String(e.body.message):null)??`Install @goondocks/myco-team to enable Worker upgrades, or use myco-team-dev after make dev-link in a dev checkout.`):S(e instanceof Error?e.message:`Upgrade failed`)}finally{b(!1)}},[t]),M=P3(r)?void 0:r?.main,N=P3(r)?void 0:r?.dlq,P=P3(l)?[]:l?.messages??[],F=a?.last_handoff??null,I=a?.remote?.total_records??null,L=a?.local.total_records??null,R=!!(e.deployed_worker_version&&e.local_team_package_version),ee=e.local_team_package_source===`dev-linked`?`Dev linked`:e.local_team_package_source===`installed`?`Installed`:e.local_team_package_source===`path`?`On PATH`:`Available`,z=!!(e.vector_reindex_status||e.vector_reindex_last_table||e.vector_reindex_last_run_at||e.vector_reindex_last_error);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(S8,{title:`Worker`,actions:(0,G.jsx)(X,{variant:e.worker_update_available?`outline`:`default`,children:e.worker_update_available?`update available`:R?`current`:`deployed`}),children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[(0,G.jsx)(v0,{label:`Deployed`,value:e.deployed_worker_version?`v${e.deployed_worker_version}`:`Unknown`,accent:e.worker_update_available?`ochre`:`outline`}),(0,G.jsx)(v0,{label:ee,value:e.local_team_package_version?`v${e.local_team_package_version}`:`Not found`,accent:`outline`}),(0,G.jsx)(v0,{label:`Protocol`,value:`v${e.sync_protocol_version}`,accent:`outline`})]}),e.worker_update_available&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(bo,{className:`h-5 w-5 text-ochre shrink-0`}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-on-surface`,children:`Worker update available`}),(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant`,children:[`Deployed: v`,e.deployed_worker_version??`?`,` · Available: v`,e.local_team_package_version??`?`]})]})]}),(0,G.jsx)(Y,{variant:`default`,size:`sm`,onClick:j,disabled:y,children:y?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ps,{className:`h-3.5 w-3.5 animate-spin mr-1.5`}),`Deploying...`]}):`Update worker`})]}),x&&(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mt-3`,children:x})]}),(0,G.jsxs)(S8,{title:`Backfill`,actions:(0,G.jsx)(Y,{size:`sm`,variant:`default`,onClick:D,disabled:h,children:h?`Backfilling...`:`Backfill existing records`}),children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3`,children:(0,G.jsx)(v0,{label:`Left to sync`,value:E8(a?.local.pending_sync_count??e.pending_sync_count),accent:(a?.local.pending_sync_count??e.pending_sync_count)>0?`sage`:`outline`,href:`/logs?component=team-sync`})}),_&&(0,G.jsx)(`p`,{className:`text-sm text-sage m-0 mt-3`,children:_})]}),(0,G.jsx)(S8,{title:`Last handoff`,children:o&&!a?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,G.jsx)(v0,{label:`Last handoff`,value:O8(F?.completed_at),sublabel:k8(F?.completed_at),accent:F?.error?`terracotta`:`outline`}),(0,G.jsx)(v0,{label:`Accepted`,value:E8(F?.accepted),accent:`outline`}),(0,G.jsx)(v0,{label:`Batches`,value:E8(F?.batches),accent:`outline`}),(0,G.jsx)(v0,{label:`Duration`,value:D8(F?.duration_ms),accent:`outline`})]}),F?.error&&(0,G.jsx)(`p`,{className:`text-sm text-terracotta break-words m-0 mt-3`,children:F.error})]})}),(0,G.jsx)(S8,{title:`Remote store`,actions:a?.remote?(0,G.jsxs)(X,{variant:`default`,children:[`v`,a.remote.package_version]}):null,children:o&&!a?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):a?.remote_error?(0,G.jsx)(`p`,{className:`text-sm text-terracotta break-words m-0`,children:a.remote_error}):a?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,G.jsx)(v0,{label:`Local records`,value:E8(L),accent:`outline`}),(0,G.jsx)(v0,{label:`Remote records`,value:E8(I),accent:`outline`}),(0,G.jsx)(v0,{label:`Delta`,value:I===null||L===null?`—`:j8(L,I),accent:I!==null&&L!==null&&I!==L?`ochre`:`outline`}),(0,G.jsx)(M8,{remote:a.remote,localEmbedded:s?.embedding.embedded_count??null})]}),(0,G.jsx)(N8,{summary:a})]}):(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:E})}),(0,G.jsx)(S8,{title:`Queue health`,children:i?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):C?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:E}):(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,G.jsx)(y8,{label:`Pending`,value:M?.depth??0,tone:(M?.depth??0)>0?`ochre`:`outline`,sub:(()=>{let e=T8(M?.oldest_msg_age_s??null);return e===`—`?void 0:`Oldest ${e}`})()}),(0,G.jsx)(y8,{label:`Failed`,value:N?.depth??P.length,tone:(N?.depth??P.length)>0?`terracotta`:`outline`,sub:(()=>{let e=T8(N?.oldest_msg_age_s??null);return e===`—`?void 0:`Oldest ${e}`})()}),(0,G.jsx)(y8,{label:`DLQ`,value:P.length,tone:P.length>0?`terracotta`:`outline`})]})}),(0,G.jsxs)(S8,{title:`Failed syncs`,actions:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:d||T,onClick:A,children:`Refresh`}),(0,G.jsx)(Y,{size:`sm`,variant:`outline`,disabled:d||T||P.length===0,onClick:k,children:P.length>0?`Retry all (${P.length})`:`Retry all`})]}),children:[p&&(0,G.jsx)(`p`,{className:`text-xs font-mono text-on-surface-variant m-0 mb-3`,children:p}),w?(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:`Loading...`}):T?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:E}):P.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0`,children:`No failed syncs.`}):(0,G.jsx)(`div`,{className:`divide-y divide-outline-variant/10`,children:P.map(e=>(0,G.jsx)(P8,{message:e,onAction:O,busy:d},e.msg_id))})]}),z&&(0,G.jsxs)(S8,{title:`Remote Vector Index`,actions:(0,G.jsx)(X,{variant:w8(e.vector_reindex_status),children:e.vector_reindex_status??`ready`}),children:[(0,G.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:`Last table`}),(0,G.jsx)(`p`,{className:`text-sm text-on-surface`,children:e.vector_reindex_last_table??`None`})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:`Last run`}),(0,G.jsx)(`p`,{className:`text-sm text-on-surface`,children:e.vector_reindex_last_run_at?new Date(e.vector_reindex_last_run_at*1e3).toLocaleString():`Never`})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:`Processed`}),(0,G.jsx)(`p`,{className:`text-sm text-on-surface`,children:e.vector_reindex_last_processed??0})]}),(0,G.jsxs)(`div`,{className:`space-y-1`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:`Updated / deleted`}),(0,G.jsxs)(`p`,{className:`text-sm text-on-surface`,children:[e.vector_reindex_last_reindexed??0,` / `,e.vector_reindex_last_deleted??0]})]})]}),e.vector_reindex_last_error&&(0,G.jsxs)(`div`,{className:`space-y-1 border-t border-[var(--ghost-border)] pt-3 mt-3`,children:[(0,G.jsx)(`span`,{className:`text-xs text-on-surface-variant`,children:`Last error`}),(0,G.jsx)(`p`,{className:`text-xs text-terracotta break-words m-0`,children:e.vector_reindex_last_error})]})]})]})}function I8(e){let t=e.trim();if(!t)return`?`;let n=t.split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[1][0]).toUpperCase():t.slice(0,2).toUpperCase()}var L8=(0,W.forwardRef)(({name:e,initials:t,size:n=36,className:r,style:i,...a},o)=>{let s=(t??I8(e)).slice(0,2);return(0,G.jsx)(`span`,{ref:o,"aria-label":e,className:J(`inline-flex items-center justify-center rounded-full font-mono font-semibold uppercase text-[var(--on-primary)] shrink-0`,r),style:{width:n,height:n,fontSize:Math.round(n/3),background:`linear-gradient(135deg, var(--sage-dim), var(--ochre))`,...i},...a,children:s})});L8.displayName=`MemberAvatar`;function R8(e){if(!e)return`never`;let t=Date.now()-e*1e3,n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<48?`${r}h ago`:`${Math.floor(r/24)}d ago`}function z8({m:e,isSelf:t}){return(0,G.jsx)(Aj,{accent:`ochre`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(L8,{name:e.user,size:36}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-sm text-on-surface`,children:e.user}),t&&(0,G.jsx)(X,{variant:`outline`,children:`this machine`}),e.role&&(0,G.jsx)(X,{variant:e.role===`owner`?`default`:`outline`,children:e.role})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-on-surface-variant`,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:e.machine_id}),e.joined&&(0,G.jsxs)(`span`,{children:[`joined `,e.joined]}),!t&&(0,G.jsxs)(`span`,{children:[`last received `,R8(e.synced_at)]}),e.tags.map(e=>(0,G.jsxs)(`span`,{className:`font-mono`,children:[`#`,e]},e))]})]})]})})}function B8(){let{data:e,isLoading:t}=R3(),{data:n,isLoading:r}=N3(),i=n?.machine_id??null,a=t||r,o=e?.members.length??0;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(FA,{tone:`ochre`,eyebrow:`Members`,title:`Roster`,actions:a?null:(0,G.jsxs)(`span`,{className:`font-mono text-xs text-on-surface-variant`,children:[o,` `,o===1?`member`:`members`]}),padded:!1,children:a?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant m-0`,children:`Loading…`}):!e||e.members.length===0?(0,G.jsxs)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant m-0`,children:[`No team members yet. Run `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team join`}),` on a teammate's machine to add them.`]}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:e.members.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(z8,{m:e,isSelf:e.machine_id===i})},e.id))})}),(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`Members come from the local `,(0,G.jsx)(`code`,{className:`font-mono`,children:`team_members`}),` table, synced from peers via the team Worker.`]})]})}var V8=(0,W.forwardRef)(({number:e,size:t=28,className:n,style:r,...i},a)=>(0,G.jsx)(`span`,{ref:a,className:J(`inline-flex items-center justify-center rounded-full bg-surface-container-high text-on-surface font-mono font-semibold shrink-0`,n),style:{width:t,height:t,fontSize:Math.round(t*12/28),...r},...i,children:e}));V8.displayName=`StepCircle`;function H8({n:e,state:t,title:n,children:r}){return(0,G.jsxs)(`li`,{"aria-current":t===`active`?`step`:void 0,className:J(`flex gap-3 rounded-md border border-[var(--ghost-border)] px-4 py-3 transition-colors`,t===`active`&&`bg-sage/[0.05] border-l-2 border-l-sage`,t===`complete`&&`opacity-70`),children:[(0,G.jsx)(V8,{number:e,className:J(t===`active`&&`bg-sage/15 text-sage`,t===`complete`&&`bg-sage text-on-sage`)}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,G.jsx)(`h4`,{className:`text-sm font-medium text-on-surface m-0`,children:n}),r]})]})}function U8({onConnected:e,scopeName:t}){let[n,r]=(0,W.useState)(``),[i,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1);return(0,G.jsxs)(FA,{tone:`sage`,eyebrow:(0,G.jsx)(k3,{Icon:Ps,tone:`sage`,children:`Connect Grove`}),title:`Paste credentials`,children:[(0,G.jsxs)(`p`,{className:`text-sm text-on-surface-variant m-0 mb-3`,children:[`Provision `,t,` with `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team install`}),` first (`,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team-dev install`}),` in dev), then enter the Worker URL and Team key.`]}),(0,G.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),s(null),l(!0);try{await sa(`/team/connect`,{url:n,api_key:i}),e()}catch(e){s(e instanceof Error?e.message:`Connection failed`)}finally{l(!1)}},className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs font-medium text-on-surface-variant mb-1`,children:`Worker URL`}),(0,G.jsx)(cp,{type:`url`,placeholder:`https://myco-team.your-account.workers.dev`,value:n,onChange:e=>r(e.target.value),required:!0})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`block text-xs font-medium text-on-surface-variant mb-1`,children:`Team key`}),(0,G.jsx)(cp,{type:`password`,placeholder:`paste team key`,value:i,onChange:e=>a(e.target.value),required:!0})]}),o&&(0,G.jsx)(`p`,{className:`text-sm text-terracotta m-0`,children:o}),(0,G.jsx)(Y,{type:`submit`,size:`sm`,disabled:c||!n||!i,children:c?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ps,{className:`h-3.5 w-3.5 animate-spin mr-1.5`}),`Connecting...`]}):`Connect`})]})]})}function W8({scopeName:e}){let t=We();return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(FA,{tone:`ochre`,eyebrow:`Getting started`,title:`Connect this Grove to a team worker`,children:[(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant m-0 mb-3`,children:`Team sync connects a Grove to shared knowledge infrastructure through a Cloudflare Worker. One team member provisions the worker, then shares the connection details.`}),(0,G.jsxs)(`ol`,{className:`m-0 p-0 list-none flex flex-col gap-3`,children:[(0,G.jsx)(H8,{n:1,state:`active`,title:`Install prerequisites`,children:(0,G.jsx)(`code`,{className:`block font-mono text-xs bg-surface-container rounded px-3 py-2 text-on-surface-variant`,children:`npm install -g @goondocks/myco-team wrangler && wrangler login`})}),(0,G.jsxs)(H8,{n:2,state:`idle`,title:`Provision the Grove worker`,children:[(0,G.jsx)(`code`,{className:`block font-mono text-xs bg-surface-container rounded px-3 py-2 text-on-surface-variant`,children:`myco-team install`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant m-0 mt-1`,children:`Creates a D1 database, Vectorize index, and deploys the sync worker. Outputs a Worker URL and Team key for the Grove.`})]}),(0,G.jsx)(H8,{n:3,state:`idle`,title:`Connect`,children:(0,G.jsxs)(`p`,{className:`text-xs text-on-surface-variant m-0`,children:[`Paste the Worker URL and Team key below, or if you ran `,(0,G.jsx)(`code`,{className:`font-mono`,children:`myco-team install`}),`, you're already connected.`]})})]})]}),(0,G.jsx)(U8,{scopeName:e,onConnected:()=>t.invalidateQueries({queryKey:[`team-status`]})})]})}var G8=[{id:`status`,label:`Status`,description:`identity + health`,Icon:oo},{id:`sync`,label:`Sync`,description:`queue + secrets`,Icon:ps},{id:`members`,label:`Members`,description:`roster`,Icon:Ns}],K8=new Set([`status`,`sync`,`members`]);function q8(){let{data:e,isLoading:t}=N3(),[n,r]=di(),i=n.get(`tab`)??`status`,a=K8.has(i)?i:`status`;if(t)return(0,G.jsx)(OA,{isLoading:!0,error:null,loadingText:`Loading team…`,children:(0,G.jsx)(`span`,{})});if(!e)return null;let o=e.enabled&&e.worker_url,s=e.grove?.name??e.project.name??`this Grove`;return(0,G.jsxs)(AA,{children:[(0,G.jsx)(cN,{title:`Team`,subtitle:`Grove-scoped team sync and membership`}),o&&(0,G.jsx)(qN,{tabs:G8,activeTab:a,onTabChange:e=>r(t=>{let n=new URLSearchParams(t);return n.set(`tab`,e),n},{replace:!0}),columns:3}),o?a===`sync`?(0,G.jsx)(F8,{status:e}):a===`members`?(0,G.jsx)(B8,{}):(0,G.jsx)(_8,{status:e}):(0,G.jsx)(W8,{scopeName:s})]})}function J8(){return(0,G.jsx)(AA,{variant:`narrow`,className:`min-h-full justify-center`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-primary/10 text-primary`,children:(0,G.jsx)(Os,{className:`h-5 w-5`})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h1`,{className:`text-2xl font-semibold text-on-surface`,children:`Initialize a project`}),(0,G.jsx)(`p`,{className:`mt-2 max-w-xl text-sm text-on-surface-variant`,children:`This daemon has no registered Grove projects yet. Initialize a repository from its project directory to make it available here.`})]}),(0,G.jsx)(`pre`,{className:`overflow-x-auto rounded-md border border-outline-variant/30 bg-surface-container p-4 text-sm text-on-surface`,children:(0,G.jsx)(`code`,{children:`myco init`})})]})})}function Y8(){let e=We();return st({mutationFn:e=>sa(`/groves`,e),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`]})}})}function X8(){let e=We();return st({mutationFn:({id:e,name:t})=>$i(`/groves/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({name:t})}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:[`groves`]}),e.invalidateQueries({queryKey:[`grove`,n.id]})}})}function Z8(){let e=We();return st({mutationFn:({id:e})=>$i(`/groves/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`]})}})}function Q8(){let e=We();return st({mutationFn:({targetGroveId:e,projectId:t})=>sa(`/groves/${encodeURIComponent(e)}/projects/${encodeURIComponent(t)}`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`]})}})}function $8(){let e=We();return st({mutationFn:({id:e})=>sa(`/groves/${encodeURIComponent(e)}/default`),onSuccess:()=>{e.invalidateQueries({queryKey:[`groves`]})}})}function e5(){return st({mutationFn:({projectId:e})=>sa(`/projects/${encodeURIComponent(e)}/backup`)})}function t5({items:e,ariaLabel:t,trigger:n,align:r=`right`}){let[i,a]=(0,W.useState)(!1),o=(0,W.useRef)(null);return(0,W.useEffect)(()=>{if(!i)return;function e(e){o.current&&(o.current.contains(e.target)||a(!1))}function t(e){e.key===`Escape`&&a(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]),(0,G.jsxs)(`div`,{ref:o,className:`relative inline-block`,children:[(0,G.jsx)(`button`,{type:`button`,"aria-label":t,"aria-haspopup":`menu`,"aria-expanded":i,onClick:e=>{e.preventDefault(),e.stopPropagation(),a(e=>!e)},className:`inline-flex h-8 w-8 items-center justify-center rounded-md text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,children:n??(0,G.jsx)(No,{className:`h-4 w-4`})}),i&&(0,G.jsx)(`div`,{role:`menu`,className:J(`absolute z-50 mt-1 min-w-[12rem] rounded-md border border-outline-variant/30 bg-surface-container-highest p-1 shadow-lg`,r===`right`?`right-0`:`left-0`),children:e.map(e=>(0,G.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,title:e.disabled?e.disabledReason:void 0,onClick:t=>{t.preventDefault(),t.stopPropagation(),!e.disabled&&(a(!1),e.onSelect())},className:J(`flex w-full items-center rounded-sm px-3 py-1.5 text-left text-sm transition-colors`,`text-on-surface hover:bg-surface-container-high`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent`,e.destructive&&!e.disabled&&`text-tertiary hover:bg-tertiary/10`),children:e.label},e.key))})]})}function n5({groveName:e,projectCount:t,isDefault:n,onRename:r,onDelete:i,onSetDefault:a}){let o=t>0;return(0,G.jsx)(t5,{items:[{key:`set-default`,label:`Set as default`,disabled:n,disabledReason:n?`Already the default Grove`:void 0,onSelect:a},{key:`rename`,label:`Rename`,onSelect:r},{key:`delete`,label:`Delete Grove`,destructive:!0,disabled:o,disabledReason:o?`Move or remove projects first`:void 0,onSelect:i}],ariaLabel:`${e} actions`})}function r5({projectName:e,onMove:t,onOpen:n,onBackup:r,backupPending:i}){return(0,G.jsx)(t5,{items:[{key:`open`,label:`Open dashboard`,onSelect:n},{key:`move`,label:`Move to another Grove`,onSelect:t},{key:`backup`,label:i?`Backing up…`:`Back up this project`,onSelect:r,disabled:i}],ariaLabel:`${e} actions`})}function i5(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`default`}function a5({open:e,onOpenChange:t}){let[n,r]=(0,W.useState)(``),[i,a]=(0,W.useState)(null),o=Y8();(0,W.useEffect)(()=>{e&&(r(``),a(null),o.reset())},[e]);let s=n.trim(),c=s.length>0?i5(s):``;function l(e){if(e.preventDefault(),s.length===0){a(`Name is required.`);return}a(null),o.mutate({name:s},{onSuccess:e=>{vk({level:`success`,title:`Grove created`,detail:e.slug}),t(!1)},onError:e=>{vk({level:`error`,title:`Could not create Grove`,detail:e.message})}})}return(0,G.jsx)($f,{open:e,onOpenChange:t,children:(0,G.jsxs)(rp,{className:`sm:max-w-md`,children:[(0,G.jsxs)(ip,{children:[(0,G.jsx)(op,{children:`New Grove`}),(0,G.jsx)(sp,{children:`Group projects into a local Grove.`})]}),(0,G.jsxs)(`form`,{onSubmit:l,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`new-grove-name`,className:`text-sm font-medium text-on-surface`,children:`Name`}),(0,G.jsx)(`input`,{id:`new-grove-name`,type:`text`,value:n,autoFocus:!0,onChange:e=>r(e.target.value),placeholder:`Personal`,className:`w-full rounded-md border border-outline-variant/40 bg-surface-container-low px-3 py-1.5 text-sm text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`}),c&&(0,G.jsxs)(`p`,{className:`font-mono text-xs text-on-surface-variant`,children:[`slug: `,c]}),i&&(0,G.jsx)(`p`,{className:`text-xs text-tertiary`,children:i})]}),(0,G.jsxs)(ap,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:o.isPending,children:`Cancel`}),(0,G.jsx)(Y,{type:`submit`,size:`sm`,disabled:o.isPending||s.length===0,children:o.isPending?`Creating…`:`Create`})]})]})]})})}function o5({open:e,onOpenChange:t,groveId:n,currentName:r}){let[i,a]=(0,W.useState)(r),o=X8();(0,W.useEffect)(()=>{e&&(a(r),o.reset())},[e,r]);let s=i.trim(),c=s===r;function l(e){e.preventDefault(),!(s.length===0||c)&&o.mutate({id:n,name:s},{onSuccess:()=>{vk({level:`success`,title:`Grove renamed`}),t(!1)},onError:e=>{vk({level:`error`,title:`Rename failed`,detail:e.message})}})}return(0,G.jsx)($f,{open:e,onOpenChange:t,children:(0,G.jsxs)(rp,{className:`sm:max-w-md`,children:[(0,G.jsx)(ip,{children:(0,G.jsx)(op,{children:`Rename Grove`})}),(0,G.jsxs)(`form`,{onSubmit:l,className:`space-y-4`,children:[(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`rename-grove-name`,className:`text-sm font-medium text-on-surface`,children:`Name`}),(0,G.jsx)(`input`,{id:`rename-grove-name`,type:`text`,value:i,autoFocus:!0,onChange:e=>a(e.target.value),className:`w-full rounded-md border border-outline-variant/40 bg-surface-container-low px-3 py-1.5 text-sm text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant`,children:`The Grove slug may change if the new name slugifies differently. Auto-suffixes on collision.`})]}),(0,G.jsxs)(ap,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:o.isPending,children:`Cancel`}),(0,G.jsx)(Y,{type:`submit`,size:`sm`,disabled:o.isPending||s.length===0||c,children:o.isPending?`Saving…`:`Save`})]})]})]})})}function s5({open:e,onOpenChange:t,groveId:n,groveName:r,projectCount:i}){let a=Z8(),o=i>0;function s(){o||a.mutate({id:n},{onSuccess:()=>{vk({level:`success`,title:`Grove deleted`,detail:r}),t(!1)},onError:e=>{e instanceof ma&&e.status===409?vk({level:`error`,title:`Grove not empty`,detail:`${e.body?.project_count??`?`} project(s) still bound`}):vk({level:`error`,title:`Delete failed`,detail:e.message})}})}return(0,G.jsx)($f,{open:e,onOpenChange:t,children:(0,G.jsxs)(rp,{className:`sm:max-w-md`,children:[(0,G.jsxs)(ip,{children:[(0,G.jsx)(op,{children:`Delete Grove`}),(0,G.jsxs)(sp,{children:[`Delete `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:r}),`? This removes the Grove from the local registry.`]})]}),o&&(0,G.jsxs)(`p`,{className:`rounded-md border border-tertiary/30 bg-tertiary/10 px-3 py-2 text-sm text-on-surface`,children:[`Move or remove the `,i,` project`,i===1?``:`s`,` in this Grove first.`]}),(0,G.jsxs)(ap,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:a.isPending,children:`Cancel`}),(0,G.jsx)(`span`,{title:o?`Grove still has projects`:void 0,children:(0,G.jsx)(Y,{type:`button`,variant:`destructive`,size:`sm`,onClick:s,disabled:a.isPending||o,children:a.isPending?`Deleting…`:`Delete Grove`})})]})]})})}function c5({open:e,onOpenChange:t,sourceGroveId:n,projectId:r,projectName:i,groves:a}){let o=a.filter(e=>e.id!==n),[s,c]=(0,W.useState)(o[0]?.id??``),l=Q8();(0,W.useEffect)(()=>{e&&(c(o[0]?.id??``),l.reset())},[e,n,r]);function u(){s&&l.mutate({targetGroveId:s,projectId:r},{onSuccess:()=>{vk({level:`success`,title:`Project moved`}),t(!1)},onError:e=>{vk({level:`error`,title:`Move failed`,detail:e.message})}})}return(0,G.jsx)($f,{open:e,onOpenChange:t,children:(0,G.jsxs)(rp,{className:`sm:max-w-md`,children:[(0,G.jsxs)(ip,{children:[(0,G.jsx)(op,{children:`Move project`}),(0,G.jsxs)(sp,{children:[`Move `,(0,G.jsx)(`span`,{className:`font-medium text-on-surface`,children:i}),` to another Grove.`]})]}),o.length===0?(0,G.jsx)(`p`,{className:`text-sm text-on-surface-variant`,children:`No other Groves available. Create a new Grove first.`}):(0,G.jsxs)(`div`,{className:`space-y-2`,children:[(0,G.jsx)(`label`,{htmlFor:`move-target-grove`,className:`text-sm font-medium text-on-surface`,children:`Destination Grove`}),(0,G.jsx)(`select`,{id:`move-target-grove`,value:s,onChange:e=>c(e.target.value),disabled:l.isPending,className:`w-full rounded-md border border-outline-variant/40 bg-surface-container-low px-3 py-1.5 text-sm text-on-surface focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40`,children:o.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.name},e.id))}),(0,G.jsx)(`p`,{className:`text-xs text-on-surface-variant`,children:`The project keeps its data; only its Grove binding changes.`})]}),(0,G.jsxs)(ap,{children:[(0,G.jsx)(Y,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>t(!1),disabled:l.isPending,children:`Cancel`}),(0,G.jsxs)(Y,{type:`button`,size:`sm`,onClick:u,disabled:l.isPending||o.length===0||!s,className:`gap-2`,children:[l.isPending&&(0,G.jsx)(es,{className:`h-4 w-4 animate-spin`}),l.isPending?`Moving…`:`Confirm move`]})]})]})})}function l5(){let e=tc(),t=Nn(),n=e5(),r=$8(),[i,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(null),m=e.data?.groves??[];function h(e){r.mutate({id:e.id},{onSuccess:()=>{vk({level:`success`,title:`${e.name} is now the default Grove`})},onError:e=>{vk({level:`error`,title:`Failed to set default`,detail:e.message})}})}function g(e){p(e.project_id),n.mutate({projectId:e.project_id},{onSuccess:t=>{vk({level:`success`,title:`Backup created for ${e.name}`,detail:t.snapshot_path})},onError:e=>{vk({level:`error`,title:`Backup failed`,detail:e.message})},onSettled:()=>p(null)})}return(0,G.jsxs)(OA,{isLoading:e.isLoading,error:e.error,loadingText:`Loading Groves...`,children:[(0,G.jsxs)(AA,{children:[(0,G.jsxs)(`header`,{className:`flex items-end justify-between gap-4 flex-wrap`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 min-w-0`,children:[(0,G.jsx)(PA,{children:`Grove management`}),(0,G.jsx)(`h1`,{className:`myco-display-lg text-on-surface m-0`,children:`Groves`}),(0,G.jsx)(`p`,{className:`font-sans text-sm text-on-surface-variant m-0`,children:`Registered local Grove projects for this daemon.`})]}),(0,G.jsxs)(Y,{size:`sm`,onClick:()=>a(!0),className:`gap-1.5`,children:[(0,G.jsx)(ds,{className:`h-4 w-4`}),`New Grove`]})]}),(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:m.map(e=>(0,G.jsx)(FA,{tone:`sage`,eyebrow:`Grove`,title:e.name,actions:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.is_default&&(0,G.jsx)(X,{variant:`outline`,children:`default`}),(0,G.jsxs)(`span`,{className:`font-mono text-[11px] text-on-surface-variant`,children:[e.project_count,` project`,e.project_count===1?``:`s`]}),(0,G.jsx)(n5,{groveName:e.name,projectCount:e.project_count,isDefault:e.is_default,onRename:()=>s(e),onDelete:()=>l(e),onSetDefault:()=>h(e)})]}),padded:!1,children:e.projects.length===0?(0,G.jsx)(`p`,{className:`px-5 py-4 text-sm text-on-surface-variant`,children:`No projects in this Grove.`}):(0,G.jsx)(`ul`,{className:`m-0 p-0 list-none`,children:e.projects.map(n=>(0,G.jsx)(`li`,{children:(0,G.jsx)(Aj,{accent:`sage`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsxs)(ii,{to:Bi({grove:e,project:n}),className:`flex min-w-0 flex-1 items-center gap-3 hover:text-sage`,children:[(0,G.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-xs font-semibold text-white`,style:{backgroundColor:qi(n.project_id)},children:Ki(n.name)}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-sm font-medium text-on-surface`,children:n.name}),(0,G.jsx)(`span`,{className:`block truncate text-xs text-on-surface-variant font-mono`,children:n.root})]}),n.manifest_state!==`present`&&(0,G.jsx)(X,{variant:`outline`,children:n.manifest_state})]}),(0,G.jsx)(r5,{projectName:n.name,backupPending:f===n.project_id,onOpen:()=>t(Bi({grove:e,project:n})),onMove:()=>d({grove:e,project:n}),onBackup:()=>g(n)})]})})},n.project_id))})},e.id))})]}),(0,G.jsx)(a5,{open:i,onOpenChange:a}),o&&(0,G.jsx)(o5,{open:o!==null,onOpenChange:e=>!e&&s(null),groveId:o.id,currentName:o.name}),c&&(0,G.jsx)(s5,{open:c!==null,onOpenChange:e=>!e&&l(null),groveId:c.id,groveName:c.name,projectCount:c.project_count}),u&&(0,G.jsx)(c5,{open:u!==null,onOpenChange:e=>!e&&d(null),sourceGroveId:u.grove.id,projectId:u.project.project_id,projectName:u.project.name,groves:m})]})}function u5(){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yk,{}),(0,G.jsxs)(dr,{children:[(0,G.jsx)(lr,{path:`/`,element:(0,G.jsx)(d5,{})}),(0,G.jsxs)(lr,{element:(0,G.jsx)(ba,{children:(0,G.jsx)(fk,{})}),children:[(0,G.jsx)(lr,{path:`/onboarding`,element:(0,G.jsx)(J8,{})}),(0,G.jsx)(lr,{path:`/groves`,element:(0,G.jsx)(l5,{})}),(0,G.jsx)(lr,{path:`/logs`,element:(0,G.jsx)(e8,{})}),(0,G.jsx)(lr,{path:`/machine`,element:(0,G.jsx)(f8,{})}),(0,G.jsx)(lr,{path:`/settings`,element:(0,G.jsx)(x5,{})}),(0,G.jsx)(lr,{path:`/machine/settings`,element:(0,G.jsx)(y5,{})}),(0,G.jsx)(lr,{path:`/system`,element:(0,G.jsx)(sr,{to:`/settings#logging`,replace:!0})})]}),(0,G.jsxs)(lr,{path:`/g/:groveSlug/p/:projectSlug`,element:(0,G.jsx)(S5,{}),children:[(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(sj,{})}),(0,G.jsx)(lr,{path:`sessions`,element:(0,G.jsx)(sN,{})}),(0,G.jsx)(lr,{path:`sessions/:id`,element:(0,G.jsx)(sN,{})}),(0,G.jsx)(lr,{path:`cortex`,element:(0,G.jsx)(mP,{})}),(0,G.jsx)(lr,{path:`mycelium`,element:(0,G.jsx)(MQ,{})}),(0,G.jsx)(lr,{path:`agent`,element:(0,G.jsx)(f2,{})}),(0,G.jsx)(lr,{path:`agent/:id`,element:(0,G.jsx)(f2,{})}),(0,G.jsx)(lr,{path:`skills`,element:(0,G.jsx)(q2,{})}),(0,G.jsx)(lr,{path:`settings`,element:(0,G.jsx)(b5,{})}),(0,G.jsx)(lr,{path:`operations`,element:(0,G.jsx)(g5,{})}),(0,G.jsx)(lr,{path:`team`,element:(0,G.jsx)(m5,{})})]}),(0,G.jsx)(lr,{path:`/g/:groveSlug/dashboard`,element:(0,G.jsx)(C5,{}),children:(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(X3,{})})}),(0,G.jsx)(lr,{path:`/g/:groveSlug/operations`,element:(0,G.jsx)(C5,{}),children:(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(S6,{})})}),(0,G.jsx)(lr,{path:`/g/:groveSlug/settings`,element:(0,G.jsx)(v5,{})}),(0,G.jsx)(lr,{path:`/g/:groveSlug/maintenance`,element:(0,G.jsx)(_5,{})}),(0,G.jsxs)(lr,{path:`/g/:groveSlug/team`,element:(0,G.jsx)(C5,{}),children:[(0,G.jsx)(lr,{index:!0,element:(0,G.jsx)(q8,{})}),(0,G.jsx)(lr,{path:`maintenance`,element:(0,G.jsx)(h5,{})})]}),(0,G.jsx)(lr,{path:`/sessions`,element:(0,G.jsx)(f5,{suffix:`/sessions`})}),(0,G.jsx)(lr,{path:`/sessions/:id`,element:(0,G.jsx)(f5,{suffixFromPath:!0})}),(0,G.jsx)(lr,{path:`/cortex`,element:(0,G.jsx)(f5,{suffix:`/cortex`})}),(0,G.jsx)(lr,{path:`/mycelium`,element:(0,G.jsx)(f5,{suffix:`/mycelium`})}),(0,G.jsx)(lr,{path:`/agent`,element:(0,G.jsx)(f5,{suffix:`/agent`})}),(0,G.jsx)(lr,{path:`/agent/:id`,element:(0,G.jsx)(f5,{suffixFromPath:!0})}),(0,G.jsx)(lr,{path:`/skills`,element:(0,G.jsx)(f5,{suffix:`/skills`})}),(0,G.jsx)(lr,{path:`/operations`,element:(0,G.jsx)(p5,{suffix:`/operations`})}),(0,G.jsx)(lr,{path:`/team`,element:(0,G.jsx)(p5,{suffix:`/team`})}),(0,G.jsx)(lr,{path:`*`,element:(0,G.jsx)(sr,{to:`/`,replace:!0})})]})]})}function d5(){let{data:e,isLoading:t,error:n}=tc();if(t)return(0,G.jsx)(w5,{text:`Loading projects...`});if(n)return(0,G.jsx)(w5,{text:n.message});let r=e?.groves??[],i=Gi(r)??zi(r);return i?(0,G.jsx)(sr,{to:Bi(i),replace:!0}):(0,G.jsx)(sr,{to:`/onboarding`,replace:!0})}function f5({suffix:e,suffixFromPath:t=!1}){let n=An(),{data:r,isLoading:i,error:a}=tc();if(i)return(0,G.jsx)(w5,{text:`Loading projects...`});if(a)return(0,G.jsx)(w5,{text:a.message});let o=Gi(r?.groves??[])??zi(r?.groves??[]);return o?(0,G.jsx)(sr,{to:Bi(o,t?n.pathname:e),replace:!0}):(0,G.jsx)(sr,{to:`/onboarding`,replace:!0})}function p5({suffix:e}){let{data:t,isLoading:n,error:r}=tc();if(n)return(0,G.jsx)(w5,{text:`Loading Grove...`});if(r)return(0,G.jsx)(w5,{text:r.message});let i=t?.groves??[],a=(Gi(i)??zi(i))?.grove??i[0];if(!a)return(0,G.jsx)(sr,{to:`/onboarding`,replace:!0});let o=e.startsWith(`/`)?e:`/${e}`;return(0,G.jsx)(sr,{to:`/g/${a.slug}${o}`,replace:!0})}function m5(){let{groveSlug:e}=Ln();return e?(0,G.jsx)(sr,{to:`/g/${e}/team`,replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function h5(){let{groveSlug:e}=Ln();return e?(0,G.jsx)(sr,{to:`/g/${e}/team?tab=sync`,replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function g5(){let{groveSlug:e}=Ln();return e?(0,G.jsx)(sr,{to:`/g/${e}/operations`,replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function _5(){let{groveSlug:e}=Ln();return e?(0,G.jsx)(sr,{to:`/g/${e}/operations`,replace:!0}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function v5(){return(0,G.jsx)(sr,{to:`/settings#backup`,replace:!0})}function y5(){return(0,G.jsx)(sr,{to:`/settings#logging`,replace:!0})}function b5(){let e=An();return(0,G.jsx)(sr,{to:`/settings${e.search}${e.hash}`,replace:!0})}function x5(){let{data:e,isLoading:t,error:n}=tc();if(t)return(0,G.jsx)(w5,{text:`Loading settings...`});if(n)return(0,G.jsx)(w5,{text:n.message});let r=e?.groves??[],i=Gi(r)??zi(r);return i?(0,G.jsx)(ya,{selection:i,children:(0,G.jsx)(y3,{})}):(0,G.jsx)(ba,{children:(0,G.jsx)(y3,{})})}function S5(){let{groveSlug:e,projectSlug:t}=Ln(),{data:n,isLoading:r,error:i}=tc();if(r)return(0,G.jsx)(w5,{text:`Loading project...`});if(i)return(0,G.jsx)(w5,{text:i.message});let a=Ri(n?.groves??[],e,t);return a?(0,G.jsx)(ya,{selection:a,children:(0,G.jsx)(fk,{})}):(0,G.jsx)(sr,{to:`/`,replace:!0})}function C5(){let{groveSlug:e}=Ln(),{data:t,isLoading:n,error:r}=tc();if(n)return(0,G.jsx)(w5,{text:`Loading Grove...`});if(r)return(0,G.jsx)(w5,{text:r.message});let i=(t?.groves??[]).find(t=>t.slug===e);if(!i)return(0,G.jsx)(sr,{to:`/`,replace:!0});let a=i.projects[0];return a?(0,G.jsx)(ya,{selection:{grove:i,project:a},children:(0,G.jsx)(fk,{})}):(0,G.jsx)(sr,{to:`/onboarding`,replace:!0})}function w5({text:e}){return(0,G.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-surface text-sm text-on-surface-variant`,children:e})}Ba();var T5=new Be({defaultOptions:{queries:{staleTime:Us}}});Si.createRoot(document.getElementById(`root`)).render((0,G.jsx)(W.StrictMode,{children:(0,G.jsx)(ki,{children:(0,G.jsx)(Ge,{client:T5,children:(0,G.jsx)(Wa,{children:(0,G.jsx)(ei,{basename:ji()||void 0,children:(0,G.jsx)(u5,{})})})})})}));
|