@unerr-ai/unerr 0.2.12 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +23387 -37888
- package/dist/ui/index.html +6 -6
- package/package.json +25 -37
package/dist/ui/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>unerr — intelligence</title>
|
|
7
|
-
<script type="module" crossorigin>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 ee(e,t){return E(e.type,t,e.props)}function te(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function D(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var O=/\/+/g;function ne(e,t){return typeof e==`object`&&e&&e.key!=null?D(``+e.key):t.toString(36)}function re(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 ie(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,ie(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ne(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(O,`$&/`)+`/`),ie(o,r,i,``,function(e){return e})):o!=null&&(te(o)&&(o=ee(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(O,`$&/`)+`/`)+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+ne(a,u),c+=ie(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+ne(a,u++),c+=ie(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ie(re(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 k(e,t,n){if(e==null)return e;var r=[],i=0;return ie(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function A(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 ae=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)},j={map:k,forEach:function(e,t,n){k(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return k(e,function(){t++}),t},toArray:function(e){return k(e,function(e){return e})||[]},only:function(e){if(!te(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=j,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=te,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:A}},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,ae)}catch(e){ae(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.5`})),d=o(((e,t)=>{t.exports=u()})),f=l(d(),1),p={overview:`Dashboard`,visual:`Codebase Map`,graph:`Code Intelligence`,facts:`Project Memory`,logbook:`What unerr did`,"token-trace":`Token Trace`,reasoning:`Reasoning Trace`,"prompt-trace":`Prompt Trace`,activity:`Activity`,router:`MCP Router`,"router-sessions":`Router Sessions`,settings:`Settings`,"all-repos":`All Repositories`,daemon:`Daemon Supervisor`};function m(e){return p[e]}function h(){let e=(window.location.hash.replace(/^#/,``).split(`?`)[0]?.trim()||`/`).split(`/`).filter(Boolean),t=e[0]?.toLowerCase();if(t===`all-repos`)return{routeId:`all-repos`,repoLabel:null};if(t===`daemon`)return{routeId:`daemon`,repoLabel:null};if(t===`repo`&&e.length>=2){let t=e[1],n=e[2]?.toLowerCase();return{routeId:g(n),repoLabel:t}}return{routeId:g(t),repoLabel:null}}function g(e){switch(e){case`overview`:case`dashboard`:return`overview`;case`visual`:return`visual`;case`graph`:return`graph`;case`facts`:return`facts`;case`logbook`:case`story`:return`logbook`;case`session-economy`:case`economy`:case`headroom`:return`token-trace`;case`sidekick-memory`:case`sidekick`:case`memory`:return`facts`;case`token-trace`:return`token-trace`;case`reasoning`:return`reasoning`;case`prompt-trace`:return`prompt-trace`;case`activity`:case`session-timeline`:case`timeline`:return`activity`;case`router`:return`router`;case`router-sessions`:return`router-sessions`;case`settings`:return`settings`;default:return`overview`}}function _(){let[e,t]=(0,f.useState)(()=>typeof window>`u`?`overview`:h().routeId);return(0,f.useEffect)(()=>{t(h().routeId);let e=()=>t(h().routeId);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}function v(){let[e,t]=(0,f.useState)(()=>typeof window>`u`?{routeId:`overview`,repoLabel:null}:h());return(0,f.useEffect)(()=>{t(h());let e=()=>t(h());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}function y(e,t,n){let r=typeof t==`string`?t:void 0,i=typeof t==`object`?t:n,a=i&&Object.keys(i).length>0?`?${new URLSearchParams(i).toString()}`:``;if(e===`all-repos`||e===`daemon`){window.location.hash=`#/${e}${a}`;return}let o=r??h().repoLabel??void 0;if(o){window.location.hash=e===`overview`?`#/repo/${o}${a}`:`#/repo/${o}/${e}${a}`;return}window.location.hash=e===`overview`?`#/${a}`:`#/${e}${a}`}function b(e){if(typeof window>`u`)return null;let t=window.location.hash||``,n=t.indexOf(`?`);return n===-1?null:new URLSearchParams(t.slice(n+1)).get(e)}function x(e){if(typeof window>`u`)return;let t=window.location.hash||`#/`,n=t.indexOf(`?`),r=n===-1?t:t.slice(0,n),i=new URLSearchParams(n===-1?``:t.slice(n+1));for(let[t,n]of Object.entries(e))n===null||n===``?i.delete(t):i.set(t,n);let a=i.toString(),o=a?`${r}?${a}`:r;o!==t&&(window.location.hash=o)}function S(e){let[t,n]=(0,f.useState)(()=>typeof window>`u`?null:b(e));return(0,f.useEffect)(()=>{let t=()=>n(b(e));return t(),window.addEventListener(`hashchange`,t),()=>window.removeEventListener(`hashchange`,t)},[e]),t}var C=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})),w=o(((e,t)=>{t.exports=C()}))(),T=[{id:`overview`,label:`Dashboard`},{id:`logbook`,label:`What unerr did`},{id:`token-trace`,label:`Token Trace`},{id:`reasoning`,label:`Reasoning Trace`},{id:`visual`,label:`Codebase Map`},{id:`graph`,label:`Code Intelligence`},{id:`facts`,label:`Project Memory`},{id:`activity`,label:`Activity`},{id:`router`,label:`MCP Router`},{id:`router-sessions`,label:`Router Sessions`},{id:`settings`,label:`Settings`}],E=[{id:`all-repos`,label:`All Repositories`},{id:`daemon`,label:`Daemon`}];function ee(e){let t=e.replace(/\\/g,`/`).split(`/`).filter(Boolean),n=t[t.length-1]??e;return{name:n,dir:t.length>=2?`${t[t.length-2]}/${t[t.length-1]}`:n}}function te({title:e,subtitle:t,statusDot:n,repoPath:r,activeRoute:i,repoLabel:a,isDaemonMode:o,repos:s,authBanner:c,updateBanner:l,children:u}){let d=r?ee(r):null,f=i===`all-repos`||i===`daemon`;return(0,w.jsxs)(`div`,{className:`flex min-h-screen flex-col md:flex-row`,children:[(0,w.jsxs)(`aside`,{className:`flex w-full shrink-0 flex-col border-b border-border-subtle bg-sidebar px-5 py-6 md:w-56 md:border-r md:border-b-0 md:sticky md:top-0 md:h-screen md:overflow-y-auto`,children:[(0,w.jsx)(`div`,{className:`mb-8 flex items-center justify-center`,children:(0,w.jsx)(`img`,{src:`/icon-wordmark.png`,alt:`unerr`,className:`h-7`,draggable:!1})}),o&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`p`,{className:`mb-2 px-3 text-[10px] font-semibold uppercase tracking-widest t-tertiary`,children:`Global`}),(0,w.jsx)(`nav`,{className:`flex flex-col gap-0.5 mb-4`,"aria-label":`Global`,children:E.map(e=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(e.id),className:`block w-full rounded-md px-3 py-2 text-left text-sm transition-colors ${i===e.id?`el-raised font-medium text-foreground-emphasis`:`text-muted-foreground hover:text-foreground hover:el-raised`}`,children:e.label},e.id))}),s&&s.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`p`,{className:`mb-2 px-3 text-[10px] font-semibold uppercase tracking-widest t-tertiary`,children:`Repositories`}),(0,w.jsx)(`div`,{className:`flex flex-col gap-0.5 mb-4`,children:s.map(e=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>y(`overview`,e.label),className:`flex items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors ${a===e.label&&!f?`el-raised font-medium text-foreground-emphasis`:`text-muted-foreground hover:text-foreground hover:el-raised`}`,children:[(0,w.jsx)(`span`,{className:`inline-flex h-2 w-2 shrink-0 rounded-full ${e.status===`running`?`bg-success shadow-[0_0_4px_rgba(52,211,153,0.6)]`:e.status===`error`?`bg-error`:`bg-muted-foreground/40`}`}),(0,w.jsx)(`span`,{className:`truncate`,children:e.label})]},e.label))})]}),a&&!f&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`divider-shimmer mb-3`}),(0,w.jsx)(`nav`,{className:`flex flex-col gap-0.5`,"aria-label":`Repo`,children:T.map(e=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(e.id,a),className:`block w-full rounded-md px-3 py-2 text-left text-sm transition-colors ${i===e.id?`el-raised font-medium text-foreground-emphasis`:`text-muted-foreground hover:text-foreground hover:el-raised`}`,children:e.label},e.id))})]})]}),!o&&(0,w.jsx)(`nav`,{className:`flex flex-col gap-0.5`,"aria-label":`Primary`,children:T.map(e=>(0,w.jsx)(`a`,{href:e.id===`overview`?`#/`:`#/${e.id}`,className:`block rounded-md px-3 py-2 text-sm transition-colors ${i===e.id?`el-raised font-medium text-foreground-emphasis`:`text-muted-foreground hover:text-foreground hover:el-raised`}`,children:e.label},e.id))}),t?(0,w.jsxs)(`div`,{className:`mt-auto pt-8`,children:[(0,w.jsx)(`div`,{className:`divider-shimmer mb-4`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs leading-relaxed`,children:t})]}):null]}),(0,w.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-auto bg-background`,children:[(0,w.jsxs)(`header`,{className:`flex items-center justify-between border-b border-border-subtle bg-background/90 px-6 py-4 backdrop-blur-sm`,children:[(0,w.jsx)(`h1`,{children:e}),d&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,title:r,children:[(0,w.jsx)(`span`,{className:`inline-flex h-2 w-2 shrink-0 rounded-full ${n===`live`?`bg-success shadow-[0_0_6px_rgba(52,211,153,0.6)]`:`bg-warning animate-pulse`}`,title:n===`live`?`Connected`:`Reconnecting...`}),(0,w.jsx)(`span`,{className:`text-sm font-medium text-foreground-emphasis`,children:d.name}),(0,w.jsx)(`span`,{className:`t-tertiary text-xs font-mono hidden sm:inline`,children:d.dir})]})]}),c&&(c.badge===`warn`||c.badge===`attention`)&&(0,w.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 border-b px-6 py-2.5 text-sm ${c.badge===`attention`?`border-error/30 bg-error/10 text-error`:`border-warning/30 bg-warning/10 text-warning`}`,children:[(0,w.jsx)(`span`,{className:`inline-flex h-2 w-2 shrink-0 rounded-full ${c.badge===`attention`?`bg-error`:`bg-warning`}`}),(0,w.jsx)(`span`,{children:c.line})]}),l&&(l.status===`available`||l.status===`pending`||l.status===`rolled-back`)&&(0,w.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 border-b px-6 py-2.5 text-sm ${l.status===`rolled-back`?`border-error/30 bg-error/10 text-error`:`border-data/30 bg-data/10 text-data`}`,children:[(0,w.jsx)(`span`,{className:`inline-flex h-2 w-2 shrink-0 rounded-full ${l.status===`rolled-back`?`bg-error`:`bg-data`}`}),(0,w.jsx)(`span`,{children:l.line})]}),(0,w.jsx)(`div`,{className:`flex-1 p-6`,children:u})]})]})}var D=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};async function O(e,t){let n=await fetch(e,{...t,headers:{Accept:`application/json`,...t?.headers}}),r=await n.text(),i;try{i=r?JSON.parse(r):null}catch{i=r}if(!n.ok)throw new D(typeof i==`object`&&i&&`error`in i?String(i.error):n.statusText,n.status);return i}function ne(e,t){return e?e+t.replace(/^\/api/,``):t}var re=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(){}},ie=new class extends re{#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`}},k={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},A=new class{#e=k;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 ae(e){setTimeout(e,0)}var j=typeof window>`u`||`Deno`in globalThis;function M(){}function oe(e,t){return typeof e==`function`?e(t):e}function se(e){return typeof e==`number`&&e>=0&&e!==1/0}function ce(e,t){return Math.max(e+(t||0)-Date.now(),0)}function le(e,t){return typeof e==`function`?e(t):e}function ue(e,t){return typeof e==`function`?e(t):e}function de(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==pe(o,t.options))return!1}else if(!he(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 fe(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(me(t.options.mutationKey)!==me(a))return!1}else if(!he(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function pe(e,t){return(t?.queryKeyHashFn||me)(e)}function me(e){return JSON.stringify(e,(e,t)=>be(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function he(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>he(e[n],t[n])):!1}var ge=Object.prototype.hasOwnProperty;function _e(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ye(e)&&ye(t);if(!r&&!(be(e)&&be(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:ge.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=_e(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ve(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 ye(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function be(e){if(!xe(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!xe(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function xe(e){return Object.prototype.toString.call(e)===`[object Object]`}function Se(e){return new Promise(t=>{A.setTimeout(t,e)})}function Ce(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:_e(e,t)}function we(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Te(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ee=Symbol();function De(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ee?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Oe(e,t){return typeof e==`function`?e(...t):!!e}function ke(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 Ae=(()=>{let e=()=>j;return{isServer(){return e()},setIsServer(t){e=t}}})();function je(){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 Me=ae;function Ne(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Me,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 Pe=Ne(),Fe=new class extends re{#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 Ie(e){return Math.min(1e3*2**e,3e4)}function Le(e){return(e??`online`)===`online`?Fe.isOnline():!0}var Re=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ze(e){let t=!1,n=0,r,i=je(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Re(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ie.isFocused()&&(e.networkMode===`always`||Fe.isOnline())&&e.canRun(),u=()=>Le(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??(Ae.isServer()?0:3),o=e.retryDelay??Ie,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),Se(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 Be=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),se(this.gcTime)&&(this.#e=A.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ae.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(A.clearTimeout(this.#e),this.#e=void 0)}};function Ve(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=>{ke(e,()=>t.signal,()=>n=!0)},u=De(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?Te:we;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Ue:He,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:He(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 He(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 Ue(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var We=class extends Be{#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=qe(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=qe(this.options);e.data!==void 0&&(this.setState(Ke(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Ce(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(M).catch(M):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=>ue(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ee||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>le(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:!ce(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=De(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`?Ve(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=ze({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Re&&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 Re){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,...Ge(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ke(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),Pe.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ge(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Le(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ke(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function qe(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 Je=class extends re{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=je(),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),Xe(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ze(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ze(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 ue(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&&!ve(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Qe(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||ue(this.options.enabled,this.#t)!==ue(t.enabled,this.#t)||le(this.options.staleTime,this.#t)!==le(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||ue(this.options.enabled,this.#t)!==ue(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 et(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(M)),t}#g(){this.#b();let e=le(this.options.staleTime,this.#t);if(Ae.isServer()||this.#r.isStale||!se(e))return;let t=ce(this.#r.dataUpdatedAt,e)+1;this.#d=A.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,!(Ae.isServer()||ue(this.options.enabled,this.#t)===!1||!se(this.#p)||this.#p===0)&&(this.#f=A.setInterval(()=>{(this.options.refetchIntervalInBackground||ie.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(A.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(A.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&&Xe(e,t),o=i&&Qe(e,n,t,r);(a||o)&&(l={...l,...Ge(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=Ce(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=Ce(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:$e(e,t),refetch:this.refetch,promise:this.#o,isEnabled:ue(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=je())},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),!ve(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){Pe.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Ye(e,t){return ue(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&ue(t.retryOnMount,e)===!1)}function Xe(e,t){return Ye(e,t)||e.state.data!==void 0&&Ze(e,t,t.refetchOnMount)}function Ze(e,t,n){if(ue(t.enabled,e)!==!1&&le(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&$e(e,t)}return!1}function Qe(e,t,n,r){return(e!==t||ue(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&$e(e,n)}function $e(e,t){return ue(t.enabled,e)!==!1&&e.isStaleByTime(le(t.staleTime,e))}function et(e,t){return!ve(e.getCurrentResult(),t)}var tt=class extends Be{#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||nt(),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=ze({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),Pe.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function nt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var rt=class extends re{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 tt({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=it(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=it(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=it(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=it(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Pe.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=>fe(t,e))}findAll(e={}){return this.getAll().filter(t=>fe(e,t))}notify(e){Pe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Pe.batch(()=>Promise.all(e.map(e=>e.continue().catch(M))))}};function it(e){return e.options.scope?.id}var at=class extends re{#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),ve(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&me(t.mutationKey)!==me(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??nt();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){Pe.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)})})}},ot=class extends re{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??pe(r,t),a=this.get(i);return a||(a=new We({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(){Pe.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=>de(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>de(e,t)):t}notify(e){Pe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Pe.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Pe.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},st=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ot,this.#t=e.mutationCache||new rt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ie.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Fe.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(le(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=oe(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Pe.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;Pe.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Pe.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Pe.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(M).catch(M)}invalidateQueries(e,t={}){return Pe.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=Pe.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(M)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(M)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(le(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(M).catch(M)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(M).catch(M)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Fe.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(me(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{he(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(me(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{he(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||=pe(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===Ee&&(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()}},ct=f.createContext(void 0),lt=e=>{let t=f.useContext(ct);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ut=({client:e,children:t})=>(f.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,w.jsx)(ct.Provider,{value:e,children:t})),dt=f.createContext(!1),ft=()=>f.useContext(dt);dt.Provider;function pt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var mt=f.createContext(pt()),ht=()=>f.useContext(mt),gt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Oe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},_t=e=>{f.useEffect(()=>{e.clearReset()},[e])},vt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Oe(n,[e.error,r])),yt=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))}},bt=(e,t)=>e.isLoading&&e.isFetching&&!t,xt=(e,t)=>e?.suspense&&t.isPending,St=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ct(e,t,n){let r=ft(),i=ht(),a=lt(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,yt(o),gt(o,i,s),_t(i);let c=!a.getQueryCache().get(o.queryHash),[l]=f.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(f.useSyncExternalStore(f.useCallback(e=>{let t=d?l.subscribe(Pe.batchCalls(e)):M;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),f.useEffect(()=>{l.setOptions(o)},[o,l]),xt(o,u))throw St(o,l,i);if(vt({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&&!Ae.isServer()&&bt(u,r)&&(c?St(o,l,i):s?.promise)?.catch(M).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function N(e,t){return Ct(e,Je,t)}function wt(e,t){let n=lt(t),[r]=f.useState(()=>new at(n,e));f.useEffect(()=>{r.setOptions(e)},[r,e]);let i=f.useSyncExternalStore(f.useCallback(e=>r.subscribe(Pe.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=f.useCallback((e,t)=>{r.mutate(e,t).catch(M)},[r]);if(i.error&&Oe(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Tt=new st({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}}),Et=(0,f.createContext)({label:null,path:null,status:null,apiBase:``,isDaemonMode:!1});function Dt(){return(0,f.useContext)(Et)}function Ot(){let{apiBase:e,label:t}=Dt();return{url:(0,f.useCallback)(t=>ne(e,t),[e]),queryKey:(0,f.useCallback)(e=>t?[`repo`,t,...e]:[...e],[t])}}var kt=[`live-feed`],At=[`session-snapshot`];function jt(e){try{return JSON.parse(e)}catch{return e}}function Mt(e,t){let n=!1,r=null,i=1e3,a=null,o=(t,n)=>{let r={t:Date.now(),type:t,data:n};e.setQueryData(kt,(e=[])=>[...e,r].slice(-100))},s=()=>{e.invalidateQueries({queryKey:[`intelligence`]})},c=()=>{e.invalidateQueries({queryKey:[`session`]})},l=e=>t=>{o(e,jt(t.data)),e===`drift`&&s(),e===`intent`&&c(),(e===`violation`||e===`circuit_breaker`)&&c()},u=t=>{let n=jt(t.data);e.setQueryData(At,n),e.invalidateQueries({queryKey:[`session`]})},d=()=>{},f=()=>{a!==null&&(clearTimeout(a),a=null)},p=()=>{f(),!n&&(a=setTimeout(()=>{i=Math.min(i*2,3e4),m()},i))};function m(){if(!n){r?.close();try{r=new EventSource(`/api/stream`)}catch{t(!1),p();return}r.onopen=()=>{i=1e3,t(!0)},r.onerror=()=>{t(!1),r?.close(),r=null,p()};for(let e of[`tool_call`,`drift`,`violation`,`circuit_breaker`,`intent`])r.addEventListener(e,l(e));r.addEventListener(`session_stats`,u),r.addEventListener(`ping`,d)}}return m(),()=>{n=!0,f(),r?.close(),r=null,t(!1)}}var Nt={running:`bg-success shadow-[0_0_6px_rgba(52,211,153,0.6)]`,stopped:`bg-muted-foreground/40`,starting:`bg-warning animate-pulse`,error:`bg-error`};function Pt(e){return e===null?`—`:e<60?`${e}s`:e<3600?`${Math.round(e/60)}m`:`${Math.round(e/3600)}h`}function Ft(){let{data:e}=N({queryKey:[`daemon`,`repos`],queryFn:()=>O(`/api/repos`),refetchInterval:5e3}),{data:t}=N({queryKey:[`daemon`,`aggregate`],queryFn:()=>O(`/api/repos/aggregate`),refetchInterval:1e4}),n=e?.repos??[],r=t?.summary;return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[r&&(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,w.jsx)(It,{label:`Repositories`,value:r.totalRepos,sub:`${r.runningRepos} running`}),(0,w.jsx)(It,{label:`Total Entities`,value:r.totalEntities.toLocaleString(),sub:`${r.totalEdges.toLocaleString()} edges`}),(0,w.jsx)(It,{label:`Memory`,value:`${r.totalMemoryMb} MB`,sub:`across ${r.runningRepos} processes`}),(0,w.jsx)(It,{label:`Connections`,value:r.totalConnections,sub:r.totalNeedsInput>0?`${r.totalNeedsInput} need input`:`all healthy`})]}),t?.tokenFlow&&t.tokenFlow.total>0&&(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3`,children:[(0,w.jsx)(It,{label:`Tokens Saved`,value:t.tokenFlow.saved.toLocaleString(),sub:`across all repos`,accent:!0}),(0,w.jsx)(It,{label:`Tool Calls`,value:t.tokenFlow.total.toLocaleString(),sub:`resolved locally`}),(0,w.jsx)(It,{label:`Violations`,value:t.tokenFlow.violations,sub:`caught`})]}),(0,w.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:[n.map(e=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>y(`overview`,e.label),className:`el-raised flex flex-col gap-3 rounded-lg p-4 text-left transition-all hover:ring-2 hover:ring-brand/30`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`inline-flex h-2.5 w-2.5 shrink-0 rounded-full ${Nt[e.status]??Nt.stopped}`,title:e.status}),(0,w.jsx)(`span`,{className:`text-sm font-semibold text-foreground-emphasis truncate`,children:e.label})]}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs font-mono truncate`,children:e.path}),(0,w.jsxs)(`div`,{className:`flex items-center gap-4 text-xs t-tertiary`,children:[e.status===`running`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{children:[e.memory??0,` MB`]}),(0,w.jsxs)(`span`,{children:[e.entityCount?.toLocaleString()??0,` entities`]}),(0,w.jsxs)(`span`,{children:[`idle `,Pt(e.idle)]}),(0,w.jsxs)(`span`,{children:[e.connections,` conn`]})]}),e.status===`stopped`&&(0,w.jsx)(`span`,{className:`italic`,children:`Stopped`}),e.status===`starting`&&(0,w.jsx)(`span`,{className:`animate-pulse`,children:`Starting…`}),e.status===`error`&&(0,w.jsx)(`span`,{className:`text-error`,children:`Error`})]}),e.needsInput.length>0&&(0,w.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-warning`,children:[(0,w.jsx)(`span`,{children:`⚠`}),(0,w.jsxs)(`span`,{children:[e.needsInput.length,` need`,e.needsInput.length===1?`s`:``,` input`]})]})]},e.path)),n.length===0&&(0,w.jsxs)(`div`,{className:`col-span-full text-center py-12 t-tertiary`,children:[(0,w.jsx)(`p`,{className:`text-lg font-medium`,children:`No repos registered`}),(0,w.jsxs)(`p`,{className:`mt-2 text-sm`,children:[`Run`,` `,(0,w.jsx)(`code`,{className:`font-mono text-foreground`,children:`unerr pm add .`}),` `,`from a project directory.`]})]})]})]})}function It({label:e,value:t,sub:n,accent:r}){return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-xs uppercase tracking-wider`,children:e}),(0,w.jsx)(`p`,{className:`mt-1 text-2xl font-bold ${r?`text-brand`:`text-foreground-emphasis`}`,children:t}),n&&(0,w.jsx)(`p`,{className:`t-tertiary mt-1 text-xs`,children:n})]})}var Lt={started:`#34D399`,skipped:`#FBBF24`,failed:`#F87171`,aborted:`#F87171`},Rt={started:`✓`,skipped:`○`,failed:`✗`,aborted:`⚠`};function zt(){let{data:e,isLoading:t}=N({queryKey:[`pm`,`warm-start`],queryFn:()=>O(`/api/pm/warm-start`),refetchInterval:3e4});if(t)return(0,w.jsx)(`div`,{style:{padding:16,color:`#94a3b8`},children:`Loading warm-start info…`});if(!e||!e.events||e.events.length===0)return(0,w.jsxs)(`div`,{style:{padding:20,background:`#0f172a`,borderRadius:12,border:`1px solid #1e293b`},children:[(0,w.jsx)(`h3`,{style:{margin:`0 0 8px`,color:`#e2e8f0`,fontSize:14},children:`Warm-Start`}),(0,w.jsx)(`p`,{style:{color:`#64748b`,margin:0,fontSize:13},children:`No warm-start events yet. Repos will be pre-warmed after daemon boot.`}),e?.config&&(0,w.jsxs)(`div`,{style:{marginTop:12,fontSize:12,color:`#475569`},children:[`Budget: `,e.config.warmStartBudget,` · Idle cutoff:`,` `,e.config.warmStartIdleDays,`d · Delay:`,` `,e.config.warmStartDelayMs,`ms`]})]});let n=e.events.filter(e=>e.status===`started`),r=e.events.filter(e=>e.status===`skipped`);e.events.filter(e=>e.status===`failed`||e.status===`aborted`);let i=e.events.filter(e=>e.status===`started`).reduce((e,t)=>e+t.ms,0);return(0,w.jsxs)(`div`,{style:{padding:20,background:`#0f172a`,borderRadius:12,border:`1px solid #1e293b`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16},children:[(0,w.jsxs)(`h3`,{style:{margin:0,color:`#e2e8f0`,fontSize:14},children:[`Warm-Start`,` `,e.lastRun&&(0,w.jsxs)(`span`,{style:{color:`#64748b`,fontWeight:400},children:[`· `,e.lastRun]})]}),(0,w.jsxs)(`div`,{style:{fontSize:12,color:`#64748b`},children:[n.length,` warmed · `,r.length,` skipped · `,i,`ms total`]})]}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:e.events.map((e,t)=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 10px`,background:`#1e293b`,borderRadius:6,fontSize:13},children:[(0,w.jsx)(`span`,{style:{color:Lt[e.status]||`#64748b`},children:Rt[e.status]||`·`}),(0,w.jsx)(`span`,{style:{color:`#e2e8f0`,flex:1},children:e.label}),e.ms>0&&(0,w.jsxs)(`span`,{style:{color:`#64748b`,fontSize:11},children:[e.ms,`ms`]}),e.reason&&(0,w.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:11},children:e.reason})]},`${e.repo}-${t}`))}),e.config&&(0,w.jsxs)(`div`,{style:{marginTop:12,paddingTop:12,borderTop:`1px solid #1e293b`,fontSize:12,color:`#475569`},children:[`Budget: `,e.config.warmStartBudget,` · Idle cutoff:`,` `,e.config.warmStartIdleDays,`d · Delay:`,` `,e.config.warmStartDelayMs,`ms`]})]})}function Bt(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}h ${n}m`:n>0?`${n}m ${r}s`:`${r}s`}function Vt(){let{data:e}=N({queryKey:[`pm`,`info`],queryFn:()=>O(`/api/pm`),refetchInterval:1e4}),{data:t}=N({queryKey:[`pm`,`repos`],queryFn:()=>O(`/api/repos`),refetchInterval:5e3}),n=t?.repos??[];return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[e&&(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-6`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-foreground-emphasis mb-4`,children:`Process Manager`}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4 text-sm`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-xs uppercase`,children:`PID`}),(0,w.jsx)(`p`,{className:`font-mono text-foreground-emphasis`,children:e.pid})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-xs uppercase`,children:`Uptime`}),(0,w.jsx)(`p`,{className:`font-mono text-foreground-emphasis`,children:Bt(e.uptime)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-xs uppercase`,children:`Version`}),(0,w.jsx)(`p`,{className:`font-mono text-foreground-emphasis`,children:e.version})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-xs uppercase`,children:`Dashboard Port`}),(0,w.jsx)(`p`,{className:`font-mono text-foreground-emphasis`,children:e.port})]})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-6`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-foreground-emphasis mb-4`,children:`Managed Processes`}),n.length===0?(0,w.jsxs)(`p`,{className:`t-tertiary text-sm`,children:[`No repos registered. Run`,` `,(0,w.jsx)(`code`,{className:`font-mono`,children:`unerr pm add .`}),` from a project.`]}):(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle text-left t-tertiary text-xs uppercase tracking-wider`,children:[(0,w.jsx)(`th`,{className:`pb-2 pr-4`,children:`Repo`}),(0,w.jsx)(`th`,{className:`pb-2 pr-4`,children:`Status`}),(0,w.jsx)(`th`,{className:`pb-2 pr-4`,children:`PID`}),(0,w.jsx)(`th`,{className:`pb-2 pr-4`,children:`Memory`}),(0,w.jsx)(`th`,{className:`pb-2 pr-4`,children:`Connections`}),(0,w.jsx)(`th`,{className:`pb-2`,children:`Last Activity`})]})}),(0,w.jsx)(`tbody`,{children:n.map(e=>(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle/50 last:border-0`,children:[(0,w.jsxs)(`td`,{className:`py-3 pr-4`,children:[(0,w.jsx)(`div`,{className:`font-medium text-foreground-emphasis`,children:e.label}),(0,w.jsx)(`div`,{className:`font-mono text-xs t-tertiary truncate max-w-xs`,children:e.path})]}),(0,w.jsx)(`td`,{className:`py-3 pr-4`,children:(0,w.jsx)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${e.status===`running`?`bg-success/10 text-success`:e.status===`error`?`bg-error/10 text-error`:`bg-muted-foreground/10 text-muted-foreground`}`,children:e.status})}),(0,w.jsx)(`td`,{className:`py-3 pr-4 font-mono`,children:e.pid??`—`}),(0,w.jsx)(`td`,{className:`py-3 pr-4 font-mono`,children:e.memory?`${e.memory} MB`:`—`}),(0,w.jsx)(`td`,{className:`py-3 pr-4 font-mono`,children:e.connections}),(0,w.jsx)(`td`,{className:`py-3 text-xs t-tertiary`,children:e.lastActivity?new Date(e.lastActivity).toLocaleTimeString():`—`})]},e.path))})]})})]}),(0,w.jsx)(zt,{})]})}function Ht({className:e=``}){return(0,w.jsx)(`div`,{className:`animate-pulse rounded-md bg-surface-overlay ${e}`,"aria-hidden":`true`})}var Ut=[`c0`,`c1`,`c2`,`c3`];function Wt({n:e=4}){return(0,w.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:Ut.slice(0,Math.min(e,Ut.length)).map(e=>(0,w.jsxs)(`div`,{className:`glass-card rounded-xl p-4`,children:[(0,w.jsx)(Ht,{className:`h-3 w-20`}),(0,w.jsx)(Ht,{className:`mt-3 h-8 w-14`})]},e))})}var Gt=[`h0`,`h1`,`h2`,`h3`,`h4`,`h5`],Kt=[`t0`,`t1`,`t2`,`t3`,`t4`,`t5`,`t6`,`t7`];function qt({cols:e=5,rows:t=6}){let n=Gt.slice(0,Math.min(e,Gt.length)),r=Kt.slice(0,Math.min(t,Kt.length));return(0,w.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,w.jsx)(`div`,{className:`mb-3 flex gap-2 border-b border-border-subtle pb-2`,children:n.map(e=>(0,w.jsx)(Ht,{className:`h-3 flex-1`},e))}),r.map(e=>(0,w.jsx)(`div`,{className:`mb-2 flex gap-2`,children:n.map(t=>(0,w.jsx)(Ht,{className:`h-4 flex-1`},`${e}-${t}`))},e))]})}function Jt(e){if(e==null||!Number.isFinite(e))return`—`;let t=e<0?`-`:``,n=Math.abs(e);if(n<1e3)return`${t}${Math.round(n).toLocaleString()}`;let r=[`K`,`M`,`B`,`T`],i=-1;do n/=1e3,i++;while(n>=999.95&&i<r.length-1);return`${t}${n.toFixed(1).replace(/\.0$/,``)}${r[i]}`}function Yt(e){let t=Date.now()-new Date(e).getTime(),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<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Xt(e){return e.replace(/_/g,` `).replace(/^\w/,e=>e.toUpperCase())}var Zt={shell_compression:{bar:`bg-cyan-500`,text:`text-cyan-400`},format_encoding:{bar:`bg-amber-500`,text:`text-amber-400`},session_dedup:{bar:`bg-emerald-500`,text:`text-emerald-400`},smart_truncation:{bar:`bg-blue-500`,text:`text-blue-400`},file_read:{bar:`bg-indigo-500`,text:`text-indigo-400`},fetch_url:{bar:`bg-teal-500`,text:`text-teal-400`},graph_query:{bar:`bg-violet-500`,text:`text-violet-400`},persistent_memory:{bar:`bg-fuchsia-500`,text:`text-fuchsia-400`}},Qt={graph_query_served:{bar:`bg-violet-500`,text:`text-violet-400`},full_read_avoided:{bar:`bg-indigo-500`,text:`text-indigo-400`},loop_broken:{bar:`bg-rose-500`,text:`text-rose-400`},cascade_guard:{bar:`bg-amber-500`,text:`text-amber-400`},boundary_violation_flagged:{bar:`bg-orange-500`,text:`text-orange-400`},incomplete_work_flagged:{bar:`bg-rose-500`,text:`text-rose-400`},drift_consumed:{bar:`bg-cyan-500`,text:`text-cyan-400`},intervention_halted:{bar:`bg-rose-500`,text:`text-rose-400`},intervention_warned:{bar:`bg-amber-500`,text:`text-amber-400`},defuddle_selector_skipped:{bar:`bg-teal-500`,text:`text-teal-400`}},$t={fact_recalled:{bar:`bg-fuchsia-500`,text:`text-fuchsia-400`},fact_stored_user_fed:{bar:`bg-emerald-500`,text:`text-emerald-400`},fact_stored_auto:{bar:`bg-teal-500`,text:`text-teal-400`},caller_check_enforced:{bar:`bg-sky-500`,text:`text-sky-400`},stale_edit_prevented:{bar:`bg-cyan-500`,text:`text-cyan-400`},cascade_warning_consumed:{bar:`bg-amber-500`,text:`text-amber-400`},convention_applied:{bar:`bg-blue-500`,text:`text-blue-400`},cross_session_resume:{bar:`bg-violet-500`,text:`text-violet-400`},resume_blockers_surfaced:{bar:`bg-rose-500`,text:`text-rose-400`},cache_hit:{bar:`bg-lime-500`,text:`text-lime-400`}};function en(e){return Qt[e]??$t[e]??Zt[e]??{bar:`bg-violet-500`,text:`text-violet-400`}}function tn({text:e,label:t}){let[n,r]=(0,f.useState)(!1),i=(0,f.useId)();return(0,w.jsxs)(`span`,{className:`relative inline-flex align-middle`,children:[(0,w.jsx)(`button`,{type:`button`,"aria-label":t??`More information`,"aria-describedby":n?i:void 0,className:`inline-flex h-4 w-4 items-center justify-center rounded-full border border-border-subtle font-mono text-[9px] font-bold leading-none t-tertiary transition-colors hover:border-violet-400 hover:text-violet-300 focus-visible:text-violet-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-violet-400`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),onKeyDown:e=>{e.key===`Escape`&&r(!1)},children:`i`}),n?(0,w.jsx)(`span`,{role:`tooltip`,id:i,className:`absolute left-1/2 top-full z-30 mt-2 w-64 -translate-x-1/2 rounded-lg border border-border-subtle bg-background px-3 py-2 text-left text-[11px] font-normal normal-case leading-snug tracking-normal t-secondary shadow-xl`,children:e}):null]})}function nn(e,t=900){let[n,r]=(0,f.useState)(e),i=(0,f.useRef)(!1);return(0,f.useEffect)(()=>{if(i.current||e<=0){r(e);return}if(typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches){r(e);return}i.current=!0;let n=0,a=performance.now(),o=i=>{let s=Math.min(1,(i-a)/t);r(e*(1-(1-s)**3)),s<1?n=requestAnimationFrame(o):r(e)};return n=requestAnimationFrame(o),()=>cancelAnimationFrame(n)},[e,t]),n}function rn({value:e,format:t,prefix:n}){let r=nn(e);return(0,w.jsxs)(w.Fragment,{children:[n,t(Math.round(r))]})}var an=new Set([`user_prompt_received`,`surface2_emitted`,`surface2_missed`,`surface4a_emitted`,`presence_ambient_marker`,`fact_capture_abandoned`,`confirmation_expired`]),on={graph_query_served:{label:`unnecessary file reads prevented`,desc:`The agent found the answer in one graph query instead of reading 5-15 files with grep. Each lookup saved multiple turns of trial-and-error.`},full_read_avoided:{label:`large file dumps prevented`,desc:`Only the relevant lines were sent instead of the entire file. Without unerr: the agent loads thousands of lines when it only needed a few.`},fact_recalled:{label:`re-explanations prevented`,desc:`unerr remembered notes from your earlier sessions and surfaced them at the right moment, so the agent didn't ask you to repeat yourself.`},loop_broken:{label:`retry loops stopped`,desc:`The agent was stuck in a loop, retrying the same failing operation. unerr detected the pattern and broke the cycle before more turns were wasted.`},cascade_guard:{label:`breaking changes caught`,desc:`The agent was about to edit code that many other files depend on. unerr flagged the risk so the change didn't silently break downstream code.`},boundary_violation_flagged:{label:`architecture breaches caught`,desc:`The agent was about to import across an architecture boundary that must stay isolated. unerr flagged the crossing so the layering didn't silently erode.`},incomplete_work_flagged:{label:`unfinished refactors flagged`,desc:`A signature changed this session but some of its callers were never updated. unerr flagged them at session end so they don't surface as runtime or compile breaks later.`},drift_consumed:{label:`stale file edits prevented`,desc:`The file had changed since the agent last read it. unerr caught this so the agent didn't overwrite newer changes with an outdated version.`},intervention_halted:{label:`dangerous operations blocked`,desc:`A risky tool call was stopped before it could run. Without unerr: the operation would have executed unchecked and potentially corrupted state.`},intervention_warned:{label:`risky patterns flagged early`,desc:`unerr spotted a risky pattern and warned the agent before it committed. Without the warning: the agent would have proceeded blindly.`},defuddle_selector_skipped:{label:`web page noise filtered out`,desc:`Navigation menus, footers, and ads were stripped from fetched web pages so only the actual content reached the agent.`},fact_stored_user_fed:{label:`rules saved for future sessions`,desc:`Rules you told the agent were saved permanently. Next session, the agent will already know these without you having to repeat them.`},fact_stored_auto:{label:`code patterns learned`,desc:`unerr noticed a convention in your codebase and stored it. Future edits will follow this pattern automatically.`},caller_check_enforced:{label:`blind edits prevented`,desc:`unerr checked who calls this code before allowing the edit. Without it: changes would land without knowing what else they break.`},stale_edit_prevented:{label:`overwrites of new changes stopped`,desc:`The agent tried to edit a file that was modified after it was last read. unerr stopped the edit to prevent overwriting your recent work.`},cascade_warning_consumed:{label:`downstream breaks prevented`,desc:`Code that depends on the edited file was identified and the agent was warned before making changes that would ripple through.`},convention_applied:{label:`style violations prevented`,desc:`Project conventions (naming, imports, structure) were applied automatically, so new code matched your existing style from the start.`},cross_session_resume:{label:`cold-start sessions prevented`,desc:`Context from your last session was restored, so the agent picked up where it left off instead of starting from scratch.`},resume_blockers_surfaced:{label:`forgotten blockers resurfaced`,desc:`Unresolved problems from a previous session were brought forward so they didn't fall through the cracks.`},cache_hit:{label:`redundant computations skipped`,desc:`A previously computed answer was served from cache instead of being recomputed, saving time and tokens.`}};function sn(e){return on[e]??{label:`${Xt(e).toLowerCase()} handled`,desc:`An issue unerr caught and handled so the agent didn't have to retry or undo it.`}}function cn({count:e,label:t,desc:n,palette:r}){let[i,a]=(0,f.useState)(!1);return(0,w.jsxs)(`div`,{className:`el-raised relative cursor-default overflow-visible rounded-lg p-3.5 pl-4`,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onFocus:()=>a(!0),onBlur:()=>a(!1),children:[(0,w.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-y-0 left-0 w-1 rounded-l-lg ${r.bar} opacity-80`}),(0,w.jsxs)(`button`,{type:`button`,"aria-expanded":i,className:`block w-full text-left focus-visible:outline-none`,children:[(0,w.jsx)(`span`,{className:`font-mono text-2xl font-bold leading-none tabular-nums ${r.text}`,children:e}),(0,w.jsx)(`span`,{className:`mt-1 block text-[11px] leading-snug text-foreground-emphasis`,children:t})]}),i?(0,w.jsx)(`span`,{role:`tooltip`,className:`absolute inset-x-0 top-full z-30 mt-1 rounded-lg border border-border-subtle bg-background px-3 py-2 text-left text-[11px] leading-snug t-secondary shadow-xl`,children:n}):null]})}function ln({title:e,blurb:t,onMore:n,moreLabel:r}){return(0,w.jsxs)(`header`,{className:`mb-4 flex items-baseline justify-between gap-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:e}),(0,w.jsx)(`p`,{className:`mt-0.5 t-tertiary text-[11px] leading-snug`,children:t})]}),n?(0,w.jsx)(`button`,{type:`button`,onClick:n,className:`shrink-0 text-xs text-violet-400 transition-colors hover:text-violet-300`,children:r??`Details →`}):null]})}function un({value:e,label:t,hint:n,accent:r=`text-emerald-400`}){let i=nn(e==null?0:Math.max(0,Math.min(100,e))),a=2*Math.PI*32,o=a*(1-i/100);return(0,w.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,w.jsxs)(`div`,{className:`relative h-[76px] w-[76px] shrink-0`,children:[(0,w.jsxs)(`svg`,{viewBox:`0 0 80 80`,className:`h-[76px] w-[76px] -rotate-90`,"aria-hidden":`true`,children:[(0,w.jsx)(`circle`,{cx:`40`,cy:`40`,r:32,fill:`none`,strokeWidth:`7`,stroke:`currentColor`,className:`text-border-subtle`,opacity:.45}),(0,w.jsx)(`circle`,{cx:`40`,cy:`40`,r:32,fill:`none`,strokeWidth:`7`,strokeLinecap:`round`,stroke:`currentColor`,className:r,strokeDasharray:a,strokeDashoffset:o})]}),(0,w.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center font-mono text-lg font-bold tabular-nums ${r}`,children:e==null?`—`:`${Math.round(i)}%`})]}),(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`span`,{className:`block text-sm font-semibold text-foreground-emphasis`,children:t}),n?(0,w.jsx)(`span`,{className:`mt-0.5 block t-tertiary text-[11px] leading-snug`,children:n}):null]})]})}function dn({value:e,label:t,hint:n,accent:r=`text-violet-300`,chip:i=`bg-violet-500/10 ring-violet-500/25`}){return(0,w.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,w.jsx)(`div`,{className:`flex h-[76px] w-[76px] shrink-0 items-center justify-center rounded-2xl ring-1 ${i}`,children:(0,w.jsx)(`span`,{className:`font-mono text-3xl font-bold leading-none tabular-nums ${r}`,children:e})}),(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`span`,{className:`block text-sm font-semibold text-foreground-emphasis`,children:t}),n?(0,w.jsx)(`span`,{className:`mt-0.5 block t-tertiary text-[11px] leading-snug`,children:n}):null]})]})}function fn({label:e,value:t,hint:n,accent:r=`text-foreground`}){return(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 py-2`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`span`,{className:`block text-sm text-foreground`,children:e}),n?(0,w.jsx)(`span`,{className:`block t-tertiary text-[11px] leading-snug`,children:n}):null]}),(0,w.jsx)(`span`,{className:`shrink-0 font-mono text-lg font-semibold tabular-nums ${r}`,children:t})]})}function pn({title:e,blurb:t,onMore:n,lead:r,support:i,footer:a}){return(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsx)(ln,{title:e,blurb:t,onMore:n}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-5 sm:flex-row sm:items-center sm:gap-7`,children:[(0,w.jsx)(`div`,{className:`sm:w-[15.5rem] sm:shrink-0`,children:r}),(0,w.jsx)(`div`,{className:`flex-1 sm:border-l sm:border-border-subtle sm:pl-7`,children:(0,w.jsx)(`div`,{className:`divide-y divide-border-subtle/60`,children:i.map(e=>(0,w.jsx)(fn,{label:e.label,value:e.value,hint:e.hint,accent:e.accent},e.label))})})]}),a]})}function mn(){let{url:e,queryKey:t}=Ot(),n=N({queryKey:t([`token-flow`,`global`]),queryFn:()=>O(e(`/api/token-flow/global`))}),r=N({queryKey:t([`token-flow`,`headroom`]),queryFn:()=>O(e(`/api/token-flow/headroom`)),refetchInterval:3e4}),i=N({queryKey:t([`token-flow`,`sessions-recent`]),queryFn:()=>O(e(`/api/token-flow/sessions?limit=8&offset=0`))}),a=N({queryKey:t([`behavior-events`,`global`]),queryFn:()=>O(e(`/api/behavior-events/global`)),refetchInterval:1e4}),o=N({queryKey:t([`logbook`,`compliance`,`dashboard`]),queryFn:()=>O(e(`/api/logbook/compliance`)),refetchInterval:3e4}),s=N({queryKey:t([`reasoning-quality`,`global`,`dashboard`]),queryFn:()=>O(e(`/api/reasoning-quality/global`)),refetchInterval:3e4}),c=N({queryKey:t([`facts`,`health`,`dashboard`]),queryFn:()=>O(e(`/api/facts/health`)),refetchInterval:3e4}),l=N({queryKey:t([`timeline`,`intents`,`dashboard`]),queryFn:()=>O(e(`/api/timeline/intents?limit=10`)),refetchInterval:3e4}),u=N({queryKey:t([`timeline`,`resume`,`dashboard`]),queryFn:()=>O(e(`/api/timeline/resume`)),refetchInterval:3e4}),d=N({queryKey:t([`timeline`,`turns`,`count`,`dashboard`]),queryFn:()=>O(e(`/api/timeline/turns?limit=1`)),refetchInterval:3e4}),f=N({queryKey:t([`intelligence`,`insights`,`dashboard`]),queryFn:()=>O(e(`/api/intelligence/insights`))}),p=N({queryKey:t([`intelligence`,`graph-stats`,`dashboard`]),queryFn:()=>O(e(`/api/intelligence/graph-stats`))}),m=n.data?.data,h=i.data?.data??[],g=r.data?.data,_=r.isLoading&&g===void 0,v=o.data?.data?.runtime_joins,b=[];if(v){let e=v.memory_to_graph,t=v.graph_to_drift,n=v.three_way;e>0&&b.push(`${e} stored ${e===1?`note`:`notes`} used to protect ${e===1?`a code change`:`code changes`}`),t>0&&b.push(`${t} file ${t===1?`change`:`changes`} caught by checking code structure`),n>0&&b.push(`${n} ${n===1?`issue`:`issues`} caught by combining all three layers`)}let x=e=>e==null?`—`:`${Math.round(e)}%`,S=s.data?.data,C=c.data,T=(l.data?.data??[]).filter(e=>e.status===`active`),E=u.data?.data?.open_threads??[],ee=d.data?.total??0,te=f.data?.data,D=p.data?.data,ne=C?.by_type??{},re=(ne.negative??0)+(ne.episodic??0),ie=e=>{if(!e)return`text-foreground`;let t=e[0]?.toUpperCase();return t===`A`||t===`B`?`text-success`:t===`C`||t===`D`?`text-warning`:`text-error`},k=e=>{if(!e)return`bg-violet-500/10 ring-violet-500/25`;let t=e[0]?.toUpperCase();return t===`A`||t===`B`?`bg-emerald-500/10 ring-emerald-500/30`:t===`C`||t===`D`?`bg-amber-500/10 ring-amber-500/30`:`bg-rose-500/10 ring-rose-500/30`},A=m&&m.total_tokens_saved>0?(m.total_context_avoided/m.total_tokens_saved).toFixed(1):null,ae=a.data?.data.counts.by_type??{},j=Object.entries(ae).filter(([e,t])=>t>0&&!an.has(e)).sort(([,e],[,t])=>t-e),M=j.reduce((e,[,t])=>e+t,0),oe=j.slice(0,8),se=!!g&&[g.today,g.this_week,g.since_install].some(e=>e.turns_observed>0&&e.headroom_turns>e.turns_observed*2);return(0,w.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-6`,children:[(0,w.jsxs)(`section`,{className:`glass-panel overflow-hidden rounded-xl p-6`,children:[(0,w.jsxs)(`header`,{className:`mb-5 flex items-baseline justify-between gap-4`,children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:`Impact`}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider t-tertiary`,children:`Since install`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(`token-trace`),className:`shrink-0 text-xs text-violet-400 transition-colors hover:text-violet-300`,children:`Breakdown →`})]})]}),_&&!m?(0,w.jsx)(Wt,{n:3}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-7 sm:flex-row sm:items-end sm:gap-12`,children:[(0,w.jsx)(`div`,{className:`min-w-0`,children:g&&!se?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`block font-mono text-6xl font-bold leading-none tracking-tight text-success tabular-nums`,children:(0,w.jsx)(rn,{value:g.since_install.headroom_turns,format:e=>`+${Jt(e)}`})}),(0,w.jsxs)(`span`,{className:`mt-2 flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wider t-tertiary`,children:[`turns earned`,(0,w.jsx)(tn,{label:`What turns earned means`,text:`Extra turns of session headroom unerr earned you — the unit compression-only tools can't measure. Counts as extra prompts within your request quota (credit-billed agents) or extra context room before a window exhausts (window-billed agents).`})]})]}):se?(0,w.jsxs)(`div`,{className:`max-w-sm`,children:[(0,w.jsx)(`span`,{className:`block font-mono text-4xl font-bold leading-none text-warning tabular-nums`,children:`calibrating`}),(0,w.jsx)(`p`,{className:`mt-2 t-tertiary text-[11px] leading-snug`,children:`Turns earned needs a few more sessions to stabilise — the exact counts below are honest in the meantime.`})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`block font-mono text-6xl font-bold leading-none text-muted-foreground tabular-nums`,children:`—`}),(0,w.jsx)(`span`,{className:`mt-2 block text-[11px] font-medium uppercase tracking-wider t-tertiary`,children:`no turns earned yet`})]})}),m?(0,w.jsxs)(`div`,{className:`flex gap-9 sm:gap-12 sm:pb-1`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`block font-mono text-3xl font-bold leading-none text-foreground-emphasis tabular-nums`,children:(0,w.jsx)(rn,{value:m.total_tokens_saved,format:Jt})}),(0,w.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wider t-tertiary`,children:[`tokens saved`,(0,w.jsx)(tn,{label:`What tokens saved means`,text:`Raw bytes unerr kept out of the agent's context — counted on operations it handled (file reads, web fetches, shell output, dedup). Not whole-turn savings.`})]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`block font-mono text-3xl font-bold leading-none text-cyan-400 tabular-nums`,children:(0,w.jsx)(rn,{value:m.total_context_avoided,format:Jt})}),(0,w.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wider t-tertiary`,children:[`context avoided`,(0,w.jsx)(tn,{label:`What context avoided means`,text:`Downstream work unerr kept the agent from ever doing — re-reads, re-searches and retries it never had to issue.`})]})]})]}):null,m&&g&&!se?(0,w.jsx)(`div`,{className:`min-w-0 sm:flex-1 sm:self-stretch sm:border-l sm:border-border-subtle sm:pl-10`,children:(0,w.jsxs)(`div`,{className:`flex h-full flex-col justify-center`,children:[(0,w.jsxs)(`span`,{className:`mb-4 flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wider t-tertiary`,children:[`Where your savings come from`,(0,w.jsx)(tn,{label:`Where your savings come from`,text:`Token tools compress text. unerr also understands your code — a persistent graph of the repo means it knows what to read and what to skip. Compression is the commodity; code-intelligence is unerr-only. Turns are estimated from each tier's share of tokens saved.`})]}),(()=>{let e=m.total_tokens_saved||1,t=g.since_install.headroom_turns/e,n=(m.by_mechanism.graph_query?.tokens_saved??0)+(m.by_mechanism.file_read?.tokens_saved??0),r=Math.max(0,m.total_tokens_saved-n),i=Math.round(n/e*100);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`space-y-4`,children:[{key:`compress`,title:`Text compression`,sub:`what every token tool does`,tokens:r,primary:!1,bar:`bg-zinc-500/70`,tokenAccent:`t-secondary`,barH:`h-1.5`},{key:`intel`,title:`Understanding your code`,sub:`graph + graph-guided reads — only unerr`,tokens:n,primary:!0,bar:`bg-gradient-to-r from-violet-500 to-emerald-400`,tokenAccent:`text-emerald-300`,barH:`h-2.5`}].map(n=>(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`span`,{className:`block text-sm font-semibold ${n.primary?`text-foreground-emphasis`:`text-foreground`}`,children:n.title}),(0,w.jsx)(`span`,{className:`block text-[11px] leading-tight t-tertiary`,children:n.sub})]}),(0,w.jsxs)(`div`,{className:`shrink-0 text-right font-mono tabular-nums`,children:[(0,w.jsxs)(`span`,{className:`block text-sm font-semibold ${n.tokenAccent}`,children:[Jt(n.tokens),` tok`]}),(0,w.jsxs)(`span`,{className:`block text-[11px] t-tertiary`,children:[`~`,Jt(n.tokens*t),` turns`]})]})]}),(0,w.jsx)(`div`,{className:`mt-1.5 overflow-hidden rounded-full bg-surface-overlay ${n.barH}`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full ${n.bar}`,style:{width:`${n.tokens/e*100}%`}})})]},n.key))}),(0,w.jsxs)(`p`,{className:`mt-4 border-t border-border-subtle pt-3 text-[11px] leading-snug t-secondary`,children:[(0,w.jsxs)(`span`,{className:`font-semibold text-emerald-300`,children:[i,`%`]}),` `,`of every token unerr saves comes from`,` `,(0,w.jsx)(`span`,{className:`text-foreground`,children:`understanding your code`}),` `,`— not compressing text.`]})]})})()]})}):null]}),g&&!se||m?(0,w.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-border-subtle pt-4 text-sm t-secondary`,children:[g&&!se?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>y(`token-trace`,{window:`today`}),className:`inline-flex items-baseline gap-1.5 transition-colors hover:text-foreground`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-success`,children:[`▲ +`,Jt(g.today.headroom_turns)]}),`today`]}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`·`}),(0,w.jsxs)(`button`,{type:`button`,onClick:()=>y(`token-trace`,{window:`this_week`}),className:`inline-flex items-baseline gap-1.5 transition-colors hover:text-foreground`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-success`,children:[`▲ +`,Jt(g.this_week.headroom_turns)]}),`this week`]})]}):null,m&&A?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`·`}),(0,w.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fuchsia-400`,children:[A,`×`]}),`context compounding`,(0,w.jsx)(tn,{label:`What compounding means`,text:`Context avoided per token saved — how much downstream work each rescued token prevented.`})]})]}):null]}):null]})]}),(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`header`,{className:`mb-4 flex items-baseline justify-between gap-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:`Mistakes prevented`}),(0,w.jsx)(`p`,{className:`mt-0.5 t-tertiary text-[11px] leading-snug`,children:`Problems unerr caught before they reached your code — hover any card to see what would have gone wrong.`})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider t-tertiary`,children:[Jt(M),` caught`]}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(`logbook`),className:`text-xs text-violet-400 transition-colors hover:text-violet-300`,children:`Full log →`})]})]}),b.length>0?(0,w.jsxs)(`div`,{className:`mb-4 rounded-lg border border-violet-500/30 bg-violet-500/5 px-4 py-3`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,w.jsx)(`span`,{"aria-hidden":`true`,className:`text-fuchsia-400`,children:`⚡`}),(0,w.jsx)(`span`,{className:`font-medium text-foreground-emphasis`,children:`Cross-layer protection`}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`—`}),(0,w.jsx)(`span`,{className:`t-secondary`,children:b.join(` · `)})]}),(0,w.jsx)(`p`,{className:`mt-1 text-[11px] leading-snug t-tertiary`,children:`unerr combined what it remembers about your project, the live code structure, and file-change detection to catch issues that no single tool could spot alone.`})]}):null,a.isLoading&&oe.length===0?(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-2.5 sm:grid-cols-3 lg:grid-cols-4`,children:[(0,w.jsx)(Ht,{className:`h-20 w-full`}),(0,w.jsx)(Ht,{className:`h-20 w-full`}),(0,w.jsx)(Ht,{className:`h-20 w-full`}),(0,w.jsx)(Ht,{className:`h-20 w-full`})]}):oe.length===0?(0,w.jsx)(`p`,{className:`t-tertiary text-sm`,children:`Nothing recorded yet — unerr starts tracking as soon as your agent calls a tool.`}):(0,w.jsx)(`div`,{className:`grid grid-cols-2 gap-2.5 sm:grid-cols-3 lg:grid-cols-4`,children:oe.map(([e,t])=>{let n=sn(e);return(0,w.jsx)(cn,{count:Jt(t),label:n.label,desc:n.desc,palette:en(e)},e)})})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2 lg:items-start`,children:[(0,w.jsx)(pn,{title:`Reasoning Quality`,blurb:`How much cleaner and more first-try-correct unerr made the agent's reasoning`,onMore:()=>y(`reasoning`),lead:(0,w.jsx)(un,{value:S?.first_call_resolution_rate,label:`Found first try`,hint:`answered in one lookup — no grep loops`,accent:`text-cyan-400`}),support:[{label:`Cleaner context`,value:x(S?.noise_removed_pct),hint:`noise removed before the agent read it`,accent:`text-emerald-400`},{label:`Fewer breakages`,value:S?.prevention_score??`—`,hint:S?`${Jt(S.blast_radius_warnings)} warns · ${Jt(S.convention_injections)} hints`:`blast-radius + convention guards`,accent:`text-amber-400`},{label:`Quality multiplier`,value:S?`${S.reasoning_quality_multiplier.toFixed(1)}×`:`—`,hint:`overall reasoning lift`,accent:`text-violet-300`}]}),(0,w.jsx)(pn,{title:`Memory · Recalls & Rememberances`,blurb:`What unerr remembered, how often it resurfaced, and whether it was load-bearing`,onMore:()=>y(`facts`),lead:(0,w.jsx)(un,{value:S?.memory_effectiveness_pct,label:`Memory effectiveness`,hint:S?`${Jt(S.memory_signals_fired)} fired · ${Jt(S.memory_verdicts_total)} verdicts`:`share of recalled memories that proved load-bearing`,accent:`text-emerald-400`}),support:[{label:`Memories stored`,value:Jt(C?.total),hint:C?`${Jt(ne.semantic??0)} patterns · ${Jt(ne.procedural??0)} hot files · ${Jt(re)} lessons`:`patterns, hot files, lessons`,accent:`text-violet-300`},{label:`Recalled`,value:Jt(S?.facts_recalled),hint:`stored facts re-surfaced to the agent`,accent:`text-cyan-400`},{label:`Avg confidence`,value:x((C?.avg_confidence??0)*100),hint:`mean confidence across live memories`,accent:`text-fuchsia-300`}]}),(0,w.jsx)(pn,{title:`Activity & Tasks`,blurb:`What's in flight across sessions — open tasks, unresolved blockers, activity volume`,onMore:()=>y(`activity`),lead:(0,w.jsx)(dn,{value:Jt(T.length),label:`Tasks in progress`,hint:`open intents still being worked across sessions`,accent:`text-cyan-400`,chip:`bg-cyan-500/10 ring-cyan-500/25`}),support:[{label:`Unresolved issues`,value:Jt(E.length),hint:`blockers without a resolution yet`,accent:E.length>0?`text-amber-400`:`text-foreground`},{label:`Activity moments`,value:Jt(ee),hint:`turns unerr has observed`,accent:`text-violet-300`}],footer:T.length>0?(0,w.jsx)(`ul`,{className:`mt-4 space-y-1.5 border-t border-border-subtle pt-4`,children:T.slice(0,4).map(e=>(0,w.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,children:[(0,w.jsx)(`span`,{className:`inline-block size-1.5 shrink-0 rounded-full bg-cyan-400`,"aria-hidden":`true`}),(0,w.jsx)(`span`,{className:`truncate text-foreground`,children:e.title}),(0,w.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] t-tertiary`,children:Yt(new Date(e.last_active_at).toISOString())})]},e.intent_id))}):null}),(0,w.jsx)(pn,{title:`Code Health & Risk`,blurb:`The state of the codebase unerr reasons over — grade, test reach, risk`,onMore:()=>y(`graph`),lead:(0,w.jsx)(dn,{value:te?.healthGrade??`—`,label:`Health grade`,hint:te?`architecture score ${te.healthScore}/100`:`A–F architecture grade`,accent:ie(te?.healthGrade),chip:k(te?.healthGrade)}),support:[{label:`Tested reach`,value:x(te?.blastRadiusCoverage),hint:`of blast radius covered by tests`,accent:`text-emerald-400`},{label:`High-risk files`,value:Jt(te?.riskDistribution?.high),hint:D?`${Jt(D.entityCount)} entities · ${Jt(D.communityCount)} modules`:`entities flagged high-risk`,accent:(te?.riskDistribution?.high??0)>0?`text-error`:`text-foreground`},{label:`Chokepoints`,value:Jt(te?.bottlenecks?.length),hint:D?`${Jt(D.driftCount)} files drifted locally`:`high fan-in bottlenecks`,accent:`text-amber-400`}]})]}),(0,w.jsxs)(`section`,{className:`glass-panel overflow-hidden rounded-xl`,children:[(0,w.jsxs)(`header`,{className:`flex items-center justify-between px-5 pt-4 pb-3`,children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:`Recent Sessions`}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-xs t-tertiary`,children:[i.data?._meta.total??`—`,` total`]}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(`token-trace`),className:`text-xs text-violet-400 transition-colors hover:text-violet-300`,children:`All sessions →`})]})]}),i.isLoading?(0,w.jsxs)(`div`,{className:`space-y-2 px-5 pb-4`,children:[(0,w.jsx)(Ht,{className:`h-10 w-full`}),(0,w.jsx)(Ht,{className:`h-10 w-full`}),(0,w.jsx)(Ht,{className:`h-10 w-full`})]}):h.length===0?(0,w.jsx)(`p`,{className:`px-5 pb-5 t-tertiary text-sm`,children:`No sessions recorded yet.`}):(0,w.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-t border-border-subtle bg-surface-overlay/40 text-left`,children:[(0,w.jsx)(`th`,{className:`px-5 py-2 font-medium uppercase tracking-wider t-tertiary text-[10px]`,children:`Agent`}),(0,w.jsx)(`th`,{className:`px-2 py-2 font-medium uppercase tracking-wider t-tertiary text-[10px]`,children:`Session`}),(0,w.jsx)(`th`,{className:`px-2 py-2 font-medium uppercase tracking-wider t-tertiary text-[10px]`,children:`When`}),(0,w.jsx)(`th`,{className:`px-2 py-2 text-right font-medium uppercase tracking-wider t-tertiary text-[10px]`,children:`Turns`}),(0,w.jsx)(`th`,{className:`px-2 py-2 text-right font-medium uppercase tracking-wider t-tertiary text-[10px]`,children:`Events`}),(0,w.jsx)(`th`,{className:`px-5 py-2 text-right font-medium uppercase tracking-wider t-tertiary text-[10px]`,children:`Saved`})]})}),(0,w.jsx)(`tbody`,{className:`divide-y divide-border-subtle`,children:h.map(e=>(0,w.jsxs)(`tr`,{className:`transition-colors hover:bg-surface-overlay/30`,children:[(0,w.jsx)(`td`,{className:`px-5 py-2.5 truncate text-foreground`,children:e.agent_name||`Unknown Agent`}),(0,w.jsx)(`td`,{className:`px-2 py-2.5 font-mono text-[11px] text-violet-300`,children:e.session_id.length>10?`${e.session_id.slice(0,10)}…`:e.session_id}),(0,w.jsx)(`td`,{className:`px-2 py-2.5 t-tertiary text-xs`,children:Yt(e.last_ts)}),(0,w.jsx)(`td`,{className:`px-2 py-2.5 text-right font-mono tabular-nums t-secondary`,children:e.total_turns}),(0,w.jsx)(`td`,{className:`px-2 py-2.5 text-right font-mono tabular-nums t-secondary`,children:e.event_count}),(0,w.jsx)(`td`,{className:`px-5 py-2.5 text-right font-mono text-success tabular-nums`,children:Jt(e.total_saved)})]},e.session_id))})]})]}),n.error&&(0,w.jsx)(`p`,{className:`text-error text-sm`,children:`Some requests failed. Ensure the unerr proxy is running.`})]})}var hn={semantic:{label:`Conventions your code follows`,icon:`◆`,color:`violet`,description:`Patterns unerr detected in your codebase — naming styles, import order, file structure`,emptyMsg:`No conventions detected yet. unerr discovers these as it indexes your project.`},procedural:{label:`Files you work on most`,icon:`⚡`,color:`cyan`,description:`The files your agent keeps coming back to — unerr prioritizes these in context`,emptyMsg:`Not enough data yet. After a few sessions, unerr will spot your most-touched files.`},negative:{label:`Mistakes to avoid`,icon:`✗`,color:`red`,description:`Things that went wrong before — unerr warns your agent so it doesn't repeat them`,emptyMsg:`No past mistakes recorded. That's a good thing.`},episodic:{label:`Change outcomes`,icon:`◎`,color:`amber`,description:`Which changes stuck and which got reverted — so your agent knows what works`,emptyMsg:`No change history tracked yet.`},convention:{label:`Rules you've taught unerr`,icon:`▸`,color:`emerald`,description:`Rules you explicitly told unerr to remember — these override everything else`,emptyMsg:`No rules taught yet. Tell your agent "remember: always use camelCase" and unerr will enforce it.`}};function gn(e){let t=e.content;if(t=t.replace(/^Naming convention:\s*/,``),t=t.replace(/^Structure pattern:\s*/,``),t=t.replace(/^Import convention:\s*/,``),t=t.replace(/^Convention:\s*/,``),t=t.replace(/\s*\(\d+%\s*confidence(?:,\s*\d+\s*entities?)?\)/,``),e.fact_type===`procedural`&&t.includes(`is accessed in`)){let e=t.match(/is accessed in (\d+)% of sessions/);if(e)return`Accessed in ${e[1]}% of your coding sessions`}if(e.fact_type===`procedural`&&t.includes(`revert rate`)){let e=t.match(/has a (\d+)% revert rate/);if(e)return`${e[1]}% of changes here get reverted — handle with care`}return t}function _n(e){let t=Date.now()-e,n=Math.floor(t/6e4);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 vn(e){let t=e.split(`/`);return t.length>1?t[t.length-1]:e}function yn(e){let t=e.split(`/`);return t.length>1?`${t.slice(0,-1).join(`/`)}/`:``}function bn(e){return e>=.7?`bg-emerald-400`:e>=.4?`bg-amber-400`:`bg-red-400`}function xn(e){return e>=.7?`High certainty`:e>=.4?`Likely true`:`Needs review`}function Sn(){let e=lt(),{url:t,queryKey:n}=Ot(),[r,i]=(0,f.useState)(!1),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(`all`),[d,p]=(0,f.useState)(`all`),[m,h]=(0,f.useState)(0),g=N({queryKey:n([`facts`,`health`]),queryFn:()=>O(t(`/api/facts/health`)),refetchInterval:3e4}),_=N({queryKey:n([`facts`,`list`,`all`]),queryFn:()=>O(t(`/api/facts-v2/list?${new URLSearchParams({source:`all`,min_confidence:`0`})}`)),refetchInterval:15e3}),v=wt({mutationFn:e=>O(t(`/api/facts-v2/${e}/reinforce`),{method:`POST`}),onSuccess:()=>{e.invalidateQueries({queryKey:n([`facts`])})}}),y=wt({mutationFn:e=>O(t(`/api/facts-v2/${e}`),{method:`DELETE`}),onSuccess:()=>{e.invalidateQueries({queryKey:n([`facts`])})}}),b=wt({mutationFn:({id:e,content:n})=>O(t(`/api/facts-v2/${e}`),{method:`PATCH`,body:JSON.stringify({content:n}),headers:{"content-type":`application/json`}}),onSuccess:()=>{e.invalidateQueries({queryKey:n([`facts`])})}}),x=wt({mutationFn:e=>O(t(`/api/facts-v2/${e}/disable`),{method:`POST`}),onSuccess:()=>{e.invalidateQueries({queryKey:n([`facts`])})}}),S=g.data,C=_.data?.data??[],T=C.filter(e=>!e.disabled).reduce((e,t)=>{let n=t.fact_type,r=e[n];return r||(r=[],e[n]=r),r.push(t),e},{}),E=s.trim().toLowerCase(),ee=(0,f.useMemo)(()=>C.filter(e=>!(l===`user_fed`&&e.source!==`user_fed`||l===`auto`&&e.source===`user_fed`||d===`active`&&e.disabled||d===`disabled`&&!e.disabled||d===`drifting`&&!e.drift||E&&!`${e.subject} ${e.content} ${e.source_quote??``}`.toLowerCase().includes(E))),[C,l,d,E]),te=Math.max(1,Math.ceil(ee.length/Dn)),D=Math.min(m,te-1),ne=ee.slice(D*Dn,(D+1)*Dn),re=T.semantic??[],ie=T.procedural??[],k=T.negative??[],A=T.episodic??[],ae=T.convention??[],j=g.isLoading||_.isLoading;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,w.jsxs)(`section`,{className:`el-raised rounded-lg p-6 border-l-4 border-violet-500/60`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-6 flex-wrap`,children:[(0,w.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,w.jsx)(`h2`,{className:`text-foreground font-semibold text-base`,children:`What unerr has learned about your project`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-1 max-w-xl leading-relaxed`,children:`unerr watches how you code — which files you keep editing, what conventions your codebase follows, and what went wrong before. Every piece of knowledge here is automatically given to your AI agent so it makes fewer mistakes.`})]}),!j&&S&&S.total>0&&(0,w.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,w.jsx)(`p`,{className:`text-violet-400 font-mono font-bold text-4xl`,children:S.total}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-1`,children:`things remembered`})]})]}),j?(0,w.jsx)(`div`,{className:`mt-4`,children:(0,w.jsx)(Wt,{n:4})}):S?(0,w.jsxs)(`div`,{className:`mt-4 grid gap-3 grid-cols-2 lg:grid-cols-4`,children:[(0,w.jsx)(wn,{label:`Rules you taught`,value:S.by_type.convention??0,color:`text-emerald-400`}),(0,w.jsx)(wn,{label:`Conventions found`,value:S.by_type.semantic??0,color:`text-violet-400`}),(0,w.jsx)(wn,{label:`Frequently edited files`,value:S.by_type.procedural??0,color:`text-cyan-400`}),(0,w.jsx)(wn,{label:`Mistakes to avoid`,value:(S.by_type.negative??0)+(S.by_type.episodic??0),color:`text-red-400`})]}):null]}),(0,w.jsx)(Cn,{onSelectFactId:e=>{let t=C.find(t=>t.fact_id===e);t&&o(t)}}),(0,w.jsx)(On,{meta:hn.convention,facts:ae,renderCard:e=>(0,w.jsx)(kn,{fact:e,onSelect:()=>o(e),onReinforce:()=>v.mutate(e.fact_id),onDismiss:()=>y.mutate(e.fact_id),isPending:v.isPending||y.isPending},e.fact_id),isLoading:j}),(0,w.jsx)(On,{meta:hn.negative,facts:[...k,...A],renderCard:e=>(0,w.jsx)(jn,{fact:e,onSelect:()=>o(e),onReinforce:()=>v.mutate(e.fact_id),onDismiss:()=>y.mutate(e.fact_id),isPending:v.isPending||y.isPending},e.fact_id),isLoading:j}),(0,w.jsx)(On,{meta:hn.semantic,facts:re,renderCard:e=>(0,w.jsx)(kn,{fact:e,onSelect:()=>o(e),onReinforce:()=>v.mutate(e.fact_id),onDismiss:()=>y.mutate(e.fact_id),isPending:v.isPending||y.isPending},e.fact_id),isLoading:j}),(0,w.jsx)(On,{meta:hn.procedural,facts:ie,renderCard:e=>(0,w.jsx)(An,{fact:e,onSelect:()=>o(e),onReinforce:()=>v.mutate(e.fact_id),onDismiss:()=>y.mutate(e.fact_id),isPending:v.isPending||y.isPending},e.fact_id),isLoading:j}),C.length>0&&(0,w.jsxs)(`section`,{children:[(0,w.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 text-xs t-tertiary hover:text-foreground transition-colors`,onClick:()=>i(!r),children:[(0,w.jsx)(`span`,{className:`transition-transform`,style:{transform:r?`rotate(90deg)`:`rotate(0deg)`},children:`▸`}),r?`Hide`:`Show`,` all `,C.length,` memories`]}),r&&(0,w.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`search`,value:s,onChange:e=>{c(e.target.value),h(0)},placeholder:`Search memories…`,className:`flex-1 min-w-[160px] rounded-lg border border-border-subtle bg-surface-overlay px-3 py-1.5 text-xs text-foreground placeholder:t-tertiary`}),(0,w.jsx)(Tn,{value:l,onChange:e=>{u(e),h(0)},options:[[`all`,`All`],[`user_fed`,`Your rules`],[`auto`,`Auto-learned`]]}),(0,w.jsx)(Tn,{value:d,onChange:e=>{p(e),h(0)},options:[[`all`,`Any status`],[`active`,`Active`],[`disabled`,`Turned off`],[`drifting`,`Possibly outdated`]]})]}),(0,w.jsx)(`div`,{className:`glass-panel rounded-xl p-4 overflow-x-auto custom-scrollbar`,children:(0,w.jsxs)(`table`,{className:`w-full min-w-[760px] text-left text-xs`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle t-tertiary uppercase`,children:[(0,w.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Kind`}),(0,w.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`About`}),(0,w.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`What unerr remembers`}),(0,w.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Status`}),(0,w.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Certainty`}),(0,w.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Learned`})]})}),(0,w.jsxs)(`tbody`,{children:[ne.map(e=>(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle cursor-pointer hover:bg-surface-overlay/40 transition-colors`,onClick:()=>o(e),children:[(0,w.jsx)(`td`,{className:`py-2 pr-3`,children:(0,w.jsx)(Vn,{type:e.fact_type})}),(0,w.jsx)(`td`,{className:`py-2 pr-3 font-mono max-w-[160px] truncate`,title:e.subject,children:e.subject}),(0,w.jsx)(`td`,{className:`py-2 pr-3 max-w-[280px] truncate t-secondary`,title:e.content,children:e.content}),(0,w.jsx)(`td`,{className:`py-2 pr-3`,children:(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[e.drift&&(0,w.jsx)(`span`,{className:`rounded bg-amber-500/20 px-1.5 py-0.5 text-[9px] font-medium text-amber-300`,children:`outdated`}),e.disabled?(0,w.jsx)(`span`,{className:`rounded bg-red-500/20 px-1.5 py-0.5 text-[9px] font-medium text-red-300`,children:`off`}):(0,w.jsx)(`span`,{className:`rounded bg-emerald-500/15 px-1.5 py-0.5 text-[9px] font-medium text-emerald-300`,children:`active`})]})}),(0,w.jsxs)(`td`,{className:`py-2 pr-3 font-mono tabular-nums`,children:[(e.effective_confidence*100).toFixed(0),`%`]}),(0,w.jsx)(`td`,{className:`py-2 pr-3 t-tertiary tabular-nums`,children:_n(e.created_at)})]},e.fact_id)),ne.length===0&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,className:`py-6 text-center t-tertiary italic`,children:`No memories match these filters.`})})]})]})}),ee.length>Dn&&(0,w.jsxs)(`div`,{className:`flex items-center justify-between pt-2`,children:[(0,w.jsxs)(`span`,{className:`text-[10px] t-tertiary tabular-nums`,children:[D*Dn+1,`–`,Math.min((D+1)*Dn,ee.length),` `,`of `,ee.length]}),(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[(0,w.jsx)(`button`,{type:`button`,disabled:D===0,onClick:()=>h(e=>Math.max(0,e-1)),className:`rounded-md px-2 py-1 text-[11px] font-medium t-secondary bg-surface-overlay hover:text-foreground transition-colors disabled:opacity-30`,children:`← Prev`}),(0,w.jsxs)(`span`,{className:`flex items-center px-2 text-[10px] t-tertiary tabular-nums`,children:[D+1,` / `,te]}),(0,w.jsx)(`button`,{type:`button`,disabled:D>=te-1,onClick:()=>h(e=>Math.min(te-1,e+1)),className:`rounded-md px-2 py-1 text-[11px] font-medium t-secondary bg-surface-overlay hover:text-foreground transition-colors disabled:opacity-30`,children:`Next →`})]})]})]})]}),a&&(0,w.jsx)(In,{fact:a,allFacts:C,onClose:()=>o(null),onReinforce:()=>{v.mutate(a.fact_id),o(null)},onDismiss:()=>{y.mutate(a.fact_id),o(null)},onEdit:e=>{b.mutate({id:a.fact_id,content:e}),o(null)},onDisable:()=>{x.mutate(a.fact_id),o(null)},isPending:v.isPending||y.isPending||b.isPending||x.isPending})]})}function Cn({onSelectFactId:e}){let{url:t,queryKey:n}=Ot(),[r,i]=(0,f.useState)(``),[a,o]=(0,f.useState)(``),s=N({queryKey:n([`facts`,`injection-preview`,a]),queryFn:()=>O(t(`/api/facts-v2/injection-preview?${new URLSearchParams({file:a})}`)),enabled:a.length>0}),c=s.data;return(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-6`,children:[(0,w.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-foreground`,children:`Try it — see what your agent sees`}),(0,w.jsx)(`p`,{className:`mt-1 text-sm t-secondary leading-relaxed`,children:`Type any file path to preview the exact knowledge unerr gives your agent when it works on that file. This is the real thing, not a simulation.`})]})}),(0,w.jsxs)(`form`,{className:`mt-4 flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),o(r.trim())},children:[(0,w.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),placeholder:`src/proxy/proxy.ts`,spellCheck:!1,className:`flex-1 min-w-[220px] rounded-lg border border-border-subtle bg-surface-overlay px-3 py-1.5 font-mono text-xs text-foreground placeholder:t-tertiary`}),(0,w.jsx)(`button`,{type:`submit`,disabled:r.trim().length===0,className:`rounded-lg border border-border-subtle bg-surface-overlay px-3 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-surface-overlay/60 disabled:opacity-40`,children:`Preview`})]}),a.length>0&&(0,w.jsx)(`div`,{className:`mt-4`,children:s.isLoading?(0,w.jsx)(`p`,{className:`text-xs t-tertiary italic`,children:`Resolving memories…`}):s.isError?(0,w.jsxs)(`p`,{className:`text-xs text-red-300`,children:[`Could not load injection preview for`,` `,(0,w.jsx)(`span`,{className:`font-mono`,children:a}),`.`]}):c?c.injected.length===0?(0,w.jsx)(`div`,{className:`rounded-lg border border-border-subtle bg-surface-overlay/40 p-4`,children:(0,w.jsxs)(`p`,{className:`text-xs t-secondary`,children:[`unerr doesn't have any knowledge about`,` `,(0,w.jsx)(`span`,{className:`font-mono t-tertiary`,children:a}),` `,`yet. As you work on this file, unerr will learn its conventions, track changes, and remember past issues.`]})}):(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-widest t-tertiary`,children:`What your agent sees when it opens this file`}),(0,w.jsx)(`pre`,{className:`overflow-x-auto custom-scrollbar rounded-lg border border-violet-500/30 bg-violet-500/5 p-3 font-mono text-[11px] leading-relaxed text-violet-100 whitespace-pre-wrap`,children:c.injected.join(`
|
|
7
|
+
<script type="module" crossorigin>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 ee(e,t){return E(e.type,t,e.props)}function te(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function D(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var O=/\/+/g;function ne(e,t){return typeof e==`object`&&e&&e.key!=null?D(``+e.key):t.toString(36)}function re(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 ie(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,ie(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ne(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(O,`$&/`)+`/`),ie(o,r,i,``,function(e){return e})):o!=null&&(te(o)&&(o=ee(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(O,`$&/`)+`/`)+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+ne(a,u),c+=ie(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+ne(a,u++),c+=ie(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ie(re(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 k(e,t,n){if(e==null)return e;var r=[],i=0;return ie(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function A(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 ae=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)},j={map:k,forEach:function(e,t,n){k(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return k(e,function(){t++}),t},toArray:function(e){return k(e,function(e){return e})||[]},only:function(e){if(!te(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=j,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=te,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:A}},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,ae)}catch(e){ae(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.5`})),d=o(((e,t)=>{t.exports=u()})),f=l(d(),1),p={overview:`Dashboard`,visual:`Codebase Map`,graph:`Code Intelligence`,facts:`Project Memory`,logbook:`What unerr did`,guard:`Cascade Guard`,"token-trace":`Token Trace`,reasoning:`Reasoning Trace`,"prompt-trace":`Prompt Trace`,activity:`Activity`,router:`MCP Router`,"router-sessions":`Router Sessions`,settings:`Settings`,"all-repos":`All Repositories`,daemon:`Daemon Supervisor`};function m(e){return p[e]}function h(){let e=(window.location.hash.replace(/^#/,``).split(`?`)[0]?.trim()||`/`).split(`/`).filter(Boolean),t=e[0]?.toLowerCase();if(t===`all-repos`)return{routeId:`all-repos`,repoLabel:null};if(t===`daemon`)return{routeId:`daemon`,repoLabel:null};if(t===`repo`&&e.length>=2){let t=e[1],n=e[2]?.toLowerCase();return{routeId:g(n),repoLabel:t}}return{routeId:g(t),repoLabel:null}}function g(e){switch(e){case`overview`:case`dashboard`:return`overview`;case`visual`:return`visual`;case`graph`:return`graph`;case`facts`:return`facts`;case`logbook`:case`story`:return`logbook`;case`guard`:case`cascade-guard`:return`guard`;case`session-economy`:case`economy`:case`headroom`:return`token-trace`;case`sidekick-memory`:case`sidekick`:case`memory`:return`facts`;case`token-trace`:return`token-trace`;case`reasoning`:return`reasoning`;case`prompt-trace`:return`prompt-trace`;case`activity`:case`session-timeline`:case`timeline`:return`activity`;case`router`:return`router`;case`router-sessions`:return`router-sessions`;case`settings`:return`settings`;default:return`overview`}}function _(){let[e,t]=(0,f.useState)(()=>typeof window>`u`?`overview`:h().routeId);return(0,f.useEffect)(()=>{t(h().routeId);let e=()=>t(h().routeId);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}function v(){let[e,t]=(0,f.useState)(()=>typeof window>`u`?{routeId:`overview`,repoLabel:null}:h());return(0,f.useEffect)(()=>{t(h());let e=()=>t(h());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}function y(e,t,n){let r=typeof t==`string`?t:void 0,i=typeof t==`object`?t:n,a=i&&Object.keys(i).length>0?`?${new URLSearchParams(i).toString()}`:``;if(e===`all-repos`||e===`daemon`){window.location.hash=`#/${e}${a}`;return}let o=r??h().repoLabel??void 0;if(o){window.location.hash=e===`overview`?`#/repo/${o}${a}`:`#/repo/${o}/${e}${a}`;return}window.location.hash=e===`overview`?`#/${a}`:`#/${e}${a}`}function b(e){if(typeof window>`u`)return null;let t=window.location.hash||``,n=t.indexOf(`?`);return n===-1?null:new URLSearchParams(t.slice(n+1)).get(e)}function x(e){if(typeof window>`u`)return;let t=window.location.hash||`#/`,n=t.indexOf(`?`),r=n===-1?t:t.slice(0,n),i=new URLSearchParams(n===-1?``:t.slice(n+1));for(let[t,n]of Object.entries(e))n===null||n===``?i.delete(t):i.set(t,n);let a=i.toString(),o=a?`${r}?${a}`:r;o!==t&&(window.location.hash=o)}function S(e){let[t,n]=(0,f.useState)(()=>typeof window>`u`?null:b(e));return(0,f.useEffect)(()=>{let t=()=>n(b(e));return t(),window.addEventListener(`hashchange`,t),()=>window.removeEventListener(`hashchange`,t)},[e]),t}var C=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})),w=o(((e,t)=>{t.exports=C()}))(),T=[{id:`overview`,label:`Dashboard`},{id:`logbook`,label:`What unerr did`},{id:`guard`,label:`Cascade Guard`},{id:`token-trace`,label:`Token Trace`},{id:`reasoning`,label:`Reasoning Trace`},{id:`visual`,label:`Codebase Map`},{id:`graph`,label:`Code Intelligence`},{id:`facts`,label:`Project Memory`},{id:`activity`,label:`Activity`},{id:`router`,label:`MCP Router`},{id:`router-sessions`,label:`Router Sessions`},{id:`settings`,label:`Settings`}],E=[{id:`all-repos`,label:`All Repositories`},{id:`daemon`,label:`Daemon`}];function ee(e){let t=e.replace(/\\/g,`/`).split(`/`).filter(Boolean),n=t[t.length-1]??e;return{name:n,dir:t.length>=2?`${t[t.length-2]}/${t[t.length-1]}`:n}}function te({title:e,subtitle:t,statusDot:n,repoPath:r,activeRoute:i,repoLabel:a,isDaemonMode:o,repos:s,authBanner:c,updateBanner:l,children:u}){let d=r?ee(r):null,f=i===`all-repos`||i===`daemon`;return(0,w.jsxs)(`div`,{className:`flex min-h-screen flex-col md:flex-row`,children:[(0,w.jsxs)(`aside`,{className:`flex w-full shrink-0 flex-col border-b border-border-subtle bg-sidebar px-5 py-6 md:w-56 md:border-r md:border-b-0 md:sticky md:top-0 md:h-screen md:overflow-y-auto`,children:[(0,w.jsx)(`div`,{className:`mb-8 flex items-center justify-center`,children:(0,w.jsx)(`img`,{src:`/icon-wordmark.png`,alt:`unerr`,className:`h-7`,draggable:!1})}),o&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`p`,{className:`mb-2 px-3 text-[10px] font-semibold uppercase tracking-widest t-tertiary`,children:`Global`}),(0,w.jsx)(`nav`,{className:`flex flex-col gap-0.5 mb-4`,"aria-label":`Global`,children:E.map(e=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(e.id),className:`block w-full rounded-md px-3 py-2 text-left text-sm transition-colors ${i===e.id?`el-raised font-medium text-foreground-emphasis`:`text-muted-foreground hover:text-foreground hover:el-raised`}`,children:e.label},e.id))}),s&&s.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`p`,{className:`mb-2 px-3 text-[10px] font-semibold uppercase tracking-widest t-tertiary`,children:`Repositories`}),(0,w.jsx)(`div`,{className:`flex flex-col gap-0.5 mb-4`,children:s.map(e=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>y(`overview`,e.label),className:`flex items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors ${a===e.label&&!f?`el-raised font-medium text-foreground-emphasis`:`text-muted-foreground hover:text-foreground hover:el-raised`}`,children:[(0,w.jsx)(`span`,{className:`inline-flex h-2 w-2 shrink-0 rounded-full ${e.status===`running`?`bg-success shadow-[0_0_4px_rgba(52,211,153,0.6)]`:e.status===`error`?`bg-error`:`bg-muted-foreground/40`}`}),(0,w.jsx)(`span`,{className:`truncate`,children:e.label})]},e.label))})]}),a&&!f&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`divider-shimmer mb-3`}),(0,w.jsx)(`nav`,{className:`flex flex-col gap-0.5`,"aria-label":`Repo`,children:T.map(e=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(e.id,a),className:`block w-full rounded-md px-3 py-2 text-left text-sm transition-colors ${i===e.id?`el-raised font-medium text-foreground-emphasis`:`text-muted-foreground hover:text-foreground hover:el-raised`}`,children:e.label},e.id))})]})]}),!o&&(0,w.jsx)(`nav`,{className:`flex flex-col gap-0.5`,"aria-label":`Primary`,children:T.map(e=>(0,w.jsx)(`a`,{href:e.id===`overview`?`#/`:`#/${e.id}`,className:`block rounded-md px-3 py-2 text-sm transition-colors ${i===e.id?`el-raised font-medium text-foreground-emphasis`:`text-muted-foreground hover:text-foreground hover:el-raised`}`,children:e.label},e.id))}),t?(0,w.jsxs)(`div`,{className:`mt-auto pt-8`,children:[(0,w.jsx)(`div`,{className:`divider-shimmer mb-4`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs leading-relaxed`,children:t})]}):null]}),(0,w.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-auto bg-background`,children:[(0,w.jsxs)(`header`,{className:`flex items-center justify-between border-b border-border-subtle bg-background/90 px-6 py-4 backdrop-blur-sm`,children:[(0,w.jsx)(`h1`,{children:e}),d&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,title:r,children:[(0,w.jsx)(`span`,{className:`inline-flex h-2 w-2 shrink-0 rounded-full ${n===`live`?`bg-success shadow-[0_0_6px_rgba(52,211,153,0.6)]`:`bg-warning animate-pulse`}`,title:n===`live`?`Connected`:`Reconnecting...`}),(0,w.jsx)(`span`,{className:`text-sm font-medium text-foreground-emphasis`,children:d.name}),(0,w.jsx)(`span`,{className:`t-tertiary text-xs font-mono hidden sm:inline`,children:d.dir})]})]}),c&&(c.badge===`warn`||c.badge===`attention`)&&(0,w.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 border-b px-6 py-2.5 text-sm ${c.badge===`attention`?`border-error/30 bg-error/10 text-error`:`border-warning/30 bg-warning/10 text-warning`}`,children:[(0,w.jsx)(`span`,{className:`inline-flex h-2 w-2 shrink-0 rounded-full ${c.badge===`attention`?`bg-error`:`bg-warning`}`}),(0,w.jsx)(`span`,{children:c.line})]}),l&&(l.status===`available`||l.status===`pending`||l.status===`rolled-back`)&&(0,w.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 border-b px-6 py-2.5 text-sm ${l.status===`rolled-back`?`border-error/30 bg-error/10 text-error`:`border-data/30 bg-data/10 text-data`}`,children:[(0,w.jsx)(`span`,{className:`inline-flex h-2 w-2 shrink-0 rounded-full ${l.status===`rolled-back`?`bg-error`:`bg-data`}`}),(0,w.jsx)(`span`,{children:l.line})]}),(0,w.jsx)(`div`,{className:`flex-1 p-6`,children:u})]})]})}var D=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};async function O(e,t){let n=await fetch(e,{...t,headers:{Accept:`application/json`,...t?.headers}}),r=await n.text(),i;try{i=r?JSON.parse(r):null}catch{i=r}if(!n.ok)throw new D(typeof i==`object`&&i&&`error`in i?String(i.error):n.statusText,n.status);return i}function ne(e,t){return e?e+t.replace(/^\/api/,``):t}var re=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(){}},ie=new class extends re{#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`}},k={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},A=new class{#e=k;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 ae(e){setTimeout(e,0)}var j=typeof window>`u`||`Deno`in globalThis;function M(){}function oe(e,t){return typeof e==`function`?e(t):e}function se(e){return typeof e==`number`&&e>=0&&e!==1/0}function ce(e,t){return Math.max(e+(t||0)-Date.now(),0)}function le(e,t){return typeof e==`function`?e(t):e}function ue(e,t){return typeof e==`function`?e(t):e}function de(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==pe(o,t.options))return!1}else if(!he(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 fe(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(me(t.options.mutationKey)!==me(a))return!1}else if(!he(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function pe(e,t){return(t?.queryKeyHashFn||me)(e)}function me(e){return JSON.stringify(e,(e,t)=>be(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function he(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>he(e[n],t[n])):!1}var ge=Object.prototype.hasOwnProperty;function _e(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ye(e)&&ye(t);if(!r&&!(be(e)&&be(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:ge.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=_e(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function ve(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 ye(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function be(e){if(!xe(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!xe(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function xe(e){return Object.prototype.toString.call(e)===`[object Object]`}function Se(e){return new Promise(t=>{A.setTimeout(t,e)})}function Ce(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:_e(e,t)}function we(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Te(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ee=Symbol();function De(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Ee?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Oe(e,t){return typeof e==`function`?e(...t):!!e}function ke(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 Ae=(()=>{let e=()=>j;return{isServer(){return e()},setIsServer(t){e=t}}})();function je(){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 Me=ae;function Ne(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Me,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 Pe=Ne(),Fe=new class extends re{#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 Ie(e){return Math.min(1e3*2**e,3e4)}function Le(e){return(e??`online`)===`online`?Fe.isOnline():!0}var Re=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ze(e){let t=!1,n=0,r,i=je(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Re(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>ie.isFocused()&&(e.networkMode===`always`||Fe.isOnline())&&e.canRun(),u=()=>Le(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??(Ae.isServer()?0:3),o=e.retryDelay??Ie,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),Se(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 Be=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),se(this.gcTime)&&(this.#e=A.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ae.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(A.clearTimeout(this.#e),this.#e=void 0)}};function Ve(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=>{ke(e,()=>t.signal,()=>n=!0)},u=De(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?Te:we;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Ue:He,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:He(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 He(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 Ue(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var We=class extends Be{#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=qe(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=qe(this.options);e.data!==void 0&&(this.setState(Ke(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Ce(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(M).catch(M):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=>ue(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ee||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>le(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:!ce(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=De(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`?Ve(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=ze({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Re&&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 Re){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,...Ge(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Ke(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),Pe.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Ge(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Le(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Ke(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function qe(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 Je=class extends re{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=je(),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),Xe(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ze(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ze(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 ue(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&&!ve(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Qe(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||ue(this.options.enabled,this.#t)!==ue(t.enabled,this.#t)||le(this.options.staleTime,this.#t)!==le(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||ue(this.options.enabled,this.#t)!==ue(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 et(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(M)),t}#g(){this.#b();let e=le(this.options.staleTime,this.#t);if(Ae.isServer()||this.#r.isStale||!se(e))return;let t=ce(this.#r.dataUpdatedAt,e)+1;this.#d=A.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,!(Ae.isServer()||ue(this.options.enabled,this.#t)===!1||!se(this.#p)||this.#p===0)&&(this.#f=A.setInterval(()=>{(this.options.refetchIntervalInBackground||ie.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(A.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(A.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&&Xe(e,t),o=i&&Qe(e,n,t,r);(a||o)&&(l={...l,...Ge(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=Ce(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=Ce(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:$e(e,t),refetch:this.refetch,promise:this.#o,isEnabled:ue(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=je())},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),!ve(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){Pe.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Ye(e,t){return ue(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&ue(t.retryOnMount,e)===!1)}function Xe(e,t){return Ye(e,t)||e.state.data!==void 0&&Ze(e,t,t.refetchOnMount)}function Ze(e,t,n){if(ue(t.enabled,e)!==!1&&le(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&$e(e,t)}return!1}function Qe(e,t,n,r){return(e!==t||ue(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&$e(e,n)}function $e(e,t){return ue(t.enabled,e)!==!1&&e.isStaleByTime(le(t.staleTime,e))}function et(e,t){return!ve(e.getCurrentResult(),t)}var tt=class extends Be{#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||nt(),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=ze({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),Pe.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function nt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var rt=class extends re{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 tt({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=it(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=it(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=it(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=it(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Pe.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=>fe(t,e))}findAll(e={}){return this.getAll().filter(t=>fe(e,t))}notify(e){Pe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Pe.batch(()=>Promise.all(e.map(e=>e.continue().catch(M))))}};function it(e){return e.options.scope?.id}var at=class extends re{#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),ve(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&me(t.mutationKey)!==me(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??nt();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){Pe.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)})})}},ot=class extends re{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??pe(r,t),a=this.get(i);return a||(a=new We({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(){Pe.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=>de(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>de(e,t)):t}notify(e){Pe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Pe.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Pe.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},st=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ot,this.#t=e.mutationCache||new rt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ie.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Fe.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(le(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=oe(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Pe.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;Pe.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Pe.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Pe.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(M).catch(M)}invalidateQueries(e,t={}){return Pe.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=Pe.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(M)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(M)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(le(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(M).catch(M)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(M).catch(M)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Fe.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(me(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{he(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(me(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{he(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||=pe(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===Ee&&(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()}},ct=f.createContext(void 0),lt=e=>{let t=f.useContext(ct);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},ut=({client:e,children:t})=>(f.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,w.jsx)(ct.Provider,{value:e,children:t})),dt=f.createContext(!1),ft=()=>f.useContext(dt);dt.Provider;function pt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var mt=f.createContext(pt()),ht=()=>f.useContext(mt),gt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Oe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},_t=e=>{f.useEffect(()=>{e.clearReset()},[e])},vt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Oe(n,[e.error,r])),yt=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))}},bt=(e,t)=>e.isLoading&&e.isFetching&&!t,xt=(e,t)=>e?.suspense&&t.isPending,St=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ct(e,t,n){let r=ft(),i=ht(),a=lt(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,yt(o),gt(o,i,s),_t(i);let c=!a.getQueryCache().get(o.queryHash),[l]=f.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(f.useSyncExternalStore(f.useCallback(e=>{let t=d?l.subscribe(Pe.batchCalls(e)):M;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),f.useEffect(()=>{l.setOptions(o)},[o,l]),xt(o,u))throw St(o,l,i);if(vt({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&&!Ae.isServer()&&bt(u,r)&&(c?St(o,l,i):s?.promise)?.catch(M).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function N(e,t){return Ct(e,Je,t)}function wt(e,t){let n=lt(t),[r]=f.useState(()=>new at(n,e));f.useEffect(()=>{r.setOptions(e)},[r,e]);let i=f.useSyncExternalStore(f.useCallback(e=>r.subscribe(Pe.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=f.useCallback((e,t)=>{r.mutate(e,t).catch(M)},[r]);if(i.error&&Oe(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Tt=new st({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}}),Et=(0,f.createContext)({label:null,path:null,status:null,apiBase:``,isDaemonMode:!1});function Dt(){return(0,f.useContext)(Et)}function Ot(){let{apiBase:e,label:t}=Dt();return{url:(0,f.useCallback)(t=>ne(e,t),[e]),queryKey:(0,f.useCallback)(e=>t?[`repo`,t,...e]:[...e],[t])}}var kt=[`live-feed`],At=[`session-snapshot`];function jt(e){try{return JSON.parse(e)}catch{return e}}function Mt(e,t){let n=!1,r=null,i=1e3,a=null,o=(t,n)=>{let r={t:Date.now(),type:t,data:n};e.setQueryData(kt,(e=[])=>[...e,r].slice(-100))},s=()=>{e.invalidateQueries({queryKey:[`intelligence`]})},c=()=>{e.invalidateQueries({queryKey:[`session`]})},l=e=>t=>{o(e,jt(t.data)),e===`drift`&&s(),e===`intent`&&c(),(e===`violation`||e===`circuit_breaker`)&&c()},u=t=>{let n=jt(t.data);e.setQueryData(At,n),e.invalidateQueries({queryKey:[`session`]})},d=()=>{},f=()=>{a!==null&&(clearTimeout(a),a=null)},p=()=>{f(),!n&&(a=setTimeout(()=>{i=Math.min(i*2,3e4),m()},i))};function m(){if(!n){r?.close();try{r=new EventSource(`/api/stream`)}catch{t(!1),p();return}r.onopen=()=>{i=1e3,t(!0)},r.onerror=()=>{t(!1),r?.close(),r=null,p()};for(let e of[`tool_call`,`drift`,`violation`,`circuit_breaker`,`intent`])r.addEventListener(e,l(e));r.addEventListener(`session_stats`,u),r.addEventListener(`ping`,d)}}return m(),()=>{n=!0,f(),r?.close(),r=null,t(!1)}}var Nt={running:`bg-success shadow-[0_0_6px_rgba(52,211,153,0.6)]`,stopped:`bg-muted-foreground/40`,starting:`bg-warning animate-pulse`,error:`bg-error`};function Pt(e){return e===null?`—`:e<60?`${e}s`:e<3600?`${Math.round(e/60)}m`:`${Math.round(e/3600)}h`}function Ft(){let{data:e}=N({queryKey:[`daemon`,`repos`],queryFn:()=>O(`/api/repos`),refetchInterval:5e3}),{data:t}=N({queryKey:[`daemon`,`aggregate`],queryFn:()=>O(`/api/repos/aggregate`),refetchInterval:1e4}),n=e?.repos??[],r=t?.summary;return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[r&&(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,w.jsx)(It,{label:`Repositories`,value:r.totalRepos,sub:`${r.runningRepos} running`}),(0,w.jsx)(It,{label:`Total Entities`,value:r.totalEntities.toLocaleString(),sub:`${r.totalEdges.toLocaleString()} edges`}),(0,w.jsx)(It,{label:`Memory`,value:`${r.totalMemoryMb} MB`,sub:`across ${r.runningRepos} processes`}),(0,w.jsx)(It,{label:`Connections`,value:r.totalConnections,sub:r.totalNeedsInput>0?`${r.totalNeedsInput} need input`:`all healthy`})]}),t?.tokenFlow&&t.tokenFlow.total>0&&(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3`,children:[(0,w.jsx)(It,{label:`Tokens Saved`,value:t.tokenFlow.saved.toLocaleString(),sub:`across all repos`,accent:!0}),(0,w.jsx)(It,{label:`Tool Calls`,value:t.tokenFlow.total.toLocaleString(),sub:`resolved locally`}),(0,w.jsx)(It,{label:`Violations`,value:t.tokenFlow.violations,sub:`caught`})]}),(0,w.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3`,children:[n.map(e=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>y(`overview`,e.label),className:`el-raised flex flex-col gap-3 rounded-lg p-4 text-left transition-all hover:ring-2 hover:ring-brand/30`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`inline-flex h-2.5 w-2.5 shrink-0 rounded-full ${Nt[e.status]??Nt.stopped}`,title:e.status}),(0,w.jsx)(`span`,{className:`text-sm font-semibold text-foreground-emphasis truncate`,children:e.label})]}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs font-mono truncate`,children:e.path}),(0,w.jsxs)(`div`,{className:`flex items-center gap-4 text-xs t-tertiary`,children:[e.status===`running`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{children:[e.memory??0,` MB`]}),(0,w.jsxs)(`span`,{children:[e.entityCount?.toLocaleString()??0,` entities`]}),(0,w.jsxs)(`span`,{children:[`idle `,Pt(e.idle)]}),(0,w.jsxs)(`span`,{children:[e.connections,` conn`]})]}),e.status===`stopped`&&(0,w.jsx)(`span`,{className:`italic`,children:`Stopped`}),e.status===`starting`&&(0,w.jsx)(`span`,{className:`animate-pulse`,children:`Starting…`}),e.status===`error`&&(0,w.jsx)(`span`,{className:`text-error`,children:`Error`})]}),e.needsInput.length>0&&(0,w.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-warning`,children:[(0,w.jsx)(`span`,{children:`⚠`}),(0,w.jsxs)(`span`,{children:[e.needsInput.length,` need`,e.needsInput.length===1?`s`:``,` input`]})]})]},e.path)),n.length===0&&(0,w.jsxs)(`div`,{className:`col-span-full text-center py-12 t-tertiary`,children:[(0,w.jsx)(`p`,{className:`text-lg font-medium`,children:`No repos registered`}),(0,w.jsxs)(`p`,{className:`mt-2 text-sm`,children:[`Run`,` `,(0,w.jsx)(`code`,{className:`font-mono text-foreground`,children:`unerr pm add .`}),` `,`from a project directory.`]})]})]})]})}function It({label:e,value:t,sub:n,accent:r}){return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-xs uppercase tracking-wider`,children:e}),(0,w.jsx)(`p`,{className:`mt-1 text-2xl font-bold ${r?`text-brand`:`text-foreground-emphasis`}`,children:t}),n&&(0,w.jsx)(`p`,{className:`t-tertiary mt-1 text-xs`,children:n})]})}var Lt={started:`#34D399`,skipped:`#FBBF24`,failed:`#F87171`,aborted:`#F87171`},Rt={started:`✓`,skipped:`○`,failed:`✗`,aborted:`⚠`};function zt(){let{data:e,isLoading:t}=N({queryKey:[`pm`,`warm-start`],queryFn:()=>O(`/api/pm/warm-start`),refetchInterval:3e4});if(t)return(0,w.jsx)(`div`,{style:{padding:16,color:`#94a3b8`},children:`Loading warm-start info…`});if(!e||!e.events||e.events.length===0)return(0,w.jsxs)(`div`,{style:{padding:20,background:`#0f172a`,borderRadius:12,border:`1px solid #1e293b`},children:[(0,w.jsx)(`h3`,{style:{margin:`0 0 8px`,color:`#e2e8f0`,fontSize:14},children:`Warm-Start`}),(0,w.jsx)(`p`,{style:{color:`#64748b`,margin:0,fontSize:13},children:`No warm-start events yet. Repos will be pre-warmed after daemon boot.`}),e?.config&&(0,w.jsxs)(`div`,{style:{marginTop:12,fontSize:12,color:`#475569`},children:[`Budget: `,e.config.warmStartBudget,` · Idle cutoff:`,` `,e.config.warmStartIdleDays,`d · Delay:`,` `,e.config.warmStartDelayMs,`ms`]})]});let n=e.events.filter(e=>e.status===`started`),r=e.events.filter(e=>e.status===`skipped`);e.events.filter(e=>e.status===`failed`||e.status===`aborted`);let i=e.events.filter(e=>e.status===`started`).reduce((e,t)=>e+t.ms,0);return(0,w.jsxs)(`div`,{style:{padding:20,background:`#0f172a`,borderRadius:12,border:`1px solid #1e293b`},children:[(0,w.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:16},children:[(0,w.jsxs)(`h3`,{style:{margin:0,color:`#e2e8f0`,fontSize:14},children:[`Warm-Start`,` `,e.lastRun&&(0,w.jsxs)(`span`,{style:{color:`#64748b`,fontWeight:400},children:[`· `,e.lastRun]})]}),(0,w.jsxs)(`div`,{style:{fontSize:12,color:`#64748b`},children:[n.length,` warmed · `,r.length,` skipped · `,i,`ms total`]})]}),(0,w.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:6},children:e.events.map((e,t)=>(0,w.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,padding:`6px 10px`,background:`#1e293b`,borderRadius:6,fontSize:13},children:[(0,w.jsx)(`span`,{style:{color:Lt[e.status]||`#64748b`},children:Rt[e.status]||`·`}),(0,w.jsx)(`span`,{style:{color:`#e2e8f0`,flex:1},children:e.label}),e.ms>0&&(0,w.jsxs)(`span`,{style:{color:`#64748b`,fontSize:11},children:[e.ms,`ms`]}),e.reason&&(0,w.jsx)(`span`,{style:{color:`#94a3b8`,fontSize:11},children:e.reason})]},`${e.repo}-${t}`))}),e.config&&(0,w.jsxs)(`div`,{style:{marginTop:12,paddingTop:12,borderTop:`1px solid #1e293b`,fontSize:12,color:`#475569`},children:[`Budget: `,e.config.warmStartBudget,` · Idle cutoff:`,` `,e.config.warmStartIdleDays,`d · Delay:`,` `,e.config.warmStartDelayMs,`ms`]})]})}function Bt(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}h ${n}m`:n>0?`${n}m ${r}s`:`${r}s`}function Vt(){let{data:e}=N({queryKey:[`pm`,`info`],queryFn:()=>O(`/api/pm`),refetchInterval:1e4}),{data:t}=N({queryKey:[`pm`,`repos`],queryFn:()=>O(`/api/repos`),refetchInterval:5e3}),n=t?.repos??[];return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[e&&(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-6`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-foreground-emphasis mb-4`,children:`Process Manager`}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4 text-sm`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-xs uppercase`,children:`PID`}),(0,w.jsx)(`p`,{className:`font-mono text-foreground-emphasis`,children:e.pid})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-xs uppercase`,children:`Uptime`}),(0,w.jsx)(`p`,{className:`font-mono text-foreground-emphasis`,children:Bt(e.uptime)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-xs uppercase`,children:`Version`}),(0,w.jsx)(`p`,{className:`font-mono text-foreground-emphasis`,children:e.version})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-xs uppercase`,children:`Dashboard Port`}),(0,w.jsx)(`p`,{className:`font-mono text-foreground-emphasis`,children:e.port})]})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-6`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-foreground-emphasis mb-4`,children:`Managed Processes`}),n.length===0?(0,w.jsxs)(`p`,{className:`t-tertiary text-sm`,children:[`No repos registered. Run`,` `,(0,w.jsx)(`code`,{className:`font-mono`,children:`unerr pm add .`}),` from a project.`]}):(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle text-left t-tertiary text-xs uppercase tracking-wider`,children:[(0,w.jsx)(`th`,{className:`pb-2 pr-4`,children:`Repo`}),(0,w.jsx)(`th`,{className:`pb-2 pr-4`,children:`Status`}),(0,w.jsx)(`th`,{className:`pb-2 pr-4`,children:`PID`}),(0,w.jsx)(`th`,{className:`pb-2 pr-4`,children:`Memory`}),(0,w.jsx)(`th`,{className:`pb-2 pr-4`,children:`Connections`}),(0,w.jsx)(`th`,{className:`pb-2`,children:`Last Activity`})]})}),(0,w.jsx)(`tbody`,{children:n.map(e=>(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle/50 last:border-0`,children:[(0,w.jsxs)(`td`,{className:`py-3 pr-4`,children:[(0,w.jsx)(`div`,{className:`font-medium text-foreground-emphasis`,children:e.label}),(0,w.jsx)(`div`,{className:`font-mono text-xs t-tertiary truncate max-w-xs`,children:e.path})]}),(0,w.jsx)(`td`,{className:`py-3 pr-4`,children:(0,w.jsx)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium ${e.status===`running`?`bg-success/10 text-success`:e.status===`error`?`bg-error/10 text-error`:`bg-muted-foreground/10 text-muted-foreground`}`,children:e.status})}),(0,w.jsx)(`td`,{className:`py-3 pr-4 font-mono`,children:e.pid??`—`}),(0,w.jsx)(`td`,{className:`py-3 pr-4 font-mono`,children:e.memory?`${e.memory} MB`:`—`}),(0,w.jsx)(`td`,{className:`py-3 pr-4 font-mono`,children:e.connections}),(0,w.jsx)(`td`,{className:`py-3 text-xs t-tertiary`,children:e.lastActivity?new Date(e.lastActivity).toLocaleTimeString():`—`})]},e.path))})]})})]}),(0,w.jsx)(zt,{})]})}function Ht({className:e=``}){return(0,w.jsx)(`div`,{className:`animate-pulse rounded-md bg-surface-overlay ${e}`,"aria-hidden":`true`})}var Ut=[`c0`,`c1`,`c2`,`c3`];function Wt({n:e=4}){return(0,w.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:Ut.slice(0,Math.min(e,Ut.length)).map(e=>(0,w.jsxs)(`div`,{className:`glass-card rounded-xl p-4`,children:[(0,w.jsx)(Ht,{className:`h-3 w-20`}),(0,w.jsx)(Ht,{className:`mt-3 h-8 w-14`})]},e))})}var Gt=[`h0`,`h1`,`h2`,`h3`,`h4`,`h5`],Kt=[`t0`,`t1`,`t2`,`t3`,`t4`,`t5`,`t6`,`t7`];function qt({cols:e=5,rows:t=6}){let n=Gt.slice(0,Math.min(e,Gt.length)),r=Kt.slice(0,Math.min(t,Kt.length));return(0,w.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,w.jsx)(`div`,{className:`mb-3 flex gap-2 border-b border-border-subtle pb-2`,children:n.map(e=>(0,w.jsx)(Ht,{className:`h-3 flex-1`},e))}),r.map(e=>(0,w.jsx)(`div`,{className:`mb-2 flex gap-2`,children:n.map(t=>(0,w.jsx)(Ht,{className:`h-4 flex-1`},`${e}-${t}`))},e))]})}function Jt(e){if(e==null||!Number.isFinite(e))return`—`;let t=e<0?`-`:``,n=Math.abs(e);if(n<1e3)return`${t}${Math.round(n).toLocaleString()}`;let r=[`K`,`M`,`B`,`T`],i=-1;do n/=1e3,i++;while(n>=999.95&&i<r.length-1);return`${t}${n.toFixed(1).replace(/\.0$/,``)}${r[i]}`}function Yt(e){let t=Date.now()-new Date(e).getTime(),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<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Xt(e){return e.replace(/_/g,` `).replace(/^\w/,e=>e.toUpperCase())}var Zt={shell_compression:{bar:`bg-cyan-500`,text:`text-cyan-400`},format_encoding:{bar:`bg-amber-500`,text:`text-amber-400`},session_dedup:{bar:`bg-emerald-500`,text:`text-emerald-400`},smart_truncation:{bar:`bg-blue-500`,text:`text-blue-400`},file_read:{bar:`bg-indigo-500`,text:`text-indigo-400`},fetch_url:{bar:`bg-teal-500`,text:`text-teal-400`},graph_query:{bar:`bg-violet-500`,text:`text-violet-400`},persistent_memory:{bar:`bg-fuchsia-500`,text:`text-fuchsia-400`}},Qt={graph_query_served:{bar:`bg-violet-500`,text:`text-violet-400`},full_read_avoided:{bar:`bg-indigo-500`,text:`text-indigo-400`},loop_broken:{bar:`bg-rose-500`,text:`text-rose-400`},cascade_guard:{bar:`bg-amber-500`,text:`text-amber-400`},boundary_violation_flagged:{bar:`bg-orange-500`,text:`text-orange-400`},incomplete_work_flagged:{bar:`bg-rose-500`,text:`text-rose-400`},drift_consumed:{bar:`bg-cyan-500`,text:`text-cyan-400`},intervention_halted:{bar:`bg-rose-500`,text:`text-rose-400`},intervention_warned:{bar:`bg-amber-500`,text:`text-amber-400`},defuddle_selector_skipped:{bar:`bg-teal-500`,text:`text-teal-400`}},$t={fact_recalled:{bar:`bg-fuchsia-500`,text:`text-fuchsia-400`},fact_stored_user_fed:{bar:`bg-emerald-500`,text:`text-emerald-400`},fact_stored_auto:{bar:`bg-teal-500`,text:`text-teal-400`},caller_check_enforced:{bar:`bg-sky-500`,text:`text-sky-400`},stale_edit_prevented:{bar:`bg-cyan-500`,text:`text-cyan-400`},cascade_warning_consumed:{bar:`bg-amber-500`,text:`text-amber-400`},convention_applied:{bar:`bg-blue-500`,text:`text-blue-400`},cross_session_resume:{bar:`bg-violet-500`,text:`text-violet-400`},resume_blockers_surfaced:{bar:`bg-rose-500`,text:`text-rose-400`},cache_hit:{bar:`bg-lime-500`,text:`text-lime-400`}};function en(e){return Qt[e]??$t[e]??Zt[e]??{bar:`bg-violet-500`,text:`text-violet-400`}}function tn({text:e,label:t}){let[n,r]=(0,f.useState)(!1),i=(0,f.useId)();return(0,w.jsxs)(`span`,{className:`relative inline-flex align-middle`,children:[(0,w.jsx)(`button`,{type:`button`,"aria-label":t??`More information`,"aria-describedby":n?i:void 0,className:`inline-flex h-4 w-4 items-center justify-center rounded-full border border-border-subtle font-mono text-[9px] font-bold leading-none t-tertiary transition-colors hover:border-violet-400 hover:text-violet-300 focus-visible:text-violet-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-violet-400`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),onKeyDown:e=>{e.key===`Escape`&&r(!1)},children:`i`}),n?(0,w.jsx)(`span`,{role:`tooltip`,id:i,className:`absolute left-1/2 top-full z-30 mt-2 w-64 -translate-x-1/2 rounded-lg border border-border-subtle bg-background px-3 py-2 text-left text-[11px] font-normal normal-case leading-snug tracking-normal t-secondary shadow-xl`,children:e}):null]})}function nn(e,t=900){let[n,r]=(0,f.useState)(e),i=(0,f.useRef)(!1);return(0,f.useEffect)(()=>{if(i.current||e<=0){r(e);return}if(typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches){r(e);return}i.current=!0;let n=0,a=performance.now(),o=i=>{let s=Math.min(1,(i-a)/t);r(e*(1-(1-s)**3)),s<1?n=requestAnimationFrame(o):r(e)};return n=requestAnimationFrame(o),()=>cancelAnimationFrame(n)},[e,t]),n}function rn({value:e,format:t,prefix:n}){let r=nn(e);return(0,w.jsxs)(w.Fragment,{children:[n,t(Math.round(r))]})}var an=new Set([`user_prompt_received`,`surface2_emitted`,`surface2_missed`,`surface4a_emitted`,`presence_ambient_marker`,`fact_capture_abandoned`,`confirmation_expired`]),on={graph_query_served:{label:`unnecessary file reads prevented`,desc:`The agent found the answer in one graph query instead of reading 5-15 files with grep. Each lookup saved multiple turns of trial-and-error.`},full_read_avoided:{label:`large file dumps prevented`,desc:`Only the relevant lines were sent instead of the entire file. Without unerr: the agent loads thousands of lines when it only needed a few.`},fact_recalled:{label:`re-explanations prevented`,desc:`unerr remembered notes from your earlier sessions and surfaced them at the right moment, so the agent didn't ask you to repeat yourself.`},loop_broken:{label:`retry loops stopped`,desc:`The agent was stuck in a loop, retrying the same failing operation. unerr detected the pattern and broke the cycle before more turns were wasted.`},cascade_guard:{label:`breaking changes caught`,desc:`The agent was about to edit code that many other files depend on. unerr flagged the risk so the change didn't silently break downstream code.`},boundary_violation_flagged:{label:`architecture breaches caught`,desc:`The agent was about to import across an architecture boundary that must stay isolated. unerr flagged the crossing so the layering didn't silently erode.`},incomplete_work_flagged:{label:`unfinished refactors flagged`,desc:`A signature changed this session but some of its callers were never updated. unerr flagged them at session end so they don't surface as runtime or compile breaks later.`},drift_consumed:{label:`stale file edits prevented`,desc:`The file had changed since the agent last read it. unerr caught this so the agent didn't overwrite newer changes with an outdated version.`},intervention_halted:{label:`dangerous operations blocked`,desc:`A risky tool call was stopped before it could run. Without unerr: the operation would have executed unchecked and potentially corrupted state.`},intervention_warned:{label:`risky patterns flagged early`,desc:`unerr spotted a risky pattern and warned the agent before it committed. Without the warning: the agent would have proceeded blindly.`},defuddle_selector_skipped:{label:`web page noise filtered out`,desc:`Navigation menus, footers, and ads were stripped from fetched web pages so only the actual content reached the agent.`},fact_stored_user_fed:{label:`rules saved for future sessions`,desc:`Rules you told the agent were saved permanently. Next session, the agent will already know these without you having to repeat them.`},fact_stored_auto:{label:`code patterns learned`,desc:`unerr noticed a convention in your codebase and stored it. Future edits will follow this pattern automatically.`},caller_check_enforced:{label:`blind edits prevented`,desc:`unerr checked who calls this code before allowing the edit. Without it: changes would land without knowing what else they break.`},stale_edit_prevented:{label:`overwrites of new changes stopped`,desc:`The agent tried to edit a file that was modified after it was last read. unerr stopped the edit to prevent overwriting your recent work.`},cascade_warning_consumed:{label:`downstream breaks prevented`,desc:`Code that depends on the edited file was identified and the agent was warned before making changes that would ripple through.`},convention_applied:{label:`style violations prevented`,desc:`Project conventions (naming, imports, structure) were applied automatically, so new code matched your existing style from the start.`},cross_session_resume:{label:`cold-start sessions prevented`,desc:`Context from your last session was restored, so the agent picked up where it left off instead of starting from scratch.`},resume_blockers_surfaced:{label:`forgotten blockers resurfaced`,desc:`Unresolved problems from a previous session were brought forward so they didn't fall through the cracks.`},cache_hit:{label:`redundant computations skipped`,desc:`A previously computed answer was served from cache instead of being recomputed, saving time and tokens.`}};function sn(e){return on[e]??{label:`${Xt(e).toLowerCase()} handled`,desc:`An issue unerr caught and handled so the agent didn't have to retry or undo it.`}}function cn({count:e,label:t,desc:n,palette:r}){let[i,a]=(0,f.useState)(!1);return(0,w.jsxs)(`div`,{className:`el-raised relative cursor-default overflow-visible rounded-lg p-3.5 pl-4`,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onFocus:()=>a(!0),onBlur:()=>a(!1),children:[(0,w.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-y-0 left-0 w-1 rounded-l-lg ${r.bar} opacity-80`}),(0,w.jsxs)(`button`,{type:`button`,"aria-expanded":i,className:`block w-full text-left focus-visible:outline-none`,children:[(0,w.jsx)(`span`,{className:`font-mono text-2xl font-bold leading-none tabular-nums ${r.text}`,children:e}),(0,w.jsx)(`span`,{className:`mt-1 block text-[11px] leading-snug text-foreground-emphasis`,children:t})]}),i?(0,w.jsx)(`span`,{role:`tooltip`,className:`absolute inset-x-0 top-full z-30 mt-1 rounded-lg border border-border-subtle bg-background px-3 py-2 text-left text-[11px] leading-snug t-secondary shadow-xl`,children:n}):null]})}function ln({title:e,blurb:t,onMore:n,moreLabel:r}){return(0,w.jsxs)(`header`,{className:`mb-4 flex items-baseline justify-between gap-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:e}),(0,w.jsx)(`p`,{className:`mt-0.5 t-tertiary text-[11px] leading-snug`,children:t})]}),n?(0,w.jsx)(`button`,{type:`button`,onClick:n,className:`shrink-0 text-xs text-violet-400 transition-colors hover:text-violet-300`,children:r??`Details →`}):null]})}function un({value:e,label:t,hint:n,accent:r=`text-emerald-400`}){let i=nn(e==null?0:Math.max(0,Math.min(100,e))),a=2*Math.PI*32,o=a*(1-i/100);return(0,w.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,w.jsxs)(`div`,{className:`relative h-[76px] w-[76px] shrink-0`,children:[(0,w.jsxs)(`svg`,{viewBox:`0 0 80 80`,className:`h-[76px] w-[76px] -rotate-90`,"aria-hidden":`true`,children:[(0,w.jsx)(`circle`,{cx:`40`,cy:`40`,r:32,fill:`none`,strokeWidth:`7`,stroke:`currentColor`,className:`text-border-subtle`,opacity:.45}),(0,w.jsx)(`circle`,{cx:`40`,cy:`40`,r:32,fill:`none`,strokeWidth:`7`,strokeLinecap:`round`,stroke:`currentColor`,className:r,strokeDasharray:a,strokeDashoffset:o})]}),(0,w.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center font-mono text-lg font-bold tabular-nums ${r}`,children:e==null?`—`:`${Math.round(i)}%`})]}),(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`span`,{className:`block text-sm font-semibold text-foreground-emphasis`,children:t}),n?(0,w.jsx)(`span`,{className:`mt-0.5 block t-tertiary text-[11px] leading-snug`,children:n}):null]})]})}function dn({value:e,label:t,hint:n,accent:r=`text-violet-300`,chip:i=`bg-violet-500/10 ring-violet-500/25`}){return(0,w.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,w.jsx)(`div`,{className:`flex h-[76px] w-[76px] shrink-0 items-center justify-center rounded-2xl ring-1 ${i}`,children:(0,w.jsx)(`span`,{className:`font-mono text-3xl font-bold leading-none tabular-nums ${r}`,children:e})}),(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`span`,{className:`block text-sm font-semibold text-foreground-emphasis`,children:t}),n?(0,w.jsx)(`span`,{className:`mt-0.5 block t-tertiary text-[11px] leading-snug`,children:n}):null]})]})}function fn({label:e,value:t,hint:n,accent:r=`text-foreground`}){return(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 py-2`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`span`,{className:`block text-sm text-foreground`,children:e}),n?(0,w.jsx)(`span`,{className:`block t-tertiary text-[11px] leading-snug`,children:n}):null]}),(0,w.jsx)(`span`,{className:`shrink-0 font-mono text-lg font-semibold tabular-nums ${r}`,children:t})]})}function pn({title:e,blurb:t,onMore:n,lead:r,support:i,footer:a}){return(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsx)(ln,{title:e,blurb:t,onMore:n}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-5 sm:flex-row sm:items-center sm:gap-7`,children:[(0,w.jsx)(`div`,{className:`sm:w-[15.5rem] sm:shrink-0`,children:r}),(0,w.jsx)(`div`,{className:`flex-1 sm:border-l sm:border-border-subtle sm:pl-7`,children:(0,w.jsx)(`div`,{className:`divide-y divide-border-subtle/60`,children:i.map(e=>(0,w.jsx)(fn,{label:e.label,value:e.value,hint:e.hint,accent:e.accent},e.label))})})]}),a]})}function mn(){let{url:e,queryKey:t}=Ot(),n=N({queryKey:t([`token-flow`,`global`]),queryFn:()=>O(e(`/api/token-flow/global`))}),r=N({queryKey:t([`token-flow`,`headroom`]),queryFn:()=>O(e(`/api/token-flow/headroom`)),refetchInterval:3e4}),i=N({queryKey:t([`token-flow`,`sessions-recent`]),queryFn:()=>O(e(`/api/token-flow/sessions?limit=8&offset=0`))}),a=N({queryKey:t([`behavior-events`,`global`]),queryFn:()=>O(e(`/api/behavior-events/global`)),refetchInterval:1e4}),o=N({queryKey:t([`logbook`,`compliance`,`dashboard`]),queryFn:()=>O(e(`/api/logbook/compliance`)),refetchInterval:3e4}),s=N({queryKey:t([`reasoning-quality`,`global`,`dashboard`]),queryFn:()=>O(e(`/api/reasoning-quality/global`)),refetchInterval:3e4}),c=N({queryKey:t([`facts`,`health`,`dashboard`]),queryFn:()=>O(e(`/api/facts/health`)),refetchInterval:3e4}),l=N({queryKey:t([`timeline`,`intents`,`dashboard`]),queryFn:()=>O(e(`/api/timeline/intents?limit=10`)),refetchInterval:3e4}),u=N({queryKey:t([`timeline`,`resume`,`dashboard`]),queryFn:()=>O(e(`/api/timeline/resume`)),refetchInterval:3e4}),d=N({queryKey:t([`timeline`,`turns`,`count`,`dashboard`]),queryFn:()=>O(e(`/api/timeline/turns?limit=1`)),refetchInterval:3e4}),f=N({queryKey:t([`intelligence`,`insights`,`dashboard`]),queryFn:()=>O(e(`/api/intelligence/insights`))}),p=N({queryKey:t([`intelligence`,`graph-stats`,`dashboard`]),queryFn:()=>O(e(`/api/intelligence/graph-stats`))}),m=n.data?.data,h=i.data?.data??[],g=r.data?.data,_=r.isLoading&&g===void 0,v=o.data?.data?.runtime_joins,b=[];if(v){let e=v.memory_to_graph,t=v.graph_to_drift,n=v.three_way;e>0&&b.push(`${e} stored ${e===1?`note`:`notes`} used to protect ${e===1?`a code change`:`code changes`}`),t>0&&b.push(`${t} file ${t===1?`change`:`changes`} caught by checking code structure`),n>0&&b.push(`${n} ${n===1?`issue`:`issues`} caught by combining all three layers`)}let x=e=>e==null?`—`:`${Math.round(e)}%`,S=s.data?.data,C=c.data,T=(l.data?.data??[]).filter(e=>e.status===`active`),E=u.data?.data?.open_threads??[],ee=d.data?.total??0,te=f.data?.data,D=p.data?.data,ne=C?.by_type??{},re=(ne.negative??0)+(ne.episodic??0),ie=e=>{if(!e)return`text-foreground`;let t=e[0]?.toUpperCase();return t===`A`||t===`B`?`text-success`:t===`C`||t===`D`?`text-warning`:`text-error`},k=e=>{if(!e)return`bg-violet-500/10 ring-violet-500/25`;let t=e[0]?.toUpperCase();return t===`A`||t===`B`?`bg-emerald-500/10 ring-emerald-500/30`:t===`C`||t===`D`?`bg-amber-500/10 ring-amber-500/30`:`bg-rose-500/10 ring-rose-500/30`},A=m&&m.total_tokens_saved>0?(m.total_context_avoided/m.total_tokens_saved).toFixed(1):null,ae=a.data?.data.counts.by_type??{},j=Object.entries(ae).filter(([e,t])=>t>0&&!an.has(e)).sort(([,e],[,t])=>t-e),M=j.reduce((e,[,t])=>e+t,0),oe=j.slice(0,8),se=!!g&&[g.today,g.this_week,g.since_install].some(e=>e.turns_observed>0&&e.headroom_turns>e.turns_observed*2);return(0,w.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-6`,children:[(0,w.jsxs)(`section`,{className:`glass-panel overflow-hidden rounded-xl p-6`,children:[(0,w.jsxs)(`header`,{className:`mb-5 flex items-baseline justify-between gap-4`,children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:`Impact`}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider t-tertiary`,children:`Since install`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(`token-trace`),className:`shrink-0 text-xs text-violet-400 transition-colors hover:text-violet-300`,children:`Breakdown →`})]})]}),_&&!m?(0,w.jsx)(Wt,{n:3}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-7 sm:flex-row sm:items-end sm:gap-12`,children:[(0,w.jsx)(`div`,{className:`min-w-0`,children:g&&!se?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`block font-mono text-6xl font-bold leading-none tracking-tight text-success tabular-nums`,children:(0,w.jsx)(rn,{value:g.since_install.headroom_turns,format:e=>`+${Jt(e)}`})}),(0,w.jsxs)(`span`,{className:`mt-2 flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wider t-tertiary`,children:[`turns earned`,(0,w.jsx)(tn,{label:`What turns earned means`,text:`Extra turns of session headroom unerr earned you — the unit compression-only tools can't measure. Counts as extra prompts within your request quota (credit-billed agents) or extra context room before a window exhausts (window-billed agents).`})]})]}):se?(0,w.jsxs)(`div`,{className:`max-w-sm`,children:[(0,w.jsx)(`span`,{className:`block font-mono text-4xl font-bold leading-none text-warning tabular-nums`,children:`calibrating`}),(0,w.jsx)(`p`,{className:`mt-2 t-tertiary text-[11px] leading-snug`,children:`Turns earned needs a few more sessions to stabilise — the exact counts below are honest in the meantime.`})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`block font-mono text-6xl font-bold leading-none text-muted-foreground tabular-nums`,children:`—`}),(0,w.jsx)(`span`,{className:`mt-2 block text-[11px] font-medium uppercase tracking-wider t-tertiary`,children:`no turns earned yet`})]})}),m?(0,w.jsxs)(`div`,{className:`flex gap-9 sm:gap-12 sm:pb-1`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`block font-mono text-3xl font-bold leading-none text-foreground-emphasis tabular-nums`,children:(0,w.jsx)(rn,{value:m.total_tokens_saved,format:Jt})}),(0,w.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wider t-tertiary`,children:[`tokens saved`,(0,w.jsx)(tn,{label:`What tokens saved means`,text:`Raw bytes unerr kept out of the agent's context — counted on operations it handled (file reads, web fetches, shell output, dedup). Not whole-turn savings.`})]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`block font-mono text-3xl font-bold leading-none text-cyan-400 tabular-nums`,children:(0,w.jsx)(rn,{value:m.total_context_avoided,format:Jt})}),(0,w.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wider t-tertiary`,children:[`context avoided`,(0,w.jsx)(tn,{label:`What context avoided means`,text:`Downstream work unerr kept the agent from ever doing — re-reads, re-searches and retries it never had to issue.`})]})]})]}):null,m&&g&&!se?(0,w.jsx)(`div`,{className:`min-w-0 sm:flex-1 sm:self-stretch sm:border-l sm:border-border-subtle sm:pl-10`,children:(0,w.jsxs)(`div`,{className:`flex h-full flex-col justify-center`,children:[(0,w.jsxs)(`span`,{className:`mb-4 flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-wider t-tertiary`,children:[`Where your savings come from`,(0,w.jsx)(tn,{label:`Where your savings come from`,text:`Token tools compress text. unerr also understands your code — a persistent graph of the repo means it knows what to read and what to skip. Compression is the commodity; code-intelligence is unerr-only. Turns are estimated from each tier's share of tokens saved.`})]}),(()=>{let e=m.total_tokens_saved||1,t=g.since_install.headroom_turns/e,n=(m.by_mechanism.graph_query?.tokens_saved??0)+(m.by_mechanism.file_read?.tokens_saved??0),r=Math.max(0,m.total_tokens_saved-n),i=Math.round(n/e*100);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`space-y-4`,children:[{key:`compress`,title:`Text compression`,sub:`what every token tool does`,tokens:r,primary:!1,bar:`bg-zinc-500/70`,tokenAccent:`t-secondary`,barH:`h-1.5`},{key:`intel`,title:`Understanding your code`,sub:`graph + graph-guided reads — only unerr`,tokens:n,primary:!0,bar:`bg-gradient-to-r from-violet-500 to-emerald-400`,tokenAccent:`text-emerald-300`,barH:`h-2.5`}].map(n=>(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`span`,{className:`block text-sm font-semibold ${n.primary?`text-foreground-emphasis`:`text-foreground`}`,children:n.title}),(0,w.jsx)(`span`,{className:`block text-[11px] leading-tight t-tertiary`,children:n.sub})]}),(0,w.jsxs)(`div`,{className:`shrink-0 text-right font-mono tabular-nums`,children:[(0,w.jsxs)(`span`,{className:`block text-sm font-semibold ${n.tokenAccent}`,children:[Jt(n.tokens),` tok`]}),(0,w.jsxs)(`span`,{className:`block text-[11px] t-tertiary`,children:[`~`,Jt(n.tokens*t),` turns`]})]})]}),(0,w.jsx)(`div`,{className:`mt-1.5 overflow-hidden rounded-full bg-surface-overlay ${n.barH}`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full ${n.bar}`,style:{width:`${n.tokens/e*100}%`}})})]},n.key))}),(0,w.jsxs)(`p`,{className:`mt-4 border-t border-border-subtle pt-3 text-[11px] leading-snug t-secondary`,children:[(0,w.jsxs)(`span`,{className:`font-semibold text-emerald-300`,children:[i,`%`]}),` `,`of every token unerr saves comes from`,` `,(0,w.jsx)(`span`,{className:`text-foreground`,children:`understanding your code`}),` `,`— not compressing text.`]})]})})()]})}):null]}),g&&!se||m?(0,w.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-border-subtle pt-4 text-sm t-secondary`,children:[g&&!se?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>y(`token-trace`,{window:`today`}),className:`inline-flex items-baseline gap-1.5 transition-colors hover:text-foreground`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-success`,children:[`▲ +`,Jt(g.today.headroom_turns)]}),`today`]}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`·`}),(0,w.jsxs)(`button`,{type:`button`,onClick:()=>y(`token-trace`,{window:`this_week`}),className:`inline-flex items-baseline gap-1.5 transition-colors hover:text-foreground`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-success`,children:[`▲ +`,Jt(g.this_week.headroom_turns)]}),`this week`]})]}):null,m&&A?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`·`}),(0,w.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fuchsia-400`,children:[A,`×`]}),`context compounding`,(0,w.jsx)(tn,{label:`What compounding means`,text:`Context avoided per token saved — how much downstream work each rescued token prevented.`})]})]}):null]}):null]})]}),(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`header`,{className:`mb-4 flex items-baseline justify-between gap-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:`Mistakes prevented`}),(0,w.jsx)(`p`,{className:`mt-0.5 t-tertiary text-[11px] leading-snug`,children:`Problems unerr caught before they reached your code — hover any card to see what would have gone wrong.`})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-[10px] uppercase tracking-wider t-tertiary`,children:[Jt(M),` caught`]}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(`logbook`),className:`text-xs text-violet-400 transition-colors hover:text-violet-300`,children:`Full log →`})]})]}),b.length>0?(0,w.jsxs)(`div`,{className:`mb-4 rounded-lg border border-violet-500/30 bg-violet-500/5 px-4 py-3`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,w.jsx)(`span`,{"aria-hidden":`true`,className:`text-fuchsia-400`,children:`⚡`}),(0,w.jsx)(`span`,{className:`font-medium text-foreground-emphasis`,children:`Cross-layer protection`}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`—`}),(0,w.jsx)(`span`,{className:`t-secondary`,children:b.join(` · `)})]}),(0,w.jsx)(`p`,{className:`mt-1 text-[11px] leading-snug t-tertiary`,children:`unerr combined what it remembers about your project, the live code structure, and file-change detection to catch issues that no single tool could spot alone.`})]}):null,a.isLoading&&oe.length===0?(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-2.5 sm:grid-cols-3 lg:grid-cols-4`,children:[(0,w.jsx)(Ht,{className:`h-20 w-full`}),(0,w.jsx)(Ht,{className:`h-20 w-full`}),(0,w.jsx)(Ht,{className:`h-20 w-full`}),(0,w.jsx)(Ht,{className:`h-20 w-full`})]}):oe.length===0?(0,w.jsx)(`p`,{className:`t-tertiary text-sm`,children:`Nothing recorded yet — unerr starts tracking as soon as your agent calls a tool.`}):(0,w.jsx)(`div`,{className:`grid grid-cols-2 gap-2.5 sm:grid-cols-3 lg:grid-cols-4`,children:oe.map(([e,t])=>{let n=sn(e);return(0,w.jsx)(cn,{count:Jt(t),label:n.label,desc:n.desc,palette:en(e)},e)})})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2 lg:items-start`,children:[(0,w.jsx)(pn,{title:`Reasoning Quality`,blurb:`How much cleaner and more first-try-correct unerr made the agent's reasoning`,onMore:()=>y(`reasoning`),lead:(0,w.jsx)(un,{value:S?.first_call_resolution_rate,label:`Found first try`,hint:`answered in one lookup — no grep loops`,accent:`text-cyan-400`}),support:[{label:`Cleaner context`,value:x(S?.noise_removed_pct),hint:`noise removed before the agent read it`,accent:`text-emerald-400`},{label:`Fewer breakages`,value:S?.prevention_score??`—`,hint:S?`${Jt(S.blast_radius_warnings)} warns · ${Jt(S.convention_injections)} hints`:`blast-radius + convention guards`,accent:`text-amber-400`},{label:`Quality multiplier`,value:S?`${S.reasoning_quality_multiplier.toFixed(1)}×`:`—`,hint:`overall reasoning lift`,accent:`text-violet-300`}]}),(0,w.jsx)(pn,{title:`Memory · Recalls & Rememberances`,blurb:`What unerr remembered, how often it resurfaced, and whether it was load-bearing`,onMore:()=>y(`facts`),lead:(0,w.jsx)(un,{value:S?.memory_effectiveness_pct,label:`Memory effectiveness`,hint:S?`${Jt(S.memory_signals_fired)} fired · ${Jt(S.memory_verdicts_total)} verdicts`:`share of recalled memories that proved load-bearing`,accent:`text-emerald-400`}),support:[{label:`Memories stored`,value:Jt(C?.total),hint:C?`${Jt(ne.semantic??0)} patterns · ${Jt(ne.procedural??0)} hot files · ${Jt(re)} lessons`:`patterns, hot files, lessons`,accent:`text-violet-300`},{label:`Recalled`,value:Jt(S?.facts_recalled),hint:`stored facts re-surfaced to the agent`,accent:`text-cyan-400`},{label:`Avg confidence`,value:x((C?.avg_confidence??0)*100),hint:`mean confidence across live memories`,accent:`text-fuchsia-300`}]}),(0,w.jsx)(pn,{title:`Activity & Tasks`,blurb:`What's in flight across sessions — open tasks, unresolved blockers, activity volume`,onMore:()=>y(`activity`),lead:(0,w.jsx)(dn,{value:Jt(T.length),label:`Tasks in progress`,hint:`open intents still being worked across sessions`,accent:`text-cyan-400`,chip:`bg-cyan-500/10 ring-cyan-500/25`}),support:[{label:`Unresolved issues`,value:Jt(E.length),hint:`blockers without a resolution yet`,accent:E.length>0?`text-amber-400`:`text-foreground`},{label:`Activity moments`,value:Jt(ee),hint:`turns unerr has observed`,accent:`text-violet-300`}],footer:T.length>0?(0,w.jsx)(`ul`,{className:`mt-4 space-y-1.5 border-t border-border-subtle pt-4`,children:T.slice(0,4).map(e=>(0,w.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,children:[(0,w.jsx)(`span`,{className:`inline-block size-1.5 shrink-0 rounded-full bg-cyan-400`,"aria-hidden":`true`}),(0,w.jsx)(`span`,{className:`truncate text-foreground`,children:e.title}),(0,w.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] t-tertiary`,children:Yt(new Date(e.last_active_at).toISOString())})]},e.intent_id))}):null}),(0,w.jsx)(pn,{title:`Code Health & Risk`,blurb:`The state of the codebase unerr reasons over — grade, test reach, risk`,onMore:()=>y(`graph`),lead:(0,w.jsx)(dn,{value:te?.healthGrade??`—`,label:`Health grade`,hint:te?`architecture score ${te.healthScore}/100`:`A–F architecture grade`,accent:ie(te?.healthGrade),chip:k(te?.healthGrade)}),support:[{label:`Tested reach`,value:x(te?.blastRadiusCoverage),hint:`of blast radius covered by tests`,accent:`text-emerald-400`},{label:`High-risk files`,value:Jt(te?.riskDistribution?.high),hint:D?`${Jt(D.entityCount)} entities · ${Jt(D.communityCount)} modules`:`entities flagged high-risk`,accent:(te?.riskDistribution?.high??0)>0?`text-error`:`text-foreground`},{label:`Chokepoints`,value:Jt(te?.bottlenecks?.length),hint:D?`${Jt(D.driftCount)} files drifted locally`:`high fan-in bottlenecks`,accent:`text-amber-400`}]})]}),(0,w.jsxs)(`section`,{className:`glass-panel overflow-hidden rounded-xl`,children:[(0,w.jsxs)(`header`,{className:`flex items-center justify-between px-5 pt-4 pb-3`,children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:`Recent Sessions`}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-xs t-tertiary`,children:[i.data?._meta.total??`—`,` total`]}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(`token-trace`),className:`text-xs text-violet-400 transition-colors hover:text-violet-300`,children:`All sessions →`})]})]}),i.isLoading?(0,w.jsxs)(`div`,{className:`space-y-2 px-5 pb-4`,children:[(0,w.jsx)(Ht,{className:`h-10 w-full`}),(0,w.jsx)(Ht,{className:`h-10 w-full`}),(0,w.jsx)(Ht,{className:`h-10 w-full`})]}):h.length===0?(0,w.jsx)(`p`,{className:`px-5 pb-5 t-tertiary text-sm`,children:`No sessions recorded yet.`}):(0,w.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-t border-border-subtle bg-surface-overlay/40 text-left`,children:[(0,w.jsx)(`th`,{className:`px-5 py-2 font-medium uppercase tracking-wider t-tertiary text-[10px]`,children:`Agent`}),(0,w.jsx)(`th`,{className:`px-2 py-2 font-medium uppercase tracking-wider t-tertiary text-[10px]`,children:`Session`}),(0,w.jsx)(`th`,{className:`px-2 py-2 font-medium uppercase tracking-wider t-tertiary text-[10px]`,children:`When`}),(0,w.jsx)(`th`,{className:`px-2 py-2 text-right font-medium uppercase tracking-wider t-tertiary text-[10px]`,children:`Turns`}),(0,w.jsx)(`th`,{className:`px-2 py-2 text-right font-medium uppercase tracking-wider t-tertiary text-[10px]`,children:`Events`}),(0,w.jsx)(`th`,{className:`px-5 py-2 text-right font-medium uppercase tracking-wider t-tertiary text-[10px]`,children:`Saved`})]})}),(0,w.jsx)(`tbody`,{className:`divide-y divide-border-subtle`,children:h.map(e=>(0,w.jsxs)(`tr`,{className:`transition-colors hover:bg-surface-overlay/30`,children:[(0,w.jsx)(`td`,{className:`px-5 py-2.5 truncate text-foreground`,children:e.agent_name||`Unknown Agent`}),(0,w.jsx)(`td`,{className:`px-2 py-2.5 font-mono text-[11px] text-violet-300`,children:e.session_id.length>10?`${e.session_id.slice(0,10)}…`:e.session_id}),(0,w.jsx)(`td`,{className:`px-2 py-2.5 t-tertiary text-xs`,children:Yt(e.last_ts)}),(0,w.jsx)(`td`,{className:`px-2 py-2.5 text-right font-mono tabular-nums t-secondary`,children:e.total_turns}),(0,w.jsx)(`td`,{className:`px-2 py-2.5 text-right font-mono tabular-nums t-secondary`,children:e.event_count}),(0,w.jsx)(`td`,{className:`px-5 py-2.5 text-right font-mono text-success tabular-nums`,children:Jt(e.total_saved)})]},e.session_id))})]})]}),n.error&&(0,w.jsx)(`p`,{className:`text-error text-sm`,children:`Some requests failed. Ensure the unerr proxy is running.`})]})}var hn={semantic:{label:`Conventions your code follows`,icon:`◆`,color:`violet`,description:`Patterns unerr detected in your codebase — naming styles, import order, file structure`,emptyMsg:`No conventions detected yet. unerr discovers these as it indexes your project.`},procedural:{label:`Files you work on most`,icon:`⚡`,color:`cyan`,description:`The files your agent keeps coming back to — unerr prioritizes these in context`,emptyMsg:`Not enough data yet. After a few sessions, unerr will spot your most-touched files.`},negative:{label:`Mistakes to avoid`,icon:`✗`,color:`red`,description:`Things that went wrong before — unerr warns your agent so it doesn't repeat them`,emptyMsg:`No past mistakes recorded. That's a good thing.`},episodic:{label:`Change outcomes`,icon:`◎`,color:`amber`,description:`Which changes stuck and which got reverted — so your agent knows what works`,emptyMsg:`No change history tracked yet.`},convention:{label:`Rules you've taught unerr`,icon:`▸`,color:`emerald`,description:`Rules you explicitly told unerr to remember — these override everything else`,emptyMsg:`No rules taught yet. Tell your agent "remember: always use camelCase" and unerr will enforce it.`}};function gn(e){let t=e.content;if(t=t.replace(/^Naming convention:\s*/,``),t=t.replace(/^Structure pattern:\s*/,``),t=t.replace(/^Import convention:\s*/,``),t=t.replace(/^Convention:\s*/,``),t=t.replace(/\s*\(\d+%\s*confidence(?:,\s*\d+\s*entities?)?\)/,``),e.fact_type===`procedural`&&t.includes(`is accessed in`)){let e=t.match(/is accessed in (\d+)% of sessions/);if(e)return`Accessed in ${e[1]}% of your coding sessions`}if(e.fact_type===`procedural`&&t.includes(`revert rate`)){let e=t.match(/has a (\d+)% revert rate/);if(e)return`${e[1]}% of changes here get reverted — handle with care`}return t}function _n(e){let t=Date.now()-e,n=Math.floor(t/6e4);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 vn(e){let t=e.split(`/`);return t.length>1?t[t.length-1]:e}function yn(e){let t=e.split(`/`);return t.length>1?`${t.slice(0,-1).join(`/`)}/`:``}function bn(e){return e>=.7?`bg-emerald-400`:e>=.4?`bg-amber-400`:`bg-red-400`}function xn(e){return e>=.7?`High certainty`:e>=.4?`Likely true`:`Needs review`}function Sn(){let e=lt(),{url:t,queryKey:n}=Ot(),[r,i]=(0,f.useState)(!1),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(``),[l,u]=(0,f.useState)(`all`),[d,p]=(0,f.useState)(`all`),[m,h]=(0,f.useState)(0),g=N({queryKey:n([`facts`,`health`]),queryFn:()=>O(t(`/api/facts/health`)),refetchInterval:3e4}),_=N({queryKey:n([`facts`,`list`,`all`]),queryFn:()=>O(t(`/api/facts-v2/list?${new URLSearchParams({source:`all`,min_confidence:`0`})}`)),refetchInterval:15e3}),v=wt({mutationFn:e=>O(t(`/api/facts-v2/${e}/reinforce`),{method:`POST`}),onSuccess:()=>{e.invalidateQueries({queryKey:n([`facts`])})}}),y=wt({mutationFn:e=>O(t(`/api/facts-v2/${e}`),{method:`DELETE`}),onSuccess:()=>{e.invalidateQueries({queryKey:n([`facts`])})}}),b=wt({mutationFn:({id:e,content:n})=>O(t(`/api/facts-v2/${e}`),{method:`PATCH`,body:JSON.stringify({content:n}),headers:{"content-type":`application/json`}}),onSuccess:()=>{e.invalidateQueries({queryKey:n([`facts`])})}}),x=wt({mutationFn:e=>O(t(`/api/facts-v2/${e}/disable`),{method:`POST`}),onSuccess:()=>{e.invalidateQueries({queryKey:n([`facts`])})}}),S=g.data,C=_.data?.data??[],T=C.filter(e=>!e.disabled).reduce((e,t)=>{let n=t.fact_type,r=e[n];return r||(r=[],e[n]=r),r.push(t),e},{}),E=s.trim().toLowerCase(),ee=(0,f.useMemo)(()=>C.filter(e=>!(l===`user_fed`&&e.source!==`user_fed`||l===`auto`&&e.source===`user_fed`||d===`active`&&e.disabled||d===`disabled`&&!e.disabled||d===`drifting`&&!e.drift||E&&!`${e.subject} ${e.content} ${e.source_quote??``}`.toLowerCase().includes(E))),[C,l,d,E]),te=Math.max(1,Math.ceil(ee.length/Dn)),D=Math.min(m,te-1),ne=ee.slice(D*Dn,(D+1)*Dn),re=T.semantic??[],ie=T.procedural??[],k=T.negative??[],A=T.episodic??[],ae=T.convention??[],j=g.isLoading||_.isLoading;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,w.jsxs)(`section`,{className:`el-raised rounded-lg p-6 border-l-4 border-violet-500/60`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-6 flex-wrap`,children:[(0,w.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,w.jsx)(`h2`,{className:`text-foreground font-semibold text-base`,children:`What unerr has learned about your project`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-1 max-w-xl leading-relaxed`,children:`unerr watches how you code — which files you keep editing, what conventions your codebase follows, and what went wrong before. Every piece of knowledge here is automatically given to your AI agent so it makes fewer mistakes.`})]}),!j&&S&&S.total>0&&(0,w.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,w.jsx)(`p`,{className:`text-violet-400 font-mono font-bold text-4xl`,children:S.total}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-1`,children:`things remembered`})]})]}),j?(0,w.jsx)(`div`,{className:`mt-4`,children:(0,w.jsx)(Wt,{n:4})}):S?(0,w.jsxs)(`div`,{className:`mt-4 grid gap-3 grid-cols-2 lg:grid-cols-4`,children:[(0,w.jsx)(wn,{label:`Rules you taught`,value:S.by_type.convention??0,color:`text-emerald-400`}),(0,w.jsx)(wn,{label:`Conventions found`,value:S.by_type.semantic??0,color:`text-violet-400`}),(0,w.jsx)(wn,{label:`Frequently edited files`,value:S.by_type.procedural??0,color:`text-cyan-400`}),(0,w.jsx)(wn,{label:`Mistakes to avoid`,value:(S.by_type.negative??0)+(S.by_type.episodic??0),color:`text-red-400`})]}):null]}),(0,w.jsx)(Cn,{onSelectFactId:e=>{let t=C.find(t=>t.fact_id===e);t&&o(t)}}),(0,w.jsx)(On,{meta:hn.convention,facts:ae,renderCard:e=>(0,w.jsx)(kn,{fact:e,onSelect:()=>o(e),onReinforce:()=>v.mutate(e.fact_id),onDismiss:()=>y.mutate(e.fact_id),isPending:v.isPending||y.isPending},e.fact_id),isLoading:j}),(0,w.jsx)(On,{meta:hn.negative,facts:[...k,...A],renderCard:e=>(0,w.jsx)(jn,{fact:e,onSelect:()=>o(e),onReinforce:()=>v.mutate(e.fact_id),onDismiss:()=>y.mutate(e.fact_id),isPending:v.isPending||y.isPending},e.fact_id),isLoading:j}),(0,w.jsx)(On,{meta:hn.semantic,facts:re,renderCard:e=>(0,w.jsx)(kn,{fact:e,onSelect:()=>o(e),onReinforce:()=>v.mutate(e.fact_id),onDismiss:()=>y.mutate(e.fact_id),isPending:v.isPending||y.isPending},e.fact_id),isLoading:j}),(0,w.jsx)(On,{meta:hn.procedural,facts:ie,renderCard:e=>(0,w.jsx)(An,{fact:e,onSelect:()=>o(e),onReinforce:()=>v.mutate(e.fact_id),onDismiss:()=>y.mutate(e.fact_id),isPending:v.isPending||y.isPending},e.fact_id),isLoading:j}),C.length>0&&(0,w.jsxs)(`section`,{children:[(0,w.jsxs)(`button`,{type:`button`,className:`flex items-center gap-2 text-xs t-tertiary hover:text-foreground transition-colors`,onClick:()=>i(!r),children:[(0,w.jsx)(`span`,{className:`transition-transform`,style:{transform:r?`rotate(90deg)`:`rotate(0deg)`},children:`▸`}),r?`Hide`:`Show`,` all `,C.length,` memories`]}),r&&(0,w.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`search`,value:s,onChange:e=>{c(e.target.value),h(0)},placeholder:`Search memories…`,className:`flex-1 min-w-[160px] rounded-lg border border-border-subtle bg-surface-overlay px-3 py-1.5 text-xs text-foreground placeholder:t-tertiary`}),(0,w.jsx)(Tn,{value:l,onChange:e=>{u(e),h(0)},options:[[`all`,`All`],[`user_fed`,`Your rules`],[`auto`,`Auto-learned`]]}),(0,w.jsx)(Tn,{value:d,onChange:e=>{p(e),h(0)},options:[[`all`,`Any status`],[`active`,`Active`],[`disabled`,`Turned off`],[`drifting`,`Possibly outdated`]]})]}),(0,w.jsx)(`div`,{className:`glass-panel rounded-xl p-4 overflow-x-auto custom-scrollbar`,children:(0,w.jsxs)(`table`,{className:`w-full min-w-[760px] text-left text-xs`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle t-tertiary uppercase`,children:[(0,w.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Kind`}),(0,w.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`About`}),(0,w.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`What unerr remembers`}),(0,w.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Status`}),(0,w.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Certainty`}),(0,w.jsx)(`th`,{className:`py-2 pr-3 font-medium`,children:`Learned`})]})}),(0,w.jsxs)(`tbody`,{children:[ne.map(e=>(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle cursor-pointer hover:bg-surface-overlay/40 transition-colors`,onClick:()=>o(e),children:[(0,w.jsx)(`td`,{className:`py-2 pr-3`,children:(0,w.jsx)(Vn,{type:e.fact_type})}),(0,w.jsx)(`td`,{className:`py-2 pr-3 font-mono max-w-[160px] truncate`,title:e.subject,children:e.subject}),(0,w.jsx)(`td`,{className:`py-2 pr-3 max-w-[280px] truncate t-secondary`,title:e.content,children:e.content}),(0,w.jsx)(`td`,{className:`py-2 pr-3`,children:(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[e.drift&&(0,w.jsx)(`span`,{className:`rounded bg-amber-500/20 px-1.5 py-0.5 text-[9px] font-medium text-amber-300`,children:`outdated`}),e.disabled?(0,w.jsx)(`span`,{className:`rounded bg-red-500/20 px-1.5 py-0.5 text-[9px] font-medium text-red-300`,children:`off`}):(0,w.jsx)(`span`,{className:`rounded bg-emerald-500/15 px-1.5 py-0.5 text-[9px] font-medium text-emerald-300`,children:`active`})]})}),(0,w.jsxs)(`td`,{className:`py-2 pr-3 font-mono tabular-nums`,children:[(e.effective_confidence*100).toFixed(0),`%`]}),(0,w.jsx)(`td`,{className:`py-2 pr-3 t-tertiary tabular-nums`,children:_n(e.created_at)})]},e.fact_id)),ne.length===0&&(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:6,className:`py-6 text-center t-tertiary italic`,children:`No memories match these filters.`})})]})]})}),ee.length>Dn&&(0,w.jsxs)(`div`,{className:`flex items-center justify-between pt-2`,children:[(0,w.jsxs)(`span`,{className:`text-[10px] t-tertiary tabular-nums`,children:[D*Dn+1,`–`,Math.min((D+1)*Dn,ee.length),` `,`of `,ee.length]}),(0,w.jsxs)(`div`,{className:`flex gap-1`,children:[(0,w.jsx)(`button`,{type:`button`,disabled:D===0,onClick:()=>h(e=>Math.max(0,e-1)),className:`rounded-md px-2 py-1 text-[11px] font-medium t-secondary bg-surface-overlay hover:text-foreground transition-colors disabled:opacity-30`,children:`← Prev`}),(0,w.jsxs)(`span`,{className:`flex items-center px-2 text-[10px] t-tertiary tabular-nums`,children:[D+1,` / `,te]}),(0,w.jsx)(`button`,{type:`button`,disabled:D>=te-1,onClick:()=>h(e=>Math.min(te-1,e+1)),className:`rounded-md px-2 py-1 text-[11px] font-medium t-secondary bg-surface-overlay hover:text-foreground transition-colors disabled:opacity-30`,children:`Next →`})]})]})]})]}),a&&(0,w.jsx)(In,{fact:a,allFacts:C,onClose:()=>o(null),onReinforce:()=>{v.mutate(a.fact_id),o(null)},onDismiss:()=>{y.mutate(a.fact_id),o(null)},onEdit:e=>{b.mutate({id:a.fact_id,content:e}),o(null)},onDisable:()=>{x.mutate(a.fact_id),o(null)},isPending:v.isPending||y.isPending||b.isPending||x.isPending})]})}function Cn({onSelectFactId:e}){let{url:t,queryKey:n}=Ot(),[r,i]=(0,f.useState)(``),[a,o]=(0,f.useState)(``),s=N({queryKey:n([`facts`,`injection-preview`,a]),queryFn:()=>O(t(`/api/facts-v2/injection-preview?${new URLSearchParams({file:a})}`)),enabled:a.length>0}),c=s.data;return(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-6`,children:[(0,w.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-foreground`,children:`Try it — see what your agent sees`}),(0,w.jsx)(`p`,{className:`mt-1 text-sm t-secondary leading-relaxed`,children:`Type any file path to preview the exact knowledge unerr gives your agent when it works on that file. This is the real thing, not a simulation.`})]})}),(0,w.jsxs)(`form`,{className:`mt-4 flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),o(r.trim())},children:[(0,w.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),placeholder:`src/proxy/proxy.ts`,spellCheck:!1,className:`flex-1 min-w-[220px] rounded-lg border border-border-subtle bg-surface-overlay px-3 py-1.5 font-mono text-xs text-foreground placeholder:t-tertiary`}),(0,w.jsx)(`button`,{type:`submit`,disabled:r.trim().length===0,className:`rounded-lg border border-border-subtle bg-surface-overlay px-3 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-surface-overlay/60 disabled:opacity-40`,children:`Preview`})]}),a.length>0&&(0,w.jsx)(`div`,{className:`mt-4`,children:s.isLoading?(0,w.jsx)(`p`,{className:`text-xs t-tertiary italic`,children:`Resolving memories…`}):s.isError?(0,w.jsxs)(`p`,{className:`text-xs text-red-300`,children:[`Could not load injection preview for`,` `,(0,w.jsx)(`span`,{className:`font-mono`,children:a}),`.`]}):c?c.injected.length===0?(0,w.jsx)(`div`,{className:`rounded-lg border border-border-subtle bg-surface-overlay/40 p-4`,children:(0,w.jsxs)(`p`,{className:`text-xs t-secondary`,children:[`unerr doesn't have any knowledge about`,` `,(0,w.jsx)(`span`,{className:`font-mono t-tertiary`,children:a}),` `,`yet. As you work on this file, unerr will learn its conventions, track changes, and remember past issues.`]})}):(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-widest t-tertiary`,children:`What your agent sees when it opens this file`}),(0,w.jsx)(`pre`,{className:`overflow-x-auto custom-scrollbar rounded-lg border border-violet-500/30 bg-violet-500/5 p-3 font-mono text-[11px] leading-relaxed text-violet-100 whitespace-pre-wrap`,children:c.injected.join(`
|
|
8
8
|
`)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`p`,{className:`mb-1.5 text-[10px] font-semibold uppercase tracking-widest t-tertiary`,children:[`Knowledge sources (`,c.facts.length,`)`]}),(0,w.jsx)(`div`,{className:`flex flex-col gap-1`,children:c.facts.map(t=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>e(t.fact_id),className:`flex items-center gap-2 rounded-lg border border-border-subtle bg-surface-overlay/40 px-3 py-2 text-left text-xs transition-colors hover:bg-surface-overlay/70`,children:[(0,w.jsx)(Vn,{type:t.fact_type}),(0,w.jsx)(`span`,{className:`flex-1 min-w-0 truncate t-secondary`,title:t.content,children:t.content})]},t.fact_id))})]}),(0,w.jsx)(`p`,{className:`text-[10px] t-tertiary`,children:c.resolver_available?`Found ${c.entity_keys.length} function${c.entity_keys.length===1?``:`s`} in this file with relevant knowledge.`:`Showing file-level and project-wide knowledge only.`})]}):null})]})}function wn({label:e,value:t,color:n}){return(0,w.jsxs)(`div`,{className:`glass-card rounded-lg px-3 py-2.5`,children:[(0,w.jsx)(`p`,{className:`text-[10px] t-tertiary uppercase tracking-wide font-medium`,children:e}),(0,w.jsx)(`p`,{className:`text-xl font-semibold tabular-nums ${n}`,children:t})]})}function Tn({value:e,onChange:t,options:n}){return(0,w.jsx)(`div`,{className:`flex gap-0.5 rounded-lg bg-surface-overlay p-0.5`,children:n.map(([n,r])=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:`rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors ${e===n?`bg-violet-500/25 text-violet-200`:`t-tertiary hover:text-foreground`}`,children:r},n))})}var En=6,Dn=15;function On({meta:e,facts:t,renderCard:n,isLoading:r}){let[i,a]=(0,f.useState)(En);if(r)return(0,w.jsxs)(`section`,{children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:e.label}),(0,w.jsx)(`div`,{className:`mt-3`,children:(0,w.jsx)(Wt,{n:3})})]});let o=t.slice(0,i),s=t.length-i,c=s>0,l=i>=t.length;return(0,w.jsxs)(`section`,{children:[(0,w.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,w.jsxs)(`h2`,{className:`section-label`,style:{color:`var(--color-${e.color}-400, currentColor)`},children:[(0,w.jsx)(`span`,{className:`mr-1.5 opacity-60`,children:e.icon}),e.label]}),t.length>0&&(0,w.jsx)(`span`,{className:`text-[10px] t-tertiary tabular-nums`,children:t.length})]}),(0,w.jsx)(`p`,{className:`mt-1 text-xs t-tertiary`,children:e.description}),t.length===0?(0,w.jsx)(`p`,{className:`mt-4 text-sm t-tertiary italic`,children:e.emptyMsg}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:o.map(n)}),(c||l)&&t.length>En&&(0,w.jsx)(`div`,{className:`mt-3 flex justify-center`,children:c?(0,w.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>Math.min(e+En,t.length)),className:`rounded-lg border border-border-subtle bg-surface-overlay px-4 py-1.5 text-xs font-medium t-secondary hover:text-foreground transition-colors`,children:[`Show `,Math.min(s,En),` more of `,s]}):(0,w.jsx)(`button`,{type:`button`,onClick:()=>a(En),className:`rounded-lg border border-border-subtle bg-surface-overlay px-4 py-1.5 text-xs font-medium t-tertiary hover:text-foreground transition-colors`,children:`Show less`})})]})]})}function kn({fact:e,onSelect:t,onReinforce:n,onDismiss:r,isPending:i}){let a=gn(e),o=e.effective_confidence;return(0,w.jsxs)(`div`,{className:`glass-card rounded-xl p-4 flex flex-col gap-3 cursor-pointer hover:ring-1 hover:ring-violet-500/30 transition-all ${e.disabled?`opacity-60`:``}`,onClick:t,children:[(0,w.jsx)(Pn,{fact:e}),(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-foreground leading-snug truncate`,children:e.subject}),(0,w.jsx)(Nn,{onReinforce:n,onDismiss:r,isPending:i})]}),(0,w.jsx)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:a}),(0,w.jsx)(Mn,{confidence:o}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] t-tertiary`,children:[(0,w.jsxs)(`span`,{children:[`Learned `,_n(e.created_at)]}),e.reinforcement_count>0&&(0,w.jsxs)(`span`,{children:[`Confirmed `,e.reinforcement_count,` time`,e.reinforcement_count===1?``:`s`]})]})]})}function An({fact:e,onSelect:t,onReinforce:n,onDismiss:r,isPending:i}){let a=gn(e),o=e.content.match(/(\d+)% of sessions/),s=o?Number.parseInt(o[1],10):0;return(0,w.jsxs)(`div`,{className:`glass-card rounded-xl p-4 flex flex-col gap-3 cursor-pointer hover:ring-1 hover:ring-cyan-500/30 transition-all ${e.disabled?`opacity-60`:``}`,onClick:t,children:[(0,w.jsx)(Pn,{fact:e}),(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-foreground truncate`,title:e.subject,children:vn(e.subject)}),(0,w.jsx)(`p`,{className:`text-[10px] font-mono t-tertiary truncate`,title:e.subject,children:yn(e.subject)})]}),(0,w.jsx)(Nn,{onReinforce:n,onDismiss:r,isPending:i})]}),(0,w.jsx)(`p`,{className:`text-xs t-secondary`,children:a}),s>0&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`div`,{className:`flex-1 h-1.5 rounded-full bg-surface-overlay overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full bg-cyan-400 transition-all duration-500`,style:{width:`${s}%`}})}),(0,w.jsxs)(`span`,{className:`text-[10px] font-mono text-cyan-400 tabular-nums`,children:[s,`%`]})]}),(0,w.jsx)(`div`,{className:`text-[10px] t-tertiary`,children:_n(e.created_at)})]})}function jn({fact:e,onSelect:t,onReinforce:n,onDismiss:r,isPending:i}){let a=gn(e),o=e.content.includes(`reverted`);return(0,w.jsxs)(`div`,{className:`glass-card rounded-xl p-4 flex flex-col gap-3 border border-red-500/10 cursor-pointer hover:ring-1 hover:ring-red-500/30 transition-all ${e.disabled?`opacity-60`:``}`,onClick:t,children:[(0,w.jsx)(Pn,{fact:e}),(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,w.jsx)(`span`,{className:`flex items-center justify-center w-5 h-5 rounded-full text-[10px] font-bold bg-red-500/15 text-red-400 flex-shrink-0`,children:o?`↩`:`!`}),(0,w.jsx)(`h3`,{className:`text-sm font-medium text-foreground truncate`,title:e.subject,children:vn(e.subject)})]}),(0,w.jsx)(Nn,{onReinforce:n,onDismiss:r,isPending:i})]}),(0,w.jsx)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:a}),(0,w.jsx)(Mn,{confidence:e.effective_confidence})]})}function Mn({confidence:e}){let t=Math.round(e*100);return(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`div`,{className:`flex-1 h-1 rounded-full bg-surface-overlay overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500 ${bn(e)}`,style:{width:`${t}%`}})}),(0,w.jsx)(`span`,{className:`text-[10px] tabular-nums ${t>=70?`text-emerald-400`:t>=40?`text-amber-400`:`text-red-400`}`,children:xn(e)})]})}function Nn({onReinforce:e,onDismiss:t,isPending:n}){return(0,w.jsxs)(`div`,{className:`flex gap-1 flex-shrink-0`,children:[(0,w.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-xs text-emerald-400/60 hover:text-emerald-400 hover:bg-emerald-500/10 transition-colors disabled:opacity-30`,onClick:e,disabled:n,title:`This is still true — confirm this`,children:(0,w.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,w.jsx)(`path`,{d:`M8 12V4M5 7l3-3 3 3`})})}),(0,w.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-xs text-red-400/60 hover:text-red-400 hover:bg-red-500/10 transition-colors disabled:opacity-30`,onClick:t,disabled:n,title:`This is wrong — remove it`,children:(0,w.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,w.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]})}function Pn({fact:e}){return!e.drift&&!e.disabled?null:(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[e.drift&&(0,w.jsx)(`span`,{className:`rounded-full bg-amber-500/20 px-1.5 py-0.5 text-[9px] font-medium text-amber-300`,children:`possibly outdated`}),e.disabled&&(0,w.jsx)(`span`,{className:`rounded-full bg-red-500/20 px-1.5 py-0.5 text-[9px] font-medium text-red-300`,children:`turned off`})]})}var Fn={convention_detector:{label:`Learned from your code`,description:`unerr analyzed your codebase and found this pattern used consistently`},session_analysis:{label:`Learned from your sessions`,description:`Discovered by watching which files and patterns you work with across sessions`},causal_bridge:{label:`Learned from change outcomes`,description:`unerr tracked whether this change survived or was reverted within 24 hours`},negative_knowledge:{label:`Learned from a mistake`,description:`A change was made and then undone — unerr captured this so the same mistake isn't repeated`},agent_explicit:{label:`You told unerr`,description:`You or your AI agent explicitly asked unerr to remember this`},user_fed:{label:`You told unerr`,description:`You explicitly asked unerr to remember this rule`}};function In({fact:e,allFacts:t,onClose:n,onReinforce:r,onDismiss:i,onEdit:a,onDisable:o,isPending:s}){let[c,l]=(0,f.useState)(!1),[u,d]=(0,f.useState)(e.content);(0,f.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(c?l(!1):n())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[n,c]);let p=hn[e.fact_type],m=p?.label??e.fact_type,h=p?.icon??`?`,g=p?.color??`violet`,_=Math.round(e.base_confidence*100),v=Math.round(e.effective_confidence*100),y=_-v;return(0,w.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,onClick:n,children:[(0,w.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`}),(0,w.jsxs)(`div`,{className:`relative glass-panel rounded-2xl w-full max-w-lg max-h-[85vh] overflow-y-auto custom-scrollbar shadow-2xl`,onClick:e=>e.stopPropagation(),children:[(0,w.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center justify-between gap-3 px-6 py-4 border-b border-border-subtle bg-surface/95 backdrop-blur-sm rounded-t-2xl`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,w.jsx)(`span`,{className:`flex items-center justify-center w-8 h-8 rounded-lg text-sm font-bold`,style:{background:`var(--color-${g}-500, #8B5CF6)1a`,color:`var(--color-${g}-400, #8B5CF6)`},children:h}),(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`p`,{className:`text-[10px] uppercase tracking-wide t-tertiary font-medium`,children:m}),e.drift&&(0,w.jsx)(`span`,{className:`rounded-full bg-amber-500/20 px-1.5 py-0.5 text-[9px] font-medium text-amber-300`,children:`possibly outdated`}),e.disabled&&(0,w.jsx)(`span`,{className:`rounded-full bg-red-500/20 px-1.5 py-0.5 text-[9px] font-medium text-red-300`,children:`turned off`})]}),(0,w.jsx)(`h3`,{className:`text-sm font-semibold text-foreground truncate`,title:e.subject,children:e.subject})]})]}),(0,w.jsx)(`button`,{type:`button`,className:`flex-shrink-0 rounded-lg p-1.5 t-tertiary hover:text-foreground hover:bg-surface-overlay transition-colors`,onClick:n,children:(0,w.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,className:`w-4 h-4`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,w.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})})})]}),(0,w.jsxs)(`div`,{className:`px-6 py-5 flex flex-col gap-5`,children:[(0,w.jsx)(Ln,{title:`What this means`,children:(0,w.jsx)(Rn,{fact:e})}),(0,w.jsx)(Ln,{title:`Summary`,children:c?(0,w.jsx)(`textarea`,{value:u,onChange:e=>d(e.target.value),rows:4,className:`w-full rounded-lg border border-border-subtle bg-surface-overlay p-2.5 font-mono text-xs text-foreground`}):(0,w.jsx)(`p`,{className:`text-sm text-foreground leading-relaxed`,children:gn(e)})}),e.source_quote?(0,w.jsx)(Ln,{title:`What you said`,children:(0,w.jsxs)(`blockquote`,{className:`border-l-2 border-violet-400/40 pl-3 text-xs italic t-secondary leading-relaxed`,children:[`"`,e.source_quote,`"`]})}):null,(0,w.jsx)(Ln,{title:`How certain is this?`,children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsx)(Mn,{confidence:e.effective_confidence}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-1.5 text-xs mt-1`,children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`Certainty`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-foreground text-right`,children:[v,`%`]}),y>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`Faded over time`}),(0,w.jsxs)(`span`,{className:`text-amber-400 tabular-nums text-right`,children:[`-`,y,`%`]})]}),e.reinforcement_count>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`Times confirmed`}),(0,w.jsx)(`span`,{className:`text-emerald-400 tabular-nums text-right`,children:e.reinforcement_count})]})]})]})}),(0,w.jsx)(zn,{fact:e,allFacts:t}),(0,w.jsxs)(Ln,{title:`Where this applies`,children:[(0,w.jsxs)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:[`When your agent works on files near`,` `,(0,w.jsx)(`span`,{className:`font-mono text-foreground`,children:e.scope}),`, unerr automatically shares this knowledge — the agent sees it before making changes.`]}),e.applies_to&&e.applies_to.length>0&&(0,w.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.applies_to.map(e=>(0,w.jsx)(`code`,{className:`rounded bg-surface-overlay px-1.5 py-0.5 text-[10px] font-mono t-secondary`,children:e},e))})]}),(0,w.jsx)(Ln,{title:`How this was learned`,children:(()=>{let t=Fn[e.source]??{label:e.source,description:`Automatically generated`};return(0,w.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,w.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-violet-400/60 mt-1.5 flex-shrink-0`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`text-xs font-medium text-foreground`,children:t.label}),(0,w.jsx)(`p`,{className:`text-[10px] t-tertiary mt-0.5`,children:t.description})]})]})})()}),(0,w.jsx)(Ln,{title:`Timeline`,children:(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-x-4 gap-y-1.5 text-xs`,children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`First detected`}),(0,w.jsx)(`span`,{className:`t-secondary text-right`,children:new Date(e.created_at).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}),e.last_reinforced_at>e.created_at&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`Last confirmed`}),(0,w.jsx)(`span`,{className:`t-secondary text-right`,children:new Date(e.last_reinforced_at).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})})]})]})})]}),(0,w.jsxs)(`div`,{className:`sticky bottom-0 flex items-center justify-between gap-3 px-6 py-4 border-t border-border-subtle bg-surface/95 backdrop-blur-sm rounded-b-2xl`,children:[(0,w.jsx)(`span`,{className:`text-[10px] t-tertiary`}),c?(0,w.jsxs)(`div`,{className:`flex gap-2`,children:[(0,w.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-xs font-medium text-violet-300 bg-violet-500/15 hover:bg-violet-500/25 transition-colors disabled:opacity-30`,onClick:()=>a(u),disabled:s||u.trim().length===0,children:`Save`}),(0,w.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-xs font-medium t-secondary bg-surface-overlay hover:opacity-80 transition-opacity`,onClick:()=>{l(!1),d(e.content)},children:`Cancel`})]}):(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,w.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-xs font-medium t-secondary bg-surface-overlay hover:opacity-80 transition-opacity disabled:opacity-30`,onClick:()=>l(!0),disabled:s,children:`Edit`}),(0,w.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium text-emerald-400 bg-emerald-500/10 hover:bg-emerald-500/20 transition-colors disabled:opacity-30`,onClick:r,disabled:s,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,w.jsx)(`path`,{d:`M8 12V4M5 7l3-3 3 3`})}),e.disabled?`Turn back on`:`Still true`]}),!e.disabled&&(0,w.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-xs font-medium text-amber-300 bg-amber-500/10 hover:bg-amber-500/20 transition-colors disabled:opacity-30`,onClick:o,disabled:s,children:`Turn off`}),(0,w.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium text-red-400 bg-red-500/10 hover:bg-red-500/20 transition-colors disabled:opacity-30`,onClick:i,disabled:s,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,className:`w-3.5 h-3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,w.jsx)(`path`,{d:`M4 4l8 8M12 4l-8 8`})}),`Forget`]})]})]})]})]})}function Ln({title:e,children:t}){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,w.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wide t-tertiary`,children:e}),t]})}function Rn({fact:e}){if(e.fact_type===`semantic`)return(0,w.jsxs)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:[`unerr detected that your codebase consistently follows this pattern. When your AI agent modifies code in`,` `,(0,w.jsx)(`span`,{className:`font-mono text-violet-400`,children:e.scope}),`, this convention is automatically surfaced so it doesn't accidentally break the pattern.`]});if(e.fact_type===`procedural`)return(0,w.jsx)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:`You keep coming back to this file across coding sessions. unerr prioritizes it in context so your AI agent understands this is central to your workflow.`});if(e.fact_type===`negative`||e.fact_type===`episodic`){let t=e.content.includes(`reverted`),n=e.source===`causal_bridge`,r=e.source===`session_analysis`,i=e.source===`negative_knowledge`;return t&&n?(0,w.jsxs)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:[`A change was made to`,` `,(0,w.jsx)(`span`,{className:`font-mono text-red-400`,children:e.subject}),` but it was reverted within 24 hours — the approach didn't work out. unerr remembers this so your AI agent avoids the same mistake.`]}):!t&&n?(0,w.jsxs)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:[`A change to`,` `,(0,w.jsx)(`span`,{className:`font-mono text-amber-400`,children:e.subject}),` `,`survived past the 24-hour window and shipped. This is tracked as a successful change.`]}):i?(0,w.jsxs)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:[`The file`,` `,(0,w.jsx)(`span`,{className:`font-mono text-red-400`,children:e.subject}),` was modified and then reverted — the approach was incorrect. unerr captured this as a lesson so the same mistake isn't repeated.`]}):r?(0,w.jsxs)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:[`Changes to`,` `,(0,w.jsx)(`span`,{className:`font-mono text-red-400`,children:e.subject}),` `,`frequently get reverted across multiple sessions. This file may have tricky edge cases or dependencies that make changes fragile.`]}):(0,w.jsxs)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:[`Something went wrong with`,` `,(0,w.jsx)(`span`,{className:`font-mono text-red-400`,children:e.subject}),`. This lesson is surfaced when your AI agent works in this area.`]})}return e.fact_type===`convention`?(0,w.jsxs)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:[`This is a rule you or your AI agent explicitly recorded. It's injected whenever the agent works in`,` `,(0,w.jsx)(`span`,{className:`font-mono text-emerald-400`,children:e.scope}),`.`]}):(0,w.jsx)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:e.content})}function zn({fact:e,allFacts:t}){if(e.fact_type===`semantic`){let t=e.content.match(/(\d+)\s*entit/),n=t?t[1]:null;return n?(0,w.jsx)(Ln,{title:`How widespread`,children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`text-lg font-semibold text-violet-400 tabular-nums`,children:n}),(0,w.jsx)(`span`,{className:`text-xs t-secondary`,children:`entities in your codebase follow this convention`})]})}):null}if(e.fact_type===`procedural`){let n=e.content.match(/(\d+)% of sessions/),r=n?Number.parseInt(n[1],10):0,i=e.content.match(/(\d+)% revert rate/),a=i?Number.parseInt(i[1],10):0,o=yn(e.subject),s=t.filter(t=>t.fact_id!==e.fact_id&&t.fact_type===`procedural`&&yn(t.subject)===o).slice(0,4),c=t.filter(t=>(t.fact_type===`negative`||t.fact_type===`episodic`)&&t.subject===e.subject);return(0,w.jsxs)(w.Fragment,{children:[(r>0||a>0)&&(0,w.jsx)(Ln,{title:`Session frequency`,children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[r>0&&(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`div`,{className:`w-36 h-2.5 rounded-full bg-surface-overlay overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full bg-cyan-400`,style:{width:`${r}%`}})}),(0,w.jsxs)(`span`,{className:`text-xs text-cyan-400 font-semibold tabular-nums`,children:[r,`%`]}),(0,w.jsx)(`span`,{className:`text-[10px] t-tertiary`,children:`of sessions`})]}),a>0&&(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`div`,{className:`w-36 h-2.5 rounded-full bg-surface-overlay overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full bg-red-400`,style:{width:`${a}%`}})}),(0,w.jsxs)(`span`,{className:`text-xs text-red-400 font-semibold tabular-nums`,children:[a,`%`]}),(0,w.jsx)(`span`,{className:`text-[10px] t-tertiary`,children:`revert rate`})]})]})}),s.length>0&&(0,w.jsx)(Ln,{title:`Often changed together`,children:(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:s.map(e=>(0,w.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-overlay px-2 py-0.5 text-[10px] font-mono t-secondary`,children:vn(e.subject)},e.fact_id))})}),c.length>0&&(0,w.jsx)(Ln,{title:`Known issues with this file`,children:(0,w.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:c.map(e=>(0,w.jsxs)(`div`,{className:`flex items-start gap-2 text-xs`,children:[(0,w.jsx)(`span`,{className:`text-red-400 flex-shrink-0 mt-0.5`,children:`!`}),(0,w.jsx)(`span`,{className:`t-secondary`,children:gn(e)})]},e.fact_id))})})]})}return e.fact_type===`negative`||e.fact_type===`episodic`?(0,w.jsx)(Ln,{title:`Affected code`,children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`font-mono text-xs text-red-400`,children:e.subject}),e.scope!==e.subject&&(0,w.jsxs)(`span`,{className:`text-[10px] t-tertiary`,children:[`in `,e.scope]})]})}):null}var Bn={procedural:{color:`bg-cyan-500/15 text-cyan-400`,label:`frequent file`},semantic:{color:`bg-violet-500/15 text-violet-400`,label:`convention`},negative:{color:`bg-red-500/15 text-red-400`,label:`lesson`},convention:{color:`bg-emerald-500/15 text-emerald-400`,label:`your rule`},episodic:{color:`bg-amber-500/15 text-amber-400`,label:`change outcome`}};function Vn({type:e}){let t=Bn[e]??{color:`bg-surface-overlay text-muted-foreground`,label:e};return(0,w.jsx)(`span`,{className:`inline-block rounded-full px-2 py-0.5 text-[10px] font-medium ${t.color}`,children:t.label})}function Hn(e){switch(e){case`low`:return`bg-emerald-500/20 border-emerald-500/40 text-emerald-300`;case`medium`:return`bg-amber-500/20 border-amber-500/40 text-amber-300`;case`high`:return`bg-orange-500/20 border-orange-500/40 text-orange-300`;case`critical`:return`bg-red-500/20 border-red-500/40 text-red-300`;default:return`bg-zinc-700/30 border-zinc-600 text-zinc-400`}}function Un(e){switch(e){case`low`:return`bg-emerald-500/30 text-emerald-300`;case`medium`:return`bg-amber-500/30 text-amber-300`;case`high`:return`bg-orange-500/30 text-orange-300`;case`critical`:return`bg-red-500/30 text-red-300`;default:return`bg-zinc-600/30 text-zinc-400`}}function Wn({label:e,value:t,max:n,unit:r,hint:i}){let a=Math.min(t/n*100,100);return(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,w.jsx)(`span`,{className:`w-28 text-zinc-300 shrink-0 font-medium`,children:e}),(0,w.jsx)(`div`,{className:`flex-1 h-1.5 bg-zinc-700 rounded-full overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full bg-violet-500 rounded-full transition-all`,style:{width:`${a}%`}})}),(0,w.jsxs)(`span`,{className:`w-12 text-right text-zinc-400 tabular-nums`,children:[typeof t==`number`&&t%1!=0?t.toFixed(2):t,r??``]})]}),i&&(0,w.jsx)(`div`,{className:`mt-0.5 ml-[7.5rem] text-[10px] text-zinc-500 leading-snug`,children:i})]})}function Gn({node:e,onDrillDown:t,onSelect:n,isSelected:r}){let i=e.children&&e.children.length>0;return(0,w.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))},className:`border rounded-lg p-3 text-left transition-all hover:scale-[1.01] cursor-pointer ${r?`ring-2 ring-violet-500 `:``}${Hn(e.risk_level)}`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,w.jsx)(`span`,{className:`font-medium text-sm truncate`,children:e.name}),(0,w.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full font-medium ${Un(e.risk_level)}`,children:e.risk_level})]}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-zinc-400`,children:[(0,w.jsxs)(`span`,{children:[`Score: `,Math.round(e.health_score*100),`%`]}),(0,w.jsxs)(`span`,{children:[e.entity_count,` entities`]}),i&&(0,w.jsxs)(`span`,{children:[e.children?.length,` dirs`]})]}),i&&t&&(0,w.jsx)(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),t(e)},className:`text-[11px] text-violet-300 hover:text-violet-200 transition-colors px-1.5 py-0.5 rounded hover:bg-violet-500/10`,"aria-label":`Open ${e.name}`,children:`Open \\u25B8`})]})]})}function Kn({node:e,activity:t}){let n=e.metrics;return(0,w.jsxs)(`div`,{className:`border border-zinc-700 rounded-lg p-4 bg-zinc-800/50`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,w.jsx)(`h3`,{className:`font-semibold text-sm text-zinc-200 truncate`,children:e.path}),(0,w.jsxs)(`span`,{className:`text-xs px-2 py-0.5 rounded-full font-medium ${Un(e.risk_level)}`,children:[Math.round(e.health_score*100),`% health`]})]}),t&&t.edit_count>=3&&(0,w.jsxs)(`div`,{className:`mb-3 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:[(0,w.jsxs)(`div`,{className:`font-medium`,children:[`🩹 Active churn — `,t.edit_count,` edits in the last`,` `,t.window_days,` days`]}),(0,w.jsxs)(`div`,{className:`mt-0.5 text-[11px] text-amber-200/80`,children:[t.session_count,` session`,t.session_count===1?``:`s`,` touched this file. Hot files are more likely to break unrelated callers.`]})]}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsx)(Wn,{label:`Called by`,value:n.fan_in,max:40,hint:n.fan_in>=20?`${n.fan_in} places depend on this — high-blast file`:n.fan_in>=5?`${n.fan_in} dependents`:`Few dependents`}),(0,w.jsx)(Wn,{label:`Calls`,value:n.fan_out,max:40,hint:n.fan_out>=20?`Imports ${n.fan_out} things — consider splitting`:`Uses ${n.fan_out} other entities`}),(0,w.jsx)(Wn,{label:`Edited recently`,value:n.change_frequency,max:10,hint:n.change_frequency>=5?`${n.change_frequency} recent edits — hot file`:`${n.change_frequency} recent edits`}),(0,w.jsx)(Wn,{label:`Co-changes with`,value:n.coupling_count,max:10,hint:n.coupling_count>=5?`Edited alongside ${n.coupling_count} other files — likely coupled`:`${n.coupling_count} co-change partners`}),(0,w.jsx)(Wn,{label:`Stability`,value:Math.round(n.durability*100),max:100,unit:`%`,hint:n.durability>=.7?`Rarely changes — stable surface`:n.durability>=.4?`Moderate churn`:`Changes often`})]}),(0,w.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-zinc-700 text-xs text-zinc-500`,children:[e.entity_count,` entities in this`,` `,e.children?`directory`:`file`]})]})}function qn({initialFilter:e}={}){let[t,n]=(0,f.useState)([]),[r,i]=(0,f.useState)(null),[a,o]=(0,f.useState)(e??``);(0,f.useEffect)(()=>{e!==void 0&&o(e)},[e]);let{data:s,isLoading:c,error:l}=N({queryKey:[`health-map`],queryFn:()=>O(`/api/intelligence/health-map`),staleTime:3e4}),u=!!r&&!r.children,d=N({queryKey:[`health-map-file`,r?.path],queryFn:()=>O(`/api/intelligence/health-map/file?path=${encodeURIComponent(r?.path??``)}`),enabled:u,staleTime:3e4}).data?.data?.recent_activity??null;if(c)return(0,w.jsx)(`div`,{className:`flex items-center justify-center h-64 text-zinc-500`,children:`Loading health map...`});if(l||!s?.data)return(0,w.jsx)(`div`,{className:`flex items-center justify-center h-64 text-red-400`,children:`Failed to load health map`});let p=s.data;for(let e of t){let t=p.children?.find(t=>t.path===e);if(t)p=t;else break}let m=p.children??[p],h=a.trim().toLowerCase(),g=h?m.filter(e=>e.name.toLowerCase().includes(h)||e.path.toLowerCase().includes(h)):m;return(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-zinc-400`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>{n([]),i(null)},className:`hover:text-zinc-200 transition-colors`,children:`root`}),t.map((e,r)=>(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`text-zinc-600`,children:`/`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>{n(t.slice(0,r+1)),i(null)},className:`hover:text-zinc-200 transition-colors`,children:e.split(`/`).pop()})]},e))]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-4 text-sm`,children:[(0,w.jsxs)(`span`,{className:`text-zinc-300`,children:[`Overall health:`,` `,(0,w.jsxs)(`span`,{className:`font-semibold text-violet-400`,children:[Math.round(p.health_score*100),`%`]})]}),(0,w.jsxs)(`span`,{className:`text-zinc-500`,children:[p.entity_count,` entities`]}),(0,w.jsxs)(`span`,{className:`text-xs px-2 py-0.5 rounded-full ${Un(p.risk_level)}`,children:[p.risk_level,` risk`]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`search`,value:a,onChange:e=>o(e.target.value),placeholder:`Filter files in this level…`,className:`text-xs rounded-md border border-zinc-700 bg-zinc-800/60 px-2.5 py-1.5 w-56 focus:outline-none focus:border-violet-500 placeholder:text-zinc-500`}),a&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>o(``),className:`text-xs text-zinc-500 hover:text-zinc-300`,children:`Clear`})]})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-3 gap-4`,children:[(0,w.jsxs)(`div`,{className:`lg:col-span-2 grid grid-cols-2 sm:grid-cols-3 gap-2`,children:[g.map(e=>(0,w.jsx)(Gn,{node:e,onDrillDown:e=>{n([...t,e.path]),i(null)},onSelect:i,isSelected:r?.path===e.path},e.path)),g.length===0&&(0,w.jsx)(`div`,{className:`col-span-full text-center text-zinc-500 py-8`,children:`No health data for this path`})]}),(0,w.jsx)(`div`,{children:r?(0,w.jsx)(Kn,{node:r,activity:d}):(0,w.jsx)(`div`,{className:`border border-zinc-700 rounded-lg p-4 bg-zinc-800/50 text-zinc-500 text-sm`,children:`Click a file to see detailed health metrics`})})]})]})}var Jn={critical:`bg-red-500/15 text-red-400 border-red-500/20`,high:`bg-red-500/15 text-red-400 border-red-500/20`,medium:`bg-amber-500/15 text-amber-400 border-amber-500/20`,low:`bg-emerald-500/15 text-emerald-400 border-emerald-500/20`},Yn={critical:`bg-red-400`,high:`bg-red-400`,medium:`bg-amber-400`,low:`bg-emerald-400`},Xn={critical:`text-red-400`,high:`text-red-400`,medium:`text-amber-400`,low:`text-emerald-400`},Zn={critical:{border:`border-red-500/30`,bg:`bg-red-500/5`,icon:`!!`,iconColor:`text-red-400 bg-red-500/20`},warning:{border:`border-amber-500/30`,bg:`bg-amber-500/5`,icon:`!`,iconColor:`text-amber-400 bg-amber-500/20`},info:{border:`border-blue-500/30`,bg:`bg-blue-500/5`,icon:`i`,iconColor:`text-blue-400 bg-blue-500/20`},positive:{border:`border-emerald-500/30`,bg:`bg-emerald-500/5`,icon:`✓`,iconColor:`text-emerald-400 bg-emerald-500/20`}},Qn={A:`text-emerald-400`,B:`text-emerald-400`,C:`text-amber-400`,D:`text-red-400`,F:`text-red-400`};function $n(e){let t=e.risk_level===`high`?3:e.risk_level===`medium`?2:1,n=e.test_count===0?2:1;return e.degree*t*n}function er(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function tr(e){return`${e}%`}function nr({level:e}){return(0,w.jsxs)(`span`,{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide ${Jn[e]??Jn.low}`,children:[(0,w.jsx)(`span`,{className:`mr-1 inline-block h-1.5 w-1.5 rounded-full ${Yn[e]??Yn.low}`}),e]})}function rr({count:e}){return e===0?(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] font-medium text-red-400/80`,children:[(0,w.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-red-400/60`}),`untested`]}):(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] font-medium text-emerald-400/80`,children:[(0,w.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-emerald-400/60`}),e,` test`,e===1?``:`s`]})}function ir({insights:e,stats:t,isLoading:n}){if(n)return(0,w.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:(0,w.jsx)(Wt,{n:4})});if(!e||!t)return(0,w.jsx)(`div`,{className:`glass-panel rounded-xl px-6 py-8 text-center`,children:(0,w.jsx)(`p`,{className:`t-secondary text-sm`,children:`Graph not loaded yet — start the proxy or wait for indexing.`})});let r=e.healthGrade,i=e.healthScore,a=e.blastRadiusCoverage;return(0,w.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[280px_1fr]`,children:[(0,w.jsxs)(`div`,{className:`glass-panel rounded-xl flex flex-col items-center justify-center py-6 px-4 gap-2`,children:[(0,w.jsxs)(`div`,{className:`relative flex items-center justify-center`,children:[(0,w.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 120 120`,className:`h-28 w-28`,children:[(0,w.jsx)(`circle`,{cx:`60`,cy:`60`,r:`52`,fill:`none`,stroke:`currentColor`,strokeWidth:`8`,className:`text-surface-overlay`}),(0,w.jsx)(`circle`,{cx:`60`,cy:`60`,r:`52`,fill:`none`,strokeWidth:`8`,strokeLinecap:`round`,strokeDasharray:`${i/100*327} 327`,transform:`rotate(-90 60 60)`,className:i>=80?`text-emerald-400`:i>=50?`text-amber-400`:`text-red-400`,style:{transition:`stroke-dasharray 0.6s ease`}})]}),(0,w.jsxs)(`div`,{className:`absolute flex flex-col items-center`,children:[(0,w.jsx)(`span`,{className:`text-3xl font-bold ${Qn[r]??`text-foreground`}`,children:r}),(0,w.jsxs)(`span`,{className:`text-xs t-tertiary font-mono`,children:[i,`/100`]})]})]}),(0,w.jsx)(`span`,{className:`text-xs t-tertiary`,children:`Codebase Health`})]}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,w.jsx)(ar,{label:`Tested Reach`,value:tr(a),hint:`% of your code's dependency reach that has tests guarding it.`,accent:a>=75?`emerald`:a>=50?`amber`:`red`}),(0,w.jsx)(ar,{label:`Chokepoints`,value:String(e.bottlenecks.length),hint:`High-traffic files with no tests — break one, break many.`,accent:e.bottlenecks.length>0?`red`:`emerald`}),(0,w.jsx)(ar,{label:`Risk Concentrated In Top 5`,value:tr(e.riskConcentration),hint:`Higher = more fragile codebase (few files carry most risk).`,accent:e.riskConcentration>60?`red`:e.riskConcentration>40?`amber`:`emerald`})]}),(0,w.jsxs)(`details`,{className:`group rounded-xl border border-border-subtle bg-sidebar/40 px-4 py-2`,children:[(0,w.jsxs)(`summary`,{className:`cursor-pointer text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[`Advanced metrics (`,er(t.entityCount),` entities ·`,` `,t.communityCount,` modules)`]}),(0,w.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4`,children:[(0,w.jsx)(ar,{label:`High-Risk Files`,value:String(e.riskDistribution.high),sub:`of ${e.riskDistribution.high+e.riskDistribution.medium+e.riskDistribution.low} analyzed`,hint:`Files with high blast radius and weak test coverage.`,accent:e.riskDistribution.high>0?`red`:`emerald`}),(0,w.jsx)(ar,{label:`Untested Reach`,value:er(e.untestedBlastRadius),sub:`of ${er(e.totalBlastRadius)} total`,hint:`Dependency edges that no test currently exercises.`,accent:e.untestedBlastRadius>e.testedBlastRadius?`red`:`emerald`}),(0,w.jsx)(ar,{label:`Modules`,value:String(t.communityCount),sub:`${er(t.fileCount)} files`,hint:`Clusters of files that change together (auto-detected).`}),e.mostCoupledPair?(0,w.jsx)(ar,{label:`Tightest Co-Change Pair`,value:String(e.mostCoupledPair.weight),sub:`${e.mostCoupledPair.from.slice(0,16)}…`,hint:`Two files edited together this many times — likely coupled.`,accent:e.mostCoupledPair.weight>=10?`amber`:void 0}):(0,w.jsx)(ar,{label:`Drift`,value:er(t.driftCount),sub:t.driftCount>0?`entities drifted`:`clean`,hint:`Entities modified since the graph was last indexed.`})]})]})]})]})}function ar({label:e,value:t,sub:n,hint:r,accent:i,onClick:a}){return(0,w.jsxs)(a?`button`:`div`,{type:a?`button`:void 0,onClick:a,className:`glass-panel rounded-xl px-4 py-3 w-full ${a?`cursor-pointer hover:el-raised transition-colors text-left`:``}`,title:r,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-[10px] uppercase tracking-wider`,children:e}),(0,w.jsx)(`div`,{className:`mt-1 text-xl font-semibold font-mono ${i===`emerald`?`text-emerald-400`:i===`red`?`text-red-400`:i===`amber`?`text-amber-400`:`text-foreground-emphasis`}`,children:t}),n&&(0,w.jsx)(`div`,{className:`mt-0.5 t-tertiary text-[10px]`,children:n}),r&&(0,w.jsx)(`div`,{className:`mt-1 text-[10px] text-muted-foreground leading-snug`,children:r})]})}var or={"blast-radius-coverage":{label:`View hotspots`,action:`scroll`,target:`section-risk-hotspots`},bottlenecks:{label:`View bottlenecks`,action:`scroll`,target:`section-risk-hotspots`},"risk-concentration":{label:`View top 5`,action:`scroll`,target:`section-risk-hotspots`},"coupling-hotspot":{label:`View module graph`,action:`route`,target:`visual`},"no-high-risk":null};function sr({cards:e}){if(e.length===0)return null;let t=e=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})};return(0,w.jsxs)(`section`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:`What needs your attention`}),(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`ranked findings your IDE can't surface — start here`})]}),(0,w.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:e.map(e=>{let n=Zn[e.severity]??Zn.info,r=or[e.id]??null;return(0,w.jsxs)(`div`,{className:`rounded-xl border ${n.border} ${n.bg} p-4 transition-colors flex flex-col`,children:[(0,w.jsxs)(`div`,{className:`flex items-start gap-3 flex-1`,children:[(0,w.jsx)(`span`,{className:`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-xs font-bold ${n.iconColor}`,children:n.icon}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-foreground-emphasis leading-snug`,children:e.title}),(0,w.jsx)(`p`,{className:`mt-1.5 text-xs t-secondary leading-relaxed`,children:e.description}),e.metric!==void 0&&e.metricLabel&&(0,w.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`font-mono text-sm font-semibold text-foreground-emphasis`,children:e.metric}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] uppercase tracking-wider`,children:e.metricLabel})]})]})]}),r&&(0,w.jsx)(`div`,{className:`mt-3 pt-3 border-t border-border-subtle/40`,children:(0,w.jsxs)(`button`,{type:`button`,onClick:()=>r.action===`scroll`?t(r.target):y(r.target),className:`text-xs text-violet-400 hover:text-violet-300 transition-colors font-medium`,children:[r.label,` →`]})})]},e.id)})})]})}function cr({hotspots:e,bottlenecks:t,isLoading:n,isError:r}){let i=e.slice(0,3),a=e.slice(3),o=new Set(t.map(e=>e.key)),s=e=>{window.location.hash=`#/visual?entity=${encodeURIComponent(e)}`};return(0,w.jsxs)(`section`,{id:`section-risk-hotspots`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:`Risk Hotspots`}),(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`files where a small change can cascade — fix these first`})]}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(`visual`),className:`text-xs text-violet-400 hover:text-violet-300 transition-colors`,children:`View map →`})]}),n?(0,w.jsx)(qt,{cols:4,rows:6}):r?(0,w.jsx)(`div`,{className:`glass-panel rounded-xl px-4 py-6`,children:(0,w.jsx)(`p`,{className:`text-error text-sm`,children:`Could not load risk data — graph may still be indexing.`})}):e.length===0?(0,w.jsx)(`div`,{className:`glass-panel rounded-xl px-4 py-6 text-center`,children:(0,w.jsx)(`p`,{className:`t-secondary text-sm`,children:`No entities indexed yet.`})}):(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:i.map((e,t)=>{let n=o.has(e.key);return(0,w.jsxs)(`button`,{type:`button`,onClick:()=>s(e.key),className:`glass-panel rounded-xl p-4 text-left w-full cursor-pointer hover:el-raised transition-all`,"aria-label":`Open ${e.name} in graph visualizer`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,w.jsxs)(`span`,{className:`text-[10px] font-medium t-tertiary uppercase tracking-wider`,children:[`#`,t+1,` highest risk`]}),(0,w.jsx)(nr,{level:e.risk_level})]}),(0,w.jsx)(`div`,{className:`font-mono text-sm font-medium text-foreground-emphasis truncate`,children:e.name}),(0,w.jsx)(`div`,{className:`mt-1 text-[10px] t-tertiary truncate`,children:e.file_path}),(0,w.jsxs)(`div`,{className:`mt-3 flex items-center gap-3 text-xs`,title:`Called by ${e.fan_in} places · calls ${e.fan_out} things`,children:[(0,w.jsxs)(`div`,{className:`font-mono`,children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`called by `}),(0,w.jsx)(`span`,{className:Xn[e.risk_level]??`text-foreground`,children:e.fan_in})]}),(0,w.jsxs)(`div`,{className:`font-mono`,children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`calls `}),(0,w.jsx)(`span`,{className:`text-foreground`,children:e.fan_out})]}),(0,w.jsx)(rr,{count:e.test_count})]}),n&&(0,w.jsx)(`div`,{className:`mt-2 rounded-md bg-red-500/10 px-2 py-1 text-[10px] text-red-400 font-medium`,children:`Structural bottleneck`})]},e.key)})}),a.length>0&&(0,w.jsx)(`div`,{className:`glass-panel rounded-xl overflow-hidden`,children:(0,w.jsx)(`div`,{className:`custom-scrollbar max-h-[320px] overflow-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,w.jsx)(`thead`,{className:`sticky top-0 bg-surface-overlay/95 backdrop-blur-sm`,children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle t-tertiary text-left`,children:[(0,w.jsx)(`th`,{className:`py-2 pl-4 pr-2 font-medium`,children:`Entity`}),(0,w.jsx)(`th`,{className:`py-2 px-2 font-medium`,children:`Kind`}),(0,w.jsx)(`th`,{className:`py-2 px-2 font-medium text-right`,title:`Number of places that depend on this entity`,children:`Called By`}),(0,w.jsx)(`th`,{className:`py-2 px-2 font-medium text-right`,title:`Number of things this entity uses`,children:`Calls`}),(0,w.jsx)(`th`,{className:`py-2 px-2 font-medium`,children:`Risk`}),(0,w.jsx)(`th`,{className:`py-2 px-2 font-medium`,children:`Tests`}),(0,w.jsx)(`th`,{className:`py-2 px-2 pr-4 font-medium`,children:`Module`})]})}),(0,w.jsx)(`tbody`,{className:`divide-y divide-border-subtle`,children:a.map(e=>(0,w.jsxs)(`tr`,{onClick:()=>s(e.key),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),s(e.key))},tabIndex:0,role:`button`,"aria-label":`Open ${e.name} in graph visualizer`,className:`transition-colors hover:el-raised cursor-pointer focus:outline-none focus-visible:ring-1 focus-visible:ring-violet-500`,children:[(0,w.jsxs)(`td`,{className:`py-2 pl-4 pr-2`,children:[(0,w.jsx)(`div`,{className:`font-mono text-foreground-emphasis truncate max-w-[180px]`,children:e.name}),(0,w.jsx)(`div`,{className:`t-tertiary truncate max-w-[180px]`,children:e.file_path})]}),(0,w.jsx)(`td`,{className:`py-2 px-2`,children:(0,w.jsx)(`span`,{className:`rounded bg-surface-raised px-1.5 py-0.5 text-[10px] t-tertiary`,children:e.kind})}),(0,w.jsx)(`td`,{className:`py-2 px-2 text-right font-mono ${Xn[e.risk_level]??``}`,children:e.fan_in}),(0,w.jsx)(`td`,{className:`py-2 px-2 text-right font-mono`,children:e.fan_out}),(0,w.jsx)(`td`,{className:`py-2 px-2`,children:(0,w.jsx)(nr,{level:e.risk_level})}),(0,w.jsx)(`td`,{className:`py-2 px-2`,children:(0,w.jsx)(rr,{count:e.test_count})}),(0,w.jsx)(`td`,{className:`py-2 px-2 pr-4`,children:(0,w.jsx)(`span`,{className:`text-violet-400/60 truncate max-w-[100px] inline-block`,children:e.community_label||`—`})})]},e.key))})]})})})]})]})}function lr({coverage:e}){if(e.length===0)return null;let t=[{key:`comment`,label:`comment`,color:`bg-emerald-400`},{key:`harvested`,label:`harvested`,color:`bg-cyan-400`},{key:`propagated`,label:`propagated`,color:`bg-amber-400`},{key:`path`,label:`path`,color:`bg-surface-overlay`}];return(0,w.jsxs)(`section`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:`Domain Coverage`}),(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`how each domain is tagged — durable (comment/harvested) vs. inferred (propagated/path)`})]}),(0,w.jsxs)(`div`,{className:`glass-panel rounded-xl p-4 space-y-3`,children:[e.map(e=>{let n=e.durablePct>=75?`text-emerald-400`:e.durablePct>=40?`text-amber-400`:`text-red-400`;return(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,w.jsxs)(`span`,{className:`text-sm font-medium text-foreground-emphasis truncate max-w-[200px]`,children:[e.domain,(0,w.jsxs)(`span`,{className:`ml-2 t-tertiary font-mono text-[10px]`,children:[e.total,` entities`]})]}),(0,w.jsxs)(`span`,{className:`font-mono text-sm font-semibold ${n}`,children:[e.durablePct,`% durable`]})]}),(0,w.jsx)(`div`,{className:`flex h-2 rounded-full overflow-hidden bg-surface-overlay`,children:t.map(t=>{let n=e.total>0?e[t.key]/e.total*100:0;return n===0?null:(0,w.jsx)(`div`,{className:t.color,style:{width:`${n}%`},title:`${t.label}: ${e[t.key]}`},t.key)})})]},e.domain)}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 pt-1`,children:t.map(e=>(0,w.jsxs)(`span`,{className:`flex items-center gap-1 t-tertiary text-[10px]`,children:[(0,w.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-sm ${e.color}`}),e.label]},e.key))})]})]})}function ur({communities:e,onSelectModule:t}){return e.length===0?null:(0,w.jsxs)(`section`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,w.jsx)(`h2`,{className:`section-label text-violet-500`,children:`Module Health`}),(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`which parts of the codebase are well-tested vs. exposed`})]}),(0,w.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`,children:e.map(e=>{let n=e.blastRadiusCoveragePct>=75?`text-emerald-400`:e.blastRadiusCoveragePct>=50?`text-amber-400`:`text-red-400`,r=e.blastRadiusCoveragePct>=75?`bg-emerald-400`:e.blastRadiusCoveragePct>=50?`bg-amber-400`:`bg-red-400`;return(0,w.jsxs)(`button`,{type:`button`,onClick:()=>t(e.label),className:`glass-panel rounded-xl p-4 text-left w-full cursor-pointer hover:el-raised transition-all`,"aria-label":`Open ${e.label} in File Health Map`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium text-foreground-emphasis truncate max-w-[160px]`,children:e.domain?(0,w.jsxs)(w.Fragment,{children:[e.domain,typeof e.domainPurityPct==`number`?(0,w.jsxs)(`span`,{className:`ml-1 t-tertiary font-mono text-[10px]`,children:[e.domainPurityPct,`% pure`]}):null,(0,w.jsx)(`span`,{className:`block t-tertiary text-[10px] truncate`,children:e.label})]}):e.label}),(0,w.jsxs)(`span`,{className:`font-mono text-sm font-semibold ${n}`,children:[e.blastRadiusCoveragePct,`%`]})]}),(0,w.jsx)(`div`,{className:`h-1.5 rounded-full bg-surface-overlay overflow-hidden mb-3`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full ${r} transition-all duration-500`,style:{width:`${e.blastRadiusCoveragePct}%`}})}),(0,w.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-[10px]`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`t-tertiary`,children:`Entities`}),(0,w.jsx)(`div`,{className:`font-mono text-foreground-emphasis`,children:e.entities})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`t-tertiary`,children:`Tested`}),(0,w.jsx)(`div`,{className:`font-mono text-emerald-400`,children:e.tested})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`t-tertiary`,children:`Untested`}),(0,w.jsx)(`div`,{className:`font-mono ${e.untested>0?`text-red-400`:`text-emerald-400`}`,children:e.untested})]})]}),(e.riskHigh>0||e.riskMedium>0)&&(0,w.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5 flex-wrap`,children:[e.riskHigh>0&&(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-red-500/10 px-1.5 py-0.5 text-[10px] text-red-400`,children:[(0,w.jsx)(`span`,{className:`h-1 w-1 rounded-full bg-red-400`}),e.riskHigh,` high`]}),e.riskMedium>0&&(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-400`,children:[(0,w.jsx)(`span`,{className:`h-1 w-1 rounded-full bg-amber-400`}),e.riskMedium,` med`]})]})]},e.label)})})]})}function dr(){return typeof window>`u`?`overview`:window.location.hash.replace(/^#/,``).trim().split(`/`).filter(Boolean)[1]===`file-health`?`file-health`:`overview`}function fr(e){let t=e===`file-health`?`#/graph/file-health`:`#/graph`;window.location.hash!==t&&window.history.replaceState(null,``,t)}function pr(){let[e,t]=(0,f.useState)(()=>dr()),[n,r]=(0,f.useState)(void 0),i=e=>{t(e),fr(e)},a=e=>{r(e),i(`file-health`)};(0,f.useEffect)(()=>{let e=()=>t(dr());return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let{url:o,queryKey:s}=Ot(),c=N({queryKey:s([`intelligence`,`graph-stats`]),queryFn:()=>O(o(`/api/intelligence/graph-stats`)),enabled:e===`overview`}),l=N({queryKey:s([`intelligence`,`insights`]),queryFn:()=>O(o(`/api/intelligence/insights`)),enabled:e===`overview`}),u=N({queryKey:s([`intelligence`,`risk-hotspots`]),queryFn:()=>O(o(`/api/intelligence/risk-hotspots?limit=25`)),enabled:e===`overview`}),d=N({queryKey:s([`session`,`efficiency`]),queryFn:()=>O(o(`/api/session/efficiency`)),enabled:e===`overview`,staleTime:1e4}),p=N({queryKey:s([`session`,`intents`]),queryFn:()=>O(o(`/api/session/intents`)),enabled:e===`overview`,staleTime:1e4}),m=N({queryKey:s([`intelligence`,`reading-tour`]),queryFn:()=>O(o(`/api/intelligence/reading-tour?limit=5`)),enabled:e===`overview`,staleTime:5*6e4}).data?.data,h=!!m&&m.stops.length>=3&&(d.data?.data?.totalCalls??0)===0&&(p.data?.data?.length??0)===0,g=l.data?.data,_=(u.data?.data??[]).sort((e,t)=>$n(t)-$n(e));return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsxs)(`div`,{className:`inline-flex rounded-lg border border-border-subtle bg-sidebar p-1`,role:`tablist`,"aria-label":`Code Intelligence view`,children:[(0,w.jsx)(mr,{active:e===`overview`,onClick:()=>i(`overview`),children:`Overview`}),(0,w.jsx)(mr,{active:e===`file-health`,onClick:()=>i(`file-health`),children:`File Health Map`})]}),e===`overview`?(0,w.jsxs)(`div`,{className:`space-y-8`,children:[(0,w.jsx)(gr,{efficiency:d.data?.data??null,intents:p.data?.data??null,hotspots:_}),h&&m&&(0,w.jsx)(hr,{stops:m.stops,estimatedReadingTimeMin:m.estimatedReadingTimeMin}),g&&(0,w.jsx)(sr,{cards:g.insights}),(0,w.jsx)(cr,{hotspots:_,bottlenecks:g?.bottlenecks??[],isLoading:u.isLoading,isError:u.isError}),(0,w.jsx)(ir,{insights:g??null,stats:c.data?.data??null,isLoading:c.isLoading||l.isLoading}),g&&(0,w.jsx)(ur,{communities:g.communityHealth,onSelectModule:a}),g?.domainCoverage&&g.domainCoverage.length>0&&(0,w.jsx)(lr,{coverage:g.domainCoverage})]}):(0,w.jsx)(qn,{initialFilter:n})]})}function mr({active:e,onClick:t,children:n}){return(0,w.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e,onClick:t,className:`px-4 py-1.5 text-sm rounded-md transition-colors ${e?`el-raised font-medium text-foreground-emphasis`:`text-muted-foreground hover:text-foreground`}`,children:n})}function hr({stops:e,estimatedReadingTimeMin:t}){let[n,r]=(0,f.useState)(0),i=e[n],a=e=>{window.location.hash=`#/visual?entity=${encodeURIComponent(e)}`};return(0,w.jsxs)(`section`,{"aria-label":`Reading tour`,className:`rounded-xl border border-violet-500/30 bg-violet-500/5 p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,w.jsx)(`span`,{className:`text-[10px] font-medium text-violet-300 uppercase tracking-wider`,children:`New to this codebase?`})}),(0,w.jsx)(`h2`,{className:`mt-1 text-base font-semibold text-foreground-emphasis`,children:`Reading Tour — start here`}),(0,w.jsxs)(`p`,{className:`mt-1 text-xs t-secondary leading-relaxed max-w-2xl`,children:[e.length,` files form the structural backbone of this repo. Reading them in order gives you ~80% of the architecture in about`,` `,t,` minutes.`]})]}),(0,w.jsxs)(`div`,{className:`t-tertiary text-[10px] uppercase tracking-wider shrink-0`,children:[n+1,` / `,e.length]})]}),(0,w.jsx)(`div`,{className:`flex gap-1.5 mb-4 overflow-x-auto custom-scrollbar pb-1`,children:e.map((e,t)=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>r(t),className:`shrink-0 px-3 py-1.5 rounded-md text-xs transition-colors ${t===n?`bg-violet-500/30 text-violet-100 font-medium`:`bg-surface-overlay/40 text-muted-foreground hover:text-foreground`}`,children:[(0,w.jsxs)(`span`,{className:`text-[10px] mr-1.5 opacity-60`,children:[`#`,e.rank]}),e.name]},e.key))}),i&&(0,w.jsxs)(`div`,{className:`rounded-lg bg-surface-overlay/40 border border-border-subtle p-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 mb-1`,children:[(0,w.jsx)(`div`,{className:`font-mono text-sm text-foreground-emphasis truncate`,children:i.name}),(0,w.jsx)(`span`,{className:`text-[10px] t-tertiary uppercase tracking-wider shrink-0`,children:i.kind})]}),(0,w.jsx)(`div`,{className:`t-tertiary text-[11px] font-mono truncate mb-2`,children:i.file_path}),(0,w.jsx)(`p`,{className:`text-xs t-secondary leading-relaxed`,children:i.why}),(0,w.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>a(i.key),className:`text-xs text-violet-400 hover:text-violet-300 transition-colors font-medium`,children:`Open in graph →`}),n>0&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>r(e=>e-1),className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:`← Prev`}),n<e.length-1&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>r(e=>e+1),className:`text-xs text-muted-foreground hover:text-foreground transition-colors`,children:`Next →`})]})]})]})}function gr({efficiency:e,intents:t,hotspots:n}){let r=e?.savedTokens??0,i=new Set(n.map(e=>e.key)),a=new Set;if(t)for(let e of t)for(let t of e.entitiesModified??[])i.has(t)&&a.add(t);return r>0||a.size>0?(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2 rounded-lg border border-violet-500/20 bg-violet-500/5 px-4 py-2.5 text-xs`,children:[(0,w.jsx)(`span`,{className:`t-tertiary uppercase tracking-wider text-[10px]`,children:`This session`}),a.size>0&&(0,w.jsxs)(`button`,{type:`button`,onClick:()=>document.getElementById(`section-risk-hotspots`)?.scrollIntoView({behavior:`smooth`,block:`start`}),className:`flex items-center gap-1.5 text-foreground hover:text-violet-300 transition-colors`,children:[(0,w.jsx)(`span`,{className:`text-amber-400 font-semibold`,children:a.size}),(0,w.jsxs)(`span`,{children:[`hotspot`,a.size===1?``:`s`,` touched`]}),(0,w.jsx)(`span`,{className:`text-violet-400`,children:`→`})]}),r>0&&(0,w.jsxs)(`button`,{type:`button`,onClick:()=>y(`reasoning`),className:`flex items-center gap-1.5 text-foreground hover:text-cyan-300 transition-colors`,title:`Counted on operations unerr handled (file reads, web fetches, shell output, dedup). Not whole-turn savings.`,children:[(0,w.jsx)(`span`,{className:`text-emerald-400 font-semibold`,children:(e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e))(r)}),(0,w.jsx)(`span`,{children:`tokens saved today · on ops unerr handled`}),(0,w.jsx)(`span`,{className:`text-cyan-400`,children:`→`})]})]}):null}function _r(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>`u`)){var r=document.head||document.getElementsByTagName(`head`)[0],i=document.createElement(`style`);i.type=`text/css`,n===`top`&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}_r(`div.vis-network div.vis-manipulation {
|
|
9
9
|
box-sizing: content-box;
|
|
10
10
|
|
|
@@ -912,9 +912,9 @@ input.vis-configuration.vis-config-range:focus::-ms-fill-upper {
|
|
|
912
912
|
`,Wx()):K+=G,Wx();if(G!=`"`)throw sS(`End of string " expected`);Wx(),Hx=Rx.IDENTIFIER;return}for(Hx=Rx.UNKNOWN;G!=``;)K+=G,Wx();throw SyntaxError(`Syntax error in part "`+cS(K,30)+`"`)}function $x(){var e={};if(Ux(),Qx(),K===`strict`&&(e.strict=!0,Qx()),(K===`graph`||K===`digraph`)&&(e.type=K,Qx()),Hx===Rx.IDENTIFIER&&(e.id=K,Qx()),K!=`{`)throw sS(`Angle bracket { expected`);if(Qx(),eS(e),K!=`}`)throw sS(`Angle bracket } expected`);if(Qx(),K!==``)throw sS(`End of file expected`);return Qx(),delete e.node,delete e.edge,delete e.graph,e}function eS(e){for(;K!==``&&K!=`}`;)tS(e),K===`;`&&Qx()}function tS(e){var t=nS(e);if(t){aS(e,t);return}if(!rS(e)){if(Hx!=Rx.IDENTIFIER)throw sS(`Identifier expected`);var n=K;if(Qx(),K===`=`){if(Qx(),Hx!=Rx.IDENTIFIER)throw sS(`Identifier expected`);e[n]=K,Qx()}else iS(e,n)}}function nS(e){var t=null;if(K===`subgraph`&&(t={},t.type=`subgraph`,Qx(),Hx===Rx.IDENTIFIER&&(t.id=K,Qx())),K===`{`){if(Qx(),t||={},t.parent=e,t.node=e.node,t.edge=e.edge,t.graph=e.graph,eS(t),K!=`}`)throw sS(`Angle bracket } expected`);Qx(),delete t.node,delete t.edge,delete t.graph,delete t.parent,e.subgraphs||=[],e.subgraphs.push(t)}return t}function rS(e){return K===`node`?(Qx(),e.node=oS(),`node`):K===`edge`?(Qx(),e.edge=oS(),`edge`):K===`graph`?(Qx(),e.graph=oS(),`graph`):null}function iS(e,t){var n={id:t},r=oS();r&&(n.attr=r),Yx(e,n),aS(e,t)}function aS(e,t){for(;K===`->`||K===`--`;){var n,r=K;Qx();var i=nS(e);if(i)n=i;else{if(Hx!=Rx.IDENTIFIER)throw sS(`Identifier or subgraph expected`);n=K,Yx(e,{id:n}),Qx()}var a=oS();Xx(e,Zx(e,t,n,r,a)),t=n}}function oS(){for(var e,t=null,n={dashed:!0,solid:!1,dotted:[1,5]},r={dot:`circle`,box:`box`,crow:`crow`,curve:`curve`,icurve:`inv_curve`,normal:`triangle`,inv:`inv_triangle`,diamond:`diamond`,tee:`bar`,vee:`vee`},i=[],a=[];K===`[`;){for(Qx(),t={};K!==``&&K!=`]`;){if(Hx!=Rx.IDENTIFIER)throw sS(`Attribute name expected`);var o=K;if(Qx(),K!=`=`)throw sS(`Equal sign = expected`);if(Qx(),Hx!=Rx.IDENTIFIER)throw sS(`Attribute value expected`);var s=K;o===`style`&&(s=n[s]);var c;o===`arrowhead`&&(c=r[s],o=`arrows`,s={to:{enabled:!0,type:c}}),o===`arrowtail`&&(c=r[s],o=`arrows`,s={from:{enabled:!0,type:c}}),i.push({attr:t,name:o,value:s}),a.push(o),Qx(),K==`,`&&Qx()}if(K!=`]`)throw sS(`Bracket ] expected`);Qx()}if(Km(a).call(a,`dir`)){var l={};for(l.arrows={},e=0;e<i.length;e++)if(i[e].name===`arrows`)if(i[e].value.to!=null)l.arrows.to=e;else if(i[e].value.from!=null)l.arrows.from=e;else throw sS(`Invalid value of arrows`);else i[e].name===`dir`&&(l.dir=e);var u=i[l.dir].value;if(!Km(a).call(a,`arrows`))if(u===`both`)i.push({attr:i[l.dir].attr,name:`arrows`,value:{to:{enabled:!0}}}),l.arrows.to=i.length-1,i.push({attr:i[l.dir].attr,name:`arrows`,value:{from:{enabled:!0}}}),l.arrows.from=i.length-1;else if(u===`forward`)i.push({attr:i[l.dir].attr,name:`arrows`,value:{to:{enabled:!0}}}),l.arrows.to=i.length-1;else if(u===`back`)i.push({attr:i[l.dir].attr,name:`arrows`,value:{from:{enabled:!0}}}),l.arrows.from=i.length-1;else if(u===`none`)i.push({attr:i[l.dir].attr,name:`arrows`,value:``}),l.arrows.to=i.length-1;else throw sS(`Invalid dir type "`+u+`"`);var d,f;if(u===`both`)l.arrows.to&&l.arrows.from?(f=i[l.arrows.to].value.to.type,d=i[l.arrows.from].value.from.type,i[l.arrows.to]={attr:i[l.arrows.to].attr,name:i[l.arrows.to].name,value:{to:{enabled:!0,type:f},from:{enabled:!0,type:d}}},hm(i).call(i,l.arrows.from,1)):l.arrows.to?(f=i[l.arrows.to].value.to.type,d=`arrow`,i[l.arrows.to]={attr:i[l.arrows.to].attr,name:i[l.arrows.to].name,value:{to:{enabled:!0,type:f},from:{enabled:!0,type:d}}}):l.arrows.from&&(f=`arrow`,d=i[l.arrows.from].value.from.type,i[l.arrows.from]={attr:i[l.arrows.from].attr,name:i[l.arrows.from].name,value:{to:{enabled:!0,type:f},from:{enabled:!0,type:d}}});else if(u===`back`)l.arrows.to&&l.arrows.from?(f=``,d=i[l.arrows.from].value.from.type,i[l.arrows.from]={attr:i[l.arrows.from].attr,name:i[l.arrows.from].name,value:{to:{enabled:!0,type:f},from:{enabled:!0,type:d}}}):l.arrows.to?(f=``,d=`arrow`,l.arrows.from=l.arrows.to,i[l.arrows.from]={attr:i[l.arrows.from].attr,name:i[l.arrows.from].name,value:{to:{enabled:!0,type:f},from:{enabled:!0,type:d}}}):l.arrows.from&&(f=``,d=i[l.arrows.from].value.from.type,i[l.arrows.to]={attr:i[l.arrows.from].attr,name:i[l.arrows.from].name,value:{to:{enabled:!0,type:f},from:{enabled:!0,type:d}}}),i[l.arrows.from]={attr:i[l.arrows.from].attr,name:i[l.arrows.from].name,value:{from:{enabled:!0,type:i[l.arrows.from].value.from.type}}};else if(u===`none`){var p=l.arrows.to?l.arrows.to:l.arrows.from;i[p]={attr:i[p].attr,name:i[p].name,value:``}}else if(u===`forward`)l.arrows.to&&l.arrows.from||l.arrows.to?(f=i[l.arrows.to].value.to.type,d=``,i[l.arrows.to]={attr:i[l.arrows.to].attr,name:i[l.arrows.to].name,value:{to:{enabled:!0,type:f},from:{enabled:!0,type:d}}}):l.arrows.from&&(f=`arrow`,d=``,l.arrows.to=l.arrows.from,i[l.arrows.to]={attr:i[l.arrows.to].attr,name:i[l.arrows.to].name,value:{to:{enabled:!0,type:f},from:{enabled:!0,type:d}}}),i[l.arrows.to]={attr:i[l.arrows.to].attr,name:i[l.arrows.to].name,value:{to:{enabled:!0,type:i[l.arrows.to].value.to.type}}};else throw sS(`Invalid dir type "`+u+`"`);hm(i).call(i,l.dir,1)}var m;if(Km(a).call(a,`penwidth`)){var h=[];for(m=i.length,e=0;e<m;e++)i[e].name!==`width`&&(i[e].name===`penwidth`&&(i[e].name=`width`),h.push(i[e]));i=h}for(m=i.length,e=0;e<m;e++)Jx(i[e].attr,i[e].name,i[e].value);return t}function sS(e){return SyntaxError(e+`, got "`+cS(K,30)+`" (char `+Vx+`)`)}function cS(e,t){return e.length<=t?e:e.substr(0,27)+`...`}function lS(e,t,n){W(e)?jp(e).call(e,function(e){W(t)?jp(t).call(t,function(t){n(e,t)}):n(e,t)}):W(t)?jp(t).call(t,function(t){n(e,t)}):n(e,t)}function uS(e,t,n){for(var r=t.split(`.`),i=r.pop(),a=e,o=0;o<r.length;o++){var s=r[o];s in a||(a[s]={}),a=a[s]}return a[i]=n,e}function dS(e,t){var n={};for(var r in e)if(e.hasOwnProperty(r)){var i=t[r];W(i)?jp(i).call(i,function(t){uS(n,t,e[r])}):typeof i==`string`?uS(n,i,e[r]):uS(n,r,e[r])}return n}function fS(e){var t=Fx(e),n={nodes:[],edges:[],options:{}};if(t.nodes){var r;jp(r=t.nodes).call(r,function(e){var t={id:e.id,label:String(e.label||e.id)};qx(t,dS(e.attr,Ix)),t.image&&(t.shape=`image`),n.nodes.push(t)})}if(t.edges){var i,a=function(e){var t={from:e.from,to:e.to};return qx(t,dS(e.attr,Lx)),t.arrows==null&&e.type===`->`&&(t.arrows=`to`),t};jp(i=t.edges).call(i,function(e){var t=e.from instanceof Object?e.from.nodes:{id:e.from},r=e.to instanceof Object?e.to.nodes:{id:e.to};if(e.from instanceof Object&&e.from.edges){var i;jp(i=e.from.edges).call(i,function(e){var t=a(e);n.edges.push(t)})}if(lS(t,r,function(t,r){var i=a(Zx(n,t.id,r.id,e.type,e.attr));n.edges.push(i)}),e.to instanceof Object&&e.to.edges){var o;jp(o=e.to.edges).call(o,function(e){var t=a(e);n.edges.push(t)})}})}return t.attr&&(n.options=t.attr),n}function pS(e,t){var n;let r={edges:{inheritColor:!1},nodes:{fixed:!1,parseColor:!1}};t!=null&&(t.fixed!=null&&(r.nodes.fixed=t.fixed),t.parseColor!=null&&(r.nodes.parseColor=t.parseColor),t.inheritColor!=null&&(r.edges.inheritColor=t.inheritColor));let i=e.edges,a=Lf(i).call(i,e=>{let t={from:e.source,id:e.id,to:e.target};return e.attributes!=null&&(t.attributes=e.attributes),e.label!=null&&(t.label=e.label),e.attributes!=null&&e.attributes.title!=null&&(t.title=e.attributes.title),e.type===`Directed`&&(t.arrows=`to`),e.color&&r.edges.inheritColor===!1&&(t.color=e.color),t});return{nodes:Lf(n=e.nodes).call(n,e=>{let t={id:e.id,fixed:r.nodes.fixed&&e.x!=null&&e.y!=null};return e.attributes!=null&&(t.attributes=e.attributes),e.label!=null&&(t.label=e.label),e.size!=null&&(t.size=e.size),e.attributes!=null&&e.attributes.title!=null&&(t.title=e.attributes.title),e.title!=null&&(t.title=e.title),e.x!=null&&(t.x=e.x),e.y!=null&&(t.y=e.y),e.color!=null&&(r.nodes.parseColor===!0?t.color=e.color:t.color={background:e.color,border:e.color,highlight:{background:e.color,border:e.color},hover:{background:e.color,border:e.color}}),t}),edges:a}}var mS=Object.freeze({__proto__:null,cn:{addDescription:`单击空白处放置新节点。`,addEdge:`添加连接线`,addNode:`添加节点`,back:`返回`,close:`關閉`,createEdgeError:`无法将连接线连接到群集。`,del:`删除选定`,deleteClusterError:`无法删除群集。`,edgeDescription:`单击某个节点并将该连接线拖动到另一个节点以连接它们。`,edit:`编辑`,editClusterError:`无法编辑群集。`,editEdge:`编辑连接线`,editEdgeDescription:`单击控制节点并将它们拖到节点上连接。`,editNode:`编辑节点`},cs:{addDescription:`Kluknutím do prázdného prostoru můžete přidat nový vrchol.`,addEdge:`Přidat hranu`,addNode:`Přidat vrchol`,back:`Zpět`,close:`Zavřít`,createEdgeError:`Nelze připojit hranu ke shluku.`,del:`Smazat výběr`,deleteClusterError:`Nelze mazat shluky.`,edgeDescription:`Přetažením z jednoho vrcholu do druhého můžete spojit tyto vrcholy novou hranou.`,edit:`Upravit`,editClusterError:`Nelze upravovat shluky.`,editEdge:`Upravit hranu`,editEdgeDescription:`Přetažením kontrolního vrcholu hrany ji můžete připojit k jinému vrcholu.`,editNode:`Upravit vrchol`},de:{addDescription:`Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.`,addEdge:`Kante hinzufügen`,addNode:`Knoten hinzufügen`,back:`Zurück`,close:`Schließen`,createEdgeError:`Es ist nicht möglich, Kanten mit Clustern zu verbinden.`,del:`Lösche Auswahl`,deleteClusterError:`Cluster können nicht gelöscht werden.`,edgeDescription:`Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.`,edit:`Editieren`,editClusterError:`Cluster können nicht editiert werden.`,editEdge:`Kante editieren`,editEdgeDescription:`Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.`,editNode:`Knoten editieren`},en:{addDescription:`Click in an empty space to place a new node.`,addEdge:`Add Edge`,addNode:`Add Node`,back:`Back`,close:`Close`,createEdgeError:`Cannot link edges to a cluster.`,del:`Delete selected`,deleteClusterError:`Clusters cannot be deleted.`,edgeDescription:`Click on a node and drag the edge to another node to connect them.`,edit:`Edit`,editClusterError:`Clusters cannot be edited.`,editEdge:`Edit Edge`,editEdgeDescription:`Click on the control points and drag them to a node to connect to it.`,editNode:`Edit Node`},es:{addDescription:`Haga clic en un lugar vacío para colocar un nuevo nodo.`,addEdge:`Añadir arista`,addNode:`Añadir nodo`,back:`Atrás`,close:`Cerrar`,createEdgeError:`No se puede conectar una arista a un grupo.`,del:`Eliminar selección`,deleteClusterError:`No es posible eliminar grupos.`,edgeDescription:`Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.`,edit:`Editar`,editClusterError:`No es posible editar grupos.`,editEdge:`Editar arista`,editEdgeDescription:`Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.`,editNode:`Editar nodo`},fr:{addDescription:`Cliquez dans un endroit vide pour placer un nœud.`,addEdge:`Ajouter un lien`,addNode:`Ajouter un nœud`,back:`Retour`,close:`Fermer`,createEdgeError:`Impossible de créer un lien vers un cluster.`,del:`Effacer la sélection`,deleteClusterError:`Les clusters ne peuvent pas être effacés.`,edgeDescription:`Cliquez sur un nœud et glissez le lien vers un autre nœud pour les connecter.`,edit:`Éditer`,editClusterError:`Les clusters ne peuvent pas être édités.`,editEdge:`Éditer le lien`,editEdgeDescription:`Cliquez sur les points de contrôle et glissez-les pour connecter un nœud.`,editNode:`Éditer le nœud`},it:{addDescription:`Clicca per aggiungere un nuovo nodo`,addEdge:`Aggiungi un vertice`,addNode:`Aggiungi un nodo`,back:`Indietro`,close:`Chiudere`,createEdgeError:`Non si possono collegare vertici ad un cluster`,del:`Cancella la selezione`,deleteClusterError:`I cluster non possono essere cancellati`,edgeDescription:`Clicca su un nodo e trascinalo ad un altro nodo per connetterli.`,edit:`Modifica`,editClusterError:`I clusters non possono essere modificati.`,editEdge:`Modifica il vertice`,editEdgeDescription:`Clicca sui Punti di controllo e trascinali ad un nodo per connetterli.`,editNode:`Modifica il nodo`},nl:{addDescription:`Klik op een leeg gebied om een nieuwe node te maken.`,addEdge:`Link toevoegen`,addNode:`Node toevoegen`,back:`Terug`,close:`Sluiten`,createEdgeError:`Kan geen link maken naar een cluster.`,del:`Selectie verwijderen`,deleteClusterError:`Clusters kunnen niet worden verwijderd.`,edgeDescription:`Klik op een node en sleep de link naar een andere node om ze te verbinden.`,edit:`Wijzigen`,editClusterError:`Clusters kunnen niet worden aangepast.`,editEdge:`Link wijzigen`,editEdgeDescription:`Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.`,editNode:`Node wijzigen`},pt:{addDescription:`Clique em um espaço em branco para adicionar um novo nó`,addEdge:`Adicionar aresta`,addNode:`Adicionar nó`,back:`Voltar`,close:`Fechar`,createEdgeError:`Não foi possível linkar arestas a um cluster.`,del:`Remover selecionado`,deleteClusterError:`Clusters não puderam ser removidos.`,edgeDescription:`Clique em um nó e arraste a aresta até outro nó para conectá-los`,edit:`Editar`,editClusterError:`Clusters não puderam ser editados.`,editEdge:`Editar aresta`,editEdgeDescription:`Clique nos pontos de controle e os arraste para um nó para conectá-los`,editNode:`Editar nó`},ru:{addDescription:`Кликните в свободное место, чтобы добавить новый узел.`,addEdge:`Добавить ребро`,addNode:`Добавить узел`,back:`Назад`,close:`Закрывать`,createEdgeError:`Невозможно соединить ребра в кластер.`,del:`Удалить выбранное`,deleteClusterError:`Кластеры не могут быть удалены`,edgeDescription:`Кликните на узел и протяните ребро к другому узлу, чтобы соединить их.`,edit:`Редактировать`,editClusterError:`Кластеры недоступны для редактирования.`,editEdge:`Редактировать ребро`,editEdgeDescription:`Кликните на контрольные точки и перетащите их в узел, чтобы подключиться к нему.`,editNode:`Редактировать узел`},uk:{addDescription:`Kлікніть на вільне місце, щоб додати новий вузол.`,addEdge:`Додати край`,addNode:`Додати вузол`,back:`Назад`,close:`Закрити`,createEdgeError:`Не можливо об'єднати краї в групу.`,del:`Видалити обране`,deleteClusterError:`Групи не можуть бути видалені.`,edgeDescription:`Клікніть на вузол і перетягніть край до іншого вузла, щоб їх з'єднати.`,edit:`Редагувати`,editClusterError:`Групи недоступні для редагування.`,editEdge:`Редагувати край`,editEdgeDescription:`Клікніть на контрольні точки і перетягніть їх у вузол, щоб підключитися до нього.`,editNode:`Редагувати вузол`}});function hS(e,t){try{let[r,i]=t.split(/[-_ /]/,2),a=r==null?null:r.toLowerCase(),o=i==null?null:i.toUpperCase();if(a&&o){let t=a+`-`+o;if(Object.prototype.hasOwnProperty.call(e,t))return t;var n;console.warn(vh(n=`Unknown variant ${o} of language `).call(n,a,`.`))}if(a){let t=a;if(Object.prototype.hasOwnProperty.call(e,t))return t;console.warn(`Unknown language ${a}`)}return console.warn(`Unknown locale ${t}, falling back to English.`),`en`}catch(e){return console.error(e),console.warn(`Unexpected error while normalizing locale ${t}, falling back to English.`),`en`}}var gS=class{constructor(){this.NUM_ITERATIONS=4,this.image=new Image,this.canvas=document.createElement(`canvas`)}init(){if(this.initialized())return;this.src=this.image.src;let e=this.image.width,t=this.image.height;this.width=e,this.height=t;let n=Math.floor(t/2),r=Math.floor(t/4),i=Math.floor(t/8),a=Math.floor(t/16),o=Math.floor(e/2),s=Math.floor(e/4),c=Math.floor(e/8),l=Math.floor(e/16);this.canvas.width=3*s,this.canvas.height=n,this.coordinates=[[0,0,o,n],[o,0,s,r],[o,r,c,i],[5*c,r,l,a]],this._fillMipMap()}initialized(){return this.coordinates!==void 0}_fillMipMap(){let e=this.canvas.getContext(`2d`),t=this.coordinates[0];e.drawImage(this.image,t[0],t[1],t[2],t[3]);for(let t=1;t<this.NUM_ITERATIONS;t++){let n=this.coordinates[t-1],r=this.coordinates[t];e.drawImage(this.canvas,n[0],n[1],n[2],n[3],r[0],r[1],r[2],r[3])}}drawImageAtPosition(e,t,n,r,i,a){if(this.initialized())if(t>2){t*=.5;let o=0;for(;t>2&&o<this.NUM_ITERATIONS;)t*=.5,o+=1;o>=this.NUM_ITERATIONS&&(o=this.NUM_ITERATIONS-1);let s=this.coordinates[o];e.drawImage(this.canvas,s[0],s[1],s[2],s[3],n,r,i,a)}else e.drawImage(this.image,n,r,i,a)}},_S=class{constructor(e){this.images={},this.imageBroken={},this.callback=e}_tryloadBrokenUrl(e,t,n){if(!(e===void 0||n===void 0)){if(t===void 0){console.warn(`No broken url image defined`);return}n.image.onerror=()=>{console.error(`Could not load brokenImage:`,t)},n.image.src=t}}_redrawWithImage(e){this.callback&&this.callback(e)}load(e,t){let n=this.images[e];if(n)return n;let r=new gS;return this.images[e]=r,r.image.onload=()=>{this._fixImageCoordinates(r.image),r.init(),this._redrawWithImage(r)},r.image.onerror=()=>{console.error(`Could not load image:`,e),this._tryloadBrokenUrl(e,t,r)},r.image.src=e,r}_fixImageCoordinates(e){e.width===0&&(document.body.appendChild(e),e.width=e.offsetWidth,e.height=e.offsetHeight,document.body.removeChild(e))}},vS={},yS={},bS={exports:{}},xS,SS;function CS(){return SS?xS:(SS=1,xS=F()(function(){if(typeof ArrayBuffer==`function`){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,`a`,{value:8})}}),xS)}var wS,TS;function ES(){if(TS)return wS;TS=1;var e=F(),t=hi(),n=Fr(),r=CS(),i=Object.isExtensible;return wS=e(function(){})||r?function(e){return!t(e)||r&&n(e)===`ArrayBuffer`?!1:i?i(e):!0}:i,wS}var DS,OS;function kS(){return OS?DS:(OS=1,DS=!F()(function(){return Object.isExtensible(Object.preventExtensions({}))}),DS)}var AS;function jS(){if(AS)return bS.exports;AS=1;var e=R(),t=I(),n=xo(),r=hi(),i=ma(),a=Ya().f,o=Pc(),s=Lc(),c=ES(),l=_a(),u=kS(),d=!1,f=l(`meta`),p=0,m=function(e){a(e,f,{value:{objectID:`O`+ p++,weakData:{}}})},h=bS.exports={enable:function(){h.enable=function(){},d=!0;var n=o.f,r=t([].splice),i={};i[f]=1,n(i).length&&(o.f=function(e){for(var t=n(e),i=0,a=t.length;i<a;i++)if(t[i]===f){r(t,i,1);break}return t},e({target:`Object`,stat:!0,forced:!0},{getOwnPropertyNames:s.f}))},fastKey:function(e,t){if(!r(e))return typeof e==`symbol`?e:(typeof e==`string`?`S`:`P`)+e;if(!i(e,f)){if(!c(e))return`F`;if(!t)return`E`;m(e)}return e[f].objectID},getWeakData:function(e,t){if(!i(e,f)){if(!c(e))return!0;if(!t)return!1;m(e)}return e[f].weakData},onFreeze:function(e){return u&&d&&c(e)&&!i(e,f)&&m(e),e}};return n[f]=!0,bS.exports}var MS,NS;function PS(){if(NS)return MS;NS=1;var e=ba(),t=Lu(),n=e(`iterator`),r=Array.prototype;return MS=function(e){return e!==void 0&&(t.Array===e||r[n]===e)},MS}var FS,IS;function LS(){if(IS)return FS;IS=1;var e=Zs(),t=qi(),n=oi(),r=Lu(),i=ba()(`iterator`);return FS=function(a){if(!n(a))return t(a,i)||t(a,`@@iterator`)||r[e(a)]},FS}var RS,zS;function BS(){if(zS)return RS;zS=1;var e=Jr(),t=Wi(),n=qa(),r=Vi(),i=LS(),a=TypeError;return RS=function(o,s){var c=arguments.length<2?i(o):s;if(t(c))return n(e(c,o));throw new a(r(o)+` is not iterable`)},RS}var VS,HS;function US(){if(HS)return VS;HS=1;var e=Jr(),t=qa(),n=qi();return VS=function(r,i,a){var o,s;t(r);try{if(o=n(r,`return`),!o){if(i===`throw`)throw a;return a}o=e(o,r)}catch(e){s=!0,o=e}if(i===`throw`)throw a;if(s)throw o;return t(o),a},VS}var WS,GS;function KS(){if(GS)return WS;GS=1;var e=Ba(),t=Jr(),n=qa(),r=Vi(),i=PS(),a=ho(),o=Ci(),s=BS(),c=LS(),l=US(),u=TypeError,d=function(e,t){this.stopped=e,this.result=t},f=d.prototype;return WS=function(p,m,h){var g=h&&h.that,_=!!(h&&h.AS_ENTRIES),v=!!(h&&h.IS_RECORD),y=!!(h&&h.IS_ITERATOR),b=!!(h&&h.INTERRUPTED),x=e(m,g),S,C,w,T,E,ee,te,D=function(e){return S&&l(S,`normal`),new d(!0,e)},O=function(e){return _?(n(e),b?x(e[0],e[1],D):x(e[0],e[1])):b?x(e,D):x(e)};if(v)S=p.iterator;else if(y)S=p;else{if(C=c(p),!C)throw new u(r(p)+` is not iterable`);if(i(C)){for(w=0,T=a(p);T>w;w++)if(E=O(p[w]),E&&o(f,E))return E;return new d(!1)}S=s(p,C)}for(ee=v?p.next:S.next;!(te=t(ee,S)).done;){try{E=O(te.value)}catch(e){l(S,`throw`,e)}if(typeof E==`object`&&E&&o(f,E))return E}return new d(!1)},WS}var qS,JS;function YS(){if(JS)return qS;JS=1;var e=Ci(),t=TypeError;return qS=function(n,r){if(e(r,n))return n;throw new t(`Incorrect invocation`)},qS}var XS,ZS;function QS(){if(ZS)return XS;ZS=1;var e=R(),t=Sr(),n=jS(),r=F(),i=Qa(),a=KS(),o=YS(),s=Vr(),c=hi(),l=oi(),u=il(),d=Ya().f,f=pl().forEach,p=Gr(),m=ul(),h=m.set,g=m.getterFor;return XS=function(m,_,v){var y=m.indexOf(`Map`)!==-1,b=m.indexOf(`Weak`)!==-1,x=y?`set`:`add`,S=t[m],C=S&&S.prototype,w={},T;if(!p||!s(S)||!(b||C.forEach&&!r(function(){new S().entries().next()})))T=v.getConstructor(_,m,y,x),n.enable();else{T=_(function(e,t){h(o(e,E),{type:m,collection:new S}),l(t)||a(t,e[x],{that:e,AS_ENTRIES:y})});var E=T.prototype,ee=g(m);f([`add`,`clear`,`delete`,`forEach`,`get`,`has`,`set`,`keys`,`values`,`entries`],function(e){var t=e===`add`||e===`set`;e in C&&!(b&&e===`clear`)&&i(E,e,function(n,r){var i=ee(this).collection;if(!t&&b&&!c(n))return e===`get`?void 0:!1;var a=i[e](n===0?0:n,r);return t?this:a})}),b||d(E,`size`,{configurable:!0,get:function(){return ee(this).collection.size}})}return u(T,m,!1,!0),w[m]=T,e({global:!0,forced:!0},w),b||v.setStrong(T,m,y),T},XS}var $S,eC;function tC(){if(eC)return $S;eC=1;var e=Bc();return $S=function(t,n,r){for(var i in n)r&&r.unsafe&&t[i]?t[i]=n[i]:e(t,i,n[i],r);return t},$S}var nC,rC;function iC(){if(rC)return nC;rC=1;var e=bi(),t=Uc(),n=ba(),r=Gr(),i=n(`species`);return nC=function(n){var a=e(n);r&&a&&!a[i]&&t(a,i,{configurable:!0,get:function(){return this}})},nC}var aC,oC;function sC(){if(oC)return aC;oC=1;var e=jc(),t=Uc(),n=tC(),r=Ba(),i=YS(),a=oi(),o=KS(),s=pd(),c=gd(),l=iC(),u=Gr(),d=jS().fastKey,f=ul(),p=f.set,m=f.getterFor;return aC={getConstructor:function(s,c,l,f){var h=s(function(t,n){i(t,g),p(t,{type:c,index:e(null),first:null,last:null,size:0}),u||(t.size=0),a(n)||o(n,t[f],{that:t,AS_ENTRIES:l})}),g=h.prototype,_=m(c),v=function(e,t,n){var r=_(e),i=y(e,t),a,o;return i?i.value=n:(r.last=i={index:o=d(t,!0),key:t,value:n,previous:a=r.last,next:null,removed:!1},r.first||=i,a&&(a.next=i),u?r.size++:e.size++,o!==`F`&&(r.index[o]=i)),e},y=function(e,t){var n=_(e),r=d(t),i;if(r!==`F`)return n.index[r];for(i=n.first;i;i=i.next)if(i.key===t)return i};return n(g,{clear:function(){for(var t=this,n=_(t),r=n.first;r;)r.removed=!0,r.previous&&=r.previous.next=null,r=r.next;n.first=n.last=null,n.index=e(null),u?n.size=0:t.size=0},delete:function(e){var t=this,n=_(t),r=y(t,e);if(r){var i=r.next,a=r.previous;delete n.index[r.index],r.removed=!0,a&&(a.next=i),i&&(i.previous=a),n.first===r&&(n.first=i),n.last===r&&(n.last=a),u?n.size--:t.size--}return!!r},forEach:function(e){for(var t=_(this),n=r(e,arguments.length>1?arguments[1]:void 0),i;i=i?i.next:t.first;)for(n(i.value,i.key,this);i&&i.removed;)i=i.previous},has:function(e){return!!y(this,e)}}),n(g,l?{get:function(e){var t=y(this,e);return t&&t.value},set:function(e,t){return v(this,e===0?0:e,t)}}:{add:function(e){return v(this,e=e===0?0:e,e)}}),u&&t(g,`size`,{configurable:!0,get:function(){return _(this).size}}),h},setStrong:function(e,t,n){var r=t+` Iterator`,i=m(t),a=m(r);s(e,t,function(e,t){p(this,{type:r,target:e,state:i(e),kind:t,last:null})},function(){for(var e=a(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return!e.target||!(e.last=n=n?n.next:e.state.first)?(e.target=null,c(void 0,!0)):c(t===`keys`?n.key:t===`values`?n.value:[n.key,n.value],!1)},n?`entries`:`values`,!n,!0),l(t)}},aC}var cC;function lC(){return cC?yS:(cC=1,QS()(`Map`,function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},sC()),yS)}var uC;function dC(){return uC?vS:(uC=1,lC(),vS)}var fC={},pC,mC;function hC(){return mC?pC:(mC=1,pC=function(e,t){return t===1?function(t,n){return t[e](n)}:function(t,n,r){return t[e](n,r)}},pC)}var gC,_C;function vC(){if(_C)return gC;_C=1;var e=bi(),t=hC(),n=e(`Map`);return gC={Map:n,set:t(`set`,2),get:t(`get`,1),has:t(`has`,1),remove:t(`delete`,1),proto:n.prototype},gC}var yC;function bC(){if(yC)return fC;yC=1;var e=R(),t=I(),n=Wi(),r=li(),i=KS(),a=vC(),o=ea(),s=F(),c=a.Map,l=a.has,u=a.get,d=a.set,f=t([].push),p=o||s(function(){return c.groupBy(`ab`,function(e){return e}).get(`a`).length!==1});return e({target:`Map`,stat:!0,forced:o||p},{groupBy:function(e,t){r(e),n(t);var a=new c,o=0;return i(e,function(e){var n=t(e,o++);l(a,n)?f(u(a,n),e):d(a,n,[e])}),a}}),fC}var xC={},SC,CC;function wC(){if(CC)return SC;CC=1;var e=I(),t=oo(),n=yc(),r=li(),i=e(``.charAt),a=e(``.charCodeAt),o=e(``.slice),s=function(e){return function(s,c){var l=n(r(s)),u=t(c),d=l.length,f,p;return u<0||u>=d?e?``:void 0:(f=a(l,u),f<55296||f>56319||u+1===d||(p=a(l,u+1))<56320||p>57343?e?i(l,u):f:e?o(l,u,u+2):(f-55296<<10)+(p-56320)+65536)}};return SC={codeAt:s(!1),charAt:s(!0)},SC}var TC;function EC(){if(TC)return xC;TC=1;var e=wC().charAt,t=yc(),n=ul(),r=pd(),i=gd(),a=`String Iterator`,o=n.set,s=n.getterFor(a);return r(String,`String`,function(e){o(this,{type:a,string:t(e),index:0})},function(){var t=s(this),n=t.string,r=t.index,a;return r>=n.length?i(void 0,!0):(a=e(n,r),t.index+=a.length,i(a,!1))}),xC}var DC,OC;function kC(){return OC?DC:(OC=1,yd(),dC(),bC(),EC(),DC=L().Map,DC)}var AC,jC;function MC(){if(jC)return AC;jC=1;var e=kC();return wd(),AC=e,AC}var NC,PC;function FC(){return PC?NC:(PC=1,NC=MC(),NC)}var IC=P(FC()),LC=class{constructor(){this.clear(),this._defaultIndex=0,this._groupIndex=0,this._defaultGroups=[{border:`#2B7CE9`,background:`#97C2FC`,highlight:{border:`#2B7CE9`,background:`#D2E5FF`},hover:{border:`#2B7CE9`,background:`#D2E5FF`}},{border:`#FFA500`,background:`#FFFF00`,highlight:{border:`#FFA500`,background:`#FFFFA3`},hover:{border:`#FFA500`,background:`#FFFFA3`}},{border:`#FA0A10`,background:`#FB7E81`,highlight:{border:`#FA0A10`,background:`#FFAFB1`},hover:{border:`#FA0A10`,background:`#FFAFB1`}},{border:`#41A906`,background:`#7BE141`,highlight:{border:`#41A906`,background:`#A1EC76`},hover:{border:`#41A906`,background:`#A1EC76`}},{border:`#E129F0`,background:`#EB7DF4`,highlight:{border:`#E129F0`,background:`#F0B3F5`},hover:{border:`#E129F0`,background:`#F0B3F5`}},{border:`#7C29F0`,background:`#AD85E4`,highlight:{border:`#7C29F0`,background:`#D3BDF0`},hover:{border:`#7C29F0`,background:`#D3BDF0`}},{border:`#C37F00`,background:`#FFA807`,highlight:{border:`#C37F00`,background:`#FFCA66`},hover:{border:`#C37F00`,background:`#FFCA66`}},{border:`#4220FB`,background:`#6E6EFD`,highlight:{border:`#4220FB`,background:`#9B9BFD`},hover:{border:`#4220FB`,background:`#9B9BFD`}},{border:`#FD5A77`,background:`#FFC0CB`,highlight:{border:`#FD5A77`,background:`#FFD1D9`},hover:{border:`#FD5A77`,background:`#FFD1D9`}},{border:`#4AD63A`,background:`#C2FABC`,highlight:{border:`#4AD63A`,background:`#E6FFE3`},hover:{border:`#4AD63A`,background:`#E6FFE3`}},{border:`#990000`,background:`#EE0000`,highlight:{border:`#BB0000`,background:`#FF3333`},hover:{border:`#BB0000`,background:`#FF3333`}},{border:`#FF6000`,background:`#FF6000`,highlight:{border:`#FF6000`,background:`#FF6000`},hover:{border:`#FF6000`,background:`#FF6000`}},{border:`#97C2FC`,background:`#2B7CE9`,highlight:{border:`#D2E5FF`,background:`#2B7CE9`},hover:{border:`#D2E5FF`,background:`#2B7CE9`}},{border:`#399605`,background:`#255C03`,highlight:{border:`#399605`,background:`#255C03`},hover:{border:`#399605`,background:`#255C03`}},{border:`#B70054`,background:`#FF007E`,highlight:{border:`#B70054`,background:`#FF007E`},hover:{border:`#B70054`,background:`#FF007E`}},{border:`#AD85E4`,background:`#7C29F0`,highlight:{border:`#D3BDF0`,background:`#7C29F0`},hover:{border:`#D3BDF0`,background:`#7C29F0`}},{border:`#4557FA`,background:`#000EA1`,highlight:{border:`#6E6EFD`,background:`#000EA1`},hover:{border:`#6E6EFD`,background:`#000EA1`}},{border:`#FFC0CB`,background:`#FD5A77`,highlight:{border:`#FFD1D9`,background:`#FD5A77`},hover:{border:`#FFD1D9`,background:`#FD5A77`}},{border:`#C2FABC`,background:`#74D66A`,highlight:{border:`#E6FFE3`,background:`#74D66A`},hover:{border:`#E6FFE3`,background:`#74D66A`}},{border:`#EE0000`,background:`#990000`,highlight:{border:`#FF3333`,background:`#BB0000`},hover:{border:`#FF3333`,background:`#BB0000`}}],this.options={},this.defaultOptions={useDefaultGroups:!0},Jo(this.options,this.defaultOptions)}setOptions(e){let t=[`useDefaultGroups`];if(e!==void 0){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Pg(t).call(t,n)===-1){let t=e[n];this.add(n,t)}}}clear(){this._groups=new IC,this._groupNames=[]}get(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this._groups.get(e);if(n===void 0&&t)if(this.options.useDefaultGroups===!1&&this._groupNames.length>0){let t=this._groupIndex%this._groupNames.length;++this._groupIndex,n={},n.color=this._groups.get(this._groupNames[t]),this._groups.set(e,n)}else{let t=this._defaultIndex%this._defaultGroups.length;this._defaultIndex++,n={},n.color=this._defaultGroups[t],this._groups.set(e,n)}return n}add(e,t){return this._groups.has(e)||this._groupNames.push(e),this._groups.set(e,t),t}},RC={},zC;function BC(){return zC?RC:(zC=1,R()({target:`Number`,stat:!0},{isNaN:function(e){return e!==e}}),RC)}var VC,HC;function UC(){return HC?VC:(HC=1,BC(),VC=L().Number.isNaN,VC)}var WC,GC;function KC(){return GC?WC:(GC=1,WC=UC(),WC)}var qC,JC;function YC(){return JC?qC:(JC=1,qC=KC(),qC)}var XC=P(YC()),ZC={},QC,$C;function ew(){if($C)return QC;$C=1;var e=Sr().isFinite;return QC=Number.isFinite||function(t){return typeof t==`number`&&e(t)},QC}var tw;function nw(){return tw?ZC:(tw=1,R()({target:`Number`,stat:!0},{isFinite:ew()}),ZC)}var rw,iw;function aw(){return iw?rw:(iw=1,nw(),rw=L().Number.isFinite,rw)}var ow,sw;function cw(){return sw?ow:(sw=1,ow=aw(),ow)}var lw,uw;function dw(){return uw?lw:(uw=1,lw=cw(),lw)}var fw=P(dw()),pw={},mw;function hw(){if(mw)return pw;mw=1;var e=R(),t=pl().some;return e({target:`Array`,proto:!0,forced:!pp()(`some`)},{some:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)}}),pw}var gw,_w;function vw(){return _w?gw:(_w=1,hw(),gw=os()(`Array`,`some`),gw)}var yw,bw;function xw(){if(bw)return yw;bw=1;var e=Ci(),t=vw(),n=Array.prototype;return yw=function(r){var i=r.some;return r===n||e(n,r)&&i===n.some?t:i},yw}var Sw,Cw;function ww(){return Cw?Sw:(Cw=1,Sw=xw(),Sw)}var Tw,Ew;function Dw(){return Ew?Tw:(Ew=1,Tw=ww(),Tw)}var Ow=P(Dw()),kw,Aw;function jw(){return Aw?kw:(Aw=1,Fl(),kw=L().Object.getOwnPropertySymbols,kw)}var Mw,Nw;function Pw(){return Nw?Mw:(Nw=1,Mw=jw(),Mw)}var Fw,Iw;function Lw(){return Iw?Fw:(Iw=1,Fw=Pw(),Fw)}var Rw=P(Lw()),zw={exports:{}},Bw={},Vw;function Hw(){if(Vw)return Bw;Vw=1;var e=R(),t=F(),n=fi(),r=Pa().f,i=Gr();return e({target:`Object`,stat:!0,forced:!i||t(function(){r(1)}),sham:!i},{getOwnPropertyDescriptor:function(e,t){return r(n(e),t)}}),Bw}var Uw;function Ww(){if(Uw)return zw.exports;Uw=1,Hw();var e=L().Object,t=zw.exports=function(t,n){return e.getOwnPropertyDescriptor(t,n)};return e.getOwnPropertyDescriptor.sham&&(t.sham=!0),zw.exports}var Gw,Kw;function qw(){return Kw?Gw:(Kw=1,Gw=Ww(),Gw)}var Jw,Yw;function Xw(){return Yw?Jw:(Yw=1,Jw=qw(),Jw)}var Zw=P(Xw()),Qw={},$w;function eT(){if($w)return Qw;$w=1;var e=R(),t=Gr(),n=Xd(),r=fi(),i=Pa(),a=Gs();return e({target:`Object`,stat:!0,sham:!t},{getOwnPropertyDescriptors:function(e){for(var t=r(e),o=i.f,s=n(t),c={},l=0,u,d;s.length>l;)d=o(t,u=s[l++]),d!==void 0&&a(c,u,d);return c}}),Qw}var tT,nT;function rT(){return nT?tT:(nT=1,eT(),tT=L().Object.getOwnPropertyDescriptors,tT)}var iT,aT;function oT(){return aT?iT:(aT=1,iT=rT(),iT)}var sT,cT;function lT(){return cT?sT:(cT=1,sT=oT(),sT)}var uT=P(lT()),dT={exports:{}},fT={},pT;function mT(){if(pT)return fT;pT=1;var e=R(),t=Gr(),n=Sc().f;return e({target:`Object`,stat:!0,forced:Object.defineProperties!==n,sham:!t},{defineProperties:n}),fT}var hT;function gT(){if(hT)return dT.exports;hT=1,mT();var e=L().Object,t=dT.exports=function(t,n){return e.defineProperties(t,n)};return e.defineProperties.sham&&(t.sham=!0),dT.exports}var _T,vT;function yT(){return vT?_T:(vT=1,_T=gT(),_T)}var bT,xT;function ST(){return xT?bT:(xT=1,bT=yT(),bT)}var CT=P(ST()),wT={exports:{}},TT={},ET;function DT(){if(ET)return TT;ET=1;var e=R(),t=Gr(),n=Ya().f;return e({target:`Object`,stat:!0,forced:Object.defineProperty!==n,sham:!t},{defineProperty:n}),TT}var OT;function kT(){if(OT)return wT.exports;OT=1,DT();var e=L().Object,t=wT.exports=function(t,n,r){return e.defineProperty(t,n,r)};return e.defineProperty.sham&&(t.sham=!0),wT.exports}var AT,jT;function MT(){return jT?AT:(jT=1,AT=kT(),AT)}var NT,PT;function FT(){return PT?NT:(PT=1,NT=MT(),NT)}var IT,LT;function RT(){return LT?IT:(LT=1,IT=FT(),IT)}var zT,BT;function VT(){return BT?zT:(BT=1,zT=RT(),zT)}var HT=P(VT()),UT={},WT;function GT(){if(WT)return UT;WT=1;var e=ba(),t=Ya().f,n=e(`metadata`),r=Function.prototype;return r[n]===void 0&&t(r,n,{value:null}),UT}var KT={},qT;function JT(){return qT?KT:(qT=1,Rl(),KT)}var YT={},XT;function ZT(){return XT?YT:(XT=1,V(),YT)}var QT={},$T;function eE(){return $T?QT:($T=1,Yc()(`metadata`),QT)}var tE,nE;function rE(){if(nE)return tE;nE=1;var e=U();return GT(),JT(),ZT(),eE(),tE=e,tE}var iE={},aE,oE;function sE(){if(oE)return aE;oE=1;var e=bi(),t=I(),n=e(`Symbol`),r=n.keyFor,i=t(n.prototype.valueOf);return aE=n.isRegisteredSymbol||function(e){try{return r(i(e))!==void 0}catch{return!1}},aE}var cE;function lE(){return cE?iE:(cE=1,R()({target:`Symbol`,stat:!0},{isRegisteredSymbol:sE()}),iE)}var uE={},dE,fE;function pE(){if(fE)return dE;fE=1;for(var e=ca(),t=bi(),n=I(),r=Ri(),i=ba(),a=t(`Symbol`),o=a.isWellKnownSymbol,s=t(`Object`,`getOwnPropertyNames`),c=n(a.prototype.valueOf),l=e(`wks`),u=0,d=s(a),f=d.length;u<f;u++)try{var p=d[u];r(a[p])&&i(p)}catch{}return dE=function(e){if(o&&o(e))return!0;try{for(var t=c(e),n=0,r=s(l),i=r.length;n<i;n++)if(l[r[n]]==t)return!0}catch{}return!1},dE}var mE;function hE(){return mE?uE:(mE=1,R()({target:`Symbol`,stat:!0,forced:!0},{isWellKnownSymbol:pE()}),uE)}var gE={},_E;function vE(){return _E?gE:(_E=1,Yc()(`customMatcher`),gE)}var yE={},bE;function xE(){return bE?yE:(bE=1,Yc()(`observable`),yE)}var SE={},CE;function wE(){return CE?SE:(CE=1,R()({target:`Symbol`,stat:!0,name:`isRegisteredSymbol`},{isRegistered:sE()}),SE)}var TE={},EE;function DE(){return EE?TE:(EE=1,R()({target:`Symbol`,stat:!0,name:`isWellKnownSymbol`,forced:!0},{isWellKnown:pE()}),TE)}var OE={},kE;function AE(){return kE?OE:(kE=1,Yc()(`matcher`),OE)}var jE={},ME;function NE(){return ME?jE:(ME=1,Yc()(`metadataKey`),jE)}var PE={},FE;function IE(){return FE?PE:(FE=1,Yc()(`patternMatch`),PE)}var LE={},RE;function zE(){return RE?LE:(RE=1,Yc()(`replaceAll`),LE)}var BE,VE;function HE(){if(VE)return BE;VE=1;var e=rE();return lE(),hE(),vE(),xE(),wE(),DE(),AE(),NE(),IE(),zE(),BE=e,BE}var UE,WE;function GE(){return WE?UE:(WE=1,UE=HE(),UE)}var KE=P(GE()),qE,JE;function YE(){return JE?qE:(JE=1,yd(),EC(),Zl(),qE=Kc().f(`iterator`),qE)}var XE,ZE;function QE(){if(ZE)return XE;ZE=1;var e=YE();return wd(),XE=e,XE}var $E,eD;function tD(){return eD?$E:(eD=1,$E=QE(),$E)}var nD,rD;function iD(){return rD?nD:(rD=1,nD=tD(),nD)}var aD,oD;function sD(){return oD?aD:(oD=1,aD=iD(),aD)}var cD=P(sD());function lD(e){"@babel/helpers - typeof";return lD=typeof KE==`function`&&typeof cD==`symbol`?function(e){return typeof e}:function(e){return e&&typeof KE==`function`&&e.constructor===KE&&e!==KE.prototype?`symbol`:typeof e},lD(e)}var uD,dD;function fD(){return dD?uD:(dD=1,vu(),uD=Kc().f(`toPrimitive`),uD)}var pD,mD;function hD(){return mD?pD:(mD=1,pD=fD(),pD)}var gD,_D;function vD(){return _D?gD:(_D=1,gD=hD(),gD)}var yD,bD;function xD(){return bD?yD:(bD=1,yD=vD(),yD)}var SD,CD;function wD(){return CD?SD:(CD=1,SD=xD(),SD)}var TD=P(wD());function ED(e,t){if(lD(e)!=`object`||!e)return e;var n=e[TD];if(n!==void 0){var r=n.call(e,t);if(lD(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function DD(e){var t=ED(e,`string`);return lD(t)==`symbol`?t:t+``}function OD(e,t,n){return(t=DD(t))in e?HT(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var kD={},AD,jD;function MD(){if(jD)return AD;jD=1;var e=Wi(),t=da(),n=ri(),r=ho(),i=TypeError,a=`Reduce of empty array with no initial value`,o=function(o){return function(s,c,l,u){var d=t(s),f=n(d),p=r(d);if(e(c),p===0&&l<2)throw new i(a);var m=o?p-1:0,h=o?-1:1;if(l<2)for(;;){if(m in f){u=f[m],m+=h;break}if(m+=h,o?m<0:p<=m)throw new i(a)}for(;o?m>=0:p>m;m+=h)m in f&&(u=c(u,f[m],m,d));return u}};return AD={left:o(!1),right:o(!0)},AD}var ND,PD;function FD(){return PD?ND:(PD=1,ND=b_()===`NODE`,ND)}var ID;function LD(){if(ID)return kD;ID=1;var e=R(),t=MD().left,n=pp(),r=ki();return e({target:`Array`,proto:!0,forced:!FD()&&r>79&&r<83||!n(`reduce`)},{reduce:function(e){var n=arguments.length;return t(this,e,n,n>1?arguments[1]:void 0)}}),kD}var RD,zD;function BD(){return zD?RD:(zD=1,LD(),RD=os()(`Array`,`reduce`),RD)}var VD,HD;function UD(){if(HD)return VD;HD=1;var e=Ci(),t=BD(),n=Array.prototype;return VD=function(r){var i=r.reduce;return r===n||e(n,r)&&i===n.reduce?t:i},VD}var WD,GD;function KD(){return GD?WD:(GD=1,WD=UD(),WD)}var qD,JD;function YD(){return JD?qD:(JD=1,qD=KD(),qD)}var XD=P(YD()),ZD={},QD,$D;function eO(){if($D)return QD;$D=1;var e=zs(),t=ho(),n=Hs(),r=Ba(),i=function(a,o,s,c,l,u,d,f){for(var p=l,m=0,h=d?r(d,f):!1,g,_;m<c;)m in s&&(g=h?h(s[m],m,o):s[m],u>0&&e(g)?(_=t(g),p=i(a,o,g,_,p,u-1)-1):(n(p+1),a[p]=g),p++),m++;return p};return QD=i,QD}var tO;function nO(){if(tO)return ZD;tO=1;var e=R(),t=eO(),n=Wi(),r=da(),i=ho(),a=lc();return e({target:`Array`,proto:!0},{flatMap:function(e){var o=r(this),s=i(o),c;return n(e),c=a(o,0),c.length=t(c,o,o,s,0,1,e,arguments.length>1?arguments[1]:void 0),c}}),ZD}var rO={},iO;function aO(){return iO?rO:(iO=1,Pu()(`flatMap`),rO)}var oO,sO;function cO(){return sO?oO:(sO=1,nO(),aO(),oO=os()(`Array`,`flatMap`),oO)}var lO,uO;function dO(){if(uO)return lO;uO=1;var e=Ci(),t=cO(),n=Array.prototype;return lO=function(r){var i=r.flatMap;return r===n||e(n,r)&&i===n.flatMap?t:i},lO}var fO,pO;function mO(){return pO?fO:(pO=1,fO=dO(),fO)}var hO,gO;function _O(){return gO?hO:(gO=1,hO=mO(),hO)}_O();var vO,yO;function bO(){return yO?vO:(yO=1,vO=QE(),vO)}var xO=P(bO()),SO={},CO={},wO;function TO(){return wO?CO:(wO=1,QS()(`Set`,function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},sC()),CO)}var EO;function DO(){return EO?SO:(EO=1,TO(),SO)}var OO={},kO,AO;function jO(){if(AO)return kO;AO=1;var e=Vi(),t=TypeError;return kO=function(n){if(typeof n==`object`&&`size`in n&&`has`in n&&`add`in n&&`delete`in n&&`keys`in n)return n;throw new t(e(n)+` is not a set`)},kO}var MO,NO;function PO(){if(NO)return MO;NO=1;var e=bi(),t=hC(),n=e(`Set`),r=n.prototype;return MO={Set:n,add:t(`add`,1),has:t(`has`,1),remove:t(`delete`,1),proto:r},MO}var FO,IO;function LO(){if(IO)return FO;IO=1;var e=Jr();return FO=function(t,n,r){for(var i=r?t:t.iterator,a=t.next,o,s;!(o=e(a,i)).done;)if(s=n(o.value),s!==void 0)return s},FO}var RO,zO;function BO(){if(zO)return RO;zO=1;var e=LO();return RO=function(t,n,r){return r?e(t.keys(),n,!0):t.forEach(n)},RO}var VO,HO;function UO(){if(HO)return VO;HO=1;var e=PO(),t=BO(),n=e.Set,r=e.add;return VO=function(e){var i=new n;return t(e,function(e){r(i,e)}),i},VO}var WO,GO;function KO(){return GO?WO:(GO=1,WO=function(e){return e.size},WO)}var qO,JO;function YO(){return JO?qO:(JO=1,qO=function(e){return{iterator:e,next:e.next,done:!1}},qO)}var XO,ZO;function QO(){if(ZO)return XO;ZO=1;var e=Wi(),t=qa(),n=Jr(),r=oo(),i=YO(),a=`Invalid size`,o=RangeError,s=TypeError,c=Math.max,l=function(t,n){this.set=t,this.size=c(n,0),this.has=e(t.has),this.keys=e(t.keys)};return l.prototype={getIterator:function(){return i(t(n(this.keys,this.set)))},includes:function(e){return n(this.has,this.set,e)}},XO=function(e){t(e);var n=+e.size;if(n!==n)throw new s(a);var i=r(n);if(i<0)throw new o(a);return new l(e,i)},XO}var $O,ek;function tk(){if(ek)return $O;ek=1;var e=jO(),t=PO(),n=UO(),r=KO(),i=QO(),a=BO(),o=LO(),s=t.has,c=t.remove;return $O=function(t){var l=e(this),u=i(t),d=n(l);return r(l)<=u.size?a(l,function(e){u.includes(e)&&c(d,e)}):o(u.getIterator(),function(e){s(d,e)&&c(d,e)}),d},$O}var nk,rk;function ik(){return rk?nk:(rk=1,nk=function(){return!1},nk)}var ak;function ok(){if(ak)return OO;ak=1;var e=R(),t=tk(),n=F();return e({target:`Set`,proto:!0,real:!0,forced:!ik()(`difference`,function(e){return e.size===0})||n(function(){var e={size:1,has:function(){return!0},keys:function(){var e=0;return{next:function(){var n=e++>1;return t.has(1)&&t.clear(),{done:n,value:2}}}}},t=new Set([1,2,3,4]);return t.difference(e).size!==3})},{difference:t}),OO}var sk={},ck,lk;function uk(){if(lk)return ck;lk=1;var e=jO(),t=PO(),n=KO(),r=QO(),i=BO(),a=LO(),o=t.Set,s=t.add,c=t.has;return ck=function(t){var l=e(this),u=r(t),d=new o;return n(l)>u.size?a(u.getIterator(),function(e){c(l,e)&&s(d,e)}):i(l,function(e){u.includes(e)&&s(d,e)}),d},ck}var dk;function fk(){if(dk)return sk;dk=1;var e=R(),t=F(),n=uk();return e({target:`Set`,proto:!0,real:!0,forced:!ik()(`intersection`,function(e){return e.size===2&&e.has(1)&&e.has(2)})||t(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!==`3,2`})},{intersection:n}),sk}var pk={},mk,hk;function gk(){if(hk)return mk;hk=1;var e=jO(),t=PO().has,n=KO(),r=QO(),i=BO(),a=LO(),o=US();return mk=function(s){var c=e(this),l=r(s);if(n(c)<=l.size)return i(c,function(e){if(l.includes(e))return!1},!0)!==!1;var u=l.getIterator();return a(u,function(e){if(t(c,e))return o(u,`normal`,!1)})!==!1},mk}var _k;function vk(){if(_k)return pk;_k=1;var e=R(),t=gk();return e({target:`Set`,proto:!0,real:!0,forced:!ik()(`isDisjointFrom`,function(e){return!e})},{isDisjointFrom:t}),pk}var yk={},bk,xk;function Sk(){if(xk)return bk;xk=1;var e=jO(),t=KO(),n=BO(),r=QO();return bk=function(i){var a=e(this),o=r(i);return t(a)>o.size?!1:n(a,function(e){if(!o.includes(e))return!1},!0)!==!1},bk}var Ck;function wk(){if(Ck)return yk;Ck=1;var e=R(),t=Sk();return e({target:`Set`,proto:!0,real:!0,forced:!ik()(`isSubsetOf`,function(e){return e})},{isSubsetOf:t}),yk}var Tk={},Ek,Dk;function Ok(){if(Dk)return Ek;Dk=1;var e=jO(),t=PO().has,n=KO(),r=QO(),i=LO(),a=US();return Ek=function(o){var s=e(this),c=r(o);if(n(s)<c.size)return!1;var l=c.getIterator();return i(l,function(e){if(!t(s,e))return a(l,`normal`,!1)})!==!1},Ek}var kk;function Ak(){if(kk)return Tk;kk=1;var e=R(),t=Ok();return e({target:`Set`,proto:!0,real:!0,forced:!ik()(`isSupersetOf`,function(e){return!e})},{isSupersetOf:t}),Tk}var jk={},Mk,Nk;function Pk(){if(Nk)return Mk;Nk=1;var e=jO(),t=PO(),n=UO(),r=QO(),i=LO(),a=t.add,o=t.has,s=t.remove;return Mk=function(t){var c=e(this),l=r(t).getIterator(),u=n(c);return i(l,function(e){o(c,e)?s(u,e):a(u,e)}),u},Mk}var Fk,Ik;function Lk(){return Ik?Fk:(Ik=1,Fk=function(e){try{var t=new Set,n=t[e]({size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},`next`,{get:function(){return t.clear(),t.add(4),function(){return{done:!0}}}})}});return n.size===1&&n.values().next().value===4}catch{return!1}},Fk)}var Rk;function zk(){if(Rk)return jk;Rk=1;var e=R(),t=Pk(),n=Lk();return e({target:`Set`,proto:!0,real:!0,forced:!ik()(`symmetricDifference`)||!n(`symmetricDifference`)},{symmetricDifference:t}),jk}var Bk={},Vk,Hk;function Uk(){if(Hk)return Vk;Hk=1;var e=jO(),t=PO().add,n=UO(),r=QO(),i=LO();return Vk=function(a){var o=e(this),s=r(a).getIterator(),c=n(o);return i(s,function(e){t(c,e)}),c},Vk}var Wk;function Gk(){if(Wk)return Bk;Wk=1;var e=R(),t=Uk(),n=Lk();return e({target:`Set`,proto:!0,real:!0,forced:!ik()(`union`)||!n(`union`)},{union:t}),Bk}var Kk,qk;function Jk(){return qk?Kk:(qk=1,yd(),DO(),ok(),fk(),vk(),wk(),Ak(),zk(),Gk(),EC(),Kk=L().Set,Kk)}var Yk,Xk;function Zk(){if(Xk)return Yk;Xk=1;var e=Jk();return wd(),Yk=e,Yk}var Qk,$k;function eA(){return $k?Qk:($k=1,Qk=Zk(),Qk)}var tA=P(eA()),nA,rA;function iA(){return rA?nA:(rA=1,yd(),EC(),nA=BS(),nA)}var aA,oA;function sA(){if(oA)return aA;oA=1;var e=iA();return wd(),aA=e,aA}var cA,lA;function uA(){return lA?cA:(lA=1,cA=sA(),cA)}var dA,fA;function pA(){return fA?dA:(fA=1,dA=uA(),dA)}var mA,hA;function gA(){return hA?mA:(hA=1,mA=pA(),mA)}var _A,vA;function yA(){return vA?_A:(vA=1,_A=gA(),_A)}var bA=P(yA()),xA={},SA,CA;function wA(){if(CA)return SA;CA=1;var e=Qo(),t=Math.floor,n=function(r,i){var a=r.length;if(a<8)for(var o=1,s,c;o<a;){for(c=o,s=r[o];c&&i(r[c-1],s)>0;)r[c]=r[--c];c!==o++&&(r[c]=s)}else for(var l=t(a/2),u=n(e(r,0,l),i),d=n(e(r,l),i),f=u.length,p=d.length,m=0,h=0;m<f||h<p;)r[m+h]=m<f&&h<p?i(u[m],d[h])<=0?u[m++]:d[h++]:m<f?u[m++]:d[h++];return r};return SA=n,SA}var TA,EA;function DA(){if(EA)return TA;EA=1;var e=Ei().match(/firefox\/(\d+)/i);return TA=!!e&&+e[1],TA}var OA,kA;function AA(){if(kA)return OA;kA=1;var e=Ei();return OA=/MSIE|Trident/.test(e),OA}var jA,MA;function NA(){if(MA)return jA;MA=1;var e=Ei().match(/AppleWebKit\/(\d+)\./);return jA=!!e&&+e[1],jA}var PA;function FA(){if(PA)return xA;PA=1;var e=R(),t=I(),n=Wi(),r=da(),i=ho(),a=em(),o=yc(),s=F(),c=wA(),l=pp(),u=DA(),d=AA(),f=ki(),p=NA(),m=[],h=t(m.sort),g=t(m.push),_=s(function(){m.sort(void 0)}),v=s(function(){m.sort(null)}),y=l(`sort`),b=!s(function(){if(f)return f<70;if(!(u&&u>3)){if(d)return!0;if(p)return p<603;var e=``,t,n,r,i;for(t=65;t<76;t++){switch(n=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(i=0;i<47;i++)m.push({k:n+i,v:r})}for(m.sort(function(e,t){return t.v-e.v}),i=0;i<m.length;i++)n=m[i].k.charAt(0),e.charAt(e.length-1)!==n&&(e+=n);return e!==`DGBEFHACIJK`}}),x=_||!v||!y||!b,S=function(e){return function(t,n){return n===void 0?-1:t===void 0?1:e===void 0?o(t)>o(n)?1:-1:+e(t,n)||0}};return e({target:`Array`,proto:!0,forced:x},{sort:function(e){e!==void 0&&n(e);var t=r(this);if(b)return e===void 0?h(t):h(t,e);var o=[],s=i(t),l,u;for(u=0;u<s;u++)u in t&&g(o,t[u]);for(c(o,S(e)),l=i(o),u=0;u<l;)t[u]=o[u++];for(;u<s;)a(t,u++);return t}}),xA}var IA,LA;function RA(){return LA?IA:(LA=1,FA(),IA=os()(`Array`,`sort`),IA)}var zA,BA;function VA(){if(BA)return zA;BA=1;var e=Ci(),t=RA(),n=Array.prototype;return zA=function(r){var i=r.sort;return r===n||e(n,r)&&i===n.sort?t:i},zA}var HA,UA;function WA(){return UA?HA:(UA=1,HA=VA(),HA)}var GA,KA;function qA(){return KA?GA:(KA=1,GA=WA(),GA)}var JA=P(qA()),YA,XA;function ZA(){return XA?YA:(XA=1,yd(),YA=os()(`Array`,`keys`),YA)}var QA,$A;function ej(){return $A?QA:($A=1,QA=ZA(),QA)}var tj,nj;function rj(){if(nj)return tj;nj=1,wd();var e=Zs(),t=ma(),n=Ci(),r=ej(),i=Array.prototype,a={DOMTokenList:!0,NodeList:!0};return tj=function(o){var s=o.keys;return o===i||n(i,o)&&s===i.keys||t(a,e(o))?r:s},tj}var ij,aj;function oj(){return aj?ij:(aj=1,ij=rj(),ij)}var sj=P(oj()),cj,lj;function uj(){return lj?cj:(lj=1,yd(),cj=os()(`Array`,`values`),cj)}var dj,fj;function pj(){return fj?dj:(fj=1,dj=uj(),dj)}var mj,hj;function gj(){if(hj)return mj;hj=1,wd();var e=Zs(),t=ma(),n=Ci(),r=pj(),i=Array.prototype,a={DOMTokenList:!0,NodeList:!0};return mj=function(o){var s=o.values;return o===i||n(i,o)&&s===i.values||t(a,e(o))?r:s},mj}var _j,vj;function yj(){return vj?_j:(vj=1,_j=gj(),_j)}var bj=P(yj()),xj,Sj;function Cj(){return Sj?xj:(Sj=1,yd(),xj=os()(`Array`,`entries`),xj)}var wj,Tj;function Ej(){return Tj?wj:(Tj=1,wj=Cj(),wj)}var Dj,Oj;function kj(){if(Oj)return Dj;Oj=1,wd();var e=Zs(),t=ma(),n=Ci(),r=Ej(),i=Array.prototype,a={DOMTokenList:!0,NodeList:!0};return Dj=function(o){var s=o.entries;return o===i||n(i,o)&&s===i.entries||t(a,e(o))?r:s},Dj}var Aj,jj;function Mj(){return jj?Aj:(jj=1,Aj=kj(),Aj)}var Nj=P(Mj()),Pj,Fj;function Ij(){return Fj?Pj:(Fj=1,Pj=MT(),Pj)}var Lj=P(Ij()),Rj=[];for(let e=0;e<256;++e)Rj.push((e+256).toString(16).slice(1));function zj(e,t=0){return(Rj[e[t+0]]+Rj[e[t+1]]+Rj[e[t+2]]+Rj[e[t+3]]+`-`+Rj[e[t+4]]+Rj[e[t+5]]+`-`+Rj[e[t+6]]+Rj[e[t+7]]+`-`+Rj[e[t+8]]+Rj[e[t+9]]+`-`+Rj[e[t+10]]+Rj[e[t+11]]+Rj[e[t+12]]+Rj[e[t+13]]+Rj[e[t+14]]+Rj[e[t+15]]).toLowerCase()}var Bj,Vj=new Uint8Array(16);function Hj(){if(!Bj){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);Bj=crypto.getRandomValues.bind(crypto)}return Bj(Vj)}var Uj={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Wj(e,t,n){e||={};let r=e.random??e.rng?.()??Hj();if(r.length<16)throw Error(`Random bytes length must be >= 16`);return r[6]=r[6]&15|64,r[8]=r[8]&63|128,zj(r)}function Gj(e,t,n){return Uj.randomUUID&&!e?Uj.randomUUID():Wj(e)}function Kj(e,t){var n=Xf(e);if(Rw){var r=Rw(e);t&&(r=Ph(r).call(r,function(t){return Zw(e,t).enumerable})),n.push.apply(n,r)}return n}function qj(e){for(var t=1;t<arguments.length;t++){var n,r,i=arguments[t]==null?{}:arguments[t];t%2?jp(n=Kj(Object(i),!0)).call(n,function(t){OD(e,t,i[t])}):uT?CT(e,uT(i)):jp(r=Kj(Object(i))).call(r,function(t){Lj(e,t,Zw(i,t))})}return e}function Jj(e){return typeof e==`string`||typeof e==`number`}var Yj=class e{constructor(e){OD(this,`delay`,void 0),OD(this,`max`,void 0),OD(this,`_queue`,[]),OD(this,`_timeout`,null),OD(this,`_extended`,null),this.delay=null,this.max=1/0,this.setOptions(e)}setOptions(e){e&&e.delay!==void 0&&(this.delay=e.delay),e&&e.max!==void 0&&(this.max=e.max),this._flushIfNeeded()}static extend(t,n){let r=new e(n);if(t.flush!==void 0)throw Error(`Target object already has a property flush`);t.flush=()=>{r.flush()};let i=[{name:`flush`,original:void 0}];if(n&&n.replace)for(let e=0;e<n.replace.length;e++){let a=n.replace[e];i.push({name:a,original:t[a]}),r.replace(t,a)}return r._extended={object:t,methods:i},r}destroy(){if(this.flush(),this._extended){let e=this._extended.object,t=this._extended.methods;for(let n=0;n<t.length;n++){let r=t[n];r.original?e[r.name]=r.original:delete e[r.name]}this._extended=null}}replace(e,t){let n=this,r=e[t];if(!r)throw Error(`Method `+t+` undefined`);e[t]=function(){var e=[...arguments];n.queue({args:e,fn:r,context:this})}}queue(e){typeof e==`function`?this._queue.push({fn:e}):this._queue.push(e),this._flushIfNeeded()}_flushIfNeeded(){this._queue.length>this.max&&this.flush(),this._timeout!=null&&(clearTimeout(this._timeout),this._timeout=null),this.queue.length>0&&typeof this.delay==`number`&&(this._timeout=B_(()=>{this.flush()},this.delay))}flush(){var e,t;jp(e=hm(t=this._queue).call(t,0)).call(e,e=>{e.fn.apply(e.context||e.fn,e.args||[])})}},Xj=class e{constructor(){OD(this,`_subscribers`,{"*":[],add:[],remove:[],update:[]}),OD(this,`subscribe`,e.prototype.on),OD(this,`unsubscribe`,e.prototype.off)}_trigger(e,t,n){var r;if(e===`*`)throw Error(`Cannot trigger event *`);jp(r=[...this._subscribers[e],...this._subscribers[`*`]]).call(r,r=>{r(e,t,n??null)})}on(e,t){typeof t==`function`&&this._subscribers[e].push(t)}off(e,t){var n;this._subscribers[e]=Ph(n=this._subscribers[e]).call(n,e=>e!==t)}},Zj=class e{constructor(e){OD(this,`_pairs`,void 0),this._pairs=e}*[xO](){for(let[e,t]of this._pairs)yield[e,t]}*entries(){for(let[e,t]of this._pairs)yield[e,t]}*keys(){for(let[e]of this._pairs)yield e}*values(){for(let[,e]of this._pairs)yield e}toIdArray(){var e;return Lf(e=[...this._pairs]).call(e,e=>e[0])}toItemArray(){var e;return Lf(e=[...this._pairs]).call(e,e=>e[1])}toEntryArray(){return[...this._pairs]}toObjectMap(){let e=qg(null);for(let[t,n]of this._pairs)e[t]=n;return e}toMap(){return new IC(this._pairs)}toIdSet(){return new tA(this.toIdArray())}toItemSet(){return new tA(this.toItemArray())}cache(){return new e([...this._pairs])}distinct(e){let t=new tA;for(let[n,r]of this._pairs)t.add(e(r,n));return t}filter(t){let n=this._pairs;return new e({*[xO](){for(let[e,r]of n)t(r,e)&&(yield[e,r])}})}forEach(e){for(let[t,n]of this._pairs)e(n,t)}map(t){let n=this._pairs;return new e({*[xO](){for(let[e,r]of n)yield[e,t(r,e)]}})}max(e){let t=bA(this._pairs),n=t.next();if(n.done)return null;let r=n.value[1],i=e(n.value[1],n.value[0]);for(;!(n=t.next()).done;){let[t,a]=n.value,o=e(a,t);o>i&&(i=o,r=a)}return r}min(e){let t=bA(this._pairs),n=t.next();if(n.done)return null;let r=n.value[1],i=e(n.value[1],n.value[0]);for(;!(n=t.next()).done;){let[t,a]=n.value,o=e(a,t);o<i&&(i=o,r=a)}return r}reduce(e,t){for(let[n,r]of this._pairs)t=e(t,r,n);return t}sort(t){return new e({[xO]:()=>{var e;return bA(JA(e=[...this._pairs]).call(e,(e,n)=>{let[r,i]=e,[a,o]=n;return t(i,o,r,a)}))}})}};function Qj(e,t){return e[t]??(e[t]=Gj()),e}var $j=class extends Xj{get idProp(){return this._idProp}constructor(e,t){super(),OD(this,`flush`,void 0),OD(this,`length`,void 0),OD(this,`_options`,void 0),OD(this,`_data`,void 0),OD(this,`_idProp`,void 0),OD(this,`_queue`,null),e&&!W(e)&&(t=e,e=[]),this._options=t||{},this._data=new IC,this.length=0,this._idProp=this._options.fieldId||`id`,e&&e.length&&this.add(e),this.setOptions(t)}setOptions(e){e&&e.queue!==void 0&&(e.queue===!1?this._queue&&=(this._queue.destroy(),null):(this._queue||=Yj.extend(this,{replace:[`add`,`update`,`remove`]}),e.queue&&typeof e.queue==`object`&&this._queue.setOptions(e.queue)))}add(e,t){let n=[],r;if(W(e)){let t=Lf(e).call(e,e=>e[this._idProp]);if(Ow(t).call(t,e=>this._data.has(e)))throw Error(`A duplicate id was found in the parameter array.`);for(let t=0,i=e.length;t<i;t++)r=this._addItem(e[t]),n.push(r)}else if(e&&typeof e==`object`)r=this._addItem(e),n.push(r);else throw Error(`Unknown dataType`);return n.length&&this._trigger(`add`,{items:n},t),n}update(e,t){let n=[],r=[],i=[],a=[],o=this._idProp,s=e=>{let t=e[o];if(t!=null&&this._data.has(t)){let n=e,o=Jo({},this._data.get(t)),s=this._updateItem(n);r.push(s),a.push(n),i.push(o)}else{let t=this._addItem(e);n.push(t)}};if(W(e))for(let t=0,n=e.length;t<n;t++)e[t]&&typeof e[t]==`object`?s(e[t]):console.warn(`Ignoring input item, which is not an object at index `+t);else if(e&&typeof e==`object`)s(e);else throw Error(`Unknown dataType`);if(n.length&&this._trigger(`add`,{items:n},t),r.length){let e={items:r,oldData:i,data:a};this._trigger(`update`,e,t)}return vh(n).call(n,r)}updateOnly(e,t){var n;W(e)||(e=[e]);let r=Lf(n=Lf(e).call(e,e=>{let t=this._data.get(e[this._idProp]);if(t==null)throw Error(`Updating non-existent items is not allowed.`);return{oldData:t,update:e}})).call(n,e=>{let{oldData:t,update:n}=e,r=t[this._idProp],i=kb(t,n);return this._data.set(r,i),{id:r,oldData:t,updatedData:i}});if(r.length){let e={items:Lf(r).call(r,e=>e.id),oldData:Lf(r).call(r,e=>e.oldData),data:Lf(r).call(r,e=>e.updatedData)};return this._trigger(`update`,e,t),e.items}else return[]}get(e,t){let n,r,i;Jj(e)?(n=e,i=t):W(e)?(r=e,i=t):i=e;let a=i&&i.returnType===`Object`?`Object`:`Array`,o=i&&Ph(i),s=[],c,l,u;if(n!=null)c=this._data.get(n),c&&o&&!o(c)&&(c=void 0);else if(r!=null)for(let e=0,t=r.length;e<t;e++)c=this._data.get(r[e]),c!=null&&(!o||o(c))&&s.push(c);else{var d;l=[...sj(d=this._data).call(d)];for(let e=0,t=l.length;e<t;e++)u=l[e],c=this._data.get(u),c!=null&&(!o||o(c))&&s.push(c)}if(i&&i.order&&n==null&&this._sort(s,i.order),i&&i.fields){let e=i.fields;if(n!=null&&c!=null)c=this._filterFields(c,e);else for(let t=0,n=s.length;t<n;t++)s[t]=this._filterFields(s[t],e)}if(a==`Object`){let e={};for(let t=0,n=s.length;t<n;t++){let n=s[t],r=n[this._idProp];e[r]=n}return e}else if(n!=null)return c??null;else return s}getIds(e){let t=this._data,n=e&&Ph(e),r=e&&e.order,i=[...sj(t).call(t)],a=[];if(n)if(r){let e=[];for(let t=0,r=i.length;t<r;t++){let r=i[t],a=this._data.get(r);a!=null&&n(a)&&e.push(a)}this._sort(e,r);for(let t=0,n=e.length;t<n;t++)a.push(e[t][this._idProp])}else for(let e=0,t=i.length;e<t;e++){let t=i[e],r=this._data.get(t);r!=null&&n(r)&&a.push(r[this._idProp])}else if(r){let e=[];for(let n=0,r=i.length;n<r;n++){let r=i[n];e.push(t.get(r))}this._sort(e,r);for(let t=0,n=e.length;t<n;t++)a.push(e[t][this._idProp])}else for(let e=0,n=i.length;e<n;e++){let n=i[e],r=t.get(n);r!=null&&a.push(r[this._idProp])}return a}getDataSet(){return this}forEach(e,t){let n=t&&Ph(t),r=this._data,i=[...sj(r).call(r)];if(t&&t.order){let n=this.get(t);for(let t=0,r=n.length;t<r;t++){let r=n[t],i=r[this._idProp];e(r,i)}}else for(let t=0,r=i.length;t<r;t++){let r=i[t],a=this._data.get(r);a!=null&&(!n||n(a))&&e(a,r)}}map(e,t){let n=t&&Ph(t),r=[],i=this._data,a=[...sj(i).call(i)];for(let t=0,i=a.length;t<i;t++){let i=a[t],o=this._data.get(i);o!=null&&(!n||n(o))&&r.push(e(o,i))}return t&&t.order&&this._sort(r,t.order),r}_filterFields(e,t){var n;return e&&XD(n=W(t)?t:Xf(t)).call(n,(t,n)=>(t[n]=e[n],t),{})}_sort(e,t){if(typeof t==`string`){let n=t;JA(e).call(e,(e,t)=>{let r=e[n],i=t[n];return r>i?1:r<i?-1:0})}else if(typeof t==`function`)JA(e).call(e,t);else throw TypeError(`Order must be a function or a string`)}remove(e,t){let n=[],r=[],i=W(e)?e:[e];for(let e=0,t=i.length;e<t;e++){let t=this._remove(i[e]);if(t){let e=t[this._idProp];e!=null&&(n.push(e),r.push(t))}}return n.length&&this._trigger(`remove`,{items:n,oldData:r},t),n}_remove(e){let t;if(Jj(e)?t=e:e&&typeof e==`object`&&(t=e[this._idProp]),t!=null&&this._data.has(t)){let e=this._data.get(t)||null;return this._data.delete(t),--this.length,e}return null}clear(e){var t;let n=[...sj(t=this._data).call(t)],r=[];for(let e=0,t=n.length;e<t;e++)r.push(this._data.get(n[e]));return this._data.clear(),this.length=0,this._trigger(`remove`,{items:n,oldData:r},e),n}max(e){let t=null,n=null;for(let i of bj(r=this._data).call(r)){var r;let a=i[e];typeof a==`number`&&(n==null||a>n)&&(t=i,n=a)}return t||null}min(e){let t=null,n=null;for(let i of bj(r=this._data).call(r)){var r;let a=i[e];typeof a==`number`&&(n==null||a<n)&&(t=i,n=a)}return t||null}distinct(e){let t=this._data,n=[...sj(t).call(t)],r=[],i=0;for(let a=0,o=n.length;a<o;a++){let o=n[a],s=t.get(o)[e],c=!1;for(let e=0;e<i;e++)if(r[e]==s){c=!0;break}!c&&s!==void 0&&(r[i]=s,i++)}return r}_addItem(e){let t=Qj(e,this._idProp),n=t[this._idProp];if(this._data.has(n))throw Error(`Cannot add item: item with id `+n+` already exists`);return this._data.set(n,t),++this.length,n}_updateItem(e){let t=e[this._idProp];if(t==null)throw Error(`Cannot update item: item has no id (item: `+h_(e)+`)`);let n=this._data.get(t);if(!n)throw Error(`Cannot update item: no item with id `+t+` found`);return this._data.set(t,qj(qj({},n),e)),t}stream(e){if(e){let t=this._data;return new Zj({*[xO](){for(let n of e){let e=t.get(n);e!=null&&(yield[n,e])}}})}else{var t;return new Zj({[xO]:B(t=Nj(this._data)).call(t,this._data)})}}};function eM(e,t){return typeof t==`object`&&!!t&&e===t.idProp&&typeof t.add==`function`&&typeof t.clear==`function`&&typeof t.distinct==`function`&&typeof jp(t)==`function`&&typeof t.get==`function`&&typeof t.getDataSet==`function`&&typeof t.getIds==`function`&&typeof t.length==`number`&&typeof Lf(t)==`function`&&typeof t.max==`function`&&typeof t.min==`function`&&typeof t.off==`function`&&typeof t.on==`function`&&typeof t.remove==`function`&&typeof t.setOptions==`function`&&typeof t.stream==`function`&&typeof t.update==`function`&&typeof t.updateOnly==`function`}function tM(e,t){return typeof t==`object`&&!!t&&e===t.idProp&&typeof jp(t)==`function`&&typeof t.get==`function`&&typeof t.getDataSet==`function`&&typeof t.getIds==`function`&&typeof t.length==`number`&&typeof Lf(t)==`function`&&typeof t.off==`function`&&typeof t.on==`function`&&typeof t.stream==`function`&&eM(e,t.getDataSet())}var nM={},rM,iM;function aM(){if(iM)return rM;iM=1;var e=Sr(),t=F(),n=I(),r=yc(),i=rg().trim,a=eg(),o=n(``.charAt),s=e.parseFloat,c=e.Symbol,l=c&&c.iterator;return rM=1/s(a+`-0`)!=-1/0||l&&!t(function(){s(Object(l))})?function(e){var t=i(r(e)),n=s(t);return n===0&&o(t,0)===`-`?-0:n}:s,rM}var oM;function sM(){if(oM)return nM;oM=1;var e=R(),t=aM();return e({global:!0,forced:parseFloat!==t},{parseFloat:t}),nM}var cM,lM;function uM(){return lM?cM:(lM=1,sM(),cM=L().parseFloat,cM)}var dM,fM;function pM(){return fM?dM:(fM=1,dM=uM(),dM)}var mM,hM;function gM(){return hM?mM:(hM=1,mM=pM(),mM)}var _M=P(gM()),vM={},yM;function bM(){if(yM)return vM;yM=1;var e=R(),t=F(),n=Lc().f;return e({target:`Object`,stat:!0,forced:t(function(){return!Object.getOwnPropertyNames(1)})},{getOwnPropertyNames:n}),vM}var xM,SM;function CM(){if(SM)return xM;SM=1,bM();var e=L().Object;return xM=function(t){return e.getOwnPropertyNames(t)},xM}var wM,TM;function EM(){return TM?wM:(TM=1,wM=CM(),wM)}var DM,OM;function kM(){return OM?DM:(OM=1,DM=EM(),DM)}var AM=P(kM());function jM(e,t){let n=[`node`,`edge`,`label`],r=!0,i=yx(t,`chosen`);if(typeof i==`boolean`)r=i;else if(typeof i==`object`){if(Pg(n).call(n,e)===-1)throw Error(`choosify: subOption '`+e+`' should be one of '`+n.join(`', '`)+`'`);let i=yx(t,[`chosen`,e]);(typeof i==`boolean`||typeof i==`function`)&&(r=i)}return r}function MM(e,t,n){if(e.width<=0||e.height<=0)return!1;if(n!==void 0){let e={x:t.x-n.x,y:t.y-n.y};if(n.angle!==0){let r=-n.angle;t={x:Math.cos(r)*e.x-Math.sin(r)*e.y,y:Math.sin(r)*e.x+Math.cos(r)*e.y}}else t=e}let r=e.x+e.width,i=e.y+e.width;return e.left<t.x&&r>t.x&&e.top<t.y&&i>t.y}function NM(e){return typeof e==`string`&&e!==``}function PM(e,t,n,r){let i=r.x,a=r.y;if(typeof r.distanceToBorder==`function`){let n=r.distanceToBorder(e,t),o=Math.sin(t)*n,s=Math.cos(t)*n;s===n?(i+=n,a=r.y):o===n?(i=r.x,a-=n):(i+=s,a-=o)}else r.shape.width>r.shape.height?(i=r.x+r.shape.width*.5,a=r.y-n):(i=r.x+n,a=r.y-r.shape.height*.5);return{x:i,y:a}}var FM=class{constructor(e){this.measureText=e,this.current=0,this.width=0,this.height=0,this.lines=[]}_add(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`normal`;this.lines[e]===void 0&&(this.lines[e]={width:0,height:0,blocks:[]});let r=t;(t===void 0||t===``)&&(r=` `);let i=this.measureText(r,n),a=Jo({},bj(i));a.text=t,a.width=i.width,a.mod=n,(t===void 0||t===``)&&(a.width=0),this.lines[e].blocks.push(a),this.lines[e].width+=a.width}curWidth(){let e=this.lines[this.current];return e===void 0?0:e.width}append(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`normal`;this._add(this.current,e,t)}newLine(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`normal`;this._add(this.current,e,t),this.current++}determineLineHeights(){for(let e=0;e<this.lines.length;e++){let t=this.lines[e],n=0;if(t.blocks!==void 0)for(let e=0;e<t.blocks.length;e++){let r=t.blocks[e];n<r.height&&(n=r.height)}t.height=n}}determineLabelSize(){let e=0,t=0;for(let n=0;n<this.lines.length;n++){let r=this.lines[n];r.width>e&&(e=r.width),t+=r.height}this.width=e,this.height=t}removeEmptyBlocks(){let e=[];for(let t=0;t<this.lines.length;t++){let n=this.lines[t];if(n.blocks.length===0||t===this.lines.length-1&&n.width===0)continue;let r={};Jo(r,n),r.blocks=[];let i,a=[];for(let e=0;e<n.blocks.length;e++){let t=n.blocks[e];t.width===0?i===void 0&&(i=t):a.push(t)}a.length===0&&i!==void 0&&a.push(i),r.blocks=a,e.push(r)}return e}finalize(){this.determineLineHeights(),this.determineLabelSize();let e=this.removeEmptyBlocks();return{width:this.width,height:this.height,lines:e}}},IM={"<b>":/<b>/,"<i>":/<i>/,"<code>":/<code>/,"</b>":/<\/b>/,"</i>":/<\/i>/,"</code>":/<\/code>/,"*":/\*/,_:/_/,"`":/`/,afterBold:/[^*]/,afterItal:/[^_]/,afterMono:/[^`]/},LM=class{constructor(e){this.text=e,this.bold=!1,this.ital=!1,this.mono=!1,this.spacing=!1,this.position=0,this.buffer=``,this.modStack=[],this.blocks=[]}mod(){return this.modStack.length===0?`normal`:this.modStack[0]}modName(){if(this.modStack.length===0)return`normal`;if(this.modStack[0]===`mono`)return`mono`;if(this.bold&&this.ital)return`boldital`;if(this.bold)return`bold`;if(this.ital)return`ital`}emitBlock(){this.spacing&&=(this.add(` `),!1),this.buffer.length>0&&(this.blocks.push({text:this.buffer,mod:this.modName()}),this.buffer=``)}add(e){e===` `&&(this.spacing=!0),this.spacing&&=(this.buffer+=` `,!1),e!=` `&&(this.buffer+=e)}parseWS(e){return/[ \t]/.test(e)?(this.mono?this.add(e):this.spacing=!0,!0):!1}setTag(e){this.emitBlock(),this[e]=!0,this.modStack.unshift(e)}unsetTag(e){this.emitBlock(),this[e]=!1,this.modStack.shift()}parseStartTag(e,t){return!this.mono&&!this[e]&&this.match(t)?(this.setTag(e),!0):!1}match(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,[n,r]=this.prepareRegExp(e),i=n.test(this.text.substr(this.position,r));return i&&t&&(this.position+=r-1),i}parseEndTag(e,t,n){let r=this.mod()===e;return e===`mono`?r&&=this.mono:r&&=!this.mono,r&&this.match(t)?((n===void 0||this.position===this.text.length-1||this.match(n,!1))&&this.unsetTag(e),!0):!1}replace(e,t){return this.match(e)?(this.add(t),this.position+=length-1,!0):!1}prepareRegExp(e){let t,n;if(e instanceof RegExp)n=e,t=1;else{let r=IM[e];n=r===void 0?new RegExp(e):r,t=e.length}return[n,t]}},RM=class{constructor(e,t,n,r){this.ctx=e,this.parent=t,this.selected=n,this.hover=r;let i=(t,i)=>{if(t===void 0)return 0;let a=this.parent.getFormattingValues(e,n,r,i),o=0;return t!==``&&(o=this.ctx.measureText(t).width),{width:o,values:a}};this.lines=new FM(i)}process(e){if(!NM(e))return this.lines.finalize();let t=this.parent.fontOptions;e=e.replace(/\r\n/g,`
|
|
913
913
|
`),e=e.replace(/\r/g,`
|
|
914
914
|
`);let n=String(e).split(`
|
|
915
|
-
`),r=n.length;if(t.multi)for(let e=0;e<r;e++){let r=this.splitBlocks(n[e],t.multi);if(r!==void 0){if(r.length===0){this.lines.newLine(``);continue}if(t.maxWdt>0)for(let e=0;e<r.length;e++){let t=r[e].mod,n=r[e].text;this.splitStringIntoLines(n,t,!0)}else for(let e=0;e<r.length;e++){let t=r[e].mod,n=r[e].text;this.lines.append(n,t)}this.lines.newLine()}}else if(t.maxWdt>0)for(let e=0;e<r;e++)this.splitStringIntoLines(n[e]);else for(let e=0;e<r;e++)this.lines.newLine(n[e]);return this.lines.finalize()}decodeMarkupSystem(e){let t=`none`;return e===`markdown`||e===`md`?t=`markdown`:(e===!0||e===`html`)&&(t=`html`),t}splitHtmlBlocks(e){let t=new LM(e),n=e=>/&/.test(e)?(t.replace(t.text,`<`,`<`)||t.replace(t.text,`&`,`&`)||t.add(`&`),!0):!1;for(;t.position<t.text.length;){let e=t.text.charAt(t.position);t.parseWS(e)||/</.test(e)&&(t.parseStartTag(`bold`,`<b>`)||t.parseStartTag(`ital`,`<i>`)||t.parseStartTag(`mono`,`<code>`)||t.parseEndTag(`bold`,`</b>`)||t.parseEndTag(`ital`,`</i>`)||t.parseEndTag(`mono`,`</code>`))||n(e)||t.add(e),t.position++}return t.emitBlock(),t.blocks}splitMarkdownBlocks(e){let t=new LM(e),n=!0,r=e=>/\\/.test(e)?(t.position<this.text.length+1&&(t.position++,e=this.text.charAt(t.position),/ \t/.test(e)?t.spacing=!0:(t.add(e),n=!1)),!0):!1;for(;t.position<t.text.length;){let e=t.text.charAt(t.position);t.parseWS(e)||r(e)||(n||t.spacing)&&(t.parseStartTag(`bold`,`*`)||t.parseStartTag(`ital`,`_`)||t.parseStartTag(`mono`,"`"))||t.parseEndTag(`bold`,`*`,`afterBold`)||t.parseEndTag(`ital`,`_`,`afterItal`)||t.parseEndTag(`mono`,"`",`afterMono`)||(t.add(e),n=!1),t.position++}return t.emitBlock(),t.blocks}splitBlocks(e,t){let n=this.decodeMarkupSystem(t);if(n===`none`)return[{text:e,mod:`normal`}];if(n===`markdown`)return this.splitMarkdownBlocks(e);if(n===`html`)return this.splitHtmlBlocks(e)}overMaxWidth(e){let t=this.ctx.measureText(e).width;return this.lines.curWidth()+t>this.parent.fontOptions.maxWdt}getLongestFit(e){let t=``,n=0;for(;n<e.length;){let r=t+(t===``?``:` `)+e[n];if(this.overMaxWidth(r))break;t=r,n++}return n}getLongestFitWord(e){let t=0;for(;t<e.length&&!this.overMaxWidth(Kd(e).call(e,0,t));)t++;return t}splitStringIntoLines(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`normal`,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,`$1\r`),e=e.replace(/([^\r][^ ]*)( +)/g,`$1\r$2\r`);let r=e.split(`\r`);for(;r.length>0;){let e=this.getLongestFit(r);if(e===0){let e=r[0],n=this.getLongestFitWord(e);this.lines.newLine(Kd(e).call(e,0,n),t),r[0]=Kd(e).call(e,n)}else{let i=e;r[e-1]===` `?e--:r[i]===` `&&i++;let a=Kd(r).call(r,0,e).join(``);e==r.length&&n?this.lines.append(a,t):this.lines.newLine(a,t),r=Kd(r).call(r,i)}}}},zM=[`bold`,`ital`,`boldital`,`mono`],BM=class e{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.body=e,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(t),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=n}setOptions(e){if(this.elementOptions=e,this.initFontOptions(e.font),NM(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font==`string`)this.baseSize=this.fontOptions.size;else if(typeof e.font==`object`){let t=e.font.size;t!==void 0&&(this.baseSize=t)}}}initFontOptions(t){if(ix(zM,e=>{this.fontOptions[e]={}}),e.parseFontString(this.fontOptions,t)){this.fontOptions.vadjust=0;return}ix(t,(e,t)=>{e!=null&&typeof e!=`object`&&(this.fontOptions[t]=e)})}static parseFontString(e,t){if(!t||typeof t!=`string`)return!1;let n=t.split(` `);return e.size=+n[0].replace(`px`,``),e.face=n[1],e.color=n[2],!0}constrain(e){let t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:`middle`},n=yx(e,`widthConstraint`);if(typeof n==`number`)t.maxWdt=Number(n),t.minWdt=Number(n);else if(typeof n==`object`){let n=yx(e,[`widthConstraint`,`maximum`]);typeof n==`number`&&(t.maxWdt=Number(n));let r=yx(e,[`widthConstraint`,`minimum`]);typeof r==`number`&&(t.minWdt=Number(r))}let r=yx(e,`heightConstraint`);if(typeof r==`number`)t.minHgt=Number(r);else if(typeof r==`object`){let n=yx(e,[`heightConstraint`,`minimum`]);typeof n==`number`&&(t.minHgt=Number(n));let r=yx(e,[`heightConstraint`,`valign`]);typeof r==`string`&&(r===`top`||r===`bottom`)&&(t.valign=r)}return t}update(e,t){this.setOptions(e,!0),this.propagateFonts(t),$b(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=jM(`label`,t)}adjustSizes(e){let t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);let n=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=n)}addFontOptionsToPile(e,t){for(let n=0;n<t.length;++n)this.addFontToPile(e,t[n])}addFontToPile(e,t){if(t===void 0||t.font===void 0||t.font===null)return;let n=t.font;e.push(n)}getBasicOptions(t){let n={};for(let r=0;r<t.length;++r){let i=t[r],a={};e.parseFontString(a,i)&&(i=a),ix(i,(e,t)=>{e!==void 0&&(Object.prototype.hasOwnProperty.call(n,t)||(Pg(zM).call(zM,t)===-1?n[t]=e:n[t]={}))})}return n}getFontOption(t,n,r){let i;for(let a=0;a<t.length;++a){let o=t[a];if(Object.prototype.hasOwnProperty.call(o,n)){if(i=o[n],i==null)continue;let t={};if(e.parseFontString(t,i)&&(i=t),Object.prototype.hasOwnProperty.call(i,r))return i[r]}}if(Object.prototype.hasOwnProperty.call(this.fontOptions,r))return this.fontOptions[r];throw Error(`Did not find value for multi-font for property: '`+r+`'`)}getFontOptions(e,t){let n={},r=[`color`,`size`,`face`,`mod`,`vadjust`];for(let i=0;i<r.length;++i){let a=r[i];n[a]=this.getFontOption(e,t,a)}return n}propagateFonts(e){let t=[];this.addFontOptionsToPile(t,e),this.fontOptions=this.getBasicOptions(t);for(let e=0;e<zM.length;++e){let n=zM[e],r=this.fontOptions[n];ix(this.getFontOptions(t,n),(e,t)=>{r[t]=e}),r.size=Number(r.size),r.vadjust=Number(r.vadjust)}}draw(e,t,n,r,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:`middle`;if(this.elementOptions.label===void 0)return;let o=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&o<this.elementOptions.scaling.label.drawThreshold-1||(o>=this.elementOptions.scaling.label.maxVisible&&(o=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,r,i,t,n,a),this._drawBackground(e),this._drawText(e,t,this.size.yLine,a,o))}_drawBackground(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!==`none`){e.fillStyle=this.fontOptions.background;let t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}_drawText(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`middle`,i=arguments.length>4?arguments[4]:void 0;[t,n]=this._setAlignment(e,t,n,r),e.textAlign=`left`,t-=this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign===`top`&&(n-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign===`bottom`&&(n+=(this.size.height-this.size.labelHeight)/2));for(let r=0;r<this.lineCount;r++){let a=this.lines[r];if(a&&a.blocks){let r=0;this.isEdgeLabel||this.fontOptions.align===`center`?r+=(this.size.width-a.width)/2:this.fontOptions.align===`right`&&(r+=this.size.width-a.width);for(let o=0;o<a.blocks.length;o++){let s=a.blocks[o];e.font=s.font;let[c,l]=this._getColor(s.color,i,s.strokeColor);s.strokeWidth>0&&(e.lineWidth=s.strokeWidth,e.strokeStyle=l,e.lineJoin=`round`),e.fillStyle=c,s.strokeWidth>0&&e.strokeText(s.text,t+r,n+s.vadjust),e.fillText(s.text,t+r,n+s.vadjust),r+=s.width}n+=a.height}}}_setAlignment(e,t,n,r){return this.isEdgeLabel&&this.fontOptions.align!==`horizontal`&&this.pointToSelf===!1?(t=0,n=0,this.fontOptions.align===`top`?(e.textBaseline=`alphabetic`,n-=4):this.fontOptions.align===`bottom`?(e.textBaseline=`hanging`,n+=4):e.textBaseline=`middle`):e.textBaseline=r,[t,n]}_getColor(e,t,n){let r=e||`#000000`,i=n||`#ffffff`;if(t<=this.elementOptions.scaling.label.drawThreshold){let e=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));r=ox(r,e),i=ox(i,e)}return[r,i]}getTextSize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,n),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}getSize(){let e=this.size.left,t=this.size.top-.5*2;if(this.isEdgeLabel){let n=-this.size.width*.5;switch(this.fontOptions.align){case`middle`:e=n,t=-this.size.height*.5;break;case`top`:e=n,t=-(this.size.height+2);break;case`bottom`:e=n,t=2;break}}return{left:e,top:t,width:this.size.width,height:this.size.height}}calculateLabelSize(e,t,n){let 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]:`middle`;this._processLabel(e,t,n),this.size.left=r-this.size.width*.5,this.size.top=i-this.size.height*.5,this.size.yLine=i+(1-this.lineCount)*.5*this.fontOptions.size,a===`hanging`&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}getFormattingValues(e,t,n,r){let i=function(e,t,n){return t===`normal`?n===`mod`?``:e[n]:e[t][n]===void 0?e[n]:e[t][n]},a={color:i(this.fontOptions,r,`color`),size:i(this.fontOptions,r,`size`),face:i(this.fontOptions,r,`face`),mod:i(this.fontOptions,r,`mod`),vadjust:i(this.fontOptions,r,`vadjust`),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||n)&&(r===`normal`&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?a.mod=`bold`:typeof this.fontOptions.chooser==`function`&&this.fontOptions.chooser(a,this.elementOptions.id,t,n));let o=``;return a.mod!==void 0&&a.mod!==``&&(o+=a.mod+` `),o+=a.size+`px `+a.face,e.font=o.replace(/"/g,``),a.font=e.font,a.height=a.size,a}differentState(e,t){return e!==this.selectedState||t!==this.hoverState}_processLabelText(e,t,n,r){return new RM(e,this,t,n).process(r)}_processLabel(e,t,n){if(this.labelDirty===!1&&!this.differentState(t,n))return;let r=this._processLabelText(e,t,n,this.elementOptions.label);this.fontOptions.minWdt>0&&r.width<this.fontOptions.minWdt&&(r.width=this.fontOptions.minWdt),this.size.labelHeight=r.height,this.fontOptions.minHgt>0&&r.height<this.fontOptions.minHgt&&(r.height=this.fontOptions.minHgt),this.lines=r.lines,this.lineCount=r.lines.length,this.size.width=r.width,this.size.height=r.height,this.selectedState=t,this.hoverState=n,this.labelDirty=!1}visible(){return!(this.size.width===0||this.size.height===0||this.elementOptions.label===void 0||this.fontOptions.size*this.body.view.scale<this.elementOptions.scaling.label.drawThreshold-1)}},VM=class{constructor(e,t,n){this.body=t,this.labelModule=n,this.setOptions(e),this.top=void 0,this.left=void 0,this.height=void 0,this.width=void 0,this.radius=void 0,this.margin=void 0,this.refreshNeeded=!0,this.boundingBox={top:0,left:0,right:0,bottom:0}}setOptions(e){this.options=e}_setMargins(e){this.margin={},this.options.margin&&(typeof this.options.margin==`object`?(this.margin.top=this.options.margin.top,this.margin.right=this.options.margin.right,this.margin.bottom=this.options.margin.bottom,this.margin.left=this.options.margin.left):(this.margin.top=this.options.margin,this.margin.right=this.options.margin,this.margin.bottom=this.options.margin,this.margin.left=this.options.margin)),e.adjustSizes(this.margin)}_distanceToBorder(e,t){let n=this.options.borderWidth;return e&&this.resize(e),Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+n}enableShadow(e,t){t.shadow&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}disableShadow(e,t){t.shadow&&(e.shadowColor=`rgba(0,0,0,0)`,e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}enableBorderDashes(e,t){if(t.borderDashes!==!1)if(e.setLineDash!==void 0){let n=t.borderDashes;n===!0&&(n=[5,15]),e.setLineDash(n)}else console.warn(`setLineDash is not supported in this browser. The dashed borders cannot be used.`),this.options.shapeProperties.borderDashes=!1,t.borderDashes=!1}disableBorderDashes(e,t){t.borderDashes!==!1&&(e.setLineDash===void 0?(console.warn(`setLineDash is not supported in this browser. The dashed borders cannot be used.`),this.options.shapeProperties.borderDashes=!1,t.borderDashes=!1):e.setLineDash([0]))}needsRefresh(e,t){return this.refreshNeeded===!0?(this.refreshNeeded=!1,!0):this.width===void 0||this.labelModule.differentState(e,t)}initContextForDraw(e,t){let n=t.borderWidth/this.body.view.scale;e.lineWidth=Math.min(this.width,n),e.strokeStyle=t.borderColor,e.fillStyle=t.color}performStroke(e,t){let n=t.borderWidth/this.body.view.scale;e.save(),n>0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}performFill(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),av(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}_addBoundingBoxMargin(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}_updateBoundingBox(e,t,n,r,i){n!==void 0&&this.resize(n,r,i),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}updateBoundingBox(e,t,n,r,i){this._updateBoundingBox(e,t,n,r,i)}getDimensionsFromLabel(e,t,n){this.textSize=this.labelModule.getTextSize(e,t,n);let r=this.textSize.width,i=this.textSize.height;return r===0&&(r=14,i=14),{width:r,height:i}}},HM=class extends VM{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,n)){let r=this.getDimensionsFromLabel(e,t,n);this.width=r.width+this.margin.right+this.margin.left,this.height=r.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}draw(e,t,n,r,i,a){this.resize(e,r,i),this.left=t-this.width/2,this.top=n-this.height/2,this.initContextForDraw(e,a),Ts(e,this.left,this.top,this.width,this.height,a.borderRadius),this.performFill(e,a),this.updateBoundingBox(t,n,e,r,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,r,i)}updateBoundingBox(e,t,n,r,i){this._updateBoundingBox(e,t,n,r,i);let a=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(a)}distanceToBorder(e,t){e&&this.resize(e);let n=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+n}},UM=class extends VM{constructor(e,t,n){super(e,t,n),this.labelOffset=0,this.selected=!1}setOptions(e,t,n){this.options=e,t===void 0&&n===void 0||this.setImages(t,n)}setImages(e,t){t&&this.selected?(this.imageObj=t,this.imageObjAlt=e):(this.imageObj=e,this.imageObjAlt=t)}switchImages(e){let t=e&&!this.selected||!e&&this.selected;if(this.selected=e,this.imageObjAlt!==void 0&&t){let e=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=e}}_getImagePadding(){let e={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){let t=this.options.imagePadding;typeof t==`object`?(e.top=t.top,e.right=t.right,e.bottom=t.bottom,e.left=t.left):(e.top=t,e.right=t,e.bottom=t,e.left=t)}return e}_resizeImage(){let e,t;if(this.options.shapeProperties.useImageSize===!1){let n=1,r=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?n=this.imageObj.width/this.imageObj.height:r=this.imageObj.height/this.imageObj.width),e=this.options.size*2*n,t=this.options.size*2*r}else{let n=this._getImagePadding();e=this.imageObj.width+n.left+n.right,t=this.imageObj.height+n.top+n.bottom}this.width=e,this.height=t,this.radius=.5*this.width}_drawRawCircle(e,t,n,r){this.initContextForDraw(e,r),ys(e,t,n,r.size),this.performFill(e,r)}_drawImageAtPosition(e,t){if(this.imageObj.width!=0){e.globalAlpha=t.opacity===void 0?1:t.opacity,this.enableShadow(e,t);let n=1;this.options.shapeProperties.interpolation===!0&&(n=this.imageObj.width/this.width/this.body.view.scale);let r=this._getImagePadding(),i=this.left+r.left,a=this.top+r.top,o=this.width-r.left-r.right,s=this.height-r.top-r.bottom;this.imageObj.drawImageAtPosition(e,n,i,a,o,s),this.disableShadow(e,t)}}_drawImageLabel(e,t,n,r,i){let a=0;if(this.height!==void 0){a=this.height*.5;let t=this.labelModule.getTextSize(e,r,i);t.lineCount>=1&&(a+=t.height/2)}let o=n+a;this.options.label&&(this.labelOffset=a),this.labelModule.draw(e,t,o,r,i,`hanging`)}},WM=class extends UM{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,n)){let r=this.getDimensionsFromLabel(e,t,n),i=Math.max(r.width+this.margin.right+this.margin.left,r.height+this.margin.top+this.margin.bottom);this.options.size=i/2,this.width=i,this.height=i,this.radius=this.width/2}}draw(e,t,n,r,i,a){this.resize(e,r,i),this.left=t-this.width/2,this.top=n-this.height/2,this._drawRawCircle(e,t,n,a),this.updateBoundingBox(t,n),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,n,r,i)}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size}distanceToBorder(e){return e&&this.resize(e),this.width*.5}},GM=class extends UM{constructor(e,t,n,r,i){super(e,t,n),this.setImages(r,i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){let e=this.options.size*2;this.width=e,this.height=e,this.radius=.5*this.width;return}this.needsRefresh(t,n)&&this._resizeImage()}draw(e,t,n,r,i,a){this.switchImages(r),this.resize();let o=t,s=n;this.options.shapeProperties.coordinateOrigin===`top-left`?(this.left=t,this.top=n,o+=this.width/2,s+=this.height/2):(this.left=t-this.width/2,this.top=n-this.height/2),this._drawRawCircle(e,o,s,a),e.save(),e.clip(),this._drawImageAtPosition(e,a),e.restore(),this._drawImageLabel(e,o,s,r,i),this.updateBoundingBox(t,n)}updateBoundingBox(e,t){this.options.shapeProperties.coordinateOrigin===`top-left`?(this.boundingBox.top=t,this.boundingBox.left=e,this.boundingBox.right=e+this.options.size*2,this.boundingBox.bottom=t+this.options.size*2):(this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}distanceToBorder(e){return e&&this.resize(e),this.width*.5}},KM=class extends VM{constructor(e,t,n){super(e,t,n)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(t,n)){this.labelModule.getTextSize(e,t,n);let i=2*r.size;this.width=this.customSizeWidth??i,this.height=this.customSizeHeight??i,this.radius=.5*this.width}}_drawShape(e,t,n,r,i,a,o,s){return this.resize(e,a,o,s),this.left=r-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,s),js(t)(e,r,i,s.size),this.performFill(e,s),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(e.font=(a?`bold `:``)+this.height/2+`px `+(this.options.icon.face||`FontAwesome`),e.fillStyle=this.options.icon.color||`black`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(this.options.icon.code,r,i)),{drawExternalLabel:()=>{if(this.options.label!==void 0){this.labelModule.calculateLabelSize(e,a,o,r,i,`hanging`);let t=i+.5*this.height+.5*this.labelModule.size.height;this.labelModule.draw(e,r,t,a,o,`hanging`)}this.updateBoundingBox(r,i)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}};function qM(e,t){var n=Xf(e);if(Rw){var r=Rw(e);t&&(r=Ph(r).call(r,function(t){return Zw(e,t).enumerable})),n.push.apply(n,r)}return n}function JM(e){for(var t=1;t<arguments.length;t++){var n,r,i=arguments[t]==null?{}:arguments[t];t%2?jp(n=qM(Object(i),!0)).call(n,function(t){OD(e,t,i[t])}):uT?CT(e,uT(i)):jp(r=qM(Object(i))).call(r,function(t){Lj(e,t,Zw(i,t))})}return e}var YM=class extends KM{constructor(e,t,n,r){super(e,t,n,r),this.ctxRenderer=r}draw(e,t,n,r,i,a){this.resize(e,r,i,a),this.left=t-this.width/2,this.top=n-this.height/2,e.save();let o=this.ctxRenderer({ctx:e,id:this.options.id,x:t,y:n,state:{selected:r,hover:i},style:JM({},a),label:this.options.label});if(o.drawNode!=null&&o.drawNode(),e.restore(),o.drawExternalLabel){let t=o.drawExternalLabel;o.drawExternalLabel=()=>{e.save(),t(),e.restore()}}return o.nodeDimensions&&(this.customSizeWidth=o.nodeDimensions.width,this.customSizeHeight=o.nodeDimensions.height),o}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},XM=class extends VM{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e,t,n){if(this.needsRefresh(t,n)){let r=this.getDimensionsFromLabel(e,t,n).width+this.margin.right+this.margin.left;this.width=r,this.height=r,this.radius=this.width/2}}draw(e,t,n,r,i,a){this.resize(e,r,i),this.left=t-this.width/2,this.top=n-this.height/2,this.initContextForDraw(e,a),Ds(e,t-this.width/2,n-this.height/2,this.width,this.height),this.performFill(e,a),this.updateBoundingBox(t,n,e,r,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,r,i)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},ZM=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`diamond`,4,t,n,r,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},QM=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`circle`,2,t,n,r,i,a)}distanceToBorder(e){return e&&this.resize(e),this.options.size}},$M=class extends VM{constructor(e,t,n){super(e,t,n)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,n)){let r=this.getDimensionsFromLabel(e,t,n);this.height=r.height*2,this.width=r.width+r.height,this.radius=.5*this.width}}draw(e,t,n,r,i,a){this.resize(e,r,i),this.left=t-this.width*.5,this.top=n-this.height*.5,this.initContextForDraw(e,a),Es(e,this.left,this.top,this.width,this.height),this.performFill(e,a),this.updateBoundingBox(t,n,e,r,i),this.labelModule.draw(e,t,n,r,i)}distanceToBorder(e,t){e&&this.resize(e);let n=this.width*.5,r=this.height*.5,i=Math.sin(t)*n,a=Math.cos(t)*r;return n*r/Math.sqrt(i*i+a*a)}},eN=class extends VM{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e,t,n){this.needsRefresh(t,n)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,n,r,i,a){return this.resize(e,r,i),this.options.icon.size=this.options.icon.size||50,this.left=t-this.width/2,this.top=n-this.height/2,this._icon(e,t,n,r,i,a),{drawExternalLabel:()=>{this.options.label!==void 0&&this.labelModule.draw(e,this.left+this.iconSize.width/2+this.margin.left,n+this.height/2+5,r),this.updateBoundingBox(t,n)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.icon.size*.5,this.boundingBox.left=e-this.options.icon.size*.5,this.boundingBox.right=e+this.options.icon.size*.5,this.boundingBox.bottom=t+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+5))}_icon(e,t,n,r,i,a){let o=Number(this.options.icon.size);this.options.icon.code===void 0?console.error(`When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.`):(e.font=[this.options.icon.weight==null?r?`bold`:``:this.options.icon.weight,(this.options.icon.weight!=null&&r?5:0)+o+`px`,this.options.icon.face].join(` `),e.fillStyle=this.options.icon.color||`black`,e.textAlign=`center`,e.textBaseline=`middle`,this.enableShadow(e,a),e.fillText(this.options.icon.code,t,n),this.disableShadow(e,a))}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},tN=class extends UM{constructor(e,t,n,r,i){super(e,t,n),this.setImages(r,i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){let e=this.options.size*2;this.width=e,this.height=e;return}this.needsRefresh(t,n)&&this._resizeImage()}draw(e,t,n,r,i,a){e.save(),this.switchImages(r),this.resize();let o=t,s=n;if(this.options.shapeProperties.coordinateOrigin===`top-left`?(this.left=t,this.top=n,o+=this.width/2,s+=this.height/2):(this.left=t-this.width/2,this.top=n-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){let t=this.options.borderWidth,n=this.options.borderWidthSelected||2*this.options.borderWidth,o=(r?n:t)/this.body.view.scale;e.lineWidth=Math.min(this.width,o),e.beginPath();let s=r?this.options.color.highlight.border:i?this.options.color.hover.border:this.options.color.border,c=r?this.options.color.highlight.background:i?this.options.color.hover.background:this.options.color.background;a.opacity!==void 0&&(s=ox(s,a.opacity),c=ox(c,a.opacity)),e.strokeStyle=s,e.fillStyle=c,e.rect(this.left-.5*e.lineWidth,this.top-.5*e.lineWidth,this.width+e.lineWidth,this.height+e.lineWidth),av(e).call(e),this.performStroke(e,a),e.closePath()}this._drawImageAtPosition(e,a),this._drawImageLabel(e,o,s,r,i),this.updateBoundingBox(t,n),e.restore()}updateBoundingBox(e,t){this.resize(),this.options.shapeProperties.coordinateOrigin===`top-left`?(this.left=e,this.top=t):(this.left=e-this.width/2,this.top=t-this.height/2),this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},nN=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`square`,2,t,n,r,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},rN=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`hexagon`,4,t,n,r,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},iN=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`star`,4,t,n,r,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},aN=class extends VM{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e,t,n){this.needsRefresh(t,n)&&(this.textSize=this.labelModule.getTextSize(e,t,n),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,n,r,i,a){this.resize(e,r,i),this.left=t-this.width/2,this.top=n-this.height/2,this.enableShadow(e,a),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,r,i),this.disableShadow(e,a),this.updateBoundingBox(t,n,e,r,i)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},oN=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`triangle`,3,t,n,r,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},sN=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`triangleDown`,3,t,n,r,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};function cN(e,t){var n=Xf(e);if(Rw){var r=Rw(e);t&&(r=Ph(r).call(r,function(t){return Zw(e,t).enumerable})),n.push.apply(n,r)}return n}function lN(e){for(var t=1;t<arguments.length;t++){var n,r,i=arguments[t]==null?{}:arguments[t];t%2?jp(n=cN(Object(i),!0)).call(n,function(t){OD(e,t,i[t])}):uT?CT(e,uT(i)):jp(r=cN(Object(i))).call(r,function(t){Lj(e,t,Zw(i,t))})}return e}var uN=class e{constructor(e,t,n,r,i,a){this.options=gx(i),this.globalOptions=i,this.defaultOptions=a,this.body=t,this.edges=[],this.id=void 0,this.imagelist=n,this.grouplist=r,this.x=void 0,this.y=void 0,this.baseSize=this.options.size,this.baseFontSize=this.options.font.size,this.predefinedPosition=!1,this.selected=!1,this.hover=!1,this.labelModule=new BM(this.body,this.options,!1),this.setOptions(e)}attachEdge(e){var t;Pg(t=this.edges).call(t,e)===-1&&this.edges.push(e)}detachEdge(e){var t;let n=Pg(t=this.edges).call(t,e);if(n!=-1){var r;hm(r=this.edges).call(r,n,1)}}setOptions(t){let n=this.options.shape;if(!t)return;if(t.color!==void 0&&(this._localColor=t.color),t.id!==void 0&&(this.id=t.id),this.id===void 0)throw Error(`Node must have an id`);e.checkMass(t,this.id),t.x!==void 0&&(t.x===null?(this.x=void 0,this.predefinedPosition=!1):(this.x=vg(t.x),this.predefinedPosition=!0)),t.y!==void 0&&(t.y===null?(this.y=void 0,this.predefinedPosition=!1):(this.y=vg(t.y),this.predefinedPosition=!0)),t.size!==void 0&&(this.baseSize=t.size),t.value!==void 0&&(t.value=_M(t.value)),e.parseOptions(this.options,t,!0,this.globalOptions,this.grouplist);let r=[t,this.options,this.defaultOptions];return this.chooser=jM(`node`,r),this._load_images(),this.updateLabelModule(t),t.opacity!==void 0&&e.checkOpacity(t.opacity)&&(this.options.opacity=t.opacity),this.updateShape(n),t.hidden!==void 0||t.physics!==void 0}_load_images(){if((this.options.shape===`circularImage`||this.options.shape===`image`)&&this.options.image===void 0)throw Error(`Option image must be defined for node type '`+this.options.shape+`'`);if(this.options.image!==void 0){if(this.imagelist===void 0)throw Error(`Internal Error: No images provided`);if(typeof this.options.image==`string`)this.imageObj=this.imagelist.load(this.options.image,this.options.brokenImage,this.id);else{if(this.options.image.unselected===void 0)throw Error(`No unselected image provided`);this.imageObj=this.imagelist.load(this.options.image.unselected,this.options.brokenImage,this.id),this.options.image.selected===void 0?this.imageObjAlt=void 0:this.imageObjAlt=this.imagelist.load(this.options.image.selected,this.options.brokenImage,this.id)}}}static checkOpacity(e){return 0<=e&&e<=1}static checkCoordinateOrigin(e){return e===void 0||e===`center`||e===`top-left`}static updateGroupOptions(t,n,r){var i;if(r===void 0)return;let a=t.group;if(n!==void 0&&n.group!==void 0&&a!==n.group)throw Error(`updateGroupOptions: group values in options don't match.`);if(!(typeof a==`number`||typeof a==`string`&&a!=``))return;let o=r.get(a);o.opacity!==void 0&&n.opacity===void 0&&(e.checkOpacity(o.opacity)||(console.error(`Invalid option for node opacity. Value must be between 0 and 1, found: `+o.opacity),o.opacity=void 0));let s=Ph(i=AM(n)).call(i,e=>n[e]!=null);s.push(`font`),Qb(s,t,o),t.color=cx(t.color)}static parseOptions(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=arguments.length>4?arguments[4]:void 0;if(Qb([`color`,`fixed`,`shadow`],t,n,r),e.checkMass(n),t.opacity!==void 0&&(e.checkOpacity(t.opacity)||(console.error(`Invalid option for node opacity. Value must be between 0 and 1, found: `+t.opacity),t.opacity=void 0)),n.opacity!==void 0&&(e.checkOpacity(n.opacity)||(console.error(`Invalid option for node opacity. Value must be between 0 and 1, found: `+n.opacity),n.opacity=void 0)),n.shapeProperties&&!e.checkCoordinateOrigin(n.shapeProperties.coordinateOrigin)&&console.error(`Invalid option for node coordinateOrigin, found: `+n.shapeProperties.coordinateOrigin),_x(t,n,`shadow`,i),n.color!==void 0&&n.color!==null){let e=cx(n.color);Xb(t.color,e)}else r===!0&&n.color===null&&(t.color=gx(i.color));n.fixed!==void 0&&n.fixed!==null&&(typeof n.fixed==`boolean`?(t.fixed.x=n.fixed,t.fixed.y=n.fixed):(n.fixed.x!==void 0&&typeof n.fixed.x==`boolean`&&(t.fixed.x=n.fixed.x),n.fixed.y!==void 0&&typeof n.fixed.y==`boolean`&&(t.fixed.y=n.fixed.y))),r===!0&&n.font===null&&(t.font=gx(i.font)),e.updateGroupOptions(t,n,a),n.scaling!==void 0&&_x(t.scaling,n.scaling,`label`,i.scaling)}getFormattingValues(){let e={color:this.options.color.background,opacity:this.options.opacity,borderWidth:this.options.borderWidth,borderColor:this.options.color.border,size:this.options.size,borderDashes:this.options.shapeProperties.borderDashes,borderRadius:this.options.shapeProperties.borderRadius,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y};if(this.selected||this.hover?this.chooser===!0?this.selected?(this.options.borderWidthSelected==null?e.borderWidth*=2:e.borderWidth=this.options.borderWidthSelected,e.color=this.options.color.highlight.background,e.borderColor=this.options.color.highlight.border,e.shadow=this.options.shadow.enabled):this.hover&&(e.color=this.options.color.hover.background,e.borderColor=this.options.color.hover.border,e.shadow=this.options.shadow.enabled):typeof this.chooser==`function`&&(this.chooser(e,this.options.id,this.selected,this.hover),e.shadow===!1&&(e.shadowColor!==this.options.shadow.color||e.shadowSize!==this.options.shadow.size||e.shadowX!==this.options.shadow.x||e.shadowY!==this.options.shadow.y)&&(e.shadow=!0)):e.shadow=this.options.shadow.enabled,this.options.opacity!==void 0){let t=this.options.opacity;e.borderColor=ox(e.borderColor,t),e.color=ox(e.color,t),e.shadowColor=ox(e.shadowColor,t)}return e}updateLabelModule(t){(this.options.label===void 0||this.options.label===null)&&(this.options.label=``),e.updateGroupOptions(this.options,lN(lN({},t),{},{color:t&&t.color||this._localColor||void 0}),this.grouplist);let n=this.grouplist.get(this.options.group,!1),r=[t,this.options,n,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,r),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateShape(e){if(e===this.options.shape&&this.shape)this.shape.setOptions(this.options,this.imageObj,this.imageObjAlt);else switch(this.options.shape){case`box`:this.shape=new HM(this.options,this.body,this.labelModule);break;case`circle`:this.shape=new WM(this.options,this.body,this.labelModule);break;case`circularImage`:this.shape=new GM(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case`custom`:this.shape=new YM(this.options,this.body,this.labelModule,this.options.ctxRenderer);break;case`database`:this.shape=new XM(this.options,this.body,this.labelModule);break;case`diamond`:this.shape=new ZM(this.options,this.body,this.labelModule);break;case`dot`:this.shape=new QM(this.options,this.body,this.labelModule);break;case`ellipse`:this.shape=new $M(this.options,this.body,this.labelModule);break;case`icon`:this.shape=new eN(this.options,this.body,this.labelModule);break;case`image`:this.shape=new tN(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case`square`:this.shape=new nN(this.options,this.body,this.labelModule);break;case`hexagon`:this.shape=new rN(this.options,this.body,this.labelModule);break;case`star`:this.shape=new iN(this.options,this.body,this.labelModule);break;case`text`:this.shape=new aN(this.options,this.body,this.labelModule);break;case`triangle`:this.shape=new oN(this.options,this.body,this.labelModule);break;case`triangleDown`:this.shape=new sN(this.options,this.body,this.labelModule);break;default:this.shape=new $M(this.options,this.body,this.labelModule);break}this.needsRefresh()}select(){this.selected=!0,this.needsRefresh()}unselect(){this.selected=!1,this.needsRefresh()}needsRefresh(){this.shape.refreshNeeded=!0}getTitle(){return this.options.title}distanceToBorder(e,t){return this.shape.distanceToBorder(e,t)}isFixed(){return this.options.fixed.x&&this.options.fixed.y}isSelected(){return this.selected}getValue(){return this.options.value}getLabelSize(){return this.labelModule.size()}setValueRange(e,t,n){if(this.options.value!==void 0){let r=this.options.scaling.customScalingFunction(e,t,n,this.options.value),i=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){let e=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+r*e}this.options.size=this.options.scaling.min+r*i}else this.options.size=this.baseSize,this.options.font.size=this.baseFontSize;this.updateLabelModule()}draw(e){let t=this.getFormattingValues();return this.shape.draw(e,this.x,this.y,this.selected,this.hover,t)||{}}updateBoundingBox(e){this.shape.updateBoundingBox(this.x,this.y,e)}resize(e){let t=this.getFormattingValues();this.shape.resize(e,this.selected,this.hover,t)}getItemsOnPoint(e){let t=[];return this.labelModule.visible()&&MM(this.labelModule.getSize(),e)&&t.push({nodeId:this.id,labelId:0}),MM(this.shape.boundingBox,e)&&t.push({nodeId:this.id}),t}isOverlappingWith(e){return this.shape.left<e.right&&this.shape.left+this.shape.width>e.left&&this.shape.top<e.bottom&&this.shape.top+this.shape.height>e.top}isBoundingBoxOverlappingWith(e){return this.shape.boundingBox.left<e.right&&this.shape.boundingBox.right>e.left&&this.shape.boundingBox.top<e.bottom&&this.shape.boundingBox.bottom>e.top}static checkMass(e,t){if(e.mass!==void 0&&e.mass<=0){let n=``;t!==void 0&&(n=` in node id: `+t),console.error(`%cNegative or zero mass disallowed`+n+`, setting mass to 1.`,Nx),e.mass=1}}},dN=class{constructor(e,t,n,r){var i;if(this.body=e,this.images=t,this.groups=n,this.layoutEngine=r,this.body.functions.createNode=B(i=this.create).call(i,this),this.nodesListeners={add:(e,t)=>{this.add(t.items)},update:(e,t)=>{this.update(t.items,t.data,t.oldData)},remove:(e,t)=>{this.remove(t.items)}},this.defaultOptions={borderWidth:1,borderWidthSelected:void 0,brokenImage:void 0,color:{border:`#2B7CE9`,background:`#97C2FC`,highlight:{border:`#2B7CE9`,background:`#D2E5FF`},hover:{border:`#2B7CE9`,background:`#D2E5FF`}},opacity:void 0,fixed:{x:!1,y:!1},font:{color:`#343434`,size:14,face:`arial`,background:`none`,strokeWidth:0,strokeColor:`#ffffff`,align:`center`,vadjust:0,multi:!1,bold:{mod:`bold`},boldital:{mod:`bold italic`},ital:{mod:`italic`},mono:{mod:``,size:15,face:`monospace`,vadjust:2}},group:void 0,hidden:!1,icon:{face:`FontAwesome`,code:void 0,size:50,color:`#2B7CE9`},image:void 0,imagePadding:{top:0,right:0,bottom:0,left:0},label:void 0,labelHighlightBold:!0,level:void 0,margin:{top:5,right:5,bottom:5,left:5},mass:1,physics:!0,scaling:{min:10,max:30,label:{enabled:!1,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(e,t,n,r){if(t===e)return .5;{let n=1/(t-e);return Math.max(0,(r-e)*n)}}},shadow:{enabled:!1,color:`rgba(0,0,0,0.5)`,size:10,x:5,y:5},shape:`ellipse`,shapeProperties:{borderDashes:!1,borderRadius:6,interpolation:!0,useImageSize:!1,useBorderWithImage:!1,coordinateOrigin:`center`},size:25,title:void 0,value:void 0,x:void 0,y:void 0},this.defaultOptions.mass<=0)throw`Internal error: mass in defaultOptions of NodesHandler may not be zero or negative`;this.options=gx(this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e,t;this.body.emitter.on(`refreshNodes`,B(e=this.refresh).call(e,this)),this.body.emitter.on(`refresh`,B(t=this.refresh).call(t,this)),this.body.emitter.on(`destroy`,()=>{ix(this.nodesListeners,(e,t)=>{this.body.data.nodes&&this.body.data.nodes.off(t,e)}),delete this.body.functions.createNode,delete this.nodesListeners.add,delete this.nodesListeners.update,delete this.nodesListeners.remove,delete this.nodesListeners})}setOptions(e){if(e!==void 0){if(uN.parseOptions(this.options,e),e.opacity!==void 0&&(XC(e.opacity)||!fw(e.opacity)||e.opacity<0||e.opacity>1?console.error(`Invalid option for node opacity. Value must be between 0 and 1, found: `+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(let e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this.body.nodes[e].updateShape();if(e.font!==void 0||e.widthConstraint!==void 0||e.heightConstraint!==void 0)for(let e of Xf(this.body.nodes))this.body.nodes[e].updateLabelModule(),this.body.nodes[e].needsRefresh();if(e.size!==void 0)for(let e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this.body.nodes[e].needsRefresh();(e.hidden!==void 0||e.physics!==void 0)&&this.body.emitter.emit(`_dataChanged`)}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.data.nodes;if(tM(`id`,e))this.body.data.nodes=e;else if(W(e))this.body.data.nodes=new $j,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new $j;else throw TypeError(`Array or DataSet expected`);if(n&&ix(this.nodesListeners,function(e,t){n.off(t,e)}),this.body.nodes={},this.body.data.nodes){let e=this;ix(this.nodesListeners,function(t,n){e.body.data.nodes.on(n,t)});let t=this.body.data.nodes.getIds();this.add(t,!0)}t===!1&&this.body.emitter.emit(`_dataChanged`)}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n,r=[];for(let t=0;t<e.length;t++){n=e[t];let i=this.body.data.nodes.get(n),a=this.create(i);r.push(a),this.body.nodes[n]=a}this.layoutEngine.positionInitially(r),t===!1&&this.body.emitter.emit(`_dataChanged`)}update(e,t,n){let r=this.body.nodes,i=!1;for(let n=0;n<e.length;n++){let a=e[n],o=r[a],s=t[n];o===void 0?(i=!0,o=this.create(s),r[a]=o):o.setOptions(s)&&(i=!0)}!i&&n!==void 0&&(i=Ow(t).call(t,function(e,t){let r=n[t];return r&&r.level!==e.level})),i===!0?this.body.emitter.emit(`_dataChanged`):this.body.emitter.emit(`_dataUpdated`)}remove(e){let t=this.body.nodes;for(let n=0;n<e.length;n++){let r=e[n];delete t[r]}this.body.emitter.emit(`_dataChanged`)}create(e){return new(arguments.length>1&&arguments[1]!==void 0?arguments[1]:uN)(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}refresh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;ix(this.body.nodes,(t,n)=>{let r=this.body.data.nodes.get(n);r!==void 0&&(e===!0&&t.setOptions({x:null,y:null}),t.setOptions({fixed:!1}),t.setOptions(r))})}getPositions(e){let t={};if(e!==void 0){if(W(e)===!0){for(let n=0;n<e.length;n++)if(this.body.nodes[e[n]]!==void 0){let r=this.body.nodes[e[n]];t[e[n]]={x:Math.round(r.x),y:Math.round(r.y)}}}else if(this.body.nodes[e]!==void 0){let n=this.body.nodes[e];t[e]={x:Math.round(n.x),y:Math.round(n.y)}}}else for(let e=0;e<this.body.nodeIndices.length;e++){let n=this.body.nodes[this.body.nodeIndices[e]];t[this.body.nodeIndices[e]]={x:Math.round(n.x),y:Math.round(n.y)}}return t}getPosition(e){if(e==null)throw TypeError(`No id was specified for getPosition method.`);if(this.body.nodes[e]==null)throw ReferenceError(`NodeId provided for getPosition does not exist. Provided: ${e}`);return{x:Math.round(this.body.nodes[e].x),y:Math.round(this.body.nodes[e].y)}}storePositions(){let e=[],t=this.body.data.nodes.getDataSet();for(let n of t.get()){let t=n.id,r=this.body.nodes[t],i=Math.round(r.x),a=Math.round(r.y);(n.x!==i||n.y!==a)&&e.push({id:t,x:i,y:a})}t.update(e)}getBoundingBox(e){if(this.body.nodes[e]!==void 0)return this.body.nodes[e].shape.boundingBox}getConnectedNodes(e,t){let n=[];if(this.body.nodes[e]!==void 0){let r=this.body.nodes[e],i={};for(let e=0;e<r.edges.length;e++){let a=r.edges[e];t!==`to`&&a.toId==r.id?i[a.fromId]===void 0&&(n.push(a.fromId),i[a.fromId]=!0):t!==`from`&&a.fromId==r.id&&i[a.toId]===void 0&&(n.push(a.toId),i[a.toId]=!0)}}return n}getConnectedEdges(e){let t=[];if(this.body.nodes[e]!==void 0){let n=this.body.nodes[e];for(let e=0;e<n.edges.length;e++)t.push(n.edges[e].id)}else console.error(`NodeId provided for getConnectedEdges does not exist. Provided: `,e);return t}moveNode(e,t,n){this.body.nodes[e]===void 0?console.error(`Node id supplied to moveNode does not exist. Provided: `,e):(this.body.nodes[e].x=Number(t),this.body.nodes[e].y=Number(n),B_(()=>{this.body.emitter.emit(`startSimulation`)},0))}},fN={},pN;function mN(){if(pN)return fN;pN=1;var e=R(),t=Math.hypot,n=Math.abs,r=Math.sqrt;return e({target:`Math`,stat:!0,arity:2,forced:!!t&&t(1/0,NaN)!==1/0},{hypot:function(e,t){for(var i=0,a=0,o=arguments.length,s=0,c,l;a<o;)c=n(arguments[a++]),s<c?(l=s/c,i=i*l*l+1,s=c):c>0?(l=c/s,i+=l*l):i+=c;return s===1/0?1/0:s*r(i)}}),fN}var hN,gN;function _N(){return gN?hN:(gN=1,mN(),hN=L().Math.hypot,hN)}var vN,yN;function bN(){return yN?vN:(yN=1,vN=_N(),vN)}var xN,SN;function CN(){return SN?xN:(SN=1,xN=bN(),xN)}var wN=P(CN()),TN=class{static transform(e,t){W(e)||(e=[e]);let n=t.point.x,r=t.point.y,i=t.angle,a=t.length;for(let t=0;t<e.length;++t){let o=e[t],s=o.x*Math.cos(i)-o.y*Math.sin(i),c=o.x*Math.sin(i)+o.y*Math.cos(i);o.x=n+a*s,o.y=r+a*c}}static drawPath(e,t){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;++n)e.lineTo(t[n].x,t[n].y);e.closePath()}},EN=class extends TN{static draw(e,t){if(t.image){e.save(),e.translate(t.point.x,t.point.y),e.rotate(Math.PI/2+t.angle);let n=t.imageWidth==null?t.image.width:t.imageWidth,r=t.imageHeight==null?t.image.height:t.imageHeight;t.image.drawImageAtPosition(e,1,-n/2,0,n,r),e.restore()}return!1}},DN=class extends TN{static draw(e,t){let n=[{x:0,y:0},{x:-1,y:.3},{x:-.9,y:0},{x:-1,y:-.3}];return TN.transform(n,t),TN.drawPath(e,n),!0}},ON=class{static draw(e,t){let n=[{x:-1,y:0},{x:0,y:.3},{x:-.4,y:0},{x:0,y:-.3}];return TN.transform(n,t),TN.drawPath(e,n),!0}},kN=class{static draw(e,t){let n={x:-.4,y:0};TN.transform(n,t),e.strokeStyle=e.fillStyle,e.fillStyle=`rgba(0, 0, 0, 0)`;let r=Math.PI,i=t.angle-r/2,a=t.angle+r/2;return e.beginPath(),e.arc(n.x,n.y,t.length*.4,i,a,!1),e.stroke(),!0}},AN=class{static draw(e,t){let n={x:-.3,y:0};TN.transform(n,t),e.strokeStyle=e.fillStyle,e.fillStyle=`rgba(0, 0, 0, 0)`;let r=Math.PI,i=t.angle+r/2,a=t.angle+3*r/2;return e.beginPath(),e.arc(n.x,n.y,t.length*.4,i,a,!1),e.stroke(),!0}},jN=class{static draw(e,t){let n=[{x:.02,y:0},{x:-1,y:.3},{x:-1,y:-.3}];return TN.transform(n,t),TN.drawPath(e,n),!0}},MN=class{static draw(e,t){let n=[{x:0,y:.3},{x:0,y:-.3},{x:-1,y:0}];return TN.transform(n,t),TN.drawPath(e,n),!0}},NN=class{static draw(e,t){let n={x:-.4,y:0};return TN.transform(n,t),ys(e,n.x,n.y,t.length*.4),!0}},PN=class{static draw(e,t){let n=[{x:0,y:.5},{x:0,y:-.5},{x:-.15,y:-.5},{x:-.15,y:.5}];return TN.transform(n,t),TN.drawPath(e,n),!0}},FN=class{static draw(e,t){let n=[{x:0,y:.3},{x:0,y:-.3},{x:-.6,y:-.3},{x:-.6,y:.3}];return TN.transform(n,t),TN.drawPath(e,n),!0}},IN=class{static draw(e,t){let n=[{x:0,y:0},{x:-.5,y:-.3},{x:-1,y:0},{x:-.5,y:.3}];return TN.transform(n,t),TN.drawPath(e,n),!0}},LN=class{static draw(e,t){let n=[{x:-1,y:.3},{x:-.5,y:0},{x:-1,y:-.3},{x:0,y:0}];return TN.transform(n,t),TN.drawPath(e,n),!0}},RN=class{static draw(e,t){let n;switch(t.type&&(n=t.type.toLowerCase()),n){case`image`:return EN.draw(e,t);case`circle`:return NN.draw(e,t);case`box`:return FN.draw(e,t);case`crow`:return ON.draw(e,t);case`curve`:return kN.draw(e,t);case`diamond`:return IN.draw(e,t);case`inv_curve`:return AN.draw(e,t);case`triangle`:return jN.draw(e,t);case`inv_triangle`:return MN.draw(e,t);case`bar`:return PN.draw(e,t);case`vee`:return LN.draw(e,t);default:return DN.draw(e,t)}}};function zN(e,t){var n=Xf(e);if(Rw){var r=Rw(e);t&&(r=Ph(r).call(r,function(t){return Zw(e,t).enumerable})),n.push.apply(n,r)}return n}function BN(e){for(var t=1;t<arguments.length;t++){var n,r,i=arguments[t]==null?{}:arguments[t];t%2?jp(n=zN(Object(i),!0)).call(n,function(t){OD(e,t,i[t])}):uT?CT(e,uT(i)):jp(r=zN(Object(i))).call(r,function(t){Lj(e,t,Zw(i,t))})}return e}var VN=class{constructor(e,t,n){OD(this,`color`,{}),OD(this,`colorDirty`,!0),OD(this,`hoverWidth`,1.5),OD(this,`selectionWidth`,2),this._body=t,this._labelModule=n,this.setOptions(e),this.fromPoint=this.from,this.toPoint=this.to}connect(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to]}cleanup(){return!1}setOptions(e){this.options=e,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.id=this.options.id}drawLine(e,t,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes===!1?this._drawLine(e,t,i):this._drawDashedLine(e,t,i)}_drawLine(e,t,n,r,i){if(this.from!=this.to)this._line(e,t,n,r,i);else{let[n,r,i]=this._getCircleData(e);this._circle(e,t,n,r,i)}}_drawDashedLine(e,t,n,r,i){e.lineCap=`round`;let a=W(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(a),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,n);else{let[n,r,i]=this._getCircleData(e);this._circle(e,t,n,r,i)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)Os(e,this.from.x,this.from.y,this.to.x,this.to.y,a);else{let[n,r,i]=this._getCircleData(e);this._circle(e,t,n,r,i)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}findBorderPosition(e,t,n){return this.from==this.to?this._findBorderPositionCircle(e,t,n):this._findBorderPosition(e,t,n)}findBorderPositions(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};{var t;let[n,r]=Kd(t=this._getCircleData(e)).call(t,0,2);return{from:this._findBorderPositionCircle(this.from,e,{x:n,y:r,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:n,y:r,low:.6,high:.8,direction:1})}}}_getCircleData(e){let t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);let n=PM(e,this.options.selfReference.angle,t,this.from);return[n.x,n.y,t]}_pointOnCircle(e,t,n,r){let i=r*2*Math.PI;return{x:e+n*Math.cos(i),y:t-n*Math.sin(i)}}_findBorderPositionCircle(e,t,n){let r=n.x,i=n.y,a=n.low,o=n.high,s=n.direction,c=this.options.selfReference.size,l,u=(a+o)*.5,d=0;this.options.arrowStrikethrough===!0&&(s===-1?d=this.options.endPointOffset.from:s===1&&(d=this.options.endPointOffset.to));let f=0;do{u=(a+o)*.5,l=this._pointOnCircle(r,i,c,u);let n=Math.atan2(e.y-l.y,e.x-l.x),p=e.distanceToBorder(t,n)+d-Math.sqrt((l.x-e.x)**2+(l.y-e.y)**2);if(Math.abs(p)<.05)break;p>0?s>0?a=u:o=u:s>0?o=u:a=u,++f}while(a<=o&&f<10);return BN(BN({},l),{},{t:u})}getLineWidth(e,t){return Math.max(e===!0?this.selectionWidth:t===!0?this.hoverWidth:this.options.width,.3/this._body.view.scale)}getColor(e,t){if(t.inheritsColor!==!1){if(t.inheritsColor===`both`&&this.from.id!==this.to.id){let n=e.createLinearGradient(this.from.x,this.from.y,this.to.x,this.to.y),r=this.from.options.color.highlight.border,i=this.to.options.color.highlight.border;return this.from.selected===!1&&this.to.selected===!1?(r=ox(this.from.options.color.border,t.opacity),i=ox(this.to.options.color.border,t.opacity)):this.from.selected===!0&&this.to.selected===!1?i=this.to.options.color.border:this.from.selected===!1&&this.to.selected===!0&&(r=this.from.options.color.border),n.addColorStop(0,r),n.addColorStop(1,i),n}return t.inheritsColor===`to`?ox(this.to.options.color.border,t.opacity):ox(this.from.options.color.border,t.opacity)}else return ox(t.color,t.opacity)}_circle(e,t,n,r,i){this.enableShadow(e,t);let a=0,o=Math.PI*2;if(!this.options.selfReference.renderBehindTheNode){let t=this.options.selfReference.angle,i=this.options.selfReference.angle+Math.PI,s=this._findBorderPositionCircle(this.from,e,{x:n,y:r,low:t,high:i,direction:-1}),c=this._findBorderPositionCircle(this.from,e,{x:n,y:r,low:t,high:i,direction:1});a=Math.atan2(s.y-r,s.x-n),o=Math.atan2(c.y-r,c.x-n)}e.beginPath(),e.arc(n,r,i,a,o,!1),e.stroke(),this.disableShadow(e,t)}getDistanceToEdge(e,t,n,r,i,a){if(this.from!=this.to)return this._getDistanceToEdge(e,t,n,r,i,a);{let[e,t,n]=this._getCircleData(void 0),r=e-i,o=t-a;return Math.abs(Math.sqrt(r*r+o*o)-n)}}_getDistanceToLine(e,t,n,r,i,a){let o=n-e,s=r-t,c=o*o+s*s,l=((i-e)*o+(a-t)*s)/c;l>1?l=1:l<0&&(l=0);let u=e+l*o,d=t+l*s,f=u-i,p=d-a;return Math.sqrt(f*f+p*p)}getArrowData(e,t,n,r,i,a){let o,s,c,l,u,d,f,p=a.width;t===`from`?(c=this.from,l=this.to,u=a.fromArrowScale<0,d=Math.abs(a.fromArrowScale),f=a.fromArrowType):t===`to`?(c=this.to,l=this.from,u=a.toArrowScale<0,d=Math.abs(a.toArrowScale),f=a.toArrowType):(c=this.to,l=this.from,u=a.middleArrowScale<0,d=Math.abs(a.middleArrowScale),f=a.middleArrowType);let m=15*d+3*p;if(c!=l){let r=m/wN(c.x-l.x,c.y-l.y);if(t!==`middle`)if(this.options.smooth.enabled===!0){let i=this._findBorderPosition(c,e,{via:n}),a=this.getPoint(i.t+r*(t===`from`?1:-1),n);o=Math.atan2(i.y-a.y,i.x-a.x),s=i}else o=Math.atan2(c.y-l.y,c.x-l.x),s=this._findBorderPosition(c,e);else{let e=(u?-r:r)/2,t=this.getPoint(.5+e,n),i=this.getPoint(.5-e,n);o=Math.atan2(t.y-i.y,t.x-i.x),s=this.getPoint(.5,n)}}else{let[n,r,i]=this._getCircleData(e);if(t===`from`){let t=this.options.selfReference.angle,i=this.options.selfReference.angle+Math.PI,a=this._findBorderPositionCircle(this.from,e,{x:n,y:r,low:t,high:i,direction:-1});o=a.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,s=a}else if(t===`to`){let t=this.options.selfReference.angle,i=this.options.selfReference.angle+Math.PI,a=this._findBorderPositionCircle(this.from,e,{x:n,y:r,low:t,high:i,direction:1});o=a.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,s=a}else{let e=this.options.selfReference.angle/(2*Math.PI);s=this._pointOnCircle(n,r,i,e),o=e*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}let h={x:s.x-m*.9*Math.cos(o),y:s.y-m*.9*Math.sin(o)};return{point:s,core:h,angle:o,length:m,type:f}}drawArrowHead(e,t,n,r,i){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width,RN.draw(e,i)&&(this.enableShadow(e,t),av(e).call(e),this.disableShadow(e,t))}enableShadow(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}disableShadow(e,t){t.shadow===!0&&(e.shadowColor=`rgba(0,0,0,0)`,e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}drawBackground(e,t){if(t.background!==!1){let n={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=n.strokeStyle,e.lineWidth=n.lineWidth,e.dashes=n.dashes,this.setStrokeDashed(e,t.dashes)}}setStrokeDashed(e,t){if(t!==!1)if(e.setLineDash!==void 0){let n=W(t)?t:[5,5];e.setLineDash(n)}else console.warn(`setLineDash is not supported in this browser. The dashed stroke cannot be used.`);else e.setLineDash===void 0?console.warn(`setLineDash is not supported in this browser. The dashed stroke cannot be used.`):e.setLineDash([])}};function HN(e,t){var n=Xf(e);if(Rw){var r=Rw(e);t&&(r=Ph(r).call(r,function(t){return Zw(e,t).enumerable})),n.push.apply(n,r)}return n}function UN(e){for(var t=1;t<arguments.length;t++){var n,r,i=arguments[t]==null?{}:arguments[t];t%2?jp(n=HN(Object(i),!0)).call(n,function(t){OD(e,t,i[t])}):uT?CT(e,uT(i)):jp(r=HN(Object(i))).call(r,function(t){Lj(e,t,Zw(i,t))})}return e}var WN=class extends VN{constructor(e,t,n){super(e,t,n)}_findBorderPositionBezier(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates(),r=!1,i=1,a=0,o=this.to,s,c,l=this.options.endPointOffset?this.options.endPointOffset.to:0;e.id===this.from.id&&(o=this.from,r=!0,l=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(l=0);let u=0;do{c=(a+i)*.5,s=this.getPoint(c,n);let e=Math.atan2(o.y-s.y,o.x-s.x),d=o.distanceToBorder(t,e)+l-Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2);if(Math.abs(d)<.2)break;d<0?r===!1?a=c:i=c:r===!1?i=c:a=c,++u}while(a<=i&&u<10);return UN(UN({},s),{},{t:c})}_getDistanceToBezierEdge(e,t,n,r,i,a,o){let s=1e9,c,l,u,d,f,p=e,m=t;for(l=1;l<10;l++)u=.1*l,d=(1-u)**2*e+2*u*(1-u)*o.x+u**2*n,f=(1-u)**2*t+2*u*(1-u)*o.y+u**2*r,l>0&&(c=this._getDistanceToLine(p,m,d,f,i,a),s=c<s?c:s),p=d,m=f;return s}_bezierCurve(e,t,n,r){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),n!=null&&n.x!=null?r!=null&&r.x!=null?e.bezierCurveTo(n.x,n.y,r.x,r.y,this.toPoint.x,this.toPoint.y):e.quadraticCurveTo(n.x,n.y,this.toPoint.x,this.toPoint.y):e.lineTo(this.toPoint.x,this.toPoint.y),this.drawBackground(e,t),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}getViaNode(){return this._getViaCoordinates()}},GN=class extends WN{constructor(e,t,n){super(e,t,n),OD(this,`via`,this.via),this._boundFunction=()=>{this.positionBezierNode()},this._body.emitter.on(`_repositionBezierNodes`,this._boundFunction)}setOptions(e){super.setOptions(e);let t=!1;this.options.physics!==e.physics&&(t=!0),this.options=e,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),t===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}connect(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1||this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}cleanup(){return this._body.emitter.off(`_repositionBezierNodes`,this._boundFunction),this.via===void 0?!1:(delete this._body.nodes[this.via.id],this.via=void 0,!0)}setupSupportNode(){if(this.via===void 0){let e=`edgeId:`+this.id,t=this._body.functions.createNode({id:e,shape:`circle`,physics:!0,hidden:!0});this._body.nodes[e]=t,this.via=t,this.via.parentEdgeId=this.id,this.positionBezierNode()}}positionBezierNode(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}_line(e,t,n){this._bezierCurve(e,t,n)}_getViaCoordinates(){return this.via}getViaNode(){return this.via}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){let[t,n,r]=this._getCircleData(),i=2*Math.PI*(1-e);return{x:t+r*Math.sin(i),y:n+r-r*(1-Math.cos(i))}}else return{x:(1-e)**2*this.fromPoint.x+2*e*(1-e)*t.x+e**2*this.toPoint.x,y:(1-e)**2*this.fromPoint.y+2*e*(1-e)*t.y+e**2*this.toPoint.y}}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t,this.via)}_getDistanceToEdge(e,t,n,r,i,a){return this._getDistanceToBezierEdge(e,t,n,r,i,a,this.via)}},KN=class extends WN{constructor(e,t,n){super(e,t,n)}_line(e,t,n){this._bezierCurve(e,t,n)}getViaNode(){return this._getViaCoordinates()}_getViaCoordinates(){let e=this.options.smooth.roundness,t=this.options.smooth.type,n=Math.abs(this.from.x-this.to.x),r=Math.abs(this.from.y-this.to.y);if(t===`discrete`||t===`diagonalCross`){let i,a;i=a=n<=r?e*r:e*n,this.from.x>this.to.x&&(i=-i),this.from.y>=this.to.y&&(a=-a);let o=this.from.x+i,s=this.from.y+a;return t===`discrete`&&(n<=r?o=n<e*r?this.from.x:o:s=r<e*n?this.from.y:s),{x:o,y:s}}else if(t===`straightCross`){let t=(1-e)*n,i=(1-e)*r;return n<=r?(t=0,this.from.y<this.to.y&&(i=-i)):(this.from.x<this.to.x&&(t=-t),i=0),{x:this.to.x+t,y:this.to.y+i}}else if(t===`horizontal`){let t=(1-e)*n;return this.from.x<this.to.x&&(t=-t),{x:this.to.x+t,y:this.from.y}}else if(t===`vertical`){let t=(1-e)*r;return this.from.y<this.to.y&&(t=-t),{x:this.from.x,y:this.to.y+t}}else if(t===`curvedCW`){n=this.to.x-this.from.x,r=this.from.y-this.to.y;let t=Math.sqrt(n*n+r*r),i=Math.PI,a=(Math.atan2(r,n)+(e*.5+.5)*i)%(2*i);return{x:this.from.x+(e*.5+.5)*t*Math.sin(a),y:this.from.y+(e*.5+.5)*t*Math.cos(a)}}else if(t===`curvedCCW`){n=this.to.x-this.from.x,r=this.from.y-this.to.y;let t=Math.sqrt(n*n+r*r),i=Math.PI,a=(Math.atan2(r,n)+(-e*.5+.5)*i)%(2*i);return{x:this.from.x+(e*.5+.5)*t*Math.sin(a),y:this.from.y+(e*.5+.5)*t*Math.cos(a)}}else{let t,i;t=i=n<=r?e*r:e*n,this.from.x>this.to.x&&(t=-t),this.from.y>=this.to.y&&(i=-i);let a=this.from.x+t,o=this.from.y+i;return n<=r?a=this.from.x<=this.to.x?this.to.x<a?this.to.x:a:this.to.x>a?this.to.x:a:o=this.from.y>=this.to.y?this.to.y>o?this.to.y:o:this.to.y<o?this.to.y:o,{x:a,y:o}}}_findBorderPosition(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(e,t,n.via)}_getDistanceToEdge(e,t,n,r,i,a){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(e,t,n,r,i,a,o)}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),n=e;return{x:(1-n)**2*this.fromPoint.x+2*n*(1-n)*t.x+n**2*this.toPoint.x,y:(1-n)**2*this.fromPoint.y+2*n*(1-n)*t.y+n**2*this.toPoint.y}}},qN=class extends WN{constructor(e,t,n){super(e,t,n)}_getDistanceToBezierEdge2(e,t,n,r,i,a,o,s){let c=1e9,l=e,u=t,d=[0,0,0,0];for(let f=1;f<10;f++){let p=.1*f;d[0]=(1-p)**3,d[1]=3*p*(1-p)**2,d[2]=3*p**2*(1-p),d[3]=p**3;let m=d[0]*e+d[1]*o.x+d[2]*s.x+d[3]*n,h=d[0]*t+d[1]*o.y+d[2]*s.y+d[3]*r;if(f>0){let e=this._getDistanceToLine(l,u,m,h,i,a);c=e<c?e:c}l=m,u=h}return c}},JN=class extends qN{constructor(e,t,n){super(e,t,n)}_line(e,t,n){let r=n[0],i=n[1];this._bezierCurve(e,t,r,i)}_getViaCoordinates(){let e=this.from.x-this.to.x,t=this.from.y-this.to.y,n,r,i,a,o=this.options.smooth.roundness;return(Math.abs(e)>Math.abs(t)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection===`horizontal`)&&this.options.smooth.forceDirection!==`vertical`?(r=this.from.y,a=this.to.y,n=this.from.x-o*e,i=this.to.x+o*e):(r=this.from.y-o*t,a=this.to.y+o*t,n=this.from.x,i=this.to.x),[{x:n,y:r},{x:i,y:a}]}getViaNode(){return this._getViaCoordinates()}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t)}_getDistanceToEdge(e,t,n,r,i,a){let[o,s]=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge2(e,t,n,r,i,a,o,s)}getPoint(e){let[t,n]=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),r=e,i=[(1-r)**3,3*r*(1-r)**2,3*r**2*(1-r),r**3];return{x:i[0]*this.fromPoint.x+i[1]*t.x+i[2]*n.x+i[3]*this.toPoint.x,y:i[0]*this.fromPoint.y+i[1]*t.y+i[2]*n.y+i[3]*this.toPoint.y}}},YN=class extends VN{constructor(e,t,n){super(e,t,n)}_line(e,t){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),e.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}getViaNode(){}getPoint(e){return{x:(1-e)*this.fromPoint.x+e*this.toPoint.x,y:(1-e)*this.fromPoint.y+e*this.toPoint.y}}_findBorderPosition(e,t){let n=this.to,r=this.from;e.id===this.from.id&&(n=this.from,r=this.to);let i=Math.atan2(n.y-r.y,n.x-r.x),a=n.x-r.x,o=n.y-r.y,s=Math.sqrt(a*a+o*o),c=(s-e.distanceToBorder(t,i))/s;return{x:(1-c)*r.x+c*n.x,y:(1-c)*r.y+c*n.y,t:0}}_getDistanceToEdge(e,t,n,r,i,a){return this._getDistanceToLine(e,t,n,r,i,a)}},XN=class e{constructor(e,t,n,r,i){if(t===void 0)throw Error(`No body provided`);this.options=gx(r),this.globalOptions=r,this.defaultOptions=i,this.body=t,this.imagelist=n,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new BM(this.body,this.options,!0),this.setOptions(e)}setOptions(t){if(!t)return;let n=t.physics!==void 0&&this.options.physics!==t.physics||t.hidden!==void 0&&(this.options.hidden||!1)!==(t.hidden||!1)||t.from!==void 0&&this.options.from!==t.from||t.to!==void 0&&this.options.to!==t.to;e.parseOptions(this.options,t,!0,this.globalOptions),t.id!==void 0&&(this.id=t.id),t.from!==void 0&&(this.fromId=t.from),t.to!==void 0&&(this.toId=t.to),t.title!==void 0&&(this.title=t.title),t.value!==void 0&&(t.value=_M(t.value));let r=[t,this.options,this.defaultOptions];return this.chooser=jM(`edge`,r),this.updateLabelModule(t),n=this.updateEdgeType()||n,this._setInteractionWidths(),this.connect(),n}static parseOptions(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(Zb([`endPointOffset`,`arrowStrikethrough`,`id`,`from`,`hidden`,`hoverWidth`,`labelHighlightBold`,`length`,`line`,`opacity`,`physics`,`scaling`,`selectionWidth`,`selfReferenceSize`,`selfReference`,`to`,`title`,`value`,`width`,`font`,`chosen`,`widthConstraint`],e,t,n),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(fw(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=r.endPointOffset.from===void 0?0:r.endPointOffset.from,console.error(`endPointOffset.from is not a valid number`))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(fw(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=r.endPointOffset.to===void 0?0:r.endPointOffset.to,console.error(`endPointOffset.to is not a valid number`))),NM(t.label)?e.label=t.label:NM(e.label)||(e.label=void 0),_x(e,t,`smooth`,r),_x(e,t,`shadow`,r),_x(e,t,`background`,r),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:n===!0&&t.dashes===null&&(e.dashes=qg(r.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),_x(e.scaling,t.scaling,`label`,r.scaling)):n===!0&&t.scaling===null&&(e.scaling=qg(r.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows==`string`){let n=t.arrows.toLowerCase();e.arrows.to.enabled=Pg(n).call(n,`to`)!=-1,e.arrows.middle.enabled=Pg(n).call(n,`middle`)!=-1,e.arrows.from.enabled=Pg(n).call(n,`from`)!=-1}else if(typeof t.arrows==`object`)_x(e.arrows,t.arrows,`to`,r.arrows),_x(e.arrows,t.arrows,`middle`,r.arrows),_x(e.arrows,t.arrows,`from`,r.arrows);else throw Error(`The arrow newOptions can only be an object or a string. Refer to the documentation. You used:`+h_(t.arrows));else n===!0&&t.arrows===null&&(e.arrows=qg(r.arrows));if(t.color!==void 0&&t.color!==null){let a=qb(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,o=e.color;if(i)$b(o,r.color,!1,n);else for(let e in o)Object.prototype.hasOwnProperty.call(o,e)&&delete o[e];if(qb(o))o.color=o,o.highlight=o,o.hover=o,o.inherit=!1,a.opacity===void 0&&(o.opacity=1);else{let e=!1;a.color!==void 0&&(o.color=a.color,e=!0),a.highlight!==void 0&&(o.highlight=a.highlight,e=!0),a.hover!==void 0&&(o.hover=a.hover,e=!0),a.inherit!==void 0&&(o.inherit=a.inherit),a.opacity!==void 0&&(o.opacity=Math.min(1,Math.max(0,a.opacity))),e===!0?o.inherit=!1:o.inherit===void 0&&(o.inherit=`from`)}}else n===!0&&t.color===null&&(e.color=gx(r.color));n===!0&&t.font===null&&(e.font=gx(r.font)),Object.prototype.hasOwnProperty.call(t,`selfReferenceSize`)&&(console.warn(`The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}`),e.selfReference.size=t.selfReferenceSize)}getFormattingValues(){let e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,n=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,r=this.options.color.inherit,i={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:n,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:r?void 0:this.options.color.color,inheritsColor:r,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){let e=this.options.selectionWidth;typeof e==`function`?i.width=e(i.width):typeof e==`number`&&(i.width+=e),i.width=Math.max(i.width,.3/this.body.view.scale),i.color=this.options.color.highlight,i.shadow=this.options.shadow.enabled}else if(this.hover){let e=this.options.hoverWidth;typeof e==`function`?i.width=e(i.width):typeof e==`number`&&(i.width+=e),i.width=Math.max(i.width,.3/this.body.view.scale),i.color=this.options.color.hover,i.shadow=this.options.shadow.enabled}}else typeof this.chooser==`function`&&(this.chooser(i,this.options.id,this.selected,this.hover),i.color!==void 0&&(i.inheritsColor=!1),i.shadow===!1&&(i.shadowColor!==this.options.shadow.color||i.shadowSize!==this.options.shadow.size||i.shadowX!==this.options.shadow.x||i.shadowY!==this.options.shadow.y)&&(i.shadow=!0));else i.shadow=this.options.shadow.enabled,i.width=Math.max(i.width,.3/this.body.view.scale);return i}updateLabelModule(e){let t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateEdgeType(){let e=this.options.smooth,t=!1,n=!0;return this.edgeType!==void 0&&((this.edgeType instanceof GN&&e.enabled===!0&&e.type===`dynamic`||this.edgeType instanceof JN&&e.enabled===!0&&e.type===`cubicBezier`||this.edgeType instanceof KN&&e.enabled===!0&&e.type!==`dynamic`&&e.type!==`cubicBezier`||this.edgeType instanceof YN&&e.type.enabled===!1)&&(n=!1),n===!0&&(t=this.cleanup())),n===!0?e.enabled===!0?e.type===`dynamic`?(t=!0,this.edgeType=new GN(this.options,this.body,this.labelModule)):e.type===`cubicBezier`?this.edgeType=new JN(this.options,this.body,this.labelModule):this.edgeType=new KN(this.options,this.body,this.labelModule):this.edgeType=new YN(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}connect(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}disconnect(){this.from&&=(this.from.detachEdge(this),void 0),this.to&&=(this.to.detachEdge(this),void 0),this.connected=!1}getTitle(){return this.title}isSelected(){return this.selected}getValue(){return this.options.value}setValueRange(e,t,n){if(this.options.value!==void 0){let r=this.options.scaling.customScalingFunction(e,t,n,this.options.value),i=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){let e=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+r*e}this.options.width=this.options.scaling.min+r*i}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}_setInteractionWidths(){typeof this.options.hoverWidth==`function`?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth==`function`?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}draw(e){let t=this.getFormattingValues();if(t.hidden)return;let n=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,n),this.drawLabel(e,n)}drawArrows(e){let t=this.getFormattingValues();if(t.hidden)return;let n=this.edgeType.getViaNode(),r={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(r.from=this.edgeType.getArrowData(e,`from`,n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=r.from.core),t.fromArrowSrc&&(r.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(r.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(r.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(r.to=this.edgeType.getArrowData(e,`to`,n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=r.to.core),t.toArrowSrc&&(r.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(r.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(r.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(r.middle=this.edgeType.getArrowData(e,`middle`,n,this.selected,this.hover,t),t.middleArrowSrc&&(r.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(r.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(r.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,r.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,r.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,r.to)}drawLabel(e,t){if(this.options.label!==void 0){let n=this.from,r=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);let i;if(n.id!=r.id){this.labelModule.pointToSelf=!1,i=this.edgeType.getPoint(.5,t),e.save();let n=this._getRotation(e);n.angle!=0&&(e.translate(n.x,n.y),e.rotate(n.angle)),this.labelModule.draw(e,i.x,i.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;let t=PM(e,this.options.selfReference.angle,this.options.selfReference.size,n);i=this._pointOnCircle(t.x,t.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,i.x,i.y,this.selected,this.hover)}}}getItemsOnPoint(e){let t=[];if(this.labelModule.visible()){let n=this._getRotation();MM(this.labelModule.getSize(),e,n)&&t.push({edgeId:this.id,labelId:0})}let n={left:e.x,top:e.y};return this.isOverlappingWith(n)&&t.push({edgeId:this.id}),t}isOverlappingWith(e){if(this.connected){let t=this.from.x,n=this.from.y,r=this.to.x,i=this.to.y,a=e.left,o=e.top;return this.edgeType.getDistanceToEdge(t,n,r,i,a,o)<10}else return!1}_getRotation(e){let t=this.edgeType.getViaNode(),n=this.edgeType.getPoint(.5,t);e!==void 0&&this.labelModule.calculateLabelSize(e,this.selected,this.hover,n.x,n.y);let r={x:n.x,y:this.labelModule.size.yLine,angle:0};if(!this.labelModule.visible()||this.options.font.align===`horizontal`)return r;let i=this.from.y-this.to.y,a=this.from.x-this.to.x,o=Math.atan2(i,a);return(o<-1&&a<0||o>0&&a<0)&&(o+=Math.PI),r.angle=o,r}_pointOnCircle(e,t,n,r){return{x:e+n*Math.cos(r),y:t-n*Math.sin(r)}}select(){this.selected=!0}unselect(){this.selected=!1}cleanup(){return this.edgeType.cleanup()}remove(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}endPointsValid(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}},ZN=class{constructor(e,t,n){var r;this.body=e,this.images=t,this.groups=n,this.body.functions.createEdge=B(r=this.create).call(r,this),this.edgesListeners={add:(e,t)=>{this.add(t.items)},update:(e,t)=>{this.update(t.items)},remove:(e,t)=>{this.remove(t.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:`arrow`},middle:{enabled:!1,scaleFactor:1,type:`arrow`},from:{enabled:!1,scaleFactor:1,type:`arrow`}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:`#848484`,highlight:`#848484`,hover:`#848484`,inherit:`from`,opacity:1},dashes:!1,font:{color:`#343434`,size:14,face:`arial`,background:`none`,strokeWidth:2,strokeColor:`#ffffff`,align:`horizontal`,multi:!1,vadjust:0,bold:{mod:`bold`},boldital:{mod:`bold italic`},ital:{mod:`italic`},mono:{mod:``,size:15,face:`courier new`,vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(e,t,n,r){if(t===e)return .5;{let n=1/(t-e);return Math.max(0,(r-e)*n)}}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:`rgba(0,0,0,0.5)`,size:10,x:5,y:5},background:{enabled:!1,color:`rgba(111,111,111,1)`,size:10,dashes:!1},smooth:{enabled:!0,type:`dynamic`,forceDirection:`none`,roundness:.5},title:void 0,width:1,value:void 0},$b(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e=this,t,n;this.body.emitter.on(`_forceDisableDynamicCurves`,function(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;t===`dynamic`&&(t=`continuous`);let r=!1;for(let n in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,n)){let i=e.body.edges[n],a=e.body.data.edges.get(n);if(a!=null){let e=a.smooth;e!==void 0&&e.enabled===!0&&e.type===`dynamic`&&(t===void 0?i.setOptions({smooth:!1}):i.setOptions({smooth:{type:t}}),r=!0)}}n===!0&&r===!0&&e.body.emitter.emit(`_dataChanged`)}),this.body.emitter.on(`_dataUpdated`,()=>{this.reconnectEdges()}),this.body.emitter.on(`refreshEdges`,B(t=this.refresh).call(t,this)),this.body.emitter.on(`refresh`,B(n=this.refresh).call(n,this)),this.body.emitter.on(`destroy`,()=>{ix(this.edgesListeners,(e,t)=>{this.body.data.edges&&this.body.data.edges.off(t,e)}),delete this.body.functions.createEdge,delete this.edgesListeners.add,delete this.edgesListeners.update,delete this.edgesListeners.remove,delete this.edgesListeners})}setOptions(e){if(e!==void 0){XN.parseOptions(this.options,e,!0,this.defaultOptions,!0);let t=!1;if(e.smooth!==void 0)for(let e in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,e)&&(t=this.body.edges[e].updateEdgeType()||t);if(e.font!==void 0)for(let e in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,e)&&this.body.edges[e].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit(`_dataChanged`)}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.data.edges;if(tM(`id`,e))this.body.data.edges=e;else if(W(e))this.body.data.edges=new $j,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new $j;else throw TypeError(`Array or DataSet expected`);if(n&&ix(this.edgesListeners,(e,t)=>{n.off(t,e)}),this.body.edges={},this.body.data.edges){ix(this.edgesListeners,(e,t)=>{this.body.data.edges.on(t,e)});let e=this.body.data.edges.getIds();this.add(e,!0)}this.body.emitter.emit(`_adjustEdgesForHierarchicalLayout`),t===!1&&this.body.emitter.emit(`_dataChanged`)}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.edges,r=this.body.data.edges;for(let t=0;t<e.length;t++){let i=e[t],a=n[i];a&&a.disconnect();let o=r.get(i,{showInternalIds:!0});n[i]=this.create(o)}this.body.emitter.emit(`_adjustEdgesForHierarchicalLayout`),t===!1&&this.body.emitter.emit(`_dataChanged`)}update(e){let t=this.body.edges,n=this.body.data.edges,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=n.get(a),s=t[a];s===void 0?(this.body.edges[a]=this.create(o),r=!0):(s.disconnect(),r=s.setOptions(o)||r,s.connect())}r===!0?(this.body.emitter.emit(`_adjustEdgesForHierarchicalLayout`),this.body.emitter.emit(`_dataChanged`)):this.body.emitter.emit(`_dataUpdated`)}remove(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length===0)return;let n=this.body.edges;ix(e,e=>{let t=n[e];t!==void 0&&t.remove()}),t&&this.body.emitter.emit(`_dataChanged`)}refresh(){ix(this.body.edges,(e,t)=>{let n=this.body.data.edges.get(t);n!==void 0&&e.setOptions(n)})}create(e){return new XN(e,this.body,this.images,this.options,this.defaultOptions)}reconnectEdges(){let e,t=this.body.nodes,n=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){let t=n[e];t.from=null,t.to=null,t.connect()}}getConnectedNodes(e){let t=[];if(this.body.edges[e]!==void 0){let n=this.body.edges[e];n.fromId!==void 0&&t.push(n.fromId),n.toId!==void 0&&t.push(n.toId)}return t}_updateState(){this._addMissingEdges(),this._removeInvalidEdges()}_removeInvalidEdges(){let e=[];ix(this.body.edges,(t,n)=>{let r=this.body.nodes[t.toId],i=this.body.nodes[t.fromId];r!==void 0&&r.isCluster===!0||i!==void 0&&i.isCluster===!0||(r===void 0||i===void 0)&&e.push(n)}),this.remove(e,!1)}_addMissingEdges(){let e=this.body.data.edges;if(e==null)return;let t=this.body.edges,n=[];jp(e).call(e,(e,r)=>{t[r]===void 0&&n.push(r)}),this.add(n,!0)}},QN=class{constructor(e,t,n){this.body=e,this.physicsBody=t,this.barnesHutTree,this.setOptions(n),this._rng=Pb(`BARNES HUT SOLVER`)}setOptions(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}solve(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){let e,t=this.body.nodes,n=this.physicsBody.physicsNodeIndices,r=n.length,i=this._formBarnesHutTree(t,n);this.barnesHutTree=i;for(let a=0;a<r;a++)e=t[n[a]],e.options.mass>0&&this._getForceContributions(i.root,e)}}_getForceContributions(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}_getForceContribution(e,t){if(e.childrenCount>0){let n=e.centerOfMass.x-t.x,r=e.centerOfMass.y-t.y,i=Math.sqrt(n*n+r*r);i*e.calcSize>this.thetaInversed?this._calculateForces(i,n,r,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(i,n,r,t,e)}}_calculateForces(e,t,n,r,i){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&r.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*r.shape.radius,e-r.shape.radius));let a=this.options.gravitationalConstant*i.mass*r.options.mass/e**3,o=t*a,s=n*a;this.physicsBody.forces[r.id].x+=o,this.physicsBody.forces[r.id].y+=s}_formBarnesHutTree(e,t){let n,r=t.length,i=e[t[0]].x,a=e[t[0]].y,o=e[t[0]].x,s=e[t[0]].y;for(let n=1;n<r;n++){let r=e[t[n]],c=r.x,l=r.y;r.options.mass>0&&(c<i&&(i=c),c>o&&(o=c),l<a&&(a=l),l>s&&(s=l))}let c=Math.abs(o-i)-Math.abs(s-a);c>0?(a-=.5*c,s+=.5*c):(i+=.5*c,o-=.5*c);let l=Math.max(1e-5,Math.abs(o-i)),u=.5*l,d=.5*(i+o),f=.5*(a+s),p={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:d-u,maxX:d+u,minY:f-u,maxY:f+u},size:l,calcSize:1/l,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(p.root);for(let i=0;i<r;i++)n=e[t[i]],n.options.mass>0&&this._placeInTree(p.root,n);return p}_updateBranchMass(e,t){let n=e.centerOfMass,r=e.mass+t.options.mass,i=1/r;n.x=n.x*e.mass+t.x*t.options.mass,n.x*=i,n.y=n.y*e.mass+t.y*t.options.mass,n.y*=i,e.mass=r;let a=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidth<a?a:e.maxWidth}_placeInTree(e,t,n){(n!=1||n===void 0)&&this._updateBranchMass(e,t);let r=e.children.NW.range,i;i=r.maxX>t.x?r.maxY>t.y?`NW`:`SW`:r.maxY>t.y?`NE`:`SE`,this._placeInRegion(e,t,i)}_placeInRegion(e,t,n){let r=e.children[n];switch(r.childrenCount){case 0:r.children.data=t,r.childrenCount=1,this._updateBranchMass(r,t);break;case 1:r.children.data.x===t.x&&r.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(r),this._placeInTree(r,t));break;case 4:this._placeInTree(r,t);break}}_splitBranch(e){let t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,`NW`),this._insertRegion(e,`NE`),this._insertRegion(e,`SW`),this._insertRegion(e,`SE`),t!=null&&this._placeInTree(e,t)}_insertRegion(e,t){let n,r,i,a,o=.5*e.size;switch(t){case`NW`:n=e.range.minX,r=e.range.minX+o,i=e.range.minY,a=e.range.minY+o;break;case`NE`:n=e.range.minX+o,r=e.range.maxX,i=e.range.minY,a=e.range.minY+o;break;case`SW`:n=e.range.minX,r=e.range.minX+o,i=e.range.minY+o,a=e.range.maxY;break;case`SE`:n=e.range.minX+o,r=e.range.maxX,i=e.range.minY+o,a=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:n,maxX:r,minY:i,maxY:a},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}_debug(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}_drawBranch(e,t,n){n===void 0&&(n=`#FF0000`),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=n,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}},$N=class{constructor(e,t,n){this._rng=Pb(`REPULSION SOLVER`),this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e}solve(){let e,t,n,r,i,a,o,s,c=this.body.nodes,l=this.physicsBody.physicsNodeIndices,u=this.physicsBody.forces,d=this.options.nodeDistance,f=-2/3/d;for(let p=0;p<l.length-1;p++){o=c[l[p]];for(let m=p+1;m<l.length;m++)s=c[l[m]],e=s.x-o.x,t=s.y-o.y,n=Math.sqrt(e*e+t*t),n===0&&(n=.1*this._rng(),e=n),n<2*d&&(a=n<.5*d?1:f*n+1.3333333333333333,a/=n,r=e*a,i=t*a,u[o.id].x-=r,u[o.id].y-=i,u[s.id].x+=r,u[s.id].y+=i)}}},eP=class{constructor(e,t,n){this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e,this.overlapAvoidanceFactor=Math.max(0,Math.min(1,this.options.avoidOverlap||0))}solve(){let e=this.body.nodes,t=this.physicsBody.physicsNodeIndices,n=this.physicsBody.forces,r=this.options.nodeDistance;for(let i=0;i<t.length-1;i++){let a=e[t[i]];for(let o=i+1;o<t.length;o++){let i=e[t[o]];if(a.level===i.level){let e=r+this.overlapAvoidanceFactor*((a.shape.radius||0)/2+(i.shape.radius||0)/2),t=i.x-a.x,o=i.y-a.y,s=Math.sqrt(t*t+o*o),c=.05,l;l=s<e?-((c*s)**2)+(c*e)**2:0,s!==0&&(l/=s);let u=t*l,d=o*l;n[a.id].x-=u,n[a.id].y-=d,n[i.id].x+=u,n[i.id].y+=d}}}}},tP=class{constructor(e,t,n){this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e}solve(){let e,t,n=this.physicsBody.physicsEdgeIndices,r=this.body.edges,i,a,o;for(let s=0;s<n.length;s++)t=r[n[s]],t.connected===!0&&t.toId!==t.fromId&&this.body.nodes[t.toId]!==void 0&&this.body.nodes[t.fromId]!==void 0&&(t.edgeType.via===void 0?(e=t.options.length===void 0?this.options.springLength*1.5:t.options.length,this._calculateSpringForce(t.from,t.to,e)):(e=t.options.length===void 0?this.options.springLength:t.options.length,i=t.to,a=t.edgeType.via,o=t.from,this._calculateSpringForce(i,a,.5*e),this._calculateSpringForce(a,o,.5*e)))}_calculateSpringForce(e,t,n){let r=e.x-t.x,i=e.y-t.y,a=Math.max(Math.sqrt(r*r+i*i),.01),o=this.options.springConstant*(n-a)/a,s=r*o,c=i*o;this.physicsBody.forces[e.id]!==void 0&&(this.physicsBody.forces[e.id].x+=s,this.physicsBody.forces[e.id].y+=c),this.physicsBody.forces[t.id]!==void 0&&(this.physicsBody.forces[t.id].x-=s,this.physicsBody.forces[t.id].y-=c)}},nP=class{constructor(e,t,n){this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e}solve(){let e,t,n,r,i,a,o,s,c=this.body.edges,l=.5,u=this.physicsBody.physicsEdgeIndices,d=this.physicsBody.physicsNodeIndices,f=this.physicsBody.forces;for(let e=0;e<d.length;e++){let t=d[e];f[t].springFx=0,f[t].springFy=0}for(let d=0;d<u.length;d++)t=c[u[d]],t.connected===!0&&(e=t.options.length===void 0?this.options.springLength:t.options.length,n=t.from.x-t.to.x,r=t.from.y-t.to.y,s=Math.sqrt(n*n+r*r),s=s===0?.01:s,o=this.options.springConstant*(e-s)/s,i=n*o,a=r*o,t.to.level==t.from.level?(f[t.toId]!==void 0&&(f[t.toId].x-=l*i,f[t.toId].y-=l*a),f[t.fromId]!==void 0&&(f[t.fromId].x+=l*i,f[t.fromId].y+=l*a)):(f[t.toId]!==void 0&&(f[t.toId].springFx-=i,f[t.toId].springFy-=a),f[t.fromId]!==void 0&&(f[t.fromId].springFx+=i,f[t.fromId].springFy+=a)));o=1;let p,m;for(let e=0;e<d.length;e++){let t=d[e];p=Math.min(o,Math.max(-o,f[t].springFx)),m=Math.min(o,Math.max(-o,f[t].springFy)),f[t].x+=p,f[t].y+=m}let h=0,g=0;for(let e=0;e<d.length;e++){let t=d[e];h+=f[t].x,g+=f[t].y}let _=h/d.length,v=g/d.length;for(let e=0;e<d.length;e++){let t=d[e];f[t].x-=_,f[t].y-=v}}},rP=class{constructor(e,t,n){this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e}solve(){let e,t,n,r,i=this.body.nodes,a=this.physicsBody.physicsNodeIndices,o=this.physicsBody.forces;for(let s=0;s<a.length;s++)r=i[a[s]],e=-r.x,t=-r.y,n=Math.sqrt(e*e+t*t),this._calculateForces(n,e,t,o,r)}_calculateForces(e,t,n,r,i){let a=e===0?0:this.options.centralGravity/e;r[i.id].x=t*a,r[i.id].y=n*a}},iP=class extends QN{constructor(e,t,n){super(e,t,n),this._rng=Pb(`FORCE ATLAS 2 BASED REPULSION SOLVER`)}_calculateForces(e,t,n,r,i){e===0&&(e=.1*this._rng(),t=e),this.overlapAvoidanceFactor<1&&r.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*r.shape.radius,e-r.shape.radius));let a=r.edges.length+1,o=this.options.gravitationalConstant*i.mass*r.options.mass*a/e**2,s=t*o,c=n*o;this.physicsBody.forces[r.id].x+=s,this.physicsBody.forces[r.id].y+=c}},aP=class extends rP{constructor(e,t,n){super(e,t,n)}_calculateForces(e,t,n,r,i){if(e>0){let e=i.edges.length+1,a=this.options.centralGravity*e*i.options.mass;r[i.id].x=t*a,r[i.id].y=n*a}}},oP=class{constructor(e){this.body=e,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:`barnesHut`,stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},Jo(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}bindEventListeners(){this.body.emitter.on(`initPhysics`,()=>{this.initPhysics()}),this.body.emitter.on(`_layoutFailed`,()=>{this.layoutFailed=!0}),this.body.emitter.on(`resetPhysics`,()=>{this.stopSimulation(),this.ready=!1}),this.body.emitter.on(`disablePhysics`,()=>{this.physicsEnabled=!1,this.stopSimulation()}),this.body.emitter.on(`restorePhysics`,()=>{this.setOptions(this.options),this.ready===!0&&this.startSimulation()}),this.body.emitter.on(`startSimulation`,()=>{this.ready===!0&&this.startSimulation()}),this.body.emitter.on(`stopSimulation`,()=>{this.stopSimulation()}),this.body.emitter.on(`destroy`,()=>{this.stopSimulation(!1),this.body.emitter.off()}),this.body.emitter.on(`_dataChanged`,()=>{this.updatePhysicsData()})}setOptions(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,Qb([`stabilization`],this.options,e),_x(this.options,e,`stabilization`),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());let t=this.options.wind;t&&((typeof t.x!=`number`||XC(t.x))&&(t.x=0),(typeof t.y!=`number`||XC(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}init(){let e;this.options.solver===`forceAtlas2Based`?(e=this.options.forceAtlas2Based,this.nodesSolver=new iP(this.body,this.physicsBody,e),this.edgesSolver=new tP(this.body,this.physicsBody,e),this.gravitySolver=new aP(this.body,this.physicsBody,e)):this.options.solver===`repulsion`?(e=this.options.repulsion,this.nodesSolver=new $N(this.body,this.physicsBody,e),this.edgesSolver=new tP(this.body,this.physicsBody,e),this.gravitySolver=new rP(this.body,this.physicsBody,e)):this.options.solver===`hierarchicalRepulsion`?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new eP(this.body,this.physicsBody,e),this.edgesSolver=new nP(this.body,this.physicsBody,e),this.gravitySolver=new rP(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new QN(this.body,this.physicsBody,e),this.edgesSolver=new tP(this.body,this.physicsBody,e),this.gravitySolver=new rP(this.body,this.physicsBody,e)),this.modelOptions=e}initPhysics(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit(`fit`,{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit(`fit`))}startSimulation(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit(`_resizeNodes`),this.viewFunction===void 0){var e;this.viewFunction=B(e=this.simulationStep).call(e,this),this.body.emitter.on(`initRedraw`,this.viewFunction),this.body.emitter.emit(`_startRendering`)}}else this.body.emitter.emit(`_redraw`)}stopSimulation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off(`initRedraw`,this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit(`_stopRendering`))}simulationStep(){let e=lp();this.physicsTick(),(lp()-e<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}_emitStabilized(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&B_(()=>{this.body.emitter.emit(`stabilized`,{iterations:e}),this.startedStabilization=!1,this.stabilizationIterations=0},0)}physicsStep(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}adjustTimeStep(){let e=1.2;this._evaluateStepQuality()===!0?this.timestep=e*this.timestep:this.timestep/e<this.options.timestep?this.timestep=this.options.timestep:(this.adaptiveCounter=-1,this.timestep=Math.max(this.options.timestep,this.timestep/e))}physicsTick(){this._startStabilizing(),this.stabilized!==!0&&(this.adaptiveTimestep===!0&&this.adaptiveTimestepEnabled===!0?(this.adaptiveCounter%this.adaptiveInterval===0?(this.timestep=2*this.timestep,this.physicsStep(),this.revert(),this.timestep=.5*this.timestep,this.physicsStep(),this.physicsStep(),this.adjustTimeStep()):this.physicsStep(),this.adaptiveCounter+=1):(this.timestep=this.options.timestep,this.physicsStep()),this.stabilized===!0&&this.revert(),this.stabilizationIterations++)}updatePhysicsData(){this.physicsBody.forces={},this.physicsBody.physicsNodeIndices=[],this.physicsBody.physicsEdgeIndices=[];let e=this.body.nodes,t=this.body.edges;for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t].options.physics===!0&&this.physicsBody.physicsNodeIndices.push(e[t].id);for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&t[e].options.physics===!0&&this.physicsBody.physicsEdgeIndices.push(t[e].id);for(let e=0;e<this.physicsBody.physicsNodeIndices.length;e++){let t=this.physicsBody.physicsNodeIndices[e];this.physicsBody.forces[t]={x:0,y:0},this.physicsBody.velocities[t]===void 0&&(this.physicsBody.velocities[t]={x:0,y:0})}for(let t in this.physicsBody.velocities)e[t]===void 0&&delete this.physicsBody.velocities[t]}revert(){let e=Xf(this.previousStates),t=this.body.nodes,n=this.physicsBody.velocities;this.referenceState={};for(let r=0;r<e.length;r++){let i=e[r];t[i]===void 0?delete this.previousStates[i]:t[i].options.physics===!0&&(this.referenceState[i]={positions:{x:t[i].x,y:t[i].y}},n[i].x=this.previousStates[i].vx,n[i].y=this.previousStates[i].vy,t[i].x=this.previousStates[i].x,t[i].y=this.previousStates[i].y)}}_evaluateStepQuality(){let e,t,n,r=this.body.nodes,i=this.referenceState;for(let a in this.referenceState)if(Object.prototype.hasOwnProperty.call(this.referenceState,a)&&r[a]!==void 0&&(e=r[a].x-i[a].positions.x,t=r[a].y-i[a].positions.y,n=Math.sqrt(e**2+t**2),n>.3))return!1;return!0}moveNodes(){let e=this.physicsBody.physicsNodeIndices,t=0,n=0;for(let r=0;r<e.length;r++){let i=e[r],a=this._performStep(i);t=Math.max(t,a),n+=a}this.adaptiveTimestepEnabled=n/e.length<5,this.stabilized=t<this.options.minVelocity}calculateComponentVelocity(e,t,n){let r=(t-this.modelOptions.damping*e)/n;e+=r*this.timestep;let i=this.options.maxVelocity||1e9;return Math.abs(e)>i&&(e=e>0?i:-i),e}_performStep(e){let t=this.body.nodes[e],n=this.physicsBody.forces[e];this.options.wind&&(n.x+=this.options.wind.x,n.y+=this.options.wind.y);let r=this.physicsBody.velocities[e];return this.previousStates[e]={x:t.x,y:t.y,vx:r.x,vy:r.y},t.options.fixed.x===!1?(r.x=this.calculateComponentVelocity(r.x,n.x,t.options.mass),t.x+=r.x*this.timestep):(n.x=0,r.x=0),t.options.fixed.y===!1?(r.y=this.calculateComponentVelocity(r.y,n.y,t.options.mass),t.y+=r.y*this.timestep):(n.y=0,r.y=0),Math.sqrt(r.x**2+r.y**2)}_freezeNodes(){let e=this.body.nodes;for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){let n=e[t].options.fixed;this.freezeCache[t]={x:n.x,y:n.y},n.x=!0,n.y=!0}}_restoreFrozenNodes(){let e=this.body.nodes;for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}stabilize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof e!=`number`&&(e=this.options.stabilization.iterations,console.error(`The stabilize method needs a numeric amount of iterations. Switching to default: `,e)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit(`_resizeNodes`),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit(`_blockRedraw`),this.targetIterations=e,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,B_(()=>this._stabilizationBatch(),0)}_startStabilizing(){return this.startedStabilization===!0?!1:(this.body.emitter.emit(`startStabilizing`),this.startedStabilization=!0,!0)}_stabilizationBatch(){let e=()=>this.stabilized===!1&&this.stabilizationIterations<this.targetIterations,t=()=>{this.body.emitter.emit(`stabilizationProgress`,{iterations:this.stabilizationIterations,total:this.targetIterations})};this._startStabilizing()&&t();let n=0;for(;e()&&n<this.options.stabilization.updateInterval;)this.physicsTick(),n++;if(t(),e()){var r;B_(B(r=this._stabilizationBatch).call(r,this),0)}else this._finalizeStabilization()}_finalizeStabilization(){this.body.emitter.emit(`_allowRedraw`),this.options.stabilization.fit===!0&&this.body.emitter.emit(`fit`),this.options.stabilization.onlyDynamicEdges===!0&&this._restoreFrozenNodes(),this.body.emitter.emit(`stabilizationIterationsDone`),this.body.emitter.emit(`_requestRedraw`),this.stabilized===!0?this._emitStabilized():this.startSimulation(),this.ready=!0}_drawForces(e){for(let t=0;t<this.physicsBody.physicsNodeIndices.length;t++){let n=this.physicsBody.physicsNodeIndices[t],r=this.body.nodes[n],i=this.physicsBody.forces[n],a=Math.sqrt(i.x**2+i.x**2),o=Math.min(Math.max(5,a),15),s=3*o,c=dx((180-Math.min(1,Math.max(0,.03*a))*180)/360,1,1),l={x:r.x+20*i.x,y:r.y+20*i.y};e.lineWidth=o,e.strokeStyle=c,e.beginPath(),e.moveTo(r.x,r.y),e.lineTo(l.x,l.y),e.stroke();let u=Math.atan2(i.y,i.x);e.fillStyle=c,RN.draw(e,{type:`arrow`,point:l,angle:u,length:s}),av(e).call(e)}}},sP=class{constructor(){}static getRange(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,r=-1e9,i=1e9,a=-1e9,o;if(t.length>0)for(let s=0;s<t.length;s++)o=e[t[s]],i>o.shape.boundingBox.left&&(i=o.shape.boundingBox.left),a<o.shape.boundingBox.right&&(a=o.shape.boundingBox.right),n>o.shape.boundingBox.top&&(n=o.shape.boundingBox.top),r<o.shape.boundingBox.bottom&&(r=o.shape.boundingBox.bottom);return i===1e9&&a===-1e9&&n===1e9&&r===-1e9&&(n=0,r=0,i=0,a=0),{minX:i,maxX:a,minY:n,maxY:r}}static getRangeCore(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,r=-1e9,i=1e9,a=-1e9,o;if(t.length>0)for(let s=0;s<t.length;s++)o=e[t[s]],i>o.x&&(i=o.x),a<o.x&&(a=o.x),n>o.y&&(n=o.y),r<o.y&&(r=o.y);return i===1e9&&a===-1e9&&n===1e9&&r===-1e9&&(n=0,r=0,i=0,a=0),{minX:i,maxX:a,minY:n,maxY:r}}static findCenter(e){return{x:.5*(e.maxX+e.minX),y:.5*(e.maxY+e.minY)}}static cloneOptions(e,t){let n={};return t===void 0||t===`node`?($b(n,e.options,!0),n.x=e.x,n.y=e.y,n.amountOfConnections=e.edges.length):$b(n,e.options,!0),n}},cP=class extends uN{constructor(e,t,n,r,i,a){super(e,t,n,r,i,a),this.isCluster=!0,this.containedNodes={},this.containedEdges={}}_openChildCluster(e){let t=this.body.nodes[e];if(this.containedNodes[e]===void 0)throw Error(`node with id: `+e+` not in current cluster`);if(!t.isCluster)throw Error(`node with id: `+e+` is not a cluster`);delete this.containedNodes[e],ix(t.edges,e=>{delete this.containedEdges[e.id]}),ix(t.containedNodes,(e,t)=>{this.containedNodes[t]=e}),t.containedNodes={},ix(t.containedEdges,(e,t)=>{this.containedEdges[t]=e}),t.containedEdges={},ix(t.edges,e=>{ix(this.edges,t=>{var n,r;let i=Pg(n=t.clusteringEdgeReplacingIds).call(n,e.id);i!==-1&&(ix(e.clusteringEdgeReplacingIds,e=>{t.clusteringEdgeReplacingIds.push(e),this.body.edges[e].edgeReplacedById=t.id}),hm(r=t.clusteringEdgeReplacingIds).call(r,i,1))})}),t.edges=[]}},lP=class{constructor(e){this.body=e,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},Jo(this.options,this.defaultOptions),this.body.emitter.on(`_resetData`,()=>{this.clusteredNodes={},this.clusteredEdges={}})}clusterByHubsize(e,t){e===void 0?e=this._getHubSize():typeof e==`object`&&(t=this._checkOptions(e),e=this._getHubSize());let n=[];for(let t=0;t<this.body.nodeIndices.length;t++){let r=this.body.nodes[this.body.nodeIndices[t]];r.edges.length>=e&&n.push(r.id)}for(let e=0;e<n.length;e++)this.clusterByConnection(n[e],t,!0);this.body.emitter.emit(`_dataChanged`)}cluster(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.joinCondition===void 0)throw Error(`Cannot call clusterByNodeData without a joinCondition function in the options.`);e=this._checkOptions(e);let n={},r={};ix(this.body.nodes,(t,i)=>{t.options&&e.joinCondition(t.options)===!0&&(n[i]=t,ix(t.edges,e=>{this.clusteredEdges[e.id]===void 0&&(r[e.id]=e)}))}),this._cluster(n,r,e,t)}clusterByEdgeCount(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);let r=[],i={},a,o,s;for(let n=0;n<this.body.nodeIndices.length;n++){let c={},l={},u=this.body.nodeIndices[n],d=this.body.nodes[u];if(i[u]===void 0){s=0,o=[];for(let e=0;e<d.edges.length;e++)a=d.edges[e],this.clusteredEdges[a.id]===void 0&&(a.toId!==a.fromId&&s++,o.push(a));if(s===e){let e=function(e){if(t.joinCondition===void 0||t.joinCondition===null)return!0;let n=sP.cloneOptions(e);return t.joinCondition(n)},n=!0;for(let t=0;t<o.length;t++){a=o[t];let r=this._getConnectedId(a,u);if(e(d))l[a.id]=a,c[u]=d,c[r]=this.body.nodes[r],i[u]=!0;else{n=!1;break}}if(Xf(c).length>0&&Xf(l).length>0&&n===!0){let e=function(){for(let e=0;e<r.length;++e)for(let t in c)if(r[e].nodes[t]!==void 0)return r[e]}();if(e!==void 0){for(let t in c)e.nodes[t]===void 0&&(e.nodes[t]=c[t]);for(let t in l)e.edges[t]===void 0&&(e.edges[t]=l[t])}else r.push({nodes:c,edges:l})}}}}for(let e=0;e<r.length;e++)this._cluster(r[e].nodes,r[e].edges,t,!1);n===!0&&this.body.emitter.emit(`_dataChanged`)}clusterOutliers(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}clusterBridges(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}clusterByConnection(e,t){var n;let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw Error(`No nodeId supplied to clusterByConnection!`);if(this.body.nodes[e]===void 0)throw Error(`The nodeId given to clusterByConnection does not exist!`);let i=this.body.nodes[e];t=this._checkOptions(t,i),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=i.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=i.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=i.options.fixed.x,t.clusterNodeProperties.fixed.y=i.options.fixed.y);let a={},o={},s=i.id,c=sP.cloneOptions(i);a[s]=i;for(let e=0;e<i.edges.length;e++){let n=i.edges[e];if(this.clusteredEdges[n.id]===void 0){let e=this._getConnectedId(n,s);if(this.clusteredNodes[e]===void 0)if(e!==s)if(t.joinCondition===void 0)o[n.id]=n,a[e]=this.body.nodes[e];else{let r=sP.cloneOptions(this.body.nodes[e]);t.joinCondition(c,r)===!0&&(o[n.id]=n,a[e]=this.body.nodes[e])}else o[n.id]=n}}let l=Lf(n=Xf(a)).call(n,function(e){return a[e].id});for(let e in a){if(!Object.prototype.hasOwnProperty.call(a,e))continue;let t=a[e];for(let e=0;e<t.edges.length;e++){let n=t.edges[e];Pg(l).call(l,this._getConnectedId(n,t.id))>-1&&(o[n.id]=n)}}this._cluster(a,o,t,r)}_createClusterEdges(e,t,n,r){let i,a,o,s,c,l,u=Xf(e),d=[];for(let r=0;r<u.length;r++){a=u[r],o=e[a];for(let r=0;r<o.edges.length;r++)i=o.edges[r],this.clusteredEdges[i.id]===void 0&&(i.toId==i.fromId?t[i.id]=i:i.toId==a?(s=n.id,c=i.fromId,l=c):(s=i.toId,c=n.id,l=s),e[l]===void 0&&d.push({edge:i,fromId:c,toId:s}))}let f=[],p=function(e){for(let t=0;t<f.length;t++){let n=f[t],r=e.fromId===n.fromId&&e.toId===n.toId,i=e.fromId===n.toId&&e.toId===n.fromId;if(r||i)return n}return null};for(let e=0;e<d.length;e++){let t=d[e],n=t.edge,i=p(t);i===null?(i=this._createClusteredEdge(t.fromId,t.toId,n,r),f.push(i)):i.clusteringEdgeReplacingIds.push(n.id),this.body.edges[n.id].edgeReplacedById=i.id,this._backupEdgeOptions(n),n.setOptions({physics:!1})}}_checkOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}_cluster(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=[];for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.clusteredNodes[t]!==void 0&&i.push(t);for(let t=0;t<i.length;++t)delete e[i[t]];if(Xf(e).length==0||Xf(e).length==1&&n.clusterNodeProperties.allowSingleNodeCluster!=1)return;let a=$b({},n.clusterNodeProperties);if(n.processProperties!==void 0){let r=[];for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=sP.cloneOptions(e[t]);r.push(n)}let i=[];for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&e.substr(0,12)!==`clusterEdge:`){let n=sP.cloneOptions(t[e],`edge`);i.push(n)}if(a=n.processProperties(a,r,i),!a)throw Error(`The processProperties function does not return properties!`)}a.id===void 0&&(a.id=`cluster:`+Gj());let o=a.id;a.label===void 0&&(a.label=`cluster`);let s;a.x===void 0&&(s=this._getClusterPosition(e),a.x=s.x),a.y===void 0&&(s===void 0&&(s=this._getClusterPosition(e)),a.y=s.y),a.id=o;let c=this.body.functions.createNode(a,cP);c.containedNodes=e,c.containedEdges=t,c.clusterEdgeProperties=n.clusterEdgeProperties,this.body.nodes[a.id]=c,this._clusterEdges(e,t,a,n.clusterEdgeProperties),a.id=void 0,r===!0&&this.body.emitter.emit(`_dataChanged`)}_backupEdgeOptions(e){this.clusteredEdges[e.id]===void 0&&(this.clusteredEdges[e.id]={physics:e.options.physics})}_restoreEdge(e){let t=this.clusteredEdges[e.id];t!==void 0&&(e.setOptions({physics:t.physics}),delete this.clusteredEdges[e.id])}isCluster(e){return this.body.nodes[e]===void 0?(console.error(`Node does not exist.`),!1):this.body.nodes[e].isCluster===!0}_getClusterPosition(e){let t=Xf(e),n=e[t[0]].x,r=e[t[0]].x,i=e[t[0]].y,a=e[t[0]].y,o;for(let s=1;s<t.length;s++)o=e[t[s]],n=o.x<n?o.x:n,r=o.x>r?o.x:r,i=o.y<i?o.y:i,a=o.y>a?o.y:a;return{x:.5*(n+r),y:.5*(i+a)}}openCluster(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw Error(`No clusterNodeId supplied to openCluster.`);let r=this.body.nodes[e];if(r===void 0)throw Error(`The clusterNodeId supplied to openCluster does not exist.`);if(r.isCluster!==!0||r.containedNodes===void 0||r.containedEdges===void 0)throw Error(`The node:`+e+` is not a valid cluster.`);let i=this.findNode(e),a=Pg(i).call(i,e)-1;if(a>=0){let t=i[a];this.body.nodes[t]._openChildCluster(e),delete this.body.nodes[e],n===!0&&this.body.emitter.emit(`_dataChanged`);return}let o=r.containedNodes,s=r.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction==`function`){let e={},n={x:r.x,y:r.y};for(let t in o)if(Object.prototype.hasOwnProperty.call(o,t)){let n=this.body.nodes[t];e[t]={x:n.x,y:n.y}}let i=t.releaseFunction(n,e);for(let e in o)if(Object.prototype.hasOwnProperty.call(o,e)){let t=this.body.nodes[e];i[e]!==void 0&&(t.x=i[e].x===void 0?r.x:i[e].x,t.y=i[e].y===void 0?r.y:i[e].y)}}else ix(o,function(e){e.options.fixed.x===!1&&(e.x=r.x),e.options.fixed.y===!1&&(e.y=r.y)});for(let e in o)if(Object.prototype.hasOwnProperty.call(o,e)){let t=this.body.nodes[e];t.vx=r.vx,t.vy=r.vy,t.setOptions({physics:!0}),delete this.clusteredNodes[e]}let c=[];for(let e=0;e<r.edges.length;e++)c.push(r.edges[e]);for(let t=0;t<c.length;t++){let n=c[t],r=this._getConnectedId(n,e),i=this.clusteredNodes[r];for(let e=0;e<n.clusteringEdgeReplacingIds.length;e++){let t=n.clusteringEdgeReplacingIds[e],a=this.body.edges[t];if(a!==void 0)if(i!==void 0){let e=this.body.nodes[i.clusterId];e.containedEdges[a.id]=a,delete s[a.id];let t=a.fromId,n=a.toId;a.toId==r?n=i.clusterId:t=i.clusterId,this._createClusteredEdge(t,n,a,e.clusterEdgeProperties,{hidden:!1,physics:!0})}else this._restoreEdge(a)}n.remove()}for(let e in s)Object.prototype.hasOwnProperty.call(s,e)&&this._restoreEdge(s[e]);delete this.body.nodes[e],n===!0&&this.body.emitter.emit(`_dataChanged`)}getNodesInCluster(e){let t=[];if(this.isCluster(e)===!0){let n=this.body.nodes[e].containedNodes;for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&t.push(this.body.nodes[e].id)}return t}findNode(e){let t=[],n=0,r;for(;this.clusteredNodes[e]!==void 0&&n<100;){if(r=this.body.nodes[e],r===void 0)return[];t.push(r.id),e=this.clusteredNodes[e].clusterId,n++}return r=this.body.nodes[e],r===void 0?[]:(t.push(r.id),qp(t).call(t),t)}updateClusteredNode(e,t){if(e===void 0)throw Error(`No clusteredNodeId supplied to updateClusteredNode.`);if(t===void 0)throw Error(`No newOptions supplied to updateClusteredNode.`);if(this.body.nodes[e]===void 0)throw Error(`The clusteredNodeId supplied to updateClusteredNode does not exist.`);this.body.nodes[e].setOptions(t),this.body.emitter.emit(`_dataChanged`)}updateEdge(e,t){if(e===void 0)throw Error(`No startEdgeId supplied to updateEdge.`);if(t===void 0)throw Error(`No newOptions supplied to updateEdge.`);if(this.body.edges[e]===void 0)throw Error(`The startEdgeId supplied to updateEdge does not exist.`);let n=this.getClusteredEdges(e);for(let e=0;e<n.length;e++)this.body.edges[n[e]].setOptions(t);this.body.emitter.emit(`_dataChanged`)}getClusteredEdges(e){let t=[],n=0;for(;e!==void 0&&this.body.edges[e]!==void 0&&n<100;)t.push(this.body.edges[e].id),e=this.body.edges[e].edgeReplacedById,n++;return qp(t).call(t),t}getBaseEdge(e){return this.getBaseEdges(e)[0]}getBaseEdges(e){let t=[e],n=[],r=[],i=0;for(;t.length>0&&i<100;){let e=t.pop();if(e===void 0)continue;let a=this.body.edges[e];if(a===void 0)continue;i++;let o=a.clusteringEdgeReplacingIds;if(o===void 0)r.push(e);else for(let e=0;e<o.length;++e){let r=o[e];Pg(t).call(t,o)!==-1||Pg(n).call(n,o)!==-1||t.push(r)}n.push(e)}return r}_getConnectedId(e,t){return e.toId==t?(e.fromId,e.fromId):e.toId}_getHubSize(){let e=0,t=0,n=0,r=0;for(let i=0;i<this.body.nodeIndices.length;i++){let a=this.body.nodes[this.body.nodeIndices[i]];a.edges.length>r&&(r=a.edges.length),e+=a.edges.length,t+=a.edges.length**2,n+=1}e/=n,t/=n;let i=t-e**2,a=Math.floor(e+2*Math.sqrt(i));return a>r&&(a=r),a}_createClusteredEdge(e,t,n,r,i){let a=sP.cloneOptions(n,`edge`);$b(a,r),a.from=e,a.to=t,a.id=`clusterEdge:`+Gj(),i!==void 0&&$b(a,i);let o=this.body.functions.createEdge(a);return o.clusteringEdgeReplacingIds=[n.id],o.connect(),this.body.edges[o.id]=o,o}_clusterEdges(e,t,n,r){if(t instanceof XN){let e=t,n={};n[e.id]=e,t=n}if(e instanceof uN){let t=e,n={};n[t.id]=t,e=n}if(n==null)throw Error(`_clusterEdges: parameter clusterNode required`);r===void 0&&(r=n.clusterEdgeProperties),this._createClusterEdges(e,t,n,r);for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&this.body.edges[e]!==void 0){let t=this.body.edges[e];this._backupEdgeOptions(t),t.setOptions({physics:!1})}for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.clusteredNodes[t]={clusterId:n.id,node:this.body.nodes[t]},this.body.nodes[t].setOptions({physics:!1}))}_getClusterNodeForNode(e){if(e===void 0)return;let t=this.clusteredNodes[e];if(t===void 0)return;let n=t.clusterId;if(n!==void 0)return this.body.nodes[n]}_filter(e,t){let n=[];return ix(e,e=>{t(e)&&n.push(e)}),n}_updateState(){let e,t=[],n={},r=e=>{ix(this.body.nodes,t=>{t.isCluster===!0&&e(t)})};for(e in this.clusteredNodes)Object.prototype.hasOwnProperty.call(this.clusteredNodes,e)&&this.body.nodes[e]===void 0&&t.push(e);r(function(e){for(let n=0;n<t.length;n++)delete e.containedNodes[t[n]]});for(let e=0;e<t.length;e++)delete this.clusteredNodes[t[e]];ix(this.clusteredEdges,e=>{let t=this.body.edges[e];(t===void 0||!t.endPointsValid())&&(n[e]=e)}),r(function(e){ix(e.containedEdges,(e,t)=>{!e.endPointsValid()&&!n[t]&&(n[t]=t)})}),ix(this.body.edges,(e,t)=>{let r=!0,i=e.clusteringEdgeReplacingIds;if(i!==void 0){let e=0;ix(i,t=>{let n=this.body.edges[t];n!==void 0&&n.endPointsValid()&&(e+=1)}),r=e>0}(!e.endPointsValid()||!r)&&(n[t]=t)}),r(e=>{ix(n,t=>{delete e.containedEdges[t],ix(e.edges,(r,i)=>{if(r.id===t){e.edges[i]=null;return}r.clusteringEdgeReplacingIds=this._filter(r.clusteringEdgeReplacingIds,function(e){return!n[e]})}),e.edges=this._filter(e.edges,function(e){return e!==null})})}),ix(n,e=>{delete this.clusteredEdges[e]}),ix(n,e=>{delete this.body.edges[e]}),ix(Xf(this.body.edges),e=>{let t=this.body.edges[e],n=this._isClusteredNode(t.fromId)||this._isClusteredNode(t.toId);if(n!==this._isClusteredEdge(t.id))if(n){let e=this._getClusterNodeForNode(t.fromId);e!==void 0&&this._clusterEdges(this.body.nodes[t.fromId],t,e);let n=this._getClusterNodeForNode(t.toId);n!==void 0&&this._clusterEdges(this.body.nodes[t.toId],t,n)}else delete this._clusterEdges[e],this._restoreEdge(t)});let i=!1,a=!0;for(;a;){let e=[];r(function(t){let n=Xf(t.containedNodes).length,r=t.options.allowSingleNodeCluster===!0;(r&&n<1||!r&&n<2)&&e.push(t.id)});for(let t=0;t<e.length;++t)this.openCluster(e[t],{},!1);a=e.length>0,i||=a}i&&this._updateState()}_isClusteredNode(e){return this.clusteredNodes[e]!==void 0}_isClusteredEdge(e){return this.clusteredEdges[e]!==void 0}},uP=class{constructor(e,t){this.body=e,this.canvas=t,this.redrawRequested=!1,this.requestAnimationFrameRequestId=void 0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},Jo(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e;this.body.emitter.on(`dragStart`,()=>{this.dragging=!0}),this.body.emitter.on(`dragEnd`,()=>{this.dragging=!1}),this.body.emitter.on(`zoom`,()=>{this.zooming=!0,window.clearTimeout(this.zoomTimeoutId),this.zoomTimeoutId=B_(()=>{var e;this.zooming=!1,B(e=this._requestRedraw).call(e,this)()},250)}),this.body.emitter.on(`_resizeNodes`,()=>{this._resizeNodes()}),this.body.emitter.on(`_redraw`,()=>{this.renderingActive===!1&&this._redraw()}),this.body.emitter.on(`_blockRedraw`,()=>{this.allowRedraw=!1}),this.body.emitter.on(`_allowRedraw`,()=>{this.allowRedraw=!0,this.redrawRequested=!1}),this.body.emitter.on(`_requestRedraw`,B(e=this._requestRedraw).call(e,this)),this.body.emitter.on(`_startRendering`,()=>{this.renderRequests+=1,this.renderingActive=!0,this._startRendering()}),this.body.emitter.on(`_stopRendering`,()=>{--this.renderRequests,this.renderingActive=this.renderRequests>0,this.requestAnimationFrameRequestId=void 0}),this.body.emitter.on(`destroy`,()=>{this.renderRequests=0,this.allowRedraw=!1,this.renderingActive=!1,window.cancelAnimationFrame(this.requestAnimationFrameRequestId),this.body.emitter.off()})}setOptions(e){e!==void 0&&Zb([`hideEdgesOnDrag`,`hideEdgesOnZoom`,`hideNodesOnDrag`],this.options,e)}_startRendering(){if(this.renderingActive===!0&&this.requestAnimationFrameRequestId===void 0){var e;this.requestAnimationFrameRequestId=window.requestAnimationFrame(B(e=this._renderStep).call(e,this),this.simulationInterval)}}_renderStep(){this.renderingActive===!0&&(this.requestAnimationFrameRequestId=void 0,this._startRendering(),this._redraw())}redraw(){this.body.emitter.emit(`setSize`),this._redraw()}_requestRedraw(){this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,window.requestAnimationFrame(()=>{this._redraw(!1)}))}_redraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit(`initRedraw`),this.redrawRequested=!1;let t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();let n=this.canvas.getContext(),r=this.canvas.frame.canvas.clientWidth,i=this.canvas.frame.canvas.clientHeight;if(n.clearRect(0,0,r,i),this.canvas.frame.clientWidth===0)return;if(n.save(),n.translate(this.body.view.translation.x,this.body.view.translation.y),n.scale(this.body.view.scale,this.body.view.scale),n.beginPath(),this.body.emitter.emit(`beforeDrawing`,n),n.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(n),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){let{drawExternalLabels:r}=this._drawNodes(n,e);t.drawExternalLabels=r}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(n),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(n),n.beginPath(),this.body.emitter.emit(`afterDrawing`,n),n.closePath(),n.restore(),e===!0&&n.clearRect(0,0,r,i)}}_resizeNodes(){this.canvas.setTransform();let e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);let t=this.body.nodes,n;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n=t[r],n.resize(e),n.updateBoundingBox(e,n.selected));e.restore()}_drawNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.nodes,r=this.body.nodeIndices,i,a=[],o=[],s=this.canvas.DOMtoCanvas({x:-20,y:-20}),c=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+20,y:this.canvas.frame.canvas.clientHeight+20}),l={top:s.y,left:s.x,bottom:c.y,right:c.x},u=[];for(let s=0;s<r.length;s++)if(i=n[r[s]],i.hover)o.push(r[s]);else if(i.isSelected())a.push(r[s]);else if(t===!0){let t=i.draw(e);t.drawExternalLabel!=null&&u.push(t.drawExternalLabel)}else if(i.isBoundingBoxOverlappingWith(l)===!0){let t=i.draw(e);t.drawExternalLabel!=null&&u.push(t.drawExternalLabel)}else i.updateBoundingBox(e,i.selected);let d,f=a.length,p=o.length;for(d=0;d<f;d++){i=n[a[d]];let t=i.draw(e);t.drawExternalLabel!=null&&u.push(t.drawExternalLabel)}for(d=0;d<p;d++){i=n[o[d]];let t=i.draw(e);t.drawExternalLabel!=null&&u.push(t.drawExternalLabel)}return{drawExternalLabels:()=>{for(let e of u)e()}}}_drawEdges(e){let t=this.body.edges,n=this.body.edgeIndices;for(let r=0;r<n.length;r++){let i=t[n[r]];i.connected===!0&&i.draw(e)}}_drawArrows(e){let t=this.body.edges,n=this.body.edgeIndices;for(let r=0;r<n.length;r++){let i=t[n[r]];i.connected===!0&&i.drawArrows(e)}}_drawSelectionBox(e){if(this.body.selectionBox.show){e.beginPath();let t=this.body.selectionBox.position.end.x-this.body.selectionBox.position.start.x,n=this.body.selectionBox.position.end.y-this.body.selectionBox.position.start.y;e.rect(this.body.selectionBox.position.start.x,this.body.selectionBox.position.start.y,t,n),e.fillStyle=`rgba(151, 194, 252, 0.2)`,e.fillRect(this.body.selectionBox.position.start.x,this.body.selectionBox.position.start.y,t,n),e.strokeStyle=`rgba(151, 194, 252, 1)`,e.stroke()}else e.closePath()}},dP,fP;function pP(){return fP?dP:(fP=1,N_(),dP=L().setInterval,dP)}var mP,hP;function gP(){return hP?mP:(hP=1,mP=pP(),mP)}var _P=P(gP());function vP(e,t){t.inputHandler=function(e){e.isFirst&&t(e)},e.on(`hammer.input`,t.inputHandler)}function yP(e,t){return t.inputHandler=function(e){e.isFinal&&t(e)},e.on(`hammer.input`,t.inputHandler)}var bP=class{constructor(e){this.body=e,this.pixelRatio=1,this.cameraState={},this.initialized=!1,this.canvasViewCenter={},this._cleanupCallbacks=[],this.options={},this.defaultOptions={autoResize:!0,height:`100%`,width:`100%`},Jo(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e;this.body.emitter.once(`resize`,e=>{e.width!==0&&(this.body.view.translation.x=e.width*.5),e.height!==0&&(this.body.view.translation.y=e.height*.5)}),this.body.emitter.on(`setSize`,B(e=this.setSize).call(e,this)),this.body.emitter.on(`destroy`,()=>{this.hammerFrame.destroy(),this.hammer.destroy(),this._cleanUp()})}setOptions(e){if(e!==void 0&&Zb([`width`,`height`,`autoResize`],this.options,e),this._cleanUp(),this.options.autoResize===!0){var t;if(window.ResizeObserver){let e=new ResizeObserver(()=>{this.setSize()===!0&&this.body.emitter.emit(`_requestRedraw`)}),{frame:t}=this;e.observe(t),this._cleanupCallbacks.push(()=>{e.unobserve(t)})}else{let e=_P(()=>{this.setSize()===!0&&this.body.emitter.emit(`_requestRedraw`)},1e3);this._cleanupCallbacks.push(()=>{clearInterval(e)})}let e=B(t=this._onResize).call(t,this);window.addEventListener(`resize`,e),this._cleanupCallbacks.push(()=>{window.removeEventListener(`resize`,e)})}}_cleanUp(){var e,t,n;jp(e=qp(t=hm(n=this._cleanupCallbacks).call(n,0)).call(t)).call(e,e=>{try{e()}catch(e){console.error(e)}})}_onResize(){this.setSize(),this.body.emitter.emit(`_redraw`)}_getCameraState(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}_setCameraState(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){let e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,n=this.cameraState.scale;e!=1&&t!=1?n=this.cameraState.scale*.5*(e+t):e==1?t!=1&&(n=this.cameraState.scale*t):n=this.cameraState.scale*e,this.body.view.scale=n;let r=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),i={x:r.x-this.cameraState.position.x,y:r.y-this.cameraState.position.y};this.body.view.translation.x+=i.x*this.body.view.scale,this.body.view.translation.y+=i.y*this.body.view.scale}}_prepareValue(e){if(typeof e==`number`)return e+`px`;if(typeof e==`string`){if(Pg(e).call(e,`%`)!==-1||Pg(e).call(e,`px`)!==-1)return e;if(Pg(e).call(e,`%`)===-1)return e+`px`}throw Error(`Could not use the value supplied for width or height:`+e)}_create(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement(`div`),this.frame.className=`vis-network`,this.frame.style.position=`relative`,this.frame.style.overflow=`hidden`,this.frame.tabIndex=0,this.frame.canvas=document.createElement(`canvas`),this.frame.canvas.style.position=`relative`,this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{let e=document.createElement(`DIV`);e.style.color=`red`,e.style.fontWeight=`bold`,e.style.padding=`10px`,e.innerText=`Error: your browser does not support HTML canvas`,this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}_bindHammer(){this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new jx(this.frame.canvas),this.hammer.get(`pinch`).set({enable:!0}),this.hammer.get(`pan`).set({threshold:5,direction:jx.DIRECTION_ALL}),vP(this.hammer,e=>{this.body.eventListeners.onTouch(e)}),this.hammer.on(`tap`,e=>{this.body.eventListeners.onTap(e)}),this.hammer.on(`doubletap`,e=>{this.body.eventListeners.onDoubleTap(e)}),this.hammer.on(`press`,e=>{this.body.eventListeners.onHold(e)}),this.hammer.on(`panstart`,e=>{this.body.eventListeners.onDragStart(e)}),this.hammer.on(`panmove`,e=>{this.body.eventListeners.onDrag(e)}),this.hammer.on(`panend`,e=>{this.body.eventListeners.onDragEnd(e)}),this.hammer.on(`pinch`,e=>{this.body.eventListeners.onPinch(e)}),this.frame.canvas.addEventListener(`wheel`,e=>{this.body.eventListeners.onMouseWheel(e)}),this.frame.canvas.addEventListener(`mousemove`,e=>{this.body.eventListeners.onMouseMove(e)}),this.frame.canvas.addEventListener(`contextmenu`,e=>{this.body.eventListeners.onContext(e)}),this.hammerFrame=new jx(this.frame),yP(this.hammerFrame,e=>{this.body.eventListeners.onRelease(e)})}setSize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);let n=!1,r=this.frame.canvas.width,i=this.frame.canvas.height,a=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(a),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width=`100%`,this.frame.canvas.style.height=`100%`,this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},n=!0;else{let e=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),t=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==e||this.frame.canvas.height!==t)&&this._getCameraState(a),this.frame.canvas.width!==e&&(this.frame.canvas.width=e,n=!0),this.frame.canvas.height!==t&&(this.frame.canvas.height=t,n=!0)}return n===!0&&(this.body.emitter.emit(`resize`,{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(r/this.pixelRatio),oldHeight:Math.round(i/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,n}getContext(){return this.frame.canvas.getContext(`2d`)}_determinePixelRatio(){let e=this.getContext();if(e===void 0)throw Error(`Could not get canvax context`);let t=1;typeof window<`u`&&(t=window.devicePixelRatio||1);let n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/n}_setPixelRatio(){this.pixelRatio=this._determinePixelRatio()}setTransform(){let e=this.getContext();if(e===void 0)throw Error(`Could not get canvax context`);e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}_XconvertDOMtoCanvas(e){return(e-this.body.view.translation.x)/this.body.view.scale}_XconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.x}_YconvertDOMtoCanvas(e){return(e-this.body.view.translation.y)/this.body.view.scale}_YconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.y}canvasToDOM(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}DOMtoCanvas(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}};function xP(e,t){let n=Jo({nodes:t,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},e??{});if(!W(n.nodes))throw TypeError(`Nodes has to be an array of ids.`);if(n.nodes.length===0&&(n.nodes=t),!(typeof n.minZoomLevel==`number`&&n.minZoomLevel>0))throw TypeError(`Min zoom level has to be a number higher than zero.`);if(!(typeof n.maxZoomLevel==`number`&&n.minZoomLevel<=n.maxZoomLevel))throw TypeError(`Max zoom level has to be a number higher than min zoom level.`);return n}var SP=class{constructor(e,t){var n,r;this.body=e,this.canvas=t,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction=`easeInOutQuint`,this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on(`fit`,B(n=this.fit).call(n,this)),this.body.emitter.on(`animationFinished`,()=>{this.body.emitter.emit(`_stopRendering`)}),this.body.emitter.on(`unlockNode`,B(r=this.releaseNode).call(r,this))}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}fit(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=xP(e,this.body.nodeIndices);let n=this.canvas.frame.canvas.clientWidth,r=this.canvas.frame.canvas.clientHeight,i,a;if(n===0||r===0)a=1,i=sP.getRange(this.body.nodes,e.nodes);else if(t===!0){let t=0;for(let e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this.body.nodes[e].predefinedPosition===!0&&(t+=1);if(t>.5*this.body.nodeIndices.length){this.fit(e,!1);return}i=sP.getRange(this.body.nodes,e.nodes),a=12.662/(this.body.nodeIndices.length+7.4147)+.0964822;let o=Math.min(n/600,r/600);a*=o}else{this.body.emitter.emit(`_resizeNodes`),i=sP.getRange(this.body.nodes,e.nodes);let t=Math.abs(i.maxX-i.minX)*1.1,o=Math.abs(i.maxY-i.minY)*1.1,s=n/t,c=r/o;a=s<=c?s:c}a>e.maxZoomLevel?a=e.maxZoomLevel:a<e.minZoomLevel&&(a=e.minZoomLevel);let o={position:sP.findCenter(i),scale:a,animation:e.animation};this.moveTo(o)}focus(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.body.nodes[e]===void 0?console.error(`Node: `+e+` cannot be found.`):(t.position={x:this.body.nodes[e].x,y:this.body.nodes[e].y},t.lockedOnNode=e,this.moveTo(t))}moveTo(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!fw(e.offset.x))throw TypeError(`The option "offset.x" has to be a finite number.`)}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!fw(e.offset.y))throw TypeError(`The option "offset.y" has to be a finite number.`)}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!fw(e.position.x))throw TypeError(`The option "position.x" has to be a finite number.`)}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!fw(e.position.y))throw TypeError(`The option "position.y" has to be a finite number.`)}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw TypeError(`The option "scale" has to be a number greater than zero.`)}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction=`easeInOutQuad`),this.animateView(e)}animateView(e){if(e===void 0)return;this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;let t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+n.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+n.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var r;this.viewFunction=B(r=this._lockedRedraw).call(r,this),this.body.emitter.on(`initRedraw`,this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit(`_requestRedraw`);else{var i;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=B(i=this._transitionRedraw).call(i,this),this.body.emitter.on(`initRedraw`,this.viewFunction),this.body.emitter.emit(`_startRendering`)}}_lockedRedraw(){let e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.x,y:t.y-e.y},r=this.body.view.translation,i={x:r.x+n.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:r.y+n.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=i}releaseNode(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off(`initRedraw`,this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}_transitionRedraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;let t=vx[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off(`initRedraw`,this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var n;this.viewFunction=B(n=this._lockedRedraw).call(n,this),this.body.emitter.on(`initRedraw`,this.viewFunction)}this.body.emitter.emit(`animationFinished`)}}getScale(){return this.body.view.scale}getViewPosition(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}};function CP(e){var t=e&&e.preventDefault||!1,n=e&&e.container||window,r={},i={keydown:{},keyup:{}},a={},o;for(o=97;o<=122;o++)a[String.fromCharCode(o)]={code:65+(o-97),shift:!1};for(o=65;o<=90;o++)a[String.fromCharCode(o)]={code:o,shift:!0};for(o=0;o<=9;o++)a[``+o]={code:48+o,shift:!1};for(o=1;o<=12;o++)a[`F`+o]={code:111+o,shift:!1};for(o=0;o<=9;o++)a[`num`+o]={code:96+o,shift:!1};a[`num*`]={code:106,shift:!1},a[`num+`]={code:107,shift:!1},a[`num-`]={code:109,shift:!1},a[`num/`]={code:111,shift:!1},a[`num.`]={code:110,shift:!1},a.left={code:37,shift:!1},a.up={code:38,shift:!1},a.right={code:39,shift:!1},a.down={code:40,shift:!1},a.space={code:32,shift:!1},a.enter={code:13,shift:!1},a.shift={code:16,shift:void 0},a.esc={code:27,shift:!1},a.backspace={code:8,shift:!1},a.tab={code:9,shift:!1},a.ctrl={code:17,shift:!1},a.alt={code:18,shift:!1},a.delete={code:46,shift:!1},a.pageup={code:33,shift:!1},a.pagedown={code:34,shift:!1},a[`=`]={code:187,shift:!1},a[`-`]={code:189,shift:!1},a[`]`]={code:221,shift:!1},a[`[`]={code:219,shift:!1};var s=function(e){l(e,`keydown`)},c=function(e){l(e,`keyup`)},l=function(e,n){if(i[n][e.keyCode]!==void 0){for(var r=i[n][e.keyCode],a=0;a<r.length;a++)(r[a].shift===void 0||r[a].shift==1&&e.shiftKey==1||r[a].shift==0&&e.shiftKey==0)&&r[a].fn(e);t==1&&e.preventDefault()}};return r.bind=function(e,t,n){if(n===void 0&&(n=`keydown`),a[e]===void 0)throw Error(`unsupported key: `+e);i[n][a[e].code]===void 0&&(i[n][a[e].code]=[]),i[n][a[e].code].push({fn:t,shift:a[e].shift})},r.bindAll=function(e,t){for(var n in t===void 0&&(t=`keydown`),a)a.hasOwnProperty(n)&&r.bind(n,e,t)},r.getKey=function(e){for(var t in a)if(a.hasOwnProperty(t)&&(e.shiftKey==1&&a[t].shift==1&&e.keyCode==a[t].code||e.shiftKey==0&&a[t].shift==0&&e.keyCode==a[t].code||e.keyCode==a[t].code&&t==`shift`))return t;return`unknown key, currently not supported`},r.unbind=function(e,t,n){if(n===void 0&&(n=`keydown`),a[e]===void 0)throw Error(`unsupported key: `+e);if(t!==void 0){var r=[],o=i[n][a[e].code];if(o!==void 0)for(var s=0;s<o.length;s++)o[s].fn==t&&o[s].shift==a[e].shift||r.push(i[n][a[e].code][s]);i[n][a[e].code]=r}else i[n][a[e].code]=[]},r.reset=function(){i={keydown:{},keyup:{}}},r.destroy=function(){i={keydown:{},keyup:{}},n.removeEventListener(`keydown`,s,!0),n.removeEventListener(`keyup`,c,!0)},n.addEventListener(`keydown`,s,!0),n.addEventListener(`keyup`,c,!0),r}var wP=class{constructor(e,t){this.body=e,this.canvas=t,this.iconsCreated=!1,this.navigationHammers=[],this.boundFunctions={},this.touchTime=0,this.activated=!1,this.body.emitter.on(`activate`,()=>{this.activated=!0,this.configureKeyboardBindings()}),this.body.emitter.on(`deactivate`,()=>{this.activated=!1,this.configureKeyboardBindings()}),this.body.emitter.on(`destroy`,()=>{this.keycharm!==void 0&&this.keycharm.destroy()}),this.options={}}setOptions(e){e!==void 0&&(this.options=e,this.create())}create(){this.options.navigationButtons===!0?this.iconsCreated===!1&&this.loadNavigationElements():this.iconsCreated===!0&&this.cleanNavigation(),this.configureKeyboardBindings()}cleanNavigation(){if(this.navigationHammers.length!=0){for(let e=0;e<this.navigationHammers.length;e++)this.navigationHammers[e].destroy();this.navigationHammers=[]}this.navigationDOM&&this.navigationDOM.wrapper&&this.navigationDOM.wrapper.parentNode&&this.navigationDOM.wrapper.parentNode.removeChild(this.navigationDOM.wrapper),this.iconsCreated=!1}loadNavigationElements(){this.cleanNavigation(),this.navigationDOM={};let e=[`up`,`down`,`left`,`right`,`zoomIn`,`zoomOut`,`zoomExtends`],t=[`_moveUp`,`_moveDown`,`_moveLeft`,`_moveRight`,`_zoomIn`,`_zoomOut`,`_fit`];this.navigationDOM.wrapper=document.createElement(`div`),this.navigationDOM.wrapper.className=`vis-navigation`,this.canvas.frame.appendChild(this.navigationDOM.wrapper);for(let i=0;i<e.length;i++){this.navigationDOM[e[i]]=document.createElement(`div`),this.navigationDOM[e[i]].className=`vis-button vis-`+e[i],this.navigationDOM.wrapper.appendChild(this.navigationDOM[e[i]]);let a=new jx(this.navigationDOM[e[i]]);if(t[i]===`_fit`){var n;vP(a,B(n=this._fit).call(n,this))}else{var r;vP(a,B(r=this.bindToRedraw).call(r,this,t[i]))}this.navigationHammers.push(a)}let i=new jx(this.canvas.frame);yP(i,()=>{this._stopMovement()}),this.navigationHammers.push(i),this.iconsCreated=!0}bindToRedraw(e){if(this.boundFunctions[e]===void 0){var t;this.boundFunctions[e]=B(t=this[e]).call(t,this),this.body.emitter.on(`initRedraw`,this.boundFunctions[e]),this.body.emitter.emit(`_startRendering`)}}unbindFromRedraw(e){this.boundFunctions[e]!==void 0&&(this.body.emitter.off(`initRedraw`,this.boundFunctions[e]),this.body.emitter.emit(`_stopRendering`),delete this.boundFunctions[e])}_fit(){new Date().valueOf()-this.touchTime>700&&(this.body.emitter.emit(`fit`,{duration:700}),this.touchTime=new Date().valueOf())}_stopMovement(){for(let e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off(`initRedraw`,this.boundFunctions[e]),this.body.emitter.emit(`_stopRendering`));this.boundFunctions={}}_moveUp(){this.body.view.translation.y+=this.options.keyboard.speed.y}_moveDown(){this.body.view.translation.y-=this.options.keyboard.speed.y}_moveLeft(){this.body.view.translation.x+=this.options.keyboard.speed.x}_moveRight(){this.body.view.translation.x-=this.options.keyboard.speed.x}_zoomIn(){let e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,r=t/e,i=(1-r)*this.canvas.canvasViewCenter.x+n.x*r,a=(1-r)*this.canvas.canvasViewCenter.y+n.y*r;this.body.view.scale=t,this.body.view.translation={x:i,y:a},this.body.emitter.emit(`zoom`,{direction:`+`,scale:this.body.view.scale,pointer:null})}_zoomOut(){let e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,r=t/e,i=(1-r)*this.canvas.canvasViewCenter.x+n.x*r,a=(1-r)*this.canvas.canvasViewCenter.y+n.y*r;this.body.view.scale=t,this.body.view.translation={x:i,y:a},this.body.emitter.emit(`zoom`,{direction:`-`,scale:this.body.view.scale,pointer:null})}configureKeyboardBindings(){if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=CP({container:window,preventDefault:!0}):this.keycharm=CP({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C;B(e=this.keycharm).call(e,`up`,()=>{this.bindToRedraw(`_moveUp`)},`keydown`),B(t=this.keycharm).call(t,`down`,()=>{this.bindToRedraw(`_moveDown`)},`keydown`),B(n=this.keycharm).call(n,`left`,()=>{this.bindToRedraw(`_moveLeft`)},`keydown`),B(r=this.keycharm).call(r,`right`,()=>{this.bindToRedraw(`_moveRight`)},`keydown`),B(i=this.keycharm).call(i,`=`,()=>{this.bindToRedraw(`_zoomIn`)},`keydown`),B(a=this.keycharm).call(a,`num+`,()=>{this.bindToRedraw(`_zoomIn`)},`keydown`),B(o=this.keycharm).call(o,`num-`,()=>{this.bindToRedraw(`_zoomOut`)},`keydown`),B(s=this.keycharm).call(s,`-`,()=>{this.bindToRedraw(`_zoomOut`)},`keydown`),B(c=this.keycharm).call(c,`[`,()=>{this.bindToRedraw(`_zoomOut`)},`keydown`),B(l=this.keycharm).call(l,`]`,()=>{this.bindToRedraw(`_zoomIn`)},`keydown`),B(u=this.keycharm).call(u,`pageup`,()=>{this.bindToRedraw(`_zoomIn`)},`keydown`),B(d=this.keycharm).call(d,`pagedown`,()=>{this.bindToRedraw(`_zoomOut`)},`keydown`),B(f=this.keycharm).call(f,`up`,()=>{this.unbindFromRedraw(`_moveUp`)},`keyup`),B(p=this.keycharm).call(p,`down`,()=>{this.unbindFromRedraw(`_moveDown`)},`keyup`),B(m=this.keycharm).call(m,`left`,()=>{this.unbindFromRedraw(`_moveLeft`)},`keyup`),B(h=this.keycharm).call(h,`right`,()=>{this.unbindFromRedraw(`_moveRight`)},`keyup`),B(g=this.keycharm).call(g,`=`,()=>{this.unbindFromRedraw(`_zoomIn`)},`keyup`),B(_=this.keycharm).call(_,`num+`,()=>{this.unbindFromRedraw(`_zoomIn`)},`keyup`),B(v=this.keycharm).call(v,`num-`,()=>{this.unbindFromRedraw(`_zoomOut`)},`keyup`),B(y=this.keycharm).call(y,`-`,()=>{this.unbindFromRedraw(`_zoomOut`)},`keyup`),B(b=this.keycharm).call(b,`[`,()=>{this.unbindFromRedraw(`_zoomOut`)},`keyup`),B(x=this.keycharm).call(x,`]`,()=>{this.unbindFromRedraw(`_zoomIn`)},`keyup`),B(S=this.keycharm).call(S,`pageup`,()=>{this.unbindFromRedraw(`_zoomIn`)},`keyup`),B(C=this.keycharm).call(C,`pagedown`,()=>{this.unbindFromRedraw(`_zoomOut`)},`keyup`)}}},TP=class{constructor(e,t,n){var r,i,a,o,s,c,l,u,d,f,p,m,h;this.body=e,this.canvas=t,this.selectionHandler=n,this.navigationHandler=new wP(e,t),this.body.eventListeners.onTap=B(r=this.onTap).call(r,this),this.body.eventListeners.onTouch=B(i=this.onTouch).call(i,this),this.body.eventListeners.onDoubleTap=B(a=this.onDoubleTap).call(a,this),this.body.eventListeners.onHold=B(o=this.onHold).call(o,this),this.body.eventListeners.onDragStart=B(s=this.onDragStart).call(s,this),this.body.eventListeners.onDrag=B(c=this.onDrag).call(c,this),this.body.eventListeners.onDragEnd=B(l=this.onDragEnd).call(l,this),this.body.eventListeners.onMouseWheel=B(u=this.onMouseWheel).call(u,this),this.body.eventListeners.onPinch=B(d=this.onPinch).call(d,this),this.body.eventListeners.onMouseMove=B(f=this.onMouseMove).call(f,this),this.body.eventListeners.onRelease=B(p=this.onRelease).call(p,this),this.body.eventListeners.onContext=B(m=this.onContext).call(m,this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=B(h=this.getPointer).call(h,this),this.options={},this.defaultOptions={dragNodes:!0,dragView:!0,hover:!1,keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02},bindToWindow:!0,autoFocus:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0,zoomSpeed:1},Jo(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){this.body.emitter.on(`destroy`,()=>{clearTimeout(this.popupTimer),delete this.body.functions.getPointer})}setOptions(e){e!==void 0&&(Qb([`hideEdgesOnDrag`,`hideEdgesOnZoom`,`hideNodesOnDrag`,`keyboard`,`multiselect`,`selectable`,`selectConnectedEdges`],this.options,e),_x(this.options,e,`keyboard`),e.tooltip&&(Jo(this.options.tooltip,e.tooltip),e.tooltip.color&&(this.options.tooltip.color=cx(e.tooltip.color)))),this.navigationHandler.setOptions(this.options)}getPointer(e){return{x:e.x-nx(this.canvas.frame.canvas),y:e.y-rx(this.canvas.frame.canvas)}}onTouch(e){new Date().valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}onTap(e){let t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent(`click`,e,t)}onDoubleTap(e){let t=this.getPointer(e.center);this.selectionHandler.generateClickEvent(`doubleClick`,e,t)}onHold(e){let t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent(`click`,e,t),this.selectionHandler.generateClickEvent(`hold`,e,t)}onRelease(e){if(new Date().valueOf()-this.touchTime>10){let t=this.getPointer(e.center);this.selectionHandler.generateClickEvent(`release`,e,t),this.touchTime=new Date().valueOf()}}onContext(e){let t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent(`oncontext`,e,t)}checkSelectionChanges(e){(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1)===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}_determineDifference(e,t){let n=function(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r];Pg(t).call(t,i)===-1&&n.push(i)}return n};return{nodes:n(e.nodes,t.nodes),edges:n(e.edges,t.edges)}}onDragStart(e){if(this.drag.dragging)return;this.drag.pointer===void 0&&this.onTouch(e);let t=this.selectionHandler.getNodeAt(this.drag.pointer);if(this.drag.dragging=!0,this.drag.selection=[],this.drag.translation=Jo({},this.body.view.translation),this.drag.nodeId=void 0,e.srcEvent.shiftKey){this.body.selectionBox.show=!0;let t=this.getPointer(e.center);this.body.selectionBox.position.start={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)},this.body.selectionBox.position.end={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)}}else if(t!==void 0&&this.options.dragNodes===!0){this.drag.nodeId=t.id,t.isSelected()===!1&&this.selectionHandler.setSelection({nodes:[t.id]}),this.selectionHandler.generateClickEvent(`dragStart`,e,this.drag.pointer);for(let e of this.selectionHandler.getSelectedNodes()){let t={id:e.id,node:e,x:e.x,y:e.y,xFixed:e.options.fixed.x,yFixed:e.options.fixed.y};e.options.fixed.x=!0,e.options.fixed.y=!0,this.drag.selection.push(t)}}else this.selectionHandler.generateClickEvent(`dragStart`,e,this.drag.pointer,void 0,!0)}onDrag(e){if(this.drag.pinched===!0)return;this.body.emitter.emit(`unlockNode`);let t=this.getPointer(e.center),n=this.drag.selection;if(n&&n.length&&this.options.dragNodes===!0){this.selectionHandler.generateClickEvent(`dragging`,e,t);let r=t.x-this.drag.pointer.x,i=t.y-this.drag.pointer.y;jp(n).call(n,e=>{let t=e.node;e.xFixed===!1&&(t.x=this.canvas._XconvertDOMtoCanvas(this.canvas._XconvertCanvasToDOM(e.x)+r)),e.yFixed===!1&&(t.y=this.canvas._YconvertDOMtoCanvas(this.canvas._YconvertCanvasToDOM(e.y)+i))}),this.body.emitter.emit(`startSimulation`)}else{if(e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent(`dragging`,e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}this.body.selectionBox.position.end={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)},this.body.emitter.emit(`_requestRedraw`)}if(this.options.dragView===!0&&!e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent(`dragging`,e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}let n=t.x-this.drag.pointer.x,r=t.y-this.drag.pointer.y;this.body.view.translation={x:this.drag.translation.x+n,y:this.drag.translation.y+r},this.body.emitter.emit(`_requestRedraw`)}}}onDragEnd(e){if(this.drag.dragging=!1,this.body.selectionBox.show){var t;this.body.selectionBox.show=!1;let n=this.body.selectionBox.position,r={minX:Math.min(n.start.x,n.end.x),minY:Math.min(n.start.y,n.end.y),maxX:Math.max(n.start.x,n.end.x),maxY:Math.max(n.start.y,n.end.y)},i=Ph(t=this.body.nodeIndices).call(t,e=>{let t=this.body.nodes[e];return t.x>=r.minX&&t.x<=r.maxX&&t.y>=r.minY&&t.y<=r.maxY});jp(i).call(i,e=>this.selectionHandler.selectObject(this.body.nodes[e]));let a=this.getPointer(e.center);this.selectionHandler.commitAndEmit(a,e),this.selectionHandler.generateClickEvent(`dragEnd`,e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit(`_requestRedraw`)}else{let t=this.drag.selection;t&&t.length?(jp(t).call(t,function(e){e.node.options.fixed.x=e.xFixed,e.node.options.fixed.y=e.yFixed}),this.selectionHandler.generateClickEvent(`dragEnd`,e,this.getPointer(e.center)),this.body.emitter.emit(`startSimulation`)):(this.selectionHandler.generateClickEvent(`dragEnd`,e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit(`_requestRedraw`))}}onPinch(e){let t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);let n=this.pinch.scale*e.scale;this.zoom(n,t)}zoom(e,t){if(this.options.zoomView===!0){let n=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);let r;this.drag!==void 0&&this.drag.dragging===!0&&(r=this.canvas.DOMtoCanvas(this.drag.pointer));let i=this.body.view.translation,a=e/n,o=(1-a)*t.x+i.x*a,s=(1-a)*t.y+i.y*a;if(this.body.view.scale=e,this.body.view.translation={x:o,y:s},r!=null){let e=this.canvas.canvasToDOM(r);this.drag.pointer.x=e.x,this.drag.pointer.y=e.y}this.body.emitter.emit(`_requestRedraw`),n<e?this.body.emitter.emit(`zoom`,{direction:`+`,scale:this.body.view.scale,pointer:t}):this.body.emitter.emit(`zoom`,{direction:`-`,scale:this.body.view.scale,pointer:t})}}onMouseWheel(e){if(this.options.zoomView===!0){if(e.deltaY!==0){let t=this.body.view.scale;t*=1+(e.deltaY<0?1:-1)*(this.options.zoomSpeed*.1);let n=this.getPointer({x:e.clientX,y:e.clientY});this.zoom(t,n)}e.preventDefault()}}onMouseMove(e){let t=this.getPointer({x:e.clientX,y:e.clientY}),n=!1;this.popup!==void 0&&(this.popup.hidden===!1&&this._checkHidePopup(t),this.popup.hidden===!1&&(n=!0,this.popup.setPosition(t.x+3,t.y-5),this.popup.show())),this.options.keyboard.autoFocus&&this.options.keyboard.bindToWindow===!1&&this.options.keyboard.enabled===!0&&this.canvas.frame.focus(),n===!1&&(this.popupTimer!==void 0&&(clearInterval(this.popupTimer),this.popupTimer=void 0),this.drag.dragging||(this.popupTimer=B_(()=>this._checkShowPopup(t),this.options.tooltipDelay))),this.options.hover===!0&&this.selectionHandler.hoverObject(e,t)}_checkShowPopup(e){let t=this.canvas._XconvertDOMtoCanvas(e.x),n=this.canvas._YconvertDOMtoCanvas(e.y),r={left:t,top:n,right:t,bottom:n},i=this.popupObj===void 0?void 0:this.popupObj.id,a=!1,o=`node`;if(this.popupObj===void 0){let e=this.body.nodeIndices,t=this.body.nodes,n,i=[];for(let o=0;o<e.length;o++)n=t[e[o]],n.isOverlappingWith(r)===!0&&(a=!0,n.getTitle()!==void 0&&i.push(e[o]));i.length>0&&(this.popupObj=t[i[i.length-1]],a=!0)}if(this.popupObj===void 0&&a===!1){let e=this.body.edgeIndices,t=this.body.edges,n,i=[];for(let a=0;a<e.length;a++)n=t[e[a]],n.isOverlappingWith(r)===!0&&n.connected===!0&&n.getTitle()!==void 0&&i.push(e[a]);i.length>0&&(this.popupObj=t[i[i.length-1]],o=`edge`)}this.popupObj===void 0?this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit(`hidePopup`)):this.popupObj.id!==i&&(this.popup===void 0&&(this.popup=new Mx(this.canvas.frame)),this.popup.popupTargetType=o,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit(`showPopup`,this.popupObj.id))}_checkHidePopup(e){let t=this.selectionHandler._pointerToPositionObject(e),n=!1;if(this.popup.popupTargetType===`node`){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(n=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),n===!0)){let t=this.selectionHandler.getNodeAt(e);n=t===void 0?!1:t.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(n=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));n===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit(`hidePopup`))}},EP={},DP={},OP,kP;function AP(){if(kP)return OP;kP=1;var e=I(),t=tC(),n=jS().getWeakData,r=YS(),i=qa(),a=oi(),o=hi(),s=KS(),c=pl(),l=ma(),u=ul(),d=u.set,f=u.getterFor,p=c.find,m=c.findIndex,h=e([].splice),g=0,_=function(e){return e.frozen||=new v},v=function(){this.entries=[]},y=function(e,t){return p(e.entries,function(e){return e[0]===t})};return v.prototype={get:function(e){var t=y(this,e);if(t)return t[1]},has:function(e){return!!y(this,e)},set:function(e,t){var n=y(this,e);n?n[1]=t:this.entries.push([e,t])},delete:function(e){var t=m(this.entries,function(t){return t[0]===e});return~t&&h(this.entries,t,1),!!~t}},OP={getConstructor:function(e,c,u,p){var m=e(function(e,t){r(e,h),d(e,{type:c,id:g++,frozen:null}),a(t)||s(t,e[p],{that:e,AS_ENTRIES:u})}),h=m.prototype,v=f(c),y=function(e,t,r){var a=v(e),o=n(i(t),!0);return o===!0?_(a).set(t,r):o[a.id]=r,e};return t(h,{delete:function(e){var t=v(this);if(!o(e))return!1;var r=n(e);return r===!0?_(t).delete(e):r&&l(r,t.id)&&delete r[t.id]},has:function(e){var t=v(this);if(!o(e))return!1;var r=n(e);return r===!0?_(t).has(e):r&&l(r,t.id)}}),t(h,u?{get:function(e){var t=v(this);if(o(e)){var r=n(e);if(r===!0)return _(t).get(e);if(r)return r[t.id]}},set:function(e,t){return y(this,e,t)}}:{add:function(e){return y(this,e,!0)}}),m}},OP}var jP;function MP(){if(jP)return DP;jP=1;var e=kS(),t=Sr(),n=I(),r=tC(),i=jS(),a=QS(),o=AP(),s=hi(),c=ul().enforce,l=F(),u=sl(),d=Object,f=Array.isArray,p=d.isExtensible,m=d.isFrozen,h=d.isSealed,g=d.freeze,_=d.seal,v=!t.ActiveXObject&&`ActiveXObject`in t,y,b=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},x=a(`WeakMap`,b,o),S=x.prototype,C=n(S.set),w=function(){return e&&l(function(){var e=g([]);return C(new x,e,1),!m(e)})};if(u)if(v){y=o.getConstructor(b,`WeakMap`,!0),i.enable();var T=n(S.delete),E=n(S.has),ee=n(S.get);r(S,{delete:function(e){if(s(e)&&!p(e)){var t=c(this);return t.frozen||=new y,T(this,e)||t.frozen.delete(e)}return T(this,e)},has:function(e){if(s(e)&&!p(e)){var t=c(this);return t.frozen||=new y,E(this,e)||t.frozen.has(e)}return E(this,e)},get:function(e){if(s(e)&&!p(e)){var t=c(this);return t.frozen||=new y,E(this,e)?ee(this,e):t.frozen.get(e)}return ee(this,e)},set:function(e,t){if(s(e)&&!p(e)){var n=c(this);n.frozen||=new y,E(this,e)?C(this,e,t):n.frozen.set(e,t)}else C(this,e,t);return this}})}else w()&&r(S,{set:function(e,t){var n;return f(e)&&(m(e)?n=g:h(e)&&(n=_)),C(this,e,t),n&&n(e),this}});return DP}var NP;function PP(){return NP?EP:(NP=1,MP(),EP)}var FP,IP;function LP(){return IP?FP:(IP=1,yd(),PP(),FP=L().WeakMap,FP)}var RP,zP;function BP(){if(zP)return RP;zP=1;var e=LP();return wd(),RP=e,RP}var VP,HP;function UP(){return HP?VP:(HP=1,VP=BP(),VP)}var WP=P(UP());function GP(e,t,n){KP(e,t),t.set(e,n)}function KP(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function qP(e,t,n){return e.set(YP(e,t),n),n}function JP(e,t){return e.get(YP(e,t))}function YP(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function XP(e,t){let n=new tA;for(let r of t)e.has(r)||n.add(r);return n}var ZP=new WP,QP=new WP,$P=class{constructor(){GP(this,ZP,new tA),GP(this,QP,new tA)}get size(){return JP(QP,this).size}add(){var e=[...arguments];for(let t of e)JP(QP,this).add(t)}delete(){var e=[...arguments];for(let t of e)JP(QP,this).delete(t)}clear(){JP(QP,this).clear()}getSelection(){return[...JP(QP,this)]}getChanges(){return{added:[...XP(JP(ZP,this),JP(QP,this))],deleted:[...XP(JP(QP,this),JP(ZP,this))],previous:[...new tA(JP(ZP,this))],current:[...new tA(JP(QP,this))]}}commit(){let e=this.getChanges();qP(ZP,this,JP(QP,this)),qP(QP,this,new tA(JP(ZP,this)));for(let t of e.added)t.select();for(let t of e.deleted)t.unselect();return e}},eF=new WP,tF=new WP,nF=new WP,rF=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:()=>{};GP(this,eF,new $P),GP(this,tF,new $P),GP(this,nF,void 0),qP(nF,this,e)}get sizeNodes(){return JP(eF,this).size}get sizeEdges(){return JP(tF,this).size}getNodes(){return JP(eF,this).getSelection()}getEdges(){return JP(tF,this).getSelection()}addNodes(){JP(eF,this).add(...arguments)}addEdges(){JP(tF,this).add(...arguments)}deleteNodes(e){JP(eF,this).delete(e)}deleteEdges(e){JP(tF,this).delete(e)}clear(){JP(eF,this).clear(),JP(tF,this).clear()}commit(){let e={nodes:JP(eF,this).commit(),edges:JP(tF,this).commit()};var t=[...arguments];return JP(nF,this).call(this,e,...t),e}},iF=class{constructor(e,t){this.body=e,this.canvas=t,this._selectionAccumulator=new rF,this.hoverObj={nodes:{},edges:{}},this.options={},this.defaultOptions={multiselect:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0},Jo(this.options,this.defaultOptions),this.body.emitter.on(`_dataChanged`,()=>{this.updateSelection()})}setOptions(e){e!==void 0&&Zb([`multiselect`,`hoverConnectedEdges`,`selectable`,`selectConnectedEdges`],this.options,e)}selectOnPoint(e){let t=!1;if(this.options.selectable===!0){let n=this.getNodeAt(e)||this.getEdgeAt(e);this.unselectAll(),n!==void 0&&(t=this.selectObject(n)),this.body.emitter.emit(`_requestRedraw`)}return t}selectAdditionalOnPoint(e){let t=!1;if(this.options.selectable===!0){let n=this.getNodeAt(e)||this.getEdgeAt(e);n!==void 0&&(t=!0,n.isSelected()===!0?this.deselectObject(n):this.selectObject(n),this.body.emitter.emit(`_requestRedraw`))}return t}_initBaseEvent(e,t){let n={};return n.pointer={DOM:{x:t.x,y:t.y},canvas:this.canvas.DOMtoCanvas(t)},n.event=e,n}generateClickEvent(e,t,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,a=this._initBaseEvent(t,n);if(i===!0)a.nodes=[],a.edges=[];else{let e=this.getSelection();a.nodes=e.nodes,a.edges=e.edges}r!==void 0&&(a.previousSelection=r),e==`click`&&(a.items=this.getClickedItems(n)),t.controlEdge!==void 0&&(a.controlEdge=t.controlEdge),this.body.emitter.emit(e,a)}selectObject(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;return e===void 0?!1:(e instanceof uN?(t===!0&&this._selectionAccumulator.addEdges(...e.edges),this._selectionAccumulator.addNodes(e)):this._selectionAccumulator.addEdges(e),!0)}deselectObject(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}_getAllNodesOverlappingWith(e){let t=[],n=this.body.nodes;for(let r=0;r<this.body.nodeIndices.length;r++){let i=this.body.nodeIndices[r];n[i].isOverlappingWith(e)&&t.push(i)}return t}_pointerToPositionObject(e){let t=this.canvas.DOMtoCanvas(e);return{left:t.x-1,top:t.y+1,right:t.x+1,bottom:t.y-1}}getNodeAt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this._pointerToPositionObject(e),r=this._getAllNodesOverlappingWith(n);if(r.length>0)return t===!0?this.body.nodes[r[r.length-1]]:r[r.length-1]}_getEdgesOverlappingWith(e,t){let n=this.body.edges;for(let r=0;r<this.body.edgeIndices.length;r++){let i=this.body.edgeIndices[r];n[i].isOverlappingWith(e)&&t.push(i)}}_getAllEdgesOverlappingWith(e){let t=[];return this._getEdgesOverlappingWith(e,t),t}getEdgeAt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this.canvas.DOMtoCanvas(e),r=10,i=null,a=this.body.edges;for(let e=0;e<this.body.edgeIndices.length;e++){let t=this.body.edgeIndices[e],o=a[t];if(o.connected){let e=o.from.x,a=o.from.y,s=o.to.x,c=o.to.y,l=o.edgeType.getDistanceToEdge(e,a,s,c,n.x,n.y);l<r&&(i=t,r=l)}}if(i!==null)return t===!0?this.body.edges[i]:i}_addToHover(e){e instanceof uN?this.hoverObj.nodes[e.id]=e:this.hoverObj.edges[e.id]=e}_removeFromSelection(e){e instanceof uN?(this._selectionAccumulator.deleteNodes(e),this._selectionAccumulator.deleteEdges(...e.edges)):this._selectionAccumulator.deleteEdges(e)}unselectAll(){this._selectionAccumulator.clear()}getSelectedNodeCount(){return this._selectionAccumulator.sizeNodes}getSelectedEdgeCount(){return this._selectionAccumulator.sizeEdges}_hoverConnectedEdges(e){for(let t=0;t<e.edges.length;t++){let n=e.edges[t];n.hover=!0,this._addToHover(n)}}emitBlurEvent(e,t,n){let r=this._initBaseEvent(e,t);n.hover===!0&&(n.hover=!1,n instanceof uN?(r.node=n.id,this.body.emitter.emit(`blurNode`,r)):(r.edge=n.id,this.body.emitter.emit(`blurEdge`,r)))}emitHoverEvent(e,t,n){let r=this._initBaseEvent(e,t),i=!1;return n.hover===!1&&(n.hover=!0,this._addToHover(n),i=!0,n instanceof uN?(r.node=n.id,this.body.emitter.emit(`hoverNode`,r)):(r.edge=n.id,this.body.emitter.emit(`hoverEdge`,r))),i}hoverObject(e,t){let n=this.getNodeAt(t);n===void 0&&(n=this.getEdgeAt(t));let r=!1;for(let i in this.hoverObj.nodes)Object.prototype.hasOwnProperty.call(this.hoverObj.nodes,i)&&(n===void 0||n instanceof uN&&n.id!=i||n instanceof XN)&&(this.emitBlurEvent(e,t,this.hoverObj.nodes[i]),delete this.hoverObj.nodes[i],r=!0);for(let i in this.hoverObj.edges)Object.prototype.hasOwnProperty.call(this.hoverObj.edges,i)&&(r===!0?(this.hoverObj.edges[i].hover=!1,delete this.hoverObj.edges[i]):(n===void 0||n instanceof XN&&n.id!=i||n instanceof uN&&!n.hover)&&(this.emitBlurEvent(e,t,this.hoverObj.edges[i]),delete this.hoverObj.edges[i],r=!0));if(n!==void 0){let i=Xf(this.hoverObj.edges).length,a=Xf(this.hoverObj.nodes).length,o=n instanceof XN&&i===0&&a===0,s=n instanceof uN&&i===0&&a===0;(r||o||s)&&(r=this.emitHoverEvent(e,t,n)),n instanceof uN&&this.options.hoverConnectedEdges===!0&&this._hoverConnectedEdges(n)}r===!0&&this.body.emitter.emit(`_requestRedraw`)}commitWithoutEmitting(){this._selectionAccumulator.commit()}commitAndEmit(e,t){let n=!1,r=this._selectionAccumulator.commit(),i={nodes:r.nodes.previous,edges:r.edges.previous};r.edges.deleted.length>0&&(this.generateClickEvent(`deselectEdge`,t,e,i),n=!0),r.nodes.deleted.length>0&&(this.generateClickEvent(`deselectNode`,t,e,i),n=!0),r.nodes.added.length>0&&(this.generateClickEvent(`selectNode`,t,e),n=!0),r.edges.added.length>0&&(this.generateClickEvent(`selectEdge`,t,e),n=!0),n===!0&&this.generateClickEvent(`select`,t,e)}getSelection(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}getSelectedNodes(){return this._selectionAccumulator.getNodes()}getSelectedEdges(){return this._selectionAccumulator.getEdges()}getSelectedNodeIds(){var e;return Lf(e=this._selectionAccumulator.getNodes()).call(e,e=>e.id)}getSelectedEdgeIds(){var e;return Lf(e=this._selectionAccumulator.getEdges()).call(e,e=>e.id)}setSelection(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw TypeError(`Selection must be an object with nodes and/or edges properties`);if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes)for(let n of e.nodes){let e=this.body.nodes[n];if(!e)throw RangeError(`Node with id "`+n+`" not found`);this.selectObject(e,t.highlightEdges)}if(e.edges)for(let t of e.edges){let e=this.body.edges[t];if(!e)throw RangeError(`Edge with id "`+t+`" not found`);this.selectObject(e)}this.body.emitter.emit(`_requestRedraw`),this._selectionAccumulator.commit()}selectNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw`Selection must be an array with ids`;this.setSelection({nodes:e},{highlightEdges:t})}selectEdges(e){if(!e||e.length===void 0)throw`Selection must be an array with ids`;this.setSelection({edges:e})}updateSelection(){for(let e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(let e in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,e.id)||this._selectionAccumulator.deleteEdges(e)}getClickedItems(e){let t=this.canvas.DOMtoCanvas(e),n=[],r=this.body.nodeIndices,i=this.body.nodes;for(let e=r.length-1;e>=0;e--){let a=i[r[e]].getItemsOnPoint(t);n.push.apply(n,a)}let a=this.body.edgeIndices,o=this.body.edges;for(let e=a.length-1;e>=0;e--){let r=o[a[e]].getItemsOnPoint(t);n.push.apply(n,r)}return n}},aF=class{abstract(){throw Error(`Can't instantiate abstract class!`)}fake_use(){}curveType(){return this.abstract()}getPosition(e){return this.fake_use(e),this.abstract()}setPosition(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,n),this.abstract()}getTreeSize(e){return this.fake_use(e),this.abstract()}sort(e){this.fake_use(e),this.abstract()}fix(e,t){this.fake_use(e,t),this.abstract()}shift(e,t){this.fake_use(e,t),this.abstract()}},oF=class extends aF{constructor(e){super(),this.layout=e}curveType(){return`horizontal`}getPosition(e){return e.x}setPosition(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;n!==void 0&&this.layout.hierarchical.addToOrdering(e,n),e.x=t}getTreeSize(e){let t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_x,max:t.max_x}}sort(e){JA(e).call(e,function(e,t){return e.x-t.x})}fix(e,t){e.y=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.y=!0}shift(e,t){this.layout.body.nodes[e].x+=t}},sF=class extends aF{constructor(e){super(),this.layout=e}curveType(){return`vertical`}getPosition(e){return e.y}setPosition(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;n!==void 0&&this.layout.hierarchical.addToOrdering(e,n),e.y=t}getTreeSize(e){let t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_y,max:t.max_y}}sort(e){JA(e).call(e,function(e,t){return e.y-t.y})}fix(e,t){e.x=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.x=!0}shift(e,t){this.layout.body.nodes[e].y+=t}},cF={},lF;function uF(){if(lF)return cF;lF=1;var e=R(),t=pl().every;return e({target:`Array`,proto:!0,forced:!pp()(`every`)},{every:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)}}),cF}var dF,fF;function pF(){return fF?dF:(fF=1,uF(),dF=os()(`Array`,`every`),dF)}var mF,hF;function gF(){if(hF)return mF;hF=1;var e=Ci(),t=pF(),n=Array.prototype;return mF=function(r){var i=r.every;return r===n||e(n,r)&&i===n.every?t:i},mF}var _F,vF;function yF(){return vF?_F:(vF=1,_F=gF(),_F)}var bF,xF;function SF(){return xF?bF:(xF=1,bF=yF(),bF)}var CF=P(SF());function wF(e,t){let n=new tA;return jp(e).call(e,e=>{var t;jp(t=e.edges).call(t,e=>{e.connected&&n.add(e)})}),jp(n).call(n,e=>{let n=e.from.id,r=e.to.id;t[n]??(t[n]=0),(t[r]==null||t[n]>=t[r])&&(t[r]=t[n]+1)}),t}function TF(e){return DF(t=>{var n,r;return CF(n=Ph(r=t.edges).call(r,t=>e.has(t.toId))).call(n,e=>e.to===t)},(e,t)=>t>e,`from`,e)}function EF(e){return DF(t=>{var n,r;return CF(n=Ph(r=t.edges).call(r,t=>e.has(t.toId))).call(n,e=>e.from===t)},(e,t)=>t<e,`to`,e)}function DF(e,t,n,r){var i;let a=qg(null),o=XD(i=[...bj(r).call(r)]).call(i,(e,t)=>e+1+t.edges.length,0),s=n+`Id`,c=n===`to`?1:-1;for(let[i,d]of r){if(!r.has(i)||!e(d))continue;a[i]=0;let f=[d],p=0,m;for(;m=f.pop();){var l,u;if(!r.has(i))continue;let e=a[m.id]+c;if(jp(l=Ph(u=m.edges).call(u,e=>e.connected&&e.to!==e.from&&e[n]!==m&&r.has(e.toId)&&r.has(e.fromId))).call(l,r=>{let i=r[s],o=a[i];(o==null||t(e,o))&&(a[i]=e,f.push(r[n]))}),p>o)return wF(r,a);++p}}return a}var OF=class{constructor(){this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}addRelation(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}checkIfTree(){for(let e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}numTrees(){return this.treeIndex+1}setTreeIndex(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}ensureLevel(e){this.levels[e]===void 0&&(this.levels[e]=0)}getMaxLevel(e){let t={},n=e=>{if(t[e]!==void 0)return t[e];let r=this.levels[e];if(this.childrenReference[e]){let t=this.childrenReference[e];if(t.length>0)for(let e=0;e<t.length;e++)r=Math.max(r,n(t[e]))}return t[e]=r,r};return n(e)}levelDownstream(e,t){this.levels[t.id]===void 0&&(this.levels[e.id]===void 0&&(this.levels[e.id]=0),this.levels[t.id]=this.levels[e.id]+1)}setMinLevelToZero(){var e;let t=new IC,n=0,r=JA(e=[...new tA(Xh(this.levels))]).call(e,(e,t)=>e-t);for(let e of r)t.set(e,n++);for(let e in this.levels)Object.prototype.hasOwnProperty.call(this.levels,e)&&(this.levels[e]=t.get(this.levels[e]))}getTreeSize(e,t){let n=1e9,r=-1e9,i=1e9,a=-1e9;for(let o in this.trees)if(Object.prototype.hasOwnProperty.call(this.trees,o)&&this.trees[o]===t){let t=e[o];n=Math.min(t.x,n),r=Math.max(t.x,r),i=Math.min(t.y,i),a=Math.max(t.y,a)}return{min_x:n,max_x:r,min_y:i,max_y:a}}hasSameParent(e,t){let n=this.parentReference[e.id],r=this.parentReference[t.id];if(n===void 0||r===void 0)return!1;for(let e=0;e<n.length;e++)for(let t=0;t<r.length;t++)if(n[e]==r[t])return!0;return!1}inSameSubNetwork(e,t){return this.trees[e.id]===this.trees[t.id]}getLevels(){return Xf(this.distributionOrdering)}addToOrdering(e,t){this.distributionOrdering[t]===void 0&&(this.distributionOrdering[t]=[]);let n=!1,r=this.distributionOrdering[t];for(let t in r)if(r[t]===e){n=!0;break}n||(this.distributionOrdering[t].push(e),this.distributionIndex[e.id]=this.distributionOrdering[t].length-1)}},kF=class{constructor(e){this.body=e,this._resetRNG(Math.random()+`:`+lp()),this.setPhysics=!1,this.options={},this.optionsBackup={physics:{}},this.defaultOptions={randomSeed:void 0,improvedLayout:!0,clusterThreshold:150,hierarchical:{enabled:!1,levelSeparation:150,nodeSpacing:100,treeSpacing:200,blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:`UD`,sortMethod:`hubsize`}},Jo(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){this.body.emitter.on(`_dataChanged`,()=>{this.setupHierarchicalLayout()}),this.body.emitter.on(`_dataLoaded`,()=>{this.layoutNetwork()}),this.body.emitter.on(`_resetHierarchicalLayout`,()=>{this.setupHierarchicalLayout()}),this.body.emitter.on(`_adjustEdgesForHierarchicalLayout`,()=>{if(this.options.hierarchical.enabled!==!0)return;let e=this.direction.curveType();this.body.emitter.emit(`_forceDisableDynamicCurves`,e,!1)})}setOptions(e,t){if(e!==void 0){let n=this.options.hierarchical,r=n.enabled;if(Zb([`randomSeed`,`improvedLayout`,`clusterThreshold`],this.options,e),_x(this.options,e,`hierarchical`),e.randomSeed!==void 0&&this._resetRNG(e.randomSeed),n.enabled===!0)return r===!0&&this.body.emitter.emit(`refresh`,!0),n.direction===`RL`||n.direction===`DU`?n.levelSeparation>0&&(n.levelSeparation*=-1):n.levelSeparation<0&&(n.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit(`_resetHierarchicalLayout`),this.adaptAllOptionsForHierarchicalLayout(t);if(r===!0)return this.body.emitter.emit(`refresh`),$b(t,this.optionsBackup)}return t}_resetRNG(e){this.initialRandomSeed=e,this._rng=Pb(this.initialRandomSeed)}adaptAllOptionsForHierarchicalLayout(e){if(this.options.hierarchical.enabled===!0){let t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:`hierarchicalRepulsion`},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||`barnesHut`):typeof e.physics==`object`?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||`barnesHut`,e.physics.solver=`hierarchicalRepulsion`):e.physics!==!1&&(t.solver=`barnesHut`,e.physics={solver:`hierarchicalRepulsion`});let n=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:`dynamic`}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:`dynamic`}},e.edges.smooth=!1;else if(typeof e.edges.smooth==`boolean`)this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:n};else{let t=e.edges.smooth;t.type!==void 0&&t.type!==`dynamic`&&(n=t.type),this.optionsBackup.edges={smooth:{enabled:t.enabled===void 0?!0:t.enabled,type:t.type===void 0?`dynamic`:t.type,roundness:t.roundness===void 0?.5:t.roundness,forceDirection:t.forceDirection===void 0?!1:t.forceDirection}},e.edges.smooth={enabled:t.enabled===void 0?!0:t.enabled,type:n,roundness:t.roundness===void 0?.5:t.roundness,forceDirection:t.forceDirection===void 0?!1:t.forceDirection}}this.body.emitter.emit(`_forceDisableDynamicCurves`,n)}return e}positionInitially(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);let t=e.length+50;for(let n=0;n<e.length;n++){let r=e[n],i=2*Math.PI*this._rng();r.x===void 0&&(r.x=t*Math.cos(i)),r.y===void 0&&(r.y=t*Math.sin(i))}}}layoutNetwork(){if(this.options.hierarchical.enabled!==!0&&this.options.improvedLayout===!0){let e=this.body.nodeIndices,t=0;for(let n=0;n<e.length;n++)this.body.nodes[e[n]].predefinedPosition===!0&&(t+=1);if(t<.5*e.length){let t=0,n=this.options.clusterThreshold,r={clusterNodeProperties:{shape:`ellipse`,label:``,group:``,font:{multi:!1}},clusterEdgeProperties:{label:``,font:{multi:!1},smooth:{enabled:!1}}};if(e.length>n){let i=e.length;for(;e.length>n&&t<=10;){t+=1;let n=e.length;if(t%3==0?this.body.modules.clustering.clusterBridges(r):this.body.modules.clustering.clusterOutliers(r),n==e.length&&t%3!=0){this._declusterAll(),this.body.emitter.emit(`_layoutFailed`),console.info(`This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.`);return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*i)})}t>10&&console.info(`The clustering didn't succeed within the amount of interations allowed, progressing with partial result.`),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();for(let t=0;t<e.length;t++){let n=this.body.nodes[e[t]];n.predefinedPosition===!1&&(n.x+=(.5-this._rng())*70,n.y+=(.5-this._rng())*70)}this._declusterAll(),this.body.emitter.emit(`_repositionBezierNodes`)}}}_shiftToCenter(){let e=sP.getRangeCore(this.body.nodes,this.body.nodeIndices),t=sP.findCenter(e);for(let e=0;e<this.body.nodeIndices.length;e++){let n=this.body.nodes[this.body.nodeIndices[e]];n.x-=t.x,n.y-=t.y}}_declusterAll(){let e=!0;for(;e===!0;){e=!1;for(let t=0;t<this.body.nodeIndices.length;t++)this.body.nodes[this.body.nodeIndices[t]].isCluster===!0&&(e=!0,this.body.modules.clustering.openCluster(this.body.nodeIndices[t],{},!1));e===!0&&this.body.emitter.emit(`_dataChanged`)}}getSeed(){return this.initialRandomSeed}setupHierarchicalLayout(){if(this.options.hierarchical.enabled===!0&&this.body.nodeIndices.length>0){let e,t,n=!1,r=!1;for(t in this.lastNodeOnLevel={},this.hierarchical=new OF,this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level===void 0?r=!0:(n=!0,this.hierarchical.levels[t]=e.options.level));if(r===!0&&n===!0)throw Error(`To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.`);{if(r===!0){let e=this.options.hierarchical.sortMethod;e===`hubsize`?this._determineLevelsByHubsize():e===`directed`?this._determineLevelsDirected():e===`custom`&&this._determineLevelsCustomCallback()}for(let e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this.hierarchical.ensureLevel(e);let e=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(e),this._condenseHierarchy(),this._shiftToCenter()}}}_condenseHierarchy(){var e=this;let t=!1,n={},r=()=>{let e=a(),t=0;for(let n=0;n<e.length-1;n++){let r=e[n].max-e[n+1].min;t+=r+this.options.hierarchical.treeSpacing,i(n+1,t)}},i=(e,t)=>{let n=this.hierarchical.trees;for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&n[r]===e&&this.direction.shift(r,t)},a=()=>{let e=[];for(let t=0;t<this.hierarchical.numTrees();t++)e.push(this.direction.getTreeSize(t));return e},o=(e,t)=>{if(!t[e.id]&&(t[e.id]=!0,this.hierarchical.childrenReference[e.id])){let n=this.hierarchical.childrenReference[e.id];if(n.length>0)for(let e=0;e<n.length;e++)o(this.body.nodes[n[e]],t)}},s=function(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e9,r=1e9,i=1e9,a=1e9,o=-1e9;for(let s in t)if(Object.prototype.hasOwnProperty.call(t,s)){let c=e.body.nodes[s],l=e.hierarchical.levels[c.id],u=e.direction.getPosition(c),[d,f]=e._getSpaceAroundNode(c,t);r=Math.min(d,r),i=Math.min(f,i),l<=n&&(a=Math.min(u,a),o=Math.max(u,o))}return[a,o,r,i]},c=(e,t)=>{let n=this.hierarchical.getMaxLevel(e.id),r=this.hierarchical.getMaxLevel(t.id);return Math.min(n,r)},l=(e,t,n)=>{let r=this.hierarchical;for(let i=0;i<t.length;i++){let a=t[i],o=r.distributionOrdering[a];if(o.length>1)for(let t=0;t<o.length-1;t++){let i=o[t],a=o[t+1];r.hasSameParent(i,a)&&r.inSameSubNetwork(i,a)&&e(i,a,n)}}},u=function(n,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=e.direction.getPosition(n),l=e.direction.getPosition(r),u=Math.abs(l-a),d=e.options.hierarchical.nodeSpacing;if(u>d){let a={},l={};o(n,a),o(r,l);let u=c(n,r),f=s(a,u),p=s(l,u),m=f[1],h=p[0],g=p[2];if(Math.abs(m-h)>d){let n=m-h+d;n<-g+d&&(n=-g+d),n<0&&(e._shiftBlock(r.id,n),t=!0,i===!0&&e._centerParent(r))}}},d=(e,r)=>{let i=r.id,a=r.edges,c=this.hierarchical.levels[r.id],l=this.options.hierarchical.levelSeparation*this.options.hierarchical.levelSeparation,u={},d=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.toId!=t.fromId){let n=t.toId==i?t.from:t.to;u[a[e].id]=n,this.hierarchical.levels[n.id]<c&&d.push(t)}}let f=(e,t)=>{let n=0;for(let r=0;r<t.length;r++)if(u[t[r].id]!==void 0){let i=this.direction.getPosition(u[t[r].id])-e;n+=i/Math.sqrt(i*i+l)}return n},p=(e,t)=>{let n=0;for(let r=0;r<t.length;r++)if(u[t[r].id]!==void 0){let i=this.direction.getPosition(u[t[r].id])-e;n-=l*(i*i+l)**-1.5}return n},m=(e,t)=>{let n=this.direction.getPosition(r),i={};for(let r=0;r<e;r++){let e=f(n,t),a=p(n,t),o=Math.max(-40,Math.min(40,Math.round(e/a)));if(n-=o,i[n]!==void 0)break;i[n]=r}return n},h=e=>{let i=this.direction.getPosition(r);if(n[r.id]===void 0){let e={};o(r,e),n[r.id]=e}let a=s(n[r.id]),c=a[2],l=a[3],u=e-i,d=0;u>0?d=Math.min(u,l-this.options.hierarchical.nodeSpacing):u<0&&(d=-Math.min(-u,c-this.options.hierarchical.nodeSpacing)),d!=0&&(this._shiftBlock(r.id,d),t=!0)},g=e=>{let n=this.direction.getPosition(r),[i,a]=this._getSpaceAroundNode(r),o=e-n,s=n;o>0?s=Math.min(n+(a-this.options.hierarchical.nodeSpacing),e):o<0&&(s=Math.max(n-(i-this.options.hierarchical.nodeSpacing),e)),s!==n&&(this.direction.setPosition(r,s),t=!0)},_=m(e,d);h(_),_=m(e,a),g(_)};this.options.hierarchical.blockShifting===!0&&((e=>{let n=this.hierarchical.getLevels();n=qp(n).call(n);for(let r=0;r<e&&(t=!1,l(u,n,!0),t===!0);r++);})(5),(()=>{for(let e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this._centerParent(this.body.nodes[e])})()),this.options.hierarchical.edgeMinimization===!0&&(e=>{let n=this.hierarchical.getLevels();n=qp(n).call(n);for(let r=0;r<e;r++){t=!1;for(let e=0;e<n.length;e++){let t=n[e],r=this.hierarchical.distributionOrdering[t];for(let e=0;e<r.length;e++)d(1e3,r[e])}if(t!==!0)break}})(20),this.options.hierarchical.parentCentralization===!0&&(()=>{let e=this.hierarchical.getLevels();e=qp(e).call(e);for(let t=0;t<e.length;t++){let n=e[t],r=this.hierarchical.distributionOrdering[n];for(let e=0;e<r.length;e++)this._centerParent(r[e])}})(),r()}_getSpaceAroundNode(e,t){let n=!0;t===void 0&&(n=!1);let r=this.hierarchical.levels[e.id];if(r!==void 0){let i=this.hierarchical.distributionIndex[e.id],a=this.direction.getPosition(e),o=this.hierarchical.distributionOrdering[r],s=1e9,c=1e9;if(i!==0){let e=o[i-1];(n===!0&&t[e.id]===void 0||n===!1)&&(s=a-this.direction.getPosition(e))}if(i!=o.length-1){let e=o[i+1];if(n===!0&&t[e.id]===void 0||n===!1){let t=this.direction.getPosition(e);c=Math.min(c,t-a)}}return[s,c]}else return[0,0]}_centerParent(e){if(this.hierarchical.parentReference[e.id]){let t=this.hierarchical.parentReference[e.id];for(let e=0;e<t.length;e++){let n=t[e],r=this.body.nodes[n],i=this.hierarchical.childrenReference[n];if(i!==void 0){let e=this._getCenterPosition(i),t=this.direction.getPosition(r),[n,a]=this._getSpaceAroundNode(r),o=t-e;(o<0&&Math.abs(o)<a-this.options.hierarchical.nodeSpacing||o>0&&Math.abs(o)<n-this.options.hierarchical.nodeSpacing)&&this.direction.setPosition(r,e)}}}}_placeNodesByHierarchy(e){this.positionedNodes={};for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var t;let r=Xf(e[n]);r=this._indexArrayToNodes(r),JA(t=this.direction).call(t,r);let i=0;for(let e=0;e<r.length;e++){let t=r[e];if(this.positionedNodes[t.id]===void 0){let a=this.options.hierarchical.nodeSpacing,o=a*i;i>0&&(o=this.direction.getPosition(r[e-1])+a),this.direction.setPosition(t,o,n),this._validatePositionAndContinue(t,n,o),i++}}}}_placeBranchNodes(e,t){var n;let r=this.hierarchical.childrenReference[e];if(r===void 0)return;let i=[];for(let e=0;e<r.length;e++)i.push(this.body.nodes[r[e]]);JA(n=this.direction).call(n,i);for(let n=0;n<i.length;n++){let r=i[n],a=this.hierarchical.levels[r.id];if(a>t&&this.positionedNodes[r.id]===void 0){let t=this.options.hierarchical.nodeSpacing,o;o=n===0?this.direction.getPosition(this.body.nodes[e]):this.direction.getPosition(i[n-1])+t,this.direction.setPosition(r,o,a),this._validatePositionAndContinue(r,a,o)}else return}let a=this._getCenterPosition(i);this.direction.setPosition(this.body.nodes[e],a,t)}_validatePositionAndContinue(e,t,n){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){let r=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(n-r<this.options.hierarchical.nodeSpacing){let i=r+this.options.hierarchical.nodeSpacing-n,a=this._findCommonParent(this.lastNodeOnLevel[t],e.id);this._shiftBlock(a.withChild,i)}}this.lastNodeOnLevel[t]=e.id,this.positionedNodes[e.id]=!0,this._placeBranchNodes(e.id,t)}}_indexArrayToNodes(e){let t=[];for(let n=0;n<e.length;n++)t.push(this.body.nodes[e[n]]);return t}_getDistribution(){let e={},t,n;for(t in this.body.nodes)if(Object.prototype.hasOwnProperty.call(this.body.nodes,t)){n=this.body.nodes[t];let r=this.hierarchical.levels[t]===void 0?0:this.hierarchical.levels[t];this.direction.fix(n,r),e[r]===void 0&&(e[r]={}),e[r][t]=n}return e}_getActiveEdges(e){let t=[];return ix(e.edges,e=>{var n;Pg(n=this.body.edgeIndices).call(n,e.id)!==-1&&t.push(e)}),t}_getHubSizes(){let e={},t=this.body.nodeIndices;ix(t,t=>{let n=this.body.nodes[t],r=this._getActiveEdges(n).length;e[r]=!0});let n=[];return ix(e,e=>{n.push(Number(e))}),JA(n).call(n,function(e,t){return t-e}),n}_determineLevelsByHubsize(){let e=(e,t)=>{this.hierarchical.levelDownstream(e,t)},t=this._getHubSizes();for(let n=0;n<t.length;++n){let r=t[n];if(r===0)break;ix(this.body.nodeIndices,t=>{let n=this.body.nodes[t];r===this._getActiveEdges(n).length&&this._crawlNetwork(e,t)})}}_determineLevelsCustomCallback(){this._crawlNetwork((e,t,n)=>{let r=this.hierarchical.levels[e.id];r===void 0&&(r=this.hierarchical.levels[e.id]=1e5),sP.cloneOptions(e,`node`),sP.cloneOptions(t,`node`),sP.cloneOptions(n,`edge`),this.hierarchical.levels[t.id]=r+void 0}),this.hierarchical.setMinLevelToZero()}_determineLevelsDirected(){var e;let t=XD(e=this.body.nodeIndices).call(e,(e,t)=>(e.set(t,this.body.nodes[t]),e),new IC);this.options.hierarchical.shakeTowards===`roots`?this.hierarchical.levels=EF(t):this.hierarchical.levels=TF(t),this.hierarchical.setMinLevelToZero()}_generateMap(){this._crawlNetwork((e,t)=>{this.hierarchical.levels[t.id]>this.hierarchical.levels[e.id]&&this.hierarchical.addRelation(e.id,t.id)}),this.hierarchical.checkIfTree()}_crawlNetwork(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},t=arguments.length>1?arguments[1]:void 0,n={},r=(t,i)=>{if(n[t.id]===void 0){this.hierarchical.setTreeIndex(t,i),n[t.id]=!0;let a,o=this._getActiveEdges(t);for(let n=0;n<o.length;n++){let s=o[n];s.connected===!0&&(a=s.toId==t.id?s.from:s.to,t.id!=a.id&&(e(t,a,s),r(a,i)))}}};if(t===void 0){let e=0;for(let t=0;t<this.body.nodeIndices.length;t++){let i=this.body.nodeIndices[t];if(n[i]===void 0){let t=this.body.nodes[i];r(t,e),e+=1}}}else{let e=this.body.nodes[t];if(e===void 0){console.error(`Node not found:`,t);return}r(e)}}_shiftBlock(e,t){let n={},r=e=>{if(n[e])return;n[e]=!0,this.direction.shift(e,t);let i=this.hierarchical.childrenReference[e];if(i!==void 0)for(let e=0;e<i.length;e++)r(i[e])};r(e)}_findCommonParent(e,t){let n={},r=(e,t)=>{let n=this.hierarchical.parentReference[t];if(n!==void 0)for(let t=0;t<n.length;t++){let i=n[t];e[i]=!0,r(e,i)}},i=(e,t)=>{let n=this.hierarchical.parentReference[t];if(n!==void 0)for(let r=0;r<n.length;r++){let a=n[r];if(e[a]!==void 0)return{foundParent:a,withChild:t};let o=i(e,a);if(o.foundParent!==null)return o}return{foundParent:null,withChild:t}};return r(n,e),i(n,t)}setDirectionStrategy(){this.options.hierarchical.direction===`UD`||this.options.hierarchical.direction===`DU`?this.direction=new oF(this):this.direction=new sF(this)}_getCenterPosition(e){let t=1e9,n=-1e9;for(let r=0;r<e.length;r++){let i;if(e[r].id!==void 0)i=e[r];else{let t=e[r];i=this.body.nodes[t]}let a=this.direction.getPosition(i);t=Math.min(t,a),n=Math.max(n,a)}return .5*(t+n)}},AF=class{constructor(e,t,n,r){var i,a;this.body=e,this.canvas=t,this.selectionHandler=n,this.interactionHandler=r,this.editMode=!1,this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0,this._domEventListenerCleanupQueue=[],this.temporaryUIFunctions={},this.temporaryEventFunctions=[],this.touchTime=0,this.temporaryIds={nodes:[],edges:[]},this.guiEnabled=!1,this.inMode=!1,this.selectedControlNode=void 0,this.options={},this.defaultOptions={enabled:!1,initiallyActive:!1,addNode:!0,addEdge:!0,editNode:void 0,editEdge:!0,deleteNode:!0,deleteEdge:!0,controlNodeStyle:{shape:`dot`,size:6,color:{background:`#ff0000`,border:`#3c3c3c`,highlight:{background:`#07f968`,border:`#3c3c3c`}},borderWidth:2,borderWidthSelected:2}},Jo(this.options,this.defaultOptions),this.body.emitter.on(`destroy`,()=>{this._clean()}),this.body.emitter.on(`_dataChanged`,B(i=this._restore).call(i,this)),this.body.emitter.on(`_resetData`,B(a=this._restore).call(a,this))}_restore(){this.inMode!==!1&&(this.options.initiallyActive===!0?this.enableEditMode():this.disableEditMode())}setOptions(e,t,n){t!==void 0&&(t.locale===void 0?this.options.locale=n.locale:this.options.locale=t.locale,t.locales===void 0?this.options.locales=n.locales:this.options.locales=t.locales),e!==void 0&&(typeof e==`boolean`?this.options.enabled=e:(this.options.enabled=!0,$b(this.options,e)),this.options.initiallyActive===!0&&(this.editMode=!0),this._setup())}toggleEditMode(){this.editMode===!0?this.disableEditMode():this.enableEditMode()}enableEditMode(){this.editMode=!0,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display=`block`,this.closeDiv.style.display=`block`,this.editModeDiv.style.display=`none`,this.showManipulatorToolbar())}disableEditMode(){this.editMode=!1,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display=`none`,this.closeDiv.style.display=`none`,this.editModeDiv.style.display=`block`,this._createEditButton())}showManipulatorToolbar(){if(this._clean(),this.manipulationDOM={},this.guiEnabled===!0){var e,t;this.editMode=!0,this.manipulationDiv.style.display=`block`,this.closeDiv.style.display=`block`;let n=this.selectionHandler.getSelectedNodeCount(),r=this.selectionHandler.getSelectedEdgeCount(),i=n+r,a=this.options.locales[this.options.locale],o=!1;this.options.addNode!==!1&&(this._createAddNodeButton(a),o=!0),this.options.addEdge!==!1&&(o===!0?this._createSeperator(1):o=!0,this._createAddEdgeButton(a)),n===1&&typeof this.options.editNode==`function`?(o===!0?this._createSeperator(2):o=!0,this._createEditNodeButton(a)):r===1&&n===0&&this.options.editEdge!==!1&&(o===!0?this._createSeperator(3):o=!0,this._createEditEdgeButton(a)),i!==0&&(n>0&&this.options.deleteNode!==!1||n===0&&this.options.deleteEdge!==!1)&&(o===!0&&this._createSeperator(4),this._createDeleteButton(a)),this._bindElementEvents(this.closeDiv,B(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent(`select`,B(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit(`_redraw`)}addNodeMode(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode=`addNode`,this.guiEnabled===!0){var t;let e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,B(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent(`click`,B(e=this._performAddNode).call(e,this))}editNode(){this.editMode!==!0&&this.enableEditMode(),this._clean();let e=this.selectionHandler.getSelectedNodes()[0];if(e!==void 0)if(this.inMode=`editNode`,typeof this.options.editNode==`function`)if(e.isCluster!==!0){let t=$b({},e.options,!1);if(t.x=e.x,t.y=e.y,this.options.editNode.length===2)this.options.editNode(t,e=>{e!=null&&this.inMode===`editNode`&&this.body.data.nodes.getDataSet().update(e),this.showManipulatorToolbar()});else throw Error(`The function for edit does not support two arguments (data, callback)`)}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw Error(`No function has been configured to handle the editing of nodes.`);else this.showManipulatorToolbar()}addEdgeMode(){var e,t,n,r,i;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode=`addEdge`,this.guiEnabled===!0){var a;let e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,B(a=this.toggleEditMode).call(a,this))}this._temporaryBindUI(`onTouch`,B(e=this._handleConnect).call(e,this)),this._temporaryBindUI(`onDragEnd`,B(t=this._finishConnect).call(t,this)),this._temporaryBindUI(`onDrag`,B(n=this._dragControlNode).call(n,this)),this._temporaryBindUI(`onRelease`,B(r=this._finishConnect).call(r,this)),this._temporaryBindUI(`onDragStart`,B(i=this._dragStartEdge).call(i,this)),this._temporaryBindUI(`onHold`,()=>{})}editEdgeMode(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode=`editEdge`,typeof this.options.editEdge==`object`&&typeof this.options.editEdge.editWithoutDrag==`function`&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){let e=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(e.from.id,e.to.id);return}if(this.guiEnabled===!0){var e;let t=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(t),this._createSeperator(),this._createDescription(t.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,B(e=this.toggleEditMode).call(e,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var t,n,r,i;let e=this.body.edges[this.edgeBeingEditedId],a=this._getNewTargetNode(e.from.x,e.from.y),o=this._getNewTargetNode(e.to.x,e.to.y);this.temporaryIds.nodes.push(a.id),this.temporaryIds.nodes.push(o.id),this.body.nodes[a.id]=a,this.body.nodeIndices.push(a.id),this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id),this._temporaryBindUI(`onTouch`,B(t=this._controlNodeTouch).call(t,this)),this._temporaryBindUI(`onTap`,()=>{}),this._temporaryBindUI(`onHold`,()=>{}),this._temporaryBindUI(`onDragStart`,B(n=this._controlNodeDragStart).call(n,this)),this._temporaryBindUI(`onDrag`,B(r=this._controlNodeDrag).call(r,this)),this._temporaryBindUI(`onDragEnd`,B(i=this._controlNodeDragEnd).call(i,this)),this._temporaryBindUI(`onMouseMove`,()=>{}),this._temporaryBindEvent(`beforeDrawing`,t=>{let n=e.edgeType.findBorderPositions(t);a.selected===!1&&(a.x=n.from.x,a.y=n.from.y),o.selected===!1&&(o.x=n.to.x,o.y=n.to.y)}),this.body.emitter.emit(`_redraw`)}else this.showManipulatorToolbar()}deleteSelected(){this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode=`delete`;let e=this.selectionHandler.getSelectedNodeIds(),t=this.selectionHandler.getSelectedEdgeIds(),n;if(e.length>0){for(let t=0;t<e.length;t++)if(this.body.nodes[e[t]].isCluster===!0){alert(this.options.locales[this.options.locale].deleteClusterError||this.options.locales.en.deleteClusterError);return}typeof this.options.deleteNode==`function`&&(n=this.options.deleteNode)}else t.length>0&&typeof this.options.deleteEdge==`function`&&(n=this.options.deleteEdge);if(typeof n==`function`){let r={nodes:e,edges:t};if(n.length===2)n(r,e=>{e!=null&&this.inMode===`delete`?(this.body.data.edges.getDataSet().remove(e.edges),this.body.data.nodes.getDataSet().remove(e.nodes),this.body.emitter.emit(`startSimulation`),this.showManipulatorToolbar()):(this.body.emitter.emit(`startSimulation`),this.showManipulatorToolbar())});else throw Error(`The function for delete does not support two arguments (data, callback)`)}else this.body.data.edges.getDataSet().remove(t),this.body.data.nodes.getDataSet().remove(e),this.body.emitter.emit(`startSimulation`),this.showManipulatorToolbar()}_setup(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}_createWrappers(){this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement(`div`),this.manipulationDiv.className=`vis-manipulation`,this.editMode===!0?this.manipulationDiv.style.display=`block`:this.manipulationDiv.style.display=`none`,this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement(`div`),this.editModeDiv.className=`vis-edit-mode`,this.editMode===!0?this.editModeDiv.style.display=`none`:this.editModeDiv.style.display=`block`,this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0&&(this.closeDiv=document.createElement(`button`),this.closeDiv.className=`vis-close`,this.closeDiv.setAttribute(`aria-label`,this.options.locales[this.options.locale]?.close??this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv))}_getNewTargetNode(e,t){let n=$b({},this.options.controlNodeStyle);n.id=`targetNode`+Gj(),n.hidden=!1,n.physics=!1,n.x=e,n.y=t;let r=this.body.functions.createNode(n);return r.shape.boundingBox={left:e,right:e,top:t,bottom:t},r}_createEditButton(){var e;this._clean(),this.manipulationDOM={},Kb(this.editModeDiv);let t=this.options.locales[this.options.locale],n=this._createButton(`editMode`,`vis-edit vis-edit-mode`,t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(n),this._bindElementEvents(n,B(e=this.toggleEditMode).call(e,this))}_clean(){this.inMode=!1,this.guiEnabled===!0&&(Kb(this.editModeDiv),Kb(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit(`restorePhysics`)}_cleanupDOMEventListeners(){for(let t of hm(e=this._domEventListenerCleanupQueue).call(e,0)){var e;t()}}_removeManipulationDOM(){this._clean(),Kb(this.manipulationDiv),Kb(this.editModeDiv),Kb(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}_createSeperator(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM[`seperatorLineDiv`+e]=document.createElement(`div`),this.manipulationDOM[`seperatorLineDiv`+e].className=`vis-separator-line`,this.manipulationDiv.appendChild(this.manipulationDOM[`seperatorLineDiv`+e])}_createAddNodeButton(e){var t;let n=this._createButton(`addNode`,`vis-add`,e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,B(t=this.addNodeMode).call(t,this))}_createAddEdgeButton(e){var t;let n=this._createButton(`addEdge`,`vis-connect`,e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,B(t=this.addEdgeMode).call(t,this))}_createEditNodeButton(e){var t;let n=this._createButton(`editNode`,`vis-edit`,e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,B(t=this.editNode).call(t,this))}_createEditEdgeButton(e){var t;let n=this._createButton(`editEdge`,`vis-edit`,e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,B(t=this.editEdgeMode).call(t,this))}_createDeleteButton(e){var t;let n;n=this.options.rtl?`vis-delete-rtl`:`vis-delete`;let r=this._createButton(`delete`,n,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(r),this._bindElementEvents(r,B(t=this.deleteSelected).call(t,this))}_createBackButton(e){var t;let n=this._createButton(`back`,`vis-back`,e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,B(t=this.showManipulatorToolbar).call(t,this))}_createButton(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`vis-label`;return this.manipulationDOM[e+`Div`]=document.createElement(`button`),this.manipulationDOM[e+`Div`].className=`vis-button `+t,this.manipulationDOM[e+`Label`]=document.createElement(`div`),this.manipulationDOM[e+`Label`].className=r,this.manipulationDOM[e+`Label`].innerText=n,this.manipulationDOM[e+`Div`].appendChild(this.manipulationDOM[e+`Label`]),this.manipulationDOM[e+`Div`]}_createDescription(e){this.manipulationDOM.descriptionLabel=document.createElement(`div`),this.manipulationDOM.descriptionLabel.className=`vis-none`,this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}_temporaryBindEvent(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}_temporaryBindUI(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw Error(`This UI function does not exist. Typo? You tried: `+e+` possible are: `+h_(Xf(this.body.eventListeners)))}_unbindTemporaryUIs(){for(let e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}_unbindTemporaryEvents(){for(let e=0;e<this.temporaryEventFunctions.length;e++){let t=this.temporaryEventFunctions[e].event,n=this.temporaryEventFunctions[e].boundFunction;this.body.emitter.off(t,n)}this.temporaryEventFunctions=[]}_bindElementEvents(e,t){let n=new jx(e,{});vP(n,t),this._domEventListenerCleanupQueue.push(()=>{n.destroy()});let r=e=>{let{keyCode:n,key:r}=e;(r===`Enter`||r===` `||n===13||n===32)&&t()};e.addEventListener(`keyup`,r,!1),this._domEventListenerCleanupQueue.push(()=>{e.removeEventListener(`keyup`,r,!1)})}_cleanupTemporaryNodesAndEdges(){for(let n=0;n<this.temporaryIds.edges.length;n++){var e;this.body.edges[this.temporaryIds.edges[n]].disconnect(),delete this.body.edges[this.temporaryIds.edges[n]];let r=Pg(e=this.body.edgeIndices).call(e,this.temporaryIds.edges[n]);if(r!==-1){var t;hm(t=this.body.edgeIndices).call(t,r,1)}}for(let e=0;e<this.temporaryIds.nodes.length;e++){var n;delete this.body.nodes[this.temporaryIds.nodes[e]];let t=Pg(n=this.body.nodeIndices).call(n,this.temporaryIds.nodes[e]);if(t!==-1){var r;hm(r=this.body.nodeIndices).call(r,t,1)}}this.temporaryIds={nodes:[],edges:[]}}_controlNodeTouch(e){this.selectionHandler.unselectAll(),this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Jo({},this.body.view.translation)}_controlNodeDragStart(){let e=this.lastTouch,t=this.selectionHandler._pointerToPositionObject(e),n=this.body.nodes[this.temporaryIds.nodes[0]],r=this.body.nodes[this.temporaryIds.nodes[1]],i=this.body.edges[this.edgeBeingEditedId];this.selectedControlNode=void 0;let a=n.isOverlappingWith(t),o=r.isOverlappingWith(t);a===!0?(this.selectedControlNode=n,i.edgeType.from=n):o===!0&&(this.selectedControlNode=r,i.edgeType.to=r),this.selectedControlNode!==void 0&&this.selectionHandler.selectObject(this.selectedControlNode),this.body.emitter.emit(`_redraw`)}_controlNodeDrag(e){this.body.emitter.emit(`disablePhysics`);let t=this.body.functions.getPointer(e.center),n=this.canvas.DOMtoCanvas(t);this.selectedControlNode===void 0?this.interactionHandler.onDrag(e):(this.selectedControlNode.x=n.x,this.selectedControlNode.y=n.y),this.body.emitter.emit(`_redraw`)}_controlNodeDragEnd(e){let t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),r=this.body.edges[this.edgeBeingEditedId];if(this.selectedControlNode===void 0)return;this.selectionHandler.unselectAll();let i=this.selectionHandler._getAllNodesOverlappingWith(n),a;for(let e=i.length-1;e>=0;e--)if(i[e]!==this.selectedControlNode.id){a=this.body.nodes[i[e]];break}if(a!==void 0&&this.selectedControlNode!==void 0)if(a.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{let e=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===e.id?this._performEditEdge(a.id,r.to.id):this._performEditEdge(r.from.id,a.id)}else r.updateEdgeType(),this.body.emitter.emit(`restorePhysics`);this.body.emitter.emit(`_redraw`)}_handleConnect(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Jo({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;let t=this.lastTouch,n=this.selectionHandler.getNodeAt(t);if(n!==void 0)if(n.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{let e=this._getNewTargetNode(n.x,n.y);this.body.nodes[e.id]=e,this.body.nodeIndices.push(e.id);let t=this.body.functions.createEdge({id:`connectionEdge`+Gj(),from:n.id,to:e.id,physics:!1,smooth:{enabled:!0,type:`continuous`,roundness:.5}});this.body.edges[t.id]=t,this.body.edgeIndices.push(t.id),this.temporaryIds.nodes.push(e.id),this.temporaryIds.edges.push(t.id)}this.touchTime=new Date().valueOf()}}_dragControlNode(e){let t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),r;this.temporaryIds.edges[0]!==void 0&&(r=this.body.edges[this.temporaryIds.edges[0]].fromId);let i=this.selectionHandler._getAllNodesOverlappingWith(n),a;for(let e=i.length-1;e>=0;e--){var o;if(Pg(o=this.temporaryIds.nodes).call(o,i[e])===-1){a=this.body.nodes[i[e]];break}}if(e.controlEdge={from:r,to:a?a.id:void 0},this.selectionHandler.generateClickEvent(`controlNodeDragging`,e,t),this.temporaryIds.nodes[0]!==void 0){let e=this.body.nodes[this.temporaryIds.nodes[0]];e.x=this.canvas._XconvertDOMtoCanvas(t.x),e.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit(`_redraw`)}else this.interactionHandler.onDrag(e)}_finishConnect(e){let t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),r;this.temporaryIds.edges[0]!==void 0&&(r=this.body.edges[this.temporaryIds.edges[0]].fromId);let i=this.selectionHandler._getAllNodesOverlappingWith(n),a;for(let e=i.length-1;e>=0;e--){var o;if(Pg(o=this.temporaryIds.nodes).call(o,i[e])===-1){a=this.body.nodes[i[e]];break}}this._cleanupTemporaryNodesAndEdges(),a!==void 0&&(a.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[r]!==void 0&&this.body.nodes[a.id]!==void 0&&this._performAddEdge(r,a.id)),e.controlEdge={from:r,to:a?a.id:void 0},this.selectionHandler.generateClickEvent(`controlNodeDragEnd`,e,t),this.body.emitter.emit(`_redraw`)}_dragStartEdge(e){let t=this.lastTouch;this.selectionHandler.generateClickEvent(`dragStart`,e,t,void 0,!0)}_performAddNode(e){let t={id:Gj(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:`new`};if(typeof this.options.addNode==`function`)if(this.options.addNode.length===2)this.options.addNode(t,e=>{e!=null&&this.inMode===`addNode`&&this.body.data.nodes.getDataSet().add(e),this.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),Error(`The function for add does not support two arguments (data,callback)`);else this.body.data.nodes.getDataSet().add(t),this.showManipulatorToolbar()}_performAddEdge(e,t){let n={from:e,to:t};if(typeof this.options.addEdge==`function`)if(this.options.addEdge.length===2)this.options.addEdge(n,e=>{e!=null&&this.inMode===`addEdge`&&(this.body.data.edges.getDataSet().add(e),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw Error(`The function for connect does not support two arguments (data,callback)`);else this.body.data.edges.getDataSet().add(n),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}_performEditEdge(e,t){let n={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label},r=this.options.editEdge;if(typeof r==`object`&&(r=r.editWithoutDrag),typeof r==`function`)if(r.length===2)r(n,e=>{e==null||this.inMode!==`editEdge`?(this.body.edges[n.id].updateEdgeType(),this.body.emitter.emit(`_redraw`),this.showManipulatorToolbar()):(this.body.data.edges.getDataSet().update(e),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw Error(`The function for edit does not support two arguments (data, callback)`);else this.body.data.edges.getDataSet().update(n),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},q=`string`,J=`boolean`,Y=`number`,jF=`array`,X=`object`,MF=`dom`,NF=`any`,PF=[`arrow`,`bar`,`box`,`circle`,`crow`,`curve`,`diamond`,`image`,`inv_curve`,`inv_triangle`,`triangle`,`vee`],FF={borderWidth:{number:Y},borderWidthSelected:{number:Y,undefined:`undefined`},brokenImage:{string:q,undefined:`undefined`},chosen:{label:{boolean:J,function:`function`},node:{boolean:J,function:`function`},__type__:{object:X,boolean:J}},color:{border:{string:q},background:{string:q},highlight:{border:{string:q},background:{string:q},__type__:{object:X,string:q}},hover:{border:{string:q},background:{string:q},__type__:{object:X,string:q}},__type__:{object:X,string:q}},opacity:{number:Y,undefined:`undefined`},fixed:{x:{boolean:J},y:{boolean:J},__type__:{object:X,boolean:J}},font:{align:{string:q},color:{string:q},size:{number:Y},face:{string:q},background:{string:q},strokeWidth:{number:Y},strokeColor:{string:q},vadjust:{number:Y},multi:{boolean:J,string:q},bold:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},boldital:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},ital:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},mono:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},__type__:{object:X,string:q}},group:{string:q,number:Y,undefined:`undefined`},heightConstraint:{minimum:{number:Y},valign:{string:q},__type__:{object:X,boolean:J,number:Y}},hidden:{boolean:J},icon:{face:{string:q},code:{string:q},size:{number:Y},color:{string:q},weight:{string:q,number:Y},__type__:{object:X}},id:{string:q,number:Y},image:{selected:{string:q,undefined:`undefined`},unselected:{string:q,undefined:`undefined`},__type__:{object:X,string:q}},imagePadding:{top:{number:Y},right:{number:Y},bottom:{number:Y},left:{number:Y},__type__:{object:X,number:Y}},label:{string:q,undefined:`undefined`},labelHighlightBold:{boolean:J},level:{number:Y,undefined:`undefined`},margin:{top:{number:Y},right:{number:Y},bottom:{number:Y},left:{number:Y},__type__:{object:X,number:Y}},mass:{number:Y},physics:{boolean:J},scaling:{min:{number:Y},max:{number:Y},label:{enabled:{boolean:J},min:{number:Y},max:{number:Y},maxVisible:{number:Y},drawThreshold:{number:Y},__type__:{object:X,boolean:J}},customScalingFunction:{function:`function`},__type__:{object:X}},shadow:{enabled:{boolean:J},color:{string:q},size:{number:Y},x:{number:Y},y:{number:Y},__type__:{object:X,boolean:J}},shape:{string:[`custom`,`ellipse`,`circle`,`database`,`box`,`text`,`image`,`circularImage`,`diamond`,`dot`,`star`,`triangle`,`triangleDown`,`square`,`icon`,`hexagon`]},ctxRenderer:{function:`function`},shapeProperties:{borderDashes:{boolean:J,array:jF},borderRadius:{number:Y},interpolation:{boolean:J},useImageSize:{boolean:J},useBorderWithImage:{boolean:J},coordinateOrigin:{string:[`center`,`top-left`]},__type__:{object:X}},size:{number:Y},title:{string:q,dom:MF,undefined:`undefined`},value:{number:Y,undefined:`undefined`},widthConstraint:{minimum:{number:Y},maximum:{number:Y},__type__:{object:X,boolean:J,number:Y}},x:{number:Y},y:{number:Y},__type__:{object:X}},IF={configure:{enabled:{boolean:J},filter:{boolean:J,string:q,array:jF,function:`function`},container:{dom:MF},showButton:{boolean:J},__type__:{object:X,boolean:J,string:q,array:jF,function:`function`}},edges:{arrows:{to:{enabled:{boolean:J},scaleFactor:{number:Y},type:{string:PF},imageHeight:{number:Y},imageWidth:{number:Y},src:{string:q},__type__:{object:X,boolean:J}},middle:{enabled:{boolean:J},scaleFactor:{number:Y},type:{string:PF},imageWidth:{number:Y},imageHeight:{number:Y},src:{string:q},__type__:{object:X,boolean:J}},from:{enabled:{boolean:J},scaleFactor:{number:Y},type:{string:PF},imageWidth:{number:Y},imageHeight:{number:Y},src:{string:q},__type__:{object:X,boolean:J}},__type__:{string:[`from`,`to`,`middle`],object:X}},endPointOffset:{from:{number:Y},to:{number:Y},__type__:{object:X,number:Y}},arrowStrikethrough:{boolean:J},background:{enabled:{boolean:J},color:{string:q},size:{number:Y},dashes:{boolean:J,array:jF},__type__:{object:X,boolean:J}},chosen:{label:{boolean:J,function:`function`},edge:{boolean:J,function:`function`},__type__:{object:X,boolean:J}},color:{color:{string:q},highlight:{string:q},hover:{string:q},inherit:{string:[`from`,`to`,`both`],boolean:J},opacity:{number:Y},__type__:{object:X,string:q}},dashes:{boolean:J,array:jF},font:{color:{string:q},size:{number:Y},face:{string:q},background:{string:q},strokeWidth:{number:Y},strokeColor:{string:q},align:{string:[`horizontal`,`top`,`middle`,`bottom`]},vadjust:{number:Y},multi:{boolean:J,string:q},bold:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},boldital:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},ital:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},mono:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},__type__:{object:X,string:q}},hidden:{boolean:J},hoverWidth:{function:`function`,number:Y},label:{string:q,undefined:`undefined`},labelHighlightBold:{boolean:J},length:{number:Y,undefined:`undefined`},physics:{boolean:J},scaling:{min:{number:Y},max:{number:Y},label:{enabled:{boolean:J},min:{number:Y},max:{number:Y},maxVisible:{number:Y},drawThreshold:{number:Y},__type__:{object:X,boolean:J}},customScalingFunction:{function:`function`},__type__:{object:X}},selectionWidth:{function:`function`,number:Y},selfReferenceSize:{number:Y},selfReference:{size:{number:Y},angle:{number:Y},renderBehindTheNode:{boolean:J},__type__:{object:X}},shadow:{enabled:{boolean:J},color:{string:q},size:{number:Y},x:{number:Y},y:{number:Y},__type__:{object:X,boolean:J}},smooth:{enabled:{boolean:J},type:{string:[`dynamic`,`continuous`,`discrete`,`diagonalCross`,`straightCross`,`horizontal`,`vertical`,`curvedCW`,`curvedCCW`,`cubicBezier`]},roundness:{number:Y},forceDirection:{string:[`horizontal`,`vertical`,`none`],boolean:J},__type__:{object:X,boolean:J}},title:{string:q,undefined:`undefined`},width:{number:Y},widthConstraint:{maximum:{number:Y},__type__:{object:X,boolean:J,number:Y}},value:{number:Y,undefined:`undefined`},__type__:{object:X}},groups:{useDefaultGroups:{boolean:J},__any__:FF,__type__:{object:X}},interaction:{dragNodes:{boolean:J},dragView:{boolean:J},hideEdgesOnDrag:{boolean:J},hideEdgesOnZoom:{boolean:J},hideNodesOnDrag:{boolean:J},hover:{boolean:J},keyboard:{enabled:{boolean:J},speed:{x:{number:Y},y:{number:Y},zoom:{number:Y},__type__:{object:X}},bindToWindow:{boolean:J},autoFocus:{boolean:J},__type__:{object:X,boolean:J}},multiselect:{boolean:J},navigationButtons:{boolean:J},selectable:{boolean:J},selectConnectedEdges:{boolean:J},hoverConnectedEdges:{boolean:J},tooltipDelay:{number:Y},zoomView:{boolean:J},zoomSpeed:{number:Y},__type__:{object:X}},layout:{randomSeed:{undefined:`undefined`,number:Y,string:q},improvedLayout:{boolean:J},clusterThreshold:{number:Y},hierarchical:{enabled:{boolean:J},levelSeparation:{number:Y},nodeSpacing:{number:Y},treeSpacing:{number:Y},blockShifting:{boolean:J},edgeMinimization:{boolean:J},parentCentralization:{boolean:J},direction:{string:[`UD`,`DU`,`LR`,`RL`]},sortMethod:{string:[`hubsize`,`directed`]},shakeTowards:{string:[`leaves`,`roots`]},__type__:{object:X,boolean:J}},__type__:{object:X}},manipulation:{enabled:{boolean:J},initiallyActive:{boolean:J},addNode:{boolean:J,function:`function`},addEdge:{boolean:J,function:`function`},editNode:{function:`function`},editEdge:{editWithoutDrag:{function:`function`},__type__:{object:X,boolean:J,function:`function`}},deleteNode:{boolean:J,function:`function`},deleteEdge:{boolean:J,function:`function`},controlNodeStyle:FF,__type__:{object:X,boolean:J}},nodes:FF,physics:{enabled:{boolean:J},barnesHut:{theta:{number:Y},gravitationalConstant:{number:Y},centralGravity:{number:Y},springLength:{number:Y},springConstant:{number:Y},damping:{number:Y},avoidOverlap:{number:Y},__type__:{object:X}},forceAtlas2Based:{theta:{number:Y},gravitationalConstant:{number:Y},centralGravity:{number:Y},springLength:{number:Y},springConstant:{number:Y},damping:{number:Y},avoidOverlap:{number:Y},__type__:{object:X}},repulsion:{centralGravity:{number:Y},springLength:{number:Y},springConstant:{number:Y},nodeDistance:{number:Y},damping:{number:Y},__type__:{object:X}},hierarchicalRepulsion:{centralGravity:{number:Y},springLength:{number:Y},springConstant:{number:Y},nodeDistance:{number:Y},damping:{number:Y},avoidOverlap:{number:Y},__type__:{object:X}},maxVelocity:{number:Y},minVelocity:{number:Y},solver:{string:[`barnesHut`,`repulsion`,`hierarchicalRepulsion`,`forceAtlas2Based`]},stabilization:{enabled:{boolean:J},iterations:{number:Y},updateInterval:{number:Y},onlyDynamicEdges:{boolean:J},fit:{boolean:J},__type__:{object:X,boolean:J}},timestep:{number:Y},adaptiveTimestep:{boolean:J},wind:{x:{number:Y},y:{number:Y},__type__:{object:X}},__type__:{object:X,boolean:J}},autoResize:{boolean:J},clickToUse:{boolean:J},locale:{string:q},locales:{__any__:{any:NF},__type__:{object:X}},height:{string:q},width:{string:q},__type__:{object:X}},LF={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:[`color`,`#2B7CE9`],background:[`color`,`#97C2FC`],highlight:{border:[`color`,`#2B7CE9`],background:[`color`,`#D2E5FF`]},hover:{border:[`color`,`#2B7CE9`],background:[`color`,`#D2E5FF`]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:[`color`,`#343434`],size:[14,0,100,1],face:[`arial`,`verdana`,`tahoma`],background:[`color`,`none`],strokeWidth:[0,0,50,1],strokeColor:[`color`,`#ffffff`]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:`rgba(0,0,0,0.5)`,size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:[`ellipse`,`box`,`circle`,`database`,`diamond`,`dot`,`square`,`star`,`text`,`triangle`,`triangleDown`,`hexagon`],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:`arrow`},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:`arrow`},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:`arrow`}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:[`color`,`#848484`],highlight:[`color`,`#848484`],hover:[`color`,`#848484`],inherit:[`from`,`to`,`both`,!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:[`color`,`#343434`],size:[14,0,100,1],face:[`arial`,`verdana`,`tahoma`],background:[`color`,`none`],strokeWidth:[2,0,50,1],strokeColor:[`color`,`#ffffff`],align:[`horizontal`,`top`,`middle`,`bottom`]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:`rgba(0,0,0,0.5)`,size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:[`dynamic`,`continuous`,`discrete`,`diagonalCross`,`straightCross`,`horizontal`,`vertical`,`curvedCW`,`curvedCCW`,`cubicBezier`],forceDirection:[`horizontal`,`vertical`,`none`],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:[`UD`,`DU`,`LR`,`RL`],sortMethod:[`hubsize`,`directed`],shakeTowards:[`leaves`,`roots`]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:[`barnesHut`,`forceAtlas2Based`,`repulsion`,`hierarchicalRepulsion`],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},RF=(e,t,n)=>{var r;return!!(Km(e).call(e,`physics`)&&Km(r=LF.physics.solver).call(r,t)&&n.physics.solver!==t&&t!==`wind`)},zF=class{constructor(){}getDistances(e,t,n){let r={},i=e.edges;for(let e=0;e<t.length;e++){let n=t[e],i={};r[n]=i;for(let n=0;n<t.length;n++)i[t[n]]=e==n?0:1e9}for(let e=0;e<n.length;e++){let t=i[n[e]];t.connected===!0&&r[t.fromId]!==void 0&&r[t.toId]!==void 0&&(r[t.fromId][t.toId]=1,r[t.toId][t.fromId]=1)}let a=t.length;for(let e=0;e<a;e++){let n=t[e],i=r[n];for(let e=0;e<a-1;e++){let o=t[e],s=r[o];for(let c=e+1;c<a;c++){let e=t[c],a=r[e],l=Math.min(s[e],s[n]+i[e]);s[e]=l,a[o]=l}}}return r}},BF=class{constructor(e,t,n){this.body=e,this.springLength=t,this.springConstant=n,this.distanceSolver=new zF}setOptions(e){e&&(e.springLength&&(this.springLength=e.springLength),e.springConstant&&(this.springConstant=e.springConstant))}solve(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(r),this._createK_matrix(r),this._createE_matrix();let i=0,a=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),o=1e9,s=0,c=0,l=0,u=0,d=0;for(;o>.01&&i<a;)for(i+=1,[s,o,c,l]=this._getHighestEnergyNode(n),u=o,d=0;u>1&&d<5;)d+=1,this._moveNode(s,c,l),[u,c,l]=this._getEnergy(s)}_getHighestEnergyNode(e){let t=this.body.nodeIndices,n=this.body.nodes,r=0,i=t[0],a=0,o=0;for(let s=0;s<t.length;s++){let c=t[s];if(n[c].predefinedPosition!==!0||n[c].isCluster===!0&&e===!0||n[c].options.fixed.x!==!0||n[c].options.fixed.y!==!0){let[e,t,n]=this._getEnergy(c);r<e&&(r=e,i=c,a=t,o=n)}}return[i,r,a,o]}_getEnergy(e){let[t,n]=this.E_sums[e];return[Math.sqrt(t**2+n**2),t,n]}_moveNode(e,t,n){let r=this.body.nodeIndices,i=this.body.nodes,a=0,o=0,s=0,c=i[e].x,l=i[e].y,u=this.K_matrix[e],d=this.L_matrix[e];for(let t=0;t<r.length;t++){let n=r[t];if(n!==e){let e=i[n].x,t=i[n].y,r=u[n],f=d[n],p=1/((c-e)**2+(l-t)**2)**1.5;a+=r*(1-f*(l-t)**2*p),o+=r*(f*(c-e)*(l-t)*p),s+=r*(1-f*(c-e)**2*p)}}let f=a,p=o,m=t,h=s,g=n,_=(m/f+g/p)/(p/f-h/p),v=-(p*_+m)/f;i[e].x+=v,i[e].y+=_,this._updateE_matrix(e)}_createL_matrix(e){let t=this.body.nodeIndices,n=this.springLength;this.L_matrix=[];for(let r=0;r<t.length;r++){this.L_matrix[t[r]]={};for(let i=0;i<t.length;i++)this.L_matrix[t[r]][t[i]]=n*e[t[r]][t[i]]}}_createK_matrix(e){let t=this.body.nodeIndices,n=this.springConstant;this.K_matrix=[];for(let r=0;r<t.length;r++){this.K_matrix[t[r]]={};for(let i=0;i<t.length;i++)this.K_matrix[t[r]][t[i]]=n*e[t[r]][t[i]]**-2}}_createE_matrix(){let e=this.body.nodeIndices,t=this.body.nodes;this.E_matrix={},this.E_sums={};for(let t=0;t<e.length;t++)this.E_matrix[e[t]]=[];for(let n=0;n<e.length;n++){let r=e[n],i=t[r].x,a=t[r].y,o=0,s=0;for(let c=n;c<e.length;c++){let l=e[c];if(l!==r){let e=t[l].x,u=t[l].y,d=1/Math.sqrt((i-e)**2+(a-u)**2);this.E_matrix[r][c]=[this.K_matrix[r][l]*(i-e-this.L_matrix[r][l]*(i-e)*d),this.K_matrix[r][l]*(a-u-this.L_matrix[r][l]*(a-u)*d)],this.E_matrix[l][n]=this.E_matrix[r][c],o+=this.E_matrix[r][c][0],s+=this.E_matrix[r][c][1]}}this.E_sums[r]=[o,s]}}_updateE_matrix(e){let t=this.body.nodeIndices,n=this.body.nodes,r=this.E_matrix[e],i=this.K_matrix[e],a=this.L_matrix[e],o=n[e].x,s=n[e].y,c=0,l=0;for(let u=0;u<t.length;u++){let d=t[u];if(d!==e){let e=r[u],t=e[0],f=e[1],p=n[d].x,m=n[d].y,h=1/Math.sqrt((o-p)**2+(s-m)**2),g=i[d]*(o-p-a[d]*(o-p)*h),_=i[d]*(s-m-a[d]*(s-m)*h);r[u]=[g,_],c+=g,l+=_;let v=this.E_sums[d];v[0]+=g-t,v[1]+=_-f}}this.E_sums[e]=[c,l]}};function Z(e,t,n){var r,i,a,o;if(!(this instanceof Z))throw SyntaxError(`Constructor must be called with the new operator`);this.options={},this.defaultOptions={locale:`en`,locales:mS,clickToUse:!1},Jo(this.options,this.defaultOptions),this.body={container:e,nodes:{},nodeIndices:[],edges:{},edgeIndices:[],emitter:{on:B(r=this.on).call(r,this),off:B(i=this.off).call(i,this),emit:B(a=this.emit).call(a,this),once:B(o=this.once).call(o,this)},eventListeners:{onTap:function(){},onTouch:function(){},onDoubleTap:function(){},onHold:function(){},onDragStart:function(){},onDrag:function(){},onDragEnd:function(){},onMouseWheel:function(){},onPinch:function(){},onMouseMove:function(){},onRelease:function(){},onContext:function(){}},data:{nodes:null,edges:null},functions:{createNode:function(){},createEdge:function(){},getPointer:function(){}},modules:{},view:{scale:1,translation:{x:0,y:0}},selectionBox:{show:!1,position:{start:{x:0,y:0},end:{x:0,y:0}}}},this.bindEventListeners(),this.images=new _S(()=>this.body.emitter.emit(`_requestRedraw`)),this.groups=new LC,this.canvas=new bP(this.body),this.selectionHandler=new iF(this.body,this.canvas),this.interactionHandler=new TP(this.body,this.canvas,this.selectionHandler),this.view=new SP(this.body,this.canvas),this.renderer=new uP(this.body,this.canvas),this.physics=new oP(this.body),this.layoutEngine=new kF(this.body),this.clustering=new lP(this.body),this.manipulation=new AF(this.body,this.canvas,this.selectionHandler,this.interactionHandler),this.nodesHandler=new dN(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new ZN(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new BF(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(n),this.setData(t)}Fs(Z.prototype),Z.prototype.setOptions=function(e){if(e===null&&(e=void 0),e!==void 0){if(Px.validate(e,IF)===!0&&console.error(`%cErrors have been found in the supplied options object.`,Nx),Zb([`locale`,`locales`,`clickToUse`],this.options,e),e.locale!==void 0&&(e.locale=hS(e.locales||this.options.locales,e.locale)),e=this.layoutEngine.setOptions(e.layout,e),this.canvas.setOptions(e),this.groups.setOptions(e.groups),this.nodesHandler.setOptions(e.nodes),this.edgesHandler.setOptions(e.edges),this.physics.setOptions(e.physics),this.manipulation.setOptions(e.manipulation,e,this.options),this.interactionHandler.setOptions(e.interaction),this.renderer.setOptions(e.interaction),this.selectionHandler.setOptions(e.interaction),e.groups!==void 0&&this.body.emitter.emit(`refreshNodes`),`configure`in e&&(this.configurator||=new Ax(this,this.body.container,LF,this.canvas.pixelRatio,RF),this.configurator.setOptions(e.configure)),this.configurator&&this.configurator.options.enabled===!0){let e={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};$b(e.nodes,this.nodesHandler.options),$b(e.edges,this.edgesHandler.options),$b(e.layout,this.layoutEngine.options),$b(e.interaction,this.selectionHandler.options),$b(e.interaction,this.renderer.options),$b(e.interaction,this.interactionHandler.options),$b(e.manipulation,this.manipulation.options),$b(e.physics,this.physics.options),$b(e.global,this.canvas.options),$b(e.global,this.options),this.configurator.setModuleOptions(e)}e.clickToUse===void 0?this.body.emitter.emit(`activate`):e.clickToUse===!0?this.activator===void 0&&(this.activator=new kx(this.canvas.frame),this.activator.on(`change`,()=>{this.body.emitter.emit(`activate`)})):(this.activator!==void 0&&(this.activator.destroy(),delete this.activator),this.body.emitter.emit(`activate`)),this.canvas.setSize(),this.body.emitter.emit(`startSimulation`)}},Z.prototype._updateVisibleIndices=function(){let e=this.body.nodes,t=this.body.edges;this.body.nodeIndices=[],this.body.edgeIndices=[];for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&!this.clustering._isClusteredNode(t)&&e[t].options.hidden===!1&&this.body.nodeIndices.push(e[t].id);for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let r=t[n],i=e[r.fromId],a=e[r.toId],o=i!==void 0&&a!==void 0;!this.clustering._isClusteredEdge(n)&&r.options.hidden===!1&&o&&i.options.hidden===!1&&a.options.hidden===!1&&this.body.edgeIndices.push(r.id)}},Z.prototype.bindEventListeners=function(){this.body.emitter.on(`_dataChanged`,()=>{this.edgesHandler._updateState(),this.body.emitter.emit(`_dataUpdated`)}),this.body.emitter.on(`_dataUpdated`,()=>{this.clustering._updateState(),this._updateVisibleIndices(),this._updateValueRange(this.body.nodes),this._updateValueRange(this.body.edges),this.body.emitter.emit(`startSimulation`),this.body.emitter.emit(`_requestRedraw`)})},Z.prototype.setData=function(e){if(this.body.emitter.emit(`resetPhysics`),this.body.emitter.emit(`_resetData`),this.selectionHandler.unselectAll(),e&&e.dot&&(e.nodes||e.edges))throw SyntaxError(`Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.`);if(this.setOptions(e&&e.options),e&&e.dot){console.warn(`The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);`);let t=fS(e.dot);this.setData(t);return}else if(e&&e.gephi){console.warn(`The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);`);let t=pS(e.gephi);this.setData(t);return}else this.nodesHandler.setData(e&&e.nodes,!0),this.edgesHandler.setData(e&&e.edges,!0);this.body.emitter.emit(`_dataChanged`),this.body.emitter.emit(`_dataLoaded`),this.body.emitter.emit(`initPhysics`)},Z.prototype.destroy=function(){this.body.emitter.emit(`destroy`),this.body.emitter.off(),this.off(),delete this.groups,delete this.canvas,delete this.selectionHandler,delete this.interactionHandler,delete this.view,delete this.renderer,delete this.physics,delete this.layoutEngine,delete this.clustering,delete this.manipulation,delete this.nodesHandler,delete this.edgesHandler,delete this.configurator,delete this.images;for(let e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&delete this.body.nodes[e];for(let e in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,e)&&delete this.body.edges[e];Kb(this.body.container)},Z.prototype._updateValueRange=function(e){let t,n,r,i=0;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let a=e[t].getValue();a!==void 0&&(n=n===void 0?a:Math.min(a,n),r=r===void 0?a:Math.max(a,r),i+=a)}if(n!==void 0&&r!==void 0)for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t].setValueRange(n,r,i)},Z.prototype.isActive=function(){return!this.activator||this.activator.active},Z.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)},Z.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)},Z.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)},Z.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)},Z.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)},Z.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)},Z.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)},Z.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)},Z.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)},Z.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)},Z.prototype.updateClusteredNode=function(){return this.clustering.updateClusteredNode.apply(this.clustering,arguments)},Z.prototype.getClusteredEdges=function(){return this.clustering.getClusteredEdges.apply(this.clustering,arguments)},Z.prototype.getBaseEdge=function(){return this.clustering.getBaseEdge.apply(this.clustering,arguments)},Z.prototype.getBaseEdges=function(){return this.clustering.getBaseEdges.apply(this.clustering,arguments)},Z.prototype.updateEdge=function(){return this.clustering.updateEdge.apply(this.clustering,arguments)},Z.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)},Z.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)},Z.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)},Z.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)},Z.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)},Z.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)},Z.prototype.editNodeMode=function(){return console.warn(`Deprecated: Please use editNode instead of editNodeMode.`),this.manipulation.editNode.apply(this.manipulation,arguments)},Z.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)},Z.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)},Z.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)},Z.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)},Z.prototype.getPosition=function(){return this.nodesHandler.getPosition.apply(this.nodesHandler,arguments)},Z.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)},Z.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)},Z.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)},Z.prototype.getConnectedNodes=function(e){return this.body.nodes[e]===void 0?this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments):this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments)},Z.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)},Z.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)},Z.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)},Z.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)},Z.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)},Z.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)},Z.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodeIds.apply(this.selectionHandler,arguments)},Z.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdgeIds.apply(this.selectionHandler,arguments)},Z.prototype.getNodeAt=function(){let e=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return e!==void 0&&e.id!==void 0?e.id:e},Z.prototype.getEdgeAt=function(){let e=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return e!==void 0&&e.id!==void 0?e.id:e},Z.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)},Z.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)},Z.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.selectionHandler.commitWithoutEmitting.apply(this.selectionHandler),this.redraw()},Z.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)},Z.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)},Z.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)},Z.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)},Z.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)},Z.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)},Z.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)},Z.prototype.getOptionsFromConfigurator=function(){let e={};return this.configurator&&(e=this.configurator.getOptions.apply(this.configurator)),e};var VF=[271,195,140,25,320,50,170,240,0,90,210,300,60,150,30,280];function HF(e){return`hsl(${VF[e%VF.length]}, ${e%3==0?70:e%3==1?85:60}%, 62%)`}function UF(e){return`hsl(${VF[e%VF.length]}, ${e%3==0?70:e%3==1?85:60}%, 42%)`}function WF(e){return`hsl(${VF[e%VF.length]}, 60%, 20%)`}var GF=`hsl(160, 40%, 45%)`,KF=`hsl(160, 40%, 30%)`,qF={fetching:`Fetching graph data…`,building:`Building graph layout…`,done:``},JF=`cluster:filecommunity:`,YF=`cluster:file:`;function XF(e){return`${JF}${e}`}function ZF(e){return`${YF}${e}`}function QF(e){return Number.parseInt(e.replace(JF,``),10)}function $F(e){return e.replace(YF,``)}function eI(e){return e.split(`/`).pop()??e}var tI=`unerr:graph-positions`;function nI(){try{let e=localStorage.getItem(tI);return e?JSON.parse(e):null}catch{return null}}function rI(e){try{localStorage.setItem(tI,JSON.stringify(e))}catch{}}var iI=100;function aI(e,t){let n=e.filter(e=>t.has(e.from)&&t.has(e.to));if(n.length<=iI)return n;let r={calls:3,tests:2,imports:1};return[...n].sort((e,t)=>(r[t.type]??0)-(r[e.type]??0)).slice(0,iI)}function oI(){let e=(0,f.useRef)(null),t=(0,f.useRef)(null),n=(0,f.useRef)(null),r=(0,f.useRef)(null),i=(0,f.useRef)(null),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(null),[l,u]=(0,f.useState)([]),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(`L0`),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(null),[b,x]=(0,f.useState)([{label:`All Clusters`,level:`L0`}]),[S,C]=(0,f.useState)(`fetching`),[T,E]=(0,f.useState)(0),{url:ee,queryKey:te}=Ot(),{data:D,isLoading:ne,isError:re}=N({queryKey:te([`intelligence`,`graph-visual`]),queryFn:()=>O(ee(`/api/intelligence/graph-visual`))});(0,f.useEffect)(()=>{D&&S===`fetching`?C(`building`):ne&&C(`fetching`)},[D,ne,S]),(0,f.useEffect)(()=>{if(!D?.data||!e.current)return;n.current&&=(n.current.destroy(),null);let{nodes:t,edges:a,fileNodes:s,fileEdges:l,fileCommunities:d,positions:f}=D.data,p=D._meta.view_mode;if(t.length===0){C(`done`);return}let m=f&&Object.keys(f.files).length>0?f:nI()??{communities:{},files:{},entities:{}};f&&Object.keys(f.files).length>0&&rI(f);let g=Math.max(...t.map(e=>e.fanIn+e.fanOut),1),v=t.map(e=>{let t=e.fanIn+e.fanOut,n=e.members??0,r=8+t/g*28+(n>0?Math.min(n*2,12):0),i=e.isTest===!0,a=s.find(t=>t.filePath===e.file)?.fileCommunity??0,o=i?GF:HF(a),c=i?KF:UF(a),l=t>g*.1||n>3,u=n>0?` (${n})`:``,d=e.externalOut>0?` ↗${e.externalOut}`:``,f=m.entities[e.id];return{id:e.id,label:l?`${e.label}${u}${d}`:``,title:`${e.label}\n${e.kind}${n>0?` · ${n} members`:``}\n${e.file}\nfan_in: ${e.fanIn} fan_out: ${e.fanOut}\nrisk: ${e.risk}${e.externalOut>0?`\n↗ ${e.externalOut} cross-cluster`:``}`,size:r,shape:i?`diamond`:`dot`,color:{background:o,border:c,highlight:{background:o,border:`#fafafa`},hover:{background:o,border:`#fafafa`}},font:{color:`rgba(250, 250, 250, 0.85)`,size:Math.max(10,r*.7),face:`JetBrains Mono, monospace`},borderWidth:n>0?3:2,borderWidthSelected:3,x:f?.x,y:f?.y,filePath:e.file,fileCommunity:a,_raw:e}}),b=new Map(t.map(e=>[e.id,e])),S=aI(a,new Set(t.map(e=>e.id))).map((e,t)=>{let n=b.get(e.from),r=s.find(e=>e.filePath===n?.file),i=r?HF(r.fileCommunity):`#8B5CF6`;return{id:`e-${t}`,from:e.from,to:e.to,title:e.type,color:{color:i,opacity:.25,highlight:i,hover:i},width:e.type===`calls`?1.5:1,smooth:{type:`continuous`,roundness:.3},arrows:{to:{enabled:!0,scaleFactor:.4}},font:{color:`rgba(250, 250, 250, 0.3)`,size:8,face:`JetBrains Mono, monospace`,strokeWidth:0}}}),w=new $j(v),T=new $j(S);r.current=w,i.current=T;let E=new Z(e.current,{nodes:w,edges:T},{physics:{enabled:!1},interaction:{hover:!0,tooltipDelay:150,zoomView:!0,dragView:!0,multiselect:!1},nodes:{shape:`dot`},edges:{selectionWidth:2}});n.current=E;function ee(){for(let e of s){if(t.filter(t=>t.file===e.filePath).length===0)continue;let n=m.files[e.filePath];E.cluster({joinCondition:t=>t.filePath===e.filePath,clusterNodeProperties:{id:ZF(e.filePath),label:`${e.label}\n(${e.entityCount})`,title:`${e.filePath}\n${e.entityCount} entities\nfan_in: ${e.totalFanIn} fan_out: ${e.totalFanOut}\nrisk: ${e.maxRisk}`,shape:`box`,size:15+Math.min(e.entityCount*3,30),x:n?.x,y:n?.y,color:{background:WF(e.fileCommunity),border:HF(e.fileCommunity),highlight:{background:WF(e.fileCommunity),border:`#fafafa`},hover:{background:WF(e.fileCommunity),border:`#fafafa`}},font:{color:`rgba(250, 250, 250, 0.9)`,size:11,face:`JetBrains Mono, monospace`,multi:!0},borderWidth:2,borderWidthSelected:3,fileCommunity:e.fileCommunity,_fileNode:e},clusterEdgeProperties:{color:{inherit:`both`,opacity:.35}}})}for(let e of d){let t=m.communities[e.id];E.cluster({joinCondition:t=>t.fileCommunity===e.id,clusterNodeProperties:{id:XF(e.id),label:`${e.label}\n(${e.fileCount} files)`,title:`${e.label}\n${e.fileCount} files · ${e.entityCount} entities\nCohesion: ${Math.round(e.cohesion*100)}%`,shape:`dot`,size:25+Math.min(e.fileCount*4,45),x:t?.x,y:t?.y,color:{background:WF(e.id),border:HF(e.id),highlight:{background:WF(e.id),border:`#fafafa`},hover:{background:WF(e.id),border:`#fafafa`}},font:{color:HF(e.id),size:14,face:`Space Grotesk, sans-serif`,bold:{color:`#fafafa`},multi:!0},borderWidth:e.cohesion>.5?3:2,borderWidthSelected:4,shapeProperties:{borderDashes:e.cohesion<.3?[5,5]:!1}},clusterEdgeProperties:{color:{inherit:`both`,opacity:.4},smooth:{type:`continuous`,roundness:.5}}})}}function te(e){let n=e===void 0?s:s.filter(t=>t.fileCommunity===e);for(let r of n){if(t.filter(e=>e.file===r.filePath).length<2)continue;let n=m.files[r.filePath];E.cluster({joinCondition:t=>e!==void 0&&t.fileCommunity!==e?!1:t.filePath===r.filePath,clusterNodeProperties:{id:ZF(r.filePath),label:`${r.label}\n(${r.entityCount})`,title:`${r.filePath}\n${r.entityCount} entities`,shape:`box`,size:15+Math.min(r.entityCount*3,25),x:n?.x,y:n?.y,color:{background:WF(r.fileCommunity),border:HF(r.fileCommunity),highlight:{background:WF(r.fileCommunity),border:`#fafafa`},hover:{background:WF(r.fileCommunity),border:`#fafafa`}},font:{color:`rgba(250, 250, 250, 0.9)`,size:11,face:`JetBrains Mono, monospace`,multi:!0},borderWidth:2,borderWidthSelected:3,fileCommunity:r.fileCommunity,_fileNode:r},clusterEdgeProperties:{color:{inherit:`both`,opacity:.35}}})}}p===`hierarchical`?(ee(),h(`L0`),x([{label:`All Clusters`,level:`L0`}])):p===`file-clusters`?(te(),h(`L1`),x([{label:`All Files`,level:`L1`}])):(h(`L2`),x([{label:`Flat View`,level:`L2`}])),E.setOptions({physics:{enabled:!0,solver:`forceAtlas2Based`,forceAtlas2Based:{gravitationalConstant:-60,centralGravity:.008,springLength:120,springConstant:.06,damping:.8,avoidOverlap:.3},stabilization:!1}}),E.stabilize(80),E.on(`doubleClick`,e=>{let t=e.nodes?.[0];if(t&&E.isCluster(t)){let e=String(t).startsWith(JF),n=String(t).startsWith(YF);if(E.openCluster(t,{releaseFunction:(e,t)=>{let n=Object.keys(t),r=n.length,i=Math.max(80,r*12),a={};return n.forEach((t,n)=>{let o=m.files[t]??m.entities[t];if(o)a[t]={x:e.x+o.x*.5,y:e.y+o.y*.5};else{let o=2*Math.PI*n/r;a[t]={x:e.x+i*Math.cos(o),y:e.y+i*Math.sin(o)}}}),a}}),E.setOptions({physics:{enabled:!0,solver:`forceAtlas2Based`,forceAtlas2Based:{damping:.85,gravitationalConstant:-40},stabilization:{enabled:!1}}}),setTimeout(()=>{E.setOptions({physics:{enabled:!1}})},1500),e){let e=QF(t);h(`L1`),_(e),y(null),x([{label:`All Clusters`,level:`L0`},{label:d.find(t=>t.id===e)?.label||`Cluster ${e}`,level:`L1`,communityId:e}])}else if(n){let e=$F(t);h(`L2`),y(e),x(t=>[...t.slice(0,t.length>1?2:1),{label:eI(e),level:`L2`,file:e}])}setTimeout(()=>{E.fit({animation:{duration:600,easingFunction:`easeInOutQuad`}})},200)}}),E.on(`selectNode`,e=>{let n=e.nodes[0];if(E.isCluster(n)){if(String(n).startsWith(YF)){let e=$F(n),t=s.find(t=>t.filePath===e);t&&(c(t),o(null))}return}let r=t.find(e=>e.id===n);if(r){o(r),c(null);let e=a.filter(e=>e.from===n||e.to===n),i=new Set(e.map(e=>e.from===n?e.to:e.from));u(t.filter(e=>i.has(e.id)).slice(0,20))}}),E.on(`deselectNode`,()=>{o(null),c(null),u([])});let O=!1,ne=()=>{O||(O=!0,E.setOptions({physics:{enabled:!1}}),C(`done`),ie())};E.on(`stabilizationIterationsDone`,ne);let re=setTimeout(ne,3e3);return E.on(`zoom`,()=>ie()),E.on(`dragEnd`,()=>ie()),C(`building`),()=>{clearTimeout(re),E.destroy(),n.current=null,r.current=null,i.current=null}},[D,T]);let ie=(0,f.useCallback)(()=>{let r=t.current,i=n.current;if(!r||!i)return;let a=r.getContext(`2d`);if(!a)return;let o=r.width,s=r.height;a.clearRect(0,0,o,s);let c=i.getPositions(),l=Object.values(c);if(l.length===0)return;let u=1/0,d=-1/0,f=1/0,p=-1/0;for(let e of l)e.x<u&&(u=e.x),e.x>d&&(d=e.x),e.y<f&&(f=e.y),e.y>p&&(p=e.y);let m=d-u||1,h=p-f||1;a.fillStyle=`rgba(139, 92, 246, 0.5)`;for(let e of l){let t=10+(e.x-u)/m*(o-20),n=10+(e.y-f)/h*(s-20);a.beginPath(),a.arc(t,n,1.5,0,Math.PI*2),a.fill()}try{let t=i.getViewPosition(),n=i.getScale(),r=e.current;if(r&&t){let e=r.clientWidth/n,i=r.clientHeight/n,c=10+(t.x-e/2-u)/m*(o-20),l=10+(t.y-i/2-f)/h*(s-20),d=e/m*(o-20),p=i/h*(s-20);a.strokeStyle=`rgba(250, 250, 250, 0.6)`,a.lineWidth=1,a.strokeRect(c,l,d,p)}}catch{}},[]),k=(0,f.useCallback)(e=>{if(!n.current||!D?.data)return;let{fileCommunities:t,fileNodes:r,nodes:i}=D.data;e.level===`L0`?(h(`L0`),_(null),y(null),x([{label:`All Clusters`,level:`L0`}])):e.level===`L1`&&e.communityId!=null&&(h(`L1`),_(e.communityId),y(null),x([{label:`All Clusters`,level:`L0`},{label:e.label,level:`L1`,communityId:e.communityId}])),C(`building`),E(e=>e+1)},[D]);(0,f.useEffect)(()=>{function e(e){if(e.key===`Escape`&&b.length>1){let e=b[b.length-2];k(e)}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b,k]);let A=(0,f.useCallback)(e=>{if(p(e),!n.current||!D?.data||e.length<2)return;let t=e.toLowerCase(),r=D.data.nodes.find(e=>e.label.toLowerCase().includes(t)),i=D.data.fileNodes.find(e=>e.label.toLowerCase().includes(t)||e.filePath.toLowerCase().includes(t)),a=r?.id??(i?ZF(i.filePath):null);if(a&&n.current){let e=n.current.findNode(a);if(e&&e.length>1)for(let t=0;t<e.length-1;t++){let r=e[t];n.current.isCluster(r)&&n.current.openCluster(r)}n.current.selectNodes([a]),n.current.focus(a,{scale:1.5,animation:{duration:600,easingFunction:`easeInOutQuad`}}),r?(o(r),c(null)):i&&(c(i),o(null))}},[D]),ae=(0,f.useCallback)(()=>{if(!e.current)return;let t=e.current.querySelector(`canvas`);if(!t)return;let n=document.createElement(`canvas`);n.width=t.width,n.height=t.height;let r=n.getContext(`2d`);if(!r)return;r.drawImage(t,0,0);let i=document.createElement(`a`);i.download=`unerr-codebase-map.png`,i.href=n.toDataURL(`image/png`),i.click()},[]),j=D?.data?.nodes.length??0;D?.data?.edges.length;let M=D?._meta,oe=M?.file_count??0,se=M?.file_edge_count??0,ce=M?.collapsed_count??0,le=M?.total_entities??0,ue=D?.data?.fileCommunities??[],de=M?.view_mode??`flat`,fe=S!==`done`&&!re;return(0,w.jsxs)(`div`,{className:`flex h-[calc(100vh-73px)] flex-col gap-0 overflow-hidden lg:flex-row`,children:[(0,w.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border-subtle bg-surface/80 px-4 py-2 backdrop-blur`,children:[(0,w.jsx)(`nav`,{className:`flex items-center gap-1 text-xs`,children:b.map((e,t)=>(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t>0&&(0,w.jsx)(`span`,{className:`t-ghost`,children:`›`}),t<b.length-1?(0,w.jsx)(`button`,{type:`button`,onClick:()=>k(e),className:`rounded px-1.5 py-0.5 text-violet-400 transition hover:bg-violet-500/10 hover:text-violet-300`,children:e.label}):(0,w.jsx)(`span`,{className:`px-1.5 py-0.5 text-foreground font-medium`,children:e.label})]},`${e.level}-${e.communityId??e.file??`root`}`))}),(0,w.jsx)(`div`,{className:`mx-2 h-4 w-px bg-border-subtle`}),(0,w.jsx)(`input`,{type:`search`,value:d,onChange:e=>A(e.target.value),placeholder:`Search files & entities...`,className:`w-48 rounded-lg border border-border bg-background px-3 py-1.5 font-mono text-sm text-foreground outline-none ring-violet-500 placeholder:t-tertiary focus:ring-2 focus:border-violet-500`}),(0,w.jsx)(`div`,{className:`flex-1`}),(0,w.jsxs)(`span`,{className:`font-mono text-xs t-tertiary`,children:[oe,` files · `,j,` entities`,de!==`flat`&&(0,w.jsx)(`span`,{className:`ml-2 rounded bg-violet-500/10 px-1.5 py-0.5 text-violet-400`,children:m===`L0`?`Clusters`:m===`L1`?`Files`:`Entities`})]}),b.length>1&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>k(b[b.length-2]),className:`rounded-lg border border-border-subtle el-raised px-3 py-1.5 text-xs font-medium text-foreground transition hover:el-overlay hover:border-violet-500`,title:`Zoom out (Esc)`,children:`↑ Up`}),(0,w.jsx)(`button`,{type:`button`,onClick:ae,className:`rounded-lg border border-border-subtle el-raised px-3 py-1.5 text-xs font-medium text-foreground transition hover:el-overlay hover:border-violet-500`,children:`Export PNG`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>n.current?.fit({animation:!0}),className:`rounded-lg border border-border-subtle el-raised px-3 py-1.5 text-xs font-medium text-foreground transition hover:el-overlay hover:border-violet-500`,children:`Fit`})]}),(0,w.jsxs)(`div`,{className:`relative flex-1 bg-background`,children:[fe&&(0,w.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center pointer-events-none`,children:(0,w.jsxs)(`div`,{className:`flex flex-col items-center gap-4 rounded-xl border border-border-subtle bg-surface-default/95 px-10 py-8 shadow-2xl backdrop-blur-sm`,children:[(0,w.jsxs)(`svg`,{"aria-hidden":`true`,className:`h-12 w-12 animate-spin`,viewBox:`0 0 48 48`,fill:`none`,children:[(0,w.jsx)(`circle`,{cx:`24`,cy:`24`,r:`20`,stroke:`rgba(255,255,255,0.06)`,strokeWidth:`5`}),(0,w.jsx)(`path`,{d:`M24 4 A20 20 0 0 1 41.32 34`,stroke:`#8B5CF6`,strokeWidth:`5`,strokeLinecap:`round`}),(0,w.jsx)(`path`,{d:`M41.32 34 A20 20 0 0 1 14 40.64`,stroke:`#22D3EE`,strokeWidth:`5`,strokeLinecap:`round`}),(0,w.jsx)(`path`,{d:`M14 40.64 A20 20 0 0 1 6.06 17.1`,stroke:`#34D399`,strokeWidth:`5`,strokeLinecap:`round`})]}),(0,w.jsx)(`p`,{className:`font-mono text-sm text-foreground font-medium`,children:qF[S]}),j>0&&(0,w.jsxs)(`p`,{className:`font-mono text-[11px] t-tertiary`,children:[oe,` files · `,j,` entities`]})]})}),re&&(0,w.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-center justify-center`,children:(0,w.jsxs)(`div`,{className:`glass-panel rounded-xl p-8 text-center`,children:[(0,w.jsx)(`p`,{className:`text-error text-sm font-medium`,children:`Graph unavailable`}),(0,w.jsxs)(`p`,{className:`mt-2 t-secondary text-xs`,children:[`Intelligence graph not loaded. Run`,` `,(0,w.jsx)(`code`,{className:`rounded el-substrate px-1.5 py-0.5 font-mono`,children:`unerr`}),` `,`in your project to index.`]})]})}),!ne&&!re&&j===0&&(0,w.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-center justify-center`,children:(0,w.jsxs)(`div`,{className:`glass-panel rounded-xl p-8 text-center`,children:[(0,w.jsx)(`p`,{className:`text-foreground text-sm font-medium`,children:`No entities found`}),(0,w.jsx)(`p`,{className:`mt-2 t-secondary text-xs`,children:`The graph will appear once the project is indexed.`})]})}),(0,w.jsx)(`div`,{ref:e,className:`absolute inset-0`,style:{opacity:S===`done`?1:S===`building`?.4:.2,transition:`opacity 0.8s ease`}}),S===`done`&&(0,w.jsx)(`div`,{className:`absolute bottom-4 left-4 rounded-lg border border-border-subtle bg-surface-default/90 p-1 backdrop-blur-sm`,children:(0,w.jsx)(`canvas`,{ref:t,width:160,height:100,className:`rounded`,style:{background:`rgba(0,0,0,0.3)`}})}),S===`done`&&m===`L0`&&de===`hierarchical`&&(0,w.jsx)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 rounded-lg border border-border-subtle bg-surface-default/90 px-3 py-2 backdrop-blur-sm`,children:(0,w.jsx)(`p`,{className:`font-mono text-[10px] t-secondary`,children:`Double-click a cluster to explore its files`})})]})]}),(0,w.jsx)(`aside`,{className:`w-full shrink-0 overflow-y-auto border-t border-border-subtle glass-panel lg:w-80 lg:border-t-0 lg:border-l`,children:(0,w.jsxs)(`div`,{className:`p-4`,children:[a?(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`section-label text-violet-500`,children:`Selected entity`}),(0,w.jsxs)(`div`,{className:`mt-2 rounded-lg el-raised p-3`,children:[(0,w.jsx)(`div`,{className:`font-mono text-live text-sm font-medium`,children:a.label}),(0,w.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 flex-wrap`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:a.kind}),(a.members??0)>0&&(0,w.jsxs)(`span`,{className:`rounded bg-violet-500/15 px-1.5 py-0.5 font-mono text-[10px] font-medium text-violet-400`,children:[a.members,` members`]}),a.isTest&&(0,w.jsx)(`span`,{className:`rounded bg-emerald-500/15 px-1.5 py-0.5 font-mono text-[10px] font-medium text-emerald-400`,children:`test`})]}),(0,w.jsx)(`div`,{className:`mt-1 truncate t-tertiary text-xs`,children:a.file}),(0,w.jsxs)(`div`,{className:`mt-2 flex gap-3 text-xs`,children:[(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`in`}),` `,(0,w.jsx)(`span`,{className:`font-mono text-live`,children:a.fanIn})]}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`out`}),` `,(0,w.jsx)(`span`,{className:`font-mono text-live`,children:a.fanOut})]}),(0,w.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[10px] font-medium ${a.risk===`critical`?`bg-error/15 text-error`:a.risk===`high`?`bg-warning/15 text-warning`:a.risk===`medium`?`bg-violet-500/15 text-violet-500`:`bg-success/15 text-success`}`,children:a.risk})]})]})]}),(a.externalOut>0||a.externalIn>0)&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`section-label t-secondary`,children:`Cross-cluster`}),(0,w.jsxs)(`div`,{className:`mt-2 flex gap-4 text-xs`,children:[a.externalOut>0&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{className:`text-warning`,children:`↗`}),(0,w.jsx)(`span`,{className:`font-mono text-live`,children:a.externalOut}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`outbound`})]}),a.externalIn>0&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{className:`text-info`,children:`↙`}),(0,w.jsx)(`span`,{className:`font-mono text-live`,children:a.externalIn}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`inbound`})]})]})]}),g!=null&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`section-label t-secondary`,children:`Location`}),(0,w.jsxs)(`div`,{className:`mt-2 text-xs`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full`,style:{backgroundColor:HF(g)}}),(0,w.jsx)(`span`,{className:`text-foreground`,children:ue.find(e=>e.id===g)?.label||`Cluster ${g}`})]}),ue.find(e=>e.id===g)?.cohesion!=null&&(0,w.jsxs)(`div`,{className:`mt-1 t-tertiary`,children:[`Cohesion:`,` `,Math.round((ue.find(e=>e.id===g)?.cohesion??0)*100),`%`]})]})]}),l.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`h3`,{className:`section-label t-secondary`,children:[`Connected (`,l.length,`)`]}),(0,w.jsx)(`ul`,{className:`mt-2 max-h-48 space-y-1 overflow-auto custom-scrollbar`,children:l.map(e=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(`button`,{type:`button`,onClick:()=>{n.current&&(n.current.selectNodes([e.id]),n.current.focus(e.id,{scale:1.5,animation:{duration:400,easingFunction:`easeInOutQuad`}})),o(e)},className:`w-full rounded px-2 py-1 text-left text-xs transition hover:el-raised`,children:[(0,w.jsx)(`span`,{className:`font-mono text-live`,children:e.label}),(0,w.jsxs)(`span`,{className:`t-tertiary`,children:[` `,`· `,eI(e.file)]})]})},e.id))})]})]}):s?(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`section-label text-violet-500`,children:`Selected file`}),(0,w.jsxs)(`div`,{className:`mt-2 rounded-lg el-raised p-3`,children:[(0,w.jsx)(`div`,{className:`font-mono text-live text-sm font-medium`,children:s.label}),(0,w.jsx)(`div`,{className:`mt-1 truncate t-tertiary text-xs`,children:s.filePath}),(0,w.jsxs)(`div`,{className:`mt-2 flex gap-3 text-xs flex-wrap`,children:[(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`entities`}),` `,(0,w.jsx)(`span`,{className:`font-mono text-live`,children:s.entityCount})]}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`fan_in`}),` `,(0,w.jsx)(`span`,{className:`font-mono text-live`,children:s.totalFanIn})]}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`fan_out`}),` `,(0,w.jsx)(`span`,{className:`font-mono text-live`,children:s.totalFanOut})]}),(0,w.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[10px] font-medium ${s.maxRisk===`high`?`bg-warning/15 text-warning`:s.maxRisk===`medium`?`bg-violet-500/15 text-violet-500`:`bg-success/15 text-success`}`,children:s.maxRisk})]}),(0,w.jsx)(`div`,{className:`mt-2 flex gap-2 flex-wrap`,children:Object.entries(s.kinds).map(([e,t])=>(0,w.jsxs)(`span`,{className:`rounded bg-surface-overlay px-1.5 py-0.5 font-mono text-[10px] t-secondary`,children:[e,`: `,t]},e))})]})]}),(s.externalOut>0||s.externalIn>0)&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`section-label t-secondary`,children:`Cross-cluster edges`}),(0,w.jsxs)(`div`,{className:`mt-2 flex gap-4 text-xs`,children:[s.externalOut>0&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{className:`text-warning`,children:`↗`}),(0,w.jsx)(`span`,{className:`font-mono text-live`,children:s.externalOut}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`outbound`})]}),s.externalIn>0&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{className:`text-info`,children:`↙`}),(0,w.jsx)(`span`,{className:`font-mono text-live`,children:s.externalIn}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`inbound`})]})]})]})]}):(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`section-label text-violet-500`,children:`Inspector`}),(0,w.jsx)(`p`,{className:`mt-3 t-secondary text-xs leading-relaxed`,children:m===`L0`?`Double-click a file cluster to explore its files. Click a node for details.`:m===`L1`?`Double-click a file to see its entities. Click a node for details.`:`Click a node to inspect its connections, risk level, and dependencies.`})]}),(0,w.jsxs)(`div`,{className:`mt-6`,children:[(0,w.jsx)(`h3`,{className:`section-label t-secondary`,children:`File Clusters`}),(0,w.jsxs)(`ul`,{className:`mt-2 max-h-40 space-y-1 overflow-auto custom-scrollbar`,children:[ue.slice(0,16).map(e=>(0,w.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,w.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 rounded-full`,style:{backgroundColor:HF(e.id)}}),(0,w.jsx)(`span`,{className:`truncate text-foreground`,children:e.label}),(0,w.jsxs)(`span`,{className:`ml-auto tabular-nums t-tertiary`,children:[e.fileCount,`f`]}),e.cohesion<.3&&(0,w.jsx)(`span`,{className:`text-warning text-[10px]`,title:`Low cohesion`,children:`!`})]},e.id)),(0,w.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,w.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 rotate-45 rounded-sm`,style:{backgroundColor:GF}}),(0,w.jsx)(`span`,{className:`text-foreground`,children:`Test files`}),(0,w.jsx)(`span`,{className:`ml-auto t-tertiary`,children:`◇`})]})]})]}),(0,w.jsxs)(`div`,{className:`mt-6 rounded-lg border border-border-subtle el-raised p-3`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`t-secondary`,children:`Files`}),(0,w.jsx)(`div`,{className:`font-mono text-live text-lg tabular-nums`,children:oe})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`t-secondary`,children:`File edges`}),(0,w.jsx)(`div`,{className:`font-mono text-live text-lg tabular-nums`,children:se})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`t-secondary`,children:`Clusters`}),(0,w.jsx)(`div`,{className:`font-mono text-live text-lg tabular-nums`,children:ue.length})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`t-secondary`,children:`Entities`}),(0,w.jsx)(`div`,{className:`font-mono text-live text-lg tabular-nums`,children:le})]})]}),ce>0&&(0,w.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border-subtle t-tertiary text-[10px]`,children:[ce,` child entities (methods, types, constructors) merged into parent nodes`]}),de!==`flat`&&(0,w.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border-subtle t-tertiary text-[10px]`,children:[`View:`,` `,de===`hierarchical`?`Hierarchical (L0→L1→L2)`:`File clusters`,` `,`· Level: `,m]})]})]})})]})}var sI=20,cI=15e3;function lI(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function uI(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2])-1,i=Number(t[3]),a=new Date(n,r,i,0,0,0,0),o=new Date(n,r,i+1,0,0,0,0);return{from_ts:a.toISOString(),to_ts:o.toISOString()}}function dI(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=Date.now()-t.getTime();if(n<0)return`just now`;let r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function fI(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}function pI(e){return e.length>10?`${e.slice(0,8)}…`:e}function mI(e){return e==null?`—`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function hI(e,t=900){let[n,r]=(0,f.useState)(e),i=(0,f.useRef)(!1);return(0,f.useEffect)(()=>{if(i.current||e<=0){r(e);return}if(typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches){r(e);return}i.current=!0;let n=0,a=performance.now(),o=i=>{let s=Math.min(1,(i-a)/t);r(e*(1-(1-s)**3)),s<1?n=requestAnimationFrame(o):r(e)};return n=requestAnimationFrame(o),()=>cancelAnimationFrame(n)},[e,t]),n}function gI({value:e,format:t}){let n=hI(e);return(0,w.jsx)(w.Fragment,{children:t(Math.round(n))})}var _I=[{stripe:`border-l-violet-400`,chip:`bg-violet-500/15 text-violet-200`,bg:`bg-violet-500/4`},{stripe:`border-l-cyan-400`,chip:`bg-cyan-500/15 text-cyan-200`,bg:`bg-cyan-500/4`},{stripe:`border-l-emerald-400`,chip:`bg-emerald-500/15 text-emerald-200`,bg:`bg-emerald-500/4`},{stripe:`border-l-amber-400`,chip:`bg-amber-500/15 text-amber-200`,bg:`bg-amber-500/4`},{stripe:`border-l-rose-400`,chip:`bg-rose-500/15 text-rose-200`,bg:`bg-rose-500/4`},{stripe:`border-l-sky-400`,chip:`bg-sky-500/15 text-sky-200`,bg:`bg-sky-500/4`},{stripe:`border-l-fuchsia-400`,chip:`bg-fuchsia-500/15 text-fuchsia-200`,bg:`bg-fuchsia-500/4`},{stripe:`border-l-lime-400`,chip:`bg-lime-500/15 text-lime-200`,bg:`bg-lime-500/4`}];function vI(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return _I[Math.abs(t)%_I.length]}var yI={shell_compression:`Shell compressed`,file_read:`Read trimmed`,fetch_url:`Fetch cleaned`,graph_query:`Graph used`,session_dedup:`Context deduped`,format_encoding:`Response compacted`,smart_truncation:`Smart trim`,behavior_automation:`Automation`,persistent_memory:`Memory`},bI={stale_edit_prevented:`✦`,cascade_guard:`✦`,boundary_violation_flagged:`▦`,incomplete_work_flagged:`◌`,cascade_warning_consumed:`✓`,intervention_halted:`✕`,intervention_warned:`!`,loop_broken:`⟲`,full_read_avoided:`▥`,graph_query_served:`◈`,caller_check_enforced:`⊕`,drift_consumed:`≈`,convention_applied:`◇`,defuddle_selector_skipped:`▤`,fact_recalled:`❝`,fact_stored_user_fed:`✎`,fact_stored_auto:`✎`,fact_capture_abandoned:`∅`,cross_session_resume:`↪`,resume_blockers_surfaced:`⚑`,cache_hit:`◐`,confirmation_expired:`◷`,presence_ambient_marker:`·`,surface2_emitted:`▸`,surface2_missed:`▹`,user_prompt_received:`▶`,shell_compression:`◈`,file_read:`▥`,fetch_url:`↗`,graph_query:`◈`,session_dedup:`≡`,format_encoding:`⊞`,smart_truncation:`▤`,behavior_automation:`⚙`,persistent_memory:`❝`},xI={stale_edit_prevented:`Prevented a broken edit`,cascade_guard:`Protected code that depends on this`,boundary_violation_flagged:`Kept an architecture boundary intact`,incomplete_work_flagged:`Flagged an unfinished refactor`,cascade_warning_consumed:`Agent checked dependent code first`,intervention_halted:`Blocked a bad tool call`,intervention_warned:`Flagged a risky operation`,loop_broken:`Stopped a wasteful retry loop`,full_read_avoided:`Read only the relevant part`,graph_query_served:`Answered instantly from code graph`,caller_check_enforced:`Checked what uses this before editing`,drift_consumed:`Detected file changed on disk`,convention_applied:`Enforced your project's style`,defuddle_selector_skipped:`Handled a web page parsing error`,fact_recalled:`Recalled a rule you taught it`,fact_stored_user_fed:`Remembered your instruction`,fact_stored_auto:`Noticed a codebase pattern`,fact_capture_abandoned:`Skipped an uncertain note`,cross_session_resume:`Continued from last session`,resume_blockers_surfaced:`Brought forward open issues`,cache_hit:`Reused a cached result`,confirmation_expired:`Confirmation timed out`,user_prompt_received:`Prompt received`,presence_ambient_marker:`Running quietly`,surface2_emitted:`Added context to the response`,surface2_missed:`Context was not added this turn`,"tokenflow.shell_compression":`Compressed command output`,"tokenflow.file_read":`Read only what was needed`,"tokenflow.fetch_url":`Cleaned up a web page`,"tokenflow.graph_query":`Used code graph instead of reading files`,"tokenflow.session_dedup":`Skipped info the agent already had`,"tokenflow.format_encoding":`Made the response more compact`,"tokenflow.smart_truncation":`Trimmed repetitive output`,"tokenflow.behavior_automation":`Did a step automatically`,"tokenflow.persistent_memory":`Loaded from memory`};function SI(e,t){let n=typeof t.tool==`string`?t.tool:null,r=typeof t.file_path==`string`?t.file_path.split(`/`).pop():typeof t.file==`string`?t.file.split(`/`).pop():typeof t.path==`string`?t.path.split(`/`).pop():null,i=typeof t.top_content==`string`?t.top_content:typeof t.content==`string`?t.content:typeof t.fact_content==`string`?t.fact_content:null,a=(e,t=80)=>e.length>t?`${e.slice(0,t)}…`:e;switch(e){case`tokenflow.shell_compression`:{let e=typeof t.command==`string`?t.command:null;return e?`Compressed the output of "${a(e,60)}" so the agent sees a concise version`:`Compressed a long command output so the agent doesn't waste tokens reading it`}case`tokenflow.file_read`:{let e=typeof t.total_lines==`number`?t.total_lines:null;return r&&e?`Only sent the relevant part of ${r} (${e}-line file) instead of the whole thing`:r?`Sent only the relevant section of ${r} instead of the entire file`:`Sent only the relevant section instead of the full file`}case`tokenflow.graph_query`:return n?`Answered the ${n} question from the code graph — no file reading needed`:`Answered from the code graph — saved the agent from reading files one by one`;case`tokenflow.format_encoding`:return n?`Made the ${n} response smaller so it uses fewer tokens`:`Made the response smaller so it uses fewer tokens`;case`tokenflow.fetch_url`:return`Stripped navigation, ads, and boilerplate from a web page before sending it to the agent`;case`tokenflow.session_dedup`:return`The agent already had this information — skipped sending it again`;case`tokenflow.smart_truncation`:return`Trimmed repetitive or boilerplate content from a long output`;case`tokenflow.behavior_automation`:return`Performed a maintenance step automatically so the agent didn't have to`;case`tokenflow.persistent_memory`:{let e=typeof t.verdict==`string`?t.verdict:null;return e===`acted_on`?`Loaded a note from memory — the agent used it in its work`:e===`reinforced`?`Re-surfaced a note from memory — it's still relevant`:e===`ignored`?`Loaded a note from memory, but the agent didn't use it this time`:`Loaded stored notes from memory instead of the agent having to re-learn them`}case`stale_edit_prevented`:return r?`Stopped the agent from editing ${r} because the file had changed since it was last read`:`Stopped the agent from editing a file that had been modified — avoided overwriting new changes`;case`cascade_guard`:return r?`Other code depends on ${r} — warned the agent before editing to prevent breakage`:`Warned the agent that other code depends on what it was about to change`;case`boundary_violation_flagged`:{let e=typeof t.violations==`number`?t.violations:null,n=Array.isArray(t.target_layers)?t.target_layers.filter(e=>typeof e==`string`):[];return r&&n.length>0?`${r} was about to import across an architecture boundary into ${n.join(`, `)} — flagged before the layering eroded`:e?`Flagged ${e} import(s) that crossed an architecture boundary meant to stay isolated`:`Flagged an import that crossed an architecture boundary meant to stay isolated`}case`incomplete_work_flagged`:{let e=typeof t.items==`number`?t.items:null,n=typeof t.high_severity==`number`?t.high_severity:0;return n>0?`Flagged ${n} signature change(s) whose callers were never updated this session — they'd break at runtime or compile time`:e?`Flagged ${e} unfinished refactor(s) at session end so they don't surface as breaks later`:`Flagged an unfinished refactor at session end so it doesn't surface as a break later`}case`cascade_warning_consumed`:return`The agent read the dependency warning and adjusted its approach before editing`;case`intervention_halted`:return n?`Blocked the ${n} call because it was going in the wrong direction`:`Blocked a tool call that would have taken the agent off track`;case`intervention_warned`:return n?`Warned the agent that the ${n} call looked risky — it adjusted its approach`:`Warned the agent about a risky operation — it adjusted its approach`;case`loop_broken`:return`The agent was retrying the same thing — unerr broke the loop before it wasted more tokens`;case`full_read_avoided`:return r?`Sent only the relevant part of ${r} instead of the entire file`:`Sent a focused section instead of dumping the full file into context`;case`graph_query_served`:return n?`Answered a ${n} question instantly from the code graph`:`Answered a code question instantly from the code graph — no file reading needed`;case`caller_check_enforced`:return r?`Made the agent check what other code uses ${r} before making changes`:`Made the agent check what other code depends on this before editing`;case`drift_consumed`:return r?`Noticed ${r} was modified on disk and told the agent to re-read it before editing`:`A file was modified on disk — told the agent to re-read it before editing`;case`convention_applied`:return i?`Applied your project rule: "${a(i)}"`:`Applied your project's naming and style conventions to the generated code`;case`fact_recalled`:{let e=typeof t.count==`number`?t.count:1;return i&&e>1?`Recalled ${e} stored notes — top one: "${a(i)}"`:i?`Recalled: "${a(i)}"`:`Recalled ${e} ${e===1?`note`:`notes`} that you taught unerr in a previous session`}case`fact_stored_user_fed`:{let e=typeof t.source_quote==`string`?t.source_quote:null;return e?`You said: "${a(e)}" — saved for future sessions`:i?`Saved for future sessions: "${a(i)}"`:`Saved a rule you told unerr to remember — it will apply in future sessions`}case`fact_stored_auto`:return i?`Noticed a pattern and saved it: "${a(i)}"`:`Noticed a pattern in your codebase and saved it for future use`;case`fact_capture_abandoned`:return`Decided not to save a note — it wasn't clear enough to be reliable`;case`cross_session_resume`:return`Picked up where the last session left off — didn't need to re-learn your codebase`;case`resume_blockers_surfaced`:{let e=typeof t.count==`number`?t.count:1;return`Brought forward ${e} unresolved ${e===1?`issue`:`issues`} from the previous session so nothing gets lost`}case`cache_hit`:return n?`Reused a cached ${n} result — no need to recompute`:`Reused a cached result instead of doing the same work again`;case`confirmation_expired`:return`Asked you a question, but it went unanswered and timed out`;case`presence_ambient_marker`:return`Nothing to report this turn — unerr was running quietly in the background`;case`surface2_emitted`:return`Added relevant notes, conventions, and warnings to the agent's response`;case`surface2_missed`:return`Was supposed to add context to the response but didn't fire this turn`;case`defuddle_selector_skipped`:return`Ran into an issue parsing a web page but recovered gracefully — no data was lost`;default:return``}}var CI={stale_edit_prevented:`catch`,cascade_guard:`catch`,boundary_violation_flagged:`catch`,intervention_halted:`catch`,loop_broken:`catch`,intervention_warned:`guard`,cascade_warning_consumed:`guard`,caller_check_enforced:`guard`,drift_consumed:`guard`,defuddle_selector_skipped:`guard`,surface2_missed:`guard`,incomplete_work_flagged:`guard`,fact_recalled:`remember`,fact_stored_user_fed:`remember`,fact_stored_auto:`remember`,cross_session_resume:`remember`,resume_blockers_surfaced:`remember`,full_read_avoided:`save`,cache_hit:`save`,graph_query_served:`serve`,convention_applied:`serve`,surface2_emitted:`serve`},wI={catch:`text-red-400`,guard:`text-amber-400`,save:`text-emerald-400`,remember:`text-violet-400`,serve:`text-cyan-400`,note:`text-zinc-400`},TI={catch:`bg-red-500/10 border-red-500/20`,guard:`bg-amber-500/10 border-amber-500/20`,save:`bg-emerald-500/10 border-emerald-500/20`,remember:`bg-violet-500/10 border-violet-500/20`,serve:`bg-cyan-500/10 border-cyan-500/20`,note:`bg-zinc-500/10 border-zinc-500/20`};function EI(e){return e?e.startsWith(`tokenflow.`)?`save`:CI[e]??`note`:`note`}function DI({totalPrompts:e,totalEvents:t,tokensSaved:n}){return(0,w.jsxs)(`section`,{className:`relative overflow-hidden rounded-2xl border border-border-subtle bg-linear-to-br from-violet-950/40 via-card to-card`,children:[(0,w.jsx)(`div`,{className:`absolute inset-0 bg-linear-to-r from-violet-500/5 to-transparent`}),(0,w.jsxs)(`div`,{className:`relative px-6 py-8 sm:px-8`,children:[(0,w.jsxs)(`div`,{className:`mb-6`,children:[(0,w.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.15em] text-violet-300/70`,children:`Prompts handled`}),(0,w.jsx)(`p`,{className:`mt-1 font-grotesk text-5xl font-bold tabular-nums text-foreground`,children:(0,w.jsx)(gI,{value:e,format:e=>e.toLocaleString()})})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-2`,children:[(0,w.jsxs)(`div`,{className:`rounded-xl border border-border-subtle bg-white/3 px-4 py-3`,children:[(0,w.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-zinc-400`,children:`unerr events`}),(0,w.jsx)(`p`,{className:`mt-1 font-mono text-xl font-semibold tabular-nums text-foreground`,children:(0,w.jsx)(gI,{value:t,format:mI})})]}),(0,w.jsxs)(`div`,{className:`rounded-xl border border-border-subtle bg-white/3 px-4 py-3`,children:[(0,w.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-zinc-400`,children:`Tokens saved`}),(0,w.jsx)(`p`,{className:`mt-1 font-mono text-xl font-semibold tabular-nums text-emerald-400`,children:(0,w.jsx)(gI,{value:n,format:mI})})]})]})]})]})}function OI({date:e,agent:t,sessionId:n,facets:r,onChange:i,onReset:a,isDefault:o}){let s=`block text-[10px] uppercase tracking-[0.12em] t-tertiary`,c=`w-full rounded-md border border-border bg-muted/40 px-2.5 py-1.5 text-xs text-foreground focus:border-violet-500/60 focus:outline-none focus:ring-1 focus:ring-violet-500/40`;return(0,w.jsxs)(`section`,{"aria-label":`Filter logbook`,className:`rounded-xl border border-border-subtle bg-card p-4`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`lb-date`,className:s,children:`Date`}),(0,w.jsx)(`input`,{id:`lb-date`,type:`date`,value:e,max:lI(),onChange:e=>i({date:e.target.value,page:null}),className:`${c} font-mono tabular-nums`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`lb-agent`,className:s,children:`Agent`}),(0,w.jsxs)(`select`,{id:`lb-agent`,value:t,onChange:e=>i({agent:e.target.value||null,page:null}),className:c,children:[(0,w.jsxs)(`option`,{value:``,children:[`All agents`,r?` (${r.total})`:``]}),r?.agents.map(e=>(0,w.jsxs)(`option`,{value:e.name,children:[e.name,` (`,e.count,`)`]},e.name))]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`lb-session`,className:s,children:`Session`}),(0,w.jsxs)(`select`,{id:`lb-session`,value:n,onChange:e=>i({session:e.target.value||null,page:null}),className:c,children:[(0,w.jsx)(`option`,{value:``,children:`Any session`}),r?.sessions.map(e=>(0,w.jsxs)(`option`,{value:e.id,children:[pI(e.id),` · `,e.agent,` · `,fI(e.started_ts),` (`,e.count,`)`]},e.id))]})]})]}),o?null:(0,w.jsx)(`div`,{className:`mt-3 flex items-center justify-end`,children:(0,w.jsx)(`button`,{type:`button`,onClick:a,className:`rounded-md px-2 py-1 text-xs t-secondary hover:bg-muted hover:text-foreground`,children:`Reset to today`})})]})}var kI=new Set([`user_prompt_received`,`presence_ambient_marker`,`surface2_emitted`,`surface2_missed`,`defuddle_selector_skipped`,`confirmation_expired`]);function AI({byType:e}){let t=Object.entries(e).filter(([e,t])=>t>0&&!kI.has(e)).sort(([,e],[,t])=>t-e).slice(0,4);return t.length===0?null:(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(([e,t])=>{let n=xI[e]??e.replace(/^tokenflow\./,``).replace(/_/g,` `),r=EI(e);return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium ${TI[r]}`,children:[(0,w.jsx)(`span`,{className:wI[r],children:bI[e.replace(`tokenflow.`,``)]??`·`}),(0,w.jsx)(`span`,{className:`text-foreground/80`,children:t}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:n})]},e)})})}function jI({item:e,isExpanded:t,onToggle:n,isHighestImpact:r}){let i=vI(e.session_id),a=EI(e.summary.featured_event_type),o=e.prompt?.text,s=e.prompt?.classified_as;return(0,w.jsxs)(`div`,{className:`overflow-hidden rounded-xl border transition-all ${t?`border-violet-500/30 bg-card shadow-lg shadow-violet-500/5`:r?`border-violet-500/20 bg-card`:`border-border-subtle bg-card hover:border-border-strong`}`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:n,className:`w-full text-left`,"aria-expanded":t,children:(0,w.jsxs)(`div`,{className:`border-l-2 px-4 py-3.5 sm:px-5 ${i.stripe}`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[o?(0,w.jsxs)(`p`,{className:`line-clamp-2 text-sm font-medium leading-relaxed text-foreground`,children:[`"`,o,`"`]}):(0,w.jsx)(`p`,{className:`text-sm italic t-tertiary`,children:e.prompt?`Prompt (${e.prompt.length} chars) — content not captured`:`Prompt not captured`}),s?(0,w.jsx)(`span`,{className:`mt-1.5 inline-block rounded-full bg-violet-500/10 px-2 py-0.5 text-[10px] font-medium text-violet-300`,children:s}):null]}),(0,w.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,w.jsxs)(`div`,{className:`text-right`,children:[(0,w.jsx)(`span`,{className:`block font-mono text-xs tabular-nums text-foreground`,children:fI(e.ts_start)}),(0,w.jsx)(`span`,{className:`block text-[10px] t-tertiary`,children:dI(e.ts_start)})]}),(0,w.jsx)(`span`,{className:`t-tertiary transition-transform ${t?`rotate-90`:``}`,"aria-hidden":`true`,children:`›`})]})]}),(0,w.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,w.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[11px] ${i.chip}`,title:e.session_id,children:pI(e.session_id)}),e.summary.agents.length>0?(0,w.jsx)(`span`,{className:`font-mono text-[11px] text-foreground/70`,children:e.summary.agents[0]}):null,(0,w.jsxs)(`span`,{className:`font-mono text-[11px] tabular-nums t-tertiary`,children:[`turn `,e.turn]}),(0,w.jsx)(`span`,{className:`hidden sm:inline t-ghost`,children:`·`}),(0,w.jsxs)(`span`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-foreground/70`,children:[e.summary.event_count,` `,e.summary.event_count===1?`event`:`events`]}),e.summary.tool_call_count>0?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`t-ghost`,children:`·`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-cyan-300`,children:[e.summary.tool_call_count,` tool`,` `,e.summary.tool_call_count===1?`call`:`calls`]})]}):null,e.summary.marker_count>0?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`t-ghost`,children:`·`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-violet-300`,children:[e.summary.marker_count,` `,e.summary.marker_count===1?`marker`:`markers`]})]}):null,e.summary.tokens_saved>0?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`t-ghost`,children:`·`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[mI(e.summary.tokens_saved),` saved`]})]}):null]}),e.summary.featured_verb?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`hidden sm:inline t-ghost`,children:`·`}),(0,w.jsx)(`span`,{className:`text-[11px] ${wI[a]}`,children:e.summary.featured_verb})]}):null]}),(0,w.jsx)(`div`,{className:`mt-2.5`,children:(0,w.jsx)(AI,{byType:e.summary.by_type})})]})}),t?(0,w.jsx)(MI,{sessionId:e.session_id,turn:e.turn}):null]})}function MI({sessionId:e,turn:t}){let{url:n,queryKey:r}=Ot(),[i,a]=(0,f.useState)(`events`),o=N({queryKey:r([`logbook`,`prompt-detail`,e,t]),queryFn:()=>O(n(`/api/logbook/prompt-detail/${e}/${t}`))});if(o.isLoading)return(0,w.jsx)(`div`,{className:`border-t border-border-subtle px-5 py-4`,children:(0,w.jsx)(Wt,{count:3})});let s=o.data?.data;if(!s)return null;let c=s.events??[],l=s.transcript??[],u=s.token_optimization??{total_saved:0,mechanisms:{}},d=s.tool_calls??[],p=s.markers??[],m=[{id:`events`,label:`Events`,count:c.length},...d.length>0?[{id:`tool_calls`,label:`Tool Calls`,count:d.length}]:[],...p.length>0?[{id:`markers`,label:`Markers`,count:p.length}]:[],...s.has_transcript?[{id:`transcript`,label:`Execution Trace`,count:l.length}]:[],...u.total_saved>0?[{id:`tokens`,label:`Token Savings`,count:Object.keys(u.mechanisms).length}]:[]];return(0,w.jsxs)(`div`,{className:`border-t border-border-subtle`,children:[s.attribution&&((s.attribution.recalls?.length??0)>0||(s.attribution.captures?.length??0)>0||(s.attribution.drift?.length??0)>0)?(0,w.jsxs)(`div`,{className:`border-b border-border-subtle bg-violet-500/4 px-5 py-3`,children:[(0,w.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-violet-300/70`,children:`What unerr contributed`}),(0,w.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[s.attribution.recalls?.map((e,t)=>(0,w.jsxs)(`p`,{className:`text-xs text-foreground/80`,children:[(0,w.jsx)(`span`,{className:`text-violet-400`,children:`↳`}),` Recalled: "`,e.content.length>100?`${e.content.slice(0,100)}…`:e.content,`"`,e.scope?(0,w.jsxs)(`span`,{className:`t-tertiary`,children:[` · `,e.scope]}):null]},`recall-${t}`)),s.attribution.captures?.map((e,t)=>(0,w.jsxs)(`p`,{className:`text-xs text-foreground/80`,children:[(0,w.jsx)(`span`,{className:`text-emerald-400`,children:`↳`}),` Remembered: "`,e.content.length>100?`${e.content.slice(0,100)}…`:e.content,`"`]},`capture-${t}`)),s.attribution.drift?.map((e,t)=>(0,w.jsxs)(`p`,{className:`text-xs text-foreground/80`,children:[(0,w.jsx)(`span`,{className:`text-amber-400`,children:`↳`}),` Caught drift on`,` `,(0,w.jsx)(`code`,{className:`rounded bg-muted/80 px-1 py-0.5 font-mono text-[11px]`,children:e.file_path})]},`drift-${t}`))]})]}):null,(0,w.jsxs)(`div`,{className:`flex gap-0 border-b border-border-subtle`,children:[m.map(e=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>a(e.id),className:`px-4 py-2.5 text-xs font-medium transition-colors ${i===e.id?`border-b-2 border-violet-400 text-foreground`:`text-zinc-400 hover:text-foreground`}`,children:[e.label,(0,w.jsx)(`span`,{className:`ml-1.5 rounded-full bg-white/5 px-1.5 py-0.5 font-mono text-[10px] tabular-nums`,children:e.count})]},e.id)),(0,w.jsxs)(`div`,{className:`ml-auto flex items-center gap-2 px-3`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(`activity`,{session:e}),className:`rounded px-2 py-1 text-[10px] text-violet-300 transition-colors hover:bg-violet-500/10 hover:text-violet-200`,children:`Activity →`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(`prompt-trace`,{session:e,turn:String(t)}),className:`rounded px-2 py-1 text-[10px] text-violet-300 transition-colors hover:bg-violet-500/10 hover:text-violet-200`,children:`Prompt Trace →`})]})]}),(0,w.jsx)(`div`,{className:`px-5 py-4`,children:i===`events`?(0,w.jsx)(LI,{events:c}):i===`tool_calls`?(0,w.jsx)(VI,{toolCalls:d}):i===`markers`?(0,w.jsx)(UI,{markers:p}):i===`transcript`?(0,w.jsx)(WI,{transcript:l}):i===`tokens`?(0,w.jsx)(GI,{optimization:u}):null})]})}var NI={stale_edit_prevented:`catches`,cascade_guard:`catches`,cascade_warning_consumed:`catches`,intervention_halted:`catches`,intervention_warned:`catches`,loop_broken:`catches`,full_read_avoided:`intelligence`,graph_query_served:`intelligence`,caller_check_enforced:`intelligence`,drift_consumed:`intelligence`,convention_applied:`intelligence`,defuddle_selector_skipped:`intelligence`,fact_recalled:`memory`,fact_stored_user_fed:`memory`,fact_stored_auto:`memory`,cross_session_resume:`memory`,resume_blockers_surfaced:`memory`,fact_capture_abandoned:`other`,cache_hit:`savings`,confirmation_expired:`other`,presence_ambient_marker:`other`,surface2_emitted:`other`,surface2_missed:`other`},PI={catches:{label:`Mistakes prevented`,sublabel:`These would have gone wrong without unerr`,color:`text-red-400`},intelligence:{label:`Smarter answers`,sublabel:`Faster and more accurate than reading files one by one`,color:`text-cyan-400`},memory:{label:`Memory`,sublabel:`Your rules and patterns, carried across sessions`,color:`text-violet-400`},savings:{label:`Tokens saved`,sublabel:`Less wasted context means more room for your actual code`,color:`text-emerald-400`},other:{label:`Other activity`,sublabel:``,color:`text-zinc-400`}};function FI(e){return e.startsWith(`tokenflow.`)?`savings`:NI[e]??`other`}function II({ev:e,i:t}){let n=EI(e.event_type),r=e.metadata??{},i=typeof r.tokens_saved==`number`?r.tokens_saved:void 0,a=xI[e.event_type]??e.event_type.replace(/^tokenflow\./,``).replace(/_/g,` `),o=SI(e.event_type,r);return(0,w.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg bg-muted/20 px-3 py-2.5`,children:[(0,w.jsx)(`span`,{className:`mt-0.5 shrink-0 text-sm ${wI[n]}`,"aria-hidden":`true`,children:bI[e.event_type.replace(`tokenflow.`,``)]??`·`}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:a}),o?(0,w.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed t-secondary`,children:o}):null,typeof i==`number`&&i>0?(0,w.jsxs)(`p`,{className:`mt-0.5 font-mono text-[11px] tabular-nums text-emerald-400`,children:[`saved `,mI(i),` tokens`]}):null]}),(0,w.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] tabular-nums t-tertiary`,children:fI(e.ts)})]},`${e.ts}-${e.event_type}-${t}`)}function LI({events:e}){if(e.length===0)return(0,w.jsx)(`p`,{className:`py-4 text-center text-sm t-secondary`,children:`No events recorded for this prompt.`});let t=e.filter(e=>e.event_type!==`user_prompt_received`);if(t.length===0)return(0,w.jsx)(`p`,{className:`py-4 text-center text-sm t-secondary`,children:`No unerr actions recorded for this prompt.`});let n=new Map;for(let e of t){let t=FI(e.event_type),r=n.get(t);r?r.push(e):n.set(t,[e])}return n.size<=1||t.length<=3?(0,w.jsx)(`div`,{className:`space-y-2`,children:t.map((e,t)=>(0,w.jsx)(II,{ev:e,i:t},`${e.ts}-${e.event_type}-${t}`))}):(0,w.jsx)(`div`,{className:`space-y-5`,children:[`catches`,`intelligence`,`memory`,`savings`,`other`].map(e=>{let t=n.get(e);if(!t||t.length===0)return null;let r=PI[e];return(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-baseline gap-2`,children:[(0,w.jsx)(`h4`,{className:`text-[11px] font-semibold uppercase tracking-widest ${r.color}`,children:r.label}),(0,w.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums t-tertiary`,children:t.length}),r.sublabel?(0,w.jsxs)(`span`,{className:`text-[10px] t-ghost`,children:[`— `,r.sublabel]}):null]}),(0,w.jsx)(`div`,{className:`space-y-1.5`,children:t.map((e,t)=>(0,w.jsx)(II,{ev:e,i:t},`${e.ts}-${e.event_type}-${t}`))})]},e)})})}var RI={search_code:{label:`Search`,color:`text-cyan-300 bg-cyan-500/10`},get_entity:{label:`Read entity`,color:`text-cyan-300 bg-cyan-500/10`},get_references:{label:`References`,color:`text-cyan-300 bg-cyan-500/10`},file_read:{label:`File read`,color:`text-cyan-300 bg-cyan-500/10`},file_outline:{label:`Outline`,color:`text-cyan-300 bg-cyan-500/10`},get_imports:{label:`Imports`,color:`text-cyan-300 bg-cyan-500/10`},get_conventions:{label:`Conventions`,color:`text-emerald-300 bg-emerald-500/10`},get_rules:{label:`Rules`,color:`text-emerald-300 bg-emerald-500/10`},recall_facts:{label:`Recall facts`,color:`text-violet-300 bg-violet-500/10`},unerr_recall_notes:{label:`Recall notes`,color:`text-violet-300 bg-violet-500/10`},unerr_remember:{label:`Remember`,color:`text-violet-300 bg-violet-500/10`},record_fact:{label:`Record fact`,color:`text-violet-300 bg-violet-500/10`},unerr_turn_summary:{label:`Turn summary`,color:`text-zinc-400 bg-white/5`},fetch_url:{label:`Fetch URL`,color:`text-amber-300 bg-amber-500/10`},get_critical_nodes:{label:`Critical nodes`,color:`text-rose-300 bg-rose-500/10`}};function zI(e){let t=[];for(let[n,r]of Object.entries(e)){if(r==null||r===``)continue;let e=typeof r==`string`?r.length>60?`${r.slice(0,60)}…`:r:JSON.stringify(r);t.push(`${n}: ${e}`)}return t.join(`, `)}function BI(e){if(`count`in e&&typeof e.count==`number`)return`${e.count} result${e.count===1?``:`s`}`;if(`found`in e)return e.found?`found`:`not found`;if(`entity_count`in e&&typeof e.entity_count==`number`)return`${e.entity_count} entities`;let t=Object.keys(e);return t.length===0?null:t.slice(0,3).join(`, `)}function VI({toolCalls:e}){return e.length===0?(0,w.jsx)(`p`,{className:`py-4 text-center text-sm t-secondary`,children:`No tool calls recorded for this session.`}):(0,w.jsx)(`div`,{className:`space-y-1.5`,children:e.map((e,t)=>{let n=RI[e.tool],r=n?.label??e.tool,i=n?.color??`text-zinc-400 bg-white/5`,a=zI(e.args_summary),o=BI(e.result_summary);return(0,w.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg bg-muted/20 px-3 py-2`,children:[(0,w.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[10px] font-mono tabular-nums t-tertiary`,children:fI(e.ts)}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 font-mono text-[10px] font-medium ${i}`,children:r}),o?(0,w.jsxs)(`span`,{className:`font-mono text-[10px] tabular-nums text-emerald-400/70`,children:[`→ `,o]}):null]}),a?(0,w.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] leading-relaxed t-secondary`,children:a}):null]}),e.correlation_id?(0,w.jsx)(`span`,{className:`shrink-0 rounded bg-white/5 px-1 py-0.5 font-mono text-[9px] t-tertiary`,title:`Correlated with ${e.correlation_id}`,children:`⤴`}):null]},e.id??`${e.ts}-${t}`)})})}var HI={mark_intent:{icon:`◆`,color:`text-violet-400`,label:`Intent`},mark_decision:{icon:`⟡`,color:`text-cyan-400`,label:`Decision`},mark_blocker:{icon:`⚠`,color:`text-amber-400`,label:`Blocker`},mark_resolution:{icon:`✓`,color:`text-emerald-400`,label:`Resolved`}};function UI({markers:e}){return e.length===0?(0,w.jsx)(`p`,{className:`py-4 text-center text-sm t-secondary`,children:`No markers recorded for this session.`}):(0,w.jsx)(`div`,{className:`space-y-2`,children:e.map((e,t)=>{let n=HI[e.type]??{icon:`·`,color:`text-zinc-400`,label:e.type};return(0,w.jsx)(`div`,{className:`rounded-lg border border-border-subtle bg-muted/20 px-4 py-3`,children:(0,w.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,w.jsx)(`span`,{className:`mt-0.5 text-sm ${n.color}`,children:n.icon}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase ${n.color} bg-white/5`,children:n.label}),(0,w.jsx)(`span`,{className:`ml-auto font-mono text-[10px] tabular-nums t-tertiary`,children:fI(e.ts)})]}),(0,w.jsx)(`p`,{className:`mt-1.5 text-sm text-foreground`,children:e.text}),e.alternatives?(0,w.jsxs)(`div`,{className:`mt-2`,children:[(0,w.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-wide t-tertiary`,children:`Alternatives considered`}),(0,w.jsx)(`ul`,{className:`mt-1 space-y-0.5`,children:e.alternatives.map((e,t)=>(0,w.jsx)(`li`,{className:`text-xs t-secondary before:mr-1.5 before:content-['–']`,children:e},`alt-${t}`))})]}):null,e.file_path?(0,w.jsx)(`code`,{className:`mt-1 inline-block rounded bg-muted/80 px-1.5 py-0.5 font-mono text-[11px] text-foreground/70`,children:e.file_path}):null,e.blocker_ref?(0,w.jsxs)(`p`,{className:`mt-1 text-[11px] t-secondary`,children:[`Resolves blocker`,` `,(0,w.jsx)(`code`,{className:`rounded bg-muted/80 px-1 py-0.5 font-mono text-[10px]`,children:e.blocker_ref})]}):null]})]})},e.id??`${e.ts}-${t}`)})})}function WI({transcript:e}){return e.length===0?(0,w.jsx)(`p`,{className:`py-4 text-center text-sm t-secondary`,children:`No execution trace available for this prompt.`}):(0,w.jsx)(`div`,{className:`space-y-3`,children:e.map((e,t)=>{let n=e.role===`user`;return(0,w.jsxs)(`div`,{className:`rounded-lg border px-4 py-3 ${n?`border-violet-500/20 bg-violet-500/5`:`border-border-subtle bg-muted/20`}`,children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase ${n?`bg-violet-500/20 text-violet-300`:`bg-white/5 text-zinc-400`}`,children:e.role}),e.model?(0,w.jsx)(`span`,{className:`font-mono text-[10px] t-tertiary`,children:e.model}):null,(0,w.jsx)(`span`,{className:`ml-auto font-mono text-[10px] tabular-nums t-tertiary`,children:fI(e.ts)})]}),e.text?(0,w.jsx)(`p`,{className:`line-clamp-4 whitespace-pre-wrap text-xs leading-relaxed text-foreground/80`,children:e.text}):null,e.tools&&e.tools.length>0||e.files&&e.files.length>0?(0,w.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[e.tools?.map(e=>(0,w.jsx)(`span`,{className:`rounded-full bg-cyan-500/10 px-2 py-0.5 font-mono text-[10px] text-cyan-300`,children:e},e)),e.files?.slice(0,5).map(e=>(0,w.jsx)(`span`,{className:`rounded-full bg-white/5 px-2 py-0.5 font-mono text-[10px] t-secondary`,title:e,children:e.split(`/`).pop()},e)),e.files&&e.files.length>5?(0,w.jsxs)(`span`,{className:`text-[10px] t-tertiary`,children:[`+`,e.files.length-5,` more`]}):null]}):null,e.tokens_input>0||e.tokens_output>0?(0,w.jsxs)(`div`,{className:`mt-2 flex gap-3 font-mono text-[10px] tabular-nums t-tertiary`,children:[(0,w.jsxs)(`span`,{children:[mI(e.tokens_input),` in`]}),(0,w.jsxs)(`span`,{children:[mI(e.tokens_output),` out`]})]}):null]},`${e.ts}-${e.role}-${t}`)})})}function GI({optimization:e}){let t=Object.entries(e.mechanisms).sort(([,e],[,t])=>t-e);return(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,w.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] t-tertiary`,children:`Total saved`}),(0,w.jsx)(`span`,{className:`font-mono text-2xl font-bold tabular-nums text-emerald-400`,children:mI(e.total_saved)}),(0,w.jsx)(`span`,{className:`text-xs t-tertiary`,children:`tokens`})]}),t.length>0?(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] t-tertiary`,children:`By mechanism`}),t.map(([t,n])=>{let r=e.total_saved>0?n/e.total_saved*100:0;return(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsx)(`span`,{className:`text-xs text-foreground/80`,children:yI[t]??t.replace(/_/g,` `)}),(0,w.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-foreground`,children:[mI(n),` `,(0,w.jsxs)(`span`,{className:`t-tertiary`,children:[`(`,r.toFixed(0),`%)`]})]})]}),(0,w.jsx)(`div`,{className:`h-1.5 rounded-full bg-white/5`,children:(0,w.jsx)(`div`,{className:`h-1.5 rounded-full bg-emerald-500/60 transition-all`,style:{width:`${Math.max(2,r)}%`}})})]},t)})]}):null]})}function KI({page:e,total:t,pageSize:n,onChange:r}){let i=Math.max(1,Math.ceil(t/n));if(i<=1)return null;let a=Math.max(1,Math.min(e,i)),o=(a-1)*n+1,s=Math.min(a*n,t),c=`rounded-md px-2.5 py-1 font-mono text-xs tabular-nums transition-colors`;return(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-border-subtle bg-card px-4 py-3`,children:[(0,w.jsxs)(`span`,{className:`text-xs t-secondary`,children:[`Showing`,` `,(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-foreground`,children:[o,`–`,s]}),` `,`of`,` `,(0,w.jsx)(`span`,{className:`font-mono tabular-nums text-foreground`,children:mI(t)}),` `,`prompts`]}),(0,w.jsxs)(`nav`,{className:`flex items-center gap-1`,"aria-label":`Pagination`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>r(a-1),disabled:a===1,className:`${c} ${a===1?`t-ghost`:`t-secondary hover:bg-muted hover:text-foreground`}`,children:`‹ Prev`}),(0,w.jsxs)(`span`,{className:`px-2 font-mono text-xs tabular-nums text-foreground`,children:[a,` / `,i]}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>r(a+1),disabled:a===i,className:`${c} ${a===i?`t-ghost`:`t-secondary hover:bg-muted hover:text-foreground`}`,children:`Next ›`})]})]})}function qI(){let{url:e,queryKey:t}=Ot(),n=S(`date`),r=S(`agent`),i=S(`session`),a=S(`page`),o=n||lI(),s=r||``,c=i||``,l=Math.max(1,Number(a??1)||1),u=!n&&!r&&!i&&(!a||a===`1`),d=(0,f.useMemo)(()=>uI(o),[o]),[p,m]=(0,f.useState)(null),h=(0,f.useMemo)(()=>{let e=new URLSearchParams;return d&&(e.set(`from_ts`,d.from_ts),e.set(`to_ts`,d.to_ts)),s&&e.set(`agent`,s),c&&e.set(`session_id`,c),e},[d,s,c]),g=N({queryKey:t([`logbook`,`story`,d?.from_ts??``,d?.to_ts??``,s,c]),queryFn:()=>O(e(`/api/logbook/story?${h.toString()}`)),refetchInterval:cI}),_=N({queryKey:t([`logbook`,`facets`,d?.from_ts??``,d?.to_ts??``]),queryFn:()=>{let t=new URLSearchParams;return d&&(t.set(`from_ts`,d.from_ts),t.set(`to_ts`,d.to_ts)),O(e(`/api/logbook/facets?${t.toString()}`))},refetchInterval:cI}),v=N({queryKey:t([`logbook`,`prompt-feed`,d?.from_ts??``,d?.to_ts??``,s,c,l]),queryFn:()=>{let t=new URLSearchParams(h);return t.set(`limit`,String(sI)),t.set(`offset`,String((l-1)*sI)),O(e(`/api/logbook/prompt-feed?${t.toString()}`))},refetchInterval:cI});(0,f.useEffect)(()=>{m(null)},[o,s,c,l]);let y=g.data?.data,b=_.data?.data,C=v.data?.data??[],T=v.data?.total??0,E=(0,f.useMemo)(()=>{if(C.length===0)return null;let e=C[0];for(let t of C)t.summary.tokens_saved>e.summary.tokens_saved&&(e=t);return`${e.session_id}::${e.turn}`},[C]),ee=e=>{x(e),m(null)},te=()=>{x({date:null,agent:null,session:null,page:null}),m(null)};return g.isLoading&&v.isLoading?(0,w.jsx)(`div`,{className:`space-y-6`,children:(0,w.jsx)(Wt,{count:3})}):(0,w.jsxs)(`div`,{className:`space-y-6`,children:[y?(0,w.jsx)(DI,{totalPrompts:T,totalEvents:y.right_rail.total_events,tokensSaved:y.right_rail.total_tokens_saved}):null,(0,w.jsx)(OI,{date:o,agent:s,sessionId:c,facets:b,onChange:ee,onReset:te,isDefault:u}),(0,w.jsx)(`section`,{"aria-label":`Prompt feed`,children:v.isLoading?(0,w.jsx)(Wt,{count:5}):C.length===0?(0,w.jsxs)(`div`,{className:`flex flex-col items-center gap-2 rounded-xl border border-border-subtle bg-card px-6 py-12 text-center`,children:[(0,w.jsx)(`p`,{className:`text-3xl`,"aria-hidden":`true`,children:`◇`}),(0,w.jsx)(`p`,{className:`text-sm t-secondary`,children:y?.honest_zero?`unerr was quiet — nothing to replay for this view.`:`No prompts match these filters.`}),u?null:(0,w.jsx)(`button`,{type:`button`,onClick:te,className:`mt-1 text-xs text-violet-300 hover:text-violet-200 hover:underline`,children:`Reset to today`})]}):(0,w.jsx)(`div`,{className:`space-y-3`,children:C.map(e=>{let t=`${e.session_id}::${e.turn}`;return(0,w.jsx)(jI,{item:e,isExpanded:p===t,onToggle:()=>m(e=>e===t?null:t),isHighestImpact:t===E},t)})})}),(0,w.jsx)(KI,{page:l,total:T,pageSize:sI,onChange:e=>{x({page:e>1?String(e):null}),m(null),typeof window<`u`&&window.scrollTo({top:0,behavior:`smooth`})}})]})}var JI={"claude-code":{bg:`bg-amber-500/20`,text:`text-amber-400`,label:`Claude Code`},"claude-desktop":{bg:`bg-amber-500/20`,text:`text-amber-400`,label:`Claude Desktop`},cursor:{bg:`bg-blue-500/20`,text:`text-blue-400`,label:`Cursor`},cline:{bg:`bg-emerald-500/20`,text:`text-emerald-400`,label:`Cline`},windsurf:{bg:`bg-cyan-500/20`,text:`text-cyan-400`,label:`Windsurf`},copilot:{bg:`bg-zinc-500/20`,text:`text-zinc-400`,label:`Copilot`},vscode:{bg:`bg-blue-500/20`,text:`text-blue-400`,label:`VS Code`},zed:{bg:`bg-violet-500/20`,text:`text-violet-400`,label:`Zed`},kiro:{bg:`bg-fuchsia-500/20`,text:`text-fuchsia-400`,label:`Kiro`},"gemini-cli":{bg:`bg-cyan-500/20`,text:`text-cyan-400`,label:`Gemini CLI`},codex:{bg:`bg-emerald-500/20`,text:`text-emerald-400`,label:`Codex`},aider:{bg:`bg-rose-500/20`,text:`text-rose-400`,label:`Aider`},opencode:{bg:`bg-violet-500/20`,text:`text-violet-400`,label:`OpenCode`},trae:{bg:`bg-amber-500/20`,text:`text-amber-400`,label:`Trae`},augment:{bg:`bg-emerald-500/20`,text:`text-emerald-400`,label:`Augment`},"github-copilot-cli":{bg:`bg-zinc-500/20`,text:`text-zinc-400`,label:`Copilot CLI`},continue:{bg:`bg-violet-500/20`,text:`text-violet-400`,label:`Continue`},antigravity:{bg:`bg-fuchsia-500/20`,text:`text-fuchsia-400`,label:`Antigravity`}};function YI({name:e}){if(!e)return(0,w.jsx)(`span`,{className:`inline-flex items-center whitespace-nowrap rounded-full bg-white/5 px-2 py-0.5 text-[10px] font-medium t-tertiary ring-1 ring-inset ring-white/10`,children:`unknown`});let t=JI[e.toLowerCase().replace(/\s+/g,`-`)]??{bg:`bg-zinc-500/20`,text:`text-zinc-400`,label:e};return(0,w.jsx)(`span`,{className:`inline-flex items-center whitespace-nowrap rounded-full px-2 py-0.5 ${t.bg} ${t.text} text-[10px] font-medium ring-1 ring-inset ring-white/10`,children:t.label})}function XI({items:e}){return(0,w.jsx)(`nav`,{className:`flex items-center gap-1 text-sm mb-5`,children:e.map((t,n)=>{let r=n===e.length-1;return(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[n>0&&(0,w.jsx)(`span`,{className:`t-ghost select-none`,children:`›`}),r?(0,w.jsx)(`span`,{className:`text-foreground font-medium`,children:t.label}):(0,w.jsx)(`button`,{type:`button`,className:`-mx-0.5 cursor-pointer rounded px-1.5 py-0.5 text-violet-400 transition-colors hover:bg-violet-500/10 hover:text-violet-300`,onClick:t.onClick,children:t.label})]},t.label)})})}var ZI={graph_query:{bg:`bg-violet-500/20`,text:`text-violet-300`,bar:`bg-violet-500`,ring:`ring-violet-500/40`},shell_compression:{bg:`bg-cyan-500/20`,text:`text-cyan-400`,bar:`bg-cyan-500`,ring:`ring-cyan-500/40`},format_encoding:{bg:`bg-amber-500/20`,text:`text-amber-400`,bar:`bg-amber-500`,ring:`ring-amber-500/40`},session_dedup:{bg:`bg-emerald-500/20`,text:`text-emerald-400`,bar:`bg-emerald-500`,ring:`ring-emerald-500/40`},smart_truncation:{bg:`bg-blue-500/20`,text:`text-blue-400`,bar:`bg-blue-500`,ring:`ring-blue-500/40`},file_read:{bg:`bg-indigo-500/20`,text:`text-indigo-400`,bar:`bg-indigo-500`,ring:`ring-indigo-500/40`},fetch_url:{bg:`bg-teal-500/20`,text:`text-teal-400`,bar:`bg-teal-500`,ring:`ring-teal-500/40`}},QI=[`graph_query`,`file_read`,`shell_compression`,`format_encoding`,`session_dedup`,`smart_truncation`,`fetch_url`],$I=new Set([`graph_query`,`file_read`]);function eL(e){let t={key:`intelligence`,tokens:0,events:0,entries:[]},n={key:`compression`,tokens:0,events:0,entries:[]};for(let[r,i]of Object.entries(e)){let e=$I.has(r)?t:n;e.tokens+=i.tokens_saved,e.events+=i.event_count,e.entries.push([r,i])}let r=(e,t)=>t[1].tokens_saved-e[1].tokens_saved;return t.entries.sort(r),n.entries.sort(r),{intelligence:t,compression:n,total:t.tokens+n.tokens}}function tL(e){return e.replace(/_/g,` `)}var nL=new Set([`user_prompt_received`,`surface2_emitted`,`surface2_missed`,`surface4a_emitted`,`presence_ambient_marker`,`fact_capture_abandoned`,`confirmation_expired`]),rL={graph_query_served:`Unnecessary file reads prevented`,full_read_avoided:`Large file dumps prevented`,loop_broken:`Retry loops stopped`,cascade_guard:`Breaking changes caught`,boundary_violation_flagged:`Architecture breaches caught`,incomplete_work_flagged:`Unfinished refactors flagged`,drift_consumed:`Stale file edits prevented`,intervention_halted:`Dangerous operations blocked`,intervention_warned:`Risky patterns flagged`,defuddle_selector_skipped:`Web page noise filtered`,fact_recalled:`Re-explanations prevented`,fact_stored_user_fed:`Rules saved for next session`,fact_stored_auto:`Code patterns learned`,stale_edit_prevented:`Overwrites of new changes stopped`,cascade_warning_consumed:`Downstream breaks prevented`,convention_applied:`Style violations prevented`,caller_check_enforced:`Blind edits prevented`,cross_session_resume:`Cold-start sessions prevented`,resume_blockers_surfaced:`Forgotten blockers resurfaced`,cache_hit:`Redundant computations skipped`,auto_doc_generated:`Code auto-documented`,loop_circuit_breaker_fired:`Agent loops stopped`},iL={graph_query_served:`The agent found the answer in one graph query instead of reading 5-15 files. Each lookup saved multiple turns of trial-and-error searching.`,full_read_avoided:`Only the relevant lines were sent instead of the entire file. Without unerr, the agent loads thousands of lines when it only needed a few.`,loop_broken:`The agent was stuck retrying the same failing operation. unerr detected the pattern and broke the cycle before more turns were wasted.`,cascade_guard:`The agent was about to edit code that many other files depend on. unerr flagged the risk so the change didn't silently break downstream code.`,boundary_violation_flagged:`The agent was about to import across an architecture boundary that must stay isolated. unerr flagged the crossing so the layering didn't silently erode.`,incomplete_work_flagged:`A signature changed this session but some of its callers were never updated. unerr flagged them at session end so they don't surface as runtime or compile breaks later.`,drift_consumed:`The file had changed since the agent last read it. unerr caught this so the agent didn't overwrite newer changes with an outdated version.`,intervention_halted:`A risky tool call was stopped before it could run. Without unerr, the operation would have executed unchecked.`,intervention_warned:`unerr spotted a risky pattern and warned the agent before it committed. Without the warning, the agent would have proceeded blindly.`,defuddle_selector_skipped:`Navigation, footers, and ads were stripped from fetched web pages so only the actual content reached the agent.`,fact_recalled:`Notes from your earlier sessions were surfaced at the right moment, so the agent didn't ask you to repeat yourself.`,fact_stored_user_fed:`Rules you told the agent were saved permanently. Next session, the agent will know these without you repeating them.`,fact_stored_auto:`unerr noticed a convention in your codebase and stored it. Future edits will follow this pattern automatically.`,stale_edit_prevented:`The agent tried to edit a file that was modified after it was last read. unerr stopped the edit to prevent overwriting your recent work.`,cascade_warning_consumed:`Code that depends on the edited file was identified and the agent was warned before making changes that would ripple through.`,convention_applied:`Project conventions (naming, imports, structure) were applied automatically, so new code matched your existing style.`,caller_check_enforced:`unerr checked who calls this code before allowing the edit. Without it, changes would land without knowing what else they break.`,cross_session_resume:`Context from your last session was restored, so the agent picked up where it left off instead of starting from scratch.`,resume_blockers_surfaced:`Unresolved problems from a previous session were brought forward so they didn't fall through the cracks.`,cache_hit:`A previously computed answer was served from cache instead of being recomputed, saving time and tokens.`,auto_doc_generated:`Documentation was generated automatically for code the agent wrote or modified.`,loop_circuit_breaker_fired:`The agent was repeating the same failing operation. unerr detected the loop and stopped it.`};function Q(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function aL(e){let t=Date.now()-new Date(e).getTime(),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<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function oL(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function sL(e){return ZI[e]??{bg:`bg-zinc-500/20`,text:`text-zinc-400`,bar:`bg-zinc-500`,ring:`ring-zinc-500/40`}}function cL(e){let t=e.detail;if(!t)return e.tool??`token rescue`;if(t.command){let e=String(t.command);return e.length>80?`${e.slice(0,77)}…`:e}return t.optimization?String(t.optimization):t.counterfactual&&t.counterfactual!==`generic file exploration`?String(t.counterfactual):t.format?`${e.tool??`query`} → ${t.format} format`:e.tool??`token rescue`}function lL(e){if(e.length===0)return{label:`Empty turn`,subtitle:``};let t=[...new Set(e.map(e=>e.tool).filter(Boolean))],n=[...new Set(e.map(e=>e.mechanism))],r=e.find(e=>e.detail?.command);if(r){let t=String(r.detail?.command);return{label:t.length>60?`${t.slice(0,57)}…`:t,subtitle:`shell → ${e.length} rescue${e.length>1?`s`:``}`}}let i=e.find(e=>e.detail?.optimization);if(i){let n=String(i.detail?.optimization),r=e.length>1?` +${e.length-1} more`:``;return{label:n,subtitle:t.join(`, `)+r}}if(t.length>0){let r=t.join(` → `),i=e.length,a=n[0]?.replace(/_/g,` `)??``;return{label:r,subtitle:`${i} event${i>1?`s`:``} · ${a}`}}return{label:n.map(e=>e.replace(/_/g,` `)).join(`, `),subtitle:`${e.length} event${e.length>1?`s`:``}`}}function uL({mechanism:e}){let t=sL(e);return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5 ${t.bg} ${t.text} text-[10px] font-medium ring-1 ring-inset ${t.ring}`,children:[(0,w.jsx)(`span`,{className:`h-1 w-1 rounded-full ${t.bar}`,"aria-hidden":!0}),e.replace(/_/g,` `)]})}function dL(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function fL(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function pL({label:e,value:t,accent:n,hint:r,sub:i}){return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4`,title:r,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wider`,children:e}),(0,w.jsx)(`p`,{className:`mt-1 text-2xl font-bold font-mono tabular-nums ${n}`,children:t}),i&&(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-1 leading-snug`,children:i})]})}function mL({trace:e}){let t=e.prompt;return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-l-4 border-violet-500/50`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 mb-2 flex-wrap`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] uppercase tracking-wider`,children:`Prompt`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs font-mono`,children:[`turn `,e.turn]}),(0,w.jsx)(YI,{name:e.agent}),t?.classified_as&&(0,w.jsx)(`span`,{className:`rounded-full bg-violet-500/15 text-violet-300 px-2 py-0.5 text-[10px] font-medium`,children:t.classified_as})]}),t?.prompt?(0,w.jsxs)(`p`,{className:`text-foreground text-lg leading-snug italic`,children:[`"`,t.prompt,`"`]}):t?(0,w.jsxs)(`p`,{className:`t-secondary text-sm`,children:[`Prompt not captured —`,` `,(0,w.jsxs)(`span`,{className:`font-mono`,children:[`set `,(0,w.jsx)(`span`,{className:`text-amber-400`,children:`capture_prompts: true`}),` in .unerr/config.json`]}),` `,`to record verbatim text (`,t.length,` chars this turn).`]}):(0,w.jsx)(`p`,{className:`t-tertiary text-sm`,children:`No prompt captured for this turn (agent does not emit the UserPromptSubmit hook).`})]})}function hL({trace:e}){let t=e.tokens_used;if(e.transcript_available&&t)return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-t-2 border-cyan-500/60`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 flex-wrap`,children:[(0,w.jsx)(`p`,{className:`text-cyan-400 text-[10px] uppercase tracking-wider font-medium`,children:`Tokens used (actual)`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px]`,children:[`from `,e.agent??`agent`,`'s own session log`]})]}),(0,w.jsx)(`p`,{className:`text-3xl font-bold font-mono text-cyan-400 mt-2`,children:dL(t.total)}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 mt-2 t-secondary text-xs font-mono`,children:[(0,w.jsxs)(`span`,{children:[dL(t.input),` in`]}),(0,w.jsxs)(`span`,{children:[dL(t.output),` out`]}),(0,w.jsxs)(`span`,{children:[dL(t.cache_create),` cache-write`]}),(0,w.jsxs)(`span`,{children:[dL(t.cache_read),` cache-read`]})]})]});let n=e.capability?e.flag_on?`No matching transcript was found for this prompt.`:`Reading the agent's own session log is opt-in.`:`${e.agent??`This agent`} has no transcript reader — actual token usage is only available for Claude Code and Cursor.`;return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-t-2 border-zinc-600/60`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wider font-medium`,children:`Tokens used (actual)`}),(0,w.jsx)(`p`,{className:`text-2xl font-bold font-mono t-tertiary mt-2`,children:`—`}),(0,w.jsx)(`p`,{className:`t-secondary text-xs mt-2 leading-snug`,children:n}),e.capability&&!e.flag_on&&(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-1 font-mono leading-snug`,children:`set read_agent_transcripts: true in .unerr/config.json`})]})}var gL={"tokenflow.shell_compression":`Compressed command output`,"tokenflow.file_read":`Delivered targeted file content`,"tokenflow.persistent_memory":`Used stored knowledge`,"tokenflow.format_encoding":`Encoded response compactly`,"tokenflow.response_dedup":`Removed duplicate content`,"tokenflow.context_rot_prevention":`Cleaned stale context`,"tokenflow.instruction_reinforcement":`Reinforced agent instructions`,drift_consumed:`Caught file drift`,stale_edit_prevented:`Prevented stale edit`,cascade_warning_consumed:`Protected dependent code`,convention_consumed:`Applied project conventions`,fact_recalled:`Recalled stored knowledge`,fact_captured:`Learned new project fact`,user_prompt_received:`Received prompt`,presence_ambient_marker:`Active monitoring`,loop_circuit_breaker_fired:`Stopped a loop`,auto_doc_generated:`Auto-documented code`,defuddle_selector_skipped:`Recovered from parse issue`};function _L(e){let t=e.metadata??{},n=typeof t.file_path==`string`?t.file_path:typeof t.file==`string`?t.file:e.entity_key;switch(e.event_type){case`tokenflow.shell_compression`:{let e=typeof t.command==`string`?t.command:null;return e?`Compressed output of "${vL(e,60)}"`:`Compressed a long command output`}case`tokenflow.file_read`:return n?`Delivered only the relevant lines from ${vL(n,50)}`:`Delivered targeted file content`;case`tokenflow.persistent_memory`:return`Used stored project knowledge instead of re-reading files`;case`tokenflow.format_encoding`:return`Encoded the response compactly to save tokens`;case`tokenflow.response_dedup`:return`Removed duplicate information the agent already had`;case`tokenflow.context_rot_prevention`:return`Cleaned stale context that would have confused the agent`;case`tokenflow.instruction_reinforcement`:return`Reinforced agent instructions to keep it on track`;case`drift_consumed`:return n?`Caught that ${vL(n,50)} changed since last read`:`Caught a file change the agent hadn't seen`;case`stale_edit_prevented`:return n?`Stopped the agent from overwriting changes in ${vL(n,50)}`:`Prevented the agent from overwriting new changes`;case`cascade_warning_consumed`:return n?`Warned about code that depends on ${vL(n,50)}`:`Warned about downstream code dependencies`;case`convention_consumed`:return n?`Applied project conventions for ${vL(n,50)}`:`Applied project coding conventions`;case`fact_recalled`:{let e=typeof t.content==`string`?t.content:typeof t.source_quote==`string`?t.source_quote:null;return e?`Recalled: "${vL(e)}"`:`Recalled stored project knowledge`}case`fact_captured`:{let e=typeof t.content==`string`?t.content:typeof t.source_quote==`string`?t.source_quote:null;return e?`Learned: "${vL(e)}"`:`Learned a new project fact`}case`loop_circuit_breaker_fired`:return`Detected and stopped a repetitive agent loop`;default:return gL[e.event_type]??e.event_type.replace(/_/g,` `)}}function vL(e,t=80){return e.length>t?`${e.slice(0,t)}…`:e}var yL={"tokenflow.shell_compression":`📦`,"tokenflow.file_read":`📄`,"tokenflow.persistent_memory":`🧠`,"tokenflow.format_encoding":`🗜️`,"tokenflow.response_dedup":`♻️`,"tokenflow.context_rot_prevention":`🧹`,"tokenflow.instruction_reinforcement":`📋`,drift_consumed:`🔄`,stale_edit_prevented:`🛡️`,cascade_warning_consumed:`⚠️`,convention_consumed:`📐`,fact_recalled:`💡`,fact_captured:`📝`,user_prompt_received:`💬`,presence_ambient_marker:`👁️`,loop_circuit_breaker_fired:`🔴`,auto_doc_generated:`📖`},bL={search_code:{color:`text-cyan-400`,label:`Search`},file_read:{color:`text-blue-400`,label:`Read`},file_outline:{color:`text-blue-400`,label:`Read`},get_entity:{color:`text-blue-400`,label:`Read`},get_references:{color:`text-purple-400`,label:`Graph`},get_imports:{color:`text-purple-400`,label:`Graph`},get_critical_nodes:{color:`text-purple-400`,label:`Graph`},get_conventions:{color:`text-indigo-400`,label:`Conventions`},get_rules:{color:`text-indigo-400`,label:`Conventions`},recall_facts:{color:`text-amber-400`,label:`Memory`},unerr_recall_notes:{color:`text-amber-400`,label:`Memory`},unerr_remember:{color:`text-amber-400`,label:`Memory`},record_fact:{color:`text-amber-400`,label:`Memory`},unerr_turn_summary:{color:`text-emerald-400`,label:`Summary`}},xL={mark_intent:{icon:`🎯`,color:`text-violet-400`,label:`Intent`},mark_decision:{icon:`⚖️`,color:`text-cyan-400`,label:`Decision`},mark_blocker:{icon:`🚧`,color:`text-amber-400`,label:`Blocker`},mark_resolution:{icon:`✅`,color:`text-emerald-400`,label:`Resolution`}};function SL({attribution:e}){let t=e?.recalls??[],n=e?.captures??[],r=e?.drift??[];return t.length+n.length+r.length===0?null:(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:`Memory activity`}),(0,w.jsxs)(`div`,{className:`space-y-2`,children:[t.map((e,t)=>(0,w.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,w.jsx)(`span`,{className:`text-amber-400 shrink-0`,children:`💡`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`text-amber-400 text-xs font-medium`,children:`Recalled`}),(0,w.jsx)(`p`,{className:`t-secondary text-xs mt-0.5 leading-snug`,children:vL(e.content||e.source_quote,120)})]})]},`recall-${t}`)),n.map((e,t)=>(0,w.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,w.jsx)(`span`,{className:`text-emerald-400 shrink-0`,children:`📝`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`text-emerald-400 text-xs font-medium`,children:`Learned`}),(0,w.jsx)(`p`,{className:`t-secondary text-xs mt-0.5 leading-snug`,children:vL(e.content||e.source_quote,120)})]})]},`capture-${t}`)),r.map((e,t)=>(0,w.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,w.jsx)(`span`,{className:`text-red-400 shrink-0`,children:`🔄`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`text-red-400 text-xs font-medium`,children:`Drift caught`}),(0,w.jsx)(`p`,{className:`font-mono text-xs t-secondary mt-0.5`,children:e.file_path})]})]},`drift-${t}`))]})]})}function CL({events:e}){let t=e.filter(e=>e.event_type!==`user_prompt_received`&&e.event_type!==`presence_ambient_marker`);return t.length===0?null:(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:[`What happened (`,t.length,` event`,t.length===1?``:`s`,`)`]}),(0,w.jsx)(`div`,{className:`space-y-2`,children:t.map((e,t)=>{let n=yL[e.event_type]??`•`,r=e.event_type.startsWith(`tokenflow.`)?e.metadata.tokens_saved:null;return(0,w.jsxs)(`div`,{className:`flex items-start gap-2 group`,children:[(0,w.jsx)(`span`,{className:`shrink-0 text-sm`,children:n}),(0,w.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,w.jsx)(`p`,{className:`text-foreground text-xs leading-snug`,children:_L(e)}),r!=null&&r>0&&(0,w.jsxs)(`span`,{className:`text-emerald-400/70 text-[10px] font-mono`,children:[`saved `,dL(r),` tokens`]})]}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] font-mono shrink-0 opacity-0 group-hover:opacity-100 transition-opacity`,children:new Date(e.ts).toLocaleTimeString()})]},t)})})]})}function wL({toolCalls:e}){let[t,n]=(0,f.useState)(null);return e.length===0?null:(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:[`Agent queries to unerr (`,e.length,`)`]}),(0,w.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>{let r=bL[e.tool]??{color:`t-secondary`,label:`Tool`},i=t===e.id;return(0,w.jsxs)(`div`,{className:`rounded border border-border-subtle/30`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-surface-secondary/50 transition-colors`,onClick:()=>n(i?null:e.id),children:[(0,w.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider ${r.color}`,children:r.label}),(0,w.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e.tool}),(0,w.jsx)(`span`,{className:`flex-1`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:new Date(e.ts).toLocaleTimeString()}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:i?`▾`:`▸`})]}),i&&(0,w.jsxs)(`div`,{className:`px-3 pb-2 space-y-1.5 border-t border-border-subtle/20`,children:[Object.keys(e.args_summary).length>0&&(0,w.jsxs)(`div`,{className:`mt-1.5`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wider mb-0.5`,children:`Args`}),(0,w.jsx)(`pre`,{className:`text-[11px] font-mono t-secondary whitespace-pre-wrap break-all bg-surface-secondary/30 rounded p-1.5`,children:EL(e.args_summary)})]}),Object.keys(e.result_summary).length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wider mb-0.5`,children:`Result`}),(0,w.jsx)(`pre`,{className:`text-[11px] font-mono t-secondary whitespace-pre-wrap break-all bg-surface-secondary/30 rounded p-1.5`,children:EL(e.result_summary)})]})]})]},e.id)})})]})}function TL({markers:e}){return e.length===0?null:(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:[`Session markers (`,e.length,`)`]}),(0,w.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let t=xL[e.type]??{icon:`📌`,color:`t-secondary`,label:e.type};return(0,w.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,w.jsx)(`span`,{className:`shrink-0`,children:t.icon}),(0,w.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,w.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider ${t.color}`,children:t.label}),(0,w.jsx)(`p`,{className:`text-foreground text-xs leading-snug mt-0.5`,children:e.text}),e.alternatives&&e.alternatives.length>0&&(0,w.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.alternatives.map((e,t)=>(0,w.jsxs)(`span`,{className:`text-[10px] t-tertiary bg-surface-secondary rounded px-1.5 py-0.5`,children:[`alt: `,e]},t))}),e.file_path&&(0,w.jsx)(`p`,{className:`font-mono text-[10px] t-tertiary mt-0.5`,children:e.file_path})]}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] font-mono shrink-0`,children:new Date(e.ts).toLocaleTimeString()})]},e.id)})})]})}function EL(e){let t=[];for(let[n,r]of Object.entries(e)){if(r==null)continue;let e=typeof r==`string`?vL(r,100):typeof r==`number`||typeof r==`boolean`?String(r):JSON.stringify(r).slice(0,100);t.push(`${n}: ${e}`)}return t.join(`
|
|
916
|
-
`)||`(empty)`}function DL(){let{url:e,queryKey:t}=Ot(),n=S(`session`),r=S(`turn`),i=Number(r),a=!!n&&Number.isInteger(i)&&i>=0,o=N({queryKey:t([`prompt-trace`,n,r]),queryFn:()=>O(e(`/api/prompt-trace/${encodeURIComponent(n??``)}/${i}`)),enabled:a,refetchInterval:5e3});if(!a)return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-10 text-center`,children:[(0,w.jsx)(`p`,{className:`t-secondary text-lg`,children:`No prompt selected`}),(0,w.jsxs)(`p`,{className:`t-tertiary mt-2 text-sm`,children:[`Open a prompt trace from`,` `,(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors`,onClick:()=>y(`logbook`),children:`What unerr did`}),` `,`or the Activity timeline.`]})]});let s=[{label:`What unerr did`,onClick:()=>y(`logbook`)},{label:`Prompt · turn ${i}`}];if(o.isLoading)return(0,w.jsxs)(`div`,{children:[(0,w.jsx)(XI,{items:s}),(0,w.jsx)(Wt,{n:4})]});let c=o.data?.data;if(!c)return(0,w.jsxs)(`div`,{children:[(0,w.jsx)(XI,{items:s}),(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-8 text-center`,children:(0,w.jsxs)(`p`,{className:`t-secondary`,children:[`No trace for session `,n?.slice(0,12),` · turn `,i]})})]});let l=c.reasoning,u=c.events??[],d=c.attribution??{recalls:[],captures:[],drift:[]},f=c.tool_calls??[],p=c.markers??[],m=u.length+f.length+p.length;return(0,w.jsxs)(`div`,{className:`space-y-5`,children:[(0,w.jsx)(XI,{items:s}),(0,w.jsx)(mL,{trace:c}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 md:grid-cols-4`,children:[(0,w.jsx)(pL,{label:`Tokens saved`,value:dL(c.tokens_saved),accent:`text-emerald-400`,hint:`Tokens unerr kept out of context this turn.`,sub:c.mechanisms.length>0?`${c.mechanisms.length} mechanism${c.mechanisms.length===1?``:`s`}`:void 0}),(0,w.jsx)(pL,{label:`Noise removed`,value:`${l.noise_removed_pct}%`,accent:`text-violet-400`,hint:`Noise removed from context (graph-backed vs grep/glob).`,sub:l.first_call_resolution_rate>=50?`found first try ✓`:`${l.first_call_resolution_rate}% first-try`}),(0,w.jsx)(pL,{label:`Turns saved`,value:`~${l.turns_saved}`,accent:`text-cyan-400`,hint:`Estimated agent turns saved by unerr's precision.`}),(0,w.jsx)(pL,{label:`Activity`,value:String(m),accent:`text-foreground`,hint:`Total events, tool queries, and markers this turn.`,sub:`${u.length} events · ${f.length} queries · ${p.length} markers`})]}),(0,w.jsx)(hL,{trace:c}),(0,w.jsx)(SL,{attribution:d}),(0,w.jsx)(CL,{events:u}),(0,w.jsx)(wL,{toolCalls:f}),(0,w.jsx)(TL,{markers:p}),c.mechanisms.length>0&&(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:`Savings mechanisms`}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:c.mechanisms.map(e=>(0,w.jsx)(uL,{mechanism:e},e))})]}),(0,w.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:[`Files touched (`,c.files.length,`)`]}),c.files.length===0?(0,w.jsx)(`p`,{className:`t-tertiary text-xs`,children:`No files touched this turn.`}):(0,w.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:c.files.map(e=>(0,w.jsx)(`span`,{className:`inline-flex items-center rounded bg-surface-secondary px-2 py-0.5 font-mono text-[11px] text-foreground`,title:e,children:fL(e)},e))}),c.tools.length>0&&(0,w.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-border-subtle/50`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wider mb-1.5`,children:`Tools used`}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:c.tools.map(e=>(0,w.jsx)(`span`,{className:`font-mono text-[11px] t-secondary`,children:e},e))})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:`Breakages caught`}),c.drift_caught>0?(0,w.jsxs)(`p`,{className:`text-amber-400 font-mono text-2xl font-bold`,children:[c.drift_caught,(0,w.jsxs)(`span`,{className:`t-secondary text-xs font-normal ml-2`,children:[`stale-edit / drift catch`,c.drift_caught===1?``:`es`]})]}):(0,w.jsx)(`p`,{className:`t-tertiary text-xs`,children:`No drift or stale-edit catches this turn.`})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4 flex flex-wrap items-center justify-center gap-x-6 gap-y-2 text-xs`,children:[(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`token-trace`,{session:c.session_id,turn:String(c.turn)}),children:`See token-by-token in Token Trace →`}),(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`reasoning`,{session:c.session_id}),children:`See reasoning detail in Reasoning Trace →`})]})]})}function OL(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var kL={},AL={};function jL(e,t){try{let n=(kL[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in AL?AL[n]:NL(n,n.split(`:`))}catch{if(e in AL)return AL[e];let t=e?.match(ML);return t?NL(e,t.slice(1)):NaN}}var ML=/([+-]\d\d):?(\d\d)?/;function NL(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return AL[e]=n*60+r>0?n*60+r+i:n*60-r-i}var PL=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(jL(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),RL(this,NaN),IL(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-jL(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),IL(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},FL=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!FL.test(e))return;let t=e.replace(FL,`$1UTC`);PL.prototype[t]&&(e.startsWith(`get`)?PL.prototype[e]=function(){return this.internal[t]()}:(PL.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),LL(this),+this},PL.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),IL(this),+this}))});function IL(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-jL(e.timeZone,e)*60))}function LL(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),RL(e)}function RL(e){let t=jL(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);let i=-new Date(+e).getTimezoneOffset(),a=i- -new Date(+r).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=i-n;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=new Date(+e);c.setUTCSeconds(0);let l=i>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(jL(e.timeZone,e)*60))%60;(u||l)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+l));let d=jL(e.timeZone,e),f=d>0?Math.floor(d):Math.ceil(d),p=-new Date(+e).getTimezoneOffset()-f,m=f!==n,h=p-s;if(m&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);let t=jL(e.timeZone,e),n=f-(t>0?Math.floor(t):Math.ceil(t));n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var zL=class e extends PL{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${OL(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},BL=365.2425,VL=6048e5,HL=864e5,UL=3600*24;UL*7,UL*BL/12*3;var WL=Symbol.for(`constructDateFrom`);function GL(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&WL in e?e[WL](t):e instanceof Date?new e.constructor(t):new Date(t)}function KL(e,t){return GL(t||e,e)}function qL(e,t,n){let r=KL(e,n?.in);return isNaN(t)?GL(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function JL(e,t,n){let r=KL(e,n?.in);if(isNaN(t))return GL(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=GL(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}var YL={};function XL(){return YL}function ZL(e,t){let n=XL(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=KL(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function QL(e,t){return ZL(e,{...t,weekStartsOn:1})}function $L(e,t){let n=KL(e,t?.in),r=n.getFullYear(),i=GL(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=QL(i),o=GL(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=QL(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function eR(e){let t=KL(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function tR(e,...t){let n=GL.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function nR(e,t){let n=KL(e,t?.in);return n.setHours(0,0,0,0),n}function rR(e,t,n){let[r,i]=tR(n?.in,e,t),a=nR(r),o=nR(i),s=+a-eR(a),c=+o-eR(o);return Math.round((s-c)/HL)}function iR(e,t){let n=$L(e,t),r=GL(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),QL(r)}function aR(e,t,n){return qL(e,t*7,n)}function oR(e,t,n){return JL(e,t*12,n)}function sR(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=GL.bind(null,e));let t=KL(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),GL(r,n||NaN)}function cR(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=GL.bind(null,e));let t=KL(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),GL(r,n||NaN)}function lR(e,t,n){let[r,i]=tR(n?.in,e,t);return+nR(r)==+nR(i)}function uR(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function dR(e){return!(!uR(e)&&typeof e!=`number`||isNaN(+KL(e)))}function fR(e,t,n){let[r,i]=tR(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function pR(e,t){let n=KL(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function mR(e,t){let[n,r]=tR(e,t.start,t.end);return{start:n,end:r}}function hR(e,t){let{start:n,end:r}=mR(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(GL(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function gR(e,t){let n=KL(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function _R(e,t){let n=KL(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function vR(e,t){let n=KL(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function yR(e,t){let{start:n,end:r}=mR(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(GL(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function bR(e,t){let n=XL(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=KL(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function xR(e,t){return bR(e,{...t,weekStartsOn:1})}var SR={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},CR=(e,t,n)=>{let r,i=SR[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function wR(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var TR={date:wR({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:wR({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:wR({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},ER={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},DR=(e,t,n,r)=>ER[e];function OR(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var kR={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:OR({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:OR({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:OR({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:OR({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:OR({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function AR(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?MR(s,e=>e.test(o)):jR(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function jR(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function MR(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function NR(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var PR={code:`en-US`,formatDistance:CR,formatLong:TR,formatRelative:DR,localize:kR,match:{ordinalNumber:NR({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:AR({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:AR({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:AR({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:AR({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:AR({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function FR(e,t){let n=KL(e,t?.in);return rR(n,vR(n))+1}function IR(e,t){let n=KL(e,t?.in),r=QL(n)-+iR(n);return Math.round(r/VL)+1}function LR(e,t){let n=KL(e,t?.in),r=n.getFullYear(),i=XL(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=GL(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=ZL(o,t),c=GL(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=ZL(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function RR(e,t){let n=XL(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=LR(e,t),a=GL(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),ZL(a,t)}function zR(e,t){let n=KL(e,t?.in),r=ZL(n,t)-+RR(n,t);return Math.round(r/VL)+1}function BR(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var VR={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return BR(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):BR(n+1,2)},d(e,t){return BR(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return BR(e.getHours()%12||12,t.length)},H(e,t){return BR(e.getHours(),t.length)},m(e,t){return BR(e.getMinutes(),t.length)},s(e,t){return BR(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return BR(Math.trunc(r*10**(n-3)),t.length)}},HR={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},UR={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return VR.y(e,t)},Y:function(e,t,n,r){let i=LR(e,r),a=i>0?i:1-i;return t===`YY`?BR(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):BR(a,t.length)},R:function(e,t){return BR($L(e),t.length)},u:function(e,t){return BR(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return BR(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return BR(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return VR.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return BR(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=zR(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):BR(i,t.length)},I:function(e,t,n){let r=IR(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):BR(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):VR.d(e,t)},D:function(e,t,n){let r=FR(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):BR(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return BR(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return BR(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return BR(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?HR.noon:r===0?HR.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?HR.evening:r>=12?HR.afternoon:r>=4?HR.morning:HR.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return VR.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):VR.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):BR(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):BR(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):VR.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):VR.s(e,t)},S:function(e,t){return VR.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return GR(r);case`XXXX`:case`XX`:return KR(r);default:return KR(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return GR(r);case`xxxx`:case`xx`:return KR(r);default:return KR(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+WR(r,`:`);default:return`GMT`+KR(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+WR(r,`:`);default:return`GMT`+KR(r,`:`)}},t:function(e,t,n){return BR(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return BR(+e,t.length)}};function WR(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+BR(a,2)}function GR(e,t){return e%60==0?(e>0?`-`:`+`)+BR(Math.abs(e)/60,2):KR(e,t)}function KR(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=BR(Math.trunc(r/60),2),a=BR(r%60,2);return n+i+t+a}var qR=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},JR=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},YR={p:JR,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return qR(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,qR(r,t)).replace(`{{time}}`,JR(i,t))}},XR=/^D+$/,ZR=/^Y+$/,QR=[`D`,`DD`,`YY`,`YYYY`];function $R(e){return XR.test(e)}function ez(e){return ZR.test(e)}function tz(e,t,n){let r=nz(e,t,n);if(console.warn(r),QR.includes(e))throw RangeError(r)}function nz(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var rz=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,iz=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,az=/^'([^]*?)'?$/,oz=/''/g,sz=/[a-zA-Z]/;function cz(e,t,n){let r=XL(),i=n?.locale??r.locale??PR,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=KL(e,n?.in);if(!dR(s))throw RangeError(`Invalid time value`);let c=t.match(iz).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=YR[t];return n(e,i.formatLong)}return e}).join(``).match(rz).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:lz(e)};if(UR[t])return{isToken:!0,value:e};if(t.match(sz))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&ez(a)||!n?.useAdditionalDayOfYearTokens&&$R(a))&&tz(a,t,String(e));let o=UR[a[0]];return o(s,a,i.localize,l)}).join(``)}function lz(e){let t=e.match(az);return t?t[1].replace(oz,`'`):e}function uz(e,t){let n=KL(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=GL(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function dz(e,t){return KL(e,t?.in).getMonth()}function fz(e,t){return KL(e,t?.in).getFullYear()}function pz(e,t){return+KL(e)>+KL(t)}function mz(e,t){return+KL(e)<+KL(t)}function hz(e,t,n){let[r,i]=tR(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function gz(e,t,n){let[r,i]=tR(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function _z(e,t,n){let r=KL(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=GL(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=uz(o);return r.setMonth(t,Math.min(a,s)),r}function vz(e,t,n){let r=KL(e,n?.in);return isNaN(+r)?GL(n?.in||e,NaN):(r.setFullYear(t),r)}var yz=5,bz=4;function xz(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,yz*7-1);return t.getMonth(e)===t.getMonth(a)?yz:bz}function Sz(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function Cz(e,t){let n=Sz(e,t),r=xz(e,t);return t.addDays(n,r*7-1)}var wz={...PR,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>cz(e,t,{locale:PR,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>cz(e,n,{locale:PR,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>cz(e,t,{locale:PR,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>cz(e,n,{locale:PR,...t}),r(e,`cccc`)}}},Tz=class e{constructor(e,t){this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?zL.tz(this.options.timeZone):new(this.options.Date??Date),this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new zL(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):qL(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):JL(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):aR(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):oR(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):rR(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):fR(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):hR(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):yR(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):Cz(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):xR(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):pR(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):bR(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):_R(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):cz(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):IR(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):dz(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):fz(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):zR(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):pz(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):mz(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):uR(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):lR(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):hz(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):gz(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):sR(e),this.min=e=>this.overrides?.min?this.overrides.min(e):cR(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):_z(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):vz(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):Sz(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):nR(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):QL(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):gR(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):ZL(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):vR(e),this.options={locale:wz,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};Tz.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var Ez=new Tz,Dz=class{constructor(e,t,n=Ez){this.date=e,this.displayMonth=t,this.outside=!!(t&&!n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},Oz=class{constructor(e,t){this.date=e,this.weeks=t}},kz=class{constructor(e,t){this.days=t,this.weekNumber=e}};function Az(e){return f.createElement(`span`,{...e})}function jz(e){let{size:t=24,orientation:n=`left`,className:r}=e;return f.createElement(`svg`,{className:r,width:t,height:t,viewBox:`0 0 24 24`},n===`up`&&f.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),n===`down`&&f.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),n===`left`&&f.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),n===`right`&&f.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function Mz(e){let{day:t,modifiers:n,...r}=e;return f.createElement(`td`,{...r})}function Nz(e){let{day:t,modifiers:n,...r}=e,i=f.useRef(null);return f.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),f.createElement(`button`,{ref:i,...r})}var $;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})($||={});var Pz;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(Pz||={});var Fz;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(Fz||={});var Iz;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})(Iz||={});var Lz=(0,f.createContext)(void 0);function Rz(){let e=(0,f.useContext)(Lz);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function zz(e){let{options:t,className:n,...r}=e,{classNames:i,components:a}=Rz(),o=[i[$.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===r.value);return f.createElement(`span`,{"data-disabled":r.disabled,className:i[$.DropdownRoot]},f.createElement(a.Select,{className:o,...r},t?.map(({value:e,label:t,disabled:n})=>f.createElement(a.Option,{key:e,value:e,disabled:n},t))),f.createElement(`span`,{className:i[$.CaptionLabel],"aria-hidden":!0},s?.label,f.createElement(a.Chevron,{orientation:`down`,size:18,className:i[$.Chevron]})))}function Bz(e){return f.createElement(`div`,{...e})}function Vz(e){return f.createElement(`div`,{...e})}function Hz(e){let{calendarMonth:t,displayIndex:n,...r}=e;return f.createElement(`div`,{...r},e.children)}function Uz(e){let{calendarMonth:t,displayIndex:n,...r}=e;return f.createElement(`div`,{...r})}function Wz(e){return f.createElement(`table`,{...e})}function Gz(e){return f.createElement(`div`,{...e})}function Kz(e){let{components:t}=Rz();return f.createElement(t.Dropdown,{...e})}function qz(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=Rz(),u=(0,f.useCallback)(e=>{i&&n?.(e)},[i,n]),d=(0,f.useCallback)(e=>{r&&t?.(e)},[r,t]);return f.createElement(`nav`,{...a},f.createElement(o.PreviousMonthButton,{type:`button`,className:s[$.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:d},f.createElement(o.Chevron,{disabled:r?void 0:!0,className:s[$.Chevron],orientation:`left`})),f.createElement(o.NextMonthButton,{type:`button`,className:s[$.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":l(i),onClick:u},f.createElement(o.Chevron,{disabled:i?void 0:!0,orientation:`right`,className:s[$.Chevron]})))}function Jz(e){return f.createElement(`button`,{...e})}function Yz(e){return f.createElement(`option`,{...e})}function Xz(e){return f.createElement(`button`,{...e})}function Zz(e){let{rootRef:t,...n}=e;return f.createElement(`div`,{...n,ref:t})}function Qz(e){return f.createElement(`select`,{...e})}function $z(e){let{week:t,...n}=e;return f.createElement(`tr`,{...n})}function eB(e){return f.createElement(`th`,{...e})}function tB(e){return f.createElement(`thead`,{"aria-hidden":!0},f.createElement(`tr`,{...e}))}function nB(e){let{week:t,...n}=e;return f.createElement(`th`,{...n})}function rB(e){return f.createElement(`th`,{...e})}function iB(e){return f.createElement(`tbody`,{...e})}function aB(e){let{components:t}=Rz();return f.createElement(t.Dropdown,{...e})}var oB=s({CaptionLabel:()=>Az,Chevron:()=>jz,Day:()=>Mz,DayButton:()=>Nz,Dropdown:()=>zz,DropdownNav:()=>Bz,Footer:()=>Vz,Month:()=>Hz,MonthCaption:()=>Uz,MonthGrid:()=>Wz,Months:()=>Gz,MonthsDropdown:()=>Kz,Nav:()=>qz,NextMonthButton:()=>Jz,Option:()=>Yz,PreviousMonthButton:()=>Xz,Root:()=>Zz,Select:()=>Qz,Week:()=>$z,WeekNumber:()=>nB,WeekNumberHeader:()=>rB,Weekday:()=>eB,Weekdays:()=>tB,Weeks:()=>iB,YearsDropdown:()=>aB});function sB(e,t,n=!1,r=Ez){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function cB(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function lB(e){return!!(e&&typeof e==`object`&&`from`in e)}function uB(e){return!!(e&&typeof e==`object`&&`after`in e)}function dB(e){return!!(e&&typeof e==`object`&&`before`in e)}function fB(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function pB(e,t){return Array.isArray(e)&&e.every(t.isDate)}function mB(e,t,n=Ez){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(pB(t,n))return t.some(t=>i(e,t));if(lB(t))return sB(t,e,!1,n);if(fB(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(cB(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return uB(t)?a(e,t.after)>0:dB(t)?a(t.before,e)>0:typeof t==`function`?t(e):!1})}function hB(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[Pz.focused]:[],[Pz.outside]:[],[Pz.disabled]:[],[Pz.hidden]:[],[Pz.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!!(n&&!f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&mB(e,a,i)),S=!!(o&&mB(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&mB(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[Pz.focused]:!1,[Pz.disabled]:!1,[Pz.hidden]:!1,[Pz.outside]:!1,[Pz.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function gB(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[Pz[r]]?e.push(t[Pz[r]]):t[Fz[r]]&&e.push(t[Fz[r]]),e),[t[$.Day]])}function _B(e){return{...oB,...e}}function vB(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function yB(){let e={};for(let t in $)e[$[t]]=`rdp-${$[t]}`;for(let t in Pz)e[Pz[t]]=`rdp-${Pz[t]}`;for(let t in Fz)e[Fz[t]]=`rdp-${Fz[t]}`;for(let t in Iz)e[Iz[t]]=`rdp-${Iz[t]}`;return e}function bB(e,t,n){return(n??new Tz(t)).formatMonthYear(e)}function xB(e,t,n){return(n??new Tz(t)).format(e,`d`)}function SB(e,t=Ez){return t.format(e,`LLLL`)}function CB(e,t,n){return(n??new Tz(t)).format(e,`cccccc`)}function wB(e,t=Ez){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function TB(){return``}function EB(e,t=Ez){return t.format(e,`yyyy`)}var DB=s({formatCaption:()=>bB,formatDay:()=>xB,formatMonthDropdown:()=>SB,formatWeekNumber:()=>wB,formatWeekNumberHeader:()=>TB,formatWeekdayName:()=>CB,formatYearDropdown:()=>EB});function OB(e){return{...DB,...e}}function kB(e,t,n,r){let i=(r??new Tz(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}function AB(e,t,n){return(n??new Tz(t)).formatMonthYear(e)}function jB(e,t,n,r){let i=(r??new Tz(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function MB(e){return`Choose the Month`}function NB(){return``}var PB=`Go to the Next Month`;function FB(e,t){return PB}function IB(e){return`Go to the Previous Month`}function LB(e,t,n){return(n??new Tz(t)).format(e,`cccc`)}function RB(e,t){return`Week ${e}`}function zB(e){return`Week Number`}function BB(e){return`Choose the Year`}var VB=s({labelDayButton:()=>kB,labelGrid:()=>AB,labelGridcell:()=>jB,labelMonthDropdown:()=>MB,labelNav:()=>NB,labelNext:()=>FB,labelPrevious:()=>IB,labelWeekNumber:()=>RB,labelWeekNumberHeader:()=>zB,labelWeekday:()=>LB,labelYearDropdown:()=>BB}),HB=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function UB(e,t){let n=t.locale?.labels??{};return{...VB,...e??{},labelDayButton:HB(kB,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:HB(MB,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:HB(FB,e?.labelNext,n.labelNext),labelPrevious:HB(IB,e?.labelPrevious,n.labelPrevious),labelWeekNumber:HB(RB,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:HB(BB,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:HB(AB,e?.labelGrid,n.labelGrid),labelGridcell:HB(jB,e?.labelGridcell,n.labelGridcell),labelNav:HB(NB,e?.labelNav,n.labelNav),labelWeekNumberHeader:HB(zB,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:HB(LB,e?.labelWeekday,n.labelWeekday)}}function WB(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function GB(e,t={},n={}){let r={...t?.[$.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function KB(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function qB(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function JB(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new zL(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(zL.tz(e)),newDate:(t,n,r)=>new zL(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new zL(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new zL(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new zL(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new zL(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>zR(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>IR(o(e)),differenceInCalendarDays:(e,t)=>rR(o(e),o(t)),differenceInCalendarMonths:(e,t)=>fR(o(e),o(t))}}var YB=e=>e instanceof HTMLElement?e:null,XB=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],ZB=e=>YB(e.querySelector(`[data-animated-month]`)),QB=e=>YB(e.querySelector(`[data-animated-caption]`)),$B=e=>YB(e.querySelector(`[data-animated-weeks]`)),eV=e=>YB(e.querySelector(`[data-animated-nav]`)),tV=e=>YB(e.querySelector(`[data-animated-weekdays]`));function nV(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=(0,f.useRef)(null),s=(0,f.useRef)(r),c=(0,f.useRef)(!1);(0,f.useLayoutEffect)(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[Iz.caption_after_enter]:n[Iz.caption_before_enter],p=d?n[Iz.weeks_after_enter]:n[Iz.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(XB(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=ZB(e);t&&e.contains(t)&&e.removeChild(t);let n=QB(e);n&&n.classList.remove(f);let r=$B(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?XB(m):[],_=XB(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g?.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=eV(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=QB(i);s&&s.classList.add(f);let l=$B(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=tV(o);m&&(m.style.opacity=`0`);let h=QB(o);h&&(h.classList.add(d?n[Iz.caption_before_exit]:n[Iz.caption_after_exit]),h.addEventListener(`animationend`,u));let _=$B(o);_&&_.classList.add(d?n[Iz.weeks_before_exit]:n[Iz.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function rV(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function iV(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function aV(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function oV(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function sV(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new Oz(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new Dz(t,m,r);return a?a.days.push(o):e.push(new kz(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function cV(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,today:u}=t,d=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):!n&&d&&(n=i(c(e.today??u(),-100))),r?r=s(r):!r&&d&&(r=l(e.today??u())),[n&&a(n),r&&a(r)]}function lV(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function uV(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function dV(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function fV(e,t){let[n,r]=(0,f.useState)(e);return[t===void 0?n:t,r]}function pV(e,t){let[n,r]=cV(e,t),{startOfMonth:i,endOfMonth:a}=t,o=oV(e,n,r,t),[s,c]=fV(o,e.month?o:void 0);(0,f.useEffect)(()=>{c(oV(e,n,r,t))},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:p,nextMonth:m}=(0,f.useMemo)(()=>{let i=aV(s,r,{numberOfMonths:e.numberOfMonths},t),o=sV(i,rV(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:dV(o),days:iV(o),previousMonth:uV(s,n,e,t),nextMonth:lV(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:h,onMonthChange:g}=e,_=e=>u.some(t=>t.days.some(t=>t.isEqualTo(e))),v=e=>{if(h)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),c(t),g?.(t)};return{months:l,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:p,nextMonth:m,goToMonth:v,goToDay:e=>{_(e)||v(e.date)}}}var mV;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(mV||={});function hV(e){return!e[Pz.disabled]&&!e[Pz.hidden]&&!e[Pz.outside]}function gV(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);hV(e)&&(e[Pz.focused]&&a<mV.FocusedModifier?(i=o,a=mV.FocusedModifier):r?.isEqualTo(o)&&a<mV.LastFocused?(i=o,a=mV.LastFocused):n(o.date)&&a<mV.Selected?(i=o,a=mV.Selected):e[Pz.today]&&a<mV.Today&&(i=o,a=mV.Today))}return i||=e.find(e=>hV(t(e))),i}function _V(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function vV(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=_V(e,t,n.date,r,i,a,o),l=!!(a.disabled&&mB(c,a.disabled,o)),u=!!(a.hidden&&mB(c,a.hidden,o)),d=new Dz(c,c,o);return!l&&!u?d:vV(e,t,d,r,i,a,o,s+1)}function yV(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,f.useState)(),c=gV(t.days,n,r||(()=>!1),o),[l,u]=(0,f.useState)(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=vV(n,r,l,t.navStart,t.navEnd,e,i);a&&(e.disableNavigation&&!t.days.some(e=>e.isEqualTo(a))||(t.goToDay(a),u(a)))}}}function bV(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=fV(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function xV(e,t,n=0,r=0,i=!1,a=Ez){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s)if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`);if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function SV(e,t,n=Ez){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function CV(e,t,n=Ez){return sB(e,t.from,!1,n)||sB(e,t.to,!1,n)||sB(t,e.from,!1,n)||sB(t,e.to,!1,n)}function wV(e,t,n=Ez){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?sB(e,t,!1,n):pB(t,n)?t.some(t=>sB(e,t,!1,n)):lB(t)?t.from&&t.to?CV(e,{from:t.from,to:t.to},n):!1:fB(t)?SV(e,t.dayOfWeek,n):cB(t)?n.isAfter(t.before,t.after)?CV(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):mB(e.from,t,n)||mB(e.to,t,n):uB(t)||dB(t)?mB(e.from,t,n)||mB(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function TV(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=fV(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:xV(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&wV({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&sB(u,e,!1,t)}}function EV(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=fV(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function DV(e,t){let n=EV(e,t),r=bV(e,t),i=TV(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function OV(e,t){return e instanceof zL&&e.timeZone===t?e:new zL(e,t)}function kV(e,t,n){if(!n)return OV(e,t);let r=OV(e,t),i=new zL(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function AV(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?kV(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?kV(e,t,n):e):lB(e)?{...e,from:e.from?OV(e.from,t):e.from,to:e.to?OV(e.to,t):e.to}:cB(e)?{before:kV(e.before,t,n),after:kV(e.after,t,n)}:uB(e)?{after:kV(e.after,t,n)}:dB(e)?{before:kV(e.before,t,n)}:e}function jV(e,t,n){return e&&(Array.isArray(e)?e.map(e=>AV(e,t,n)):AV(e,t,n))}function MV(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=OV(t.today,n),t.month&&=OV(t.month,n),t.defaultMonth&&=OV(t.defaultMonth,n),t.startMonth&&=OV(t.startMonth,n),t.endMonth&&=OV(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=OV(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>OV(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?OV(t.selected.from,n):t.selected.from,to:t.selected.to?OV(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=jV(t.disabled,n)),t.hidden!==void 0&&(t.hidden=jV(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=jV(t.modifiers?.[r],n)}),t.modifiers=e}let{components:r,formatters:i,labels:a,dateLib:o,locale:s,classNames:c}=(0,f.useMemo)(()=>{let e={...wz,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?JB(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new Tz({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:_B(t.components),formatters:OB(t.formatters),labels:UB(t.labels,a.options),locale:e,classNames:{...yB(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});let{captionLayout:l,mode:u,navLayout:d,numberOfMonths:p=1,onDayBlur:m,onDayClick:h,onDayFocus:g,onDayKeyDown:_,onDayMouseEnter:v,onDayMouseLeave:y,onNextClick:b,onPrevClick:x,showWeekNumber:S,styles:C}=t,{formatCaption:w,formatDay:T,formatMonthDropdown:E,formatWeekNumber:ee,formatWeekNumberHeader:te,formatWeekdayName:D,formatYearDropdown:O}=i,ne=pV(t,o),{days:re,months:ie,navStart:k,navEnd:A,previousMonth:ae,nextMonth:j,goToMonth:M}=ne,oe=hB(re,t,k,A,o),{isSelected:se,select:ce,selected:le}=DV(t,o)??{},{blur:ue,focused:de,isFocusTarget:fe,moveFocus:pe,setFocused:me}=yV(t,ne,oe,se??(()=>!1),o),{labelDayButton:he,labelGridcell:ge,labelGrid:_e,labelMonthDropdown:ve,labelNav:ye,labelPrevious:be,labelNext:xe,labelWeekday:Se,labelWeekNumber:Ce,labelWeekNumberHeader:we,labelYearDropdown:Te}=a,Ee=(0,f.useMemo)(()=>KB(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),De=u!==void 0||h!==void 0,Oe=(0,f.useCallback)(()=>{ae&&(M(ae),x?.(ae))},[ae,M,x]),ke=(0,f.useCallback)(()=>{j&&(M(j),b?.(j))},[M,j,b]),Ae=(0,f.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),me(e),!t.disabled&&(ce?.(e.date,t,n),h?.(e.date,t,n))},[ce,h,me]),je=(0,f.useCallback)((e,t)=>n=>{me(e),g?.(e.date,t,n)},[g,me]),Me=(0,f.useCallback)((e,t)=>n=>{ue(),m?.(e.date,t,n)},[ue,m]),Ne=(0,f.useCallback)((e,n)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];pe(e,t)}_?.(e.date,n,r)},[pe,_,t.dir]),Pe=(0,f.useCallback)((e,t)=>n=>{v?.(e.date,t,n)},[v]),Fe=(0,f.useCallback)((e,t)=>n=>{y?.(e.date,t,n)},[y]),Ie=(0,f.useCallback)((e,t)=>n=>{let r=Number(n.target.value),i=o.setMonth(o.startOfMonth(e),r);M(o.addMonths(i,-t))},[o,M]),Le=(0,f.useCallback)((e,t)=>n=>{let r=Number(n.target.value),i=o.setYear(o.startOfMonth(e),r);M(o.addMonths(i,-t))},[o,M]),{className:Re,style:ze}=(0,f.useMemo)(()=>({className:[c[$.Root],t.className].filter(Boolean).join(` `),style:{...C?.[$.Root],...t.style}}),[c,t.className,t.style,C]),Be=vB(t),Ve=(0,f.useRef)(null);nV(Ve,!!t.animate,{classNames:c,months:ie,focused:de,dateLib:o});let He={dayPickerProps:t,selected:le,select:ce,isSelected:se,months:ie,nextMonth:j,previousMonth:ae,goToMonth:M,getModifiers:oe,components:r,classNames:c,styles:C,labels:a,formatters:i};return f.createElement(Lz.Provider,{value:He},f.createElement(r.Root,{rootRef:t.animate?Ve:void 0,className:Re,style:ze,dir:t.dir,id:t.id,lang:t.lang??s.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t[`aria-label`],"aria-labelledby":t[`aria-labelledby`],...Be},f.createElement(r.Months,{className:c[$.Months],style:C?.[$.Months]},!t.hideNavigation&&!d&&f.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[$.Nav],style:C?.[$.Nav],"aria-label":ye(),onPreviousClick:Oe,onNextClick:ke,previousMonth:ae,nextMonth:j}),ie.map((e,n)=>{let a=t.reverseMonths?ie.length-1-n:n;return f.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[$.Month],style:C?.[$.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&f.createElement(r.PreviousMonthButton,{type:`button`,className:c[$.PreviousMonthButton],tabIndex:ae?void 0:-1,"aria-disabled":ae?void 0:!0,"aria-label":be(ae),onClick:Oe,"data-animated-button":t.animate?`true`:void 0},f.createElement(r.Chevron,{disabled:ae?void 0:!0,className:c[$.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),f.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[$.MonthCaption],style:C?.[$.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?f.createElement(r.DropdownNav,{className:c[$.Dropdowns],style:C?.[$.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?f.createElement(r.MonthsDropdown,{key:`month`,className:c[$.MonthsDropdown],"aria-label":ve(),disabled:!!t.disableNavigation,onChange:Ie(e.date,a),options:WB(e.date,k,A,i,o),style:C?.[$.Dropdown],value:o.getMonth(e.date)}):f.createElement(`span`,{key:`month`},E(e.date,o)),s=l===`dropdown`||l===`dropdown-years`?f.createElement(r.YearsDropdown,{key:`year`,className:c[$.YearsDropdown],"aria-label":Te(o.options),disabled:!!t.disableNavigation,onChange:Le(e.date,a),options:qB(k,A,i,o,!!t.reverseYears),style:C?.[$.Dropdown],value:o.getYear(e.date)}):f.createElement(`span`,{key:`year`},O(e.date,o));return o.getMonthYearOrder()===`year-first`?[s,n]:[n,s]})(),f.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},w(e.date,o.options,o))):f.createElement(r.CaptionLabel,{className:c[$.CaptionLabel],role:`status`,"aria-live":`polite`},w(e.date,o.options,o))),d===`around`&&!t.hideNavigation&&n===p-1&&f.createElement(r.NextMonthButton,{type:`button`,className:c[$.NextMonthButton],tabIndex:j?void 0:-1,"aria-disabled":j?void 0:!0,"aria-label":xe(j),onClick:ke,"data-animated-button":t.animate?`true`:void 0},f.createElement(r.Chevron,{disabled:j?void 0:!0,className:c[$.Chevron],orientation:t.dir===`rtl`?`left`:`right`})),n===p-1&&d===`after`&&!t.hideNavigation&&f.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[$.Nav],style:C?.[$.Nav],"aria-label":ye(),onPreviousClick:Oe,onNextClick:ke,previousMonth:ae,nextMonth:j}),f.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":_e(e.date,o.options,o)||void 0,className:c[$.MonthGrid],style:C?.[$.MonthGrid]},!t.hideWeekdays&&f.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[$.Weekdays],style:C?.[$.Weekdays]},S&&f.createElement(r.WeekNumberHeader,{"aria-label":we(o.options),className:c[$.WeekNumberHeader],style:C?.[$.WeekNumberHeader],scope:`col`},te()),Ee.map(e=>f.createElement(r.Weekday,{"aria-label":Se(e,o.options,o),className:c[$.Weekday],key:String(e),style:C?.[$.Weekday],scope:`col`},D(e,o.options,o)))),f.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[$.Weeks],style:C?.[$.Weeks]},e.weeks.map(e=>f.createElement(r.Week,{className:c[$.Week],key:e.weekNumber,style:C?.[$.Week],week:e},S&&f.createElement(r.WeekNumber,{week:e,style:C?.[$.WeekNumber],"aria-label":Ce(e.weekNumber,{locale:s}),className:c[$.WeekNumber],scope:`row`,role:`rowheader`},ee(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=oe(e);if(i[Pz.focused]=!i.hidden&&!!de?.isEqualTo(e),i[Fz.selected]=se?.(n)||i.selected,lB(le)){let{from:e,to:t}=le;i[Fz.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[Fz.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[Fz.range_middle]=sB(le,n,!0,o)}let a=GB(i,C,t.modifiersStyles),s=gB(i,c,t.modifiersClassNames),l=!De&&!i.hidden?ge(n,i,o.options,o):void 0;return f.createElement(r.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:i,className:s.join(` `),style:a,role:`gridcell`,"aria-selected":i.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":i.selected||void 0,"data-disabled":i.disabled||void 0,"data-hidden":i.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":i.focused||void 0,"data-today":i.today||void 0},!i.hidden&&De?f.createElement(r.DayButton,{className:c[$.DayButton],style:C?.[$.DayButton],type:`button`,day:e,modifiers:i,disabled:!i.focused&&i.disabled||void 0,"aria-disabled":i.focused&&i.disabled||void 0,tabIndex:fe(e)?0:-1,"aria-label":he(n,i,o.options,o),onClick:Ae(e,i),onBlur:Me(e,i),onFocus:je(e,i),onKeyDown:Ne(e,i),onMouseEnter:Pe(e,i),onMouseLeave:Fe(e,i)},T(n,o.options,o)):!i.hidden&&T(e.date,o.options,o))}))))))})),t.footer&&f.createElement(r.Footer,{className:c[$.Footer],style:C?.[$.Footer],role:`status`,"aria-live":`polite`},t.footer)))}var NV=[{label:`Today`,days:0},{label:`Last 7 days`,days:7},{label:`Last 30 days`,days:30},{label:`Last 90 days`,days:90},{label:`All time`,days:null}];function PV(e){return e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function FV({fromTs:e,toTs:t,onChange:n}){let[r,i]=(0,f.useState)(!1),a=(0,f.useRef)(null),o=e||t?{from:e?new Date(e):void 0,to:t?new Date(t):void 0}:void 0;(0,f.useEffect)(()=>{if(!r)return;let e=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]);let s=e=>{if(!e){n(``,``);return}n(e.from?new Date(e.from.getFullYear(),e.from.getMonth(),e.from.getDate(),0,0,0).toISOString():``,e.to?new Date(e.to.getFullYear(),e.to.getMonth(),e.to.getDate(),23,59,59).toISOString():``)},c=e=>{if(e===null)n(``,``);else{let t=new Date;n((e===0?new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0):new Date(Date.now()-e*24*60*60*1e3)).toISOString(),t.toISOString())}i(!1)},l=o?.from||o?.to?`${o.from?PV(o.from):`...`} — ${o.to?PV(o.to):`...`}`:`All time`;return(0,w.jsxs)(`div`,{ref:a,className:`relative`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),className:`flex items-center gap-2 bg-surface-secondary border border-border-subtle rounded-lg px-3 py-1.5 text-xs text-foreground hover:border-violet-500/50 transition-colors`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5 t-tertiary shrink-0`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z`})}),(0,w.jsx)(`span`,{className:`font-mono`,children:l}),(e||t)&&(0,w.jsx)(`span`,{className:`t-tertiary hover:text-foreground ml-1 cursor-pointer`,onClick:e=>{e.stopPropagation(),n(``,``)},children:`×`})]}),r&&(0,w.jsxs)(`div`,{className:`absolute top-full mt-1 right-0 z-50 border border-border-subtle rounded-xl shadow-2xl bg-[#18181b] p-4 flex gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-0.5 border-r border-border-subtle pr-4 min-w-[120px]`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] uppercase tracking-wider mb-2 px-2`,children:`Quick select`}),NV.map(e=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>c(e.days),className:`text-left text-xs px-2 py-1.5 rounded-md hover:bg-violet-500/10 hover:text-violet-300 text-foreground transition-colors whitespace-nowrap`,children:e.label},e.label))]}),(0,w.jsx)(`div`,{className:`rdp-dark`,children:(0,w.jsx)(MV,{mode:`range`,selected:o,onSelect:s,disabled:{after:new Date},numberOfMonths:1,showOutsideDays:!0,classNames:{root:`text-foreground text-xs`,months:`flex gap-4`,month_caption:`flex items-center justify-center py-1 mb-1`,caption_label:`text-xs font-medium text-foreground`,nav:`flex items-center`,button_previous:`absolute left-1 top-2.5 h-6 w-6 inline-flex items-center justify-center rounded-md hover:bg-surface-secondary t-tertiary hover:text-foreground transition-colors`,button_next:`absolute right-1 top-2.5 h-6 w-6 inline-flex items-center justify-center rounded-md hover:bg-surface-secondary t-tertiary hover:text-foreground transition-colors`,weekdays:`flex`,weekday:`w-9 text-center t-tertiary text-[10px] font-medium py-1`,week:`flex`,day:`h-9 w-9 text-center`,day_button:`h-8 w-8 rounded-md text-xs inline-flex items-center justify-center transition-colors hover:bg-surface-secondary cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed`,selected:`!bg-violet-500 !text-white font-medium rounded-md`,range_start:`!bg-violet-500 !text-white font-medium rounded-l-md rounded-r-none`,range_end:`!bg-violet-500 !text-white font-medium rounded-r-md rounded-l-none`,range_middle:`!bg-violet-500/20 !text-violet-300 rounded-none`,today:`ring-1 ring-violet-500/50 rounded-md`,outside:`opacity-40`,disabled:`opacity-30 cursor-not-allowed`}})})]})]})}function IV({total:e,limit:t,offset:n,onPageChange:r}){let i=Math.ceil(e/t),a=Math.floor(n/t)+1;return i<=1?null:(0,w.jsxs)(`div`,{className:`flex items-center justify-between px-1 py-2`,children:[(0,w.jsxs)(`span`,{className:`t-tertiary text-xs tabular-nums`,children:[n+1,`–`,Math.min(n+t,e),` of `,e]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`button`,{type:`button`,disabled:a<=1,className:`rounded-md border border-border-subtle bg-white/[0.03] px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:border-border-strong hover:bg-white/[0.07] disabled:cursor-not-allowed disabled:opacity-30 disabled:hover:border-border-subtle disabled:hover:bg-white/[0.03]`,onClick:()=>r(Math.max(0,n-t)),children:`‹ Prev`}),(0,w.jsxs)(`span`,{className:`t-secondary text-xs px-2 font-mono tabular-nums`,children:[a,`/`,i]}),(0,w.jsx)(`button`,{type:`button`,disabled:a>=i,className:`rounded-md border border-border-subtle bg-white/[0.03] px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:border-border-strong hover:bg-white/[0.07] disabled:cursor-not-allowed disabled:opacity-30 disabled:hover:border-border-subtle disabled:hover:bg-white/[0.03]`,onClick:()=>r(n+t),children:`Next ›`})]})]})}function LV(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function RV(e){let t=Date.now()-new Date(e).getTime(),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<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function zV(e){return e>=5?{text:`Exceptional`,color:`text-emerald-400`,bg:`bg-emerald-500/20`}:e>=3?{text:`Strong`,color:`text-emerald-400`,bg:`bg-emerald-500/20`}:e>=2?{text:`Good`,color:`text-cyan-400`,bg:`bg-cyan-500/20`}:e>=1.5?{text:`Improving`,color:`text-amber-400`,bg:`bg-amber-500/20`}:{text:`Building up`,color:`text-zinc-400`,bg:`bg-zinc-500/20`}}function BV({icon:e,color:t,borderColor:n,title:r,value:i,unit:a,subtitle:o,detail:s,tooltip:c}){return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-t-2 ${n}`,title:c,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,w.jsx)(`span`,{className:`text-lg`,children:e}),(0,w.jsx)(`p`,{className:`${t} text-[10px] uppercase tracking-wider font-medium`,children:r})]}),(0,w.jsxs)(`p`,{className:`text-3xl font-bold font-mono ${t}`,children:[i,a&&(0,w.jsx)(`span`,{className:`text-lg ml-0.5`,children:a})]}),(0,w.jsx)(`p`,{className:`t-secondary text-xs mt-1.5`,children:o}),s&&(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-1 leading-snug`,children:s})]})}function VV({value:e,max:t,label:n}){let r=t&&t>0?Math.min(100,Math.round(e/t*100)):e;return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 ${r>=70?`bg-emerald-500/20`:r>=40?`bg-amber-500/20`:`bg-red-500/20`} ${r>=70?`text-emerald-400`:r>=40?`text-amber-400`:`text-red-400`} text-[10px] font-medium`,title:n,children:[r,`%`]})}function HV({onSelectSession:e}){let{url:t,queryKey:n}=Ot(),r=S(`from`)??``,i=S(`to`)??``,a=S(`session_offset`),o=Number(a)||0,s=(e,t)=>x({from:e||null,to:t||null,session_offset:null}),c=e=>x({session_offset:e>0?String(e):null}),l=r||i?`${r?`&from_ts=${r}`:``}${i?`&to_ts=${i}`:``}`:``,u=N({queryKey:n([`reasoning-quality-global`,r,i]),queryFn:()=>O(t(`/api/reasoning-quality/global?_=1${l}`)),refetchInterval:5e3}),d=N({queryKey:n([`reasoning-quality-sessions`,r,i,o]),queryFn:()=>O(t(`/api/reasoning-quality/sessions?limit=10&offset=${o}${l}`)),refetchInterval:5e3}),f=N({queryKey:n([`reasoning-quality-trend`,r,i]),queryFn:()=>O(t(`/api/reasoning-quality/trend?_=1${l}`)),refetchInterval:1e4});if(u.isLoading)return(0,w.jsx)(Wt,{n:6});let p=u.data?.data,m=d.data?.data??[],h=d.data?.total??0;if(!p||p.total_events===0)return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-10 text-center`,children:[(0,w.jsx)(`p`,{className:`t-secondary text-lg`,children:`No reasoning data yet`}),(0,w.jsx)(`p`,{className:`t-tertiary mt-2 text-sm max-w-md mx-auto`,children:`This page tracks how unerr improves your agent's thinking — not just saving tokens, but making every remaining token count more. Data appears as soon as the agent starts using unerr's tools.`})]});let g=zV(p.reasoning_quality_multiplier);return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsx)(`div`,{className:`flex items-center justify-end gap-3 flex-wrap -mt-2`,children:(0,w.jsx)(FV,{fromTs:r,toTs:i,onChange:(e,t)=>s(e,t)})}),(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-6 border-l-4 border-violet-500/60`,children:(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-4 flex-wrap`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{className:`text-foreground font-semibold text-base`,children:`Is your agent reasoning better?`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-1 max-w-lg leading-relaxed`,children:`unerr doesn't just save tokens — it makes every remaining token count more. By feeding the right code, past learnings, and project conventions at exactly the right moment, your agent makes better decisions with less context.`})]}),(0,w.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,w.jsxs)(`p`,{className:`text-violet-400 font-mono font-bold text-4xl`,children:[p.reasoning_quality_multiplier,`x`]}),(0,w.jsx)(`span`,{className:`inline-flex items-center rounded-full px-2.5 py-0.5 ${g.bg} ${g.color} text-[10px] font-medium mt-1`,children:g.text}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-1`,children:`reasoning improvement`})]})]})}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-4`,children:[(0,w.jsx)(BV,{icon:`🔍`,color:`text-emerald-400`,borderColor:`border-emerald-500/60`,title:`Cleaner Focus`,value:`${p.noise_removed_pct}%`,subtitle:`of irrelevant code removed before the agent saw it`,detail:`The agent focused on ${LV(p.entities_resolved)} relevant code entities instead of reading entire files`,tooltip:`Signal-to-noise ratio: ${p.signal_to_noise_ratio} · Context density: ${p.context_density} entities per 1K tokens · Attention boost: ${p.attention_multiplier}x`}),(0,w.jsx)(BV,{icon:`⚡`,color:`text-cyan-400`,borderColor:`border-cyan-500/60`,title:`Found It First Try`,value:`${p.first_call_resolution_rate}%`,subtitle:`of code lookups resolved in a single call`,detail:`Saved ~${LV(p.turns_saved)} wasted turns that would have been spent searching through files`,tooltip:`${LV(p.graph_calls)} graph-backed lookups out of ${LV(p.total_tool_calls)} total tool calls · ${p.exploration_loops_prevented} search loops stopped`}),(0,w.jsx)(BV,{icon:`🛡️`,color:`text-amber-400`,borderColor:`border-amber-500/60`,title:`Mistakes Prevented`,value:p.prevention_score,subtitle:`risky operations caught before they shipped`,detail:[p.blast_radius_warnings>0?`${p.blast_radius_warnings} high-impact edits flagged`:null,p.convention_injections>0?`${p.convention_injections} style rules applied`:null,p.circuit_breaker_activations>0?`${p.circuit_breaker_activations} agent loops stopped`:null].filter(Boolean).join(` · `),tooltip:`Includes blast-radius warnings (risky edits with many callers), convention injections (project rules applied automatically), and circuit breaker activations (agent retry loops stopped)`}),(0,w.jsx)(BV,{icon:`🧠`,color:`text-fuchsia-400`,borderColor:`border-fuchsia-500/60`,title:`Lessons Remembered`,value:p.memory_verdicts_total>0?`${p.memory_effectiveness_pct}%`:p.memory_signals_fired>0?`${p.memory_signals_fired}`:`—`,unit:p.memory_verdicts_total>0?``:p.memory_signals_fired>0?` notes`:``,subtitle:p.memory_verdicts_total>0?`of past learnings actually changed the agent's decisions`:p.memory_signals_fired>0?`past learnings surfaced — tracking impact`:`No past learnings surfaced yet`,detail:p.memory_verdicts_total>0?`${p.verdicts_acted_on+p.verdicts_reinforced+p.verdicts_caught} out of ${p.memory_verdicts_total} surfaced notes were load-bearing`:void 0,tooltip:`Each time unerr surfaces a past note, convention, or session resume, it tracks whether the agent actually used it. Load-bearing = the note changed what the agent did.`})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-3`,children:`How unerr improves reasoning`}),(0,w.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3 text-xs`,children:[(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(`p`,{className:`text-emerald-400 font-medium uppercase tracking-wider text-[10px]`,children:`1. Feeds the right code`}),(0,w.jsxs)(`p`,{className:`t-secondary leading-relaxed`,children:[`Instead of dumping entire files, unerr uses a live code graph to serve only the relevant functions, types, and callers. The agent sees `,p.noise_removed_pct,`% less noise — which research shows directly improves LLM attention and accuracy.`]}),(0,w.jsxs)(`div`,{className:`flex gap-4 pt-1.5 border-t border-border-subtle/50`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Entities served`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm`,children:LV(p.entities_resolved)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Attention boost`}),(0,w.jsxs)(`p`,{className:`text-foreground font-mono text-sm`,children:[p.attention_multiplier,`x`]})]})]})]}),(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(`p`,{className:`text-cyan-400 font-medium uppercase tracking-wider text-[10px]`,children:`2. Frees up context space`}),(0,w.jsx)(`p`,{className:`t-secondary leading-relaxed`,children:`By stripping noise and resolving lookups in one call, unerr frees context window space. That freed space is used for the agent's actual reasoning — longer chains of thought, more alternatives considered, better decisions.`}),(0,w.jsxs)(`div`,{className:`flex gap-4 pt-1.5 border-t border-border-subtle/50`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Graph lookups`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm`,children:LV(p.graph_calls)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Wasted turns prevented`}),(0,w.jsxs)(`p`,{className:`text-foreground font-mono text-sm`,children:[`~`,LV(p.turns_saved)]})]})]})]}),(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(`p`,{className:`text-fuchsia-400 font-medium uppercase tracking-wider text-[10px]`,children:`3. Surfaces past learnings`}),(0,w.jsx)(`p`,{className:`t-secondary leading-relaxed`,children:`Rules you've taught, conventions detected, and decisions from past sessions are surfaced at the exact moment the agent needs them — so the agent doesn't re-derive what it already learned, and doesn't repeat past mistakes.`}),(0,w.jsxs)(`div`,{className:`flex gap-4 pt-1.5 border-t border-border-subtle/50`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Notes surfaced`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm`,children:LV(p.facts_surfaced)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Rules applied`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm`,children:LV(p.conventions_surfaced)})]})]})]})]})]}),(()=>{let e=f.data?.data??[];if(e.length<2)return null;let t=Math.max(...e.map(e=>e.noise_removed_pct),1),n=Math.max(...e.map(e=>e.first_call_resolution_rate),1),r=Math.max(...e.map(e=>e.reasoning_quality_multiplier),1);return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-1`,children:`Reasoning improvement over time`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mb-3`,children:`Each bar is one session. Rising bars mean the agent is getting better at focusing, finding code, and avoiding mistakes.`}),(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,w.jsx)(`span`,{className:`text-emerald-400 text-[10px] uppercase tracking-wider font-medium`,children:`Cleaner focus`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Higher = less noise`})]}),(0,w.jsx)(`div`,{className:`flex gap-[2px]`,style:{height:`48px`},children:e.slice(-40).map(e=>{let n=t>0?Math.max(4,e.noise_removed_pct/t*100):4,r=new Date(e.first_ts).toLocaleDateString([],{month:`short`,day:`numeric`});return(0,w.jsxs)(`div`,{className:`group relative flex-1 min-w-[6px] max-w-[28px] h-full flex items-end`,children:[(0,w.jsx)(`div`,{className:`w-full bg-emerald-500 opacity-70 hover:opacity-100 rounded-t transition-all cursor-pointer`,style:{height:`${n}%`}}),(0,w.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none`,children:(0,w.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-700 rounded-lg px-3 py-2 text-xs whitespace-nowrap shadow-xl`,children:[(0,w.jsx)(`div`,{className:`font-medium text-foreground`,children:r}),(0,w.jsxs)(`div`,{className:`text-emerald-400`,children:[e.noise_removed_pct,`% noise removed`]})]})})]},e.session_id)})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,w.jsx)(`span`,{className:`text-cyan-400 text-[10px] uppercase tracking-wider font-medium`,children:`Found it first try`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Higher = fewer wasted turns`})]}),(0,w.jsx)(`div`,{className:`flex gap-[2px]`,style:{height:`48px`},children:e.slice(-40).map(e=>{let t=n>0?Math.max(4,e.first_call_resolution_rate/n*100):4,r=new Date(e.first_ts).toLocaleDateString([],{month:`short`,day:`numeric`});return(0,w.jsxs)(`div`,{className:`group relative flex-1 min-w-[6px] max-w-[28px] h-full flex items-end`,children:[(0,w.jsx)(`div`,{className:`w-full bg-cyan-500 opacity-70 hover:opacity-100 rounded-t transition-all cursor-pointer`,style:{height:`${t}%`}}),(0,w.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none`,children:(0,w.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-700 rounded-lg px-3 py-2 text-xs whitespace-nowrap shadow-xl`,children:[(0,w.jsx)(`div`,{className:`font-medium text-foreground`,children:r}),(0,w.jsxs)(`div`,{className:`text-cyan-400`,children:[e.first_call_resolution_rate,`% first try`]}),(0,w.jsxs)(`div`,{className:`t-secondary`,children:[`~`,e.turns_saved,` wasted turns prevented`]})]})})]},e.session_id)})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`flex items-center justify-between mb-1`,children:(0,w.jsx)(`span`,{className:`text-violet-400 text-[10px] uppercase tracking-wider font-medium`,children:`Overall reasoning improvement`})}),(0,w.jsx)(`div`,{className:`flex gap-[2px]`,style:{height:`48px`},children:e.slice(-40).map(e=>{let t=r>0?Math.max(4,e.reasoning_quality_multiplier/r*100):4,n=new Date(e.first_ts).toLocaleDateString([],{month:`short`,day:`numeric`});return(0,w.jsxs)(`div`,{className:`group relative flex-1 min-w-[6px] max-w-[28px] h-full flex items-end`,children:[(0,w.jsx)(`div`,{className:`w-full bg-violet-500 opacity-70 hover:opacity-100 rounded-t transition-all cursor-pointer`,style:{height:`${t}%`}}),(0,w.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none`,children:(0,w.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-700 rounded-lg px-3 py-2 text-xs whitespace-nowrap shadow-xl`,children:[(0,w.jsx)(`div`,{className:`font-medium text-foreground`,children:n}),(0,w.jsxs)(`div`,{className:`text-violet-400`,children:[e.reasoning_quality_multiplier,`x improvement`]})]})})]},e.session_id)})})]})]}),e.length>0&&(0,w.jsxs)(`div`,{className:`flex justify-between mt-2 pt-2 border-t border-border-subtle/50`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:new Date(e[Math.max(0,e.length-40)].first_ts).toLocaleDateString([],{month:`short`,day:`numeric`})}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px]`,children:[Math.min(40,e.length),` sessions shown`]}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:new Date(e[e.length-1].first_ts).toLocaleDateString([],{month:`short`,day:`numeric`})})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-4 mt-3 pt-3 border-t border-border-subtle/50`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-sm bg-emerald-500`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Cleaner focus`})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-sm bg-cyan-500`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Found first try`})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-sm bg-violet-500`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Overall improvement`})]})]})]})})(),p.memory_signals_fired>0&&(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-4 flex-wrap mb-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-fuchsia-400 text-xs font-medium uppercase tracking-wider`,children:`Your notes in action`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-1 max-w-lg`,children:`Every time unerr surfaces a past rule, convention, or session note, it tracks whether the agent actually used it. Here's how your accumulated knowledge performed.`})]}),p.memory_verdicts_total>0&&(0,w.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,w.jsxs)(`p`,{className:`text-fuchsia-400 font-mono font-bold text-3xl`,children:[p.memory_effectiveness_pct,`%`]}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wider mt-0.5`,children:`were load-bearing`})]})]}),p.memory_verdicts_total>0&&(()=>{let e=p.memory_verdicts_total,t=t=>t/e*100;return(0,w.jsxs)(`div`,{className:`mb-4`,children:[(0,w.jsx)(`div`,{className:`flex items-center justify-between mb-1.5`,children:(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px]`,children:[e,` note`,e===1?``:`s`,` surfaced and tracked`]})}),(0,w.jsxs)(`div`,{className:`flex h-3 rounded-full overflow-hidden bg-surface-secondary`,children:[p.verdicts_reinforced>0&&(0,w.jsx)(`div`,{className:`bg-emerald-500`,style:{width:`${t(p.verdicts_reinforced)}%`},title:`Confirmed existing rule: ${p.verdicts_reinforced}`}),p.verdicts_acted_on>0&&(0,w.jsx)(`div`,{className:`bg-fuchsia-500`,style:{width:`${t(p.verdicts_acted_on)}%`},title:`Changed the agent's approach: ${p.verdicts_acted_on}`}),p.verdicts_caught>0&&(0,w.jsx)(`div`,{className:`bg-cyan-500`,style:{width:`${t(p.verdicts_caught)}%`},title:`Prevented a mistake: ${p.verdicts_caught}`}),p.verdicts_ignored>0&&(0,w.jsx)(`div`,{className:`bg-zinc-600`,style:{width:`${t(p.verdicts_ignored)}%`},title:`Not used this time: ${p.verdicts_ignored}`}),p.verdicts_corrected>0&&(0,w.jsx)(`div`,{className:`bg-red-500`,style:{width:`${t(p.verdicts_corrected)}%`},title:`Note was outdated and corrected: ${p.verdicts_corrected}`})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-3 mt-2 text-[10px] t-tertiary`,children:[p.verdicts_reinforced>0&&(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm bg-emerald-500 mr-1`}),`Confirmed existing rule (`,p.verdicts_reinforced,`)`]}),p.verdicts_acted_on>0&&(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm bg-fuchsia-500 mr-1`}),`Changed approach (`,p.verdicts_acted_on,`)`]}),p.verdicts_caught>0&&(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm bg-cyan-500 mr-1`}),`Prevented mistake (`,p.verdicts_caught,`)`]}),p.verdicts_ignored>0&&(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm bg-zinc-600 mr-1`}),`Not used (`,p.verdicts_ignored,`)`]}),p.verdicts_corrected>0&&(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm bg-red-500 mr-1`}),`Outdated & corrected (`,p.verdicts_corrected,`)`]})]})]})})(),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 pt-3 border-t border-border-subtle/50`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px]`,children:`Rules you taught`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium mt-0.5`,children:LV(p.facts_recorded)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px]`,children:`Notes recalled`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium mt-0.5`,children:LV(p.facts_recalled)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px]`,children:`Conventions applied`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium mt-0.5`,children:LV(p.conventions_surfaced)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px]`,children:`Sessions resumed`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium mt-0.5`,children:LV(p.resume_hits)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px]`,children:`Anti-patterns warned`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium mt-0.5`,children:LV(p.negative_warnings)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px]`,children:`Total notes surfaced`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium mt-0.5`,children:LV(p.facts_surfaced)})]})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg overflow-hidden`,children:[(0,w.jsxs)(`div`,{className:`px-5 py-3 border-b border-border-subtle flex items-center justify-between`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Sessions`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[h,` session`,h===1?``:`s`]})]}),m.length===0?(0,w.jsx)(`p`,{className:`px-5 py-6 t-secondary text-sm`,children:`No sessions yet.`}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-left text-sm min-w-[800px]`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle t-tertiary text-xs uppercase`,children:[(0,w.jsx)(`th`,{className:`px-5 py-2.5 font-medium`,children:`Session`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:`Agent`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:`Last Active`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-center`,title:`% of noise removed from context`,children:`Focus`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-center`,title:`% of lookups resolved in one call`,children:`First Try`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-center`,title:`Risky operations caught`,children:`Safety`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-center`,title:`% of surfaced notes that changed the outcome`,children:`Memory`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-right`,title:`Wasted turns avoided`,children:`Saved`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-right`,title:`Overall reasoning improvement`,children:`Quality`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 pr-5 font-medium w-16`})]})}),(0,w.jsx)(`tbody`,{children:m.map((t,n)=>(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle hover:bg-surface-secondary transition-colors cursor-pointer group`,onClick:()=>e(t.session_id),children:[(0,w.jsx)(`td`,{className:`px-5 py-3`,children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`font-mono text-xs text-foreground group-hover:text-violet-400 transition-colors`,children:t.session_id.slice(0,12)}),n===0&&o===0&&(0,w.jsx)(`span`,{className:`rounded-full bg-emerald-500/20 text-emerald-400 px-2 py-0.5 text-[10px] font-medium`,children:`latest`})]})}),(0,w.jsx)(`td`,{className:`px-3 py-3`,children:(0,w.jsx)(YI,{name:t.agent_name})}),(0,w.jsx)(`td`,{className:`px-3 py-3 t-secondary text-xs`,children:RV(t.last_ts)}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-center`,children:(0,w.jsx)(VV,{value:t.noise_removed_pct,label:`Noise removed`})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-center`,children:(0,w.jsx)(VV,{value:t.first_call_resolution_rate,label:`First-try resolution`})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-center`,children:(0,w.jsx)(`span`,{className:`text-amber-400 font-mono text-xs font-medium`,children:t.prevention_score})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-center`,children:t.memory_verdicts_total>0?(0,w.jsxs)(`span`,{className:`text-fuchsia-400 font-mono text-xs font-medium`,children:[t.memory_effectiveness_pct,`%`]}):t.memory_signals_fired>0?(0,w.jsxs)(`span`,{className:`t-tertiary font-mono text-xs`,children:[t.memory_signals_fired,` notes`]}):(0,w.jsx)(`span`,{className:`t-tertiary font-mono text-xs`,children:`—`})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,w.jsxs)(`span`,{className:`text-cyan-400 font-mono text-xs`,children:[`~`,t.turns_saved]})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,w.jsxs)(`span`,{className:`text-violet-400 font-mono font-medium text-sm`,children:[t.reasoning_quality_multiplier,`x`]})}),(0,w.jsx)(`td`,{className:`pl-4 py-3 pr-5 text-right w-16`,children:(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-violet-400 opacity-0 group-hover:opacity-100 transition-opacity font-medium whitespace-nowrap`,children:[`View`,` `,(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 5l7 7-7 7`})})]})})]},t.session_id))})]})}),(0,w.jsx)(`div`,{className:`px-5 py-2 border-t border-border-subtle`,children:(0,w.jsx)(IV,{total:h,limit:10,offset:o,onPageChange:c})})]})]})]})}function UV({sessionId:e}){let{url:t,queryKey:n}=Ot(),r=N({queryKey:n([`reasoning-quality-session`,e]),queryFn:()=>O(t(`/api/reasoning-quality/session?session_id=${e}`)),refetchInterval:5e3});if(r.isLoading)return(0,w.jsx)(Wt,{n:6});let i=r.data?.data;if(!i)return(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-8 text-center`,children:(0,w.jsxs)(`p`,{className:`t-secondary`,children:[`No data for session `,e.slice(0,12)]})});let a=i.trajectory??[],o=zV(i.reasoning_quality_multiplier);return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-5 border-l-4 border-violet-500/40`,children:(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-4 flex-wrap`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-foreground text-sm font-medium`,children:`Session reasoning quality`}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mt-1`,children:[`How well the agent reasoned across `,i.total_turns,` turn`,i.total_turns===1?``:`s`,` in this session.`]})]}),(0,w.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,w.jsxs)(`p`,{className:`text-violet-400 font-mono font-bold text-3xl`,children:[i.reasoning_quality_multiplier,`x`]}),(0,w.jsx)(`span`,{className:`inline-flex items-center rounded-full px-2.5 py-0.5 ${o.bg} ${o.color} text-[10px] font-medium mt-1`,children:o.text})]})]})}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 lg:grid-cols-4`,children:[(0,w.jsx)(BV,{icon:`🔍`,color:`text-emerald-400`,borderColor:`border-emerald-500/60`,title:`Cleaner Focus`,value:`${i.noise_removed_pct}%`,subtitle:`noise removed`,detail:`${LV(i.entities_resolved)} entities served · ${i.attention_multiplier}x attention boost`}),(0,w.jsx)(BV,{icon:`⚡`,color:`text-cyan-400`,borderColor:`border-cyan-500/60`,title:`Found First Try`,value:`${i.first_call_resolution_rate}%`,subtitle:`one-call resolution`,detail:`~${LV(i.turns_saved)} wasted turns prevented`}),(0,w.jsx)(BV,{icon:`🛡️`,color:`text-amber-400`,borderColor:`border-amber-500/60`,title:`Mistakes Prevented`,value:i.prevention_score,subtitle:`risky operations caught`,detail:[i.blast_radius_warnings>0?`${i.blast_radius_warnings} high-impact edits flagged`:null,i.convention_injections>0?`${i.convention_injections} style rules applied`:null,i.circuit_breaker_activations>0?`${i.circuit_breaker_activations} loops stopped`:null].filter(Boolean).join(` · `)}),(0,w.jsx)(BV,{icon:`🧠`,color:`text-fuchsia-400`,borderColor:`border-fuchsia-500/60`,title:`Lessons Remembered`,value:i.memory_verdicts_total>0?`${i.memory_effectiveness_pct}%`:i.memory_signals_fired>0?`${i.memory_signals_fired}`:`—`,unit:i.memory_verdicts_total>0?``:i.memory_signals_fired>0?` notes`:``,subtitle:i.memory_verdicts_total>0?`load-bearing`:i.memory_signals_fired>0?`notes surfaced`:`No notes surfaced`})]}),a.length>0&&(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-1`,children:`How context quality changed through the session`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mb-3`,children:`Each bar is one turn. Without unerr, this line typically drops as context fills up — a rising or flat line means the session stayed clean.`}),(0,w.jsx)(`div`,{className:`flex gap-[3px]`,style:{height:`120px`},children:a.slice(-60).map(e=>(0,w.jsxs)(`div`,{className:`group relative flex-1 min-w-[6px] max-w-[28px] h-full flex items-end`,children:[(0,w.jsx)(`div`,{className:`w-full bg-emerald-500 opacity-70 hover:opacity-100 rounded-t transition-all cursor-pointer`,style:{height:`${Math.max(4,e.cumulative_noise_removed_pct)}%`}}),(0,w.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none`,children:(0,w.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-700 rounded-lg px-3 py-2 text-xs whitespace-nowrap shadow-xl`,children:[(0,w.jsxs)(`div`,{className:`font-medium text-foreground`,children:[`Turn #`,e.turn]}),(0,w.jsxs)(`div`,{className:`text-emerald-400 mt-0.5`,children:[e.cumulative_noise_removed_pct,`% noise removed`]}),(0,w.jsxs)(`div`,{className:`text-cyan-400`,children:[e.graph_calls_this_turn,` graph lookup`,e.graph_calls_this_turn===1?``:`s`]}),e.context_density>0&&(0,w.jsxs)(`div`,{className:`t-secondary`,children:[e.context_density,` entities per 1K tokens`]})]})})]},e.turn))}),(0,w.jsxs)(`div`,{className:`flex justify-between mt-1.5`,children:[(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:[`Turn `,a.length>60?a.length-59:1]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:[`Turn `,a.length]})]}),(0,w.jsx)(`div`,{className:`flex items-center gap-4 mt-3 pt-3 border-t border-border-subtle/50`,children:(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-sm bg-emerald-500`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Cumulative noise removed`})]})})]}),(0,w.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-3`,children:[(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`text-emerald-400 text-xs font-medium uppercase tracking-wider mb-4`,children:`Focus details`}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,children:`Noise removed`}),(0,w.jsxs)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:[i.noise_removed_pct,`%`]})]}),(0,w.jsx)(`div`,{className:`mt-1.5 h-2 bg-surface-secondary rounded-full overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full bg-emerald-500 rounded-full transition-all`,style:{width:`${Math.max(3,i.noise_removed_pct)}%`}})})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,title:`How many relevant code entities per 1K tokens delivered`,children:`Information density`}),(0,w.jsx)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:i.context_density})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,title:`Estimated improvement in LLM attention from noise removal`,children:`Attention improvement`}),(0,w.jsxs)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:[i.attention_multiplier,`x`]})]}),(0,w.jsxs)(`div`,{className:`pt-2 border-t border-border-subtle/50 space-y-1`,children:[(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`Code entities served`}),(0,w.jsx)(`span`,{className:`t-secondary font-mono text-xs`,children:LV(i.entities_resolved)})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`Tokens via graph`}),(0,w.jsx)(`span`,{className:`t-secondary font-mono text-xs`,children:LV(i.graph_tokens_delivered)})]})]})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`text-cyan-400 text-xs font-medium uppercase tracking-wider mb-4`,children:`Efficiency details`}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,children:`One-call resolution`}),(0,w.jsxs)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:[i.first_call_resolution_rate,`%`]})]}),(0,w.jsx)(`div`,{className:`mt-1.5 h-2 bg-surface-secondary rounded-full overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full bg-cyan-500 rounded-full transition-all`,style:{width:`${Math.max(3,i.first_call_resolution_rate)}%`}})})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,children:`Wasted turns prevented`}),(0,w.jsxs)(`span`,{className:`text-cyan-400 font-mono text-sm font-medium`,children:[`~`,LV(i.turns_saved)]})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,children:`Search loops stopped`}),(0,w.jsx)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:i.exploration_loops_prevented})]}),(0,w.jsxs)(`div`,{className:`pt-2 border-t border-border-subtle/50 space-y-1`,children:[(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`Graph lookups`}),(0,w.jsx)(`span`,{className:`t-secondary font-mono text-xs`,children:LV(i.graph_calls)})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`Total tool calls`}),(0,w.jsx)(`span`,{className:`t-secondary font-mono text-xs`,children:LV(i.total_tool_calls)})]})]})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`text-amber-400 text-xs font-medium uppercase tracking-wider mb-4`,children:`Safety details`}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,title:`High-impact edits where unerr showed all callers before the change`,children:`High-impact edits flagged`}),(0,w.jsx)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:i.blast_radius_warnings})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,title:`Project conventions automatically applied to prevent style violations`,children:`Style rules applied`}),(0,w.jsx)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:i.convention_injections})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,title:`Agent was stuck in a retry loop — unerr broke it`,children:`Agent loops stopped`}),(0,w.jsx)(`span`,{className:`font-mono text-sm font-medium ${i.circuit_breaker_activations>0?`text-red-400`:`text-foreground`}`,children:i.circuit_breaker_activations})]}),(0,w.jsxs)(`div`,{className:`flex justify-between pt-2 border-t border-border-subtle/50`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`Total safety score`}),(0,w.jsx)(`span`,{className:`text-amber-400 font-mono text-xs font-medium`,children:i.prevention_score})]})]})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4 flex flex-wrap items-center justify-center gap-x-6 gap-y-2 text-xs`,children:[(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`token-trace`,{session:e}),children:`See token savings in Token Trace →`}),(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`logbook`,{session:e}),children:`See full activity log →`})]})]})}function WV(){let e=S(`session`)||null,t=e?{level:`session`,sessionId:e}:{level:`global`},n=()=>x({session:null}),r=e=>x({session:e}),i=[];return t.level===`session`&&i.push({label:`All Sessions`,onClick:n},{label:`Session ${t.sessionId.slice(0,12)}`}),(0,w.jsxs)(`div`,{children:[i.length>0&&(0,w.jsx)(XI,{items:i}),t.level===`global`&&(0,w.jsx)(HV,{onSelectSession:r}),t.level===`session`&&(0,w.jsx)(UV,{sessionId:t.sessionId})]})}function GV(e){return e>=1e4?`${(e/1e3).toFixed(1)}k`:e.toLocaleString()}function KV(e){let t=Date.now()-new Date(e).getTime();return t<6e4?`just now`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}function qV({breakdown:e,total:t}){if(t===0)return null;let n=e=>`${Math.round(e/t*100)}%`;return(0,w.jsxs)(`div`,{className:`flex h-3 rounded-full overflow-hidden bg-muted`,children:[e.executed>0&&(0,w.jsx)(`div`,{className:`bg-success transition-all`,style:{width:n(e.executed)},title:`Executed: ${e.executed}`}),e.softRefused>0&&(0,w.jsx)(`div`,{className:`bg-warning transition-all`,style:{width:n(e.softRefused)},title:`Soft Refused: ${e.softRefused}`}),e.passthroughDegraded>0&&(0,w.jsx)(`div`,{className:`bg-amber-600 transition-all`,style:{width:n(e.passthroughDegraded)},title:`Passthrough: ${e.passthroughDegraded}`}),e.childError>0&&(0,w.jsx)(`div`,{className:`bg-error transition-all`,style:{width:n(e.childError)},title:`Errors: ${e.childError}`})]})}function JV({session:e}){return(0,w.jsxs)(`div`,{className:`space-y-5`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:[(0,w.jsxs)(`div`,{className:`card p-4`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Calls`}),(0,w.jsx)(`div`,{className:`font-mono text-2xl font-semibold tabular-nums mt-1`,children:GV(e.totalCalls)})]}),(0,w.jsxs)(`div`,{className:`card p-4`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Tokens Saved`}),(0,w.jsx)(`div`,{className:`font-mono text-2xl font-semibold tabular-nums text-live mt-1`,children:GV(e.totalTokensSaved)}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[`of `,GV(e.totalTokensIn),` in`]})]}),(0,w.jsxs)(`div`,{className:`card p-4`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Avg Latency`}),(0,w.jsxs)(`div`,{className:`font-mono text-2xl font-semibold tabular-nums mt-1`,children:[e.avgLatencyMs.toFixed(1),(0,w.jsx)(`span`,{className:`text-sm t-tertiary ml-1`,children:`ms`})]})]}),(0,w.jsxs)(`div`,{className:`card p-4`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Efficiency`}),(0,w.jsxs)(`div`,{className:`font-mono text-2xl font-semibold tabular-nums text-live mt-1`,children:[Math.round(e.efficiency*100),`%`]})]})]}),(0,w.jsxs)(`div`,{className:`card p-4 space-y-3`,children:[(0,w.jsx)(`h4`,{className:`font-semibold`,children:`Outcome Breakdown`}),(0,w.jsx)(qV,{breakdown:e.outcomeBreakdown,total:e.totalCalls}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-4 text-sm`,children:[(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-success`}),`Executed: `,e.outcomeBreakdown.executed]}),(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-warning`}),`Soft Refused: `,e.outcomeBreakdown.softRefused]}),e.outcomeBreakdown.passthroughDegraded>0&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-amber-600`}),`Passthrough: `,e.outcomeBreakdown.passthroughDegraded]}),e.outcomeBreakdown.childError>0&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-error`}),`Errors: `,e.outcomeBreakdown.childError]})]})]}),e.topTools.length>0&&(0,w.jsxs)(`div`,{className:`card`,children:[(0,w.jsx)(`div`,{className:`p-4 border-b border-border-subtle`,children:(0,w.jsx)(`h4`,{className:`font-semibold`,children:`Top Tools`})}),(0,w.jsx)(`div`,{className:`divide-y divide-border-subtle`,children:e.topTools.map(t=>{let n=e.totalCalls>0?Math.round(t.count/e.totalCalls*100):0;return(0,w.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2.5`,children:[(0,w.jsx)(`span`,{className:`font-mono text-sm`,children:t.name}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`div`,{className:`w-24 h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${n}%`}})}),(0,w.jsx)(`span`,{className:`tabular-nums text-sm w-8 text-right`,children:t.count})]})]},t.name)})})]})]})}function YV(){let[e,t]=(0,f.useState)(null),n=N({queryKey:[`router`,`sessions`],queryFn:()=>O(`/api/router/sessions`),refetchInterval:1e4});if(n.isLoading)return(0,w.jsx)(Wt,{});let r=n.data?.data?.sessions??[];if(r.length===0)return(0,w.jsxs)(`div`,{className:`card p-8 text-center`,children:[(0,w.jsx)(`div`,{className:`text-4xl mb-4`,children:`📊`}),(0,w.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`No Sessions Yet`}),(0,w.jsx)(`p`,{className:`t-secondary max-w-md mx-auto`,children:`Session metrics will appear here once the router processes tool calls. Make sure the router is enabled and your IDE is connected.`})]});let i=e?r.find(t=>t.sessionId===e)??r[0]:r[0];return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,w.jsxs)(`span`,{className:`t-secondary text-sm`,children:[r.length,` session`,r.length===1?``:`s`]})}),(0,w.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[280px_1fr]`,children:[(0,w.jsx)(`div`,{className:`card divide-y divide-border-subtle overflow-hidden`,children:r.map(e=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>t(e.sessionId),className:`w-full px-4 py-3 text-left transition-colors ${i?.sessionId===e.sessionId?`bg-accent/10 border-l-2 border-accent`:`hover:bg-muted/50 border-l-2 border-transparent`}`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-xs truncate max-w-[140px]`,children:[e.sessionId.slice(0,12),`…`]}),(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:KV(e.lastCallTs)})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-xs t-secondary`,children:[(0,w.jsxs)(`span`,{children:[e.totalCalls,` calls`]}),(0,w.jsxs)(`span`,{className:`text-success`,children:[`+`,GV(e.totalTokensSaved),` tok`]})]})]},e.sessionId))}),i&&(0,w.jsx)(JV,{session:i})]})]})}function XV(e){if(!Number.isFinite(e))return`—`;let t=e<0?`-`:``,n=Math.abs(e);if(n<1e3)return`${t}${Math.round(n).toLocaleString()}`;let r=[`K`,`M`,`B`,`T`],i=-1;do n/=1e3,i++;while(n>=999.95&&i<r.length-1);return`${t}${n.toFixed(1).replace(/\.0$/,``)}${r[i]}`}function ZV(e){let t=Date.now()-new Date(e).getTime(),n=Math.round(t/1e3);if(n<60)return`${n}s ago`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function QV(e,t=850){let[n,r]=(0,f.useState)(0),i=(0,f.useRef)(0);return(0,f.useEffect)(()=>{let n=i.current,a=performance.now(),o=0,s=c=>{let l=Math.min(1,(c-a)/t),u=1-(1-l)**3;r(n+(e-n)*u),l<1?o=requestAnimationFrame(s):i.current=e};return o=requestAnimationFrame(s),()=>cancelAnimationFrame(o)},[e,t]),n}function $V({value:e}){return(0,w.jsx)(w.Fragment,{children:XV(QV(e))})}function eH({label:e,value:t,accent:n,hint:r}){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:e}),(0,w.jsx)(`span`,{className:`font-mono text-2xl font-semibold tabular-nums ${n}`,children:(0,w.jsx)($V,{value:t})}),r?(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:r}):null]})}function tH({segments:e}){let t=e.reduce((e,t)=>e+t.value,0)||1;return(0,w.jsx)(`div`,{className:`flex h-2.5 w-full overflow-hidden rounded-full bg-surface-overlay`,children:e.map(e=>e.value>0?(0,w.jsx)(`div`,{className:e.cls,style:{width:`${e.value/t*100}%`},title:`${e.label}: ${e.value}`},e.label):null)})}function nH({outcome:e}){return(0,w.jsx)(`span`,{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${e===`executed`?`bg-success/15 text-success`:e===`soft_refused`?`bg-warning/15 text-warning`:`bg-error/15 text-error`}`,children:e.replace(/_/g,` `)})}function rH(){let e=N({queryKey:[`router`,`status`],queryFn:()=>O(`/api/router/status`),refetchInterval:5e3}),t=N({queryKey:[`router`,`sessions`],queryFn:()=>O(`/api/router/sessions`),refetchInterval:15e3,enabled:e.data?.data?.enabled===!0}),n=N({queryKey:[`router`,`recent`],queryFn:()=>O(`/api/router/recent?limit=100`),refetchInterval:4e3,enabled:e.data?.data?.enabled===!0}),r=t.data?.data?.sessions??[],i=n.data?.data?.records??[],a=(0,f.useMemo)(()=>{let e={calls:0,saved:0,tokensIn:0,refused:0,unlocks:0,latencySum:0,days:new Set};for(let t of r)e.calls+=t.totalCalls,e.saved+=t.totalTokensSaved,e.tokensIn+=t.totalTokensIn,e.refused+=t.softRefuseCount,e.unlocks+=t.unlockCount,e.latencySum+=t.avgLatencyMs*t.totalCalls,e.days.add(t.lastCallTs.slice(0,10));return{...e,avgLatency:e.calls>0?e.latencySum/e.calls:0,sessionCount:r.length,dayCount:e.days.size}},[r]),o=(0,f.useMemo)(()=>{let e=new Map;for(let t of i){let n=t.server??`unerr`,r=e.get(n);r||(r={server:n,calls:0,saved:0,refused:0,latencySum:0,tools:new Set},e.set(n,r)),r.calls++,r.saved+=t.tokensSaved,t.outcome===`soft_refused`&&r.refused++,r.latencySum+=t.latencyMs.total,r.tools.add(t.originalToolName??t.toolName)}return[...e.values()].sort((e,t)=>t.calls-e.calls)},[i]),s=(0,f.useMemo)(()=>{let e=new Map;for(let t of r)for(let n of t.topTools)e.set(n.name,(e.get(n.name)??0)+n.count);let t=[...e.entries()].sort((e,t)=>t[1]-e[1]).slice(0,8).map(([e,t])=>({name:e,count:t}));return{arr:t,max:t[0]?.count??1}},[r]),c=(0,f.useMemo)(()=>{let e=new Map;for(let t of r){let n=t.lastCallTs.slice(0,10),r=e.get(n)??{calls:0,saved:0};r.calls+=t.totalCalls,r.saved+=t.totalTokensSaved,e.set(n,r)}let t=[...e.entries()].sort((e,t)=>e[0].localeCompare(t[0])).slice(-14).map(([e,t])=>({day:e,...t}));return{arr:t,max:Math.max(1,...t.map(e=>e.calls))}},[r]),l=(0,f.useMemo)(()=>{let e={executed:0,softRefused:0,degraded:0,error:0};for(let t of r)e.executed+=t.outcomeBreakdown.executed,e.softRefused+=t.outcomeBreakdown.softRefused,e.degraded+=t.outcomeBreakdown.passthroughDegraded,e.error+=t.outcomeBreakdown.childError;return e},[r]);if(e.isLoading)return(0,w.jsx)(Wt,{});let u=e.data?.data;if(!u)return(0,w.jsx)(Wt,{});if(!u.enabled)return(0,w.jsxs)(`div`,{className:`card p-8 text-center`,children:[(0,w.jsx)(`div`,{className:`mb-4 text-4xl`,children:`⏸`}),(0,w.jsx)(`h2`,{className:`mb-2 text-xl font-semibold`,children:`MCP Router is idle`}),(0,w.jsx)(`p`,{className:`t-secondary mx-auto max-w-md`,children:`The gateway records every tool dispatch the moment your agent connects. If you are seeing this, no session has routed a call yet — run a tool and it will light up.`})]});let d=u.session,p=Math.max(o.length,1),m=a.calls>0?a.calls:d?.totalCalls??0,h=a.saved>0?a.saved:d?.totalTokensSaved??0,g=a.refused>0?a.refused:d?.softRefuseCount??0,_=a.unlocks>0?a.unlocks:d?.unlockCount??0;return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,w.jsx)(`div`,{children:(0,w.jsxs)(`p`,{className:`t-secondary text-sm`,children:[`One endpoint in front of`,` `,(0,w.jsx)(`span`,{className:`font-mono text-foreground-emphasis`,children:p}),` `,`MCP server`,p===1?``:`s`,` ·`,` `,a.dayCount>0?`${a.dayCount}-day`:`live`,` history`]})}),(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-success/15 px-3 py-1 text-sm font-medium text-success`,children:[(0,w.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-success shadow-[0_0_6px_rgba(52,211,153,0.7)]`}),`Routing live`]})]}),(0,w.jsx)(`section`,{className:`glass-panel rounded-xl p-6`,children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 sm:flex-row sm:items-center`,children:[(0,w.jsxs)(`div`,{className:`sm:w-72`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Tool calls routed`}),(0,w.jsx)(`div`,{className:`mt-1 font-mono text-6xl font-semibold leading-none tabular-nums text-foreground-emphasis`,children:(0,w.jsx)($V,{value:m})}),(0,w.jsx)(`p`,{className:`t-tertiary mt-2 text-xs`,children:`every call your agent made — classified, gated, and forwarded in under 5\xA0ms each`})]}),(0,w.jsxs)(`div`,{className:`grid flex-1 grid-cols-2 gap-x-6 gap-y-5 border-t border-border-subtle pt-5 sm:grid-cols-3 sm:border-l sm:border-t-0 sm:pl-6 sm:pt-0`,children:[(0,w.jsx)(eH,{label:`Tokens saved`,value:h,accent:`text-emerald-400`,hint:`of ${XV(a.tokensIn||(d?.totalTokensIn??0))} seen`}),(0,w.jsx)(eH,{label:`Wasteful calls blocked`,value:g,accent:`text-amber-400`,hint:`soft-refused before forwarding`}),(0,w.jsx)(eH,{label:`Tools unlocked`,value:_,accent:`text-cyan-400`,hint:`surfaced as your pattern earned them`}),(0,w.jsx)(eH,{label:`Avg latency`,value:Math.round(a.avgLatency||0),accent:`text-foreground-emphasis`,hint:`ms per routed call`}),(0,w.jsx)(eH,{label:`Sessions`,value:a.sessionCount,accent:`text-foreground-emphasis`,hint:`over ${a.dayCount} day${a.dayCount===1?``:`s`}`}),(0,w.jsx)(eH,{label:`Servers`,value:p,accent:`text-fuchsia-400`,hint:`on the bus`})]})]})}),(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Servers on the bus`}),(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`last 100 calls`})]}),(0,w.jsxs)(`p`,{className:`t-tertiary mb-4 text-xs`,children:[`Each MCP server routed through this endpoint, with the traffic it drove. Connect more with`,` `,(0,w.jsx)(`code`,{className:`rounded bg-surface-overlay px-1 py-0.5 font-mono text-[11px]`,children:`unerr enable mcp-router`}),` `,`and they appear here automatically.`]}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[o.map(e=>(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle bg-surface-overlay/40 p-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-success shadow-[0_0_4px_rgba(52,211,153,0.6)]`}),(0,w.jsx)(`span`,{className:`font-medium`,children:e.server}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[e.tools.size,` tool`,e.tools.size===1?``:`s`]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-4 text-sm tabular-nums`,children:[(0,w.jsxs)(`span`,{className:`font-mono`,children:[XV(e.calls),` calls`]}),(0,w.jsxs)(`span`,{className:`font-mono text-emerald-400`,children:[`+`,XV(e.saved),` tok`]}),(0,w.jsxs)(`span`,{className:`font-mono t-tertiary`,children:[Math.round(e.latencySum/Math.max(1,e.calls)),`ms`]})]})]}),(0,w.jsx)(`div`,{className:`mt-2`,children:(0,w.jsx)(tH,{segments:[{value:e.calls-e.refused,cls:`bg-success`,label:`executed`},{value:e.refused,cls:`bg-warning`,label:`soft-refused`}]})})]},e.server)),(0,w.jsx)(`div`,{className:`rounded-lg border border-dashed border-border-subtle p-3 text-center`,children:(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`+ your other MCP servers land here once consolidated`})})]})]}),(0,w.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Routing outcomes`}),(0,w.jsx)(`p`,{className:`t-tertiary mb-4 mt-1 text-xs`,children:`What the gateway did with each call it saw.`}),(()=>{let e=l.executed+l.softRefused+l.degraded+l.error||1,t=t=>Math.round(t/e*100);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(tH,{segments:[{value:l.executed,cls:`bg-success`,label:`executed`},{value:l.softRefused,cls:`bg-warning`,label:`soft-refused`},{value:l.degraded,cls:`bg-cyan-500`,label:`degraded`},{value:l.error,cls:`bg-error`,label:`error`}]}),(0,w.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-x-4 gap-y-2 text-sm`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`Executed`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-success`,children:[l.executed,` · `,t(l.executed),`%`]})]}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`Soft-refused`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-warning`,children:[l.softRefused,` ·`,` `,t(l.softRefused),`%`]})]}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`Degraded`}),(0,w.jsx)(`span`,{className:`font-mono tabular-nums t-tertiary`,children:l.degraded})]}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`Errors`}),(0,w.jsx)(`span`,{className:`font-mono tabular-nums t-tertiary`,children:l.error})]})]}),l.softRefused>0&&(0,w.jsxs)(`div`,{className:`mt-4 rounded-lg border border-warning/30 bg-warning/10 p-3 text-sm`,children:[(0,w.jsxs)(`span`,{className:`font-medium text-warning`,children:[l.softRefused,` wasteful call`,l.softRefused===1?``:`s`,` blocked`]}),(0,w.jsxs)(`span`,{className:`t-secondary`,children:[` `,`— the router refused redundant or low-value calls before they spent tokens.`]})]})]})})()]}),(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Most-routed tools`}),(0,w.jsx)(`p`,{className:`t-tertiary mb-4 mt-1 text-xs`,children:`Where your agent's traffic actually goes.`}),(0,w.jsxs)(`div`,{className:`space-y-2.5`,children:[s.arr.map(e=>(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`span`,{className:`w-40 truncate font-mono text-xs`,children:e.name}),(0,w.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-surface-overlay`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full bg-cyan-400/80`,style:{width:`${e.count/s.max*100}%`}})}),(0,w.jsx)(`span`,{className:`w-10 text-right font-mono text-xs tabular-nums t-secondary`,children:e.count})]},e.name)),s.arr.length===0&&(0,w.jsx)(`p`,{className:`t-tertiary text-sm`,children:`No tool calls recorded yet.`})]})]})]}),c.arr.length>1&&(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Routing volume by day`}),(0,w.jsx)(`div`,{className:`mt-4 flex items-end gap-2`,style:{height:96},children:c.arr.map(e=>(0,w.jsxs)(`div`,{className:`group flex flex-1 flex-col items-center justify-end gap-1`,title:`${e.day}: ${e.calls} calls · +${XV(e.saved)} tokens`,children:[(0,w.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums t-tertiary opacity-0 transition-opacity group-hover:opacity-100`,children:e.calls}),(0,w.jsx)(`div`,{className:`w-full rounded-t bg-fuchsia-500/60 transition-all group-hover:bg-fuchsia-400`,style:{height:`${e.calls/c.max*76}px`}}),(0,w.jsx)(`span`,{className:`font-mono text-[10px] t-tertiary`,children:e.day.slice(5)})]},e.day))})]}),i.length>0&&(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-subtle p-4`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Live call feed`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[i.length,` most recent`]})]}),(0,w.jsx)(`div`,{className:`max-h-96 overflow-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,w.jsx)(`thead`,{className:`sticky top-0 bg-surface-overlay/80 backdrop-blur`,children:(0,w.jsxs)(`tr`,{className:`t-tertiary`,children:[(0,w.jsx)(`th`,{className:`px-4 py-2 text-left font-medium`,children:`Tool`}),(0,w.jsx)(`th`,{className:`px-4 py-2 text-left font-medium`,children:`Server`}),(0,w.jsx)(`th`,{className:`px-4 py-2 text-left font-medium`,children:`Outcome`}),(0,w.jsx)(`th`,{className:`px-4 py-2 text-right font-medium`,children:`Saved`}),(0,w.jsx)(`th`,{className:`px-4 py-2 text-right font-medium`,children:`Latency`}),(0,w.jsx)(`th`,{className:`px-4 py-2 text-right font-medium`,children:`When`})]})}),(0,w.jsx)(`tbody`,{className:`divide-y divide-border-subtle`,children:i.slice().reverse().map((e,t)=>(0,w.jsxs)(`tr`,{className:`hover:bg-surface-overlay/40`,children:[(0,w.jsxs)(`td`,{className:`px-4 py-2 font-mono text-xs`,children:[e.toolName,e.wasMasked&&(0,w.jsx)(`span`,{className:`ml-1.5 inline-flex items-center rounded-full border border-zinc-700 bg-zinc-800 px-1.5 py-0.5 text-[9px] font-medium text-zinc-400`,children:`masked`})]}),(0,w.jsx)(`td`,{className:`px-4 py-2 t-tertiary text-xs`,children:e.server??`unerr`}),(0,w.jsx)(`td`,{className:`px-4 py-2`,children:(0,w.jsx)(nH,{outcome:e.outcome})}),(0,w.jsx)(`td`,{className:`px-4 py-2 text-right tabular-nums text-emerald-400`,children:e.tokensSaved>0?`+${e.tokensSaved}`:`—`}),(0,w.jsxs)(`td`,{className:`px-4 py-2 text-right tabular-nums t-tertiary`,children:[e.latencyMs.total.toFixed(0),`ms`]}),(0,w.jsx)(`td`,{className:`px-4 py-2 text-right tabular-nums t-tertiary`,children:ZV(e.ts)})]},`${e.ts}-${t}`))})]})})]})]})}var iH={page:1,perPage:15,density:`comfortable`},aH=new Set([`comfortable`,`compact`]);function oH(){if(typeof window>`u`)return{...iH};let e=window.location.hash.replace(/^#/,``),t=e.indexOf(`?`);if(t===-1)return{...iH};let n=new URLSearchParams(e.slice(t+1)),r={...iH},i=Number(n.get(`from`));Number.isFinite(i)&&i>0&&(r.from=i);let a=Number(n.get(`to`));Number.isFinite(a)&&a>0&&(r.to=a);let o=n.get(`session`);o&&o.length>0&&(r.session=o);let s=n.get(`agent`);s&&s.length>0&&(r.agent=s);let c=n.get(`type`);c&&c.length>0&&(r.type=c);let l=n.get(`q`);l&&l.length>0&&(r.q=l);let u=Number(n.get(`page`));Number.isInteger(u)&&u>0&&(r.page=u);let d=Number(n.get(`perPage`));Number.isInteger(d)&&d>0&&d<=200&&(r.perPage=d);let f=n.get(`density`);return f&&aH.has(f)&&(r.density=f),r}function sH(e){let t=new URLSearchParams;e.from!==void 0&&t.set(`from`,String(e.from)),e.to!==void 0&&t.set(`to`,String(e.to)),e.session&&t.set(`session`,e.session),e.agent&&t.set(`agent`,e.agent),e.type&&t.set(`type`,e.type),e.q&&t.set(`q`,e.q),e.page!==iH.page&&t.set(`page`,String(e.page)),e.perPage!==iH.perPage&&t.set(`perPage`,String(e.perPage)),e.density!==iH.density&&t.set(`density`,e.density);let n=t.toString();return n.length>0?`?${n}`:``}var cH=``,lH=oH();function uH(){if(typeof window>`u`)return lH;let e=window.location.hash;return e!==cH&&(cH=e,lH=oH()),lH}function dH(e){return typeof window>`u`?()=>{}:(window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e))}function fH(){let e=(0,f.useSyncExternalStore)(dH,uH,uH),t=(0,f.useCallback)(e=>{if(typeof window>`u`)return;let t=`#${window.location.hash.replace(/^#/,``).split(`?`)[0]||`/activity`}${sH(e)}`;window.location.hash!==t&&(window.history.replaceState(null,``,t),window.dispatchEvent(new HashChangeEvent(`hashchange`)))},[]),n=(0,f.useCallback)(n=>{let r={...e,...n},i=`page`in n,a=Object.keys(n).every(e=>e===`density`);!i&&!a&&(r.page=1),t(r)},[e,t]),r=(0,f.useCallback)(()=>{t({...iH})},[t]);return(0,f.useEffect)(()=>{cH=``},[]),{filters:e,setFilters:n,clear:r}}function pH(e){let t=[];return(e.from!==void 0||e.to!==void 0)&&t.push({key:`from`,label:hH(e.from,e.to)}),e.session&&t.push({key:`session`,label:`Session ${e.session.slice(0,8)}`}),e.agent&&t.push({key:`agent`,label:`Agent: ${e.agent}`}),e.type&&t.push({key:`type`,label:mH(e.type)}),e.q&&t.push({key:`q`,label:`“${e.q}”`}),t}function mH(e){switch(e){case`mark_intent`:return`🎯 Goals only`;case`mark_decision`:return`💡 Decisions only`;case`mark_blocker`:return`⚠ Stuck moments only`;case`mark_resolution`:return`✅ Solutions only`;default:return e}}function hH(e,t){return e&&t?`${gH(e)} → ${gH(t)}`:e?`Since ${gH(e)}`:t?`Until ${gH(t)}`:`All time`}function gH(e){return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function _H(e,t){if(!Number.isFinite(t)||e.length===0)return null;let n=e.find(e=>e.started_at<=t&&t<=e.ended_at);return n?n.turn_id:e.filter(e=>e.started_at<=t).sort((e,t)=>t.started_at-e.started_at)[0]?.turn_id??null}function vH(e,t=Date.now()){if(e===`all`)return{};let n=1440*6e4;if(e===`today`){let e=new Date(t);return e.setHours(0,0,0,0),{from:e.getTime(),to:t}}return e===`7d`?{from:t-7*n,to:t}:e===`30d`?{from:t-30*n,to:t}:{}}var yH=[{value:``,label:`All notes`,emoji:`▣`,color:`text-zinc-300`},{value:`mark_intent`,label:`Goals`,emoji:`🎯`,color:`text-violet-300`},{value:`mark_decision`,label:`Decisions`,emoji:`💡`,color:`text-cyan-300`},{value:`mark_blocker`,label:`Stuck moments`,emoji:`⚠`,color:`text-rose-300`},{value:`mark_resolution`,label:`Solutions`,emoji:`✅`,color:`text-emerald-300`}];function bH(e){return yH.find(t=>t.value===e)??{value:e,label:e,emoji:`•`,color:`text-zinc-300`}}function xH(e){if(!Number.isFinite(e)||e<=0)return`—`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function SH(e){return!Number.isFinite(e)||e<=0?`—`:new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function CH(e){return!Number.isFinite(e)||e<=0?`—`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function wH(e){return!Number.isFinite(e)||e<=0?`—`:new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function TH(e){if(!Number.isFinite(e)||e<=0)return`just now`;let t=Math.round(e/1e3);if(t<60)return`${t}s ago`;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 EH(e){if(!e)return``;let t=new Date(e).getTimezoneOffset()*6e4;return new Date(e-t).toISOString().slice(0,10)}function DH(e,t=!1){if(!e)return;let n=Date.parse(e);if(Number.isFinite(n))return t?n+1440*6e4-1:n}function OH(e){let t={},n=e.match(/What:\s*([^.]+?)(?:\.|$)/i);n&&(t.what=n[1].trim());let r=e.match(/Why:\s*([^.]+?)(?:\.|$)/i);r&&(t.why=r[1].trim());let i=e.match(/How:\s*([^.]+?)(?:\.|$)/i);return i&&(t.how=i[1].trim()),t}function kH(){let{url:e,queryKey:t}=Ot(),{filters:n,setFilters:r,clear:i}=fH(),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(null),{data:l,error:u}=N({queryKey:t([`timeline`,`health`]),queryFn:()=>O(e(`/api/timeline/health`)),staleTime:3e4,retry:!1}),d=!!l?.data?.ok&&!u,p=(0,f.useMemo)(()=>nU(n),[n]),{data:m,isFetching:h}=N({queryKey:t([`timeline`,`turns`,p]),queryFn:()=>O(e(`/api/timeline/turns?${p}`)),staleTime:1e4,enabled:d}),g=m?.data??[],_=m?.total??0,v=Math.max(1,Math.ceil(_/n.perPage)),y=(0,f.useMemo)(()=>{let e=new URLSearchParams;return n.session&&e.set(`session_id`,n.session),n.type&&e.set(`type`,n.type),e.set(`limit`,`500`),e.toString()},[n.session,n.type]),{data:b}=N({queryKey:t([`timeline`,`markers`,y]),queryFn:()=>O(e(`/api/timeline/markers?${y}`)),staleTime:1e4,enabled:d}),C=b?.data??[],T=(0,f.useMemo)(()=>rU(C),[C]),{data:E}=N({queryKey:t([`timeline`,`sessions`]),queryFn:()=>O(e(`/api/timeline/sessions?limit=200`)),staleTime:3e4,enabled:d}),ee=E?.data??[],{data:te}=N({queryKey:t([`timeline`,`agents`]),queryFn:()=>O(e(`/api/timeline/agents`)),staleTime:6e4,enabled:d}),D=te?.data??[],{data:ne}=N({queryKey:t([`timeline`,`heatmap`]),queryFn:()=>O(e(`/api/timeline/heatmap?days=30`)),staleTime:6e4,enabled:d}),{data:re}=N({queryKey:t([`timeline`,`resume`]),queryFn:()=>O(e(`/api/timeline/resume`)),staleTime:15e3,enabled:d}),ie=re?.data??null,{data:k}=N({queryKey:t([`timeline`,`intents`]),queryFn:()=>O(e(`/api/timeline/intents?limit=10`)),staleTime:3e4,enabled:d}),A=k?.data??[],{data:ae}=N({queryKey:t([`facts`,`episodic`]),queryFn:()=>O(e(`/api/facts?type=episodic&limit=50`)),staleTime:3e4,retry:!1}),j=ae?.data??[],M=(0,f.useMemo)(()=>{let e=new Map;for(let t of j){let n=e.get(t.scope)??[];n.push(t),e.set(t.scope,n)}return e},[j]),oe=(0,f.useMemo)(()=>n.agent?ee.filter(e=>e.agent_name===n.agent):ee,[ee,n.agent]);(0,f.useEffect)(()=>{if(!a)return;let e=e=>{e.key===`Escape`&&o(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]);let se=S(`anchor_ts`),ce=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!se||g.length===0||ce.current===se)return;ce.current=se;let e=_H(g,Number(se));e&&o(e),x({anchor_ts:null})},[se,g]);let le=s===null?_<=3:s;if(u||!d)return(0,w.jsx)(AH,{});let ue=pH(n),de=a?g.find(e=>e.turn_id===a)??null:null,fe=a?T.get(a)??[]:[];return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[le&&(0,w.jsx)(jH,{onDismiss:()=>c(!1)}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-6 border-l-4 border-violet-500/60`,children:[(0,w.jsx)(`h2`,{className:`text-foreground font-semibold text-base`,children:`What has your agent been doing?`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-1 max-w-xl leading-relaxed`,children:`A complete timeline of every task your AI agent worked on — what it tried, what decisions it made, and where it got stuck. Think of it as the commit history for your agent's reasoning.`})]}),(0,w.jsx)(MH,{activityCount:_,sessionCount:ee.length,taskCount:A.filter(e=>e.status===`active`).length,unresolvedCount:ie?.open_threads.length??0}),(0,w.jsx)(FH,{filters:n,sessions:oe,agents:D,chips:ue,onChange:r,onClear:i,isFetching:h}),ie&&(0,w.jsx)(BH,{resume:ie}),(0,w.jsxs)(`div`,{className:`space-y-5`,children:[ne&&ne.data.length>0&&(0,w.jsx)(VH,{buckets:ne.data,filters:n,onDayClick:e=>{r({from:e,to:e+1440*6e4-1})}}),A.length>0&&(0,w.jsx)(WH,{intents:A}),(0,w.jsx)(GH,{turns:g,markersByTurn:T,filters:n,totalTurns:_,totalPages:v,onPageChange:e=>r({page:e}),onTurnClick:e=>o(e),selectedTurnId:a,isFetching:h})]}),de&&(0,w.jsx)(ZH,{turn:de,markers:fe,episodicByFile:M,onClose:()=>o(null)})]})}function AH(){return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-l-4 border-amber-500/60`,children:[(0,w.jsx)(`div`,{className:`text-amber-400 text-[10px] uppercase tracking-wider font-medium`,children:`Activity tracking isn't active`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-2 leading-relaxed`,children:`unerr records your agent's activity while it's running. Restart unerr and reload this page to see the timeline.`})]})}function jH({onDismiss:e}){return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-l-4 border-violet-500/60 relative`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:e,className:`absolute top-3 right-3 t-tertiary hover:text-foreground text-xs px-2 py-0.5`,"aria-label":`Dismiss explainer`,children:`✕`}),(0,w.jsx)(`h3`,{className:`text-violet-400 text-[10px] uppercase tracking-wider font-medium`,children:`How to read this page`}),(0,w.jsxs)(`ul`,{className:`t-secondary text-xs space-y-1.5 leading-relaxed mt-2 max-w-2xl`,children:[(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`strong`,{className:`text-foreground`,children:`Each row is one task`}),` your agent worked on — it could be a bug fix, a refactor, a feature, or an exploration. Click any row to see the full details.`]}),(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`strong`,{className:`text-foreground`,children:`Goals, decisions, and problems`}),` are tracked automatically as your agent works, turning raw actions into a readable story.`]}),(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`strong`,{className:`text-foreground`,children:`Use the filters`}),` to narrow down to a specific day, session, agent, or keyword. Share the URL to show someone exactly what your agent did.`]})]}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-3`,children:`The more your agent uses unerr, the richer this timeline becomes — you'll see task titles, decisions made, and problems encountered.`})]})}function MH({activityCount:e,sessionCount:t,taskCount:n,unresolvedCount:r}){return(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,w.jsx)(PH,{label:`Agent actions`,sublabel:`distinct tasks the agent worked on`,value:e,accent:`cyan`}),(0,w.jsx)(PH,{label:`Sessions`,sublabel:`separate conversations with your agent`,value:t,accent:`emerald`}),(0,w.jsx)(PH,{label:`Active tasks`,sublabel:`goals the agent is currently tracking`,value:n,accent:`violet`}),(0,w.jsx)(PH,{label:`Unresolved`,sublabel:r>0?`problems flagged but not yet fixed`:`all clear — nothing stuck`,value:r,accent:r>0?`rose`:`zinc`})]})}var NH={cyan:{border:`border-cyan-500/60`,label:`text-cyan-400`,value:`text-cyan-400`},emerald:{border:`border-emerald-500/60`,label:`text-emerald-400`,value:`text-emerald-400`},violet:{border:`border-violet-500/60`,label:`text-violet-400`,value:`text-violet-400`},rose:{border:`border-rose-500/60`,label:`text-rose-400`,value:`text-rose-400`},zinc:{border:`border-border-subtle`,label:`t-tertiary`,value:`text-foreground`}};function PH({label:e,sublabel:t,value:n,accent:r=`zinc`}){let i=NH[r];return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-t-2 ${i.border}`,title:t,children:[(0,w.jsx)(`p`,{className:`${i.label} text-[10px] uppercase tracking-wider font-medium`,children:e}),(0,w.jsx)(`p`,{className:`text-3xl font-bold font-mono ${i.value} mt-2`,children:n.toLocaleString()}),(0,w.jsx)(`p`,{className:`t-secondary text-xs mt-1`,children:t})]})}function FH({filters:e,sessions:t,agents:n,chips:r,onChange:i,onClear:a,isFetching:o}){let[s,c]=(0,f.useState)(e.q??``);return(0,f.useEffect)(()=>{c(e.q??``)},[e.q]),(0,f.useEffect)(()=>{let t=setTimeout(()=>{(e.q??``)!==s&&i({q:s||void 0})},350);return()=>clearTimeout(t)},[s,e.q,i]),(0,w.jsxs)(`div`,{className:`sticky top-0 z-20 -mx-6 px-6 py-3 bg-background/85 backdrop-blur border-b border-border-subtle space-y-2`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(IH,{value:(0,f.useMemo)(()=>{if(!e.from&&!e.to)return`all`;let t=Date.now(),n=vH(`7d`,t),r=vH(`30d`,t),i=vH(`today`,t);return e.from&&Math.abs(e.from-(n.from??0))<6e4&&e.to&&Math.abs(e.to-(n.to??0))<6e4?`7d`:e.from&&Math.abs(e.from-(r.from??0))<6e4&&e.to&&Math.abs(e.to-(r.to??0))<6e4?`30d`:e.from&&Math.abs(e.from-(i.from??0))<6e4&&e.to&&Math.abs(e.to-(i.to??0))<6e4?`today`:`custom`},[e.from,e.to]),onChange:e=>{if(e===`custom`)return;let t=vH(e);i({from:t.from,to:t.to})}}),(0,w.jsx)(LH,{from:e.from,to:e.to,onChange:(e,t)=>i({from:e,to:t})}),n.length>0&&(0,w.jsxs)(RH,{value:e.agent??``,onChange:e=>i({agent:e||void 0}),ariaLabel:`Filter by AI agent`,children:[(0,w.jsxs)(`option`,{value:``,children:[`All AI agents (`,n.length,`)`]}),n.map(e=>(0,w.jsxs)(`option`,{value:e.agent_name,children:[e.agent_name,` — `,e.session_count,` session`,e.session_count===1?``:`s`]},e.agent_name))]}),(0,w.jsxs)(RH,{value:e.session??``,onChange:e=>i({session:e||void 0}),ariaLabel:`Filter by coding session`,children:[(0,w.jsxs)(`option`,{value:``,children:[`All sessions (`,t.length,`)`]}),t.map(e=>(0,w.jsxs)(`option`,{value:e.session_id,children:[wH(e.last_seen),` — `,e.turn_count,` action`,e.turn_count===1?``:`s`,e.agent_name&&e.agent_name!==`unknown`?` · ${e.agent_name}`:``]},e.session_id))]}),(0,w.jsx)(RH,{value:e.type??``,onChange:e=>i({type:e||void 0}),ariaLabel:`Filter by note type`,children:yH.map(e=>(0,w.jsxs)(`option`,{value:e.value,children:[e.emoji,` `,e.label]},e.value))}),(0,w.jsx)(`input`,{type:`search`,value:s,onChange:e=>c(e.target.value),placeholder:`Search your work…`,className:`flex-1 min-w-[160px] rounded-md border border-border-subtle bg-surface-secondary px-3 py-1.5 text-sm text-foreground placeholder-muted-foreground focus:outline-none focus:ring-1 focus:ring-violet-500`,"aria-label":`Search activity titles`}),(0,w.jsx)(zH,{value:e.density,onChange:e=>i({density:e})}),o&&(0,w.jsx)(`span`,{className:`text-[11px] t-tertiary font-mono`,children:`loading…`})]}),r.length>0&&(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[r.map(e=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>{e.key===`from`?i({from:void 0,to:void 0}):e.key===`session`?i({session:void 0}):e.key===`agent`?i({agent:void 0}):e.key===`type`?i({type:void 0}):e.key===`q`&&i({q:void 0})},className:`inline-flex items-center gap-1 rounded-full border border-violet-500/40 bg-violet-500/10 px-2 py-0.5 text-[11px] text-violet-300 hover:border-violet-400 hover:bg-violet-500/20`,children:[e.label,(0,w.jsx)(`span`,{"aria-hidden":!0,children:`✕`})]},e.key)),(0,w.jsx)(`button`,{type:`button`,onClick:a,className:`text-[11px] t-tertiary hover:text-foreground underline-offset-2 hover:underline ml-1`,children:`Clear all filters`})]})]})}function IH({value:e,onChange:t}){return(0,w.jsx)(`div`,{className:`inline-flex rounded-md border border-border-subtle overflow-hidden`,children:[{id:`today`,label:`Today`},{id:`7d`,label:`Last 7 days`},{id:`30d`,label:`Last 30 days`},{id:`all`,label:`All time`}].map((n,r)=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>t(n.id),className:`px-2.5 py-1 text-xs transition-colors ${e===n.id?`bg-violet-500/30 text-violet-200`:`bg-surface-secondary t-secondary hover:bg-surface-secondary/70`} ${r>0?`border-l border-border-subtle`:``}`,children:n.label},n.id))})}function LH({from:e,to:t,onChange:n}){return(0,w.jsxs)(`div`,{className:`inline-flex items-center gap-1 text-xs t-secondary`,children:[(0,w.jsx)(`input`,{type:`date`,"aria-label":`From date`,value:EH(e),onChange:e=>n(DH(e.target.value,!1),t),className:`rounded-md border border-border-subtle bg-surface-secondary px-2 py-1 text-foreground`}),(0,w.jsx)(`span`,{children:`→`}),(0,w.jsx)(`input`,{type:`date`,"aria-label":`To date`,value:EH(t),onChange:t=>n(e,DH(t.target.value,!0)),className:`rounded-md border border-border-subtle bg-surface-secondary px-2 py-1 text-foreground`})]})}function RH({value:e,onChange:t,ariaLabel:n,children:r}){return(0,w.jsx)(`select`,{value:e,onChange:e=>t(e.target.value),"aria-label":n,className:`rounded-md border border-border-subtle bg-surface-secondary px-2 py-1 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-violet-500 max-w-[260px]`,children:r})}function zH({value:e,onChange:t}){return(0,w.jsxs)(`div`,{className:`inline-flex rounded-md border border-border-subtle overflow-hidden`,role:`group`,"aria-label":`Row density`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>t(`comfortable`),className:`px-2 py-1 text-[11px] transition-colors ${e===`comfortable`?`bg-violet-500/30 text-violet-200`:`bg-surface-secondary t-secondary hover:bg-surface-secondary/70`}`,title:`Spacious rows`,"aria-pressed":e===`comfortable`,children:`☰`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>t(`compact`),className:`px-2 py-1 text-[11px] border-l border-border-subtle transition-colors ${e===`compact`?`bg-violet-500/30 text-violet-200`:`bg-surface-secondary t-secondary hover:bg-surface-secondary/70`}`,title:`Dense rows`,"aria-pressed":e===`compact`,children:`≡`})]})}function BH({resume:e}){let t=e.intent&&e.intent.length>0?e.intent:`your last session`;return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-l-4 border-cyan-500/60 flex flex-wrap items-start gap-6`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`div`,{className:`text-cyan-400 text-[10px] uppercase tracking-wider font-medium`,children:`Pick up where you left off`}),(0,w.jsx)(`div`,{className:`text-foreground text-sm font-medium mt-2 truncate`,children:t}),(0,w.jsxs)(`div`,{className:`t-tertiary text-xs mt-1`,children:[`Last active `,TH(e.elapsed_ms),` · session`,` `,(0,w.jsx)(`span`,{className:`font-mono`,children:e.session_id.slice(0,8)})]})]}),e.open_threads.length>0&&(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`div`,{className:`text-rose-400 text-[10px] uppercase tracking-wider font-medium`,children:[`Unresolved (`,e.open_threads.length,`)`]}),(0,w.jsx)(`ul`,{className:`space-y-1 mt-2`,children:e.open_threads.slice(0,3).map(e=>(0,w.jsxs)(`li`,{className:`t-secondary text-xs`,children:[(0,w.jsx)(`span`,{className:`text-rose-400`,children:`⚠`}),` `,e.text,e.file_path&&(0,w.jsxs)(`span`,{className:`t-tertiary font-mono ml-1`,children:[`(`,e.file_path,`)`]})]},e.marker_id))})]})]})}function VH({buckets:e,filters:t,onDayClick:n}){let r=Math.max(1,...e.map(e=>e.turns)),i=e.reduce((e,t)=>e+t.turns,0);return(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle bg-surface-secondary/40 px-4 py-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`text-[11px] uppercase tracking-wider t-secondary font-mono`,children:[`Last `,e.length,` days`]}),(0,w.jsxs)(`div`,{className:`text-[11px] t-tertiary mt-0.5`,children:[i.toLocaleString(),` action`,i===1?``:`s`,` tracked — brighter means busier, click any day to zoom in`]})]}),(0,w.jsxs)(`div`,{className:`text-[11px] t-tertiary font-mono`,children:[`peak `,r,`/day`]})]}),(0,w.jsx)(`div`,{className:`flex items-end gap-[3px] pb-1`,children:e.map(e=>(0,w.jsx)(HH,{bucket:e,max:r,active:UH(e.ts,t),onClick:()=>n(e.ts)},e.ts))})]})}function HH({bucket:e,max:t,active:n,onClick:r}){let i=e.turns===0?0:e.turns/t,a=e.turns===0?`bg-foreground/10 border border-border-subtle`:i>.75?`bg-violet-400`:i>.5?`bg-violet-500/85`:i>.25?`bg-violet-500/55`:`bg-violet-500/30`,o=n?`ring-2 ring-cyan-400`:``,s=`${CH(e.ts)} — ${e.turns} action${e.turns===1?``:`s`}, ${e.edits} file edit${e.edits===1?``:`s`}, ${e.tools} step${e.tools===1?``:`s`}`;return(0,w.jsx)(`button`,{type:`button`,onClick:r,title:s,className:`h-8 flex-1 min-w-[8px] rounded-sm hover:scale-110 transition-transform ${a} ${o}`,"aria-label":s})}function UH(e,t){return!t.from||!t.to?!1:Math.abs(t.from-e)<6e4&&t.to-t.from<1440*6e4*1.1}function WH({intents:e}){let t=e.filter(e=>e.status!==`dormant`),n=e.filter(e=>e.status===`dormant`).slice(0,3);return t.length===0&&n.length===0?null:(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`div`,{className:`text-violet-400 text-[10px] uppercase tracking-wider font-medium mb-3`,children:`Tasks you've been working on`}),(0,w.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2`,children:t.slice(0,6).map(e=>(0,w.jsxs)(`div`,{className:`rounded border border-violet-500/30 bg-violet-500/10 px-3 py-2`,children:[(0,w.jsx)(`div`,{className:`text-foreground text-sm font-medium truncate`,children:e.title||`(unnamed task)`}),(0,w.jsxs)(`div`,{className:`t-tertiary text-[11px] mt-1`,children:[`Last active `,TH(Date.now()-e.last_active_at),e.source===`agent_marker`?` · from agent's stated goal`:` · detected from code changes`]})]},e.intent_id))}),n.length>0&&(0,w.jsxs)(`div`,{className:`mt-3 t-tertiary text-[11px]`,children:[`Older tasks (`,n.length,`):`,` `,n.map(e=>e.title||`(unnamed)`).join(` · `)]})]})}function GH({turns:e,markersByTurn:t,filters:n,totalTurns:r,totalPages:i,onPageChange:a,onTurnClick:o,selectedTurnId:s,isFetching:c}){let l=n.density===`compact`;return(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-l-4 border-fuchsia-500/60`,children:[(0,w.jsx)(`div`,{className:`text-fuchsia-400 text-[10px] uppercase tracking-wider font-medium`,children:`Patterns unerr noticed`}),(0,w.jsx)(`div`,{className:`t-tertiary text-xs leading-relaxed mt-2 max-w-2xl`,children:`Over time, unerr spots patterns — files your agent keeps coming back to, problems that recur, and conventions it has learned. The more sessions you run, the smarter these insights become.`})]}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between text-xs t-tertiary`,children:[(0,w.jsx)(`span`,{children:r===0?`Nothing matches the current filters yet.`:`Showing ${e.length} of ${r.toLocaleString()} action${r===1?``:`s`}`}),(0,w.jsxs)(`span`,{className:`font-mono`,children:[`page `,n.page,` / `,i]})]}),e.length===0?(0,w.jsx)(KH,{isFetching:c}):(0,w.jsx)(`div`,{className:l?`divide-y divide-border-subtle rounded-lg border border-border-subtle overflow-hidden el-raised`:`space-y-2`,children:e.map(e=>(0,w.jsx)(JH,{turn:e,markers:t.get(e.turn_id)??[],compact:l,active:s===e.turn_id,onClick:()=>o(e.turn_id)},e.turn_id))}),i>1&&(0,w.jsx)(YH,{page:n.page,totalPages:i,onChange:a})]})}function KH({isFetching:e}){return(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-6 text-sm t-secondary`,children:e?(0,w.jsx)(`span`,{children:`Loading…`}):(0,w.jsxs)(w.Fragment,{children:[`No agent actions match these filters yet. Try`,` `,(0,w.jsx)(`span`,{className:`text-foreground`,children:`widening the date range`}),`,`,` `,(0,w.jsx)(`span`,{className:`text-foreground`,children:`clearing the search`}),`, or`,` `,(0,w.jsx)(`span`,{className:`text-foreground`,children:`selecting "All time"`}),`.`]})})}function qH({prompt:e,className:t}){return e?e.prompt?(0,w.jsxs)(`p`,{className:`break-words text-[13px] italic text-foreground/90 ${t??``}`,title:e.prompt,children:[(0,w.jsx)(`span`,{className:`t-tertiary not-italic`,children:`“`}),e.prompt,(0,w.jsx)(`span`,{className:`t-tertiary not-italic`,children:`”`})]}):(0,w.jsxs)(`p`,{className:`text-[11px] t-tertiary ${t??``}`,children:[`(Prompt not captured — enable `,(0,w.jsx)(`code`,{children:`capture_prompts`}),` in your unerr config to see what you asked)`]}):null}function JH({turn:e,markers:t,compact:n,active:r,onClick:i}){let a=t.find(e=>e.type===`mark_intent`),o=t.filter(e=>e.type===`mark_decision`).length,s=t.filter(e=>e.type===`mark_blocker`),c=new Set(t.filter(e=>e.type===`mark_resolution`).map(e=>e.blocker_ref)),l=s.filter(e=>!c.has(e.marker_id)),u=(a?.text??``).length>0?a?.text??``:e.title&&e.title.length>0?e.title:`Agent work — ${e.tool_count} step${e.tool_count===1?``:`s`}, ${e.edit_count} edit${e.edit_count===1?``:`s`}`;return(0,w.jsx)(`div`,{onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},role:`button`,tabIndex:0,className:`${n?`flex items-center gap-3 px-3 py-2 hover:bg-surface-secondary transition-colors cursor-pointer`:`el-raised rounded-lg border border-border-subtle hover:border-violet-500/40 transition-colors cursor-pointer`} ${r?n?`bg-violet-500/15`:`border-violet-500/60 bg-violet-500/5`:``}`,children:n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`text-sm text-foreground truncate flex-1`,children:u}),(0,w.jsxs)(`span`,{className:`text-[11px] t-tertiary font-mono shrink-0`,children:[CH(e.started_at),` `,SH(e.started_at)]}),(0,w.jsxs)(`span`,{className:`text-[11px] t-tertiary shrink-0`,children:[e.tool_count,` step`,e.tool_count===1?``:`s`,` ·`,` `,e.edit_count,` edit`,e.edit_count===1?``:`s`]}),l.length>0&&(0,w.jsxs)(`span`,{className:`text-[10px] font-mono px-1.5 py-0.5 rounded bg-rose-500/15 text-rose-400 border border-rose-500/30 shrink-0`,children:[l.length,` stuck`]})]}):(0,w.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,w.jsx)(qH,{prompt:e.prompt,className:`mb-2 line-clamp-2`}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,w.jsx)(`span`,{className:`text-sm text-foreground font-medium truncate`,children:u}),o>0&&(0,w.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-cyan-500/15 text-cyan-400 border border-cyan-500/30 shrink-0`,children:[`💡 `,o,` decision`,o===1?``:`s`]}),l.length>0&&(0,w.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-rose-500/15 text-rose-400 border border-rose-500/30 shrink-0`,children:[`⚠ `,l.length,` stuck`]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-4 text-xs t-tertiary shrink-0`,children:[(0,w.jsxs)(`span`,{children:[CH(e.started_at),` `,SH(e.started_at)]}),(0,w.jsx)(`span`,{children:xH(e.ended_at-e.started_at)}),(0,w.jsxs)(`span`,{children:[e.tool_count,` step`,e.tool_count===1?``:`s`,` ·`,` `,e.file_count,` file`,e.file_count===1?``:`s`,` ·`,` `,e.edit_count,` edit`,e.edit_count===1?``:`s`]})]})]})]})})}function YH({page:e,totalPages:t,onChange:n}){let r=XH(e,t);return(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-2`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(Math.max(1,e-1)),disabled:e<=1,className:`rounded-md border border-border-subtle bg-surface-secondary px-3 py-1 text-xs text-foreground hover:bg-surface-secondary/70 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:`← Newer`}),(0,w.jsx)(`div`,{className:`flex items-center gap-1`,children:r.map(({key:t,value:r})=>r===`…`?(0,w.jsx)(`span`,{className:`px-2 t-tertiary text-xs`,children:`…`},t):(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(r),className:`min-w-[28px] rounded-md px-2 py-1 text-xs border border-border-subtle transition-colors ${r===e?`bg-violet-500/30 text-violet-200`:`bg-surface-secondary t-secondary hover:bg-surface-secondary/70`}`,children:r},t))}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(Math.min(t,e+1)),disabled:e>=t,className:`rounded-md border border-border-subtle bg-surface-secondary px-3 py-1 text-xs text-foreground hover:bg-surface-secondary/70 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:`Older →`})]})}function XH(e,t){if(t<=7)return Array.from({length:t},(e,t)=>({key:`page-${t+1}`,value:t+1}));let n=[...new Set([1,t,e,e-1,e+1,e-2,e+2])].filter(e=>e>=1&&e<=t).sort((e,t)=>e-t),r=[];for(let e=0;e<n.length;e++){let t=n[e];if(e>0&&t-n[e-1]>1){let i=n[e-1];r.push({key:`ellipsis-${i}-${t}`,value:`…`})}r.push({key:`page-${t}`,value:t})}return r}function ZH({turn:e,markers:t,episodicByFile:n,onClose:r}){let i=(0,f.useMemo)(()=>[...new Set(t.map(e=>e.file_path).filter(e=>typeof e==`string`&&e.length>0))],[t]),a=(0,f.useMemo)(()=>{let e=[];for(let t of i){let r=n.get(t);r&&e.push(...r)}return e.slice(0,5)},[i,n]);return(0,w.jsx)(`div`,{className:`fixed inset-0 z-30 flex justify-end bg-black/40 backdrop-blur-sm`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`dialog`,"aria-modal":`true`,tabIndex:-1,children:(0,w.jsxs)(`aside`,{className:`h-full w-full max-w-md bg-background border-l border-border-subtle shadow-2xl overflow-y-auto`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`document`,children:[(0,w.jsxs)(`div`,{className:`sticky top-0 bg-background/90 backdrop-blur border-b border-border-subtle p-4 flex items-start justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-[10px] uppercase tracking-wider font-medium`,children:`What happened`}),(0,w.jsx)(`div`,{className:`text-sm text-foreground font-medium mt-1 truncate`,children:e.title||`Agent work`})]}),(0,w.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-md border border-border-subtle bg-surface-secondary px-2 py-1 t-secondary hover:text-foreground hover:bg-surface-secondary/70 transition-colors`,"aria-label":`Close detail panel`,children:`✕`})]}),(0,w.jsxs)(`div`,{className:`p-4 space-y-4`,children:[e.prompt?(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle bg-surface-secondary/40 p-3`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-[10px] uppercase tracking-wider font-medium mb-1.5`,children:`What you asked`}),(0,w.jsx)(qH,{prompt:e.prompt})]}):null,(0,w.jsx)(QH,{turn:e}),(0,w.jsx)(eU,{markers:t}),a.length>0&&(0,w.jsx)(tU,{narratives:a})]})]})})}function QH({turn:e}){let[t,n]=(0,f.useState)(!1);return(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-xs`,children:[(0,w.jsx)($H,{label:`Started`,value:wH(e.started_at)}),(0,w.jsx)($H,{label:`Duration`,value:xH(e.ended_at-e.started_at)}),(0,w.jsx)($H,{label:`Outcome`,value:e.outcome===`unknown`?`—`:e.outcome===`success`?`Completed`:e.outcome})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-xs`,children:[(0,w.jsx)($H,{label:`Steps taken`,value:String(e.tool_count)}),(0,w.jsx)($H,{label:`Files involved`,value:String(e.file_count)}),(0,w.jsx)($H,{label:`Edits written`,value:String(e.edit_count)})]}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`text-[10px] t-tertiary hover:text-foreground transition-colors`,children:t?`▾ Hide technical IDs`:`▸ Show technical IDs`}),t&&(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs`,children:[(0,w.jsx)($H,{label:`Action ID`,value:e.turn_id.slice(0,8),mono:!0}),(0,w.jsx)($H,{label:`Session ID`,value:e.session_id.slice(0,8),mono:!0})]})]})}function $H({label:e,value:t,mono:n}){return(0,w.jsxs)(`div`,{className:`rounded border border-border-subtle bg-surface-secondary px-2 py-1.5`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-[10px] uppercase tracking-wider font-medium`,children:e}),(0,w.jsx)(`div`,{className:`text-foreground mt-0.5 truncate ${n?`font-mono`:``}`,children:t})]})}function eU({markers:e}){if(e.length===0)return(0,w.jsx)(`div`,{className:`t-tertiary text-xs leading-relaxed`,children:`No notes recorded for this action. As your agent uses unerr's workflows, it automatically logs goals, decisions, stuck moments, and solutions — building a readable trail of what happened and why.`});let t=new Map(e.filter(e=>e.type===`mark_blocker`).map(e=>[e.marker_id,e.text]));return(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsxs)(`div`,{className:`t-secondary text-[10px] uppercase tracking-wider font-medium`,children:[`What happened during this action (`,e.length,` note`,e.length===1?``:`s`,`)`]}),e.map(e=>{let n=bH(e.type),r=e.blocker_ref?t.get(e.blocker_ref):void 0;return(0,w.jsxs)(`div`,{className:`rounded border border-border-subtle bg-surface-secondary px-3 py-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`span`,{className:`text-[10px] uppercase ${n.color}`,children:[n.emoji,` `,n.label]}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:SH(e.ts)})]}),(0,w.jsx)(`div`,{className:`text-xs text-foreground mt-1`,children:e.text}),e.file_path&&(0,w.jsx)(`div`,{className:`t-tertiary text-[11px] font-mono mt-1`,children:e.file_path}),e.blocker_ref&&(0,w.jsxs)(`div`,{className:`text-emerald-400 text-[11px] mt-1`,children:[`✅ Fixes: `,r||`issue ${e.blocker_ref.slice(0,8)}`]})]},e.marker_id)})]})}function tU({narratives:e}){return(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(`div`,{className:`t-secondary text-[10px] uppercase tracking-wider font-medium`,children:`What unerr knows about these files`}),e.map(e=>{let t=OH(e.content);return(0,w.jsxs)(`div`,{className:`rounded border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 text-xs`,children:[(0,w.jsx)(`div`,{className:`text-emerald-400 font-mono text-[10px] uppercase mb-1`,children:e.scope}),t.what&&(0,w.jsxs)(`div`,{className:`text-foreground`,children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`What — `}),t.what]}),t.why&&(0,w.jsxs)(`div`,{className:`t-secondary mt-1`,children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`Why — `}),t.why]}),t.how&&(0,w.jsxs)(`div`,{className:`t-secondary mt-1`,children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`How — `}),t.how]}),!t.what&&!t.why&&!t.how&&(0,w.jsx)(`div`,{className:`t-secondary`,children:e.content})]},e.fact_id)})]})}function nU(e){let t=new URLSearchParams;return e.from!==void 0&&t.set(`from`,String(e.from)),e.to!==void 0&&t.set(`to`,String(e.to)),e.session&&t.set(`session_id`,e.session),e.q&&t.set(`q`,e.q),t.set(`limit`,String(e.perPage)),t.set(`offset`,String((e.page-1)*e.perPage)),t.toString()}function rU(e){let t=new Map;for(let n of e){let e=t.get(n.turn_id)??[];e.push(n),t.set(n.turn_id,e)}return t}var iU=[{key:`surface2`,label:`Surface-2 lines`},{key:`surface3`,label:`Surface-3 lines`},{key:`mark_intent`,label:`mark_intent calls`},{key:`skill`,label:`Skill invocations`}];function aU(e){return e<60?`${Math.round(e)}s`:e<3600?`${Math.floor(e/60)}m ${Math.round(e%60)}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function oU(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function sU(e){switch(e){case`running`:case`ready`:return`bg-emerald-500 shadow-[0_0_8px_rgba(52,211,153,0.5)]`;case`indexing`:return`bg-amber-400 animate-pulse shadow-[0_0_8px_rgba(251,191,36,0.5)]`;default:return`bg-red-500 shadow-[0_0_8px_rgba(248,113,113,0.5)]`}}function cU(e){switch(e){case`running`:case`ready`:return`Operational`;case`indexing`:return`Indexing`;default:return e.charAt(0).toUpperCase()+e.slice(1)}}function lU({value:e}){let[t,n]=(0,f.useState)(!1);return(0,w.jsx)(`button`,{type:`button`,className:`ml-2 inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium t-tertiary hover:text-foreground hover:el-raised transition-all`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-3 w-3 text-emerald-500`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2.5,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})}):(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-3 w-3`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z`})})})}function uU({label:e,value:t,sub:n,color:r=`violet`}){return(0,w.jsxs)(`div`,{className:`glass-card rounded-lg p-4 ring-1 ${{violet:`ring-violet-500/20`,cyan:`ring-cyan-500/20`,emerald:`ring-emerald-500/20`,amber:`ring-amber-500/20`}[r]}`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[11px] uppercase tracking-wide`,children:e}),(0,w.jsx)(`p`,{className:`mt-1 text-2xl font-mono font-bold ${{violet:`text-violet-400`,cyan:`text-cyan-400`,emerald:`text-emerald-400`,amber:`text-amber-400`}[r]}`,children:t}),n&&(0,w.jsx)(`p`,{className:`mt-0.5 t-tertiary text-xs`,children:n})]})}function dU({label:e,value:t,mono:n=!0,copyable:r=!1}){let i=t??`—`;return(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 py-2 border-b border-border-subtle/50 last:border-0`,children:[(0,w.jsx)(`dt`,{className:`t-secondary text-sm shrink-0`,children:e}),(0,w.jsxs)(`dd`,{className:`text-right text-xs text-foreground ${n?`font-mono`:``} flex items-center`,children:[(0,w.jsx)(`span`,{className:`break-all`,children:i}),r&&typeof i==`string`&&(0,w.jsx)(lU,{value:i})]})]})}function fU({name:e}){return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-medium ring-1 ${{audit:`bg-violet-500/15 text-violet-400 ring-violet-500/30`,blame:`bg-cyan-500/15 text-cyan-400 ring-cyan-500/30`,test:`bg-emerald-500/15 text-emerald-400 ring-emerald-500/30`,lint:`bg-amber-500/15 text-amber-400 ring-amber-500/30`,commit:`bg-violet-500/15 text-violet-400 ring-violet-500/30`,"review-pr":`bg-cyan-500/15 text-cyan-400 ring-cyan-500/30`}[e.replace(/^unerr-/,``)]??`bg-violet-500/10 text-violet-400 ring-violet-500/20`}`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-2.5 w-2.5`,fill:`currentColor`,viewBox:`0 0 8 8`,children:(0,w.jsx)(`circle`,{cx:`4`,cy:`4`,r:`3`})}),e]})}function pU({config:e}){let t=Object.entries(e);return t.length===0?(0,w.jsx)(`p`,{className:`t-tertiary text-sm italic`,children:`No configuration entries.`}):(0,w.jsx)(`div`,{className:`space-y-1`,children:t.map(([e,t])=>{let n=typeof t==`object`&&t?JSON.stringify(t,null,2):String(t??`—`),r=typeof t==`object`&&!!t;return(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle/50 p-3 ${r?``:`flex items-baseline justify-between gap-4`}`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e}),r?(0,w.jsx)(`pre`,{className:`mt-2 custom-scrollbar max-h-40 overflow-auto whitespace-pre-wrap rounded-md bg-black/20 p-2.5 font-mono text-xs leading-relaxed t-secondary`,children:n}):(0,w.jsx)(`span`,{className:`font-mono text-xs t-secondary`,children:n})]},e)})})}function mU(e){if(!e)return`never`;let t=Date.now()-e;if(t<6e4)return`just now`;let n=Math.floor(t/6e4);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 hU({update:e}){let t=e.status===`rolled-back`?`bg-red-500`:e.status===`available`||e.status===`pending`?`bg-amber-400`:e.status===`disabled`?`bg-gray-500`:`bg-emerald-500`,n=e.policy===`auto`?`Auto (patch + minor)`:e.policy===`notify`?`Notify only`:`Off`;return(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`h2`,{className:`section-label text-violet-500 flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 rounded-full ${t}`}),`Auto-update`]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[`checked `,mU(e.lastCheckedAt)]})]}),(0,w.jsx)(`p`,{className:`mt-2 text-sm text-foreground`,children:e.line}),(0,w.jsxs)(`dl`,{className:`mt-3`,children:[(0,w.jsx)(dU,{label:`Current version`,value:e.current}),(0,w.jsx)(dU,{label:`Latest`,value:e.latest??`—`}),(0,w.jsx)(dU,{label:`Policy`,value:n,mono:!1}),(0,w.jsx)(dU,{label:`Install`,value:`${e.manager} · ${e.mode===`self_upgradable`?`self-updates`:`notify only`}`,mono:!1}),e.pendingVersion&&(0,w.jsx)(dU,{label:`Staged`,value:`${e.pendingVersion} (applies on next restart)`,mono:!1}),e.upgradeCommand&&(0,w.jsx)(dU,{label:`Upgrade command`,value:e.upgradeCommand,copyable:!0})]}),(0,w.jsxs)(`p`,{className:`mt-3 t-tertiary text-xs`,children:[`Change with`,` `,(0,w.jsx)(`code`,{className:`font-mono text-foreground`,children:`unerr update --mode auto|notify|off`})]})]})}function gU(){let{url:e,queryKey:t}=Ot(),n=N({queryKey:t([`system`,`status`]),queryFn:()=>O(e(`/api/system/status`)),refetchInterval:5e3}),r=N({queryKey:t([`system`,`config`]),queryFn:()=>O(e(`/api/system/config`))}),i=N({queryKey:t([`logbook`,`compliance`,`settings`]),queryFn:()=>O(e(`/api/logbook/compliance`)),refetchInterval:1e4}),a=n.data?.data,o=r.data?.data,s=i.data?.data,c=s?.runtime_joins;return n.isLoading||r.isLoading?(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsx)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:[1,2,3,4].map(e=>(0,w.jsx)(Ht,{className:`h-24 w-full rounded-lg`},e))}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 lg:flex-row`,children:[(0,w.jsx)(Ht,{className:`h-72 flex-1 rounded-xl`}),(0,w.jsx)(Ht,{className:`h-72 flex-1 rounded-xl`})]})]}):n.isError&&r.isError?(0,w.jsx)(`div`,{className:`flex items-center justify-center py-20`,children:(0,w.jsxs)(`div`,{className:`glass-panel rounded-xl p-8 text-center max-w-md`,children:[(0,w.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-red-500/15`,children:(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-6 w-6 text-red-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z`})})}),(0,w.jsx)(`h3`,{className:`text-foreground font-medium`,children:`Connection Error`}),(0,w.jsx)(`p`,{className:`mt-2 t-secondary text-sm`,children:`Unable to reach the unerr proxy. Ensure the process is running.`})]})}):(0,w.jsxs)(`div`,{className:`space-y-8`,children:[(0,w.jsx)(`div`,{className:`glass-panel rounded-xl p-5`,children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,w.jsx)(`div`,{className:`relative flex h-11 w-11 items-center justify-center rounded-xl bg-violet-500/15 ring-1 ring-violet-500/30`,children:(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-5 w-5 text-violet-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.8,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z`})})}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-foreground`,children:`Process Instance`}),(0,w.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 rounded-full ${a?sU(a.status):`bg-gray-500`}`}),(0,w.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:a?cU(a.status):`Unknown`})]}),(0,w.jsxs)(`p`,{className:`mt-0.5 t-tertiary text-xs font-mono`,children:[`PID `,a?.pid??`—`,` · `,a?.mode??`—`,` mode · port`,` `,a?.dashboard_port??`—`]})]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[a?.ide&&(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-cyan-500/10 px-3 py-1 text-xs font-medium text-cyan-400 ring-1 ring-cyan-500/20`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-3 w-3`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{d:`M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z`})}),a.ide]}),(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-violet-500/10 px-3 py-1 text-xs font-medium text-violet-400 ring-1 ring-violet-500/20`,children:[`Uptime: `,a?aU(a.uptime_s):`—`]})]})]})}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:[(0,w.jsx)(uU,{label:`Graph Entities`,value:a?oU(a.graph.entities):`—`,sub:a?`${oU(a.graph.edges)} edges`:void 0,color:`violet`}),(0,w.jsx)(uU,{label:`Rules Active`,value:a?.graph.rules??`—`,sub:`conventions & patterns`,color:`cyan`}),(0,w.jsx)(uU,{label:`Tool Calls`,value:a?oU(a.session.tool_calls):`—`,sub:`this session`,color:`emerald`}),(0,w.jsx)(uU,{label:`Tokens Saved`,value:a?oU(a.session.tokens_saved):`—`,sub:a?.session.violations_caught?`${a.session.violations_caught} violations caught · on operations unerr handled`:`on operations unerr handled`,color:`amber`})]}),a?.update&&(0,w.jsx)(hU,{update:a.update}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 lg:flex-row`,children:[(0,w.jsxs)(`section`,{className:`flex-1 glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`h2`,{className:`section-label text-violet-500 flex items-center gap-2`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z`})}),`Process Details`]}),n.isError?(0,w.jsx)(`p`,{className:`mt-4 text-error text-sm`,children:`Could not reach proxy.`}):(0,w.jsxs)(`dl`,{className:`mt-4`,children:[(0,w.jsx)(dU,{label:`Status`,value:a?cU(a.status):void 0,mono:!1}),(0,w.jsx)(dU,{label:`Process ID`,value:a?.pid,copyable:!0}),(0,w.jsx)(dU,{label:`Mode`,value:a?.mode}),(0,w.jsx)(dU,{label:`Dashboard Port`,value:a?.dashboard_port}),(0,w.jsx)(dU,{label:`IDE`,value:a?.ide||`None detected`}),(0,w.jsx)(dU,{label:`Uptime`,value:a?aU(a.uptime_s):void 0}),(0,w.jsx)(dU,{label:`Working Directory`,value:a?.cwd,copyable:!0}),(0,w.jsx)(dU,{label:`Session Started`,value:a?.session.started_at?new Date(a.session.started_at).toLocaleString():void 0})]})]}),(0,w.jsxs)(`section`,{className:`flex-1 glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`h2`,{className:`section-label text-cyan-500 flex items-center gap-2`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M13 10V3L4 14h7v7l9-11h-7z`})}),`Installed Skills`]}),(0,w.jsxs)(`p`,{className:`mt-1 t-tertiary text-xs`,children:[`Agent skills installed in this repository via`,` `,(0,w.jsx)(`span`,{className:`font-mono`,children:`unerr install`}),`.`]}),r.isError?(0,w.jsx)(`p`,{className:`mt-4 text-error text-sm`,children:`Could not load config.`}):o?.skills_installed?.length?(0,w.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:o.skills_installed.map(e=>(0,w.jsx)(fU,{name:e},e))}):(0,w.jsxs)(`div`,{className:`mt-6 flex flex-col items-center py-6 text-center`,children:[(0,w.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-amber-500/10 ring-1 ring-amber-500/20`,children:(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-5 w-5 text-amber-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})})}),(0,w.jsx)(`p`,{className:`text-sm text-foreground`,children:`No skills installed`}),(0,w.jsxs)(`p`,{className:`mt-1 t-tertiary text-xs max-w-[240px]`,children:[`Run`,` `,(0,w.jsx)(`code`,{className:`font-mono text-violet-400`,children:`unerr install <agent>`}),` `,`to install skills for your IDE.`]})]}),(0,w.jsxs)(`div`,{className:`mt-6 border-t border-border-subtle/50 pt-5`,children:[(0,w.jsxs)(`h3`,{className:`section-label text-violet-500 flex items-center gap-2`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01`})}),`Graph Intelligence`]}),(0,w.jsxs)(`div`,{className:`mt-3 grid grid-cols-3 gap-3`,children:[(0,w.jsxs)(`div`,{className:`rounded-lg bg-violet-500/5 p-3 text-center ring-1 ring-violet-500/10`,children:[(0,w.jsx)(`p`,{className:`text-xl font-mono font-bold text-violet-400`,children:a?oU(a.graph.entities):`—`}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Entities`})]}),(0,w.jsxs)(`div`,{className:`rounded-lg bg-cyan-500/5 p-3 text-center ring-1 ring-cyan-500/10`,children:[(0,w.jsx)(`p`,{className:`text-xl font-mono font-bold text-cyan-400`,children:a?oU(a.graph.edges):`—`}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Edges`})]}),(0,w.jsxs)(`div`,{className:`rounded-lg bg-emerald-500/5 p-3 text-center ring-1 ring-emerald-500/10`,children:[(0,w.jsx)(`p`,{className:`text-xl font-mono font-bold text-emerald-400`,children:a?.graph.rules??`—`}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Rules`})]})]})]})]})]}),(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`h2`,{className:`section-label text-emerald-500 flex items-center gap-2`,children:[(0,w.jsxs)(`svg`,{"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:[(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z`}),(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`})]}),`Repository Configuration`]}),(0,w.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2.5 py-0.5 text-[10px] font-mono text-emerald-400 ring-1 ring-emerald-500/20`,children:`.unerr/config.json`})]}),(0,w.jsxs)(`p`,{className:`mt-1 t-tertiary text-xs`,children:[`Per-repository configuration. Edit`,` `,(0,w.jsx)(`code`,{className:`font-mono text-emerald-400`,children:`.unerr/config.json`}),` `,`directly to modify settings.`]}),(0,w.jsx)(`div`,{className:`mt-4`,children:r.isError?(0,w.jsx)(`p`,{className:`text-error text-sm`,children:`Could not load configuration.`}):(0,w.jsx)(pU,{config:o?.repo_config??{}})})]}),(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`h2`,{className:`section-label text-amber-500 flex items-center gap-2`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M13 7h8m0 0v8m0-8l-8 8-4-4-6 6`})}),`Session Performance`]}),(0,w.jsx)(`p`,{className:`mt-1 t-tertiary text-xs`,children:`Live metrics for the current proxy session. Resets when the process restarts.`}),(0,w.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4 sm:grid-cols-4`,children:[(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle/50 p-3`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Tool Calls`}),(0,w.jsx)(`p`,{className:`mt-1 text-xl font-mono font-bold text-foreground`,children:a?oU(a.session.tool_calls):`—`})]}),(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle/50 p-3`,title:`Counted on operations unerr handled (file reads, web fetches, shell output, dedup). Not whole-turn savings.`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Tokens Saved`}),(0,w.jsx)(`p`,{className:`mt-1 text-xl font-mono font-bold text-foreground`,children:a?oU(a.session.tokens_saved):`—`}),(0,w.jsx)(`p`,{className:`mt-0.5 t-tertiary text-[9px] leading-snug`,children:`on ops unerr handled`})]}),(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle/50 p-3`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Violations`}),(0,w.jsx)(`p`,{className:`mt-1 text-xl font-mono font-bold text-foreground`,children:a?.session.violations_caught??`—`})]}),(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle/50 p-3`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Session Start`}),(0,w.jsx)(`p`,{className:`mt-1 text-xs font-mono text-foreground leading-relaxed`,children:a?.session.started_at?new Date(a.session.started_at).toLocaleTimeString():`—`})]})]})]}),(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`h2`,{className:`section-label text-cyan-500 flex items-center gap-2`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`})}),`Directive Compliance`]}),(0,w.jsx)(`p`,{className:`mt-1 t-tertiary text-xs`,children:`How often unerr honored its own protocol directives this install — diagnostics, not your outcomes.`}),i.isError?(0,w.jsx)(`p`,{className:`mt-4 text-error text-sm`,children:`Could not load compliance diagnostics.`}):s?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:iU.map(({key:e,label:t})=>{let n=s[e];return(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle/50 p-3`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:t}),(0,w.jsxs)(`p`,{className:`mt-1 text-xl font-mono font-bold text-foreground`,children:[Math.round(n.ratio*100),`%`]}),(0,w.jsxs)(`p`,{className:`mt-0.5 t-tertiary text-[11px]`,children:[n.called,` / `,n.required,n.consecutive_misses>0?(0,w.jsxs)(`span`,{className:`ml-1.5 text-amber-400`,children:[`· `,n.consecutive_misses,`× miss streak`]}):null]})]},e)})}),c&&c.total>0?(0,w.jsxs)(`div`,{className:`mt-4 rounded-lg border border-violet-500/30 bg-violet-500/5 px-4 py-3`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,w.jsx)(`span`,{"aria-hidden":`true`,className:`text-fuchsia-400`,children:`⚡`}),(0,w.jsx)(`span`,{className:`font-medium text-foreground`,children:`Cross-tier runtime joins`}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`·`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums t-secondary`,children:[`memory→graph `,c.memory_to_graph]}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`·`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums t-secondary`,children:[`graph→drift `,c.graph_to_drift]}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`·`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums t-secondary`,children:[`three-way `,c.three_way]})]}),(0,w.jsx)(`p`,{className:`mt-1 text-[11px] t-tertiary`,children:`Joins point tools cannot produce — per-repo runtime context.`})]}):null]}):(0,w.jsx)(`div`,{className:`mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[1,2,3,4].map(e=>(0,w.jsx)(Ht,{className:`h-20 w-full rounded-lg`},e))})]})]})}function _U({points:e,height:t=28,className:n=``}){let r=`spark-${(0,f.useId)().replace(/:/g,``)}`;if(!e||e.length<2)return(0,w.jsx)(`div`,{style:{height:t},"aria-hidden":!0,className:n});let i=Math.max(...e),a=Math.min(...e),o=i-a||1,s=e.length>1?100/(e.length-1):100,c=e.map((e,n)=>{let r=n*s,i=t-(e-a)/o*t;return`${r.toFixed(2)},${i.toFixed(2)}`}).join(` `),l=`0,${t} ${c} 100,${t}`;return(0,w.jsxs)(`svg`,{"aria-hidden":!0,role:`img`,viewBox:`0 0 100 ${t}`,preserveAspectRatio:`none`,className:`block w-full ${n}`,style:{height:t},children:[(0,w.jsx)(`title`,{children:`Sparkline trend`}),(0,w.jsx)(`defs`,{children:(0,w.jsxs)(`linearGradient`,{id:r,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,w.jsx)(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:.22}),(0,w.jsx)(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:0})]})}),(0,w.jsx)(`polygon`,{points:l,fill:`url(#${r})`}),(0,w.jsx)(`polyline`,{points:c,fill:`none`,stroke:`currentColor`,strokeWidth:1.25,strokeLinejoin:`round`,strokeLinecap:`round`})]})}var vU={emerald:{stripe:`border-emerald-500/60`,label:`text-emerald-400`,value:`text-emerald-400`,spark:`text-emerald-400`,wash:`from-emerald-500/[0.07]`,glow:`hover:shadow-[0_14px_34px_-16px_rgba(52,211,153,0.45)]`},cyan:{stripe:`border-cyan-500/60`,label:`text-cyan-400`,value:`text-cyan-400`,spark:`text-cyan-400`,wash:`from-cyan-500/[0.07]`,glow:`hover:shadow-[0_14px_34px_-16px_rgba(34,211,238,0.45)]`},violet:{stripe:`border-violet-500/60`,label:`text-violet-400`,value:`text-violet-400`,spark:`text-violet-400`,wash:`from-violet-500/[0.07]`,glow:`hover:shadow-[0_14px_34px_-16px_rgba(139,92,246,0.45)]`},fuchsia:{stripe:`border-fuchsia-500/60`,label:`text-fuchsia-400`,value:`text-fuchsia-400`,spark:`text-fuchsia-400`,wash:`from-fuchsia-500/[0.07]`,glow:`hover:shadow-[0_14px_34px_-16px_rgba(217,70,239,0.45)]`},amber:{stripe:`border-amber-500/60`,label:`text-amber-400`,value:`text-amber-400`,spark:`text-amber-400`,wash:`from-amber-500/[0.07]`,glow:`hover:shadow-[0_14px_34px_-16px_rgba(251,191,36,0.4)]`},rose:{stripe:`border-rose-500/60`,label:`text-rose-400`,value:`text-rose-400`,spark:`text-rose-400`,wash:`from-rose-500/[0.07]`,glow:`hover:shadow-[0_14px_34px_-16px_rgba(251,113,133,0.4)]`}};function yU({label:e,value:t,subtitle:n,accent:r,hint:i,sparklinePoints:a}){let o=vU[r],s=a&&a.length>=2;return(0,w.jsxs)(`div`,{className:`group relative overflow-hidden rounded-lg border-t-2 ${o.stripe} el-raised p-5 transition-all duration-200 hover:-translate-y-0.5 ${o.glow}`,title:i,children:[(0,w.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 bg-gradient-to-b ${o.wash} to-transparent opacity-60 transition-opacity duration-200 group-hover:opacity-100`}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(`p`,{className:`${o.label} text-[10px] uppercase tracking-wider font-medium`,children:e}),(0,w.jsx)(`p`,{className:`text-3xl font-bold font-mono ${o.value} mt-2 tabular-nums tracking-tight`,children:t}),n&&(0,w.jsx)(`p`,{className:`t-secondary text-xs mt-1`,children:n}),s&&(0,w.jsx)(`div`,{className:`mt-3 ${o.spark}`,children:(0,w.jsx)(_U,{points:a,height:28})})]})]})}function bU({text:e}){return(0,w.jsx)(`span`,{title:e,className:`inline-flex h-3.5 w-3.5 items-center justify-center rounded-full border border-border-subtle text-[9px] font-semibold t-tertiary cursor-help select-none`,"aria-label":e,children:`i`})}function xU({mech:e,data:t,tierMax:n}){let r=sL(e),i=Math.max(2,t.tokens_saved/(n||1)*100);return(0,w.jsxs)(`div`,{className:`flex items-center gap-2.5 text-xs`,children:[(0,w.jsx)(`span`,{className:`size-2 shrink-0 rounded-sm ${r.bar}`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`${r.text} w-28 shrink-0 truncate font-medium`,children:tL(e)}),(0,w.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full ${r.bar} opacity-80`,style:{width:`${i}%`}})}),(0,w.jsx)(`span`,{className:`w-14 shrink-0 text-right font-mono tabular-nums t-secondary`,children:Q(t.tokens_saved)}),(0,w.jsxs)(`span`,{className:`w-9 shrink-0 text-right font-mono tabular-nums t-tertiary`,children:[t.event_count,`×`]})]})}function SU({tier:e,pct:t,perTurn:n,primary:r,title:i,caption:a,proof:o}){let s=e.entries[0]?.[1].tokens_saved??1,c=n>0?e.tokens*n:0;return(0,w.jsxs)(`div`,{className:r?`rounded-lg border border-emerald-500/25 bg-emerald-500/[0.04] p-4`:`rounded-lg border border-border-subtle/60 p-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-end justify-between gap-4`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`h4`,{className:`text-base font-semibold ${r?`text-foreground-emphasis`:`text-foreground`}`,children:i}),r&&(0,w.jsx)(`span`,{className:`rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-300`,children:`only unerr`})]}),(0,w.jsx)(`p`,{className:`t-tertiary mt-0.5 text-xs leading-tight`,children:a})]}),(0,w.jsxs)(`div`,{className:`shrink-0 text-right`,children:[(0,w.jsxs)(`div`,{className:`font-mono text-2xl font-bold tabular-nums ${r?`text-emerald-300`:`t-secondary`}`,children:[t,`%`]}),(0,w.jsxs)(`div`,{className:`font-mono text-[11px] tabular-nums t-tertiary`,children:[Q(e.tokens),` tok`,c>0?` · ~${Q(c)} turns`:``]})]})]}),(0,w.jsx)(`div`,{className:`mt-3 overflow-hidden rounded-full bg-white/[0.06] ${r?`h-3`:`h-2`}`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full ${r?`bg-gradient-to-r from-violet-500 to-emerald-400`:`bg-zinc-500/70`}`,style:{width:`${Math.max(2,t)}%`}})}),e.entries.length>0&&(0,w.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:e.entries.map(([e,t])=>(0,w.jsx)(xU,{mech:e,data:t,tierMax:s},e))}),o&&(0,w.jsx)(`p`,{className:`mt-3 border-t border-border-subtle/50 pt-2 text-[11px] leading-snug t-tertiary`,children:o})]})}function CU({byMechanism:e,totalSaved:t}){let{url:n,queryKey:r}=Ot(),i=N({queryKey:r([`token-flow`,`headroom`]),queryFn:()=>O(n(`/api/token-flow/headroom`)),refetchInterval:3e4}).data?.data?.since_install,a=i&&i.total_tokens_saved>0?i.headroom_turns/i.total_tokens_saved:0,{intelligence:o,compression:s,total:c}=eL(e),l=c||t||1,u=Math.round(o.tokens/l*100),d=Math.max(0,100-u),f=e.graph_query?.event_count??0,p=e.file_read?.event_count??0,m=f+p>0?`Earned across ${Q(f)} graph lookup${f===1?``:`s`} served and ${Q(p)} targeted read${p===1?``:`s`} — payloads a text-only optimizer would have pulled in full.`:void 0;return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Where your savings come from`}),(0,w.jsx)(bU,{text:`Every saved token is attributed to one of two origins. Understanding-your-code = graph queries and graph-guided reads (file_outline / get_entity served a slice instead of a full file). Compressing-output = trimming the bytes of tool output. The split is exhaustive: the two tiers sum to your total. Turns are estimated from each tier's share of compounded headroom.`})]}),(0,w.jsxs)(`p`,{className:`t-tertiary mb-4 max-w-2xl text-xs leading-snug`,children:[`Trimming tool output saves tokens — every token tool does it. unerr also`,` `,(0,w.jsx)(`span`,{className:`text-foreground`,children:`understands your code`}),`, so it serves the right slice instead of raw bytes. On this install, that's where most of your savings come from.`]}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsx)(SU,{tier:o,pct:u,perTurn:a,primary:!0,title:`Understanding your code`,caption:`graph queries + graph-guided reads — needs a live map of the repo`,proof:m}),(0,w.jsx)(SU,{tier:s,pct:d,perTurn:a,primary:!1,title:`Compressing output`,caption:`trimming tool output — table-stakes for any token tool`})]}),(0,w.jsx)(`div`,{className:`mt-4 border-t border-border-subtle pt-3`,children:(0,w.jsxs)(`p`,{className:`text-sm leading-snug t-secondary`,children:[(0,w.jsxs)(`span`,{className:`font-semibold text-emerald-300`,children:[u,`%`]}),` of every token unerr saves comes from`,` `,(0,w.jsx)(`span`,{className:`text-foreground-emphasis`,children:`understanding your code`}),` `,`— work that output compression alone can't reach.`]})})]})}var wU={shell_compression:`#06b6d4`,format_encoding:`#f59e0b`,session_dedup:`#10b981`,smart_truncation:`#3b82f6`,file_read:`#6366f1`,fetch_url:`#14b8a6`},TU=`#a1a1aa`;function EU(e){return wU[e]??TU}function DU(e,t){let n=new Date(e);return t===`hour`?n.toLocaleString([],{month:`short`,day:`numeric`,hour:`2-digit`}):n.toLocaleDateString([],{month:`short`,day:`numeric`})}function OU({fromTs:e,toTs:t,bucket:n=`day`}){let{url:r,queryKey:i}=Ot(),[a,o]=(0,f.useState)(null),s=new URLSearchParams;e&&s.set(`from_ts`,e),t&&s.set(`to_ts`,t),s.set(`bucket`,n);let c=N({queryKey:i([`token-flow-series`,e??``,t??``,n]),queryFn:()=>O(r(`/api/token-flow/series?${s.toString()}`)),refetchInterval:3e4}),l=c.data?.data??[],u=(0,f.useMemo)(()=>{let e=new Set;for(let t of l)for(let n of Object.keys(t.by_mechanism))e.add(n);let t=QI.filter(t=>e.has(t)),n=[...e].filter(e=>!QI.includes(e));return[...t,...n]},[l]),d=(0,f.useMemo)(()=>Math.max(0,...l.map(e=>e.total_saved)),[l]);if(c.isLoading)return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-3`,children:`Savings Trend`}),(0,w.jsx)(`div`,{className:`h-48 animate-pulse bg-white/[0.06] rounded`})]});if(l.length===0)return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-1`,children:`Savings Trend`}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mb-3`,children:[`Tokens saved per `,n,`, stacked by mechanism.`]}),(0,w.jsx)(`p`,{className:`t-secondary text-sm py-6 text-center`,children:`No bucketed savings data yet.`})]});let p=Math.max(1,(756-(l.length-1)*2)/Math.max(1,l.length)),m=[0,.25,.5,.75,1].map(e=>Math.round(d*e));return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 mb-1`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Savings Trend`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[l.length,` `,n,l.length===1?``:`s`,` · peak `,Q(d),` tok`]})]}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mb-3 leading-snug`,children:[`Tokens saved per `,n,`, stacked by mechanism. Hover a bar for the breakdown.`]}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsxs)(`svg`,{"aria-label":`Savings trend over time`,role:`img`,viewBox:`0 0 800 200`,className:`w-full h-48`,preserveAspectRatio:`none`,onMouseLeave:()=>o(null),children:[(0,w.jsxs)(`title`,{children:[`Tokens saved per `,n,`, stacked by mechanism`]}),m.map((e,t)=>{let n=178-t/4*170;return(0,w.jsxs)(`g`,{children:[(0,w.jsx)(`line`,{x1:36,x2:792,y1:n,y2:n,stroke:`currentColor`,className:`text-border-subtle`,strokeWidth:.5,strokeDasharray:t===0?``:`2 2`}),(0,w.jsx)(`text`,{x:32,y:n+3,textAnchor:`end`,className:`t-tertiary`,style:{fontSize:`9px`},children:Q(e)})]},`ytick-${t}`)}),l.map((e,t)=>{let n=36+t*(p+2),r=178,i=a===t;return(0,w.jsxs)(`g`,{onMouseEnter:()=>o(t),style:{cursor:`pointer`},children:[u.map(t=>{let a=e.by_mechanism[t]??0;if(a<=0)return null;let o=d>0?a/d*170:0;return r-=o,(0,w.jsx)(`rect`,{x:n,y:r,width:p,height:o,fill:EU(t),opacity:i?1:.85},t)}),(0,w.jsx)(`rect`,{x:n,y:8,width:p,height:170,fill:`transparent`})]},e.ts)}),[0,Math.floor(l.length/2),l.length-1].filter((e,t,n)=>n.indexOf(e)===t).map(e=>{let t=l[e];return t?(0,w.jsx)(`text`,{x:36+e*(p+2)+p/2,y:194,textAnchor:`middle`,className:`t-tertiary`,style:{fontSize:`9px`},children:DU(t.ts,n)},t.ts):null})]}),a!==null&&l[a]&&(0,w.jsxs)(`div`,{className:`absolute top-2 right-2 el-raised rounded-md p-3 text-xs shadow-lg max-w-[220px] pointer-events-none`,children:[(0,w.jsx)(`p`,{className:`t-secondary text-[10px] uppercase tracking-wider mb-1`,children:DU(l[a].ts,n)}),(0,w.jsxs)(`p`,{className:`text-success font-mono font-bold tabular-nums mb-2`,children:[Q(l[a].total_saved),` tok`]}),(0,w.jsx)(`div`,{className:`space-y-1`,children:u.map(e=>({mech:e,saved:l[a]?.by_mechanism[e]??0})).filter(e=>e.saved>0).sort((e,t)=>t.saved-e.saved).map(({mech:e,saved:t})=>(0,w.jsxs)(`div`,{className:`flex items-center gap-2 tabular-nums`,children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm shrink-0`,style:{backgroundColor:EU(e)}}),(0,w.jsx)(`span`,{className:`${ZI[e]?.text??`text-zinc-400`} flex-1 truncate`,children:e.replace(/_/g,` `)}),(0,w.jsx)(`span`,{className:`font-mono t-secondary`,children:Q(t)})]},e))})]})]}),(0,w.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 mt-3 text-[10px]`,children:u.map(e=>(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{backgroundColor:EU(e)}}),(0,w.jsx)(`span`,{className:`${ZI[e]?.text??`text-zinc-400`} truncate`,children:e.replace(/_/g,` `)})]},e))})]})}function kU(e,t=900){let[n,r]=(0,f.useState)(e),i=(0,f.useRef)(!1);return(0,f.useEffect)(()=>{if(i.current||e<=0){r(e);return}if(typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches){r(e);return}i.current=!0;let n=0,a=performance.now(),o=i=>{let s=Math.min(1,(i-a)/t);r(e*(1-(1-s)**3)),s<1?n=requestAnimationFrame(o):r(e)};return n=requestAnimationFrame(o),()=>cancelAnimationFrame(n)},[e,t]),n}function AU({value:e,format:t,prefix:n}){let r=kU(e);return(0,w.jsxs)(w.Fragment,{children:[n,t(Math.round(r))]})}function jU({text:e,label:t}){let[n,r]=(0,f.useState)(!1),i=(0,f.useId)();return(0,w.jsxs)(`span`,{className:`relative inline-flex align-middle`,children:[(0,w.jsx)(`button`,{type:`button`,"aria-label":t??`More information`,"aria-describedby":n?i:void 0,className:`inline-flex h-4 w-4 items-center justify-center rounded-full border border-border-subtle font-mono text-[9px] font-bold leading-none t-tertiary transition-colors hover:border-violet-400 hover:text-violet-300 focus-visible:text-violet-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-violet-400`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),onKeyDown:e=>{e.key===`Escape`&&r(!1)},children:`i`}),n?(0,w.jsx)(`span`,{role:`tooltip`,id:i,className:`absolute left-1/2 top-full z-30 mt-2 w-64 -translate-x-1/2 rounded-lg border border-border-subtle bg-background px-3 py-2 text-left text-[11px] font-normal normal-case leading-snug tracking-normal t-secondary shadow-xl`,children:e}):null]})}function MU({storageKey:e,children:t}){let[n,r]=(0,f.useState)(()=>{try{return localStorage.getItem(e)===`1`}catch{return!1}}),i=(0,f.useCallback)(()=>{r(!0);try{localStorage.setItem(e,`1`)}catch{}},[e]);return n?null:(0,w.jsxs)(`div`,{className:`relative mt-4 rounded-lg border border-violet-500/20 bg-violet-500/4 px-4 py-3`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:i,className:`absolute right-3 top-3 text-[10px] font-medium text-violet-400 hover:text-violet-300 transition-colors`,"aria-label":`Dismiss explanation`,children:`Got it`}),t]})}function NU(e){if(!e)return`unknown`;let t=e.toLowerCase();return t.includes(`cursor`)||t.includes(`copilot`)?`credit`:t.includes(`claude`)||t.includes(`windsurf`)?`window`:`unknown`}function PU({label:e,rawValue:t,subtitle:n,accent:r,hint:i,prefix:a,sparklinePoints:o}){let s=kU(t);return(0,w.jsx)(yU,{label:e,value:`${a??``}${Q(Math.round(s))}`,subtitle:n,accent:r,hint:i,sparklinePoints:o})}function FU({mechanisms:e,totalSaved:t}){let n=Object.entries(e).sort(([,e],[,t])=>t.tokens_saved-e.tokens_saved);if(n.length===0)return(0,w.jsx)(`p`,{className:`t-secondary text-sm py-3`,children:`No mechanism data.`});let r=n[0][1].tokens_saved||1;return(0,w.jsx)(`div`,{className:`space-y-1.5`,children:n.map(([e,t])=>{let n=sL(e),i=Math.max(3,t.tokens_saved/r*100);return(0,w.jsxs)(`div`,{className:`flex items-center gap-3 py-0.5`,children:[(0,w.jsx)(`span`,{className:`${n.text} text-xs font-medium w-36 shrink-0 truncate`,children:e.replace(/_/g,` `)}),(0,w.jsx)(`div`,{className:`flex-1 h-5 rounded bg-white/[0.06] overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full ${n.bar} opacity-80 rounded`,style:{width:`${i}%`}})}),(0,w.jsx)(`span`,{className:`text-success font-mono text-xs w-14 text-right shrink-0`,children:Q(t.tokens_saved)}),(0,w.jsxs)(`span`,{className:`t-tertiary font-mono text-xs w-10 text-right shrink-0`,children:[t.pct_of_total,`%`]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs w-8 text-right shrink-0`,children:[t.event_count,`×`]})]},e)})})}function IU({scope:e,sessionId:t,fromTs:n,toTs:r}){let{url:i,queryKey:a}=Ot(),o=n||r?`${n?`&from_ts=${n}`:``}${r?`&to_ts=${r}`:``}`:``,s=N({queryKey:a([`behavior-events`,e,t??``,n??``,r??``]),queryFn:()=>e===`global`?O(i(`/api/behavior-events/global?_=1${o}`)).then(e=>e.data.counts):O(i(`/api/behavior-events/session?${t?`session_id=${t}`:`_=1`}`)).then(e=>e.data.counts),refetchInterval:5e3}),c=s.data,l=e===`global`?n||r?``:` (all time)`:` (this session)`,u=(0,f.useMemo)(()=>c?Object.entries(c.by_type).filter(([e,t])=>t>0&&!nL.has(e)).sort(([,e],[,t])=>t-e):[],[c]),d=u.reduce((e,[,t])=>e+t,0);return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,w.jsxs)(`h3`,{className:`t-secondary text-sm font-medium`,children:[`Mistakes prevented`,l]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[Q(d),` caught`]})]}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mb-3 leading-snug`,children:`Problems unerr caught before they reached your code — hover any row to see what would have gone wrong without it.`}),s.isLoading?(0,w.jsx)(Ht,{height:120}):u.length===0?(0,w.jsx)(`p`,{className:`t-secondary text-sm py-3`,children:`No issues caught yet — unerr starts tracking as soon as your agent calls a tool.`}):(0,w.jsx)(`div`,{className:`space-y-1.5`,children:u.map(([e,t])=>(0,w.jsxs)(`div`,{className:`flex items-center gap-3 py-1 group cursor-default`,title:iL[e]??e,children:[(0,w.jsx)(`span`,{className:`text-violet-300 text-xs font-medium w-52 shrink-0 truncate`,children:rL[e]??e.replace(/_/g,` `)}),(0,w.jsx)(`div`,{className:`flex-1 h-5 rounded bg-white/[0.06] overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full bg-violet-500 opacity-80 rounded`,style:{width:`${Math.max(3,t/(u[0]?.[1]||1)*100)}%`}})}),(0,w.jsx)(`span`,{className:`text-violet-200 font-mono text-xs w-14 text-right shrink-0`,children:Q(t)})]},e))})]})}function LU(){let{url:e,queryKey:t}=Ot(),n=N({queryKey:t([`overhead-levers`]),queryFn:()=>O(e(`/api/token-flow/overhead-levers`)).then(e=>e.data),refetchInterval:5e3}),r=n.data,i=(0,f.useMemo)(()=>r?Object.entries(r.recon.by_task_size).sort(([,e],[,t])=>t-e):[],[r]),a=i.reduce((e,[,t])=>e+t,0);return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Token-overhead levers`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[r?Q(r.recon.count):`—`,` recon calls`]})]}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mb-3 leading-snug`,children:[`Server-side proof the round-trip-reduction levers fire: one`,` `,(0,w.jsx)(`code`,{children:`unerr recon`}),` call replaces the ~5-call discovery fan-out, the footprint self-selects by task size, and verbose hook banners drop to terse after their first emission. The absolute cache_read/cache_write bill is measured offline (`,(0,w.jsx)(`code`,{children:`scripts/measure-token-baseline.mjs`}),`).`]}),n.isLoading?(0,w.jsx)(Ht,{height:120}):!r||r.recon.count===0&&r.ceremony.suppressed_count===0?(0,w.jsxs)(`p`,{className:`t-secondary text-sm py-3`,children:[`No levers fired yet — run `,(0,w.jsx)(`code`,{children:`unerr recon "<task>"`}),` or edit a file twice to move the counters.`]}):(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,w.jsxs)(`div`,{className:`rounded-lg bg-white/[0.04] px-3 py-2.5`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-xs`,children:`recon calls`}),(0,w.jsx)(`div`,{className:`text-violet-200 font-mono text-lg`,children:Q(r.recon.count)}),(0,w.jsxs)(`div`,{className:`t-tertiary text-xs`,children:[`avg `,r.recon.avg_sections,` sections · ~`,Q(r.recon.avg_tokens),` `,`tok`]})]}),(0,w.jsxs)(`div`,{className:`rounded-lg bg-white/[0.04] px-3 py-2.5`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-xs`,children:`large sweeps`}),(0,w.jsxs)(`div`,{className:`text-violet-200 font-mono text-lg`,children:[r.recon.pct_large_sweep,`%`]}),(0,w.jsxs)(`div`,{className:`t-tertiary text-xs`,children:[r.recon.pct_digest,`% emitted digest`]})]}),(0,w.jsxs)(`div`,{className:`rounded-lg bg-white/[0.04] px-3 py-2.5`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-xs`,children:`banners suppressed`}),(0,w.jsx)(`div`,{className:`text-violet-200 font-mono text-lg`,children:Q(r.ceremony.suppressed_count)}),(0,w.jsx)(`div`,{className:`t-tertiary text-xs`,children:`once per session`})]})]}),i.length>0&&(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-xs mb-1`,children:`Task-size mix`}),i.map(([e,t])=>(0,w.jsxs)(`div`,{className:`flex items-center gap-3 py-0.5`,children:[(0,w.jsx)(`span`,{className:`text-violet-300 text-xs font-medium w-32 shrink-0 truncate`,children:e.replace(/_/g,` `)}),(0,w.jsx)(`div`,{className:`flex-1 h-5 rounded bg-white/[0.06] overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full bg-violet-500 opacity-80 rounded`,style:{width:`${Math.max(3,t/(i[0]?.[1]||1)*100)}%`}})}),(0,w.jsxs)(`span`,{className:`text-violet-200 font-mono text-xs w-20 text-right shrink-0`,children:[Q(t),` (`,a>0?Math.round(t/a*100):0,`%)`]})]},e))]})]})]})}function RU({sessionId:e,turn:t}){let{url:n,queryKey:r}=Ot(),i=N({queryKey:r([`behavior-events-turn`,e,t]),queryFn:()=>O(n(`/api/behavior-events/events?session_id=${e}&turn=${t}&limit=200`)),refetchInterval:5e3});if(i.isLoading)return(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-5`,children:(0,w.jsx)(Ht,{height:80})});let a=(i.data?.data??[]).filter(e=>!nL.has(e.type));return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Mistakes prevented in this turn`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[a.length,` caught`]})]}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mb-3 leading-snug`,children:[`Each row is something unerr caught during turn #`,t,` — hover for details on what would have gone wrong.`]}),a.length===0?(0,w.jsx)(`p`,{className:`t-secondary text-sm py-3`,children:`No issues caught in this turn.`}):(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-left text-xs min-w-[700px]`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle t-tertiary uppercase`,children:[(0,w.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Time`}),(0,w.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`What was prevented`}),(0,w.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Tool`}),(0,w.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`File / Entity`}),(0,w.jsx)(`th`,{className:`px-3 py-2 font-medium text-right`,children:`Size`})]})}),(0,w.jsx)(`tbody`,{children:a.map(e=>(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle/40 hover:bg-white/[0.03]`,title:iL[e.type]??e.type,children:[(0,w.jsx)(`td`,{className:`px-3 py-1.5 font-mono t-tertiary whitespace-nowrap`,children:oL(e.ts)}),(0,w.jsx)(`td`,{className:`px-3 py-1.5`,children:(0,w.jsx)(`span`,{className:`text-violet-300`,children:rL[e.type]??e.type.replace(/_/g,` `)})}),(0,w.jsx)(`td`,{className:`px-3 py-1.5 font-mono t-secondary`,children:e.tool??`—`}),(0,w.jsx)(`td`,{className:`px-3 py-1.5 font-mono t-secondary truncate max-w-[260px]`,children:e.entity_key??`—`}),(0,w.jsx)(`td`,{className:`px-3 py-1.5 font-mono t-secondary text-right`,children:e.response_bytes==null?`—`:Q(e.response_bytes)})]},`${e.session_id}-${e.id}-${e.ts}`))})]})})]})}function zU({onSelectSession:e}){let{url:t,queryKey:n}=Ot(),r=S(`from`)??``,i=S(`to`)??``,a=S(`session_offset`),o=Number(a)||0,s=(e,t)=>x({from:e||null,to:t||null,session_offset:null}),c=e=>x({session_offset:e>0?String(e):null}),l=r||i?`${r?`&from_ts=${r}`:``}${i?`&to_ts=${i}`:``}`:``,u=N({queryKey:n([`token-flow-global`,r,i]),queryFn:()=>O(t(`/api/token-flow/global?_=1${l}`)),refetchInterval:5e3}),d=N({queryKey:n([`token-flow-sessions`,r,i,o]),queryFn:()=>O(t(`/api/token-flow/sessions?limit=10&offset=${o}${l}`)),refetchInterval:5e3});if(u.isLoading)return(0,w.jsx)(Wt,{n:4});let f=u.data?.data,p=d.data?.data??[],m=d.data?.total??0;return!f||f.event_count===0?(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-10 text-center`,children:[(0,w.jsx)(`p`,{className:`t-secondary text-lg`,children:`No token flow data yet`}),(0,w.jsx)(`p`,{className:`t-tertiary mt-2 text-sm`,children:`Token savings appear here as the agent makes tool calls through unerr.`}),(0,w.jsx)(`p`,{className:`t-tertiary mt-1 text-xs`,children:`Sources: graph queries, shell compression, format encoding, session dedup, smart truncation, file reads, behavior automation.`})]}):(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-end gap-3 flex-wrap -mt-2`,children:[(0,w.jsx)(FV,{fromTs:r,toTs:i,onChange:(e,t)=>s(e,t)}),(0,w.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium t-secondary transition-colors hover:border-border-strong hover:bg-white/[0.06] hover:text-foreground`,title:`Export all token flow data as CSV`,onClick:()=>{let e=r||i?`${r?`&from_ts=${r}`:``}${i?`&to_ts=${i}`:``}`:``;fetch(t(`/api/token-flow/events?limit=500${e}`)).then(e=>e.json()).then(e=>{let t=e.data??[];if(t.length===0)return;let n=[`timestamp`,`session_id`,`turn`,`mechanism`,`tool`,`tokens_without`,`tokens_with`,`tokens_saved`,`detail`],r=t.map(e=>[e.ts,e.session_id,e.turn,e.mechanism,e.tool??``,e.tokens_without,e.tokens_with,e.tokens_saved,(e.detail??``).toString().replace(/"/g,`""`)].map(e=>`"${e}"`).join(`,`)),i=[n.join(`,`),...r].join(`
|
|
917
|
-
`),a=new Blob([i],{type:`text/csv`}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=`token-economics-${new Date().toISOString().slice(0,10)}.csv`,s.click(),URL.revokeObjectURL(o)})},children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z`})}),`Export CSV`]})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,w.jsx)(PU,{label:`Tokens Saved`,rawValue:f.total_tokens_saved,subtitle:`direct rescue`,accent:`emerald`,hint:`Tokens removed from agent responses before they could weigh down context`}),(0,w.jsx)(PU,{label:`Context Avoided`,rawValue:f.total_context_avoided,subtitle:f.total_tokens_saved>0?`${(f.total_context_avoided/f.total_tokens_saved).toFixed(1)}× compounded`:`carried forward`,accent:`cyan`,hint:`Cumulative token-turns of context pressure prevented — savings compound because each turn's rescue carries forward to all future turns`}),(0,w.jsx)(yU,{label:`Rescue Rate`,value:`${f.efficiency_pct}%`,subtitle:`tokens kept out`,accent:`violet`,hint:`Share of original tokens that unerr rescued (saved ÷ original)`}),(0,w.jsx)(PU,{label:`Sessions`,rawValue:f.total_sessions,subtitle:`${f.total_turns} turn${f.total_turns===1?``:`s`}`,accent:`fuchsia`,hint:`Distinct agent sessions tracked, plus total turns across them`})]}),(0,w.jsx)(CU,{byMechanism:f.by_mechanism,totalSaved:f.total_tokens_saved}),f.avg_context_reduction>0&&(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4 border-l-2 border-cyan-500/60`,children:[(0,w.jsx)(`h3`,{className:`text-foreground text-sm font-medium`,children:`Carry-Forward Savings`}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mt-1 max-w-2xl leading-snug`,children:[`Each turn ran with`,` `,(0,w.jsx)(`span`,{className:`text-cyan-400 font-medium`,children:Q(f.avg_context_reduction)}),` `,`fewer tokens on average across `,f.total_turns,` turn`,f.total_turns===1?``:`s`,`, peaking at`,` `,Q(f.peak_context_reduction),`.`]})]}),(0,w.jsx)(OU,{fromTs:r,toTs:i,bucket:`day`}),(0,w.jsx)(IU,{scope:`global`,fromTs:r,toTs:i}),(0,w.jsx)(LU,{}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg overflow-hidden`,children:[(0,w.jsxs)(`div`,{className:`px-5 py-3 border-b border-border-subtle flex items-center justify-between`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Sessions`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[m,` session`,m===1?``:`s`]})]}),p.length===0?(0,w.jsx)(`p`,{className:`px-5 py-6 t-secondary text-sm`,children:`No sessions recorded.`}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`divide-y divide-border-subtle`,children:p.map((t,n)=>(t.total_saved>0&&t.avg_context_reduction>0&&Math.round(t.total_saved/(t.total_saved+t.total_turns*(t.avg_context_reduction||1))*100),(0,w.jsxs)(`div`,{className:`group relative cursor-pointer px-5 py-4 transition-all hover:bg-white/3`,onClick:()=>e(t.session_id),children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,w.jsx)(`span`,{className:`font-mono text-xs text-foreground group-hover:text-violet-400 transition-colors shrink-0`,children:t.session_id.slice(0,12)}),n===0&&o===0&&(0,w.jsx)(`span`,{className:`rounded-full bg-emerald-500/20 text-emerald-400 px-2 py-0.5 text-[10px] font-medium shrink-0`,children:`latest`}),(0,w.jsx)(YI,{name:t.agent_name}),(0,w.jsx)(`span`,{className:`t-tertiary text-xs shrink-0`,children:aL(t.last_ts)})]}),(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-violet-400 opacity-0 group-hover:opacity-100 transition-opacity font-medium whitespace-nowrap shrink-0`,children:[`View`,` `,(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 5l7 7-7 7`})})]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-4 mt-2.5 flex-wrap`,children:[(0,w.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,w.jsx)(`span`,{className:`text-emerald-400 font-mono font-semibold text-sm tabular-nums`,children:Q(t.total_saved)}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`saved`})]}),t.avg_context_reduction>0&&(0,w.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,w.jsx)(`span`,{className:`text-cyan-400 font-mono font-semibold text-sm tabular-nums`,children:Q(t.avg_context_reduction)}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`avg ctx/turn`})]}),(0,w.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,w.jsx)(`span`,{className:`t-secondary font-mono text-xs tabular-nums`,children:t.total_turns}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px]`,children:[`turn`,t.total_turns===1?``:`s`]})]}),(0,w.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,w.jsx)(`span`,{className:`t-secondary font-mono text-xs tabular-nums`,children:t.event_count}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px]`,children:[`event`,t.event_count===1?``:`s`]})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-1 ml-auto`,children:[t.mechanisms.slice(0,4).map(e=>(0,w.jsx)(uL,{mechanism:e},e)),t.mechanisms.length>4&&(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px]`,children:[`+`,t.mechanisms.length-4]})]})]}),(0,w.jsx)(`div`,{className:`h-0 overflow-hidden group-hover:h-auto group-hover:mt-2.5 transition-all`,children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-rose-500/6 border border-rose-500/10 px-3 py-1.5`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3 h-3 text-rose-400 shrink-0`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z`})}),(0,w.jsxs)(`span`,{className:`text-rose-300/80 text-[10px]`,children:[`Without unerr: `,Q(t.total_saved),` extra tokens in every subsequent turn's context`,t.avg_context_reduction>0&&` · ${Q(t.avg_context_reduction)} avg context pressure per turn`]})]})})]},t.session_id)))}),(0,w.jsx)(`div`,{className:`px-5 py-2 border-t border-border-subtle`,children:(0,w.jsx)(IV,{total:m,limit:10,offset:o,onPageChange:c})})]})]})]})}function BU({sessionId:e,onSelectTurn:t}){let{url:n,queryKey:r}=Ot(),[i,a]=(0,f.useState)(0),o=N({queryKey:r([`token-flow-session`,e]),queryFn:()=>O(n(`/api/token-flow/session${e?`?session_id=${e}`:``}`)),refetchInterval:5e3}),s=N({queryKey:r([`token-flow-cumulative`,e]),queryFn:()=>O(n(`/api/token-flow/cumulative?session_id=${e}`)),refetchInterval:5e3}),c=N({queryKey:r([`token-flow-events`,e]),queryFn:()=>O(n(`/api/token-flow/events?session_id=${e}`)),refetchInterval:5e3});if(o.isLoading)return(0,w.jsx)(Wt,{n:4});let l=o.data?.data,u=s.data?.data??[],d=c.data?.data??[];if(!l)return(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-8 text-center`,children:(0,w.jsxs)(`p`,{className:`t-secondary`,children:[`No data for session `,e.slice(0,12)]})});let p=new Map;for(let e of d){let t=p.get(e.turn)??[];t.push(e),p.set(e.turn,t)}let m=[...p.entries()].sort(([e],[t])=>t-e),h=m.slice(i*10,(i+1)*10),g=h.reduce((e,[,t])=>{let n=t.reduce((e,t)=>e+t.tokens_saved,0);return Math.max(e,n)},1),_=new Map;for(let e of u)_.set(e.turn,e);return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,w.jsx)(PU,{label:`Tokens Saved`,rawValue:l.total_tokens_saved,subtitle:`direct rescue`,accent:`emerald`,hint:`Tokens unerr rescued from agent responses this session`}),(0,w.jsx)(PU,{label:`Context Avoided`,rawValue:s.data?.total_context_avoided??0,subtitle:l.total_tokens_saved>0&&(s.data?.total_context_avoided??0)>0?`${((s.data?.total_context_avoided??0)/l.total_tokens_saved).toFixed(1)}× compounded`:`carried forward`,accent:`cyan`,hint:`Cumulative token-turns of context pressure prevented this session`}),(0,w.jsx)(yU,{label:`Rescue Rate`,value:`${l.efficiency_pct}%`,subtitle:`tokens kept out`,accent:`violet`,hint:`Share of original tokens rescued (saved ÷ original)`}),(0,w.jsx)(PU,{label:`Turns`,rawValue:l.total_turns,subtitle:`${l.event_count} event${l.event_count===1?``:`s`}`,accent:`fuchsia`,hint:`Conversation turns in this session`})]}),(s.data?.avg_context_reduction??0)>0&&(()=>{let e=s.data;return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4 border-l-2 border-cyan-500/60`,children:[(0,w.jsx)(`h3`,{className:`text-foreground text-sm font-medium`,children:`Carry-Forward Savings`}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mt-1 max-w-2xl leading-snug`,children:[`Each turn ran with`,` `,(0,w.jsx)(`span`,{className:`text-cyan-400 font-medium`,children:Q(e.avg_context_reduction)}),` `,`fewer tokens on average across `,l.total_turns,` turn`,l.total_turns===1?``:`s`,`, peaking at`,` `,Q(e.peak_context_reduction),`.`]})]})})(),(0,w.jsx)(CU,{byMechanism:l.by_mechanism,totalSaved:l.total_tokens_saved}),(0,w.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-1`,children:`Cumulative Savings`}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mb-3`,children:[`Each bar = cumulative tokens saved through that turn. Showing latest`,` `,Math.min(60,u.length),` of `,u.length,` turns. Hover for details.`]}),u.length===0?(0,w.jsx)(`div`,{className:`h-[140px] flex items-center justify-center`,children:(0,w.jsx)(`p`,{className:`t-tertiary text-xs`,children:`Loading chart data...`})}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`flex gap-[3px]`,style:{height:`140px`},children:u.slice(-60).map(e=>{let n=u[u.length-1]?.cumulative_tokens_saved||1,r=e.cumulative_tokens_saved/n*100;return(0,w.jsxs)(`div`,{className:`group relative flex-1 min-w-[6px] max-w-[28px] h-full flex items-end`,children:[(0,w.jsx)(`div`,{className:`w-full ${sL(Object.entries(e.mechanisms_this_turn).sort(([,e],[,t])=>t-e)[0]?.[0]??`shell_compression`).bar} opacity-70 hover:opacity-100 rounded-t transition-all cursor-pointer`,style:{height:`${Math.max(4,r)}%`},onClick:()=>t(e.turn)}),(0,w.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none`,children:(0,w.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-700 rounded-lg px-3 py-2 text-xs whitespace-nowrap shadow-xl`,children:[(0,w.jsxs)(`div`,{className:`font-medium text-foreground`,children:[`Turn #`,e.turn]}),(0,w.jsx)(`div`,{className:`t-tertiary mt-0.5`,children:e.tools.join(`, `)||`exec`}),(0,w.jsxs)(`div`,{className:`text-success mt-1`,children:[`+`,Q(e.tokens_saved_this_turn),` this turn`]}),(0,w.jsxs)(`div`,{className:`t-secondary`,children:[`Cumulative: `,Q(e.cumulative_tokens_saved)]}),(0,w.jsxs)(`div`,{className:`text-cyan-400 mt-0.5`,children:[`Context avoided: `,Q(e.context_avoided)]}),(0,w.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:Object.keys(e.mechanisms_this_turn).map(e=>(0,w.jsx)(uL,{mechanism:e},e))})]})})]},e.turn)})}),(0,w.jsxs)(`div`,{className:`flex justify-between mt-1.5`,children:[(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:[`T`,u.length>60?u.length-59:1]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:[`T`,u.length]})]}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-3 mt-3 pt-3 border-t border-border-subtle/50`,children:QI.filter(e=>u.some(t=>e in t.mechanisms_this_turn)).map(e=>(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-sm ${sL(e).bar}`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:e.replace(/_/g,` `)})]},e))})]})]}),(0,w.jsx)(IU,{scope:`session`,sessionId:e})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg overflow-hidden`,children:[(0,w.jsxs)(`div`,{className:`px-5 py-3 border-b border-border-subtle flex items-center justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Turns`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-0.5`,children:`Click a turn to see all events and mechanisms within it.`})]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[m.length,` turn`,m.length===1?``:`s`]})]}),h.length===0?(0,w.jsx)(`p`,{className:`px-5 py-6 t-secondary text-sm`,children:`No turns recorded.`}):(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-left text-sm min-w-[800px]`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle t-tertiary text-xs uppercase`,children:[(0,w.jsx)(`th`,{className:`px-5 py-2.5 font-medium w-14`,title:`Turn number in the conversation`,children:`Turn`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,title:`Summary of what happened in this turn`,children:`Description`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium w-36`,title:`Relative savings compared to the largest turn — wider bar means more tokens saved`,children:`Savings Bar`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,title:`Types of rescue applied this turn`,children:`Mechanisms`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-right`,title:`Tokens unerr rescued from agent responses this turn (direct savings)`,children:`Saved`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-right`,title:`Cumulative tokens of context avoided at this point — prior savings carry forward, keeping context smaller for this and future turns`,children:`Context Avoided`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-right`,title:`Number of savings events this turn`,children:`Events`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 pr-5 font-medium w-16`})]})}),(0,w.jsx)(`tbody`,{children:h.map(([e,n])=>{let r=n.reduce((e,t)=>e+t.tokens_saved,0),i=[...new Set(n.map(e=>e.mechanism))],{label:a,subtitle:o}=lL(n),s=_.get(e);return(0,w.jsxs)(`tr`,{className:`group cursor-pointer border-b border-border-subtle transition-colors hover:bg-white/[0.04]`,onClick:()=>t(e),children:[(0,w.jsx)(`td`,{className:`px-5 py-3`,children:(0,w.jsxs)(`span`,{className:`t-tertiary font-mono text-xs group-hover:text-violet-400 transition-colors`,children:[`#`,e]})}),(0,w.jsx)(`td`,{className:`px-3 py-3`,children:(0,w.jsxs)(`div`,{className:`min-w-0 max-w-[260px]`,children:[(0,w.jsx)(`p`,{className:`text-foreground font-mono text-xs truncate group-hover:text-violet-300 transition-colors`,children:a}),o&&(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-0.5 truncate`,children:o})]})}),(0,w.jsx)(`td`,{className:`px-3 py-3`,children:(0,w.jsx)(`div`,{className:`w-32 h-4 relative rounded-sm bg-white/[0.06] overflow-hidden`,children:(()=>{let e=new Map;for(let t of n)e.set(t.mechanism,(e.get(t.mechanism)??0)+t.tokens_saved);let t=0;return[...e.entries()].sort(([,e],[,t])=>t-e).map(([e,n])=>{let r=g>0?n/g*100:0,i=t;return t+=r,(0,w.jsx)(`div`,{className:`absolute inset-y-0 ${sL(e).bar} opacity-80`,style:{left:`${i}%`,width:`${Math.max(1,r)}%`}},e)})})()})}),(0,w.jsx)(`td`,{className:`px-3 py-3`,children:(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:i.map(e=>(0,w.jsx)(uL,{mechanism:e},e))})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,w.jsx)(`span`,{className:`text-success font-mono font-medium text-xs`,children:Q(r)})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right`,children:s?(0,w.jsx)(`span`,{className:`text-cyan-400 font-mono font-medium text-xs`,title:`${Q(s.context_avoided)} tokens of cumulative context avoided at turn #${e}`,children:Q(s.context_avoided)}):(0,w.jsx)(`span`,{className:`t-tertiary font-mono text-xs`,children:`—`})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:n.length})}),(0,w.jsx)(`td`,{className:`pl-4 py-3 pr-5 text-right w-16`,children:(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-violet-400 opacity-0 group-hover:opacity-100 transition-opacity font-medium whitespace-nowrap`,children:[`View`,` `,(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 5l7 7-7 7`})})]})})]},e)})})]})}),(0,w.jsx)(IV,{total:m.length,limit:10,offset:i*10,onPageChange:e=>a(Math.floor(e/10))})]})]})}function VU({sessionId:e,turn:t}){let{url:n,queryKey:r}=Ot(),i=N({queryKey:r([`token-flow-events`,e,t]),queryFn:()=>O(n(`/api/token-flow/events?session_id=${e}&turn=${t}`))}),a=N({queryKey:r([`token-flow-cumulative`,e]),queryFn:()=>O(n(`/api/token-flow/cumulative?session_id=${e}`))}),o=a.data?.data?.find(e=>e.turn===t),s=a.data?.total_turns??0,c=s>0?s-(a.data?.data?.findIndex(e=>e.turn===t)??0)-1:0,l=i.data?.data??[],[u,d]=(0,f.useState)(0),p=l.slice(u,u+10),m=l.reduce((e,t)=>e+t.tokens_saved,0),h=l.reduce((e,t)=>e+t.tokens_without,0),g=l.reduce((e,t)=>e+t.tokens_with,0),_=[...new Set(l.map(e=>e.tool).filter(Boolean))],v=h>0?Math.round(m/h*100):0,b={};for(let e of l){let t=b[e.mechanism]??{tokens_saved:0,tokens_delivered:0,event_count:0,pct_of_total:0};t.tokens_saved+=e.tokens_saved,t.tokens_delivered+=e.tokens_with,t.event_count++,b[e.mechanism]=t}for(let e of Object.values(b))e.pct_of_total=m>0?Math.round(e.tokens_saved/m*100):0;return i.isLoading?(0,w.jsx)(Wt,{n:4}):(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(()=>{let{label:e,subtitle:t}=lL(l);return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4 border-l-4 border-violet-500/60`,children:[(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium`,children:e}),t&&(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-0.5`,children:t})]})})(),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-3`,children:[(0,w.jsx)(PU,{label:`Tokens Saved`,rawValue:m,subtitle:_.length>0?_.slice(0,2).join(`, `)+(_.length>2?` +${_.length-2}`:``):`exec`,accent:`emerald`,hint:`Tokens unerr rescued from agent responses this turn`}),(0,w.jsx)(yU,{label:`Rescue Rate`,value:`${v}%`,subtitle:`${Q(h)} → ${Q(g)}`,accent:`violet`,hint:`Share of original tokens rescued this turn (Without − Delivered)`}),(0,w.jsx)(PU,{label:`Context Avoided`,rawValue:o?.context_avoided??0,subtitle:c>0?`carries to ${c} more turn${c===1?``:`s`}`:`carry-forward`,accent:`cyan`,hint:`Cumulative token-turns of context pressure prevented at this point`})]}),Object.keys(b).length>0&&(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-3`,children:`Mechanisms in this Turn`}),(0,w.jsx)(FU,{mechanisms:b,totalSaved:m})]}),(0,w.jsx)(RU,{sessionId:e,turn:t}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg overflow-hidden`,children:[(0,w.jsxs)(`div`,{className:`px-5 py-3 border-b border-border-subtle flex items-center justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Events`}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mt-0.5`,children:[`Every savings event in turn #`,t,`: tool calls, exec commands, and the mechanism that rescued tokens.`]})]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[l.length,` event`,l.length===1?``:`s`]})]}),l.length===0?(0,w.jsx)(`p`,{className:`px-5 py-6 t-secondary text-sm`,children:`No events for this turn.`}):(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-left text-sm min-w-[900px]`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle t-tertiary text-xs uppercase`,children:[(0,w.jsx)(`th`,{className:`px-5 py-3 font-medium`,title:`When this savings event occurred`,children:`Time`}),(0,w.jsx)(`th`,{className:`px-3 py-3 font-medium`,title:`Type of rescue applied (e.g. graph query, shell compression)`,children:`Mechanism`}),(0,w.jsx)(`th`,{className:`px-3 py-3 font-medium`,title:`MCP tool that triggered this rescue`,children:`Tool`}),(0,w.jsx)(`th`,{className:`px-3 py-3 font-medium text-right`,title:`Tokens that would have been sent without unerr`,children:`Without`}),(0,w.jsx)(`th`,{className:`px-3 py-3 font-medium text-right`,title:`Tokens actually delivered to the agent after unerr's rescue`,children:`Delivered`}),(0,w.jsx)(`th`,{className:`px-3 py-3 font-medium text-right`,title:`Tokens rescued by this savings event (Without − Delivered)`,children:`Saved`}),(0,w.jsx)(`th`,{className:`px-3 py-3 pr-5 font-medium`,title:`Description of what was rescued`,children:`Detail`})]})}),(0,w.jsx)(`tbody`,{children:p.map(e=>{sL(e.mechanism);let t=e.tokens_without>0?Math.round(e.tokens_saved/e.tokens_without*100):0;return(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle transition-colors hover:bg-white/[0.04]`,children:[(0,w.jsx)(`td`,{className:`t-tertiary px-5 py-3 font-mono text-xs whitespace-nowrap`,children:oL(e.ts)}),(0,w.jsx)(`td`,{className:`px-3 py-3`,children:(0,w.jsx)(uL,{mechanism:e.mechanism})}),(0,w.jsx)(`td`,{className:`t-secondary px-3 py-3 font-mono text-xs whitespace-nowrap`,children:e.tool??`—`}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right font-mono text-xs tabular-nums whitespace-nowrap`,children:Q(e.tokens_without)}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right font-mono text-xs tabular-nums whitespace-nowrap`,children:Q(e.tokens_with)}),(0,w.jsxs)(`td`,{className:`px-3 py-3 text-right whitespace-nowrap`,children:[(0,w.jsx)(`span`,{className:`text-success font-mono font-medium text-xs`,children:Q(e.tokens_saved)}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px] ml-1`,children:[`(`,t,`%)`]})]}),(0,w.jsx)(`td`,{className:`px-3 py-3 pr-5 font-mono text-xs max-w-[400px]`,children:(0,w.jsx)(`span`,{className:`t-secondary break-words leading-relaxed`,children:cL(e)})})]},e.id)})}),(0,w.jsx)(`tfoot`,{children:(0,w.jsxs)(`tr`,{className:`border-t border-border-subtle font-medium bg-white/[0.04]`,children:[(0,w.jsx)(`td`,{className:`px-5 py-3`,colSpan:3,children:(0,w.jsx)(`span`,{className:`t-secondary text-xs uppercase tracking-wider`,children:`Turn Total`})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right font-mono text-xs tabular-nums`,children:Q(h)}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right font-mono text-xs tabular-nums`,children:Q(g)}),(0,w.jsxs)(`td`,{className:`px-3 py-3 text-right`,children:[(0,w.jsx)(`span`,{className:`text-success font-mono font-medium text-xs`,children:Q(m)}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px] ml-1`,children:[`(`,v,`%)`]})]}),(0,w.jsx)(`td`,{})]})})]})}),(0,w.jsx)(`div`,{className:`px-5 py-2 border-t border-border-subtle`,children:(0,w.jsx)(IV,{total:l.length,limit:10,offset:u,onPageChange:d})})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4 flex flex-wrap items-center justify-center gap-x-6 gap-y-2 text-xs`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`prompt-trace`,{session:e,turn:String(t)}),children:[`Open the prompt trace for turn `,t,` →`]}),(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`logbook`,{session:e}),children:`See this session in What unerr did →`}),(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`reasoning`,{session:e}),children:`See reasoning detail →`})]})]})}function HU(){let e=S(`session`)||null,t=S(`turn`),n=t?Number(t):null,r=S(`window`),i=r===`today`||r===`this_week`||r===`since_install`?r:`since_install`,a=e&&Number.isFinite(n)?{level:`turn`,sessionId:e,turn:n}:e?{level:`session`,sessionId:e}:{level:`global`},o=e=>x({window:e}),s=()=>x({session:null,turn:null}),c=e=>x({session:e,turn:null}),l=(e,t)=>x({session:e,turn:String(t)}),u=[];return(a.level===`session`||a.level===`turn`)&&u.push({label:`All Sessions`,onClick:s},{label:`Session ${a.sessionId.slice(0,12)}`,onClick:a.level===`turn`?()=>c(a.sessionId):void 0}),a.level===`turn`&&u.push({label:`Turn #${a.turn}`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(UU,{windowSelected:i,onWindowChange:o,sessionId:a.level===`global`?void 0:a.sessionId}),u.length>0&&(0,w.jsx)(XI,{items:u}),a.level===`global`&&(0,w.jsx)(zU,{onSelectSession:c}),a.level===`session`&&(0,w.jsx)(BU,{sessionId:a.sessionId,onSelectTurn:e=>l(a.sessionId,e)}),a.level===`turn`&&(0,w.jsx)(VU,{sessionId:a.sessionId,turn:a.turn})]})}function UU({windowSelected:e,onWindowChange:t,sessionId:n}){let{url:r,queryKey:i}=Ot(),a=N({queryKey:i([`token-flow`,`headroom`]),queryFn:()=>O(r(`/api/token-flow/headroom`)),refetchInterval:3e4}),o=N({queryKey:i([`token-flow`,`headroom-session`,n??``]),queryFn:()=>n?O(r(`/api/token-flow/headroom/session/${n}`)):Promise.resolve(null),enabled:!!n}),s=a.data?.data,c=o.data?.data,l=s?.[e],u=c?c.total_tokens_saved:l?.total_tokens_saved??0,d=c?c.headroom_compounded:l?.headroom_turns??0,f=c?c.turn_count:l?.turns_observed??0,p=c??s?.since_install,m=p?.turns_to_limit_with??0,h=p?.turns_to_limit_without??0,g=Math.max(0,m-h),_=l?.avg_turn_tokens_without??0,v=Math.max(0,_-(l?.avg_saved_per_turn??0)),y=NU(void 0),b=y===`credit`||y===`unknown`,x=y===`window`||y===`unknown`,S=e=>e===`today`?`Today`:e===`this_week`?`This Week`:`Since Install`;return(0,w.jsxs)(`section`,{className:`mb-6`,children:[(0,w.jsxs)(`div`,{className:`el-raised rounded-xl overflow-hidden`,children:[(0,w.jsxs)(`div`,{className:`relative px-6 pt-6 pb-5`,children:[(0,w.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 bg-linear-to-b from-emerald-500/6 to-transparent`}),(0,w.jsxs)(`div`,{className:`relative flex flex-col sm:flex-row sm:items-end sm:justify-between gap-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`p`,{className:`text-emerald-400 text-[10px] uppercase tracking-wider font-medium flex items-center gap-1.5`,children:[`Tokens Saved`,(0,w.jsx)(jU,{text:`Counts tokens unerr removed from the operations it touched — file reads, web fetches, shell output, dedup. Does not include system prompt, tool schemas, conversation history, reasoning, or native Read/Edit calls.`})]}),(0,w.jsx)(`p`,{className:`text-5xl sm:text-6xl font-bold font-mono text-emerald-400 mt-2 tabular-nums tracking-tighter leading-none`,children:(0,w.jsx)(AU,{value:u,format:Q})}),(0,w.jsxs)(`p`,{className:`t-secondary text-xs mt-2`,children:[`on operations unerr handled`,!n&&(0,w.jsxs)(`span`,{className:`t-tertiary ml-1`,children:[`· `,S(e).toLowerCase()]})]})]}),!n&&(0,w.jsx)(`div`,{className:`flex items-center gap-1`,children:[`today`,`this_week`,`since_install`].map(n=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:`rounded-md px-2.5 py-1 text-xs font-medium transition-all ${e===n?`bg-emerald-500/20 text-emerald-300 shadow-sm`:`bg-surface-secondary t-secondary hover:bg-surface-tertiary hover:text-foreground`}`,children:S(n)},n))})]})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 border-t border-border-subtle divide-x divide-border-subtle`,children:[(0,w.jsxs)(`div`,{className:`px-5 py-4 transition-all ${b?`bg-emerald-500/3`:``}`,children:[(0,w.jsxs)(`p`,{className:`text-emerald-400 text-[10px] uppercase tracking-wider font-medium flex items-center gap-1.5`,children:[`Turns Earned`,(0,w.jsx)(jU,{text:`Extra turns you got for free. Calculated as total tokens saved divided by average tokens per turn. Applies to credit-billed agents — Cursor fast-requests, API metered requests.`})]}),(0,w.jsxs)(`p`,{className:`text-2xl font-bold font-mono text-emerald-400 mt-1.5 tabular-nums`,children:[`+`,(0,w.jsx)(AU,{value:d,format:Q})]}),(0,w.jsxs)(`p`,{className:`t-tertiary text-[11px] mt-1`,children:[`over `,Q(f),` turn`,f===1?``:`s`]}),b&&(0,w.jsx)(`div`,{className:`mt-2 h-0.5 w-8 rounded-full bg-emerald-400/40`})]}),(0,w.jsxs)(`div`,{className:`px-5 py-4 transition-all ${x?`bg-violet-500/3`:``}`,children:[(0,w.jsxs)(`p`,{className:`text-violet-400 text-[10px] uppercase tracking-wider font-medium flex items-center gap-1.5`,children:[`Reach / Session`,(0,w.jsx)(jU,{text:`Per-session ceiling extension: how many more turns each session can reach before context exhaustion. Derived from lifetime average, stable across windows. Applies to window-billed agents — Claude Code 5-hour windows, Copilot Pro caps.`})]}),(0,w.jsxs)(`p`,{className:`text-2xl font-bold font-mono text-violet-400 mt-1.5 tabular-nums`,children:[`+`,(0,w.jsx)(AU,{value:g,format:Q})]}),(0,w.jsxs)(`p`,{className:`t-tertiary text-[11px] mt-1`,children:[`up to turn `,Q(m)]}),x&&(0,w.jsx)(`div`,{className:`mt-2 h-0.5 w-8 rounded-full bg-violet-400/40`})]}),(0,w.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,w.jsxs)(`p`,{className:`text-cyan-400 text-[10px] uppercase tracking-wider font-medium flex items-center gap-1.5`,children:[`Rescue Rate`,(0,w.jsx)(jU,{text:`Share of original tokens that unerr rescued — saved ÷ original. Higher means more compression per operation.`})]}),(0,w.jsx)(`p`,{className:`text-2xl font-bold font-mono text-cyan-400 mt-1.5 tabular-nums`,children:l?`${Math.round(l.avg_saved_per_turn/(l.avg_turn_tokens_without||1)*100)}%`:`—`}),(0,w.jsx)(`p`,{className:`t-tertiary text-[11px] mt-1`,children:`tokens kept out`})]}),(0,w.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,w.jsxs)(`p`,{className:`text-foreground/60 text-[10px] uppercase tracking-wider font-medium flex items-center gap-1.5`,children:[`Avg Turn`,(0,w.jsx)(jU,{text:`Average tokens per turn without unerr vs with unerr. The gap shows how much context pressure unerr removes on every turn.`})]}),(0,w.jsx)(`p`,{className:`text-2xl font-bold font-mono text-foreground mt-1.5 tabular-nums`,children:Q(_)}),(0,w.jsxs)(`p`,{className:`t-tertiary text-[11px] mt-1`,children:[`vs `,Q(v),` with unerr`]})]})]})]}),(0,w.jsx)(MU,{storageKey:`unerr-token-trace-billing-explained`,children:(0,w.jsxs)(`div`,{className:`pr-12`,children:[(0,w.jsx)(`p`,{className:`text-violet-300 text-[11px] font-medium mb-1`,children:`Two metrics, two billing models`}),(0,w.jsxs)(`p`,{className:`t-secondary text-[11px] leading-relaxed`,children:[(0,w.jsx)(`span`,{className:`text-emerald-300 font-medium`,children:`Turns earned`}),` `,`is usage-cumulative — extra prompts within your request quota. Relevant for credit-billed agents (Cursor fast-requests, API requests).`,` `,(0,w.jsx)(`span`,{className:`text-violet-300 font-medium`,children:`Reach/session`}),` `,`is a per-session ceiling — extra turns before context exhaustion. Relevant for window-billed agents (Claude Code 5h windows, Copilot Pro caps). One of the two holds for your agent's billing model.`]})]})})]})}function WU(){let e=_(),t=v(),[n,r]=(0,f.useState)(!1),{data:i,isFetched:a}=N({queryKey:[`pm`,`info`],queryFn:()=>O(`/api/pm`).catch(()=>null),staleTime:6e4,retry:!1}),o=!!i,{data:s}=N({queryKey:[`daemon`,`repos`],queryFn:()=>O(`/api/repos`),refetchInterval:5e3,enabled:o}),c=s?.repos??[];(0,f.useEffect)(()=>{if(!(!a||o))return Mt(Tt,r)},[a,o]);let{data:l=[]}=N({queryKey:[`live-feed`],initialData:[]}),{data:u}=N({queryKey:[`session-snapshot`]}),{data:d}=N({queryKey:[`system`,`status`],queryFn:()=>O(`/api/system/status`).catch(()=>null),staleTime:6e4,enabled:a&&!o}),p=t.repoLabel?c.find(e=>e.label===t.repoLabel):null,h=(0,f.useMemo)(()=>({label:t.repoLabel,path:p?.path??null,status:p?.status??null,apiBase:t.repoLabel?`/api/repo/${t.repoLabel}`:``,isDaemonMode:o}),[t.repoLabel,p,o]),g=o&&(e===`logbook`||e===`overview`)&&!t.repoLabel?`all-repos`:e,y=m(g),b;switch(g){case`all-repos`:b=(0,w.jsx)(Ft,{});break;case`daemon`:b=(0,w.jsx)(Vt,{});break;case`overview`:b=(0,w.jsx)(mn,{});break;case`visual`:b=(0,w.jsx)(oI,{});break;case`graph`:b=(0,w.jsx)(pr,{});break;case`facts`:b=(0,w.jsx)(Sn,{});break;case`logbook`:b=(0,w.jsx)(qI,{});break;case`token-trace`:b=(0,w.jsx)(HU,{});break;case`reasoning`:b=(0,w.jsx)(WV,{});break;case`prompt-trace`:b=(0,w.jsx)(DL,{});break;case`activity`:b=(0,w.jsx)(kH,{});break;case`router`:b=(0,w.jsx)(rH,{});break;case`router-sessions`:b=(0,w.jsx)(YV,{});break;case`settings`:b=(0,w.jsx)(gU,{});break}return(0,w.jsx)(Et.Provider,{value:h,children:(0,w.jsx)(te,{title:y,activeRoute:g,statusDot:o?void 0:n?`live`:`reconnecting`,repoPath:o?p?.path:d?.data?.cwd,repoLabel:t.repoLabel,isDaemonMode:o,repos:c,authBanner:d?.data?.auth??null,updateBanner:d?.data?.update??null,children:b})})}var GU=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,te());else{var t=n(l);t!==null&&ne(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function ee(){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&&ne(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(ee)};else if(typeof MessageChannel<`u`){var D=new MessageChannel,O=D.port2;D.port1.onmessage=ee,te=function(){O.postMessage(null)}}else te=function(){_(ee,0)};function ne(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,ne(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),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}}}})),KU=o(((e,t)=>{t.exports=GU()})),qU=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.5`})),JU=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=qU()})),YU=o((e=>{var t=KU(),n=d(),r=JU();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 p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),te=Symbol.for(`react.memo_cache_sentinel`),D=Symbol.iterator;function O(e){return typeof e!=`object`||!e?null:(e=D&&e[D]||e[`@@iterator`],typeof e==`function`?e:null)}var ne=Symbol.for(`react.client.reference`);function re(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?re(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}var ie=Array.isArray,k=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},j=[],M=-1;function oe(e){return{current:e}}function se(e){0>M||(e.current=j[M],j[M]=null,M--)}function ce(e,t){M++,j[M]=e.current,e.current=t}var le=oe(null),ue=oe(null),de=oe(null),fe=oe(null);function pe(e,t){switch(ce(de,t),ce(ue,e),ce(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}se(le),ce(le,e)}function me(){se(le),se(ue),se(de)}function he(e){e.memoizedState!==null&&ce(fe,e);var t=le.current,n=Xd(t,e.type);t!==n&&(ce(ue,e),ce(le,n))}function ge(e){ue.current===e&&(se(le),se(ue)),fe.current===e&&(se(fe),ap._currentValue=ae)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1<e.stack.indexOf(`
|
|
915
|
+
`),r=n.length;if(t.multi)for(let e=0;e<r;e++){let r=this.splitBlocks(n[e],t.multi);if(r!==void 0){if(r.length===0){this.lines.newLine(``);continue}if(t.maxWdt>0)for(let e=0;e<r.length;e++){let t=r[e].mod,n=r[e].text;this.splitStringIntoLines(n,t,!0)}else for(let e=0;e<r.length;e++){let t=r[e].mod,n=r[e].text;this.lines.append(n,t)}this.lines.newLine()}}else if(t.maxWdt>0)for(let e=0;e<r;e++)this.splitStringIntoLines(n[e]);else for(let e=0;e<r;e++)this.lines.newLine(n[e]);return this.lines.finalize()}decodeMarkupSystem(e){let t=`none`;return e===`markdown`||e===`md`?t=`markdown`:(e===!0||e===`html`)&&(t=`html`),t}splitHtmlBlocks(e){let t=new LM(e),n=e=>/&/.test(e)?(t.replace(t.text,`<`,`<`)||t.replace(t.text,`&`,`&`)||t.add(`&`),!0):!1;for(;t.position<t.text.length;){let e=t.text.charAt(t.position);t.parseWS(e)||/</.test(e)&&(t.parseStartTag(`bold`,`<b>`)||t.parseStartTag(`ital`,`<i>`)||t.parseStartTag(`mono`,`<code>`)||t.parseEndTag(`bold`,`</b>`)||t.parseEndTag(`ital`,`</i>`)||t.parseEndTag(`mono`,`</code>`))||n(e)||t.add(e),t.position++}return t.emitBlock(),t.blocks}splitMarkdownBlocks(e){let t=new LM(e),n=!0,r=e=>/\\/.test(e)?(t.position<this.text.length+1&&(t.position++,e=this.text.charAt(t.position),/ \t/.test(e)?t.spacing=!0:(t.add(e),n=!1)),!0):!1;for(;t.position<t.text.length;){let e=t.text.charAt(t.position);t.parseWS(e)||r(e)||(n||t.spacing)&&(t.parseStartTag(`bold`,`*`)||t.parseStartTag(`ital`,`_`)||t.parseStartTag(`mono`,"`"))||t.parseEndTag(`bold`,`*`,`afterBold`)||t.parseEndTag(`ital`,`_`,`afterItal`)||t.parseEndTag(`mono`,"`",`afterMono`)||(t.add(e),n=!1),t.position++}return t.emitBlock(),t.blocks}splitBlocks(e,t){let n=this.decodeMarkupSystem(t);if(n===`none`)return[{text:e,mod:`normal`}];if(n===`markdown`)return this.splitMarkdownBlocks(e);if(n===`html`)return this.splitHtmlBlocks(e)}overMaxWidth(e){let t=this.ctx.measureText(e).width;return this.lines.curWidth()+t>this.parent.fontOptions.maxWdt}getLongestFit(e){let t=``,n=0;for(;n<e.length;){let r=t+(t===``?``:` `)+e[n];if(this.overMaxWidth(r))break;t=r,n++}return n}getLongestFitWord(e){let t=0;for(;t<e.length&&!this.overMaxWidth(Kd(e).call(e,0,t));)t++;return t}splitStringIntoLines(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`normal`,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.parent.getFormattingValues(this.ctx,this.selected,this.hover,t),e=e.replace(/^( +)/g,`$1\r`),e=e.replace(/([^\r][^ ]*)( +)/g,`$1\r$2\r`);let r=e.split(`\r`);for(;r.length>0;){let e=this.getLongestFit(r);if(e===0){let e=r[0],n=this.getLongestFitWord(e);this.lines.newLine(Kd(e).call(e,0,n),t),r[0]=Kd(e).call(e,n)}else{let i=e;r[e-1]===` `?e--:r[i]===` `&&i++;let a=Kd(r).call(r,0,e).join(``);e==r.length&&n?this.lines.append(a,t):this.lines.newLine(a,t),r=Kd(r).call(r,i)}}}},zM=[`bold`,`ital`,`boldital`,`mono`],BM=class e{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.body=e,this.pointToSelf=!1,this.baseSize=void 0,this.fontOptions={},this.setOptions(t),this.size={top:0,left:0,width:0,height:0,yLine:0},this.isEdgeLabel=n}setOptions(e){if(this.elementOptions=e,this.initFontOptions(e.font),NM(e.label)?this.labelDirty=!0:e.label=void 0,e.font!==void 0&&e.font!==null){if(typeof e.font==`string`)this.baseSize=this.fontOptions.size;else if(typeof e.font==`object`){let t=e.font.size;t!==void 0&&(this.baseSize=t)}}}initFontOptions(t){if(ix(zM,e=>{this.fontOptions[e]={}}),e.parseFontString(this.fontOptions,t)){this.fontOptions.vadjust=0;return}ix(t,(e,t)=>{e!=null&&typeof e!=`object`&&(this.fontOptions[t]=e)})}static parseFontString(e,t){if(!t||typeof t!=`string`)return!1;let n=t.split(` `);return e.size=+n[0].replace(`px`,``),e.face=n[1],e.color=n[2],!0}constrain(e){let t={constrainWidth:!1,maxWdt:-1,minWdt:-1,constrainHeight:!1,minHgt:-1,valign:`middle`},n=yx(e,`widthConstraint`);if(typeof n==`number`)t.maxWdt=Number(n),t.minWdt=Number(n);else if(typeof n==`object`){let n=yx(e,[`widthConstraint`,`maximum`]);typeof n==`number`&&(t.maxWdt=Number(n));let r=yx(e,[`widthConstraint`,`minimum`]);typeof r==`number`&&(t.minWdt=Number(r))}let r=yx(e,`heightConstraint`);if(typeof r==`number`)t.minHgt=Number(r);else if(typeof r==`object`){let n=yx(e,[`heightConstraint`,`minimum`]);typeof n==`number`&&(t.minHgt=Number(n));let r=yx(e,[`heightConstraint`,`valign`]);typeof r==`string`&&(r===`top`||r===`bottom`)&&(t.valign=r)}return t}update(e,t){this.setOptions(e,!0),this.propagateFonts(t),$b(this.fontOptions,this.constrain(t)),this.fontOptions.chooser=jM(`label`,t)}adjustSizes(e){let t=e?e.right+e.left:0;this.fontOptions.constrainWidth&&(this.fontOptions.maxWdt-=t,this.fontOptions.minWdt-=t);let n=e?e.top+e.bottom:0;this.fontOptions.constrainHeight&&(this.fontOptions.minHgt-=n)}addFontOptionsToPile(e,t){for(let n=0;n<t.length;++n)this.addFontToPile(e,t[n])}addFontToPile(e,t){if(t===void 0||t.font===void 0||t.font===null)return;let n=t.font;e.push(n)}getBasicOptions(t){let n={};for(let r=0;r<t.length;++r){let i=t[r],a={};e.parseFontString(a,i)&&(i=a),ix(i,(e,t)=>{e!==void 0&&(Object.prototype.hasOwnProperty.call(n,t)||(Pg(zM).call(zM,t)===-1?n[t]=e:n[t]={}))})}return n}getFontOption(t,n,r){let i;for(let a=0;a<t.length;++a){let o=t[a];if(Object.prototype.hasOwnProperty.call(o,n)){if(i=o[n],i==null)continue;let t={};if(e.parseFontString(t,i)&&(i=t),Object.prototype.hasOwnProperty.call(i,r))return i[r]}}if(Object.prototype.hasOwnProperty.call(this.fontOptions,r))return this.fontOptions[r];throw Error(`Did not find value for multi-font for property: '`+r+`'`)}getFontOptions(e,t){let n={},r=[`color`,`size`,`face`,`mod`,`vadjust`];for(let i=0;i<r.length;++i){let a=r[i];n[a]=this.getFontOption(e,t,a)}return n}propagateFonts(e){let t=[];this.addFontOptionsToPile(t,e),this.fontOptions=this.getBasicOptions(t);for(let e=0;e<zM.length;++e){let n=zM[e],r=this.fontOptions[n];ix(this.getFontOptions(t,n),(e,t)=>{r[t]=e}),r.size=Number(r.size),r.vadjust=Number(r.vadjust)}}draw(e,t,n,r,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:`middle`;if(this.elementOptions.label===void 0)return;let o=this.fontOptions.size*this.body.view.scale;this.elementOptions.label&&o<this.elementOptions.scaling.label.drawThreshold-1||(o>=this.elementOptions.scaling.label.maxVisible&&(o=Number(this.elementOptions.scaling.label.maxVisible)/this.body.view.scale),this.calculateLabelSize(e,r,i,t,n,a),this._drawBackground(e),this._drawText(e,t,this.size.yLine,a,o))}_drawBackground(e){if(this.fontOptions.background!==void 0&&this.fontOptions.background!==`none`){e.fillStyle=this.fontOptions.background;let t=this.getSize();e.fillRect(t.left,t.top,t.width,t.height)}}_drawText(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`middle`,i=arguments.length>4?arguments[4]:void 0;[t,n]=this._setAlignment(e,t,n,r),e.textAlign=`left`,t-=this.size.width/2,this.fontOptions.valign&&this.size.height>this.size.labelHeight&&(this.fontOptions.valign===`top`&&(n-=(this.size.height-this.size.labelHeight)/2),this.fontOptions.valign===`bottom`&&(n+=(this.size.height-this.size.labelHeight)/2));for(let r=0;r<this.lineCount;r++){let a=this.lines[r];if(a&&a.blocks){let r=0;this.isEdgeLabel||this.fontOptions.align===`center`?r+=(this.size.width-a.width)/2:this.fontOptions.align===`right`&&(r+=this.size.width-a.width);for(let o=0;o<a.blocks.length;o++){let s=a.blocks[o];e.font=s.font;let[c,l]=this._getColor(s.color,i,s.strokeColor);s.strokeWidth>0&&(e.lineWidth=s.strokeWidth,e.strokeStyle=l,e.lineJoin=`round`),e.fillStyle=c,s.strokeWidth>0&&e.strokeText(s.text,t+r,n+s.vadjust),e.fillText(s.text,t+r,n+s.vadjust),r+=s.width}n+=a.height}}}_setAlignment(e,t,n,r){return this.isEdgeLabel&&this.fontOptions.align!==`horizontal`&&this.pointToSelf===!1?(t=0,n=0,this.fontOptions.align===`top`?(e.textBaseline=`alphabetic`,n-=4):this.fontOptions.align===`bottom`?(e.textBaseline=`hanging`,n+=4):e.textBaseline=`middle`):e.textBaseline=r,[t,n]}_getColor(e,t,n){let r=e||`#000000`,i=n||`#ffffff`;if(t<=this.elementOptions.scaling.label.drawThreshold){let e=Math.max(0,Math.min(1,1-(this.elementOptions.scaling.label.drawThreshold-t)));r=ox(r,e),i=ox(i,e)}return[r,i]}getTextSize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this._processLabel(e,t,n),{width:this.size.width,height:this.size.height,lineCount:this.lineCount}}getSize(){let e=this.size.left,t=this.size.top-.5*2;if(this.isEdgeLabel){let n=-this.size.width*.5;switch(this.fontOptions.align){case`middle`:e=n,t=-this.size.height*.5;break;case`top`:e=n,t=-(this.size.height+2);break;case`bottom`:e=n,t=2;break}}return{left:e,top:t,width:this.size.width,height:this.size.height}}calculateLabelSize(e,t,n){let 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]:`middle`;this._processLabel(e,t,n),this.size.left=r-this.size.width*.5,this.size.top=i-this.size.height*.5,this.size.yLine=i+(1-this.lineCount)*.5*this.fontOptions.size,a===`hanging`&&(this.size.top+=.5*this.fontOptions.size,this.size.top+=4,this.size.yLine+=4)}getFormattingValues(e,t,n,r){let i=function(e,t,n){return t===`normal`?n===`mod`?``:e[n]:e[t][n]===void 0?e[n]:e[t][n]},a={color:i(this.fontOptions,r,`color`),size:i(this.fontOptions,r,`size`),face:i(this.fontOptions,r,`face`),mod:i(this.fontOptions,r,`mod`),vadjust:i(this.fontOptions,r,`vadjust`),strokeWidth:this.fontOptions.strokeWidth,strokeColor:this.fontOptions.strokeColor};(t||n)&&(r===`normal`&&this.fontOptions.chooser===!0&&this.elementOptions.labelHighlightBold?a.mod=`bold`:typeof this.fontOptions.chooser==`function`&&this.fontOptions.chooser(a,this.elementOptions.id,t,n));let o=``;return a.mod!==void 0&&a.mod!==``&&(o+=a.mod+` `),o+=a.size+`px `+a.face,e.font=o.replace(/"/g,``),a.font=e.font,a.height=a.size,a}differentState(e,t){return e!==this.selectedState||t!==this.hoverState}_processLabelText(e,t,n,r){return new RM(e,this,t,n).process(r)}_processLabel(e,t,n){if(this.labelDirty===!1&&!this.differentState(t,n))return;let r=this._processLabelText(e,t,n,this.elementOptions.label);this.fontOptions.minWdt>0&&r.width<this.fontOptions.minWdt&&(r.width=this.fontOptions.minWdt),this.size.labelHeight=r.height,this.fontOptions.minHgt>0&&r.height<this.fontOptions.minHgt&&(r.height=this.fontOptions.minHgt),this.lines=r.lines,this.lineCount=r.lines.length,this.size.width=r.width,this.size.height=r.height,this.selectedState=t,this.hoverState=n,this.labelDirty=!1}visible(){return!(this.size.width===0||this.size.height===0||this.elementOptions.label===void 0||this.fontOptions.size*this.body.view.scale<this.elementOptions.scaling.label.drawThreshold-1)}},VM=class{constructor(e,t,n){this.body=t,this.labelModule=n,this.setOptions(e),this.top=void 0,this.left=void 0,this.height=void 0,this.width=void 0,this.radius=void 0,this.margin=void 0,this.refreshNeeded=!0,this.boundingBox={top:0,left:0,right:0,bottom:0}}setOptions(e){this.options=e}_setMargins(e){this.margin={},this.options.margin&&(typeof this.options.margin==`object`?(this.margin.top=this.options.margin.top,this.margin.right=this.options.margin.right,this.margin.bottom=this.options.margin.bottom,this.margin.left=this.options.margin.left):(this.margin.top=this.options.margin,this.margin.right=this.options.margin,this.margin.bottom=this.options.margin,this.margin.left=this.options.margin)),e.adjustSizes(this.margin)}_distanceToBorder(e,t){let n=this.options.borderWidth;return e&&this.resize(e),Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+n}enableShadow(e,t){t.shadow&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}disableShadow(e,t){t.shadow&&(e.shadowColor=`rgba(0,0,0,0)`,e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}enableBorderDashes(e,t){if(t.borderDashes!==!1)if(e.setLineDash!==void 0){let n=t.borderDashes;n===!0&&(n=[5,15]),e.setLineDash(n)}else console.warn(`setLineDash is not supported in this browser. The dashed borders cannot be used.`),this.options.shapeProperties.borderDashes=!1,t.borderDashes=!1}disableBorderDashes(e,t){t.borderDashes!==!1&&(e.setLineDash===void 0?(console.warn(`setLineDash is not supported in this browser. The dashed borders cannot be used.`),this.options.shapeProperties.borderDashes=!1,t.borderDashes=!1):e.setLineDash([0]))}needsRefresh(e,t){return this.refreshNeeded===!0?(this.refreshNeeded=!1,!0):this.width===void 0||this.labelModule.differentState(e,t)}initContextForDraw(e,t){let n=t.borderWidth/this.body.view.scale;e.lineWidth=Math.min(this.width,n),e.strokeStyle=t.borderColor,e.fillStyle=t.color}performStroke(e,t){let n=t.borderWidth/this.body.view.scale;e.save(),n>0&&(this.enableBorderDashes(e,t),e.stroke(),this.disableBorderDashes(e,t)),e.restore()}performFill(e,t){e.save(),e.fillStyle=t.color,this.enableShadow(e,t),av(e).call(e),this.disableShadow(e,t),e.restore(),this.performStroke(e,t)}_addBoundingBoxMargin(e){this.boundingBox.left-=e,this.boundingBox.top-=e,this.boundingBox.bottom+=e,this.boundingBox.right+=e}_updateBoundingBox(e,t,n,r,i){n!==void 0&&this.resize(n,r,i),this.left=e-this.width/2,this.top=t-this.height/2,this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width}updateBoundingBox(e,t,n,r,i){this._updateBoundingBox(e,t,n,r,i)}getDimensionsFromLabel(e,t,n){this.textSize=this.labelModule.getTextSize(e,t,n);let r=this.textSize.width,i=this.textSize.height;return r===0&&(r=14,i=14),{width:r,height:i}}},HM=class extends VM{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,n)){let r=this.getDimensionsFromLabel(e,t,n);this.width=r.width+this.margin.right+this.margin.left,this.height=r.height+this.margin.top+this.margin.bottom,this.radius=this.width/2}}draw(e,t,n,r,i,a){this.resize(e,r,i),this.left=t-this.width/2,this.top=n-this.height/2,this.initContextForDraw(e,a),Ts(e,this.left,this.top,this.width,this.height,a.borderRadius),this.performFill(e,a),this.updateBoundingBox(t,n,e,r,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,r,i)}updateBoundingBox(e,t,n,r,i){this._updateBoundingBox(e,t,n,r,i);let a=this.options.shapeProperties.borderRadius;this._addBoundingBoxMargin(a)}distanceToBorder(e,t){e&&this.resize(e);let n=this.options.borderWidth;return Math.min(Math.abs(this.width/2/Math.cos(t)),Math.abs(this.height/2/Math.sin(t)))+n}},UM=class extends VM{constructor(e,t,n){super(e,t,n),this.labelOffset=0,this.selected=!1}setOptions(e,t,n){this.options=e,t===void 0&&n===void 0||this.setImages(t,n)}setImages(e,t){t&&this.selected?(this.imageObj=t,this.imageObjAlt=e):(this.imageObj=e,this.imageObjAlt=t)}switchImages(e){let t=e&&!this.selected||!e&&this.selected;if(this.selected=e,this.imageObjAlt!==void 0&&t){let e=this.imageObj;this.imageObj=this.imageObjAlt,this.imageObjAlt=e}}_getImagePadding(){let e={top:0,right:0,bottom:0,left:0};if(this.options.imagePadding){let t=this.options.imagePadding;typeof t==`object`?(e.top=t.top,e.right=t.right,e.bottom=t.bottom,e.left=t.left):(e.top=t,e.right=t,e.bottom=t,e.left=t)}return e}_resizeImage(){let e,t;if(this.options.shapeProperties.useImageSize===!1){let n=1,r=1;this.imageObj.width&&this.imageObj.height&&(this.imageObj.width>this.imageObj.height?n=this.imageObj.width/this.imageObj.height:r=this.imageObj.height/this.imageObj.width),e=this.options.size*2*n,t=this.options.size*2*r}else{let n=this._getImagePadding();e=this.imageObj.width+n.left+n.right,t=this.imageObj.height+n.top+n.bottom}this.width=e,this.height=t,this.radius=.5*this.width}_drawRawCircle(e,t,n,r){this.initContextForDraw(e,r),ys(e,t,n,r.size),this.performFill(e,r)}_drawImageAtPosition(e,t){if(this.imageObj.width!=0){e.globalAlpha=t.opacity===void 0?1:t.opacity,this.enableShadow(e,t);let n=1;this.options.shapeProperties.interpolation===!0&&(n=this.imageObj.width/this.width/this.body.view.scale);let r=this._getImagePadding(),i=this.left+r.left,a=this.top+r.top,o=this.width-r.left-r.right,s=this.height-r.top-r.bottom;this.imageObj.drawImageAtPosition(e,n,i,a,o,s),this.disableShadow(e,t)}}_drawImageLabel(e,t,n,r,i){let a=0;if(this.height!==void 0){a=this.height*.5;let t=this.labelModule.getTextSize(e,r,i);t.lineCount>=1&&(a+=t.height/2)}let o=n+a;this.options.label&&(this.labelOffset=a),this.labelModule.draw(e,t,o,r,i,`hanging`)}},WM=class extends UM{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,n)){let r=this.getDimensionsFromLabel(e,t,n),i=Math.max(r.width+this.margin.right+this.margin.left,r.height+this.margin.top+this.margin.bottom);this.options.size=i/2,this.width=i,this.height=i,this.radius=this.width/2}}draw(e,t,n,r,i,a){this.resize(e,r,i),this.left=t-this.width/2,this.top=n-this.height/2,this._drawRawCircle(e,t,n,a),this.updateBoundingBox(t,n),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,n,r,i)}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size}distanceToBorder(e){return e&&this.resize(e),this.width*.5}},GM=class extends UM{constructor(e,t,n,r,i){super(e,t,n),this.setImages(r,i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){let e=this.options.size*2;this.width=e,this.height=e,this.radius=.5*this.width;return}this.needsRefresh(t,n)&&this._resizeImage()}draw(e,t,n,r,i,a){this.switchImages(r),this.resize();let o=t,s=n;this.options.shapeProperties.coordinateOrigin===`top-left`?(this.left=t,this.top=n,o+=this.width/2,s+=this.height/2):(this.left=t-this.width/2,this.top=n-this.height/2),this._drawRawCircle(e,o,s,a),e.save(),e.clip(),this._drawImageAtPosition(e,a),e.restore(),this._drawImageLabel(e,o,s,r,i),this.updateBoundingBox(t,n)}updateBoundingBox(e,t){this.options.shapeProperties.coordinateOrigin===`top-left`?(this.boundingBox.top=t,this.boundingBox.left=e,this.boundingBox.right=e+this.options.size*2,this.boundingBox.bottom=t+this.options.size*2):(this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size),this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset)}distanceToBorder(e){return e&&this.resize(e),this.width*.5}},KM=class extends VM{constructor(e,t,n){super(e,t,n)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{size:this.options.size};if(this.needsRefresh(t,n)){this.labelModule.getTextSize(e,t,n);let i=2*r.size;this.width=this.customSizeWidth??i,this.height=this.customSizeHeight??i,this.radius=.5*this.width}}_drawShape(e,t,n,r,i,a,o,s){return this.resize(e,a,o,s),this.left=r-this.width/2,this.top=i-this.height/2,this.initContextForDraw(e,s),js(t)(e,r,i,s.size),this.performFill(e,s),this.options.icon!==void 0&&this.options.icon.code!==void 0&&(e.font=(a?`bold `:``)+this.height/2+`px `+(this.options.icon.face||`FontAwesome`),e.fillStyle=this.options.icon.color||`black`,e.textAlign=`center`,e.textBaseline=`middle`,e.fillText(this.options.icon.code,r,i)),{drawExternalLabel:()=>{if(this.options.label!==void 0){this.labelModule.calculateLabelSize(e,a,o,r,i,`hanging`);let t=i+.5*this.height+.5*this.labelModule.size.height;this.labelModule.draw(e,r,t,a,o,`hanging`)}this.updateBoundingBox(r,i)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.size,this.boundingBox.left=e-this.options.size,this.boundingBox.right=e+this.options.size,this.boundingBox.bottom=t+this.options.size,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height))}};function qM(e,t){var n=Xf(e);if(Rw){var r=Rw(e);t&&(r=Ph(r).call(r,function(t){return Zw(e,t).enumerable})),n.push.apply(n,r)}return n}function JM(e){for(var t=1;t<arguments.length;t++){var n,r,i=arguments[t]==null?{}:arguments[t];t%2?jp(n=qM(Object(i),!0)).call(n,function(t){OD(e,t,i[t])}):uT?CT(e,uT(i)):jp(r=qM(Object(i))).call(r,function(t){Lj(e,t,Zw(i,t))})}return e}var YM=class extends KM{constructor(e,t,n,r){super(e,t,n,r),this.ctxRenderer=r}draw(e,t,n,r,i,a){this.resize(e,r,i,a),this.left=t-this.width/2,this.top=n-this.height/2,e.save();let o=this.ctxRenderer({ctx:e,id:this.options.id,x:t,y:n,state:{selected:r,hover:i},style:JM({},a),label:this.options.label});if(o.drawNode!=null&&o.drawNode(),e.restore(),o.drawExternalLabel){let t=o.drawExternalLabel;o.drawExternalLabel=()=>{e.save(),t(),e.restore()}}return o.nodeDimensions&&(this.customSizeWidth=o.nodeDimensions.width,this.customSizeHeight=o.nodeDimensions.height),o}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},XM=class extends VM{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e,t,n){if(this.needsRefresh(t,n)){let r=this.getDimensionsFromLabel(e,t,n).width+this.margin.right+this.margin.left;this.width=r,this.height=r,this.radius=this.width/2}}draw(e,t,n,r,i,a){this.resize(e,r,i),this.left=t-this.width/2,this.top=n-this.height/2,this.initContextForDraw(e,a),Ds(e,t-this.width/2,n-this.height/2,this.width,this.height),this.performFill(e,a),this.updateBoundingBox(t,n,e,r,i),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,r,i)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},ZM=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`diamond`,4,t,n,r,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},QM=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`circle`,2,t,n,r,i,a)}distanceToBorder(e){return e&&this.resize(e),this.options.size}},$M=class extends VM{constructor(e,t,n){super(e,t,n)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.needsRefresh(t,n)){let r=this.getDimensionsFromLabel(e,t,n);this.height=r.height*2,this.width=r.width+r.height,this.radius=.5*this.width}}draw(e,t,n,r,i,a){this.resize(e,r,i),this.left=t-this.width*.5,this.top=n-this.height*.5,this.initContextForDraw(e,a),Es(e,this.left,this.top,this.width,this.height),this.performFill(e,a),this.updateBoundingBox(t,n,e,r,i),this.labelModule.draw(e,t,n,r,i)}distanceToBorder(e,t){e&&this.resize(e);let n=this.width*.5,r=this.height*.5,i=Math.sin(t)*n,a=Math.cos(t)*r;return n*r/Math.sqrt(i*i+a*a)}},eN=class extends VM{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e,t,n){this.needsRefresh(t,n)&&(this.iconSize={width:Number(this.options.icon.size),height:Number(this.options.icon.size)},this.width=this.iconSize.width+this.margin.right+this.margin.left,this.height=this.iconSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,n,r,i,a){return this.resize(e,r,i),this.options.icon.size=this.options.icon.size||50,this.left=t-this.width/2,this.top=n-this.height/2,this._icon(e,t,n,r,i,a),{drawExternalLabel:()=>{this.options.label!==void 0&&this.labelModule.draw(e,this.left+this.iconSize.width/2+this.margin.left,n+this.height/2+5,r),this.updateBoundingBox(t,n)}}}updateBoundingBox(e,t){this.boundingBox.top=t-this.options.icon.size*.5,this.boundingBox.left=e-this.options.icon.size*.5,this.boundingBox.right=e+this.options.icon.size*.5,this.boundingBox.bottom=t+this.options.icon.size*.5,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelModule.size.height+5))}_icon(e,t,n,r,i,a){let o=Number(this.options.icon.size);this.options.icon.code===void 0?console.error(`When using the icon shape, you need to define the code in the icon options object. This can be done per node or globally.`):(e.font=[this.options.icon.weight==null?r?`bold`:``:this.options.icon.weight,(this.options.icon.weight!=null&&r?5:0)+o+`px`,this.options.icon.face].join(` `),e.fillStyle=this.options.icon.color||`black`,e.textAlign=`center`,e.textBaseline=`middle`,this.enableShadow(e,a),e.fillText(this.options.icon.code,t,n),this.disableShadow(e,a))}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},tN=class extends UM{constructor(e,t,n,r,i){super(e,t,n),this.setImages(r,i)}resize(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.selected,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.hover;if(this.imageObj.src===void 0||this.imageObj.width===void 0||this.imageObj.height===void 0){let e=this.options.size*2;this.width=e,this.height=e;return}this.needsRefresh(t,n)&&this._resizeImage()}draw(e,t,n,r,i,a){e.save(),this.switchImages(r),this.resize();let o=t,s=n;if(this.options.shapeProperties.coordinateOrigin===`top-left`?(this.left=t,this.top=n,o+=this.width/2,s+=this.height/2):(this.left=t-this.width/2,this.top=n-this.height/2),this.options.shapeProperties.useBorderWithImage===!0){let t=this.options.borderWidth,n=this.options.borderWidthSelected||2*this.options.borderWidth,o=(r?n:t)/this.body.view.scale;e.lineWidth=Math.min(this.width,o),e.beginPath();let s=r?this.options.color.highlight.border:i?this.options.color.hover.border:this.options.color.border,c=r?this.options.color.highlight.background:i?this.options.color.hover.background:this.options.color.background;a.opacity!==void 0&&(s=ox(s,a.opacity),c=ox(c,a.opacity)),e.strokeStyle=s,e.fillStyle=c,e.rect(this.left-.5*e.lineWidth,this.top-.5*e.lineWidth,this.width+e.lineWidth,this.height+e.lineWidth),av(e).call(e),this.performStroke(e,a),e.closePath()}this._drawImageAtPosition(e,a),this._drawImageLabel(e,o,s,r,i),this.updateBoundingBox(t,n),e.restore()}updateBoundingBox(e,t){this.resize(),this.options.shapeProperties.coordinateOrigin===`top-left`?(this.left=e,this.top=t):(this.left=e-this.width/2,this.top=t-this.height/2),this.boundingBox.left=this.left,this.boundingBox.top=this.top,this.boundingBox.bottom=this.top+this.height,this.boundingBox.right=this.left+this.width,this.options.label!==void 0&&this.labelModule.size.width>0&&(this.boundingBox.left=Math.min(this.boundingBox.left,this.labelModule.size.left),this.boundingBox.right=Math.max(this.boundingBox.right,this.labelModule.size.left+this.labelModule.size.width),this.boundingBox.bottom=Math.max(this.boundingBox.bottom,this.boundingBox.bottom+this.labelOffset))}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},nN=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`square`,2,t,n,r,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},rN=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`hexagon`,4,t,n,r,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},iN=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`star`,4,t,n,r,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},aN=class extends VM{constructor(e,t,n){super(e,t,n),this._setMargins(n)}resize(e,t,n){this.needsRefresh(t,n)&&(this.textSize=this.labelModule.getTextSize(e,t,n),this.width=this.textSize.width+this.margin.right+this.margin.left,this.height=this.textSize.height+this.margin.top+this.margin.bottom,this.radius=.5*this.width)}draw(e,t,n,r,i,a){this.resize(e,r,i),this.left=t-this.width/2,this.top=n-this.height/2,this.enableShadow(e,a),this.labelModule.draw(e,this.left+this.textSize.width/2+this.margin.left,this.top+this.textSize.height/2+this.margin.top,r,i),this.disableShadow(e,a),this.updateBoundingBox(t,n,e,r,i)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},oN=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`triangle`,3,t,n,r,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}},sN=class extends KM{constructor(e,t,n){super(e,t,n)}draw(e,t,n,r,i,a){return this._drawShape(e,`triangleDown`,3,t,n,r,i,a)}distanceToBorder(e,t){return this._distanceToBorder(e,t)}};function cN(e,t){var n=Xf(e);if(Rw){var r=Rw(e);t&&(r=Ph(r).call(r,function(t){return Zw(e,t).enumerable})),n.push.apply(n,r)}return n}function lN(e){for(var t=1;t<arguments.length;t++){var n,r,i=arguments[t]==null?{}:arguments[t];t%2?jp(n=cN(Object(i),!0)).call(n,function(t){OD(e,t,i[t])}):uT?CT(e,uT(i)):jp(r=cN(Object(i))).call(r,function(t){Lj(e,t,Zw(i,t))})}return e}var uN=class e{constructor(e,t,n,r,i,a){this.options=gx(i),this.globalOptions=i,this.defaultOptions=a,this.body=t,this.edges=[],this.id=void 0,this.imagelist=n,this.grouplist=r,this.x=void 0,this.y=void 0,this.baseSize=this.options.size,this.baseFontSize=this.options.font.size,this.predefinedPosition=!1,this.selected=!1,this.hover=!1,this.labelModule=new BM(this.body,this.options,!1),this.setOptions(e)}attachEdge(e){var t;Pg(t=this.edges).call(t,e)===-1&&this.edges.push(e)}detachEdge(e){var t;let n=Pg(t=this.edges).call(t,e);if(n!=-1){var r;hm(r=this.edges).call(r,n,1)}}setOptions(t){let n=this.options.shape;if(!t)return;if(t.color!==void 0&&(this._localColor=t.color),t.id!==void 0&&(this.id=t.id),this.id===void 0)throw Error(`Node must have an id`);e.checkMass(t,this.id),t.x!==void 0&&(t.x===null?(this.x=void 0,this.predefinedPosition=!1):(this.x=vg(t.x),this.predefinedPosition=!0)),t.y!==void 0&&(t.y===null?(this.y=void 0,this.predefinedPosition=!1):(this.y=vg(t.y),this.predefinedPosition=!0)),t.size!==void 0&&(this.baseSize=t.size),t.value!==void 0&&(t.value=_M(t.value)),e.parseOptions(this.options,t,!0,this.globalOptions,this.grouplist);let r=[t,this.options,this.defaultOptions];return this.chooser=jM(`node`,r),this._load_images(),this.updateLabelModule(t),t.opacity!==void 0&&e.checkOpacity(t.opacity)&&(this.options.opacity=t.opacity),this.updateShape(n),t.hidden!==void 0||t.physics!==void 0}_load_images(){if((this.options.shape===`circularImage`||this.options.shape===`image`)&&this.options.image===void 0)throw Error(`Option image must be defined for node type '`+this.options.shape+`'`);if(this.options.image!==void 0){if(this.imagelist===void 0)throw Error(`Internal Error: No images provided`);if(typeof this.options.image==`string`)this.imageObj=this.imagelist.load(this.options.image,this.options.brokenImage,this.id);else{if(this.options.image.unselected===void 0)throw Error(`No unselected image provided`);this.imageObj=this.imagelist.load(this.options.image.unselected,this.options.brokenImage,this.id),this.options.image.selected===void 0?this.imageObjAlt=void 0:this.imageObjAlt=this.imagelist.load(this.options.image.selected,this.options.brokenImage,this.id)}}}static checkOpacity(e){return 0<=e&&e<=1}static checkCoordinateOrigin(e){return e===void 0||e===`center`||e===`top-left`}static updateGroupOptions(t,n,r){var i;if(r===void 0)return;let a=t.group;if(n!==void 0&&n.group!==void 0&&a!==n.group)throw Error(`updateGroupOptions: group values in options don't match.`);if(!(typeof a==`number`||typeof a==`string`&&a!=``))return;let o=r.get(a);o.opacity!==void 0&&n.opacity===void 0&&(e.checkOpacity(o.opacity)||(console.error(`Invalid option for node opacity. Value must be between 0 and 1, found: `+o.opacity),o.opacity=void 0));let s=Ph(i=AM(n)).call(i,e=>n[e]!=null);s.push(`font`),Qb(s,t,o),t.color=cx(t.color)}static parseOptions(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=arguments.length>4?arguments[4]:void 0;if(Qb([`color`,`fixed`,`shadow`],t,n,r),e.checkMass(n),t.opacity!==void 0&&(e.checkOpacity(t.opacity)||(console.error(`Invalid option for node opacity. Value must be between 0 and 1, found: `+t.opacity),t.opacity=void 0)),n.opacity!==void 0&&(e.checkOpacity(n.opacity)||(console.error(`Invalid option for node opacity. Value must be between 0 and 1, found: `+n.opacity),n.opacity=void 0)),n.shapeProperties&&!e.checkCoordinateOrigin(n.shapeProperties.coordinateOrigin)&&console.error(`Invalid option for node coordinateOrigin, found: `+n.shapeProperties.coordinateOrigin),_x(t,n,`shadow`,i),n.color!==void 0&&n.color!==null){let e=cx(n.color);Xb(t.color,e)}else r===!0&&n.color===null&&(t.color=gx(i.color));n.fixed!==void 0&&n.fixed!==null&&(typeof n.fixed==`boolean`?(t.fixed.x=n.fixed,t.fixed.y=n.fixed):(n.fixed.x!==void 0&&typeof n.fixed.x==`boolean`&&(t.fixed.x=n.fixed.x),n.fixed.y!==void 0&&typeof n.fixed.y==`boolean`&&(t.fixed.y=n.fixed.y))),r===!0&&n.font===null&&(t.font=gx(i.font)),e.updateGroupOptions(t,n,a),n.scaling!==void 0&&_x(t.scaling,n.scaling,`label`,i.scaling)}getFormattingValues(){let e={color:this.options.color.background,opacity:this.options.opacity,borderWidth:this.options.borderWidth,borderColor:this.options.color.border,size:this.options.size,borderDashes:this.options.shapeProperties.borderDashes,borderRadius:this.options.shapeProperties.borderRadius,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y};if(this.selected||this.hover?this.chooser===!0?this.selected?(this.options.borderWidthSelected==null?e.borderWidth*=2:e.borderWidth=this.options.borderWidthSelected,e.color=this.options.color.highlight.background,e.borderColor=this.options.color.highlight.border,e.shadow=this.options.shadow.enabled):this.hover&&(e.color=this.options.color.hover.background,e.borderColor=this.options.color.hover.border,e.shadow=this.options.shadow.enabled):typeof this.chooser==`function`&&(this.chooser(e,this.options.id,this.selected,this.hover),e.shadow===!1&&(e.shadowColor!==this.options.shadow.color||e.shadowSize!==this.options.shadow.size||e.shadowX!==this.options.shadow.x||e.shadowY!==this.options.shadow.y)&&(e.shadow=!0)):e.shadow=this.options.shadow.enabled,this.options.opacity!==void 0){let t=this.options.opacity;e.borderColor=ox(e.borderColor,t),e.color=ox(e.color,t),e.shadowColor=ox(e.shadowColor,t)}return e}updateLabelModule(t){(this.options.label===void 0||this.options.label===null)&&(this.options.label=``),e.updateGroupOptions(this.options,lN(lN({},t),{},{color:t&&t.color||this._localColor||void 0}),this.grouplist);let n=this.grouplist.get(this.options.group,!1),r=[t,this.options,n,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,r),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateShape(e){if(e===this.options.shape&&this.shape)this.shape.setOptions(this.options,this.imageObj,this.imageObjAlt);else switch(this.options.shape){case`box`:this.shape=new HM(this.options,this.body,this.labelModule);break;case`circle`:this.shape=new WM(this.options,this.body,this.labelModule);break;case`circularImage`:this.shape=new GM(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case`custom`:this.shape=new YM(this.options,this.body,this.labelModule,this.options.ctxRenderer);break;case`database`:this.shape=new XM(this.options,this.body,this.labelModule);break;case`diamond`:this.shape=new ZM(this.options,this.body,this.labelModule);break;case`dot`:this.shape=new QM(this.options,this.body,this.labelModule);break;case`ellipse`:this.shape=new $M(this.options,this.body,this.labelModule);break;case`icon`:this.shape=new eN(this.options,this.body,this.labelModule);break;case`image`:this.shape=new tN(this.options,this.body,this.labelModule,this.imageObj,this.imageObjAlt);break;case`square`:this.shape=new nN(this.options,this.body,this.labelModule);break;case`hexagon`:this.shape=new rN(this.options,this.body,this.labelModule);break;case`star`:this.shape=new iN(this.options,this.body,this.labelModule);break;case`text`:this.shape=new aN(this.options,this.body,this.labelModule);break;case`triangle`:this.shape=new oN(this.options,this.body,this.labelModule);break;case`triangleDown`:this.shape=new sN(this.options,this.body,this.labelModule);break;default:this.shape=new $M(this.options,this.body,this.labelModule);break}this.needsRefresh()}select(){this.selected=!0,this.needsRefresh()}unselect(){this.selected=!1,this.needsRefresh()}needsRefresh(){this.shape.refreshNeeded=!0}getTitle(){return this.options.title}distanceToBorder(e,t){return this.shape.distanceToBorder(e,t)}isFixed(){return this.options.fixed.x&&this.options.fixed.y}isSelected(){return this.selected}getValue(){return this.options.value}getLabelSize(){return this.labelModule.size()}setValueRange(e,t,n){if(this.options.value!==void 0){let r=this.options.scaling.customScalingFunction(e,t,n,this.options.value),i=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){let e=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+r*e}this.options.size=this.options.scaling.min+r*i}else this.options.size=this.baseSize,this.options.font.size=this.baseFontSize;this.updateLabelModule()}draw(e){let t=this.getFormattingValues();return this.shape.draw(e,this.x,this.y,this.selected,this.hover,t)||{}}updateBoundingBox(e){this.shape.updateBoundingBox(this.x,this.y,e)}resize(e){let t=this.getFormattingValues();this.shape.resize(e,this.selected,this.hover,t)}getItemsOnPoint(e){let t=[];return this.labelModule.visible()&&MM(this.labelModule.getSize(),e)&&t.push({nodeId:this.id,labelId:0}),MM(this.shape.boundingBox,e)&&t.push({nodeId:this.id}),t}isOverlappingWith(e){return this.shape.left<e.right&&this.shape.left+this.shape.width>e.left&&this.shape.top<e.bottom&&this.shape.top+this.shape.height>e.top}isBoundingBoxOverlappingWith(e){return this.shape.boundingBox.left<e.right&&this.shape.boundingBox.right>e.left&&this.shape.boundingBox.top<e.bottom&&this.shape.boundingBox.bottom>e.top}static checkMass(e,t){if(e.mass!==void 0&&e.mass<=0){let n=``;t!==void 0&&(n=` in node id: `+t),console.error(`%cNegative or zero mass disallowed`+n+`, setting mass to 1.`,Nx),e.mass=1}}},dN=class{constructor(e,t,n,r){var i;if(this.body=e,this.images=t,this.groups=n,this.layoutEngine=r,this.body.functions.createNode=B(i=this.create).call(i,this),this.nodesListeners={add:(e,t)=>{this.add(t.items)},update:(e,t)=>{this.update(t.items,t.data,t.oldData)},remove:(e,t)=>{this.remove(t.items)}},this.defaultOptions={borderWidth:1,borderWidthSelected:void 0,brokenImage:void 0,color:{border:`#2B7CE9`,background:`#97C2FC`,highlight:{border:`#2B7CE9`,background:`#D2E5FF`},hover:{border:`#2B7CE9`,background:`#D2E5FF`}},opacity:void 0,fixed:{x:!1,y:!1},font:{color:`#343434`,size:14,face:`arial`,background:`none`,strokeWidth:0,strokeColor:`#ffffff`,align:`center`,vadjust:0,multi:!1,bold:{mod:`bold`},boldital:{mod:`bold italic`},ital:{mod:`italic`},mono:{mod:``,size:15,face:`monospace`,vadjust:2}},group:void 0,hidden:!1,icon:{face:`FontAwesome`,code:void 0,size:50,color:`#2B7CE9`},image:void 0,imagePadding:{top:0,right:0,bottom:0,left:0},label:void 0,labelHighlightBold:!0,level:void 0,margin:{top:5,right:5,bottom:5,left:5},mass:1,physics:!0,scaling:{min:10,max:30,label:{enabled:!1,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(e,t,n,r){if(t===e)return .5;{let n=1/(t-e);return Math.max(0,(r-e)*n)}}},shadow:{enabled:!1,color:`rgba(0,0,0,0.5)`,size:10,x:5,y:5},shape:`ellipse`,shapeProperties:{borderDashes:!1,borderRadius:6,interpolation:!0,useImageSize:!1,useBorderWithImage:!1,coordinateOrigin:`center`},size:25,title:void 0,value:void 0,x:void 0,y:void 0},this.defaultOptions.mass<=0)throw`Internal error: mass in defaultOptions of NodesHandler may not be zero or negative`;this.options=gx(this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e,t;this.body.emitter.on(`refreshNodes`,B(e=this.refresh).call(e,this)),this.body.emitter.on(`refresh`,B(t=this.refresh).call(t,this)),this.body.emitter.on(`destroy`,()=>{ix(this.nodesListeners,(e,t)=>{this.body.data.nodes&&this.body.data.nodes.off(t,e)}),delete this.body.functions.createNode,delete this.nodesListeners.add,delete this.nodesListeners.update,delete this.nodesListeners.remove,delete this.nodesListeners})}setOptions(e){if(e!==void 0){if(uN.parseOptions(this.options,e),e.opacity!==void 0&&(XC(e.opacity)||!fw(e.opacity)||e.opacity<0||e.opacity>1?console.error(`Invalid option for node opacity. Value must be between 0 and 1, found: `+e.opacity):this.options.opacity=e.opacity),e.shape!==void 0)for(let e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this.body.nodes[e].updateShape();if(e.font!==void 0||e.widthConstraint!==void 0||e.heightConstraint!==void 0)for(let e of Xf(this.body.nodes))this.body.nodes[e].updateLabelModule(),this.body.nodes[e].needsRefresh();if(e.size!==void 0)for(let e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this.body.nodes[e].needsRefresh();(e.hidden!==void 0||e.physics!==void 0)&&this.body.emitter.emit(`_dataChanged`)}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.data.nodes;if(tM(`id`,e))this.body.data.nodes=e;else if(W(e))this.body.data.nodes=new $j,this.body.data.nodes.add(e);else if(!e)this.body.data.nodes=new $j;else throw TypeError(`Array or DataSet expected`);if(n&&ix(this.nodesListeners,function(e,t){n.off(t,e)}),this.body.nodes={},this.body.data.nodes){let e=this;ix(this.nodesListeners,function(t,n){e.body.data.nodes.on(n,t)});let t=this.body.data.nodes.getIds();this.add(t,!0)}t===!1&&this.body.emitter.emit(`_dataChanged`)}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n,r=[];for(let t=0;t<e.length;t++){n=e[t];let i=this.body.data.nodes.get(n),a=this.create(i);r.push(a),this.body.nodes[n]=a}this.layoutEngine.positionInitially(r),t===!1&&this.body.emitter.emit(`_dataChanged`)}update(e,t,n){let r=this.body.nodes,i=!1;for(let n=0;n<e.length;n++){let a=e[n],o=r[a],s=t[n];o===void 0?(i=!0,o=this.create(s),r[a]=o):o.setOptions(s)&&(i=!0)}!i&&n!==void 0&&(i=Ow(t).call(t,function(e,t){let r=n[t];return r&&r.level!==e.level})),i===!0?this.body.emitter.emit(`_dataChanged`):this.body.emitter.emit(`_dataUpdated`)}remove(e){let t=this.body.nodes;for(let n=0;n<e.length;n++){let r=e[n];delete t[r]}this.body.emitter.emit(`_dataChanged`)}create(e){return new(arguments.length>1&&arguments[1]!==void 0?arguments[1]:uN)(e,this.body,this.images,this.groups,this.options,this.defaultOptions)}refresh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;ix(this.body.nodes,(t,n)=>{let r=this.body.data.nodes.get(n);r!==void 0&&(e===!0&&t.setOptions({x:null,y:null}),t.setOptions({fixed:!1}),t.setOptions(r))})}getPositions(e){let t={};if(e!==void 0){if(W(e)===!0){for(let n=0;n<e.length;n++)if(this.body.nodes[e[n]]!==void 0){let r=this.body.nodes[e[n]];t[e[n]]={x:Math.round(r.x),y:Math.round(r.y)}}}else if(this.body.nodes[e]!==void 0){let n=this.body.nodes[e];t[e]={x:Math.round(n.x),y:Math.round(n.y)}}}else for(let e=0;e<this.body.nodeIndices.length;e++){let n=this.body.nodes[this.body.nodeIndices[e]];t[this.body.nodeIndices[e]]={x:Math.round(n.x),y:Math.round(n.y)}}return t}getPosition(e){if(e==null)throw TypeError(`No id was specified for getPosition method.`);if(this.body.nodes[e]==null)throw ReferenceError(`NodeId provided for getPosition does not exist. Provided: ${e}`);return{x:Math.round(this.body.nodes[e].x),y:Math.round(this.body.nodes[e].y)}}storePositions(){let e=[],t=this.body.data.nodes.getDataSet();for(let n of t.get()){let t=n.id,r=this.body.nodes[t],i=Math.round(r.x),a=Math.round(r.y);(n.x!==i||n.y!==a)&&e.push({id:t,x:i,y:a})}t.update(e)}getBoundingBox(e){if(this.body.nodes[e]!==void 0)return this.body.nodes[e].shape.boundingBox}getConnectedNodes(e,t){let n=[];if(this.body.nodes[e]!==void 0){let r=this.body.nodes[e],i={};for(let e=0;e<r.edges.length;e++){let a=r.edges[e];t!==`to`&&a.toId==r.id?i[a.fromId]===void 0&&(n.push(a.fromId),i[a.fromId]=!0):t!==`from`&&a.fromId==r.id&&i[a.toId]===void 0&&(n.push(a.toId),i[a.toId]=!0)}}return n}getConnectedEdges(e){let t=[];if(this.body.nodes[e]!==void 0){let n=this.body.nodes[e];for(let e=0;e<n.edges.length;e++)t.push(n.edges[e].id)}else console.error(`NodeId provided for getConnectedEdges does not exist. Provided: `,e);return t}moveNode(e,t,n){this.body.nodes[e]===void 0?console.error(`Node id supplied to moveNode does not exist. Provided: `,e):(this.body.nodes[e].x=Number(t),this.body.nodes[e].y=Number(n),B_(()=>{this.body.emitter.emit(`startSimulation`)},0))}},fN={},pN;function mN(){if(pN)return fN;pN=1;var e=R(),t=Math.hypot,n=Math.abs,r=Math.sqrt;return e({target:`Math`,stat:!0,arity:2,forced:!!t&&t(1/0,NaN)!==1/0},{hypot:function(e,t){for(var i=0,a=0,o=arguments.length,s=0,c,l;a<o;)c=n(arguments[a++]),s<c?(l=s/c,i=i*l*l+1,s=c):c>0?(l=c/s,i+=l*l):i+=c;return s===1/0?1/0:s*r(i)}}),fN}var hN,gN;function _N(){return gN?hN:(gN=1,mN(),hN=L().Math.hypot,hN)}var vN,yN;function bN(){return yN?vN:(yN=1,vN=_N(),vN)}var xN,SN;function CN(){return SN?xN:(SN=1,xN=bN(),xN)}var wN=P(CN()),TN=class{static transform(e,t){W(e)||(e=[e]);let n=t.point.x,r=t.point.y,i=t.angle,a=t.length;for(let t=0;t<e.length;++t){let o=e[t],s=o.x*Math.cos(i)-o.y*Math.sin(i),c=o.x*Math.sin(i)+o.y*Math.cos(i);o.x=n+a*s,o.y=r+a*c}}static drawPath(e,t){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;++n)e.lineTo(t[n].x,t[n].y);e.closePath()}},EN=class extends TN{static draw(e,t){if(t.image){e.save(),e.translate(t.point.x,t.point.y),e.rotate(Math.PI/2+t.angle);let n=t.imageWidth==null?t.image.width:t.imageWidth,r=t.imageHeight==null?t.image.height:t.imageHeight;t.image.drawImageAtPosition(e,1,-n/2,0,n,r),e.restore()}return!1}},DN=class extends TN{static draw(e,t){let n=[{x:0,y:0},{x:-1,y:.3},{x:-.9,y:0},{x:-1,y:-.3}];return TN.transform(n,t),TN.drawPath(e,n),!0}},ON=class{static draw(e,t){let n=[{x:-1,y:0},{x:0,y:.3},{x:-.4,y:0},{x:0,y:-.3}];return TN.transform(n,t),TN.drawPath(e,n),!0}},kN=class{static draw(e,t){let n={x:-.4,y:0};TN.transform(n,t),e.strokeStyle=e.fillStyle,e.fillStyle=`rgba(0, 0, 0, 0)`;let r=Math.PI,i=t.angle-r/2,a=t.angle+r/2;return e.beginPath(),e.arc(n.x,n.y,t.length*.4,i,a,!1),e.stroke(),!0}},AN=class{static draw(e,t){let n={x:-.3,y:0};TN.transform(n,t),e.strokeStyle=e.fillStyle,e.fillStyle=`rgba(0, 0, 0, 0)`;let r=Math.PI,i=t.angle+r/2,a=t.angle+3*r/2;return e.beginPath(),e.arc(n.x,n.y,t.length*.4,i,a,!1),e.stroke(),!0}},jN=class{static draw(e,t){let n=[{x:.02,y:0},{x:-1,y:.3},{x:-1,y:-.3}];return TN.transform(n,t),TN.drawPath(e,n),!0}},MN=class{static draw(e,t){let n=[{x:0,y:.3},{x:0,y:-.3},{x:-1,y:0}];return TN.transform(n,t),TN.drawPath(e,n),!0}},NN=class{static draw(e,t){let n={x:-.4,y:0};return TN.transform(n,t),ys(e,n.x,n.y,t.length*.4),!0}},PN=class{static draw(e,t){let n=[{x:0,y:.5},{x:0,y:-.5},{x:-.15,y:-.5},{x:-.15,y:.5}];return TN.transform(n,t),TN.drawPath(e,n),!0}},FN=class{static draw(e,t){let n=[{x:0,y:.3},{x:0,y:-.3},{x:-.6,y:-.3},{x:-.6,y:.3}];return TN.transform(n,t),TN.drawPath(e,n),!0}},IN=class{static draw(e,t){let n=[{x:0,y:0},{x:-.5,y:-.3},{x:-1,y:0},{x:-.5,y:.3}];return TN.transform(n,t),TN.drawPath(e,n),!0}},LN=class{static draw(e,t){let n=[{x:-1,y:.3},{x:-.5,y:0},{x:-1,y:-.3},{x:0,y:0}];return TN.transform(n,t),TN.drawPath(e,n),!0}},RN=class{static draw(e,t){let n;switch(t.type&&(n=t.type.toLowerCase()),n){case`image`:return EN.draw(e,t);case`circle`:return NN.draw(e,t);case`box`:return FN.draw(e,t);case`crow`:return ON.draw(e,t);case`curve`:return kN.draw(e,t);case`diamond`:return IN.draw(e,t);case`inv_curve`:return AN.draw(e,t);case`triangle`:return jN.draw(e,t);case`inv_triangle`:return MN.draw(e,t);case`bar`:return PN.draw(e,t);case`vee`:return LN.draw(e,t);default:return DN.draw(e,t)}}};function zN(e,t){var n=Xf(e);if(Rw){var r=Rw(e);t&&(r=Ph(r).call(r,function(t){return Zw(e,t).enumerable})),n.push.apply(n,r)}return n}function BN(e){for(var t=1;t<arguments.length;t++){var n,r,i=arguments[t]==null?{}:arguments[t];t%2?jp(n=zN(Object(i),!0)).call(n,function(t){OD(e,t,i[t])}):uT?CT(e,uT(i)):jp(r=zN(Object(i))).call(r,function(t){Lj(e,t,Zw(i,t))})}return e}var VN=class{constructor(e,t,n){OD(this,`color`,{}),OD(this,`colorDirty`,!0),OD(this,`hoverWidth`,1.5),OD(this,`selectionWidth`,2),this._body=t,this._labelModule=n,this.setOptions(e),this.fromPoint=this.from,this.toPoint=this.to}connect(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to]}cleanup(){return!1}setOptions(e){this.options=e,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.id=this.options.id}drawLine(e,t,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.getViaNode();e.strokeStyle=this.getColor(e,t),e.lineWidth=t.width,t.dashes===!1?this._drawLine(e,t,i):this._drawDashedLine(e,t,i)}_drawLine(e,t,n,r,i){if(this.from!=this.to)this._line(e,t,n,r,i);else{let[n,r,i]=this._getCircleData(e);this._circle(e,t,n,r,i)}}_drawDashedLine(e,t,n,r,i){e.lineCap=`round`;let a=W(t.dashes)?t.dashes:[5,5];if(e.setLineDash!==void 0){if(e.save(),e.setLineDash(a),e.lineDashOffset=0,this.from!=this.to)this._line(e,t,n);else{let[n,r,i]=this._getCircleData(e);this._circle(e,t,n,r,i)}e.setLineDash([0]),e.lineDashOffset=0,e.restore()}else{if(this.from!=this.to)Os(e,this.from.x,this.from.y,this.to.x,this.to.y,a);else{let[n,r,i]=this._getCircleData(e);this._circle(e,t,n,r,i)}this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}}findBorderPosition(e,t,n){return this.from==this.to?this._findBorderPositionCircle(e,t,n):this._findBorderPosition(e,t,n)}findBorderPositions(e){if(this.from!=this.to)return{from:this._findBorderPosition(this.from,e),to:this._findBorderPosition(this.to,e)};{var t;let[n,r]=Kd(t=this._getCircleData(e)).call(t,0,2);return{from:this._findBorderPositionCircle(this.from,e,{x:n,y:r,low:.25,high:.6,direction:-1}),to:this._findBorderPositionCircle(this.from,e,{x:n,y:r,low:.6,high:.8,direction:1})}}}_getCircleData(e){let t=this.options.selfReference.size;e!==void 0&&this.from.shape.width===void 0&&this.from.shape.resize(e);let n=PM(e,this.options.selfReference.angle,t,this.from);return[n.x,n.y,t]}_pointOnCircle(e,t,n,r){let i=r*2*Math.PI;return{x:e+n*Math.cos(i),y:t-n*Math.sin(i)}}_findBorderPositionCircle(e,t,n){let r=n.x,i=n.y,a=n.low,o=n.high,s=n.direction,c=this.options.selfReference.size,l,u=(a+o)*.5,d=0;this.options.arrowStrikethrough===!0&&(s===-1?d=this.options.endPointOffset.from:s===1&&(d=this.options.endPointOffset.to));let f=0;do{u=(a+o)*.5,l=this._pointOnCircle(r,i,c,u);let n=Math.atan2(e.y-l.y,e.x-l.x),p=e.distanceToBorder(t,n)+d-Math.sqrt((l.x-e.x)**2+(l.y-e.y)**2);if(Math.abs(p)<.05)break;p>0?s>0?a=u:o=u:s>0?o=u:a=u,++f}while(a<=o&&f<10);return BN(BN({},l),{},{t:u})}getLineWidth(e,t){return Math.max(e===!0?this.selectionWidth:t===!0?this.hoverWidth:this.options.width,.3/this._body.view.scale)}getColor(e,t){if(t.inheritsColor!==!1){if(t.inheritsColor===`both`&&this.from.id!==this.to.id){let n=e.createLinearGradient(this.from.x,this.from.y,this.to.x,this.to.y),r=this.from.options.color.highlight.border,i=this.to.options.color.highlight.border;return this.from.selected===!1&&this.to.selected===!1?(r=ox(this.from.options.color.border,t.opacity),i=ox(this.to.options.color.border,t.opacity)):this.from.selected===!0&&this.to.selected===!1?i=this.to.options.color.border:this.from.selected===!1&&this.to.selected===!0&&(r=this.from.options.color.border),n.addColorStop(0,r),n.addColorStop(1,i),n}return t.inheritsColor===`to`?ox(this.to.options.color.border,t.opacity):ox(this.from.options.color.border,t.opacity)}else return ox(t.color,t.opacity)}_circle(e,t,n,r,i){this.enableShadow(e,t);let a=0,o=Math.PI*2;if(!this.options.selfReference.renderBehindTheNode){let t=this.options.selfReference.angle,i=this.options.selfReference.angle+Math.PI,s=this._findBorderPositionCircle(this.from,e,{x:n,y:r,low:t,high:i,direction:-1}),c=this._findBorderPositionCircle(this.from,e,{x:n,y:r,low:t,high:i,direction:1});a=Math.atan2(s.y-r,s.x-n),o=Math.atan2(c.y-r,c.x-n)}e.beginPath(),e.arc(n,r,i,a,o,!1),e.stroke(),this.disableShadow(e,t)}getDistanceToEdge(e,t,n,r,i,a){if(this.from!=this.to)return this._getDistanceToEdge(e,t,n,r,i,a);{let[e,t,n]=this._getCircleData(void 0),r=e-i,o=t-a;return Math.abs(Math.sqrt(r*r+o*o)-n)}}_getDistanceToLine(e,t,n,r,i,a){let o=n-e,s=r-t,c=o*o+s*s,l=((i-e)*o+(a-t)*s)/c;l>1?l=1:l<0&&(l=0);let u=e+l*o,d=t+l*s,f=u-i,p=d-a;return Math.sqrt(f*f+p*p)}getArrowData(e,t,n,r,i,a){let o,s,c,l,u,d,f,p=a.width;t===`from`?(c=this.from,l=this.to,u=a.fromArrowScale<0,d=Math.abs(a.fromArrowScale),f=a.fromArrowType):t===`to`?(c=this.to,l=this.from,u=a.toArrowScale<0,d=Math.abs(a.toArrowScale),f=a.toArrowType):(c=this.to,l=this.from,u=a.middleArrowScale<0,d=Math.abs(a.middleArrowScale),f=a.middleArrowType);let m=15*d+3*p;if(c!=l){let r=m/wN(c.x-l.x,c.y-l.y);if(t!==`middle`)if(this.options.smooth.enabled===!0){let i=this._findBorderPosition(c,e,{via:n}),a=this.getPoint(i.t+r*(t===`from`?1:-1),n);o=Math.atan2(i.y-a.y,i.x-a.x),s=i}else o=Math.atan2(c.y-l.y,c.x-l.x),s=this._findBorderPosition(c,e);else{let e=(u?-r:r)/2,t=this.getPoint(.5+e,n),i=this.getPoint(.5-e,n);o=Math.atan2(t.y-i.y,t.x-i.x),s=this.getPoint(.5,n)}}else{let[n,r,i]=this._getCircleData(e);if(t===`from`){let t=this.options.selfReference.angle,i=this.options.selfReference.angle+Math.PI,a=this._findBorderPositionCircle(this.from,e,{x:n,y:r,low:t,high:i,direction:-1});o=a.t*-2*Math.PI+1.5*Math.PI+.1*Math.PI,s=a}else if(t===`to`){let t=this.options.selfReference.angle,i=this.options.selfReference.angle+Math.PI,a=this._findBorderPositionCircle(this.from,e,{x:n,y:r,low:t,high:i,direction:1});o=a.t*-2*Math.PI+1.5*Math.PI-1.1*Math.PI,s=a}else{let e=this.options.selfReference.angle/(2*Math.PI);s=this._pointOnCircle(n,r,i,e),o=e*-2*Math.PI+1.5*Math.PI+.1*Math.PI}}let h={x:s.x-m*.9*Math.cos(o),y:s.y-m*.9*Math.sin(o)};return{point:s,core:h,angle:o,length:m,type:f}}drawArrowHead(e,t,n,r,i){e.strokeStyle=this.getColor(e,t),e.fillStyle=e.strokeStyle,e.lineWidth=t.width,RN.draw(e,i)&&(this.enableShadow(e,t),av(e).call(e),this.disableShadow(e,t))}enableShadow(e,t){t.shadow===!0&&(e.shadowColor=t.shadowColor,e.shadowBlur=t.shadowSize,e.shadowOffsetX=t.shadowX,e.shadowOffsetY=t.shadowY)}disableShadow(e,t){t.shadow===!0&&(e.shadowColor=`rgba(0,0,0,0)`,e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}drawBackground(e,t){if(t.background!==!1){let n={strokeStyle:e.strokeStyle,lineWidth:e.lineWidth,dashes:e.dashes};e.strokeStyle=t.backgroundColor,e.lineWidth=t.backgroundSize,this.setStrokeDashed(e,t.backgroundDashes),e.stroke(),e.strokeStyle=n.strokeStyle,e.lineWidth=n.lineWidth,e.dashes=n.dashes,this.setStrokeDashed(e,t.dashes)}}setStrokeDashed(e,t){if(t!==!1)if(e.setLineDash!==void 0){let n=W(t)?t:[5,5];e.setLineDash(n)}else console.warn(`setLineDash is not supported in this browser. The dashed stroke cannot be used.`);else e.setLineDash===void 0?console.warn(`setLineDash is not supported in this browser. The dashed stroke cannot be used.`):e.setLineDash([])}};function HN(e,t){var n=Xf(e);if(Rw){var r=Rw(e);t&&(r=Ph(r).call(r,function(t){return Zw(e,t).enumerable})),n.push.apply(n,r)}return n}function UN(e){for(var t=1;t<arguments.length;t++){var n,r,i=arguments[t]==null?{}:arguments[t];t%2?jp(n=HN(Object(i),!0)).call(n,function(t){OD(e,t,i[t])}):uT?CT(e,uT(i)):jp(r=HN(Object(i))).call(r,function(t){Lj(e,t,Zw(i,t))})}return e}var WN=class extends VN{constructor(e,t,n){super(e,t,n)}_findBorderPositionBezier(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this._getViaCoordinates(),r=!1,i=1,a=0,o=this.to,s,c,l=this.options.endPointOffset?this.options.endPointOffset.to:0;e.id===this.from.id&&(o=this.from,r=!0,l=this.options.endPointOffset?this.options.endPointOffset.from:0),this.options.arrowStrikethrough===!1&&(l=0);let u=0;do{c=(a+i)*.5,s=this.getPoint(c,n);let e=Math.atan2(o.y-s.y,o.x-s.x),d=o.distanceToBorder(t,e)+l-Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2);if(Math.abs(d)<.2)break;d<0?r===!1?a=c:i=c:r===!1?i=c:a=c,++u}while(a<=i&&u<10);return UN(UN({},s),{},{t:c})}_getDistanceToBezierEdge(e,t,n,r,i,a,o){let s=1e9,c,l,u,d,f,p=e,m=t;for(l=1;l<10;l++)u=.1*l,d=(1-u)**2*e+2*u*(1-u)*o.x+u**2*n,f=(1-u)**2*t+2*u*(1-u)*o.y+u**2*r,l>0&&(c=this._getDistanceToLine(p,m,d,f,i,a),s=c<s?c:s),p=d,m=f;return s}_bezierCurve(e,t,n,r){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),n!=null&&n.x!=null?r!=null&&r.x!=null?e.bezierCurveTo(n.x,n.y,r.x,r.y,this.toPoint.x,this.toPoint.y):e.quadraticCurveTo(n.x,n.y,this.toPoint.x,this.toPoint.y):e.lineTo(this.toPoint.x,this.toPoint.y),this.drawBackground(e,t),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}getViaNode(){return this._getViaCoordinates()}},GN=class extends WN{constructor(e,t,n){super(e,t,n),OD(this,`via`,this.via),this._boundFunction=()=>{this.positionBezierNode()},this._body.emitter.on(`_repositionBezierNodes`,this._boundFunction)}setOptions(e){super.setOptions(e);let t=!1;this.options.physics!==e.physics&&(t=!0),this.options=e,this.id=this.options.id,this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.setupSupportNode(),this.connect(),t===!0&&(this.via.setOptions({physics:this.options.physics}),this.positionBezierNode())}connect(){this.from=this._body.nodes[this.options.from],this.to=this._body.nodes[this.options.to],this.from===void 0||this.to===void 0||this.options.physics===!1||this.from.id===this.to.id?this.via.setOptions({physics:!1}):this.via.setOptions({physics:!0})}cleanup(){return this._body.emitter.off(`_repositionBezierNodes`,this._boundFunction),this.via===void 0?!1:(delete this._body.nodes[this.via.id],this.via=void 0,!0)}setupSupportNode(){if(this.via===void 0){let e=`edgeId:`+this.id,t=this._body.functions.createNode({id:e,shape:`circle`,physics:!0,hidden:!0});this._body.nodes[e]=t,this.via=t,this.via.parentEdgeId=this.id,this.positionBezierNode()}}positionBezierNode(){this.via!==void 0&&this.from!==void 0&&this.to!==void 0?(this.via.x=.5*(this.from.x+this.to.x),this.via.y=.5*(this.from.y+this.to.y)):this.via!==void 0&&(this.via.x=0,this.via.y=0)}_line(e,t,n){this._bezierCurve(e,t,n)}_getViaCoordinates(){return this.via}getViaNode(){return this.via}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.via;if(this.from===this.to){let[t,n,r]=this._getCircleData(),i=2*Math.PI*(1-e);return{x:t+r*Math.sin(i),y:n+r-r*(1-Math.cos(i))}}else return{x:(1-e)**2*this.fromPoint.x+2*e*(1-e)*t.x+e**2*this.toPoint.x,y:(1-e)**2*this.fromPoint.y+2*e*(1-e)*t.y+e**2*this.toPoint.y}}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t,this.via)}_getDistanceToEdge(e,t,n,r,i,a){return this._getDistanceToBezierEdge(e,t,n,r,i,a,this.via)}},KN=class extends WN{constructor(e,t,n){super(e,t,n)}_line(e,t,n){this._bezierCurve(e,t,n)}getViaNode(){return this._getViaCoordinates()}_getViaCoordinates(){let e=this.options.smooth.roundness,t=this.options.smooth.type,n=Math.abs(this.from.x-this.to.x),r=Math.abs(this.from.y-this.to.y);if(t===`discrete`||t===`diagonalCross`){let i,a;i=a=n<=r?e*r:e*n,this.from.x>this.to.x&&(i=-i),this.from.y>=this.to.y&&(a=-a);let o=this.from.x+i,s=this.from.y+a;return t===`discrete`&&(n<=r?o=n<e*r?this.from.x:o:s=r<e*n?this.from.y:s),{x:o,y:s}}else if(t===`straightCross`){let t=(1-e)*n,i=(1-e)*r;return n<=r?(t=0,this.from.y<this.to.y&&(i=-i)):(this.from.x<this.to.x&&(t=-t),i=0),{x:this.to.x+t,y:this.to.y+i}}else if(t===`horizontal`){let t=(1-e)*n;return this.from.x<this.to.x&&(t=-t),{x:this.to.x+t,y:this.from.y}}else if(t===`vertical`){let t=(1-e)*r;return this.from.y<this.to.y&&(t=-t),{x:this.from.x,y:this.to.y+t}}else if(t===`curvedCW`){n=this.to.x-this.from.x,r=this.from.y-this.to.y;let t=Math.sqrt(n*n+r*r),i=Math.PI,a=(Math.atan2(r,n)+(e*.5+.5)*i)%(2*i);return{x:this.from.x+(e*.5+.5)*t*Math.sin(a),y:this.from.y+(e*.5+.5)*t*Math.cos(a)}}else if(t===`curvedCCW`){n=this.to.x-this.from.x,r=this.from.y-this.to.y;let t=Math.sqrt(n*n+r*r),i=Math.PI,a=(Math.atan2(r,n)+(-e*.5+.5)*i)%(2*i);return{x:this.from.x+(e*.5+.5)*t*Math.sin(a),y:this.from.y+(e*.5+.5)*t*Math.cos(a)}}else{let t,i;t=i=n<=r?e*r:e*n,this.from.x>this.to.x&&(t=-t),this.from.y>=this.to.y&&(i=-i);let a=this.from.x+t,o=this.from.y+i;return n<=r?a=this.from.x<=this.to.x?this.to.x<a?this.to.x:a:this.to.x>a?this.to.x:a:o=this.from.y>=this.to.y?this.to.y>o?this.to.y:o:this.to.y<o?this.to.y:o,{x:a,y:o}}}_findBorderPosition(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this._findBorderPositionBezier(e,t,n.via)}_getDistanceToEdge(e,t,n,r,i,a){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge(e,t,n,r,i,a,o)}getPoint(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),n=e;return{x:(1-n)**2*this.fromPoint.x+2*n*(1-n)*t.x+n**2*this.toPoint.x,y:(1-n)**2*this.fromPoint.y+2*n*(1-n)*t.y+n**2*this.toPoint.y}}},qN=class extends WN{constructor(e,t,n){super(e,t,n)}_getDistanceToBezierEdge2(e,t,n,r,i,a,o,s){let c=1e9,l=e,u=t,d=[0,0,0,0];for(let f=1;f<10;f++){let p=.1*f;d[0]=(1-p)**3,d[1]=3*p*(1-p)**2,d[2]=3*p**2*(1-p),d[3]=p**3;let m=d[0]*e+d[1]*o.x+d[2]*s.x+d[3]*n,h=d[0]*t+d[1]*o.y+d[2]*s.y+d[3]*r;if(f>0){let e=this._getDistanceToLine(l,u,m,h,i,a);c=e<c?e:c}l=m,u=h}return c}},JN=class extends qN{constructor(e,t,n){super(e,t,n)}_line(e,t,n){let r=n[0],i=n[1];this._bezierCurve(e,t,r,i)}_getViaCoordinates(){let e=this.from.x-this.to.x,t=this.from.y-this.to.y,n,r,i,a,o=this.options.smooth.roundness;return(Math.abs(e)>Math.abs(t)||this.options.smooth.forceDirection===!0||this.options.smooth.forceDirection===`horizontal`)&&this.options.smooth.forceDirection!==`vertical`?(r=this.from.y,a=this.to.y,n=this.from.x-o*e,i=this.to.x+o*e):(r=this.from.y-o*t,a=this.to.y+o*t,n=this.from.x,i=this.to.x),[{x:n,y:r},{x:i,y:a}]}getViaNode(){return this._getViaCoordinates()}_findBorderPosition(e,t){return this._findBorderPositionBezier(e,t)}_getDistanceToEdge(e,t,n,r,i,a){let[o,s]=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this._getViaCoordinates();return this._getDistanceToBezierEdge2(e,t,n,r,i,a,o,s)}getPoint(e){let[t,n]=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this._getViaCoordinates(),r=e,i=[(1-r)**3,3*r*(1-r)**2,3*r**2*(1-r),r**3];return{x:i[0]*this.fromPoint.x+i[1]*t.x+i[2]*n.x+i[3]*this.toPoint.x,y:i[0]*this.fromPoint.y+i[1]*t.y+i[2]*n.y+i[3]*this.toPoint.y}}},YN=class extends VN{constructor(e,t,n){super(e,t,n)}_line(e,t){e.beginPath(),e.moveTo(this.fromPoint.x,this.fromPoint.y),e.lineTo(this.toPoint.x,this.toPoint.y),this.enableShadow(e,t),e.stroke(),this.disableShadow(e,t)}getViaNode(){}getPoint(e){return{x:(1-e)*this.fromPoint.x+e*this.toPoint.x,y:(1-e)*this.fromPoint.y+e*this.toPoint.y}}_findBorderPosition(e,t){let n=this.to,r=this.from;e.id===this.from.id&&(n=this.from,r=this.to);let i=Math.atan2(n.y-r.y,n.x-r.x),a=n.x-r.x,o=n.y-r.y,s=Math.sqrt(a*a+o*o),c=(s-e.distanceToBorder(t,i))/s;return{x:(1-c)*r.x+c*n.x,y:(1-c)*r.y+c*n.y,t:0}}_getDistanceToEdge(e,t,n,r,i,a){return this._getDistanceToLine(e,t,n,r,i,a)}},XN=class e{constructor(e,t,n,r,i){if(t===void 0)throw Error(`No body provided`);this.options=gx(r),this.globalOptions=r,this.defaultOptions=i,this.body=t,this.imagelist=n,this.id=void 0,this.fromId=void 0,this.toId=void 0,this.selected=!1,this.hover=!1,this.labelDirty=!0,this.baseWidth=this.options.width,this.baseFontSize=this.options.font.size,this.from=void 0,this.to=void 0,this.edgeType=void 0,this.connected=!1,this.labelModule=new BM(this.body,this.options,!0),this.setOptions(e)}setOptions(t){if(!t)return;let n=t.physics!==void 0&&this.options.physics!==t.physics||t.hidden!==void 0&&(this.options.hidden||!1)!==(t.hidden||!1)||t.from!==void 0&&this.options.from!==t.from||t.to!==void 0&&this.options.to!==t.to;e.parseOptions(this.options,t,!0,this.globalOptions),t.id!==void 0&&(this.id=t.id),t.from!==void 0&&(this.fromId=t.from),t.to!==void 0&&(this.toId=t.to),t.title!==void 0&&(this.title=t.title),t.value!==void 0&&(t.value=_M(t.value));let r=[t,this.options,this.defaultOptions];return this.chooser=jM(`edge`,r),this.updateLabelModule(t),n=this.updateEdgeType()||n,this._setInteractionWidths(),this.connect(),n}static parseOptions(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(Zb([`endPointOffset`,`arrowStrikethrough`,`id`,`from`,`hidden`,`hoverWidth`,`labelHighlightBold`,`length`,`line`,`opacity`,`physics`,`scaling`,`selectionWidth`,`selfReferenceSize`,`selfReference`,`to`,`title`,`value`,`width`,`font`,`chosen`,`widthConstraint`],e,t,n),t.endPointOffset!==void 0&&t.endPointOffset.from!==void 0&&(fw(t.endPointOffset.from)?e.endPointOffset.from=t.endPointOffset.from:(e.endPointOffset.from=r.endPointOffset.from===void 0?0:r.endPointOffset.from,console.error(`endPointOffset.from is not a valid number`))),t.endPointOffset!==void 0&&t.endPointOffset.to!==void 0&&(fw(t.endPointOffset.to)?e.endPointOffset.to=t.endPointOffset.to:(e.endPointOffset.to=r.endPointOffset.to===void 0?0:r.endPointOffset.to,console.error(`endPointOffset.to is not a valid number`))),NM(t.label)?e.label=t.label:NM(e.label)||(e.label=void 0),_x(e,t,`smooth`,r),_x(e,t,`shadow`,r),_x(e,t,`background`,r),t.dashes!==void 0&&t.dashes!==null?e.dashes=t.dashes:n===!0&&t.dashes===null&&(e.dashes=qg(r.dashes)),t.scaling!==void 0&&t.scaling!==null?(t.scaling.min!==void 0&&(e.scaling.min=t.scaling.min),t.scaling.max!==void 0&&(e.scaling.max=t.scaling.max),_x(e.scaling,t.scaling,`label`,r.scaling)):n===!0&&t.scaling===null&&(e.scaling=qg(r.scaling)),t.arrows!==void 0&&t.arrows!==null)if(typeof t.arrows==`string`){let n=t.arrows.toLowerCase();e.arrows.to.enabled=Pg(n).call(n,`to`)!=-1,e.arrows.middle.enabled=Pg(n).call(n,`middle`)!=-1,e.arrows.from.enabled=Pg(n).call(n,`from`)!=-1}else if(typeof t.arrows==`object`)_x(e.arrows,t.arrows,`to`,r.arrows),_x(e.arrows,t.arrows,`middle`,r.arrows),_x(e.arrows,t.arrows,`from`,r.arrows);else throw Error(`The arrow newOptions can only be an object or a string. Refer to the documentation. You used:`+h_(t.arrows));else n===!0&&t.arrows===null&&(e.arrows=qg(r.arrows));if(t.color!==void 0&&t.color!==null){let a=qb(t.color)?{color:t.color,highlight:t.color,hover:t.color,inherit:!1,opacity:1}:t.color,o=e.color;if(i)$b(o,r.color,!1,n);else for(let e in o)Object.prototype.hasOwnProperty.call(o,e)&&delete o[e];if(qb(o))o.color=o,o.highlight=o,o.hover=o,o.inherit=!1,a.opacity===void 0&&(o.opacity=1);else{let e=!1;a.color!==void 0&&(o.color=a.color,e=!0),a.highlight!==void 0&&(o.highlight=a.highlight,e=!0),a.hover!==void 0&&(o.hover=a.hover,e=!0),a.inherit!==void 0&&(o.inherit=a.inherit),a.opacity!==void 0&&(o.opacity=Math.min(1,Math.max(0,a.opacity))),e===!0?o.inherit=!1:o.inherit===void 0&&(o.inherit=`from`)}}else n===!0&&t.color===null&&(e.color=gx(r.color));n===!0&&t.font===null&&(e.font=gx(r.font)),Object.prototype.hasOwnProperty.call(t,`selfReferenceSize`)&&(console.warn(`The selfReferenceSize property has been deprecated. Please use selfReference property instead. The selfReference can be set like thise selfReference:{size:30, angle:Math.PI / 4}`),e.selfReference.size=t.selfReferenceSize)}getFormattingValues(){let e=this.options.arrows.to===!0||this.options.arrows.to.enabled===!0,t=this.options.arrows.from===!0||this.options.arrows.from.enabled===!0,n=this.options.arrows.middle===!0||this.options.arrows.middle.enabled===!0,r=this.options.color.inherit,i={toArrow:e,toArrowScale:this.options.arrows.to.scaleFactor,toArrowType:this.options.arrows.to.type,toArrowSrc:this.options.arrows.to.src,toArrowImageWidth:this.options.arrows.to.imageWidth,toArrowImageHeight:this.options.arrows.to.imageHeight,middleArrow:n,middleArrowScale:this.options.arrows.middle.scaleFactor,middleArrowType:this.options.arrows.middle.type,middleArrowSrc:this.options.arrows.middle.src,middleArrowImageWidth:this.options.arrows.middle.imageWidth,middleArrowImageHeight:this.options.arrows.middle.imageHeight,fromArrow:t,fromArrowScale:this.options.arrows.from.scaleFactor,fromArrowType:this.options.arrows.from.type,fromArrowSrc:this.options.arrows.from.src,fromArrowImageWidth:this.options.arrows.from.imageWidth,fromArrowImageHeight:this.options.arrows.from.imageHeight,arrowStrikethrough:this.options.arrowStrikethrough,color:r?void 0:this.options.color.color,inheritsColor:r,opacity:this.options.color.opacity,hidden:this.options.hidden,length:this.options.length,shadow:this.options.shadow.enabled,shadowColor:this.options.shadow.color,shadowSize:this.options.shadow.size,shadowX:this.options.shadow.x,shadowY:this.options.shadow.y,dashes:this.options.dashes,width:this.options.width,background:this.options.background.enabled,backgroundColor:this.options.background.color,backgroundSize:this.options.background.size,backgroundDashes:this.options.background.dashes};if(this.selected||this.hover)if(this.chooser===!0){if(this.selected){let e=this.options.selectionWidth;typeof e==`function`?i.width=e(i.width):typeof e==`number`&&(i.width+=e),i.width=Math.max(i.width,.3/this.body.view.scale),i.color=this.options.color.highlight,i.shadow=this.options.shadow.enabled}else if(this.hover){let e=this.options.hoverWidth;typeof e==`function`?i.width=e(i.width):typeof e==`number`&&(i.width+=e),i.width=Math.max(i.width,.3/this.body.view.scale),i.color=this.options.color.hover,i.shadow=this.options.shadow.enabled}}else typeof this.chooser==`function`&&(this.chooser(i,this.options.id,this.selected,this.hover),i.color!==void 0&&(i.inheritsColor=!1),i.shadow===!1&&(i.shadowColor!==this.options.shadow.color||i.shadowSize!==this.options.shadow.size||i.shadowX!==this.options.shadow.x||i.shadowY!==this.options.shadow.y)&&(i.shadow=!0));else i.shadow=this.options.shadow.enabled,i.width=Math.max(i.width,.3/this.body.view.scale);return i}updateLabelModule(e){let t=[e,this.options,this.globalOptions,this.defaultOptions];this.labelModule.update(this.options,t),this.labelModule.baseSize!==void 0&&(this.baseFontSize=this.labelModule.baseSize)}updateEdgeType(){let e=this.options.smooth,t=!1,n=!0;return this.edgeType!==void 0&&((this.edgeType instanceof GN&&e.enabled===!0&&e.type===`dynamic`||this.edgeType instanceof JN&&e.enabled===!0&&e.type===`cubicBezier`||this.edgeType instanceof KN&&e.enabled===!0&&e.type!==`dynamic`&&e.type!==`cubicBezier`||this.edgeType instanceof YN&&e.type.enabled===!1)&&(n=!1),n===!0&&(t=this.cleanup())),n===!0?e.enabled===!0?e.type===`dynamic`?(t=!0,this.edgeType=new GN(this.options,this.body,this.labelModule)):e.type===`cubicBezier`?this.edgeType=new JN(this.options,this.body,this.labelModule):this.edgeType=new KN(this.options,this.body,this.labelModule):this.edgeType=new YN(this.options,this.body,this.labelModule):this.edgeType.setOptions(this.options),t}connect(){this.disconnect(),this.from=this.body.nodes[this.fromId]||void 0,this.to=this.body.nodes[this.toId]||void 0,this.connected=this.from!==void 0&&this.to!==void 0,this.connected===!0?(this.from.attachEdge(this),this.to.attachEdge(this)):(this.from&&this.from.detachEdge(this),this.to&&this.to.detachEdge(this)),this.edgeType.connect()}disconnect(){this.from&&=(this.from.detachEdge(this),void 0),this.to&&=(this.to.detachEdge(this),void 0),this.connected=!1}getTitle(){return this.title}isSelected(){return this.selected}getValue(){return this.options.value}setValueRange(e,t,n){if(this.options.value!==void 0){let r=this.options.scaling.customScalingFunction(e,t,n,this.options.value),i=this.options.scaling.max-this.options.scaling.min;if(this.options.scaling.label.enabled===!0){let e=this.options.scaling.label.max-this.options.scaling.label.min;this.options.font.size=this.options.scaling.label.min+r*e}this.options.width=this.options.scaling.min+r*i}else this.options.width=this.baseWidth,this.options.font.size=this.baseFontSize;this._setInteractionWidths(),this.updateLabelModule()}_setInteractionWidths(){typeof this.options.hoverWidth==`function`?this.edgeType.hoverWidth=this.options.hoverWidth(this.options.width):this.edgeType.hoverWidth=this.options.hoverWidth+this.options.width,typeof this.options.selectionWidth==`function`?this.edgeType.selectionWidth=this.options.selectionWidth(this.options.width):this.edgeType.selectionWidth=this.options.selectionWidth+this.options.width}draw(e){let t=this.getFormattingValues();if(t.hidden)return;let n=this.edgeType.getViaNode();this.edgeType.drawLine(e,t,this.selected,this.hover,n),this.drawLabel(e,n)}drawArrows(e){let t=this.getFormattingValues();if(t.hidden)return;let n=this.edgeType.getViaNode(),r={};this.edgeType.fromPoint=this.edgeType.from,this.edgeType.toPoint=this.edgeType.to,t.fromArrow&&(r.from=this.edgeType.getArrowData(e,`from`,n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.fromPoint=r.from.core),t.fromArrowSrc&&(r.from.image=this.imagelist.load(t.fromArrowSrc)),t.fromArrowImageWidth&&(r.from.imageWidth=t.fromArrowImageWidth),t.fromArrowImageHeight&&(r.from.imageHeight=t.fromArrowImageHeight)),t.toArrow&&(r.to=this.edgeType.getArrowData(e,`to`,n,this.selected,this.hover,t),t.arrowStrikethrough===!1&&(this.edgeType.toPoint=r.to.core),t.toArrowSrc&&(r.to.image=this.imagelist.load(t.toArrowSrc)),t.toArrowImageWidth&&(r.to.imageWidth=t.toArrowImageWidth),t.toArrowImageHeight&&(r.to.imageHeight=t.toArrowImageHeight)),t.middleArrow&&(r.middle=this.edgeType.getArrowData(e,`middle`,n,this.selected,this.hover,t),t.middleArrowSrc&&(r.middle.image=this.imagelist.load(t.middleArrowSrc)),t.middleArrowImageWidth&&(r.middle.imageWidth=t.middleArrowImageWidth),t.middleArrowImageHeight&&(r.middle.imageHeight=t.middleArrowImageHeight)),t.fromArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,r.from),t.middleArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,r.middle),t.toArrow&&this.edgeType.drawArrowHead(e,t,this.selected,this.hover,r.to)}drawLabel(e,t){if(this.options.label!==void 0){let n=this.from,r=this.to;this.labelModule.differentState(this.selected,this.hover)&&this.labelModule.getTextSize(e,this.selected,this.hover);let i;if(n.id!=r.id){this.labelModule.pointToSelf=!1,i=this.edgeType.getPoint(.5,t),e.save();let n=this._getRotation(e);n.angle!=0&&(e.translate(n.x,n.y),e.rotate(n.angle)),this.labelModule.draw(e,i.x,i.y,this.selected,this.hover),e.restore()}else{this.labelModule.pointToSelf=!0;let t=PM(e,this.options.selfReference.angle,this.options.selfReference.size,n);i=this._pointOnCircle(t.x,t.y,this.options.selfReference.size,this.options.selfReference.angle),this.labelModule.draw(e,i.x,i.y,this.selected,this.hover)}}}getItemsOnPoint(e){let t=[];if(this.labelModule.visible()){let n=this._getRotation();MM(this.labelModule.getSize(),e,n)&&t.push({edgeId:this.id,labelId:0})}let n={left:e.x,top:e.y};return this.isOverlappingWith(n)&&t.push({edgeId:this.id}),t}isOverlappingWith(e){if(this.connected){let t=this.from.x,n=this.from.y,r=this.to.x,i=this.to.y,a=e.left,o=e.top;return this.edgeType.getDistanceToEdge(t,n,r,i,a,o)<10}else return!1}_getRotation(e){let t=this.edgeType.getViaNode(),n=this.edgeType.getPoint(.5,t);e!==void 0&&this.labelModule.calculateLabelSize(e,this.selected,this.hover,n.x,n.y);let r={x:n.x,y:this.labelModule.size.yLine,angle:0};if(!this.labelModule.visible()||this.options.font.align===`horizontal`)return r;let i=this.from.y-this.to.y,a=this.from.x-this.to.x,o=Math.atan2(i,a);return(o<-1&&a<0||o>0&&a<0)&&(o+=Math.PI),r.angle=o,r}_pointOnCircle(e,t,n,r){return{x:e+n*Math.cos(r),y:t-n*Math.sin(r)}}select(){this.selected=!0}unselect(){this.selected=!1}cleanup(){return this.edgeType.cleanup()}remove(){this.cleanup(),this.disconnect(),delete this.body.edges[this.id]}endPointsValid(){return this.body.nodes[this.fromId]!==void 0&&this.body.nodes[this.toId]!==void 0}},ZN=class{constructor(e,t,n){var r;this.body=e,this.images=t,this.groups=n,this.body.functions.createEdge=B(r=this.create).call(r,this),this.edgesListeners={add:(e,t)=>{this.add(t.items)},update:(e,t)=>{this.update(t.items)},remove:(e,t)=>{this.remove(t.items)}},this.options={},this.defaultOptions={arrows:{to:{enabled:!1,scaleFactor:1,type:`arrow`},middle:{enabled:!1,scaleFactor:1,type:`arrow`},from:{enabled:!1,scaleFactor:1,type:`arrow`}},endPointOffset:{from:0,to:0},arrowStrikethrough:!0,color:{color:`#848484`,highlight:`#848484`,hover:`#848484`,inherit:`from`,opacity:1},dashes:!1,font:{color:`#343434`,size:14,face:`arial`,background:`none`,strokeWidth:2,strokeColor:`#ffffff`,align:`horizontal`,multi:!1,vadjust:0,bold:{mod:`bold`},boldital:{mod:`bold italic`},ital:{mod:`italic`},mono:{mod:``,size:15,face:`courier new`,vadjust:2}},hidden:!1,hoverWidth:1.5,label:void 0,labelHighlightBold:!0,length:void 0,physics:!0,scaling:{min:1,max:15,label:{enabled:!0,min:14,max:30,maxVisible:30,drawThreshold:5},customScalingFunction:function(e,t,n,r){if(t===e)return .5;{let n=1/(t-e);return Math.max(0,(r-e)*n)}}},selectionWidth:1.5,selfReference:{size:20,angle:Math.PI/4,renderBehindTheNode:!0},shadow:{enabled:!1,color:`rgba(0,0,0,0.5)`,size:10,x:5,y:5},background:{enabled:!1,color:`rgba(111,111,111,1)`,size:10,dashes:!1},smooth:{enabled:!0,type:`dynamic`,forceDirection:`none`,roundness:.5},title:void 0,width:1,value:void 0},$b(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e=this,t,n;this.body.emitter.on(`_forceDisableDynamicCurves`,function(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;t===`dynamic`&&(t=`continuous`);let r=!1;for(let n in e.body.edges)if(Object.prototype.hasOwnProperty.call(e.body.edges,n)){let i=e.body.edges[n],a=e.body.data.edges.get(n);if(a!=null){let e=a.smooth;e!==void 0&&e.enabled===!0&&e.type===`dynamic`&&(t===void 0?i.setOptions({smooth:!1}):i.setOptions({smooth:{type:t}}),r=!0)}}n===!0&&r===!0&&e.body.emitter.emit(`_dataChanged`)}),this.body.emitter.on(`_dataUpdated`,()=>{this.reconnectEdges()}),this.body.emitter.on(`refreshEdges`,B(t=this.refresh).call(t,this)),this.body.emitter.on(`refresh`,B(n=this.refresh).call(n,this)),this.body.emitter.on(`destroy`,()=>{ix(this.edgesListeners,(e,t)=>{this.body.data.edges&&this.body.data.edges.off(t,e)}),delete this.body.functions.createEdge,delete this.edgesListeners.add,delete this.edgesListeners.update,delete this.edgesListeners.remove,delete this.edgesListeners})}setOptions(e){if(e!==void 0){XN.parseOptions(this.options,e,!0,this.defaultOptions,!0);let t=!1;if(e.smooth!==void 0)for(let e in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,e)&&(t=this.body.edges[e].updateEdgeType()||t);if(e.font!==void 0)for(let e in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,e)&&this.body.edges[e].updateLabelModule();(e.hidden!==void 0||e.physics!==void 0||t===!0)&&this.body.emitter.emit(`_dataChanged`)}}setData(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.data.edges;if(tM(`id`,e))this.body.data.edges=e;else if(W(e))this.body.data.edges=new $j,this.body.data.edges.add(e);else if(!e)this.body.data.edges=new $j;else throw TypeError(`Array or DataSet expected`);if(n&&ix(this.edgesListeners,(e,t)=>{n.off(t,e)}),this.body.edges={},this.body.data.edges){ix(this.edgesListeners,(e,t)=>{this.body.data.edges.on(t,e)});let e=this.body.data.edges.getIds();this.add(e,!0)}this.body.emitter.emit(`_adjustEdgesForHierarchicalLayout`),t===!1&&this.body.emitter.emit(`_dataChanged`)}add(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.edges,r=this.body.data.edges;for(let t=0;t<e.length;t++){let i=e[t],a=n[i];a&&a.disconnect();let o=r.get(i,{showInternalIds:!0});n[i]=this.create(o)}this.body.emitter.emit(`_adjustEdgesForHierarchicalLayout`),t===!1&&this.body.emitter.emit(`_dataChanged`)}update(e){let t=this.body.edges,n=this.body.data.edges,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=n.get(a),s=t[a];s===void 0?(this.body.edges[a]=this.create(o),r=!0):(s.disconnect(),r=s.setOptions(o)||r,s.connect())}r===!0?(this.body.emitter.emit(`_adjustEdgesForHierarchicalLayout`),this.body.emitter.emit(`_dataChanged`)):this.body.emitter.emit(`_dataUpdated`)}remove(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.length===0)return;let n=this.body.edges;ix(e,e=>{let t=n[e];t!==void 0&&t.remove()}),t&&this.body.emitter.emit(`_dataChanged`)}refresh(){ix(this.body.edges,(e,t)=>{let n=this.body.data.edges.get(t);n!==void 0&&e.setOptions(n)})}create(e){return new XN(e,this.body,this.images,this.options,this.defaultOptions)}reconnectEdges(){let e,t=this.body.nodes,n=this.body.edges;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e].edges=[]);for(e in n)if(Object.prototype.hasOwnProperty.call(n,e)){let t=n[e];t.from=null,t.to=null,t.connect()}}getConnectedNodes(e){let t=[];if(this.body.edges[e]!==void 0){let n=this.body.edges[e];n.fromId!==void 0&&t.push(n.fromId),n.toId!==void 0&&t.push(n.toId)}return t}_updateState(){this._addMissingEdges(),this._removeInvalidEdges()}_removeInvalidEdges(){let e=[];ix(this.body.edges,(t,n)=>{let r=this.body.nodes[t.toId],i=this.body.nodes[t.fromId];r!==void 0&&r.isCluster===!0||i!==void 0&&i.isCluster===!0||(r===void 0||i===void 0)&&e.push(n)}),this.remove(e,!1)}_addMissingEdges(){let e=this.body.data.edges;if(e==null)return;let t=this.body.edges,n=[];jp(e).call(e,(e,r)=>{t[r]===void 0&&n.push(r)}),this.add(n,!0)}},QN=class{constructor(e,t,n){this.body=e,this.physicsBody=t,this.barnesHutTree,this.setOptions(n),this._rng=Pb(`BARNES HUT SOLVER`)}setOptions(e){this.options=e,this.thetaInversed=1/this.options.theta,this.overlapAvoidanceFactor=1-Math.max(0,Math.min(1,this.options.avoidOverlap))}solve(){if(this.options.gravitationalConstant!==0&&this.physicsBody.physicsNodeIndices.length>0){let e,t=this.body.nodes,n=this.physicsBody.physicsNodeIndices,r=n.length,i=this._formBarnesHutTree(t,n);this.barnesHutTree=i;for(let a=0;a<r;a++)e=t[n[a]],e.options.mass>0&&this._getForceContributions(i.root,e)}}_getForceContributions(e,t){this._getForceContribution(e.children.NW,t),this._getForceContribution(e.children.NE,t),this._getForceContribution(e.children.SW,t),this._getForceContribution(e.children.SE,t)}_getForceContribution(e,t){if(e.childrenCount>0){let n=e.centerOfMass.x-t.x,r=e.centerOfMass.y-t.y,i=Math.sqrt(n*n+r*r);i*e.calcSize>this.thetaInversed?this._calculateForces(i,n,r,t,e):e.childrenCount===4?this._getForceContributions(e,t):e.children.data.id!=t.id&&this._calculateForces(i,n,r,t,e)}}_calculateForces(e,t,n,r,i){e===0&&(e=.1,t=e),this.overlapAvoidanceFactor<1&&r.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*r.shape.radius,e-r.shape.radius));let a=this.options.gravitationalConstant*i.mass*r.options.mass/e**3,o=t*a,s=n*a;this.physicsBody.forces[r.id].x+=o,this.physicsBody.forces[r.id].y+=s}_formBarnesHutTree(e,t){let n,r=t.length,i=e[t[0]].x,a=e[t[0]].y,o=e[t[0]].x,s=e[t[0]].y;for(let n=1;n<r;n++){let r=e[t[n]],c=r.x,l=r.y;r.options.mass>0&&(c<i&&(i=c),c>o&&(o=c),l<a&&(a=l),l>s&&(s=l))}let c=Math.abs(o-i)-Math.abs(s-a);c>0?(a-=.5*c,s+=.5*c):(i+=.5*c,o-=.5*c);let l=Math.max(1e-5,Math.abs(o-i)),u=.5*l,d=.5*(i+o),f=.5*(a+s),p={root:{centerOfMass:{x:0,y:0},mass:0,range:{minX:d-u,maxX:d+u,minY:f-u,maxY:f+u},size:l,calcSize:1/l,children:{data:null},maxWidth:0,level:0,childrenCount:4}};this._splitBranch(p.root);for(let i=0;i<r;i++)n=e[t[i]],n.options.mass>0&&this._placeInTree(p.root,n);return p}_updateBranchMass(e,t){let n=e.centerOfMass,r=e.mass+t.options.mass,i=1/r;n.x=n.x*e.mass+t.x*t.options.mass,n.x*=i,n.y=n.y*e.mass+t.y*t.options.mass,n.y*=i,e.mass=r;let a=Math.max(Math.max(t.height,t.radius),t.width);e.maxWidth=e.maxWidth<a?a:e.maxWidth}_placeInTree(e,t,n){(n!=1||n===void 0)&&this._updateBranchMass(e,t);let r=e.children.NW.range,i;i=r.maxX>t.x?r.maxY>t.y?`NW`:`SW`:r.maxY>t.y?`NE`:`SE`,this._placeInRegion(e,t,i)}_placeInRegion(e,t,n){let r=e.children[n];switch(r.childrenCount){case 0:r.children.data=t,r.childrenCount=1,this._updateBranchMass(r,t);break;case 1:r.children.data.x===t.x&&r.children.data.y===t.y?(t.x+=this._rng(),t.y+=this._rng()):(this._splitBranch(r),this._placeInTree(r,t));break;case 4:this._placeInTree(r,t);break}}_splitBranch(e){let t=null;e.childrenCount===1&&(t=e.children.data,e.mass=0,e.centerOfMass.x=0,e.centerOfMass.y=0),e.childrenCount=4,e.children.data=null,this._insertRegion(e,`NW`),this._insertRegion(e,`NE`),this._insertRegion(e,`SW`),this._insertRegion(e,`SE`),t!=null&&this._placeInTree(e,t)}_insertRegion(e,t){let n,r,i,a,o=.5*e.size;switch(t){case`NW`:n=e.range.minX,r=e.range.minX+o,i=e.range.minY,a=e.range.minY+o;break;case`NE`:n=e.range.minX+o,r=e.range.maxX,i=e.range.minY,a=e.range.minY+o;break;case`SW`:n=e.range.minX,r=e.range.minX+o,i=e.range.minY+o,a=e.range.maxY;break;case`SE`:n=e.range.minX+o,r=e.range.maxX,i=e.range.minY+o,a=e.range.maxY;break}e.children[t]={centerOfMass:{x:0,y:0},mass:0,range:{minX:n,maxX:r,minY:i,maxY:a},size:.5*e.size,calcSize:2*e.calcSize,children:{data:null},maxWidth:0,level:e.level+1,childrenCount:0}}_debug(e,t){this.barnesHutTree!==void 0&&(e.lineWidth=1,this._drawBranch(this.barnesHutTree.root,e,t))}_drawBranch(e,t,n){n===void 0&&(n=`#FF0000`),e.childrenCount===4&&(this._drawBranch(e.children.NW,t),this._drawBranch(e.children.NE,t),this._drawBranch(e.children.SE,t),this._drawBranch(e.children.SW,t)),t.strokeStyle=n,t.beginPath(),t.moveTo(e.range.minX,e.range.minY),t.lineTo(e.range.maxX,e.range.minY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.minY),t.lineTo(e.range.maxX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.maxX,e.range.maxY),t.lineTo(e.range.minX,e.range.maxY),t.stroke(),t.beginPath(),t.moveTo(e.range.minX,e.range.maxY),t.lineTo(e.range.minX,e.range.minY),t.stroke()}},$N=class{constructor(e,t,n){this._rng=Pb(`REPULSION SOLVER`),this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e}solve(){let e,t,n,r,i,a,o,s,c=this.body.nodes,l=this.physicsBody.physicsNodeIndices,u=this.physicsBody.forces,d=this.options.nodeDistance,f=-2/3/d;for(let p=0;p<l.length-1;p++){o=c[l[p]];for(let m=p+1;m<l.length;m++)s=c[l[m]],e=s.x-o.x,t=s.y-o.y,n=Math.sqrt(e*e+t*t),n===0&&(n=.1*this._rng(),e=n),n<2*d&&(a=n<.5*d?1:f*n+1.3333333333333333,a/=n,r=e*a,i=t*a,u[o.id].x-=r,u[o.id].y-=i,u[s.id].x+=r,u[s.id].y+=i)}}},eP=class{constructor(e,t,n){this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e,this.overlapAvoidanceFactor=Math.max(0,Math.min(1,this.options.avoidOverlap||0))}solve(){let e=this.body.nodes,t=this.physicsBody.physicsNodeIndices,n=this.physicsBody.forces,r=this.options.nodeDistance;for(let i=0;i<t.length-1;i++){let a=e[t[i]];for(let o=i+1;o<t.length;o++){let i=e[t[o]];if(a.level===i.level){let e=r+this.overlapAvoidanceFactor*((a.shape.radius||0)/2+(i.shape.radius||0)/2),t=i.x-a.x,o=i.y-a.y,s=Math.sqrt(t*t+o*o),c=.05,l;l=s<e?-((c*s)**2)+(c*e)**2:0,s!==0&&(l/=s);let u=t*l,d=o*l;n[a.id].x-=u,n[a.id].y-=d,n[i.id].x+=u,n[i.id].y+=d}}}}},tP=class{constructor(e,t,n){this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e}solve(){let e,t,n=this.physicsBody.physicsEdgeIndices,r=this.body.edges,i,a,o;for(let s=0;s<n.length;s++)t=r[n[s]],t.connected===!0&&t.toId!==t.fromId&&this.body.nodes[t.toId]!==void 0&&this.body.nodes[t.fromId]!==void 0&&(t.edgeType.via===void 0?(e=t.options.length===void 0?this.options.springLength*1.5:t.options.length,this._calculateSpringForce(t.from,t.to,e)):(e=t.options.length===void 0?this.options.springLength:t.options.length,i=t.to,a=t.edgeType.via,o=t.from,this._calculateSpringForce(i,a,.5*e),this._calculateSpringForce(a,o,.5*e)))}_calculateSpringForce(e,t,n){let r=e.x-t.x,i=e.y-t.y,a=Math.max(Math.sqrt(r*r+i*i),.01),o=this.options.springConstant*(n-a)/a,s=r*o,c=i*o;this.physicsBody.forces[e.id]!==void 0&&(this.physicsBody.forces[e.id].x+=s,this.physicsBody.forces[e.id].y+=c),this.physicsBody.forces[t.id]!==void 0&&(this.physicsBody.forces[t.id].x-=s,this.physicsBody.forces[t.id].y-=c)}},nP=class{constructor(e,t,n){this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e}solve(){let e,t,n,r,i,a,o,s,c=this.body.edges,l=.5,u=this.physicsBody.physicsEdgeIndices,d=this.physicsBody.physicsNodeIndices,f=this.physicsBody.forces;for(let e=0;e<d.length;e++){let t=d[e];f[t].springFx=0,f[t].springFy=0}for(let d=0;d<u.length;d++)t=c[u[d]],t.connected===!0&&(e=t.options.length===void 0?this.options.springLength:t.options.length,n=t.from.x-t.to.x,r=t.from.y-t.to.y,s=Math.sqrt(n*n+r*r),s=s===0?.01:s,o=this.options.springConstant*(e-s)/s,i=n*o,a=r*o,t.to.level==t.from.level?(f[t.toId]!==void 0&&(f[t.toId].x-=l*i,f[t.toId].y-=l*a),f[t.fromId]!==void 0&&(f[t.fromId].x+=l*i,f[t.fromId].y+=l*a)):(f[t.toId]!==void 0&&(f[t.toId].springFx-=i,f[t.toId].springFy-=a),f[t.fromId]!==void 0&&(f[t.fromId].springFx+=i,f[t.fromId].springFy+=a)));o=1;let p,m;for(let e=0;e<d.length;e++){let t=d[e];p=Math.min(o,Math.max(-o,f[t].springFx)),m=Math.min(o,Math.max(-o,f[t].springFy)),f[t].x+=p,f[t].y+=m}let h=0,g=0;for(let e=0;e<d.length;e++){let t=d[e];h+=f[t].x,g+=f[t].y}let _=h/d.length,v=g/d.length;for(let e=0;e<d.length;e++){let t=d[e];f[t].x-=_,f[t].y-=v}}},rP=class{constructor(e,t,n){this.body=e,this.physicsBody=t,this.setOptions(n)}setOptions(e){this.options=e}solve(){let e,t,n,r,i=this.body.nodes,a=this.physicsBody.physicsNodeIndices,o=this.physicsBody.forces;for(let s=0;s<a.length;s++)r=i[a[s]],e=-r.x,t=-r.y,n=Math.sqrt(e*e+t*t),this._calculateForces(n,e,t,o,r)}_calculateForces(e,t,n,r,i){let a=e===0?0:this.options.centralGravity/e;r[i.id].x=t*a,r[i.id].y=n*a}},iP=class extends QN{constructor(e,t,n){super(e,t,n),this._rng=Pb(`FORCE ATLAS 2 BASED REPULSION SOLVER`)}_calculateForces(e,t,n,r,i){e===0&&(e=.1*this._rng(),t=e),this.overlapAvoidanceFactor<1&&r.shape.radius&&(e=Math.max(.1+this.overlapAvoidanceFactor*r.shape.radius,e-r.shape.radius));let a=r.edges.length+1,o=this.options.gravitationalConstant*i.mass*r.options.mass*a/e**2,s=t*o,c=n*o;this.physicsBody.forces[r.id].x+=s,this.physicsBody.forces[r.id].y+=c}},aP=class extends rP{constructor(e,t,n){super(e,t,n)}_calculateForces(e,t,n,r,i){if(e>0){let e=i.edges.length+1,a=this.options.centralGravity*e*i.options.mass;r[i.id].x=t*a,r[i.id].y=n*a}}},oP=class{constructor(e){this.body=e,this.physicsBody={physicsNodeIndices:[],physicsEdgeIndices:[],forces:{},velocities:{}},this.physicsEnabled=!0,this.simulationInterval=1e3/60,this.requiresTimeout=!0,this.previousStates={},this.referenceState={},this.freezeCache={},this.renderTimer=void 0,this.adaptiveTimestep=!1,this.adaptiveTimestepEnabled=!1,this.adaptiveCounter=0,this.adaptiveInterval=3,this.stabilized=!1,this.startedStabilization=!1,this.stabilizationIterations=0,this.ready=!1,this.options={},this.defaultOptions={enabled:!0,barnesHut:{theta:.5,gravitationalConstant:-2e3,centralGravity:.3,springLength:95,springConstant:.04,damping:.09,avoidOverlap:0},forceAtlas2Based:{theta:.5,gravitationalConstant:-50,centralGravity:.01,springConstant:.08,springLength:100,damping:.4,avoidOverlap:0},repulsion:{centralGravity:.2,springLength:200,springConstant:.05,nodeDistance:100,damping:.09,avoidOverlap:0},hierarchicalRepulsion:{centralGravity:0,springLength:100,springConstant:.01,nodeDistance:120,damping:.09},maxVelocity:50,minVelocity:.75,solver:`barnesHut`,stabilization:{enabled:!0,iterations:1e3,updateInterval:50,onlyDynamicEdges:!1,fit:!0},timestep:.5,adaptiveTimestep:!0,wind:{x:0,y:0}},Jo(this.options,this.defaultOptions),this.timestep=.5,this.layoutFailed=!1,this.bindEventListeners()}bindEventListeners(){this.body.emitter.on(`initPhysics`,()=>{this.initPhysics()}),this.body.emitter.on(`_layoutFailed`,()=>{this.layoutFailed=!0}),this.body.emitter.on(`resetPhysics`,()=>{this.stopSimulation(),this.ready=!1}),this.body.emitter.on(`disablePhysics`,()=>{this.physicsEnabled=!1,this.stopSimulation()}),this.body.emitter.on(`restorePhysics`,()=>{this.setOptions(this.options),this.ready===!0&&this.startSimulation()}),this.body.emitter.on(`startSimulation`,()=>{this.ready===!0&&this.startSimulation()}),this.body.emitter.on(`stopSimulation`,()=>{this.stopSimulation()}),this.body.emitter.on(`destroy`,()=>{this.stopSimulation(!1),this.body.emitter.off()}),this.body.emitter.on(`_dataChanged`,()=>{this.updatePhysicsData()})}setOptions(e){if(e!==void 0)if(e===!1)this.options.enabled=!1,this.physicsEnabled=!1,this.stopSimulation();else if(e===!0)this.options.enabled=!0,this.physicsEnabled=!0,this.startSimulation();else{this.physicsEnabled=!0,Qb([`stabilization`],this.options,e),_x(this.options,e,`stabilization`),e.enabled===void 0&&(this.options.enabled=!0),this.options.enabled===!1&&(this.physicsEnabled=!1,this.stopSimulation());let t=this.options.wind;t&&((typeof t.x!=`number`||XC(t.x))&&(t.x=0),(typeof t.y!=`number`||XC(t.y))&&(t.y=0)),this.timestep=this.options.timestep}this.init()}init(){let e;this.options.solver===`forceAtlas2Based`?(e=this.options.forceAtlas2Based,this.nodesSolver=new iP(this.body,this.physicsBody,e),this.edgesSolver=new tP(this.body,this.physicsBody,e),this.gravitySolver=new aP(this.body,this.physicsBody,e)):this.options.solver===`repulsion`?(e=this.options.repulsion,this.nodesSolver=new $N(this.body,this.physicsBody,e),this.edgesSolver=new tP(this.body,this.physicsBody,e),this.gravitySolver=new rP(this.body,this.physicsBody,e)):this.options.solver===`hierarchicalRepulsion`?(e=this.options.hierarchicalRepulsion,this.nodesSolver=new eP(this.body,this.physicsBody,e),this.edgesSolver=new nP(this.body,this.physicsBody,e),this.gravitySolver=new rP(this.body,this.physicsBody,e)):(e=this.options.barnesHut,this.nodesSolver=new QN(this.body,this.physicsBody,e),this.edgesSolver=new tP(this.body,this.physicsBody,e),this.gravitySolver=new rP(this.body,this.physicsBody,e)),this.modelOptions=e}initPhysics(){this.physicsEnabled===!0&&this.options.enabled===!0?this.options.stabilization.enabled===!0?this.stabilize():(this.stabilized=!1,this.ready=!0,this.body.emitter.emit(`fit`,{},this.layoutFailed),this.startSimulation()):(this.ready=!0,this.body.emitter.emit(`fit`))}startSimulation(){if(this.physicsEnabled===!0&&this.options.enabled===!0){if(this.stabilized=!1,this.adaptiveTimestep=!1,this.body.emitter.emit(`_resizeNodes`),this.viewFunction===void 0){var e;this.viewFunction=B(e=this.simulationStep).call(e,this),this.body.emitter.on(`initRedraw`,this.viewFunction),this.body.emitter.emit(`_startRendering`)}}else this.body.emitter.emit(`_redraw`)}stopSimulation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.stabilized=!0,e===!0&&this._emitStabilized(),this.viewFunction!==void 0&&(this.body.emitter.off(`initRedraw`,this.viewFunction),this.viewFunction=void 0,e===!0&&this.body.emitter.emit(`_stopRendering`))}simulationStep(){let e=lp();this.physicsTick(),(lp()-e<.4*this.simulationInterval||this.runDoubleSpeed===!0)&&this.stabilized===!1&&(this.physicsTick(),this.runDoubleSpeed=!0),this.stabilized===!0&&this.stopSimulation()}_emitStabilized(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.stabilizationIterations;(this.stabilizationIterations>1||this.startedStabilization===!0)&&B_(()=>{this.body.emitter.emit(`stabilized`,{iterations:e}),this.startedStabilization=!1,this.stabilizationIterations=0},0)}physicsStep(){this.gravitySolver.solve(),this.nodesSolver.solve(),this.edgesSolver.solve(),this.moveNodes()}adjustTimeStep(){let e=1.2;this._evaluateStepQuality()===!0?this.timestep=e*this.timestep:this.timestep/e<this.options.timestep?this.timestep=this.options.timestep:(this.adaptiveCounter=-1,this.timestep=Math.max(this.options.timestep,this.timestep/e))}physicsTick(){this._startStabilizing(),this.stabilized!==!0&&(this.adaptiveTimestep===!0&&this.adaptiveTimestepEnabled===!0?(this.adaptiveCounter%this.adaptiveInterval===0?(this.timestep=2*this.timestep,this.physicsStep(),this.revert(),this.timestep=.5*this.timestep,this.physicsStep(),this.physicsStep(),this.adjustTimeStep()):this.physicsStep(),this.adaptiveCounter+=1):(this.timestep=this.options.timestep,this.physicsStep()),this.stabilized===!0&&this.revert(),this.stabilizationIterations++)}updatePhysicsData(){this.physicsBody.forces={},this.physicsBody.physicsNodeIndices=[],this.physicsBody.physicsEdgeIndices=[];let e=this.body.nodes,t=this.body.edges;for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t].options.physics===!0&&this.physicsBody.physicsNodeIndices.push(e[t].id);for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&t[e].options.physics===!0&&this.physicsBody.physicsEdgeIndices.push(t[e].id);for(let e=0;e<this.physicsBody.physicsNodeIndices.length;e++){let t=this.physicsBody.physicsNodeIndices[e];this.physicsBody.forces[t]={x:0,y:0},this.physicsBody.velocities[t]===void 0&&(this.physicsBody.velocities[t]={x:0,y:0})}for(let t in this.physicsBody.velocities)e[t]===void 0&&delete this.physicsBody.velocities[t]}revert(){let e=Xf(this.previousStates),t=this.body.nodes,n=this.physicsBody.velocities;this.referenceState={};for(let r=0;r<e.length;r++){let i=e[r];t[i]===void 0?delete this.previousStates[i]:t[i].options.physics===!0&&(this.referenceState[i]={positions:{x:t[i].x,y:t[i].y}},n[i].x=this.previousStates[i].vx,n[i].y=this.previousStates[i].vy,t[i].x=this.previousStates[i].x,t[i].y=this.previousStates[i].y)}}_evaluateStepQuality(){let e,t,n,r=this.body.nodes,i=this.referenceState;for(let a in this.referenceState)if(Object.prototype.hasOwnProperty.call(this.referenceState,a)&&r[a]!==void 0&&(e=r[a].x-i[a].positions.x,t=r[a].y-i[a].positions.y,n=Math.sqrt(e**2+t**2),n>.3))return!1;return!0}moveNodes(){let e=this.physicsBody.physicsNodeIndices,t=0,n=0;for(let r=0;r<e.length;r++){let i=e[r],a=this._performStep(i);t=Math.max(t,a),n+=a}this.adaptiveTimestepEnabled=n/e.length<5,this.stabilized=t<this.options.minVelocity}calculateComponentVelocity(e,t,n){let r=(t-this.modelOptions.damping*e)/n;e+=r*this.timestep;let i=this.options.maxVelocity||1e9;return Math.abs(e)>i&&(e=e>0?i:-i),e}_performStep(e){let t=this.body.nodes[e],n=this.physicsBody.forces[e];this.options.wind&&(n.x+=this.options.wind.x,n.y+=this.options.wind.y);let r=this.physicsBody.velocities[e];return this.previousStates[e]={x:t.x,y:t.y,vx:r.x,vy:r.y},t.options.fixed.x===!1?(r.x=this.calculateComponentVelocity(r.x,n.x,t.options.mass),t.x+=r.x*this.timestep):(n.x=0,r.x=0),t.options.fixed.y===!1?(r.y=this.calculateComponentVelocity(r.y,n.y,t.options.mass),t.y+=r.y*this.timestep):(n.y=0,r.y=0),Math.sqrt(r.x**2+r.y**2)}_freezeNodes(){let e=this.body.nodes;for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t].x&&e[t].y){let n=e[t].options.fixed;this.freezeCache[t]={x:n.x,y:n.y},n.x=!0,n.y=!0}}_restoreFrozenNodes(){let e=this.body.nodes;for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.freezeCache[t]!==void 0&&(e[t].options.fixed.x=this.freezeCache[t].x,e[t].options.fixed.y=this.freezeCache[t].y);this.freezeCache={}}stabilize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.stabilization.iterations;if(typeof e!=`number`&&(e=this.options.stabilization.iterations,console.error(`The stabilize method needs a numeric amount of iterations. Switching to default: `,e)),this.physicsBody.physicsNodeIndices.length===0){this.ready=!0;return}this.adaptiveTimestep=this.options.adaptiveTimestep,this.body.emitter.emit(`_resizeNodes`),this.stopSimulation(),this.stabilized=!1,this.body.emitter.emit(`_blockRedraw`),this.targetIterations=e,this.options.stabilization.onlyDynamicEdges===!0&&this._freezeNodes(),this.stabilizationIterations=0,B_(()=>this._stabilizationBatch(),0)}_startStabilizing(){return this.startedStabilization===!0?!1:(this.body.emitter.emit(`startStabilizing`),this.startedStabilization=!0,!0)}_stabilizationBatch(){let e=()=>this.stabilized===!1&&this.stabilizationIterations<this.targetIterations,t=()=>{this.body.emitter.emit(`stabilizationProgress`,{iterations:this.stabilizationIterations,total:this.targetIterations})};this._startStabilizing()&&t();let n=0;for(;e()&&n<this.options.stabilization.updateInterval;)this.physicsTick(),n++;if(t(),e()){var r;B_(B(r=this._stabilizationBatch).call(r,this),0)}else this._finalizeStabilization()}_finalizeStabilization(){this.body.emitter.emit(`_allowRedraw`),this.options.stabilization.fit===!0&&this.body.emitter.emit(`fit`),this.options.stabilization.onlyDynamicEdges===!0&&this._restoreFrozenNodes(),this.body.emitter.emit(`stabilizationIterationsDone`),this.body.emitter.emit(`_requestRedraw`),this.stabilized===!0?this._emitStabilized():this.startSimulation(),this.ready=!0}_drawForces(e){for(let t=0;t<this.physicsBody.physicsNodeIndices.length;t++){let n=this.physicsBody.physicsNodeIndices[t],r=this.body.nodes[n],i=this.physicsBody.forces[n],a=Math.sqrt(i.x**2+i.x**2),o=Math.min(Math.max(5,a),15),s=3*o,c=dx((180-Math.min(1,Math.max(0,.03*a))*180)/360,1,1),l={x:r.x+20*i.x,y:r.y+20*i.y};e.lineWidth=o,e.strokeStyle=c,e.beginPath(),e.moveTo(r.x,r.y),e.lineTo(l.x,l.y),e.stroke();let u=Math.atan2(i.y,i.x);e.fillStyle=c,RN.draw(e,{type:`arrow`,point:l,angle:u,length:s}),av(e).call(e)}}},sP=class{constructor(){}static getRange(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,r=-1e9,i=1e9,a=-1e9,o;if(t.length>0)for(let s=0;s<t.length;s++)o=e[t[s]],i>o.shape.boundingBox.left&&(i=o.shape.boundingBox.left),a<o.shape.boundingBox.right&&(a=o.shape.boundingBox.right),n>o.shape.boundingBox.top&&(n=o.shape.boundingBox.top),r<o.shape.boundingBox.bottom&&(r=o.shape.boundingBox.bottom);return i===1e9&&a===-1e9&&n===1e9&&r===-1e9&&(n=0,r=0,i=0,a=0),{minX:i,maxX:a,minY:n,maxY:r}}static getRangeCore(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=1e9,r=-1e9,i=1e9,a=-1e9,o;if(t.length>0)for(let s=0;s<t.length;s++)o=e[t[s]],i>o.x&&(i=o.x),a<o.x&&(a=o.x),n>o.y&&(n=o.y),r<o.y&&(r=o.y);return i===1e9&&a===-1e9&&n===1e9&&r===-1e9&&(n=0,r=0,i=0,a=0),{minX:i,maxX:a,minY:n,maxY:r}}static findCenter(e){return{x:.5*(e.maxX+e.minX),y:.5*(e.maxY+e.minY)}}static cloneOptions(e,t){let n={};return t===void 0||t===`node`?($b(n,e.options,!0),n.x=e.x,n.y=e.y,n.amountOfConnections=e.edges.length):$b(n,e.options,!0),n}},cP=class extends uN{constructor(e,t,n,r,i,a){super(e,t,n,r,i,a),this.isCluster=!0,this.containedNodes={},this.containedEdges={}}_openChildCluster(e){let t=this.body.nodes[e];if(this.containedNodes[e]===void 0)throw Error(`node with id: `+e+` not in current cluster`);if(!t.isCluster)throw Error(`node with id: `+e+` is not a cluster`);delete this.containedNodes[e],ix(t.edges,e=>{delete this.containedEdges[e.id]}),ix(t.containedNodes,(e,t)=>{this.containedNodes[t]=e}),t.containedNodes={},ix(t.containedEdges,(e,t)=>{this.containedEdges[t]=e}),t.containedEdges={},ix(t.edges,e=>{ix(this.edges,t=>{var n,r;let i=Pg(n=t.clusteringEdgeReplacingIds).call(n,e.id);i!==-1&&(ix(e.clusteringEdgeReplacingIds,e=>{t.clusteringEdgeReplacingIds.push(e),this.body.edges[e].edgeReplacedById=t.id}),hm(r=t.clusteringEdgeReplacingIds).call(r,i,1))})}),t.edges=[]}},lP=class{constructor(e){this.body=e,this.clusteredNodes={},this.clusteredEdges={},this.options={},this.defaultOptions={},Jo(this.options,this.defaultOptions),this.body.emitter.on(`_resetData`,()=>{this.clusteredNodes={},this.clusteredEdges={}})}clusterByHubsize(e,t){e===void 0?e=this._getHubSize():typeof e==`object`&&(t=this._checkOptions(e),e=this._getHubSize());let n=[];for(let t=0;t<this.body.nodeIndices.length;t++){let r=this.body.nodes[this.body.nodeIndices[t]];r.edges.length>=e&&n.push(r.id)}for(let e=0;e<n.length;e++)this.clusterByConnection(n[e],t,!0);this.body.emitter.emit(`_dataChanged`)}cluster(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.joinCondition===void 0)throw Error(`Cannot call clusterByNodeData without a joinCondition function in the options.`);e=this._checkOptions(e);let n={},r={};ix(this.body.nodes,(t,i)=>{t.options&&e.joinCondition(t.options)===!0&&(n[i]=t,ix(t.edges,e=>{this.clusteredEdges[e.id]===void 0&&(r[e.id]=e)}))}),this._cluster(n,r,e,t)}clusterByEdgeCount(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;t=this._checkOptions(t);let r=[],i={},a,o,s;for(let n=0;n<this.body.nodeIndices.length;n++){let c={},l={},u=this.body.nodeIndices[n],d=this.body.nodes[u];if(i[u]===void 0){s=0,o=[];for(let e=0;e<d.edges.length;e++)a=d.edges[e],this.clusteredEdges[a.id]===void 0&&(a.toId!==a.fromId&&s++,o.push(a));if(s===e){let e=function(e){if(t.joinCondition===void 0||t.joinCondition===null)return!0;let n=sP.cloneOptions(e);return t.joinCondition(n)},n=!0;for(let t=0;t<o.length;t++){a=o[t];let r=this._getConnectedId(a,u);if(e(d))l[a.id]=a,c[u]=d,c[r]=this.body.nodes[r],i[u]=!0;else{n=!1;break}}if(Xf(c).length>0&&Xf(l).length>0&&n===!0){let e=function(){for(let e=0;e<r.length;++e)for(let t in c)if(r[e].nodes[t]!==void 0)return r[e]}();if(e!==void 0){for(let t in c)e.nodes[t]===void 0&&(e.nodes[t]=c[t]);for(let t in l)e.edges[t]===void 0&&(e.edges[t]=l[t])}else r.push({nodes:c,edges:l})}}}}for(let e=0;e<r.length;e++)this._cluster(r[e].nodes,r[e].edges,t,!1);n===!0&&this.body.emitter.emit(`_dataChanged`)}clusterOutliers(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(1,e,t)}clusterBridges(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.clusterByEdgeCount(2,e,t)}clusterByConnection(e,t){var n;let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw Error(`No nodeId supplied to clusterByConnection!`);if(this.body.nodes[e]===void 0)throw Error(`The nodeId given to clusterByConnection does not exist!`);let i=this.body.nodes[e];t=this._checkOptions(t,i),t.clusterNodeProperties.x===void 0&&(t.clusterNodeProperties.x=i.x),t.clusterNodeProperties.y===void 0&&(t.clusterNodeProperties.y=i.y),t.clusterNodeProperties.fixed===void 0&&(t.clusterNodeProperties.fixed={},t.clusterNodeProperties.fixed.x=i.options.fixed.x,t.clusterNodeProperties.fixed.y=i.options.fixed.y);let a={},o={},s=i.id,c=sP.cloneOptions(i);a[s]=i;for(let e=0;e<i.edges.length;e++){let n=i.edges[e];if(this.clusteredEdges[n.id]===void 0){let e=this._getConnectedId(n,s);if(this.clusteredNodes[e]===void 0)if(e!==s)if(t.joinCondition===void 0)o[n.id]=n,a[e]=this.body.nodes[e];else{let r=sP.cloneOptions(this.body.nodes[e]);t.joinCondition(c,r)===!0&&(o[n.id]=n,a[e]=this.body.nodes[e])}else o[n.id]=n}}let l=Lf(n=Xf(a)).call(n,function(e){return a[e].id});for(let e in a){if(!Object.prototype.hasOwnProperty.call(a,e))continue;let t=a[e];for(let e=0;e<t.edges.length;e++){let n=t.edges[e];Pg(l).call(l,this._getConnectedId(n,t.id))>-1&&(o[n.id]=n)}}this._cluster(a,o,t,r)}_createClusterEdges(e,t,n,r){let i,a,o,s,c,l,u=Xf(e),d=[];for(let r=0;r<u.length;r++){a=u[r],o=e[a];for(let r=0;r<o.edges.length;r++)i=o.edges[r],this.clusteredEdges[i.id]===void 0&&(i.toId==i.fromId?t[i.id]=i:i.toId==a?(s=n.id,c=i.fromId,l=c):(s=i.toId,c=n.id,l=s),e[l]===void 0&&d.push({edge:i,fromId:c,toId:s}))}let f=[],p=function(e){for(let t=0;t<f.length;t++){let n=f[t],r=e.fromId===n.fromId&&e.toId===n.toId,i=e.fromId===n.toId&&e.toId===n.fromId;if(r||i)return n}return null};for(let e=0;e<d.length;e++){let t=d[e],n=t.edge,i=p(t);i===null?(i=this._createClusteredEdge(t.fromId,t.toId,n,r),f.push(i)):i.clusteringEdgeReplacingIds.push(n.id),this.body.edges[n.id].edgeReplacedById=i.id,this._backupEdgeOptions(n),n.setOptions({physics:!1})}}_checkOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e.clusterEdgeProperties===void 0&&(e.clusterEdgeProperties={}),e.clusterNodeProperties===void 0&&(e.clusterNodeProperties={}),e}_cluster(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=[];for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.clusteredNodes[t]!==void 0&&i.push(t);for(let t=0;t<i.length;++t)delete e[i[t]];if(Xf(e).length==0||Xf(e).length==1&&n.clusterNodeProperties.allowSingleNodeCluster!=1)return;let a=$b({},n.clusterNodeProperties);if(n.processProperties!==void 0){let r=[];for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let n=sP.cloneOptions(e[t]);r.push(n)}let i=[];for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&e.substr(0,12)!==`clusterEdge:`){let n=sP.cloneOptions(t[e],`edge`);i.push(n)}if(a=n.processProperties(a,r,i),!a)throw Error(`The processProperties function does not return properties!`)}a.id===void 0&&(a.id=`cluster:`+Gj());let o=a.id;a.label===void 0&&(a.label=`cluster`);let s;a.x===void 0&&(s=this._getClusterPosition(e),a.x=s.x),a.y===void 0&&(s===void 0&&(s=this._getClusterPosition(e)),a.y=s.y),a.id=o;let c=this.body.functions.createNode(a,cP);c.containedNodes=e,c.containedEdges=t,c.clusterEdgeProperties=n.clusterEdgeProperties,this.body.nodes[a.id]=c,this._clusterEdges(e,t,a,n.clusterEdgeProperties),a.id=void 0,r===!0&&this.body.emitter.emit(`_dataChanged`)}_backupEdgeOptions(e){this.clusteredEdges[e.id]===void 0&&(this.clusteredEdges[e.id]={physics:e.options.physics})}_restoreEdge(e){let t=this.clusteredEdges[e.id];t!==void 0&&(e.setOptions({physics:t.physics}),delete this.clusteredEdges[e.id])}isCluster(e){return this.body.nodes[e]===void 0?(console.error(`Node does not exist.`),!1):this.body.nodes[e].isCluster===!0}_getClusterPosition(e){let t=Xf(e),n=e[t[0]].x,r=e[t[0]].x,i=e[t[0]].y,a=e[t[0]].y,o;for(let s=1;s<t.length;s++)o=e[t[s]],n=o.x<n?o.x:n,r=o.x>r?o.x:r,i=o.y<i?o.y:i,a=o.y>a?o.y:a;return{x:.5*(n+r),y:.5*(i+a)}}openCluster(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0)throw Error(`No clusterNodeId supplied to openCluster.`);let r=this.body.nodes[e];if(r===void 0)throw Error(`The clusterNodeId supplied to openCluster does not exist.`);if(r.isCluster!==!0||r.containedNodes===void 0||r.containedEdges===void 0)throw Error(`The node:`+e+` is not a valid cluster.`);let i=this.findNode(e),a=Pg(i).call(i,e)-1;if(a>=0){let t=i[a];this.body.nodes[t]._openChildCluster(e),delete this.body.nodes[e],n===!0&&this.body.emitter.emit(`_dataChanged`);return}let o=r.containedNodes,s=r.containedEdges;if(t!==void 0&&t.releaseFunction!==void 0&&typeof t.releaseFunction==`function`){let e={},n={x:r.x,y:r.y};for(let t in o)if(Object.prototype.hasOwnProperty.call(o,t)){let n=this.body.nodes[t];e[t]={x:n.x,y:n.y}}let i=t.releaseFunction(n,e);for(let e in o)if(Object.prototype.hasOwnProperty.call(o,e)){let t=this.body.nodes[e];i[e]!==void 0&&(t.x=i[e].x===void 0?r.x:i[e].x,t.y=i[e].y===void 0?r.y:i[e].y)}}else ix(o,function(e){e.options.fixed.x===!1&&(e.x=r.x),e.options.fixed.y===!1&&(e.y=r.y)});for(let e in o)if(Object.prototype.hasOwnProperty.call(o,e)){let t=this.body.nodes[e];t.vx=r.vx,t.vy=r.vy,t.setOptions({physics:!0}),delete this.clusteredNodes[e]}let c=[];for(let e=0;e<r.edges.length;e++)c.push(r.edges[e]);for(let t=0;t<c.length;t++){let n=c[t],r=this._getConnectedId(n,e),i=this.clusteredNodes[r];for(let e=0;e<n.clusteringEdgeReplacingIds.length;e++){let t=n.clusteringEdgeReplacingIds[e],a=this.body.edges[t];if(a!==void 0)if(i!==void 0){let e=this.body.nodes[i.clusterId];e.containedEdges[a.id]=a,delete s[a.id];let t=a.fromId,n=a.toId;a.toId==r?n=i.clusterId:t=i.clusterId,this._createClusteredEdge(t,n,a,e.clusterEdgeProperties,{hidden:!1,physics:!0})}else this._restoreEdge(a)}n.remove()}for(let e in s)Object.prototype.hasOwnProperty.call(s,e)&&this._restoreEdge(s[e]);delete this.body.nodes[e],n===!0&&this.body.emitter.emit(`_dataChanged`)}getNodesInCluster(e){let t=[];if(this.isCluster(e)===!0){let n=this.body.nodes[e].containedNodes;for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&t.push(this.body.nodes[e].id)}return t}findNode(e){let t=[],n=0,r;for(;this.clusteredNodes[e]!==void 0&&n<100;){if(r=this.body.nodes[e],r===void 0)return[];t.push(r.id),e=this.clusteredNodes[e].clusterId,n++}return r=this.body.nodes[e],r===void 0?[]:(t.push(r.id),qp(t).call(t),t)}updateClusteredNode(e,t){if(e===void 0)throw Error(`No clusteredNodeId supplied to updateClusteredNode.`);if(t===void 0)throw Error(`No newOptions supplied to updateClusteredNode.`);if(this.body.nodes[e]===void 0)throw Error(`The clusteredNodeId supplied to updateClusteredNode does not exist.`);this.body.nodes[e].setOptions(t),this.body.emitter.emit(`_dataChanged`)}updateEdge(e,t){if(e===void 0)throw Error(`No startEdgeId supplied to updateEdge.`);if(t===void 0)throw Error(`No newOptions supplied to updateEdge.`);if(this.body.edges[e]===void 0)throw Error(`The startEdgeId supplied to updateEdge does not exist.`);let n=this.getClusteredEdges(e);for(let e=0;e<n.length;e++)this.body.edges[n[e]].setOptions(t);this.body.emitter.emit(`_dataChanged`)}getClusteredEdges(e){let t=[],n=0;for(;e!==void 0&&this.body.edges[e]!==void 0&&n<100;)t.push(this.body.edges[e].id),e=this.body.edges[e].edgeReplacedById,n++;return qp(t).call(t),t}getBaseEdge(e){return this.getBaseEdges(e)[0]}getBaseEdges(e){let t=[e],n=[],r=[],i=0;for(;t.length>0&&i<100;){let e=t.pop();if(e===void 0)continue;let a=this.body.edges[e];if(a===void 0)continue;i++;let o=a.clusteringEdgeReplacingIds;if(o===void 0)r.push(e);else for(let e=0;e<o.length;++e){let r=o[e];Pg(t).call(t,o)!==-1||Pg(n).call(n,o)!==-1||t.push(r)}n.push(e)}return r}_getConnectedId(e,t){return e.toId==t?(e.fromId,e.fromId):e.toId}_getHubSize(){let e=0,t=0,n=0,r=0;for(let i=0;i<this.body.nodeIndices.length;i++){let a=this.body.nodes[this.body.nodeIndices[i]];a.edges.length>r&&(r=a.edges.length),e+=a.edges.length,t+=a.edges.length**2,n+=1}e/=n,t/=n;let i=t-e**2,a=Math.floor(e+2*Math.sqrt(i));return a>r&&(a=r),a}_createClusteredEdge(e,t,n,r,i){let a=sP.cloneOptions(n,`edge`);$b(a,r),a.from=e,a.to=t,a.id=`clusterEdge:`+Gj(),i!==void 0&&$b(a,i);let o=this.body.functions.createEdge(a);return o.clusteringEdgeReplacingIds=[n.id],o.connect(),this.body.edges[o.id]=o,o}_clusterEdges(e,t,n,r){if(t instanceof XN){let e=t,n={};n[e.id]=e,t=n}if(e instanceof uN){let t=e,n={};n[t.id]=t,e=n}if(n==null)throw Error(`_clusterEdges: parameter clusterNode required`);r===void 0&&(r=n.clusterEdgeProperties),this._createClusterEdges(e,t,n,r);for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&this.body.edges[e]!==void 0){let t=this.body.edges[e];this._backupEdgeOptions(t),t.setOptions({physics:!1})}for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this.clusteredNodes[t]={clusterId:n.id,node:this.body.nodes[t]},this.body.nodes[t].setOptions({physics:!1}))}_getClusterNodeForNode(e){if(e===void 0)return;let t=this.clusteredNodes[e];if(t===void 0)return;let n=t.clusterId;if(n!==void 0)return this.body.nodes[n]}_filter(e,t){let n=[];return ix(e,e=>{t(e)&&n.push(e)}),n}_updateState(){let e,t=[],n={},r=e=>{ix(this.body.nodes,t=>{t.isCluster===!0&&e(t)})};for(e in this.clusteredNodes)Object.prototype.hasOwnProperty.call(this.clusteredNodes,e)&&this.body.nodes[e]===void 0&&t.push(e);r(function(e){for(let n=0;n<t.length;n++)delete e.containedNodes[t[n]]});for(let e=0;e<t.length;e++)delete this.clusteredNodes[t[e]];ix(this.clusteredEdges,e=>{let t=this.body.edges[e];(t===void 0||!t.endPointsValid())&&(n[e]=e)}),r(function(e){ix(e.containedEdges,(e,t)=>{!e.endPointsValid()&&!n[t]&&(n[t]=t)})}),ix(this.body.edges,(e,t)=>{let r=!0,i=e.clusteringEdgeReplacingIds;if(i!==void 0){let e=0;ix(i,t=>{let n=this.body.edges[t];n!==void 0&&n.endPointsValid()&&(e+=1)}),r=e>0}(!e.endPointsValid()||!r)&&(n[t]=t)}),r(e=>{ix(n,t=>{delete e.containedEdges[t],ix(e.edges,(r,i)=>{if(r.id===t){e.edges[i]=null;return}r.clusteringEdgeReplacingIds=this._filter(r.clusteringEdgeReplacingIds,function(e){return!n[e]})}),e.edges=this._filter(e.edges,function(e){return e!==null})})}),ix(n,e=>{delete this.clusteredEdges[e]}),ix(n,e=>{delete this.body.edges[e]}),ix(Xf(this.body.edges),e=>{let t=this.body.edges[e],n=this._isClusteredNode(t.fromId)||this._isClusteredNode(t.toId);if(n!==this._isClusteredEdge(t.id))if(n){let e=this._getClusterNodeForNode(t.fromId);e!==void 0&&this._clusterEdges(this.body.nodes[t.fromId],t,e);let n=this._getClusterNodeForNode(t.toId);n!==void 0&&this._clusterEdges(this.body.nodes[t.toId],t,n)}else delete this._clusterEdges[e],this._restoreEdge(t)});let i=!1,a=!0;for(;a;){let e=[];r(function(t){let n=Xf(t.containedNodes).length,r=t.options.allowSingleNodeCluster===!0;(r&&n<1||!r&&n<2)&&e.push(t.id)});for(let t=0;t<e.length;++t)this.openCluster(e[t],{},!1);a=e.length>0,i||=a}i&&this._updateState()}_isClusteredNode(e){return this.clusteredNodes[e]!==void 0}_isClusteredEdge(e){return this.clusteredEdges[e]!==void 0}},uP=class{constructor(e,t){this.body=e,this.canvas=t,this.redrawRequested=!1,this.requestAnimationFrameRequestId=void 0,this.renderingActive=!1,this.renderRequests=0,this.allowRedraw=!0,this.dragging=!1,this.zooming=!1,this.options={},this.defaultOptions={hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1},Jo(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e;this.body.emitter.on(`dragStart`,()=>{this.dragging=!0}),this.body.emitter.on(`dragEnd`,()=>{this.dragging=!1}),this.body.emitter.on(`zoom`,()=>{this.zooming=!0,window.clearTimeout(this.zoomTimeoutId),this.zoomTimeoutId=B_(()=>{var e;this.zooming=!1,B(e=this._requestRedraw).call(e,this)()},250)}),this.body.emitter.on(`_resizeNodes`,()=>{this._resizeNodes()}),this.body.emitter.on(`_redraw`,()=>{this.renderingActive===!1&&this._redraw()}),this.body.emitter.on(`_blockRedraw`,()=>{this.allowRedraw=!1}),this.body.emitter.on(`_allowRedraw`,()=>{this.allowRedraw=!0,this.redrawRequested=!1}),this.body.emitter.on(`_requestRedraw`,B(e=this._requestRedraw).call(e,this)),this.body.emitter.on(`_startRendering`,()=>{this.renderRequests+=1,this.renderingActive=!0,this._startRendering()}),this.body.emitter.on(`_stopRendering`,()=>{--this.renderRequests,this.renderingActive=this.renderRequests>0,this.requestAnimationFrameRequestId=void 0}),this.body.emitter.on(`destroy`,()=>{this.renderRequests=0,this.allowRedraw=!1,this.renderingActive=!1,window.cancelAnimationFrame(this.requestAnimationFrameRequestId),this.body.emitter.off()})}setOptions(e){e!==void 0&&Zb([`hideEdgesOnDrag`,`hideEdgesOnZoom`,`hideNodesOnDrag`],this.options,e)}_startRendering(){if(this.renderingActive===!0&&this.requestAnimationFrameRequestId===void 0){var e;this.requestAnimationFrameRequestId=window.requestAnimationFrame(B(e=this._renderStep).call(e,this),this.simulationInterval)}}_renderStep(){this.renderingActive===!0&&(this.requestAnimationFrameRequestId=void 0,this._startRendering(),this._redraw())}redraw(){this.body.emitter.emit(`setSize`),this._redraw()}_requestRedraw(){this.redrawRequested!==!0&&this.renderingActive===!1&&this.allowRedraw===!0&&(this.redrawRequested=!0,window.requestAnimationFrame(()=>{this._redraw(!1)}))}_redraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(this.allowRedraw===!0){this.body.emitter.emit(`initRedraw`),this.redrawRequested=!1;let t={drawExternalLabels:null};(this.canvas.frame.canvas.width===0||this.canvas.frame.canvas.height===0)&&this.canvas.setSize(),this.canvas.setTransform();let n=this.canvas.getContext(),r=this.canvas.frame.canvas.clientWidth,i=this.canvas.frame.canvas.clientHeight;if(n.clearRect(0,0,r,i),this.canvas.frame.clientWidth===0)return;if(n.save(),n.translate(this.body.view.translation.x,this.body.view.translation.y),n.scale(this.body.view.scale,this.body.view.scale),n.beginPath(),this.body.emitter.emit(`beforeDrawing`,n),n.closePath(),e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawEdges(n),this.dragging===!1||this.dragging===!0&&this.options.hideNodesOnDrag===!1){let{drawExternalLabels:r}=this._drawNodes(n,e);t.drawExternalLabels=r}e===!1&&(this.dragging===!1||this.dragging===!0&&this.options.hideEdgesOnDrag===!1)&&(this.zooming===!1||this.zooming===!0&&this.options.hideEdgesOnZoom===!1)&&this._drawArrows(n),t.drawExternalLabels!=null&&t.drawExternalLabels(),e===!1&&this._drawSelectionBox(n),n.beginPath(),this.body.emitter.emit(`afterDrawing`,n),n.closePath(),n.restore(),e===!0&&n.clearRect(0,0,r,i)}}_resizeNodes(){this.canvas.setTransform();let e=this.canvas.getContext();e.save(),e.translate(this.body.view.translation.x,this.body.view.translation.y),e.scale(this.body.view.scale,this.body.view.scale);let t=this.body.nodes,n;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n=t[r],n.resize(e),n.updateBoundingBox(e,n.selected));e.restore()}_drawNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.body.nodes,r=this.body.nodeIndices,i,a=[],o=[],s=this.canvas.DOMtoCanvas({x:-20,y:-20}),c=this.canvas.DOMtoCanvas({x:this.canvas.frame.canvas.clientWidth+20,y:this.canvas.frame.canvas.clientHeight+20}),l={top:s.y,left:s.x,bottom:c.y,right:c.x},u=[];for(let s=0;s<r.length;s++)if(i=n[r[s]],i.hover)o.push(r[s]);else if(i.isSelected())a.push(r[s]);else if(t===!0){let t=i.draw(e);t.drawExternalLabel!=null&&u.push(t.drawExternalLabel)}else if(i.isBoundingBoxOverlappingWith(l)===!0){let t=i.draw(e);t.drawExternalLabel!=null&&u.push(t.drawExternalLabel)}else i.updateBoundingBox(e,i.selected);let d,f=a.length,p=o.length;for(d=0;d<f;d++){i=n[a[d]];let t=i.draw(e);t.drawExternalLabel!=null&&u.push(t.drawExternalLabel)}for(d=0;d<p;d++){i=n[o[d]];let t=i.draw(e);t.drawExternalLabel!=null&&u.push(t.drawExternalLabel)}return{drawExternalLabels:()=>{for(let e of u)e()}}}_drawEdges(e){let t=this.body.edges,n=this.body.edgeIndices;for(let r=0;r<n.length;r++){let i=t[n[r]];i.connected===!0&&i.draw(e)}}_drawArrows(e){let t=this.body.edges,n=this.body.edgeIndices;for(let r=0;r<n.length;r++){let i=t[n[r]];i.connected===!0&&i.drawArrows(e)}}_drawSelectionBox(e){if(this.body.selectionBox.show){e.beginPath();let t=this.body.selectionBox.position.end.x-this.body.selectionBox.position.start.x,n=this.body.selectionBox.position.end.y-this.body.selectionBox.position.start.y;e.rect(this.body.selectionBox.position.start.x,this.body.selectionBox.position.start.y,t,n),e.fillStyle=`rgba(151, 194, 252, 0.2)`,e.fillRect(this.body.selectionBox.position.start.x,this.body.selectionBox.position.start.y,t,n),e.strokeStyle=`rgba(151, 194, 252, 1)`,e.stroke()}else e.closePath()}},dP,fP;function pP(){return fP?dP:(fP=1,N_(),dP=L().setInterval,dP)}var mP,hP;function gP(){return hP?mP:(hP=1,mP=pP(),mP)}var _P=P(gP());function vP(e,t){t.inputHandler=function(e){e.isFirst&&t(e)},e.on(`hammer.input`,t.inputHandler)}function yP(e,t){return t.inputHandler=function(e){e.isFinal&&t(e)},e.on(`hammer.input`,t.inputHandler)}var bP=class{constructor(e){this.body=e,this.pixelRatio=1,this.cameraState={},this.initialized=!1,this.canvasViewCenter={},this._cleanupCallbacks=[],this.options={},this.defaultOptions={autoResize:!0,height:`100%`,width:`100%`},Jo(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){var e;this.body.emitter.once(`resize`,e=>{e.width!==0&&(this.body.view.translation.x=e.width*.5),e.height!==0&&(this.body.view.translation.y=e.height*.5)}),this.body.emitter.on(`setSize`,B(e=this.setSize).call(e,this)),this.body.emitter.on(`destroy`,()=>{this.hammerFrame.destroy(),this.hammer.destroy(),this._cleanUp()})}setOptions(e){if(e!==void 0&&Zb([`width`,`height`,`autoResize`],this.options,e),this._cleanUp(),this.options.autoResize===!0){var t;if(window.ResizeObserver){let e=new ResizeObserver(()=>{this.setSize()===!0&&this.body.emitter.emit(`_requestRedraw`)}),{frame:t}=this;e.observe(t),this._cleanupCallbacks.push(()=>{e.unobserve(t)})}else{let e=_P(()=>{this.setSize()===!0&&this.body.emitter.emit(`_requestRedraw`)},1e3);this._cleanupCallbacks.push(()=>{clearInterval(e)})}let e=B(t=this._onResize).call(t,this);window.addEventListener(`resize`,e),this._cleanupCallbacks.push(()=>{window.removeEventListener(`resize`,e)})}}_cleanUp(){var e,t,n;jp(e=qp(t=hm(n=this._cleanupCallbacks).call(n,0)).call(t)).call(e,e=>{try{e()}catch(e){console.error(e)}})}_onResize(){this.setSize(),this.body.emitter.emit(`_redraw`)}_getCameraState(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.pixelRatio;this.initialized===!0&&(this.cameraState.previousWidth=this.frame.canvas.width/e,this.cameraState.previousHeight=this.frame.canvas.height/e,this.cameraState.scale=this.body.view.scale,this.cameraState.position=this.DOMtoCanvas({x:.5*this.frame.canvas.width/e,y:.5*this.frame.canvas.height/e}))}_setCameraState(){if(this.cameraState.scale!==void 0&&this.frame.canvas.clientWidth!==0&&this.frame.canvas.clientHeight!==0&&this.pixelRatio!==0&&this.cameraState.previousWidth>0&&this.cameraState.previousHeight>0){let e=this.frame.canvas.width/this.pixelRatio/this.cameraState.previousWidth,t=this.frame.canvas.height/this.pixelRatio/this.cameraState.previousHeight,n=this.cameraState.scale;e!=1&&t!=1?n=this.cameraState.scale*.5*(e+t):e==1?t!=1&&(n=this.cameraState.scale*t):n=this.cameraState.scale*e,this.body.view.scale=n;let r=this.DOMtoCanvas({x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight}),i={x:r.x-this.cameraState.position.x,y:r.y-this.cameraState.position.y};this.body.view.translation.x+=i.x*this.body.view.scale,this.body.view.translation.y+=i.y*this.body.view.scale}}_prepareValue(e){if(typeof e==`number`)return e+`px`;if(typeof e==`string`){if(Pg(e).call(e,`%`)!==-1||Pg(e).call(e,`px`)!==-1)return e;if(Pg(e).call(e,`%`)===-1)return e+`px`}throw Error(`Could not use the value supplied for width or height:`+e)}_create(){for(;this.body.container.hasChildNodes();)this.body.container.removeChild(this.body.container.firstChild);if(this.frame=document.createElement(`div`),this.frame.className=`vis-network`,this.frame.style.position=`relative`,this.frame.style.overflow=`hidden`,this.frame.tabIndex=0,this.frame.canvas=document.createElement(`canvas`),this.frame.canvas.style.position=`relative`,this.frame.appendChild(this.frame.canvas),this.frame.canvas.getContext)this._setPixelRatio(),this.setTransform();else{let e=document.createElement(`DIV`);e.style.color=`red`,e.style.fontWeight=`bold`,e.style.padding=`10px`,e.innerText=`Error: your browser does not support HTML canvas`,this.frame.canvas.appendChild(e)}this.body.container.appendChild(this.frame),this.body.view.scale=1,this.body.view.translation={x:.5*this.frame.canvas.clientWidth,y:.5*this.frame.canvas.clientHeight},this._bindHammer()}_bindHammer(){this.hammer!==void 0&&this.hammer.destroy(),this.drag={},this.pinch={},this.hammer=new jx(this.frame.canvas),this.hammer.get(`pinch`).set({enable:!0}),this.hammer.get(`pan`).set({threshold:5,direction:jx.DIRECTION_ALL}),vP(this.hammer,e=>{this.body.eventListeners.onTouch(e)}),this.hammer.on(`tap`,e=>{this.body.eventListeners.onTap(e)}),this.hammer.on(`doubletap`,e=>{this.body.eventListeners.onDoubleTap(e)}),this.hammer.on(`press`,e=>{this.body.eventListeners.onHold(e)}),this.hammer.on(`panstart`,e=>{this.body.eventListeners.onDragStart(e)}),this.hammer.on(`panmove`,e=>{this.body.eventListeners.onDrag(e)}),this.hammer.on(`panend`,e=>{this.body.eventListeners.onDragEnd(e)}),this.hammer.on(`pinch`,e=>{this.body.eventListeners.onPinch(e)}),this.frame.canvas.addEventListener(`wheel`,e=>{this.body.eventListeners.onMouseWheel(e)}),this.frame.canvas.addEventListener(`mousemove`,e=>{this.body.eventListeners.onMouseMove(e)}),this.frame.canvas.addEventListener(`contextmenu`,e=>{this.body.eventListeners.onContext(e)}),this.hammerFrame=new jx(this.frame),yP(this.hammerFrame,e=>{this.body.eventListeners.onRelease(e)})}setSize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.width,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.height;e=this._prepareValue(e),t=this._prepareValue(t);let n=!1,r=this.frame.canvas.width,i=this.frame.canvas.height,a=this.pixelRatio;if(this._setPixelRatio(),e!=this.options.width||t!=this.options.height||this.frame.style.width!=e||this.frame.style.height!=t)this._getCameraState(a),this.frame.style.width=e,this.frame.style.height=t,this.frame.canvas.style.width=`100%`,this.frame.canvas.style.height=`100%`,this.frame.canvas.width=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),this.frame.canvas.height=Math.round(this.frame.canvas.clientHeight*this.pixelRatio),this.options.width=e,this.options.height=t,this.canvasViewCenter={x:.5*this.frame.clientWidth,y:.5*this.frame.clientHeight},n=!0;else{let e=Math.round(this.frame.canvas.clientWidth*this.pixelRatio),t=Math.round(this.frame.canvas.clientHeight*this.pixelRatio);(this.frame.canvas.width!==e||this.frame.canvas.height!==t)&&this._getCameraState(a),this.frame.canvas.width!==e&&(this.frame.canvas.width=e,n=!0),this.frame.canvas.height!==t&&(this.frame.canvas.height=t,n=!0)}return n===!0&&(this.body.emitter.emit(`resize`,{width:Math.round(this.frame.canvas.width/this.pixelRatio),height:Math.round(this.frame.canvas.height/this.pixelRatio),oldWidth:Math.round(r/this.pixelRatio),oldHeight:Math.round(i/this.pixelRatio)}),this._setCameraState()),this.initialized=!0,n}getContext(){return this.frame.canvas.getContext(`2d`)}_determinePixelRatio(){let e=this.getContext();if(e===void 0)throw Error(`Could not get canvax context`);let t=1;typeof window<`u`&&(t=window.devicePixelRatio||1);let n=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return t/n}_setPixelRatio(){this.pixelRatio=this._determinePixelRatio()}setTransform(){let e=this.getContext();if(e===void 0)throw Error(`Could not get canvax context`);e.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0)}_XconvertDOMtoCanvas(e){return(e-this.body.view.translation.x)/this.body.view.scale}_XconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.x}_YconvertDOMtoCanvas(e){return(e-this.body.view.translation.y)/this.body.view.scale}_YconvertCanvasToDOM(e){return e*this.body.view.scale+this.body.view.translation.y}canvasToDOM(e){return{x:this._XconvertCanvasToDOM(e.x),y:this._YconvertCanvasToDOM(e.y)}}DOMtoCanvas(e){return{x:this._XconvertDOMtoCanvas(e.x),y:this._YconvertDOMtoCanvas(e.y)}}};function xP(e,t){let n=Jo({nodes:t,minZoomLevel:Number.MIN_VALUE,maxZoomLevel:1},e??{});if(!W(n.nodes))throw TypeError(`Nodes has to be an array of ids.`);if(n.nodes.length===0&&(n.nodes=t),!(typeof n.minZoomLevel==`number`&&n.minZoomLevel>0))throw TypeError(`Min zoom level has to be a number higher than zero.`);if(!(typeof n.maxZoomLevel==`number`&&n.minZoomLevel<=n.maxZoomLevel))throw TypeError(`Max zoom level has to be a number higher than min zoom level.`);return n}var SP=class{constructor(e,t){var n,r;this.body=e,this.canvas=t,this.animationSpeed=1/this.renderRefreshRate,this.animationEasingFunction=`easeInOutQuint`,this.easingTime=0,this.sourceScale=0,this.targetScale=0,this.sourceTranslation=0,this.targetTranslation=0,this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0,this.touchTime=0,this.viewFunction=void 0,this.body.emitter.on(`fit`,B(n=this.fit).call(n,this)),this.body.emitter.on(`animationFinished`,()=>{this.body.emitter.emit(`_stopRendering`)}),this.body.emitter.on(`unlockNode`,B(r=this.releaseNode).call(r,this))}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=e}fit(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;e=xP(e,this.body.nodeIndices);let n=this.canvas.frame.canvas.clientWidth,r=this.canvas.frame.canvas.clientHeight,i,a;if(n===0||r===0)a=1,i=sP.getRange(this.body.nodes,e.nodes);else if(t===!0){let t=0;for(let e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this.body.nodes[e].predefinedPosition===!0&&(t+=1);if(t>.5*this.body.nodeIndices.length){this.fit(e,!1);return}i=sP.getRange(this.body.nodes,e.nodes),a=12.662/(this.body.nodeIndices.length+7.4147)+.0964822;let o=Math.min(n/600,r/600);a*=o}else{this.body.emitter.emit(`_resizeNodes`),i=sP.getRange(this.body.nodes,e.nodes);let t=Math.abs(i.maxX-i.minX)*1.1,o=Math.abs(i.maxY-i.minY)*1.1,s=n/t,c=r/o;a=s<=c?s:c}a>e.maxZoomLevel?a=e.maxZoomLevel:a<e.minZoomLevel&&(a=e.minZoomLevel);let o={position:sP.findCenter(i),scale:a,animation:e.animation};this.moveTo(o)}focus(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.body.nodes[e]===void 0?console.error(`Node: `+e+` cannot be found.`):(t.position={x:this.body.nodes[e].x,y:this.body.nodes[e].y},t.lockedOnNode=e,this.moveTo(t))}moveTo(e){if(e===void 0){e={};return}if(e.offset!=null){if(e.offset.x!=null){if(e.offset.x=+e.offset.x,!fw(e.offset.x))throw TypeError(`The option "offset.x" has to be a finite number.`)}else e.offset.x=0;if(e.offset.y!=null){if(e.offset.y=+e.offset.y,!fw(e.offset.y))throw TypeError(`The option "offset.y" has to be a finite number.`)}else e.offset.x=0}else e.offset={x:0,y:0};if(e.position!=null){if(e.position.x!=null){if(e.position.x=+e.position.x,!fw(e.position.x))throw TypeError(`The option "position.x" has to be a finite number.`)}else e.position.x=0;if(e.position.y!=null){if(e.position.y=+e.position.y,!fw(e.position.y))throw TypeError(`The option "position.y" has to be a finite number.`)}else e.position.x=0}else e.position=this.getViewPosition();if(e.scale!=null){if(e.scale=+e.scale,!(e.scale>0))throw TypeError(`The option "scale" has to be a number greater than zero.`)}else e.scale=this.body.view.scale;e.animation===void 0&&(e.animation={duration:0}),e.animation===!1&&(e.animation={duration:0}),e.animation===!0&&(e.animation={}),e.animation.duration===void 0&&(e.animation.duration=1e3),e.animation.easingFunction===void 0&&(e.animation.easingFunction=`easeInOutQuad`),this.animateView(e)}animateView(e){if(e===void 0)return;this.animationEasingFunction=e.animation.easingFunction,this.releaseNode(),e.locked===!0&&(this.lockedOnNodeId=e.lockedOnNode,this.lockedOnNodeOffset=e.offset),this.easingTime!=0&&this._transitionRedraw(!0),this.sourceScale=this.body.view.scale,this.sourceTranslation=this.body.view.translation,this.targetScale=e.scale,this.body.view.scale=this.targetScale;let t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.position.x,y:t.y-e.position.y};if(this.targetTranslation={x:this.sourceTranslation.x+n.x*this.targetScale+e.offset.x,y:this.sourceTranslation.y+n.y*this.targetScale+e.offset.y},e.animation.duration===0)if(this.lockedOnNodeId!=null){var r;this.viewFunction=B(r=this._lockedRedraw).call(r,this),this.body.emitter.on(`initRedraw`,this.viewFunction)}else this.body.view.scale=this.targetScale,this.body.view.translation=this.targetTranslation,this.body.emitter.emit(`_requestRedraw`);else{var i;this.animationSpeed=1/(60*e.animation.duration*.001)||1/60,this.animationEasingFunction=e.animation.easingFunction,this.viewFunction=B(i=this._transitionRedraw).call(i,this),this.body.emitter.on(`initRedraw`,this.viewFunction),this.body.emitter.emit(`_startRendering`)}}_lockedRedraw(){let e={x:this.body.nodes[this.lockedOnNodeId].x,y:this.body.nodes[this.lockedOnNodeId].y},t=this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight}),n={x:t.x-e.x,y:t.y-e.y},r=this.body.view.translation,i={x:r.x+n.x*this.body.view.scale+this.lockedOnNodeOffset.x,y:r.y+n.y*this.body.view.scale+this.lockedOnNodeOffset.y};this.body.view.translation=i}releaseNode(){this.lockedOnNodeId!==void 0&&this.viewFunction!==void 0&&(this.body.emitter.off(`initRedraw`,this.viewFunction),this.lockedOnNodeId=void 0,this.lockedOnNodeOffset=void 0)}_transitionRedraw(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.easingTime+=this.animationSpeed,this.easingTime=e===!0?1:this.easingTime;let t=vx[this.animationEasingFunction](this.easingTime);if(this.body.view.scale=this.sourceScale+(this.targetScale-this.sourceScale)*t,this.body.view.translation={x:this.sourceTranslation.x+(this.targetTranslation.x-this.sourceTranslation.x)*t,y:this.sourceTranslation.y+(this.targetTranslation.y-this.sourceTranslation.y)*t},this.easingTime>=1){if(this.body.emitter.off(`initRedraw`,this.viewFunction),this.easingTime=0,this.lockedOnNodeId!=null){var n;this.viewFunction=B(n=this._lockedRedraw).call(n,this),this.body.emitter.on(`initRedraw`,this.viewFunction)}this.body.emitter.emit(`animationFinished`)}}getScale(){return this.body.view.scale}getViewPosition(){return this.canvas.DOMtoCanvas({x:.5*this.canvas.frame.canvas.clientWidth,y:.5*this.canvas.frame.canvas.clientHeight})}};function CP(e){var t=e&&e.preventDefault||!1,n=e&&e.container||window,r={},i={keydown:{},keyup:{}},a={},o;for(o=97;o<=122;o++)a[String.fromCharCode(o)]={code:65+(o-97),shift:!1};for(o=65;o<=90;o++)a[String.fromCharCode(o)]={code:o,shift:!0};for(o=0;o<=9;o++)a[``+o]={code:48+o,shift:!1};for(o=1;o<=12;o++)a[`F`+o]={code:111+o,shift:!1};for(o=0;o<=9;o++)a[`num`+o]={code:96+o,shift:!1};a[`num*`]={code:106,shift:!1},a[`num+`]={code:107,shift:!1},a[`num-`]={code:109,shift:!1},a[`num/`]={code:111,shift:!1},a[`num.`]={code:110,shift:!1},a.left={code:37,shift:!1},a.up={code:38,shift:!1},a.right={code:39,shift:!1},a.down={code:40,shift:!1},a.space={code:32,shift:!1},a.enter={code:13,shift:!1},a.shift={code:16,shift:void 0},a.esc={code:27,shift:!1},a.backspace={code:8,shift:!1},a.tab={code:9,shift:!1},a.ctrl={code:17,shift:!1},a.alt={code:18,shift:!1},a.delete={code:46,shift:!1},a.pageup={code:33,shift:!1},a.pagedown={code:34,shift:!1},a[`=`]={code:187,shift:!1},a[`-`]={code:189,shift:!1},a[`]`]={code:221,shift:!1},a[`[`]={code:219,shift:!1};var s=function(e){l(e,`keydown`)},c=function(e){l(e,`keyup`)},l=function(e,n){if(i[n][e.keyCode]!==void 0){for(var r=i[n][e.keyCode],a=0;a<r.length;a++)(r[a].shift===void 0||r[a].shift==1&&e.shiftKey==1||r[a].shift==0&&e.shiftKey==0)&&r[a].fn(e);t==1&&e.preventDefault()}};return r.bind=function(e,t,n){if(n===void 0&&(n=`keydown`),a[e]===void 0)throw Error(`unsupported key: `+e);i[n][a[e].code]===void 0&&(i[n][a[e].code]=[]),i[n][a[e].code].push({fn:t,shift:a[e].shift})},r.bindAll=function(e,t){for(var n in t===void 0&&(t=`keydown`),a)a.hasOwnProperty(n)&&r.bind(n,e,t)},r.getKey=function(e){for(var t in a)if(a.hasOwnProperty(t)&&(e.shiftKey==1&&a[t].shift==1&&e.keyCode==a[t].code||e.shiftKey==0&&a[t].shift==0&&e.keyCode==a[t].code||e.keyCode==a[t].code&&t==`shift`))return t;return`unknown key, currently not supported`},r.unbind=function(e,t,n){if(n===void 0&&(n=`keydown`),a[e]===void 0)throw Error(`unsupported key: `+e);if(t!==void 0){var r=[],o=i[n][a[e].code];if(o!==void 0)for(var s=0;s<o.length;s++)o[s].fn==t&&o[s].shift==a[e].shift||r.push(i[n][a[e].code][s]);i[n][a[e].code]=r}else i[n][a[e].code]=[]},r.reset=function(){i={keydown:{},keyup:{}}},r.destroy=function(){i={keydown:{},keyup:{}},n.removeEventListener(`keydown`,s,!0),n.removeEventListener(`keyup`,c,!0)},n.addEventListener(`keydown`,s,!0),n.addEventListener(`keyup`,c,!0),r}var wP=class{constructor(e,t){this.body=e,this.canvas=t,this.iconsCreated=!1,this.navigationHammers=[],this.boundFunctions={},this.touchTime=0,this.activated=!1,this.body.emitter.on(`activate`,()=>{this.activated=!0,this.configureKeyboardBindings()}),this.body.emitter.on(`deactivate`,()=>{this.activated=!1,this.configureKeyboardBindings()}),this.body.emitter.on(`destroy`,()=>{this.keycharm!==void 0&&this.keycharm.destroy()}),this.options={}}setOptions(e){e!==void 0&&(this.options=e,this.create())}create(){this.options.navigationButtons===!0?this.iconsCreated===!1&&this.loadNavigationElements():this.iconsCreated===!0&&this.cleanNavigation(),this.configureKeyboardBindings()}cleanNavigation(){if(this.navigationHammers.length!=0){for(let e=0;e<this.navigationHammers.length;e++)this.navigationHammers[e].destroy();this.navigationHammers=[]}this.navigationDOM&&this.navigationDOM.wrapper&&this.navigationDOM.wrapper.parentNode&&this.navigationDOM.wrapper.parentNode.removeChild(this.navigationDOM.wrapper),this.iconsCreated=!1}loadNavigationElements(){this.cleanNavigation(),this.navigationDOM={};let e=[`up`,`down`,`left`,`right`,`zoomIn`,`zoomOut`,`zoomExtends`],t=[`_moveUp`,`_moveDown`,`_moveLeft`,`_moveRight`,`_zoomIn`,`_zoomOut`,`_fit`];this.navigationDOM.wrapper=document.createElement(`div`),this.navigationDOM.wrapper.className=`vis-navigation`,this.canvas.frame.appendChild(this.navigationDOM.wrapper);for(let i=0;i<e.length;i++){this.navigationDOM[e[i]]=document.createElement(`div`),this.navigationDOM[e[i]].className=`vis-button vis-`+e[i],this.navigationDOM.wrapper.appendChild(this.navigationDOM[e[i]]);let a=new jx(this.navigationDOM[e[i]]);if(t[i]===`_fit`){var n;vP(a,B(n=this._fit).call(n,this))}else{var r;vP(a,B(r=this.bindToRedraw).call(r,this,t[i]))}this.navigationHammers.push(a)}let i=new jx(this.canvas.frame);yP(i,()=>{this._stopMovement()}),this.navigationHammers.push(i),this.iconsCreated=!0}bindToRedraw(e){if(this.boundFunctions[e]===void 0){var t;this.boundFunctions[e]=B(t=this[e]).call(t,this),this.body.emitter.on(`initRedraw`,this.boundFunctions[e]),this.body.emitter.emit(`_startRendering`)}}unbindFromRedraw(e){this.boundFunctions[e]!==void 0&&(this.body.emitter.off(`initRedraw`,this.boundFunctions[e]),this.body.emitter.emit(`_stopRendering`),delete this.boundFunctions[e])}_fit(){new Date().valueOf()-this.touchTime>700&&(this.body.emitter.emit(`fit`,{duration:700}),this.touchTime=new Date().valueOf())}_stopMovement(){for(let e in this.boundFunctions)Object.prototype.hasOwnProperty.call(this.boundFunctions,e)&&(this.body.emitter.off(`initRedraw`,this.boundFunctions[e]),this.body.emitter.emit(`_stopRendering`));this.boundFunctions={}}_moveUp(){this.body.view.translation.y+=this.options.keyboard.speed.y}_moveDown(){this.body.view.translation.y-=this.options.keyboard.speed.y}_moveLeft(){this.body.view.translation.x+=this.options.keyboard.speed.x}_moveRight(){this.body.view.translation.x-=this.options.keyboard.speed.x}_zoomIn(){let e=this.body.view.scale,t=this.body.view.scale*(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,r=t/e,i=(1-r)*this.canvas.canvasViewCenter.x+n.x*r,a=(1-r)*this.canvas.canvasViewCenter.y+n.y*r;this.body.view.scale=t,this.body.view.translation={x:i,y:a},this.body.emitter.emit(`zoom`,{direction:`+`,scale:this.body.view.scale,pointer:null})}_zoomOut(){let e=this.body.view.scale,t=this.body.view.scale/(1+this.options.keyboard.speed.zoom),n=this.body.view.translation,r=t/e,i=(1-r)*this.canvas.canvasViewCenter.x+n.x*r,a=(1-r)*this.canvas.canvasViewCenter.y+n.y*r;this.body.view.scale=t,this.body.view.translation={x:i,y:a},this.body.emitter.emit(`zoom`,{direction:`-`,scale:this.body.view.scale,pointer:null})}configureKeyboardBindings(){if(this.keycharm!==void 0&&this.keycharm.destroy(),this.options.keyboard.enabled===!0&&(this.options.keyboard.bindToWindow===!0?this.keycharm=CP({container:window,preventDefault:!0}):this.keycharm=CP({container:this.canvas.frame,preventDefault:!0}),this.keycharm.reset(),this.activated===!0)){var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C;B(e=this.keycharm).call(e,`up`,()=>{this.bindToRedraw(`_moveUp`)},`keydown`),B(t=this.keycharm).call(t,`down`,()=>{this.bindToRedraw(`_moveDown`)},`keydown`),B(n=this.keycharm).call(n,`left`,()=>{this.bindToRedraw(`_moveLeft`)},`keydown`),B(r=this.keycharm).call(r,`right`,()=>{this.bindToRedraw(`_moveRight`)},`keydown`),B(i=this.keycharm).call(i,`=`,()=>{this.bindToRedraw(`_zoomIn`)},`keydown`),B(a=this.keycharm).call(a,`num+`,()=>{this.bindToRedraw(`_zoomIn`)},`keydown`),B(o=this.keycharm).call(o,`num-`,()=>{this.bindToRedraw(`_zoomOut`)},`keydown`),B(s=this.keycharm).call(s,`-`,()=>{this.bindToRedraw(`_zoomOut`)},`keydown`),B(c=this.keycharm).call(c,`[`,()=>{this.bindToRedraw(`_zoomOut`)},`keydown`),B(l=this.keycharm).call(l,`]`,()=>{this.bindToRedraw(`_zoomIn`)},`keydown`),B(u=this.keycharm).call(u,`pageup`,()=>{this.bindToRedraw(`_zoomIn`)},`keydown`),B(d=this.keycharm).call(d,`pagedown`,()=>{this.bindToRedraw(`_zoomOut`)},`keydown`),B(f=this.keycharm).call(f,`up`,()=>{this.unbindFromRedraw(`_moveUp`)},`keyup`),B(p=this.keycharm).call(p,`down`,()=>{this.unbindFromRedraw(`_moveDown`)},`keyup`),B(m=this.keycharm).call(m,`left`,()=>{this.unbindFromRedraw(`_moveLeft`)},`keyup`),B(h=this.keycharm).call(h,`right`,()=>{this.unbindFromRedraw(`_moveRight`)},`keyup`),B(g=this.keycharm).call(g,`=`,()=>{this.unbindFromRedraw(`_zoomIn`)},`keyup`),B(_=this.keycharm).call(_,`num+`,()=>{this.unbindFromRedraw(`_zoomIn`)},`keyup`),B(v=this.keycharm).call(v,`num-`,()=>{this.unbindFromRedraw(`_zoomOut`)},`keyup`),B(y=this.keycharm).call(y,`-`,()=>{this.unbindFromRedraw(`_zoomOut`)},`keyup`),B(b=this.keycharm).call(b,`[`,()=>{this.unbindFromRedraw(`_zoomOut`)},`keyup`),B(x=this.keycharm).call(x,`]`,()=>{this.unbindFromRedraw(`_zoomIn`)},`keyup`),B(S=this.keycharm).call(S,`pageup`,()=>{this.unbindFromRedraw(`_zoomIn`)},`keyup`),B(C=this.keycharm).call(C,`pagedown`,()=>{this.unbindFromRedraw(`_zoomOut`)},`keyup`)}}},TP=class{constructor(e,t,n){var r,i,a,o,s,c,l,u,d,f,p,m,h;this.body=e,this.canvas=t,this.selectionHandler=n,this.navigationHandler=new wP(e,t),this.body.eventListeners.onTap=B(r=this.onTap).call(r,this),this.body.eventListeners.onTouch=B(i=this.onTouch).call(i,this),this.body.eventListeners.onDoubleTap=B(a=this.onDoubleTap).call(a,this),this.body.eventListeners.onHold=B(o=this.onHold).call(o,this),this.body.eventListeners.onDragStart=B(s=this.onDragStart).call(s,this),this.body.eventListeners.onDrag=B(c=this.onDrag).call(c,this),this.body.eventListeners.onDragEnd=B(l=this.onDragEnd).call(l,this),this.body.eventListeners.onMouseWheel=B(u=this.onMouseWheel).call(u,this),this.body.eventListeners.onPinch=B(d=this.onPinch).call(d,this),this.body.eventListeners.onMouseMove=B(f=this.onMouseMove).call(f,this),this.body.eventListeners.onRelease=B(p=this.onRelease).call(p,this),this.body.eventListeners.onContext=B(m=this.onContext).call(m,this),this.touchTime=0,this.drag={},this.pinch={},this.popup=void 0,this.popupObj=void 0,this.popupTimer=void 0,this.body.functions.getPointer=B(h=this.getPointer).call(h,this),this.options={},this.defaultOptions={dragNodes:!0,dragView:!0,hover:!1,keyboard:{enabled:!1,speed:{x:10,y:10,zoom:.02},bindToWindow:!0,autoFocus:!0},navigationButtons:!1,tooltipDelay:300,zoomView:!0,zoomSpeed:1},Jo(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){this.body.emitter.on(`destroy`,()=>{clearTimeout(this.popupTimer),delete this.body.functions.getPointer})}setOptions(e){e!==void 0&&(Qb([`hideEdgesOnDrag`,`hideEdgesOnZoom`,`hideNodesOnDrag`,`keyboard`,`multiselect`,`selectable`,`selectConnectedEdges`],this.options,e),_x(this.options,e,`keyboard`),e.tooltip&&(Jo(this.options.tooltip,e.tooltip),e.tooltip.color&&(this.options.tooltip.color=cx(e.tooltip.color)))),this.navigationHandler.setOptions(this.options)}getPointer(e){return{x:e.x-nx(this.canvas.frame.canvas),y:e.y-rx(this.canvas.frame.canvas)}}onTouch(e){new Date().valueOf()-this.touchTime>50&&(this.drag.pointer=this.getPointer(e.center),this.drag.pinched=!1,this.pinch.scale=this.body.view.scale,this.touchTime=new Date().valueOf())}onTap(e){let t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect&&(e.changedPointers[0].ctrlKey||e.changedPointers[0].metaKey);this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent(`click`,e,t)}onDoubleTap(e){let t=this.getPointer(e.center);this.selectionHandler.generateClickEvent(`doubleClick`,e,t)}onHold(e){let t=this.getPointer(e.center),n=this.selectionHandler.options.multiselect;this.checkSelectionChanges(t,n),this.selectionHandler.commitAndEmit(t,e),this.selectionHandler.generateClickEvent(`click`,e,t),this.selectionHandler.generateClickEvent(`hold`,e,t)}onRelease(e){if(new Date().valueOf()-this.touchTime>10){let t=this.getPointer(e.center);this.selectionHandler.generateClickEvent(`release`,e,t),this.touchTime=new Date().valueOf()}}onContext(e){let t=this.getPointer({x:e.clientX,y:e.clientY});this.selectionHandler.generateClickEvent(`oncontext`,e,t)}checkSelectionChanges(e){(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1)===!0?this.selectionHandler.selectAdditionalOnPoint(e):this.selectionHandler.selectOnPoint(e)}_determineDifference(e,t){let n=function(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r];Pg(t).call(t,i)===-1&&n.push(i)}return n};return{nodes:n(e.nodes,t.nodes),edges:n(e.edges,t.edges)}}onDragStart(e){if(this.drag.dragging)return;this.drag.pointer===void 0&&this.onTouch(e);let t=this.selectionHandler.getNodeAt(this.drag.pointer);if(this.drag.dragging=!0,this.drag.selection=[],this.drag.translation=Jo({},this.body.view.translation),this.drag.nodeId=void 0,e.srcEvent.shiftKey){this.body.selectionBox.show=!0;let t=this.getPointer(e.center);this.body.selectionBox.position.start={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)},this.body.selectionBox.position.end={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)}}else if(t!==void 0&&this.options.dragNodes===!0){this.drag.nodeId=t.id,t.isSelected()===!1&&this.selectionHandler.setSelection({nodes:[t.id]}),this.selectionHandler.generateClickEvent(`dragStart`,e,this.drag.pointer);for(let e of this.selectionHandler.getSelectedNodes()){let t={id:e.id,node:e,x:e.x,y:e.y,xFixed:e.options.fixed.x,yFixed:e.options.fixed.y};e.options.fixed.x=!0,e.options.fixed.y=!0,this.drag.selection.push(t)}}else this.selectionHandler.generateClickEvent(`dragStart`,e,this.drag.pointer,void 0,!0)}onDrag(e){if(this.drag.pinched===!0)return;this.body.emitter.emit(`unlockNode`);let t=this.getPointer(e.center),n=this.drag.selection;if(n&&n.length&&this.options.dragNodes===!0){this.selectionHandler.generateClickEvent(`dragging`,e,t);let r=t.x-this.drag.pointer.x,i=t.y-this.drag.pointer.y;jp(n).call(n,e=>{let t=e.node;e.xFixed===!1&&(t.x=this.canvas._XconvertDOMtoCanvas(this.canvas._XconvertCanvasToDOM(e.x)+r)),e.yFixed===!1&&(t.y=this.canvas._YconvertDOMtoCanvas(this.canvas._YconvertCanvasToDOM(e.y)+i))}),this.body.emitter.emit(`startSimulation`)}else{if(e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent(`dragging`,e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}this.body.selectionBox.position.end={x:this.canvas._XconvertDOMtoCanvas(t.x),y:this.canvas._YconvertDOMtoCanvas(t.y)},this.body.emitter.emit(`_requestRedraw`)}if(this.options.dragView===!0&&!e.srcEvent.shiftKey){if(this.selectionHandler.generateClickEvent(`dragging`,e,t,void 0,!0),this.drag.pointer===void 0){this.onDragStart(e);return}let n=t.x-this.drag.pointer.x,r=t.y-this.drag.pointer.y;this.body.view.translation={x:this.drag.translation.x+n,y:this.drag.translation.y+r},this.body.emitter.emit(`_requestRedraw`)}}}onDragEnd(e){if(this.drag.dragging=!1,this.body.selectionBox.show){var t;this.body.selectionBox.show=!1;let n=this.body.selectionBox.position,r={minX:Math.min(n.start.x,n.end.x),minY:Math.min(n.start.y,n.end.y),maxX:Math.max(n.start.x,n.end.x),maxY:Math.max(n.start.y,n.end.y)},i=Ph(t=this.body.nodeIndices).call(t,e=>{let t=this.body.nodes[e];return t.x>=r.minX&&t.x<=r.maxX&&t.y>=r.minY&&t.y<=r.maxY});jp(i).call(i,e=>this.selectionHandler.selectObject(this.body.nodes[e]));let a=this.getPointer(e.center);this.selectionHandler.commitAndEmit(a,e),this.selectionHandler.generateClickEvent(`dragEnd`,e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit(`_requestRedraw`)}else{let t=this.drag.selection;t&&t.length?(jp(t).call(t,function(e){e.node.options.fixed.x=e.xFixed,e.node.options.fixed.y=e.yFixed}),this.selectionHandler.generateClickEvent(`dragEnd`,e,this.getPointer(e.center)),this.body.emitter.emit(`startSimulation`)):(this.selectionHandler.generateClickEvent(`dragEnd`,e,this.getPointer(e.center),void 0,!0),this.body.emitter.emit(`_requestRedraw`))}}onPinch(e){let t=this.getPointer(e.center);this.drag.pinched=!0,this.pinch.scale===void 0&&(this.pinch.scale=1);let n=this.pinch.scale*e.scale;this.zoom(n,t)}zoom(e,t){if(this.options.zoomView===!0){let n=this.body.view.scale;e<1e-5&&(e=1e-5),e>10&&(e=10);let r;this.drag!==void 0&&this.drag.dragging===!0&&(r=this.canvas.DOMtoCanvas(this.drag.pointer));let i=this.body.view.translation,a=e/n,o=(1-a)*t.x+i.x*a,s=(1-a)*t.y+i.y*a;if(this.body.view.scale=e,this.body.view.translation={x:o,y:s},r!=null){let e=this.canvas.canvasToDOM(r);this.drag.pointer.x=e.x,this.drag.pointer.y=e.y}this.body.emitter.emit(`_requestRedraw`),n<e?this.body.emitter.emit(`zoom`,{direction:`+`,scale:this.body.view.scale,pointer:t}):this.body.emitter.emit(`zoom`,{direction:`-`,scale:this.body.view.scale,pointer:t})}}onMouseWheel(e){if(this.options.zoomView===!0){if(e.deltaY!==0){let t=this.body.view.scale;t*=1+(e.deltaY<0?1:-1)*(this.options.zoomSpeed*.1);let n=this.getPointer({x:e.clientX,y:e.clientY});this.zoom(t,n)}e.preventDefault()}}onMouseMove(e){let t=this.getPointer({x:e.clientX,y:e.clientY}),n=!1;this.popup!==void 0&&(this.popup.hidden===!1&&this._checkHidePopup(t),this.popup.hidden===!1&&(n=!0,this.popup.setPosition(t.x+3,t.y-5),this.popup.show())),this.options.keyboard.autoFocus&&this.options.keyboard.bindToWindow===!1&&this.options.keyboard.enabled===!0&&this.canvas.frame.focus(),n===!1&&(this.popupTimer!==void 0&&(clearInterval(this.popupTimer),this.popupTimer=void 0),this.drag.dragging||(this.popupTimer=B_(()=>this._checkShowPopup(t),this.options.tooltipDelay))),this.options.hover===!0&&this.selectionHandler.hoverObject(e,t)}_checkShowPopup(e){let t=this.canvas._XconvertDOMtoCanvas(e.x),n=this.canvas._YconvertDOMtoCanvas(e.y),r={left:t,top:n,right:t,bottom:n},i=this.popupObj===void 0?void 0:this.popupObj.id,a=!1,o=`node`;if(this.popupObj===void 0){let e=this.body.nodeIndices,t=this.body.nodes,n,i=[];for(let o=0;o<e.length;o++)n=t[e[o]],n.isOverlappingWith(r)===!0&&(a=!0,n.getTitle()!==void 0&&i.push(e[o]));i.length>0&&(this.popupObj=t[i[i.length-1]],a=!0)}if(this.popupObj===void 0&&a===!1){let e=this.body.edgeIndices,t=this.body.edges,n,i=[];for(let a=0;a<e.length;a++)n=t[e[a]],n.isOverlappingWith(r)===!0&&n.connected===!0&&n.getTitle()!==void 0&&i.push(e[a]);i.length>0&&(this.popupObj=t[i[i.length-1]],o=`edge`)}this.popupObj===void 0?this.popup!==void 0&&(this.popup.hide(),this.body.emitter.emit(`hidePopup`)):this.popupObj.id!==i&&(this.popup===void 0&&(this.popup=new Mx(this.canvas.frame)),this.popup.popupTargetType=o,this.popup.popupTargetId=this.popupObj.id,this.popup.setPosition(e.x+3,e.y-5),this.popup.setText(this.popupObj.getTitle()),this.popup.show(),this.body.emitter.emit(`showPopup`,this.popupObj.id))}_checkHidePopup(e){let t=this.selectionHandler._pointerToPositionObject(e),n=!1;if(this.popup.popupTargetType===`node`){if(this.body.nodes[this.popup.popupTargetId]!==void 0&&(n=this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),n===!0)){let t=this.selectionHandler.getNodeAt(e);n=t===void 0?!1:t.id===this.popup.popupTargetId}}else this.selectionHandler.getNodeAt(e)===void 0&&this.body.edges[this.popup.popupTargetId]!==void 0&&(n=this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));n===!1&&(this.popupObj=void 0,this.popup.hide(),this.body.emitter.emit(`hidePopup`))}},EP={},DP={},OP,kP;function AP(){if(kP)return OP;kP=1;var e=I(),t=tC(),n=jS().getWeakData,r=YS(),i=qa(),a=oi(),o=hi(),s=KS(),c=pl(),l=ma(),u=ul(),d=u.set,f=u.getterFor,p=c.find,m=c.findIndex,h=e([].splice),g=0,_=function(e){return e.frozen||=new v},v=function(){this.entries=[]},y=function(e,t){return p(e.entries,function(e){return e[0]===t})};return v.prototype={get:function(e){var t=y(this,e);if(t)return t[1]},has:function(e){return!!y(this,e)},set:function(e,t){var n=y(this,e);n?n[1]=t:this.entries.push([e,t])},delete:function(e){var t=m(this.entries,function(t){return t[0]===e});return~t&&h(this.entries,t,1),!!~t}},OP={getConstructor:function(e,c,u,p){var m=e(function(e,t){r(e,h),d(e,{type:c,id:g++,frozen:null}),a(t)||s(t,e[p],{that:e,AS_ENTRIES:u})}),h=m.prototype,v=f(c),y=function(e,t,r){var a=v(e),o=n(i(t),!0);return o===!0?_(a).set(t,r):o[a.id]=r,e};return t(h,{delete:function(e){var t=v(this);if(!o(e))return!1;var r=n(e);return r===!0?_(t).delete(e):r&&l(r,t.id)&&delete r[t.id]},has:function(e){var t=v(this);if(!o(e))return!1;var r=n(e);return r===!0?_(t).has(e):r&&l(r,t.id)}}),t(h,u?{get:function(e){var t=v(this);if(o(e)){var r=n(e);if(r===!0)return _(t).get(e);if(r)return r[t.id]}},set:function(e,t){return y(this,e,t)}}:{add:function(e){return y(this,e,!0)}}),m}},OP}var jP;function MP(){if(jP)return DP;jP=1;var e=kS(),t=Sr(),n=I(),r=tC(),i=jS(),a=QS(),o=AP(),s=hi(),c=ul().enforce,l=F(),u=sl(),d=Object,f=Array.isArray,p=d.isExtensible,m=d.isFrozen,h=d.isSealed,g=d.freeze,_=d.seal,v=!t.ActiveXObject&&`ActiveXObject`in t,y,b=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},x=a(`WeakMap`,b,o),S=x.prototype,C=n(S.set),w=function(){return e&&l(function(){var e=g([]);return C(new x,e,1),!m(e)})};if(u)if(v){y=o.getConstructor(b,`WeakMap`,!0),i.enable();var T=n(S.delete),E=n(S.has),ee=n(S.get);r(S,{delete:function(e){if(s(e)&&!p(e)){var t=c(this);return t.frozen||=new y,T(this,e)||t.frozen.delete(e)}return T(this,e)},has:function(e){if(s(e)&&!p(e)){var t=c(this);return t.frozen||=new y,E(this,e)||t.frozen.has(e)}return E(this,e)},get:function(e){if(s(e)&&!p(e)){var t=c(this);return t.frozen||=new y,E(this,e)?ee(this,e):t.frozen.get(e)}return ee(this,e)},set:function(e,t){if(s(e)&&!p(e)){var n=c(this);n.frozen||=new y,E(this,e)?C(this,e,t):n.frozen.set(e,t)}else C(this,e,t);return this}})}else w()&&r(S,{set:function(e,t){var n;return f(e)&&(m(e)?n=g:h(e)&&(n=_)),C(this,e,t),n&&n(e),this}});return DP}var NP;function PP(){return NP?EP:(NP=1,MP(),EP)}var FP,IP;function LP(){return IP?FP:(IP=1,yd(),PP(),FP=L().WeakMap,FP)}var RP,zP;function BP(){if(zP)return RP;zP=1;var e=LP();return wd(),RP=e,RP}var VP,HP;function UP(){return HP?VP:(HP=1,VP=BP(),VP)}var WP=P(UP());function GP(e,t,n){KP(e,t),t.set(e,n)}function KP(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function qP(e,t,n){return e.set(YP(e,t),n),n}function JP(e,t){return e.get(YP(e,t))}function YP(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function XP(e,t){let n=new tA;for(let r of t)e.has(r)||n.add(r);return n}var ZP=new WP,QP=new WP,$P=class{constructor(){GP(this,ZP,new tA),GP(this,QP,new tA)}get size(){return JP(QP,this).size}add(){var e=[...arguments];for(let t of e)JP(QP,this).add(t)}delete(){var e=[...arguments];for(let t of e)JP(QP,this).delete(t)}clear(){JP(QP,this).clear()}getSelection(){return[...JP(QP,this)]}getChanges(){return{added:[...XP(JP(ZP,this),JP(QP,this))],deleted:[...XP(JP(QP,this),JP(ZP,this))],previous:[...new tA(JP(ZP,this))],current:[...new tA(JP(QP,this))]}}commit(){let e=this.getChanges();qP(ZP,this,JP(QP,this)),qP(QP,this,new tA(JP(ZP,this)));for(let t of e.added)t.select();for(let t of e.deleted)t.unselect();return e}},eF=new WP,tF=new WP,nF=new WP,rF=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:()=>{};GP(this,eF,new $P),GP(this,tF,new $P),GP(this,nF,void 0),qP(nF,this,e)}get sizeNodes(){return JP(eF,this).size}get sizeEdges(){return JP(tF,this).size}getNodes(){return JP(eF,this).getSelection()}getEdges(){return JP(tF,this).getSelection()}addNodes(){JP(eF,this).add(...arguments)}addEdges(){JP(tF,this).add(...arguments)}deleteNodes(e){JP(eF,this).delete(e)}deleteEdges(e){JP(tF,this).delete(e)}clear(){JP(eF,this).clear(),JP(tF,this).clear()}commit(){let e={nodes:JP(eF,this).commit(),edges:JP(tF,this).commit()};var t=[...arguments];return JP(nF,this).call(this,e,...t),e}},iF=class{constructor(e,t){this.body=e,this.canvas=t,this._selectionAccumulator=new rF,this.hoverObj={nodes:{},edges:{}},this.options={},this.defaultOptions={multiselect:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0},Jo(this.options,this.defaultOptions),this.body.emitter.on(`_dataChanged`,()=>{this.updateSelection()})}setOptions(e){e!==void 0&&Zb([`multiselect`,`hoverConnectedEdges`,`selectable`,`selectConnectedEdges`],this.options,e)}selectOnPoint(e){let t=!1;if(this.options.selectable===!0){let n=this.getNodeAt(e)||this.getEdgeAt(e);this.unselectAll(),n!==void 0&&(t=this.selectObject(n)),this.body.emitter.emit(`_requestRedraw`)}return t}selectAdditionalOnPoint(e){let t=!1;if(this.options.selectable===!0){let n=this.getNodeAt(e)||this.getEdgeAt(e);n!==void 0&&(t=!0,n.isSelected()===!0?this.deselectObject(n):this.selectObject(n),this.body.emitter.emit(`_requestRedraw`))}return t}_initBaseEvent(e,t){let n={};return n.pointer={DOM:{x:t.x,y:t.y},canvas:this.canvas.DOMtoCanvas(t)},n.event=e,n}generateClickEvent(e,t,n,r){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,a=this._initBaseEvent(t,n);if(i===!0)a.nodes=[],a.edges=[];else{let e=this.getSelection();a.nodes=e.nodes,a.edges=e.edges}r!==void 0&&(a.previousSelection=r),e==`click`&&(a.items=this.getClickedItems(n)),t.controlEdge!==void 0&&(a.controlEdge=t.controlEdge),this.body.emitter.emit(e,a)}selectObject(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.selectConnectedEdges;return e===void 0?!1:(e instanceof uN?(t===!0&&this._selectionAccumulator.addEdges(...e.edges),this._selectionAccumulator.addNodes(e)):this._selectionAccumulator.addEdges(e),!0)}deselectObject(e){e.isSelected()===!0&&(e.selected=!1,this._removeFromSelection(e))}_getAllNodesOverlappingWith(e){let t=[],n=this.body.nodes;for(let r=0;r<this.body.nodeIndices.length;r++){let i=this.body.nodeIndices[r];n[i].isOverlappingWith(e)&&t.push(i)}return t}_pointerToPositionObject(e){let t=this.canvas.DOMtoCanvas(e);return{left:t.x-1,top:t.y+1,right:t.x+1,bottom:t.y-1}}getNodeAt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this._pointerToPositionObject(e),r=this._getAllNodesOverlappingWith(n);if(r.length>0)return t===!0?this.body.nodes[r[r.length-1]]:r[r.length-1]}_getEdgesOverlappingWith(e,t){let n=this.body.edges;for(let r=0;r<this.body.edgeIndices.length;r++){let i=this.body.edgeIndices[r];n[i].isOverlappingWith(e)&&t.push(i)}}_getAllEdgesOverlappingWith(e){let t=[];return this._getEdgesOverlappingWith(e,t),t}getEdgeAt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this.canvas.DOMtoCanvas(e),r=10,i=null,a=this.body.edges;for(let e=0;e<this.body.edgeIndices.length;e++){let t=this.body.edgeIndices[e],o=a[t];if(o.connected){let e=o.from.x,a=o.from.y,s=o.to.x,c=o.to.y,l=o.edgeType.getDistanceToEdge(e,a,s,c,n.x,n.y);l<r&&(i=t,r=l)}}if(i!==null)return t===!0?this.body.edges[i]:i}_addToHover(e){e instanceof uN?this.hoverObj.nodes[e.id]=e:this.hoverObj.edges[e.id]=e}_removeFromSelection(e){e instanceof uN?(this._selectionAccumulator.deleteNodes(e),this._selectionAccumulator.deleteEdges(...e.edges)):this._selectionAccumulator.deleteEdges(e)}unselectAll(){this._selectionAccumulator.clear()}getSelectedNodeCount(){return this._selectionAccumulator.sizeNodes}getSelectedEdgeCount(){return this._selectionAccumulator.sizeEdges}_hoverConnectedEdges(e){for(let t=0;t<e.edges.length;t++){let n=e.edges[t];n.hover=!0,this._addToHover(n)}}emitBlurEvent(e,t,n){let r=this._initBaseEvent(e,t);n.hover===!0&&(n.hover=!1,n instanceof uN?(r.node=n.id,this.body.emitter.emit(`blurNode`,r)):(r.edge=n.id,this.body.emitter.emit(`blurEdge`,r)))}emitHoverEvent(e,t,n){let r=this._initBaseEvent(e,t),i=!1;return n.hover===!1&&(n.hover=!0,this._addToHover(n),i=!0,n instanceof uN?(r.node=n.id,this.body.emitter.emit(`hoverNode`,r)):(r.edge=n.id,this.body.emitter.emit(`hoverEdge`,r))),i}hoverObject(e,t){let n=this.getNodeAt(t);n===void 0&&(n=this.getEdgeAt(t));let r=!1;for(let i in this.hoverObj.nodes)Object.prototype.hasOwnProperty.call(this.hoverObj.nodes,i)&&(n===void 0||n instanceof uN&&n.id!=i||n instanceof XN)&&(this.emitBlurEvent(e,t,this.hoverObj.nodes[i]),delete this.hoverObj.nodes[i],r=!0);for(let i in this.hoverObj.edges)Object.prototype.hasOwnProperty.call(this.hoverObj.edges,i)&&(r===!0?(this.hoverObj.edges[i].hover=!1,delete this.hoverObj.edges[i]):(n===void 0||n instanceof XN&&n.id!=i||n instanceof uN&&!n.hover)&&(this.emitBlurEvent(e,t,this.hoverObj.edges[i]),delete this.hoverObj.edges[i],r=!0));if(n!==void 0){let i=Xf(this.hoverObj.edges).length,a=Xf(this.hoverObj.nodes).length,o=n instanceof XN&&i===0&&a===0,s=n instanceof uN&&i===0&&a===0;(r||o||s)&&(r=this.emitHoverEvent(e,t,n)),n instanceof uN&&this.options.hoverConnectedEdges===!0&&this._hoverConnectedEdges(n)}r===!0&&this.body.emitter.emit(`_requestRedraw`)}commitWithoutEmitting(){this._selectionAccumulator.commit()}commitAndEmit(e,t){let n=!1,r=this._selectionAccumulator.commit(),i={nodes:r.nodes.previous,edges:r.edges.previous};r.edges.deleted.length>0&&(this.generateClickEvent(`deselectEdge`,t,e,i),n=!0),r.nodes.deleted.length>0&&(this.generateClickEvent(`deselectNode`,t,e,i),n=!0),r.nodes.added.length>0&&(this.generateClickEvent(`selectNode`,t,e),n=!0),r.edges.added.length>0&&(this.generateClickEvent(`selectEdge`,t,e),n=!0),n===!0&&this.generateClickEvent(`select`,t,e)}getSelection(){return{nodes:this.getSelectedNodeIds(),edges:this.getSelectedEdgeIds()}}getSelectedNodes(){return this._selectionAccumulator.getNodes()}getSelectedEdges(){return this._selectionAccumulator.getEdges()}getSelectedNodeIds(){var e;return Lf(e=this._selectionAccumulator.getNodes()).call(e,e=>e.id)}getSelectedEdgeIds(){var e;return Lf(e=this._selectionAccumulator.getEdges()).call(e,e=>e.id)}setSelection(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||!e.nodes&&!e.edges)throw TypeError(`Selection must be an object with nodes and/or edges properties`);if((t.unselectAll||t.unselectAll===void 0)&&this.unselectAll(),e.nodes)for(let n of e.nodes){let e=this.body.nodes[n];if(!e)throw RangeError(`Node with id "`+n+`" not found`);this.selectObject(e,t.highlightEdges)}if(e.edges)for(let t of e.edges){let e=this.body.edges[t];if(!e)throw RangeError(`Edge with id "`+t+`" not found`);this.selectObject(e)}this.body.emitter.emit(`_requestRedraw`),this._selectionAccumulator.commit()}selectNodes(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!e||e.length===void 0)throw`Selection must be an array with ids`;this.setSelection({nodes:e},{highlightEdges:t})}selectEdges(e){if(!e||e.length===void 0)throw`Selection must be an array with ids`;this.setSelection({edges:e})}updateSelection(){for(let e in this._selectionAccumulator.getNodes())Object.prototype.hasOwnProperty.call(this.body.nodes,e.id)||this._selectionAccumulator.deleteNodes(e);for(let e in this._selectionAccumulator.getEdges())Object.prototype.hasOwnProperty.call(this.body.edges,e.id)||this._selectionAccumulator.deleteEdges(e)}getClickedItems(e){let t=this.canvas.DOMtoCanvas(e),n=[],r=this.body.nodeIndices,i=this.body.nodes;for(let e=r.length-1;e>=0;e--){let a=i[r[e]].getItemsOnPoint(t);n.push.apply(n,a)}let a=this.body.edgeIndices,o=this.body.edges;for(let e=a.length-1;e>=0;e--){let r=o[a[e]].getItemsOnPoint(t);n.push.apply(n,r)}return n}},aF=class{abstract(){throw Error(`Can't instantiate abstract class!`)}fake_use(){}curveType(){return this.abstract()}getPosition(e){return this.fake_use(e),this.abstract()}setPosition(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;this.fake_use(e,t,n),this.abstract()}getTreeSize(e){return this.fake_use(e),this.abstract()}sort(e){this.fake_use(e),this.abstract()}fix(e,t){this.fake_use(e,t),this.abstract()}shift(e,t){this.fake_use(e,t),this.abstract()}},oF=class extends aF{constructor(e){super(),this.layout=e}curveType(){return`horizontal`}getPosition(e){return e.x}setPosition(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;n!==void 0&&this.layout.hierarchical.addToOrdering(e,n),e.x=t}getTreeSize(e){let t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_x,max:t.max_x}}sort(e){JA(e).call(e,function(e,t){return e.x-t.x})}fix(e,t){e.y=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.y=!0}shift(e,t){this.layout.body.nodes[e].x+=t}},sF=class extends aF{constructor(e){super(),this.layout=e}curveType(){return`vertical`}getPosition(e){return e.y}setPosition(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;n!==void 0&&this.layout.hierarchical.addToOrdering(e,n),e.y=t}getTreeSize(e){let t=this.layout.hierarchical.getTreeSize(this.layout.body.nodes,e);return{min:t.min_y,max:t.max_y}}sort(e){JA(e).call(e,function(e,t){return e.y-t.y})}fix(e,t){e.x=this.layout.options.hierarchical.levelSeparation*t,e.options.fixed.x=!0}shift(e,t){this.layout.body.nodes[e].y+=t}},cF={},lF;function uF(){if(lF)return cF;lF=1;var e=R(),t=pl().every;return e({target:`Array`,proto:!0,forced:!pp()(`every`)},{every:function(e){return t(this,e,arguments.length>1?arguments[1]:void 0)}}),cF}var dF,fF;function pF(){return fF?dF:(fF=1,uF(),dF=os()(`Array`,`every`),dF)}var mF,hF;function gF(){if(hF)return mF;hF=1;var e=Ci(),t=pF(),n=Array.prototype;return mF=function(r){var i=r.every;return r===n||e(n,r)&&i===n.every?t:i},mF}var _F,vF;function yF(){return vF?_F:(vF=1,_F=gF(),_F)}var bF,xF;function SF(){return xF?bF:(xF=1,bF=yF(),bF)}var CF=P(SF());function wF(e,t){let n=new tA;return jp(e).call(e,e=>{var t;jp(t=e.edges).call(t,e=>{e.connected&&n.add(e)})}),jp(n).call(n,e=>{let n=e.from.id,r=e.to.id;t[n]??(t[n]=0),(t[r]==null||t[n]>=t[r])&&(t[r]=t[n]+1)}),t}function TF(e){return DF(t=>{var n,r;return CF(n=Ph(r=t.edges).call(r,t=>e.has(t.toId))).call(n,e=>e.to===t)},(e,t)=>t>e,`from`,e)}function EF(e){return DF(t=>{var n,r;return CF(n=Ph(r=t.edges).call(r,t=>e.has(t.toId))).call(n,e=>e.from===t)},(e,t)=>t<e,`to`,e)}function DF(e,t,n,r){var i;let a=qg(null),o=XD(i=[...bj(r).call(r)]).call(i,(e,t)=>e+1+t.edges.length,0),s=n+`Id`,c=n===`to`?1:-1;for(let[i,d]of r){if(!r.has(i)||!e(d))continue;a[i]=0;let f=[d],p=0,m;for(;m=f.pop();){var l,u;if(!r.has(i))continue;let e=a[m.id]+c;if(jp(l=Ph(u=m.edges).call(u,e=>e.connected&&e.to!==e.from&&e[n]!==m&&r.has(e.toId)&&r.has(e.fromId))).call(l,r=>{let i=r[s],o=a[i];(o==null||t(e,o))&&(a[i]=e,f.push(r[n]))}),p>o)return wF(r,a);++p}}return a}var OF=class{constructor(){this.childrenReference={},this.parentReference={},this.trees={},this.distributionOrdering={},this.levels={},this.distributionIndex={},this.isTree=!1,this.treeIndex=-1}addRelation(e,t){this.childrenReference[e]===void 0&&(this.childrenReference[e]=[]),this.childrenReference[e].push(t),this.parentReference[t]===void 0&&(this.parentReference[t]=[]),this.parentReference[t].push(e)}checkIfTree(){for(let e in this.parentReference)if(this.parentReference[e].length>1){this.isTree=!1;return}this.isTree=!0}numTrees(){return this.treeIndex+1}setTreeIndex(e,t){t!==void 0&&this.trees[e.id]===void 0&&(this.trees[e.id]=t,this.treeIndex=Math.max(t,this.treeIndex))}ensureLevel(e){this.levels[e]===void 0&&(this.levels[e]=0)}getMaxLevel(e){let t={},n=e=>{if(t[e]!==void 0)return t[e];let r=this.levels[e];if(this.childrenReference[e]){let t=this.childrenReference[e];if(t.length>0)for(let e=0;e<t.length;e++)r=Math.max(r,n(t[e]))}return t[e]=r,r};return n(e)}levelDownstream(e,t){this.levels[t.id]===void 0&&(this.levels[e.id]===void 0&&(this.levels[e.id]=0),this.levels[t.id]=this.levels[e.id]+1)}setMinLevelToZero(){var e;let t=new IC,n=0,r=JA(e=[...new tA(Xh(this.levels))]).call(e,(e,t)=>e-t);for(let e of r)t.set(e,n++);for(let e in this.levels)Object.prototype.hasOwnProperty.call(this.levels,e)&&(this.levels[e]=t.get(this.levels[e]))}getTreeSize(e,t){let n=1e9,r=-1e9,i=1e9,a=-1e9;for(let o in this.trees)if(Object.prototype.hasOwnProperty.call(this.trees,o)&&this.trees[o]===t){let t=e[o];n=Math.min(t.x,n),r=Math.max(t.x,r),i=Math.min(t.y,i),a=Math.max(t.y,a)}return{min_x:n,max_x:r,min_y:i,max_y:a}}hasSameParent(e,t){let n=this.parentReference[e.id],r=this.parentReference[t.id];if(n===void 0||r===void 0)return!1;for(let e=0;e<n.length;e++)for(let t=0;t<r.length;t++)if(n[e]==r[t])return!0;return!1}inSameSubNetwork(e,t){return this.trees[e.id]===this.trees[t.id]}getLevels(){return Xf(this.distributionOrdering)}addToOrdering(e,t){this.distributionOrdering[t]===void 0&&(this.distributionOrdering[t]=[]);let n=!1,r=this.distributionOrdering[t];for(let t in r)if(r[t]===e){n=!0;break}n||(this.distributionOrdering[t].push(e),this.distributionIndex[e.id]=this.distributionOrdering[t].length-1)}},kF=class{constructor(e){this.body=e,this._resetRNG(Math.random()+`:`+lp()),this.setPhysics=!1,this.options={},this.optionsBackup={physics:{}},this.defaultOptions={randomSeed:void 0,improvedLayout:!0,clusterThreshold:150,hierarchical:{enabled:!1,levelSeparation:150,nodeSpacing:100,treeSpacing:200,blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:`UD`,sortMethod:`hubsize`}},Jo(this.options,this.defaultOptions),this.bindEventListeners()}bindEventListeners(){this.body.emitter.on(`_dataChanged`,()=>{this.setupHierarchicalLayout()}),this.body.emitter.on(`_dataLoaded`,()=>{this.layoutNetwork()}),this.body.emitter.on(`_resetHierarchicalLayout`,()=>{this.setupHierarchicalLayout()}),this.body.emitter.on(`_adjustEdgesForHierarchicalLayout`,()=>{if(this.options.hierarchical.enabled!==!0)return;let e=this.direction.curveType();this.body.emitter.emit(`_forceDisableDynamicCurves`,e,!1)})}setOptions(e,t){if(e!==void 0){let n=this.options.hierarchical,r=n.enabled;if(Zb([`randomSeed`,`improvedLayout`,`clusterThreshold`],this.options,e),_x(this.options,e,`hierarchical`),e.randomSeed!==void 0&&this._resetRNG(e.randomSeed),n.enabled===!0)return r===!0&&this.body.emitter.emit(`refresh`,!0),n.direction===`RL`||n.direction===`DU`?n.levelSeparation>0&&(n.levelSeparation*=-1):n.levelSeparation<0&&(n.levelSeparation*=-1),this.setDirectionStrategy(),this.body.emitter.emit(`_resetHierarchicalLayout`),this.adaptAllOptionsForHierarchicalLayout(t);if(r===!0)return this.body.emitter.emit(`refresh`),$b(t,this.optionsBackup)}return t}_resetRNG(e){this.initialRandomSeed=e,this._rng=Pb(this.initialRandomSeed)}adaptAllOptionsForHierarchicalLayout(e){if(this.options.hierarchical.enabled===!0){let t=this.optionsBackup.physics;e.physics===void 0||e.physics===!0?(e.physics={enabled:t.enabled===void 0?!0:t.enabled,solver:`hierarchicalRepulsion`},t.enabled=t.enabled===void 0?!0:t.enabled,t.solver=t.solver||`barnesHut`):typeof e.physics==`object`?(t.enabled=e.physics.enabled===void 0?!0:e.physics.enabled,t.solver=e.physics.solver||`barnesHut`,e.physics.solver=`hierarchicalRepulsion`):e.physics!==!1&&(t.solver=`barnesHut`,e.physics={solver:`hierarchicalRepulsion`});let n=this.direction.curveType();if(e.edges===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:`dynamic`}},e.edges={smooth:!1};else if(e.edges.smooth===void 0)this.optionsBackup.edges={smooth:{enabled:!0,type:`dynamic`}},e.edges.smooth=!1;else if(typeof e.edges.smooth==`boolean`)this.optionsBackup.edges={smooth:e.edges.smooth},e.edges.smooth={enabled:e.edges.smooth,type:n};else{let t=e.edges.smooth;t.type!==void 0&&t.type!==`dynamic`&&(n=t.type),this.optionsBackup.edges={smooth:{enabled:t.enabled===void 0?!0:t.enabled,type:t.type===void 0?`dynamic`:t.type,roundness:t.roundness===void 0?.5:t.roundness,forceDirection:t.forceDirection===void 0?!1:t.forceDirection}},e.edges.smooth={enabled:t.enabled===void 0?!0:t.enabled,type:n,roundness:t.roundness===void 0?.5:t.roundness,forceDirection:t.forceDirection===void 0?!1:t.forceDirection}}this.body.emitter.emit(`_forceDisableDynamicCurves`,n)}return e}positionInitially(e){if(this.options.hierarchical.enabled!==!0){this._resetRNG(this.initialRandomSeed);let t=e.length+50;for(let n=0;n<e.length;n++){let r=e[n],i=2*Math.PI*this._rng();r.x===void 0&&(r.x=t*Math.cos(i)),r.y===void 0&&(r.y=t*Math.sin(i))}}}layoutNetwork(){if(this.options.hierarchical.enabled!==!0&&this.options.improvedLayout===!0){let e=this.body.nodeIndices,t=0;for(let n=0;n<e.length;n++)this.body.nodes[e[n]].predefinedPosition===!0&&(t+=1);if(t<.5*e.length){let t=0,n=this.options.clusterThreshold,r={clusterNodeProperties:{shape:`ellipse`,label:``,group:``,font:{multi:!1}},clusterEdgeProperties:{label:``,font:{multi:!1},smooth:{enabled:!1}}};if(e.length>n){let i=e.length;for(;e.length>n&&t<=10;){t+=1;let n=e.length;if(t%3==0?this.body.modules.clustering.clusterBridges(r):this.body.modules.clustering.clusterOutliers(r),n==e.length&&t%3!=0){this._declusterAll(),this.body.emitter.emit(`_layoutFailed`),console.info(`This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.`);return}}this.body.modules.kamadaKawai.setOptions({springLength:Math.max(150,2*i)})}t>10&&console.info(`The clustering didn't succeed within the amount of interations allowed, progressing with partial result.`),this.body.modules.kamadaKawai.solve(e,this.body.edgeIndices,!0),this._shiftToCenter();for(let t=0;t<e.length;t++){let n=this.body.nodes[e[t]];n.predefinedPosition===!1&&(n.x+=(.5-this._rng())*70,n.y+=(.5-this._rng())*70)}this._declusterAll(),this.body.emitter.emit(`_repositionBezierNodes`)}}}_shiftToCenter(){let e=sP.getRangeCore(this.body.nodes,this.body.nodeIndices),t=sP.findCenter(e);for(let e=0;e<this.body.nodeIndices.length;e++){let n=this.body.nodes[this.body.nodeIndices[e]];n.x-=t.x,n.y-=t.y}}_declusterAll(){let e=!0;for(;e===!0;){e=!1;for(let t=0;t<this.body.nodeIndices.length;t++)this.body.nodes[this.body.nodeIndices[t]].isCluster===!0&&(e=!0,this.body.modules.clustering.openCluster(this.body.nodeIndices[t],{},!1));e===!0&&this.body.emitter.emit(`_dataChanged`)}}getSeed(){return this.initialRandomSeed}setupHierarchicalLayout(){if(this.options.hierarchical.enabled===!0&&this.body.nodeIndices.length>0){let e,t,n=!1,r=!1;for(t in this.lastNodeOnLevel={},this.hierarchical=new OF,this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&(e=this.body.nodes[t],e.options.level===void 0?r=!0:(n=!0,this.hierarchical.levels[t]=e.options.level));if(r===!0&&n===!0)throw Error(`To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.`);{if(r===!0){let e=this.options.hierarchical.sortMethod;e===`hubsize`?this._determineLevelsByHubsize():e===`directed`?this._determineLevelsDirected():e===`custom`&&this._determineLevelsCustomCallback()}for(let e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this.hierarchical.ensureLevel(e);let e=this._getDistribution();this._generateMap(),this._placeNodesByHierarchy(e),this._condenseHierarchy(),this._shiftToCenter()}}}_condenseHierarchy(){var e=this;let t=!1,n={},r=()=>{let e=a(),t=0;for(let n=0;n<e.length-1;n++){let r=e[n].max-e[n+1].min;t+=r+this.options.hierarchical.treeSpacing,i(n+1,t)}},i=(e,t)=>{let n=this.hierarchical.trees;for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&n[r]===e&&this.direction.shift(r,t)},a=()=>{let e=[];for(let t=0;t<this.hierarchical.numTrees();t++)e.push(this.direction.getTreeSize(t));return e},o=(e,t)=>{if(!t[e.id]&&(t[e.id]=!0,this.hierarchical.childrenReference[e.id])){let n=this.hierarchical.childrenReference[e.id];if(n.length>0)for(let e=0;e<n.length;e++)o(this.body.nodes[n[e]],t)}},s=function(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e9,r=1e9,i=1e9,a=1e9,o=-1e9;for(let s in t)if(Object.prototype.hasOwnProperty.call(t,s)){let c=e.body.nodes[s],l=e.hierarchical.levels[c.id],u=e.direction.getPosition(c),[d,f]=e._getSpaceAroundNode(c,t);r=Math.min(d,r),i=Math.min(f,i),l<=n&&(a=Math.min(u,a),o=Math.max(u,o))}return[a,o,r,i]},c=(e,t)=>{let n=this.hierarchical.getMaxLevel(e.id),r=this.hierarchical.getMaxLevel(t.id);return Math.min(n,r)},l=(e,t,n)=>{let r=this.hierarchical;for(let i=0;i<t.length;i++){let a=t[i],o=r.distributionOrdering[a];if(o.length>1)for(let t=0;t<o.length-1;t++){let i=o[t],a=o[t+1];r.hasSameParent(i,a)&&r.inSameSubNetwork(i,a)&&e(i,a,n)}}},u=function(n,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=e.direction.getPosition(n),l=e.direction.getPosition(r),u=Math.abs(l-a),d=e.options.hierarchical.nodeSpacing;if(u>d){let a={},l={};o(n,a),o(r,l);let u=c(n,r),f=s(a,u),p=s(l,u),m=f[1],h=p[0],g=p[2];if(Math.abs(m-h)>d){let n=m-h+d;n<-g+d&&(n=-g+d),n<0&&(e._shiftBlock(r.id,n),t=!0,i===!0&&e._centerParent(r))}}},d=(e,r)=>{let i=r.id,a=r.edges,c=this.hierarchical.levels[r.id],l=this.options.hierarchical.levelSeparation*this.options.hierarchical.levelSeparation,u={},d=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.toId!=t.fromId){let n=t.toId==i?t.from:t.to;u[a[e].id]=n,this.hierarchical.levels[n.id]<c&&d.push(t)}}let f=(e,t)=>{let n=0;for(let r=0;r<t.length;r++)if(u[t[r].id]!==void 0){let i=this.direction.getPosition(u[t[r].id])-e;n+=i/Math.sqrt(i*i+l)}return n},p=(e,t)=>{let n=0;for(let r=0;r<t.length;r++)if(u[t[r].id]!==void 0){let i=this.direction.getPosition(u[t[r].id])-e;n-=l*(i*i+l)**-1.5}return n},m=(e,t)=>{let n=this.direction.getPosition(r),i={};for(let r=0;r<e;r++){let e=f(n,t),a=p(n,t),o=Math.max(-40,Math.min(40,Math.round(e/a)));if(n-=o,i[n]!==void 0)break;i[n]=r}return n},h=e=>{let i=this.direction.getPosition(r);if(n[r.id]===void 0){let e={};o(r,e),n[r.id]=e}let a=s(n[r.id]),c=a[2],l=a[3],u=e-i,d=0;u>0?d=Math.min(u,l-this.options.hierarchical.nodeSpacing):u<0&&(d=-Math.min(-u,c-this.options.hierarchical.nodeSpacing)),d!=0&&(this._shiftBlock(r.id,d),t=!0)},g=e=>{let n=this.direction.getPosition(r),[i,a]=this._getSpaceAroundNode(r),o=e-n,s=n;o>0?s=Math.min(n+(a-this.options.hierarchical.nodeSpacing),e):o<0&&(s=Math.max(n-(i-this.options.hierarchical.nodeSpacing),e)),s!==n&&(this.direction.setPosition(r,s),t=!0)},_=m(e,d);h(_),_=m(e,a),g(_)};this.options.hierarchical.blockShifting===!0&&((e=>{let n=this.hierarchical.getLevels();n=qp(n).call(n);for(let r=0;r<e&&(t=!1,l(u,n,!0),t===!0);r++);})(5),(()=>{for(let e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&this._centerParent(this.body.nodes[e])})()),this.options.hierarchical.edgeMinimization===!0&&(e=>{let n=this.hierarchical.getLevels();n=qp(n).call(n);for(let r=0;r<e;r++){t=!1;for(let e=0;e<n.length;e++){let t=n[e],r=this.hierarchical.distributionOrdering[t];for(let e=0;e<r.length;e++)d(1e3,r[e])}if(t!==!0)break}})(20),this.options.hierarchical.parentCentralization===!0&&(()=>{let e=this.hierarchical.getLevels();e=qp(e).call(e);for(let t=0;t<e.length;t++){let n=e[t],r=this.hierarchical.distributionOrdering[n];for(let e=0;e<r.length;e++)this._centerParent(r[e])}})(),r()}_getSpaceAroundNode(e,t){let n=!0;t===void 0&&(n=!1);let r=this.hierarchical.levels[e.id];if(r!==void 0){let i=this.hierarchical.distributionIndex[e.id],a=this.direction.getPosition(e),o=this.hierarchical.distributionOrdering[r],s=1e9,c=1e9;if(i!==0){let e=o[i-1];(n===!0&&t[e.id]===void 0||n===!1)&&(s=a-this.direction.getPosition(e))}if(i!=o.length-1){let e=o[i+1];if(n===!0&&t[e.id]===void 0||n===!1){let t=this.direction.getPosition(e);c=Math.min(c,t-a)}}return[s,c]}else return[0,0]}_centerParent(e){if(this.hierarchical.parentReference[e.id]){let t=this.hierarchical.parentReference[e.id];for(let e=0;e<t.length;e++){let n=t[e],r=this.body.nodes[n],i=this.hierarchical.childrenReference[n];if(i!==void 0){let e=this._getCenterPosition(i),t=this.direction.getPosition(r),[n,a]=this._getSpaceAroundNode(r),o=t-e;(o<0&&Math.abs(o)<a-this.options.hierarchical.nodeSpacing||o>0&&Math.abs(o)<n-this.options.hierarchical.nodeSpacing)&&this.direction.setPosition(r,e)}}}}_placeNodesByHierarchy(e){this.positionedNodes={};for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var t;let r=Xf(e[n]);r=this._indexArrayToNodes(r),JA(t=this.direction).call(t,r);let i=0;for(let e=0;e<r.length;e++){let t=r[e];if(this.positionedNodes[t.id]===void 0){let a=this.options.hierarchical.nodeSpacing,o=a*i;i>0&&(o=this.direction.getPosition(r[e-1])+a),this.direction.setPosition(t,o,n),this._validatePositionAndContinue(t,n,o),i++}}}}_placeBranchNodes(e,t){var n;let r=this.hierarchical.childrenReference[e];if(r===void 0)return;let i=[];for(let e=0;e<r.length;e++)i.push(this.body.nodes[r[e]]);JA(n=this.direction).call(n,i);for(let n=0;n<i.length;n++){let r=i[n],a=this.hierarchical.levels[r.id];if(a>t&&this.positionedNodes[r.id]===void 0){let t=this.options.hierarchical.nodeSpacing,o;o=n===0?this.direction.getPosition(this.body.nodes[e]):this.direction.getPosition(i[n-1])+t,this.direction.setPosition(r,o,a),this._validatePositionAndContinue(r,a,o)}else return}let a=this._getCenterPosition(i);this.direction.setPosition(this.body.nodes[e],a,t)}_validatePositionAndContinue(e,t,n){if(this.hierarchical.isTree){if(this.lastNodeOnLevel[t]!==void 0){let r=this.direction.getPosition(this.body.nodes[this.lastNodeOnLevel[t]]);if(n-r<this.options.hierarchical.nodeSpacing){let i=r+this.options.hierarchical.nodeSpacing-n,a=this._findCommonParent(this.lastNodeOnLevel[t],e.id);this._shiftBlock(a.withChild,i)}}this.lastNodeOnLevel[t]=e.id,this.positionedNodes[e.id]=!0,this._placeBranchNodes(e.id,t)}}_indexArrayToNodes(e){let t=[];for(let n=0;n<e.length;n++)t.push(this.body.nodes[e[n]]);return t}_getDistribution(){let e={},t,n;for(t in this.body.nodes)if(Object.prototype.hasOwnProperty.call(this.body.nodes,t)){n=this.body.nodes[t];let r=this.hierarchical.levels[t]===void 0?0:this.hierarchical.levels[t];this.direction.fix(n,r),e[r]===void 0&&(e[r]={}),e[r][t]=n}return e}_getActiveEdges(e){let t=[];return ix(e.edges,e=>{var n;Pg(n=this.body.edgeIndices).call(n,e.id)!==-1&&t.push(e)}),t}_getHubSizes(){let e={},t=this.body.nodeIndices;ix(t,t=>{let n=this.body.nodes[t],r=this._getActiveEdges(n).length;e[r]=!0});let n=[];return ix(e,e=>{n.push(Number(e))}),JA(n).call(n,function(e,t){return t-e}),n}_determineLevelsByHubsize(){let e=(e,t)=>{this.hierarchical.levelDownstream(e,t)},t=this._getHubSizes();for(let n=0;n<t.length;++n){let r=t[n];if(r===0)break;ix(this.body.nodeIndices,t=>{let n=this.body.nodes[t];r===this._getActiveEdges(n).length&&this._crawlNetwork(e,t)})}}_determineLevelsCustomCallback(){this._crawlNetwork((e,t,n)=>{let r=this.hierarchical.levels[e.id];r===void 0&&(r=this.hierarchical.levels[e.id]=1e5),sP.cloneOptions(e,`node`),sP.cloneOptions(t,`node`),sP.cloneOptions(n,`edge`),this.hierarchical.levels[t.id]=r+void 0}),this.hierarchical.setMinLevelToZero()}_determineLevelsDirected(){var e;let t=XD(e=this.body.nodeIndices).call(e,(e,t)=>(e.set(t,this.body.nodes[t]),e),new IC);this.options.hierarchical.shakeTowards===`roots`?this.hierarchical.levels=EF(t):this.hierarchical.levels=TF(t),this.hierarchical.setMinLevelToZero()}_generateMap(){this._crawlNetwork((e,t)=>{this.hierarchical.levels[t.id]>this.hierarchical.levels[e.id]&&this.hierarchical.addRelation(e.id,t.id)}),this.hierarchical.checkIfTree()}_crawlNetwork(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(){},t=arguments.length>1?arguments[1]:void 0,n={},r=(t,i)=>{if(n[t.id]===void 0){this.hierarchical.setTreeIndex(t,i),n[t.id]=!0;let a,o=this._getActiveEdges(t);for(let n=0;n<o.length;n++){let s=o[n];s.connected===!0&&(a=s.toId==t.id?s.from:s.to,t.id!=a.id&&(e(t,a,s),r(a,i)))}}};if(t===void 0){let e=0;for(let t=0;t<this.body.nodeIndices.length;t++){let i=this.body.nodeIndices[t];if(n[i]===void 0){let t=this.body.nodes[i];r(t,e),e+=1}}}else{let e=this.body.nodes[t];if(e===void 0){console.error(`Node not found:`,t);return}r(e)}}_shiftBlock(e,t){let n={},r=e=>{if(n[e])return;n[e]=!0,this.direction.shift(e,t);let i=this.hierarchical.childrenReference[e];if(i!==void 0)for(let e=0;e<i.length;e++)r(i[e])};r(e)}_findCommonParent(e,t){let n={},r=(e,t)=>{let n=this.hierarchical.parentReference[t];if(n!==void 0)for(let t=0;t<n.length;t++){let i=n[t];e[i]=!0,r(e,i)}},i=(e,t)=>{let n=this.hierarchical.parentReference[t];if(n!==void 0)for(let r=0;r<n.length;r++){let a=n[r];if(e[a]!==void 0)return{foundParent:a,withChild:t};let o=i(e,a);if(o.foundParent!==null)return o}return{foundParent:null,withChild:t}};return r(n,e),i(n,t)}setDirectionStrategy(){this.options.hierarchical.direction===`UD`||this.options.hierarchical.direction===`DU`?this.direction=new oF(this):this.direction=new sF(this)}_getCenterPosition(e){let t=1e9,n=-1e9;for(let r=0;r<e.length;r++){let i;if(e[r].id!==void 0)i=e[r];else{let t=e[r];i=this.body.nodes[t]}let a=this.direction.getPosition(i);t=Math.min(t,a),n=Math.max(n,a)}return .5*(t+n)}},AF=class{constructor(e,t,n,r){var i,a;this.body=e,this.canvas=t,this.selectionHandler=n,this.interactionHandler=r,this.editMode=!1,this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0,this._domEventListenerCleanupQueue=[],this.temporaryUIFunctions={},this.temporaryEventFunctions=[],this.touchTime=0,this.temporaryIds={nodes:[],edges:[]},this.guiEnabled=!1,this.inMode=!1,this.selectedControlNode=void 0,this.options={},this.defaultOptions={enabled:!1,initiallyActive:!1,addNode:!0,addEdge:!0,editNode:void 0,editEdge:!0,deleteNode:!0,deleteEdge:!0,controlNodeStyle:{shape:`dot`,size:6,color:{background:`#ff0000`,border:`#3c3c3c`,highlight:{background:`#07f968`,border:`#3c3c3c`}},borderWidth:2,borderWidthSelected:2}},Jo(this.options,this.defaultOptions),this.body.emitter.on(`destroy`,()=>{this._clean()}),this.body.emitter.on(`_dataChanged`,B(i=this._restore).call(i,this)),this.body.emitter.on(`_resetData`,B(a=this._restore).call(a,this))}_restore(){this.inMode!==!1&&(this.options.initiallyActive===!0?this.enableEditMode():this.disableEditMode())}setOptions(e,t,n){t!==void 0&&(t.locale===void 0?this.options.locale=n.locale:this.options.locale=t.locale,t.locales===void 0?this.options.locales=n.locales:this.options.locales=t.locales),e!==void 0&&(typeof e==`boolean`?this.options.enabled=e:(this.options.enabled=!0,$b(this.options,e)),this.options.initiallyActive===!0&&(this.editMode=!0),this._setup())}toggleEditMode(){this.editMode===!0?this.disableEditMode():this.enableEditMode()}enableEditMode(){this.editMode=!0,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display=`block`,this.closeDiv.style.display=`block`,this.editModeDiv.style.display=`none`,this.showManipulatorToolbar())}disableEditMode(){this.editMode=!1,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display=`none`,this.closeDiv.style.display=`none`,this.editModeDiv.style.display=`block`,this._createEditButton())}showManipulatorToolbar(){if(this._clean(),this.manipulationDOM={},this.guiEnabled===!0){var e,t;this.editMode=!0,this.manipulationDiv.style.display=`block`,this.closeDiv.style.display=`block`;let n=this.selectionHandler.getSelectedNodeCount(),r=this.selectionHandler.getSelectedEdgeCount(),i=n+r,a=this.options.locales[this.options.locale],o=!1;this.options.addNode!==!1&&(this._createAddNodeButton(a),o=!0),this.options.addEdge!==!1&&(o===!0?this._createSeperator(1):o=!0,this._createAddEdgeButton(a)),n===1&&typeof this.options.editNode==`function`?(o===!0?this._createSeperator(2):o=!0,this._createEditNodeButton(a)):r===1&&n===0&&this.options.editEdge!==!1&&(o===!0?this._createSeperator(3):o=!0,this._createEditEdgeButton(a)),i!==0&&(n>0&&this.options.deleteNode!==!1||n===0&&this.options.deleteEdge!==!1)&&(o===!0&&this._createSeperator(4),this._createDeleteButton(a)),this._bindElementEvents(this.closeDiv,B(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent(`select`,B(t=this.showManipulatorToolbar).call(t,this))}this.body.emitter.emit(`_redraw`)}addNodeMode(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode=`addNode`,this.guiEnabled===!0){var t;let e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,B(t=this.toggleEditMode).call(t,this))}this._temporaryBindEvent(`click`,B(e=this._performAddNode).call(e,this))}editNode(){this.editMode!==!0&&this.enableEditMode(),this._clean();let e=this.selectionHandler.getSelectedNodes()[0];if(e!==void 0)if(this.inMode=`editNode`,typeof this.options.editNode==`function`)if(e.isCluster!==!0){let t=$b({},e.options,!1);if(t.x=e.x,t.y=e.y,this.options.editNode.length===2)this.options.editNode(t,e=>{e!=null&&this.inMode===`editNode`&&this.body.data.nodes.getDataSet().update(e),this.showManipulatorToolbar()});else throw Error(`The function for edit does not support two arguments (data, callback)`)}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw Error(`No function has been configured to handle the editing of nodes.`);else this.showManipulatorToolbar()}addEdgeMode(){var e,t,n,r,i;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode=`addEdge`,this.guiEnabled===!0){var a;let e=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(e),this._createSeperator(),this._createDescription(e.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,B(a=this.toggleEditMode).call(a,this))}this._temporaryBindUI(`onTouch`,B(e=this._handleConnect).call(e,this)),this._temporaryBindUI(`onDragEnd`,B(t=this._finishConnect).call(t,this)),this._temporaryBindUI(`onDrag`,B(n=this._dragControlNode).call(n,this)),this._temporaryBindUI(`onRelease`,B(r=this._finishConnect).call(r,this)),this._temporaryBindUI(`onDragStart`,B(i=this._dragStartEdge).call(i,this)),this._temporaryBindUI(`onHold`,()=>{})}editEdgeMode(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode=`editEdge`,typeof this.options.editEdge==`object`&&typeof this.options.editEdge.editWithoutDrag==`function`&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){let e=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(e.from.id,e.to.id);return}if(this.guiEnabled===!0){var e;let t=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(t),this._createSeperator(),this._createDescription(t.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,B(e=this.toggleEditMode).call(e,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var t,n,r,i;let e=this.body.edges[this.edgeBeingEditedId],a=this._getNewTargetNode(e.from.x,e.from.y),o=this._getNewTargetNode(e.to.x,e.to.y);this.temporaryIds.nodes.push(a.id),this.temporaryIds.nodes.push(o.id),this.body.nodes[a.id]=a,this.body.nodeIndices.push(a.id),this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id),this._temporaryBindUI(`onTouch`,B(t=this._controlNodeTouch).call(t,this)),this._temporaryBindUI(`onTap`,()=>{}),this._temporaryBindUI(`onHold`,()=>{}),this._temporaryBindUI(`onDragStart`,B(n=this._controlNodeDragStart).call(n,this)),this._temporaryBindUI(`onDrag`,B(r=this._controlNodeDrag).call(r,this)),this._temporaryBindUI(`onDragEnd`,B(i=this._controlNodeDragEnd).call(i,this)),this._temporaryBindUI(`onMouseMove`,()=>{}),this._temporaryBindEvent(`beforeDrawing`,t=>{let n=e.edgeType.findBorderPositions(t);a.selected===!1&&(a.x=n.from.x,a.y=n.from.y),o.selected===!1&&(o.x=n.to.x,o.y=n.to.y)}),this.body.emitter.emit(`_redraw`)}else this.showManipulatorToolbar()}deleteSelected(){this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode=`delete`;let e=this.selectionHandler.getSelectedNodeIds(),t=this.selectionHandler.getSelectedEdgeIds(),n;if(e.length>0){for(let t=0;t<e.length;t++)if(this.body.nodes[e[t]].isCluster===!0){alert(this.options.locales[this.options.locale].deleteClusterError||this.options.locales.en.deleteClusterError);return}typeof this.options.deleteNode==`function`&&(n=this.options.deleteNode)}else t.length>0&&typeof this.options.deleteEdge==`function`&&(n=this.options.deleteEdge);if(typeof n==`function`){let r={nodes:e,edges:t};if(n.length===2)n(r,e=>{e!=null&&this.inMode===`delete`?(this.body.data.edges.getDataSet().remove(e.edges),this.body.data.nodes.getDataSet().remove(e.nodes),this.body.emitter.emit(`startSimulation`),this.showManipulatorToolbar()):(this.body.emitter.emit(`startSimulation`),this.showManipulatorToolbar())});else throw Error(`The function for delete does not support two arguments (data, callback)`)}else this.body.data.edges.getDataSet().remove(t),this.body.data.nodes.getDataSet().remove(e),this.body.emitter.emit(`startSimulation`),this.showManipulatorToolbar()}_setup(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}_createWrappers(){this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement(`div`),this.manipulationDiv.className=`vis-manipulation`,this.editMode===!0?this.manipulationDiv.style.display=`block`:this.manipulationDiv.style.display=`none`,this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement(`div`),this.editModeDiv.className=`vis-edit-mode`,this.editMode===!0?this.editModeDiv.style.display=`none`:this.editModeDiv.style.display=`block`,this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0&&(this.closeDiv=document.createElement(`button`),this.closeDiv.className=`vis-close`,this.closeDiv.setAttribute(`aria-label`,this.options.locales[this.options.locale]?.close??this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv))}_getNewTargetNode(e,t){let n=$b({},this.options.controlNodeStyle);n.id=`targetNode`+Gj(),n.hidden=!1,n.physics=!1,n.x=e,n.y=t;let r=this.body.functions.createNode(n);return r.shape.boundingBox={left:e,right:e,top:t,bottom:t},r}_createEditButton(){var e;this._clean(),this.manipulationDOM={},Kb(this.editModeDiv);let t=this.options.locales[this.options.locale],n=this._createButton(`editMode`,`vis-edit vis-edit-mode`,t.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(n),this._bindElementEvents(n,B(e=this.toggleEditMode).call(e,this))}_clean(){this.inMode=!1,this.guiEnabled===!0&&(Kb(this.editModeDiv),Kb(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit(`restorePhysics`)}_cleanupDOMEventListeners(){for(let t of hm(e=this._domEventListenerCleanupQueue).call(e,0)){var e;t()}}_removeManipulationDOM(){this._clean(),Kb(this.manipulationDiv),Kb(this.editModeDiv),Kb(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}_createSeperator(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM[`seperatorLineDiv`+e]=document.createElement(`div`),this.manipulationDOM[`seperatorLineDiv`+e].className=`vis-separator-line`,this.manipulationDiv.appendChild(this.manipulationDOM[`seperatorLineDiv`+e])}_createAddNodeButton(e){var t;let n=this._createButton(`addNode`,`vis-add`,e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,B(t=this.addNodeMode).call(t,this))}_createAddEdgeButton(e){var t;let n=this._createButton(`addEdge`,`vis-connect`,e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,B(t=this.addEdgeMode).call(t,this))}_createEditNodeButton(e){var t;let n=this._createButton(`editNode`,`vis-edit`,e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,B(t=this.editNode).call(t,this))}_createEditEdgeButton(e){var t;let n=this._createButton(`editEdge`,`vis-edit`,e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,B(t=this.editEdgeMode).call(t,this))}_createDeleteButton(e){var t;let n;n=this.options.rtl?`vis-delete-rtl`:`vis-delete`;let r=this._createButton(`delete`,n,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(r),this._bindElementEvents(r,B(t=this.deleteSelected).call(t,this))}_createBackButton(e){var t;let n=this._createButton(`back`,`vis-back`,e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(n),this._bindElementEvents(n,B(t=this.showManipulatorToolbar).call(t,this))}_createButton(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:`vis-label`;return this.manipulationDOM[e+`Div`]=document.createElement(`button`),this.manipulationDOM[e+`Div`].className=`vis-button `+t,this.manipulationDOM[e+`Label`]=document.createElement(`div`),this.manipulationDOM[e+`Label`].className=r,this.manipulationDOM[e+`Label`].innerText=n,this.manipulationDOM[e+`Div`].appendChild(this.manipulationDOM[e+`Label`]),this.manipulationDOM[e+`Div`]}_createDescription(e){this.manipulationDOM.descriptionLabel=document.createElement(`div`),this.manipulationDOM.descriptionLabel.className=`vis-none`,this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}_temporaryBindEvent(e,t){this.temporaryEventFunctions.push({event:e,boundFunction:t}),this.body.emitter.on(e,t)}_temporaryBindUI(e,t){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=t;else throw Error(`This UI function does not exist. Typo? You tried: `+e+` possible are: `+h_(Xf(this.body.eventListeners)))}_unbindTemporaryUIs(){for(let e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}_unbindTemporaryEvents(){for(let e=0;e<this.temporaryEventFunctions.length;e++){let t=this.temporaryEventFunctions[e].event,n=this.temporaryEventFunctions[e].boundFunction;this.body.emitter.off(t,n)}this.temporaryEventFunctions=[]}_bindElementEvents(e,t){let n=new jx(e,{});vP(n,t),this._domEventListenerCleanupQueue.push(()=>{n.destroy()});let r=e=>{let{keyCode:n,key:r}=e;(r===`Enter`||r===` `||n===13||n===32)&&t()};e.addEventListener(`keyup`,r,!1),this._domEventListenerCleanupQueue.push(()=>{e.removeEventListener(`keyup`,r,!1)})}_cleanupTemporaryNodesAndEdges(){for(let n=0;n<this.temporaryIds.edges.length;n++){var e;this.body.edges[this.temporaryIds.edges[n]].disconnect(),delete this.body.edges[this.temporaryIds.edges[n]];let r=Pg(e=this.body.edgeIndices).call(e,this.temporaryIds.edges[n]);if(r!==-1){var t;hm(t=this.body.edgeIndices).call(t,r,1)}}for(let e=0;e<this.temporaryIds.nodes.length;e++){var n;delete this.body.nodes[this.temporaryIds.nodes[e]];let t=Pg(n=this.body.nodeIndices).call(n,this.temporaryIds.nodes[e]);if(t!==-1){var r;hm(r=this.body.nodeIndices).call(r,t,1)}}this.temporaryIds={nodes:[],edges:[]}}_controlNodeTouch(e){this.selectionHandler.unselectAll(),this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Jo({},this.body.view.translation)}_controlNodeDragStart(){let e=this.lastTouch,t=this.selectionHandler._pointerToPositionObject(e),n=this.body.nodes[this.temporaryIds.nodes[0]],r=this.body.nodes[this.temporaryIds.nodes[1]],i=this.body.edges[this.edgeBeingEditedId];this.selectedControlNode=void 0;let a=n.isOverlappingWith(t),o=r.isOverlappingWith(t);a===!0?(this.selectedControlNode=n,i.edgeType.from=n):o===!0&&(this.selectedControlNode=r,i.edgeType.to=r),this.selectedControlNode!==void 0&&this.selectionHandler.selectObject(this.selectedControlNode),this.body.emitter.emit(`_redraw`)}_controlNodeDrag(e){this.body.emitter.emit(`disablePhysics`);let t=this.body.functions.getPointer(e.center),n=this.canvas.DOMtoCanvas(t);this.selectedControlNode===void 0?this.interactionHandler.onDrag(e):(this.selectedControlNode.x=n.x,this.selectedControlNode.y=n.y),this.body.emitter.emit(`_redraw`)}_controlNodeDragEnd(e){let t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),r=this.body.edges[this.edgeBeingEditedId];if(this.selectedControlNode===void 0)return;this.selectionHandler.unselectAll();let i=this.selectionHandler._getAllNodesOverlappingWith(n),a;for(let e=i.length-1;e>=0;e--)if(i[e]!==this.selectedControlNode.id){a=this.body.nodes[i[e]];break}if(a!==void 0&&this.selectedControlNode!==void 0)if(a.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{let e=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===e.id?this._performEditEdge(a.id,r.to.id):this._performEditEdge(r.from.id,a.id)}else r.updateEdgeType(),this.body.emitter.emit(`restorePhysics`);this.body.emitter.emit(`_redraw`)}_handleConnect(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=Jo({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;let t=this.lastTouch,n=this.selectionHandler.getNodeAt(t);if(n!==void 0)if(n.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{let e=this._getNewTargetNode(n.x,n.y);this.body.nodes[e.id]=e,this.body.nodeIndices.push(e.id);let t=this.body.functions.createEdge({id:`connectionEdge`+Gj(),from:n.id,to:e.id,physics:!1,smooth:{enabled:!0,type:`continuous`,roundness:.5}});this.body.edges[t.id]=t,this.body.edgeIndices.push(t.id),this.temporaryIds.nodes.push(e.id),this.temporaryIds.edges.push(t.id)}this.touchTime=new Date().valueOf()}}_dragControlNode(e){let t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),r;this.temporaryIds.edges[0]!==void 0&&(r=this.body.edges[this.temporaryIds.edges[0]].fromId);let i=this.selectionHandler._getAllNodesOverlappingWith(n),a;for(let e=i.length-1;e>=0;e--){var o;if(Pg(o=this.temporaryIds.nodes).call(o,i[e])===-1){a=this.body.nodes[i[e]];break}}if(e.controlEdge={from:r,to:a?a.id:void 0},this.selectionHandler.generateClickEvent(`controlNodeDragging`,e,t),this.temporaryIds.nodes[0]!==void 0){let e=this.body.nodes[this.temporaryIds.nodes[0]];e.x=this.canvas._XconvertDOMtoCanvas(t.x),e.y=this.canvas._YconvertDOMtoCanvas(t.y),this.body.emitter.emit(`_redraw`)}else this.interactionHandler.onDrag(e)}_finishConnect(e){let t=this.body.functions.getPointer(e.center),n=this.selectionHandler._pointerToPositionObject(t),r;this.temporaryIds.edges[0]!==void 0&&(r=this.body.edges[this.temporaryIds.edges[0]].fromId);let i=this.selectionHandler._getAllNodesOverlappingWith(n),a;for(let e=i.length-1;e>=0;e--){var o;if(Pg(o=this.temporaryIds.nodes).call(o,i[e])===-1){a=this.body.nodes[i[e]];break}}this._cleanupTemporaryNodesAndEdges(),a!==void 0&&(a.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[r]!==void 0&&this.body.nodes[a.id]!==void 0&&this._performAddEdge(r,a.id)),e.controlEdge={from:r,to:a?a.id:void 0},this.selectionHandler.generateClickEvent(`controlNodeDragEnd`,e,t),this.body.emitter.emit(`_redraw`)}_dragStartEdge(e){let t=this.lastTouch;this.selectionHandler.generateClickEvent(`dragStart`,e,t,void 0,!0)}_performAddNode(e){let t={id:Gj(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:`new`};if(typeof this.options.addNode==`function`)if(this.options.addNode.length===2)this.options.addNode(t,e=>{e!=null&&this.inMode===`addNode`&&this.body.data.nodes.getDataSet().add(e),this.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),Error(`The function for add does not support two arguments (data,callback)`);else this.body.data.nodes.getDataSet().add(t),this.showManipulatorToolbar()}_performAddEdge(e,t){let n={from:e,to:t};if(typeof this.options.addEdge==`function`)if(this.options.addEdge.length===2)this.options.addEdge(n,e=>{e!=null&&this.inMode===`addEdge`&&(this.body.data.edges.getDataSet().add(e),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw Error(`The function for connect does not support two arguments (data,callback)`);else this.body.data.edges.getDataSet().add(n),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}_performEditEdge(e,t){let n={id:this.edgeBeingEditedId,from:e,to:t,label:this.body.data.edges.get(this.edgeBeingEditedId).label},r=this.options.editEdge;if(typeof r==`object`&&(r=r.editWithoutDrag),typeof r==`function`)if(r.length===2)r(n,e=>{e==null||this.inMode!==`editEdge`?(this.body.edges[n.id].updateEdgeType(),this.body.emitter.emit(`_redraw`),this.showManipulatorToolbar()):(this.body.data.edges.getDataSet().update(e),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw Error(`The function for edit does not support two arguments (data, callback)`);else this.body.data.edges.getDataSet().update(n),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}},q=`string`,J=`boolean`,Y=`number`,jF=`array`,X=`object`,MF=`dom`,NF=`any`,PF=[`arrow`,`bar`,`box`,`circle`,`crow`,`curve`,`diamond`,`image`,`inv_curve`,`inv_triangle`,`triangle`,`vee`],FF={borderWidth:{number:Y},borderWidthSelected:{number:Y,undefined:`undefined`},brokenImage:{string:q,undefined:`undefined`},chosen:{label:{boolean:J,function:`function`},node:{boolean:J,function:`function`},__type__:{object:X,boolean:J}},color:{border:{string:q},background:{string:q},highlight:{border:{string:q},background:{string:q},__type__:{object:X,string:q}},hover:{border:{string:q},background:{string:q},__type__:{object:X,string:q}},__type__:{object:X,string:q}},opacity:{number:Y,undefined:`undefined`},fixed:{x:{boolean:J},y:{boolean:J},__type__:{object:X,boolean:J}},font:{align:{string:q},color:{string:q},size:{number:Y},face:{string:q},background:{string:q},strokeWidth:{number:Y},strokeColor:{string:q},vadjust:{number:Y},multi:{boolean:J,string:q},bold:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},boldital:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},ital:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},mono:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},__type__:{object:X,string:q}},group:{string:q,number:Y,undefined:`undefined`},heightConstraint:{minimum:{number:Y},valign:{string:q},__type__:{object:X,boolean:J,number:Y}},hidden:{boolean:J},icon:{face:{string:q},code:{string:q},size:{number:Y},color:{string:q},weight:{string:q,number:Y},__type__:{object:X}},id:{string:q,number:Y},image:{selected:{string:q,undefined:`undefined`},unselected:{string:q,undefined:`undefined`},__type__:{object:X,string:q}},imagePadding:{top:{number:Y},right:{number:Y},bottom:{number:Y},left:{number:Y},__type__:{object:X,number:Y}},label:{string:q,undefined:`undefined`},labelHighlightBold:{boolean:J},level:{number:Y,undefined:`undefined`},margin:{top:{number:Y},right:{number:Y},bottom:{number:Y},left:{number:Y},__type__:{object:X,number:Y}},mass:{number:Y},physics:{boolean:J},scaling:{min:{number:Y},max:{number:Y},label:{enabled:{boolean:J},min:{number:Y},max:{number:Y},maxVisible:{number:Y},drawThreshold:{number:Y},__type__:{object:X,boolean:J}},customScalingFunction:{function:`function`},__type__:{object:X}},shadow:{enabled:{boolean:J},color:{string:q},size:{number:Y},x:{number:Y},y:{number:Y},__type__:{object:X,boolean:J}},shape:{string:[`custom`,`ellipse`,`circle`,`database`,`box`,`text`,`image`,`circularImage`,`diamond`,`dot`,`star`,`triangle`,`triangleDown`,`square`,`icon`,`hexagon`]},ctxRenderer:{function:`function`},shapeProperties:{borderDashes:{boolean:J,array:jF},borderRadius:{number:Y},interpolation:{boolean:J},useImageSize:{boolean:J},useBorderWithImage:{boolean:J},coordinateOrigin:{string:[`center`,`top-left`]},__type__:{object:X}},size:{number:Y},title:{string:q,dom:MF,undefined:`undefined`},value:{number:Y,undefined:`undefined`},widthConstraint:{minimum:{number:Y},maximum:{number:Y},__type__:{object:X,boolean:J,number:Y}},x:{number:Y},y:{number:Y},__type__:{object:X}},IF={configure:{enabled:{boolean:J},filter:{boolean:J,string:q,array:jF,function:`function`},container:{dom:MF},showButton:{boolean:J},__type__:{object:X,boolean:J,string:q,array:jF,function:`function`}},edges:{arrows:{to:{enabled:{boolean:J},scaleFactor:{number:Y},type:{string:PF},imageHeight:{number:Y},imageWidth:{number:Y},src:{string:q},__type__:{object:X,boolean:J}},middle:{enabled:{boolean:J},scaleFactor:{number:Y},type:{string:PF},imageWidth:{number:Y},imageHeight:{number:Y},src:{string:q},__type__:{object:X,boolean:J}},from:{enabled:{boolean:J},scaleFactor:{number:Y},type:{string:PF},imageWidth:{number:Y},imageHeight:{number:Y},src:{string:q},__type__:{object:X,boolean:J}},__type__:{string:[`from`,`to`,`middle`],object:X}},endPointOffset:{from:{number:Y},to:{number:Y},__type__:{object:X,number:Y}},arrowStrikethrough:{boolean:J},background:{enabled:{boolean:J},color:{string:q},size:{number:Y},dashes:{boolean:J,array:jF},__type__:{object:X,boolean:J}},chosen:{label:{boolean:J,function:`function`},edge:{boolean:J,function:`function`},__type__:{object:X,boolean:J}},color:{color:{string:q},highlight:{string:q},hover:{string:q},inherit:{string:[`from`,`to`,`both`],boolean:J},opacity:{number:Y},__type__:{object:X,string:q}},dashes:{boolean:J,array:jF},font:{color:{string:q},size:{number:Y},face:{string:q},background:{string:q},strokeWidth:{number:Y},strokeColor:{string:q},align:{string:[`horizontal`,`top`,`middle`,`bottom`]},vadjust:{number:Y},multi:{boolean:J,string:q},bold:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},boldital:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},ital:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},mono:{color:{string:q},size:{number:Y},face:{string:q},mod:{string:q},vadjust:{number:Y},__type__:{object:X,string:q}},__type__:{object:X,string:q}},hidden:{boolean:J},hoverWidth:{function:`function`,number:Y},label:{string:q,undefined:`undefined`},labelHighlightBold:{boolean:J},length:{number:Y,undefined:`undefined`},physics:{boolean:J},scaling:{min:{number:Y},max:{number:Y},label:{enabled:{boolean:J},min:{number:Y},max:{number:Y},maxVisible:{number:Y},drawThreshold:{number:Y},__type__:{object:X,boolean:J}},customScalingFunction:{function:`function`},__type__:{object:X}},selectionWidth:{function:`function`,number:Y},selfReferenceSize:{number:Y},selfReference:{size:{number:Y},angle:{number:Y},renderBehindTheNode:{boolean:J},__type__:{object:X}},shadow:{enabled:{boolean:J},color:{string:q},size:{number:Y},x:{number:Y},y:{number:Y},__type__:{object:X,boolean:J}},smooth:{enabled:{boolean:J},type:{string:[`dynamic`,`continuous`,`discrete`,`diagonalCross`,`straightCross`,`horizontal`,`vertical`,`curvedCW`,`curvedCCW`,`cubicBezier`]},roundness:{number:Y},forceDirection:{string:[`horizontal`,`vertical`,`none`],boolean:J},__type__:{object:X,boolean:J}},title:{string:q,undefined:`undefined`},width:{number:Y},widthConstraint:{maximum:{number:Y},__type__:{object:X,boolean:J,number:Y}},value:{number:Y,undefined:`undefined`},__type__:{object:X}},groups:{useDefaultGroups:{boolean:J},__any__:FF,__type__:{object:X}},interaction:{dragNodes:{boolean:J},dragView:{boolean:J},hideEdgesOnDrag:{boolean:J},hideEdgesOnZoom:{boolean:J},hideNodesOnDrag:{boolean:J},hover:{boolean:J},keyboard:{enabled:{boolean:J},speed:{x:{number:Y},y:{number:Y},zoom:{number:Y},__type__:{object:X}},bindToWindow:{boolean:J},autoFocus:{boolean:J},__type__:{object:X,boolean:J}},multiselect:{boolean:J},navigationButtons:{boolean:J},selectable:{boolean:J},selectConnectedEdges:{boolean:J},hoverConnectedEdges:{boolean:J},tooltipDelay:{number:Y},zoomView:{boolean:J},zoomSpeed:{number:Y},__type__:{object:X}},layout:{randomSeed:{undefined:`undefined`,number:Y,string:q},improvedLayout:{boolean:J},clusterThreshold:{number:Y},hierarchical:{enabled:{boolean:J},levelSeparation:{number:Y},nodeSpacing:{number:Y},treeSpacing:{number:Y},blockShifting:{boolean:J},edgeMinimization:{boolean:J},parentCentralization:{boolean:J},direction:{string:[`UD`,`DU`,`LR`,`RL`]},sortMethod:{string:[`hubsize`,`directed`]},shakeTowards:{string:[`leaves`,`roots`]},__type__:{object:X,boolean:J}},__type__:{object:X}},manipulation:{enabled:{boolean:J},initiallyActive:{boolean:J},addNode:{boolean:J,function:`function`},addEdge:{boolean:J,function:`function`},editNode:{function:`function`},editEdge:{editWithoutDrag:{function:`function`},__type__:{object:X,boolean:J,function:`function`}},deleteNode:{boolean:J,function:`function`},deleteEdge:{boolean:J,function:`function`},controlNodeStyle:FF,__type__:{object:X,boolean:J}},nodes:FF,physics:{enabled:{boolean:J},barnesHut:{theta:{number:Y},gravitationalConstant:{number:Y},centralGravity:{number:Y},springLength:{number:Y},springConstant:{number:Y},damping:{number:Y},avoidOverlap:{number:Y},__type__:{object:X}},forceAtlas2Based:{theta:{number:Y},gravitationalConstant:{number:Y},centralGravity:{number:Y},springLength:{number:Y},springConstant:{number:Y},damping:{number:Y},avoidOverlap:{number:Y},__type__:{object:X}},repulsion:{centralGravity:{number:Y},springLength:{number:Y},springConstant:{number:Y},nodeDistance:{number:Y},damping:{number:Y},__type__:{object:X}},hierarchicalRepulsion:{centralGravity:{number:Y},springLength:{number:Y},springConstant:{number:Y},nodeDistance:{number:Y},damping:{number:Y},avoidOverlap:{number:Y},__type__:{object:X}},maxVelocity:{number:Y},minVelocity:{number:Y},solver:{string:[`barnesHut`,`repulsion`,`hierarchicalRepulsion`,`forceAtlas2Based`]},stabilization:{enabled:{boolean:J},iterations:{number:Y},updateInterval:{number:Y},onlyDynamicEdges:{boolean:J},fit:{boolean:J},__type__:{object:X,boolean:J}},timestep:{number:Y},adaptiveTimestep:{boolean:J},wind:{x:{number:Y},y:{number:Y},__type__:{object:X}},__type__:{object:X,boolean:J}},autoResize:{boolean:J},clickToUse:{boolean:J},locale:{string:q},locales:{__any__:{any:NF},__type__:{object:X}},height:{string:q},width:{string:q},__type__:{object:X}},LF={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:[`color`,`#2B7CE9`],background:[`color`,`#97C2FC`],highlight:{border:[`color`,`#2B7CE9`],background:[`color`,`#D2E5FF`]},hover:{border:[`color`,`#2B7CE9`],background:[`color`,`#D2E5FF`]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:[`color`,`#343434`],size:[14,0,100,1],face:[`arial`,`verdana`,`tahoma`],background:[`color`,`none`],strokeWidth:[0,0,50,1],strokeColor:[`color`,`#ffffff`]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:`rgba(0,0,0,0.5)`,size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:[`ellipse`,`box`,`circle`,`database`,`diamond`,`dot`,`square`,`star`,`text`,`triangle`,`triangleDown`,`hexagon`],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:`arrow`},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:`arrow`},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:`arrow`}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:[`color`,`#848484`],highlight:[`color`,`#848484`],hover:[`color`,`#848484`],inherit:[`from`,`to`,`both`,!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:[`color`,`#343434`],size:[14,0,100,1],face:[`arial`,`verdana`,`tahoma`],background:[`color`,`none`],strokeWidth:[2,0,50,1],strokeColor:[`color`,`#ffffff`],align:[`horizontal`,`top`,`middle`,`bottom`]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:`rgba(0,0,0,0.5)`,size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:[`dynamic`,`continuous`,`discrete`,`diagonalCross`,`straightCross`,`horizontal`,`vertical`,`curvedCW`,`curvedCCW`,`cubicBezier`],forceDirection:[`horizontal`,`vertical`,`none`],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:[`UD`,`DU`,`LR`,`RL`],sortMethod:[`hubsize`,`directed`],shakeTowards:[`leaves`,`roots`]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:[`barnesHut`,`forceAtlas2Based`,`repulsion`,`hierarchicalRepulsion`],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},RF=(e,t,n)=>{var r;return!!(Km(e).call(e,`physics`)&&Km(r=LF.physics.solver).call(r,t)&&n.physics.solver!==t&&t!==`wind`)},zF=class{constructor(){}getDistances(e,t,n){let r={},i=e.edges;for(let e=0;e<t.length;e++){let n=t[e],i={};r[n]=i;for(let n=0;n<t.length;n++)i[t[n]]=e==n?0:1e9}for(let e=0;e<n.length;e++){let t=i[n[e]];t.connected===!0&&r[t.fromId]!==void 0&&r[t.toId]!==void 0&&(r[t.fromId][t.toId]=1,r[t.toId][t.fromId]=1)}let a=t.length;for(let e=0;e<a;e++){let n=t[e],i=r[n];for(let e=0;e<a-1;e++){let o=t[e],s=r[o];for(let c=e+1;c<a;c++){let e=t[c],a=r[e],l=Math.min(s[e],s[n]+i[e]);s[e]=l,a[o]=l}}}return r}},BF=class{constructor(e,t,n){this.body=e,this.springLength=t,this.springConstant=n,this.distanceSolver=new zF}setOptions(e){e&&(e.springLength&&(this.springLength=e.springLength),e.springConstant&&(this.springConstant=e.springConstant))}solve(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=this.distanceSolver.getDistances(this.body,e,t);this._createL_matrix(r),this._createK_matrix(r),this._createE_matrix();let i=0,a=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),o=1e9,s=0,c=0,l=0,u=0,d=0;for(;o>.01&&i<a;)for(i+=1,[s,o,c,l]=this._getHighestEnergyNode(n),u=o,d=0;u>1&&d<5;)d+=1,this._moveNode(s,c,l),[u,c,l]=this._getEnergy(s)}_getHighestEnergyNode(e){let t=this.body.nodeIndices,n=this.body.nodes,r=0,i=t[0],a=0,o=0;for(let s=0;s<t.length;s++){let c=t[s];if(n[c].predefinedPosition!==!0||n[c].isCluster===!0&&e===!0||n[c].options.fixed.x!==!0||n[c].options.fixed.y!==!0){let[e,t,n]=this._getEnergy(c);r<e&&(r=e,i=c,a=t,o=n)}}return[i,r,a,o]}_getEnergy(e){let[t,n]=this.E_sums[e];return[Math.sqrt(t**2+n**2),t,n]}_moveNode(e,t,n){let r=this.body.nodeIndices,i=this.body.nodes,a=0,o=0,s=0,c=i[e].x,l=i[e].y,u=this.K_matrix[e],d=this.L_matrix[e];for(let t=0;t<r.length;t++){let n=r[t];if(n!==e){let e=i[n].x,t=i[n].y,r=u[n],f=d[n],p=1/((c-e)**2+(l-t)**2)**1.5;a+=r*(1-f*(l-t)**2*p),o+=r*(f*(c-e)*(l-t)*p),s+=r*(1-f*(c-e)**2*p)}}let f=a,p=o,m=t,h=s,g=n,_=(m/f+g/p)/(p/f-h/p),v=-(p*_+m)/f;i[e].x+=v,i[e].y+=_,this._updateE_matrix(e)}_createL_matrix(e){let t=this.body.nodeIndices,n=this.springLength;this.L_matrix=[];for(let r=0;r<t.length;r++){this.L_matrix[t[r]]={};for(let i=0;i<t.length;i++)this.L_matrix[t[r]][t[i]]=n*e[t[r]][t[i]]}}_createK_matrix(e){let t=this.body.nodeIndices,n=this.springConstant;this.K_matrix=[];for(let r=0;r<t.length;r++){this.K_matrix[t[r]]={};for(let i=0;i<t.length;i++)this.K_matrix[t[r]][t[i]]=n*e[t[r]][t[i]]**-2}}_createE_matrix(){let e=this.body.nodeIndices,t=this.body.nodes;this.E_matrix={},this.E_sums={};for(let t=0;t<e.length;t++)this.E_matrix[e[t]]=[];for(let n=0;n<e.length;n++){let r=e[n],i=t[r].x,a=t[r].y,o=0,s=0;for(let c=n;c<e.length;c++){let l=e[c];if(l!==r){let e=t[l].x,u=t[l].y,d=1/Math.sqrt((i-e)**2+(a-u)**2);this.E_matrix[r][c]=[this.K_matrix[r][l]*(i-e-this.L_matrix[r][l]*(i-e)*d),this.K_matrix[r][l]*(a-u-this.L_matrix[r][l]*(a-u)*d)],this.E_matrix[l][n]=this.E_matrix[r][c],o+=this.E_matrix[r][c][0],s+=this.E_matrix[r][c][1]}}this.E_sums[r]=[o,s]}}_updateE_matrix(e){let t=this.body.nodeIndices,n=this.body.nodes,r=this.E_matrix[e],i=this.K_matrix[e],a=this.L_matrix[e],o=n[e].x,s=n[e].y,c=0,l=0;for(let u=0;u<t.length;u++){let d=t[u];if(d!==e){let e=r[u],t=e[0],f=e[1],p=n[d].x,m=n[d].y,h=1/Math.sqrt((o-p)**2+(s-m)**2),g=i[d]*(o-p-a[d]*(o-p)*h),_=i[d]*(s-m-a[d]*(s-m)*h);r[u]=[g,_],c+=g,l+=_;let v=this.E_sums[d];v[0]+=g-t,v[1]+=_-f}}this.E_sums[e]=[c,l]}};function Z(e,t,n){var r,i,a,o;if(!(this instanceof Z))throw SyntaxError(`Constructor must be called with the new operator`);this.options={},this.defaultOptions={locale:`en`,locales:mS,clickToUse:!1},Jo(this.options,this.defaultOptions),this.body={container:e,nodes:{},nodeIndices:[],edges:{},edgeIndices:[],emitter:{on:B(r=this.on).call(r,this),off:B(i=this.off).call(i,this),emit:B(a=this.emit).call(a,this),once:B(o=this.once).call(o,this)},eventListeners:{onTap:function(){},onTouch:function(){},onDoubleTap:function(){},onHold:function(){},onDragStart:function(){},onDrag:function(){},onDragEnd:function(){},onMouseWheel:function(){},onPinch:function(){},onMouseMove:function(){},onRelease:function(){},onContext:function(){}},data:{nodes:null,edges:null},functions:{createNode:function(){},createEdge:function(){},getPointer:function(){}},modules:{},view:{scale:1,translation:{x:0,y:0}},selectionBox:{show:!1,position:{start:{x:0,y:0},end:{x:0,y:0}}}},this.bindEventListeners(),this.images=new _S(()=>this.body.emitter.emit(`_requestRedraw`)),this.groups=new LC,this.canvas=new bP(this.body),this.selectionHandler=new iF(this.body,this.canvas),this.interactionHandler=new TP(this.body,this.canvas,this.selectionHandler),this.view=new SP(this.body,this.canvas),this.renderer=new uP(this.body,this.canvas),this.physics=new oP(this.body),this.layoutEngine=new kF(this.body),this.clustering=new lP(this.body),this.manipulation=new AF(this.body,this.canvas,this.selectionHandler,this.interactionHandler),this.nodesHandler=new dN(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new ZN(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new BF(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(n),this.setData(t)}Fs(Z.prototype),Z.prototype.setOptions=function(e){if(e===null&&(e=void 0),e!==void 0){if(Px.validate(e,IF)===!0&&console.error(`%cErrors have been found in the supplied options object.`,Nx),Zb([`locale`,`locales`,`clickToUse`],this.options,e),e.locale!==void 0&&(e.locale=hS(e.locales||this.options.locales,e.locale)),e=this.layoutEngine.setOptions(e.layout,e),this.canvas.setOptions(e),this.groups.setOptions(e.groups),this.nodesHandler.setOptions(e.nodes),this.edgesHandler.setOptions(e.edges),this.physics.setOptions(e.physics),this.manipulation.setOptions(e.manipulation,e,this.options),this.interactionHandler.setOptions(e.interaction),this.renderer.setOptions(e.interaction),this.selectionHandler.setOptions(e.interaction),e.groups!==void 0&&this.body.emitter.emit(`refreshNodes`),`configure`in e&&(this.configurator||=new Ax(this,this.body.container,LF,this.canvas.pixelRatio,RF),this.configurator.setOptions(e.configure)),this.configurator&&this.configurator.options.enabled===!0){let e={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};$b(e.nodes,this.nodesHandler.options),$b(e.edges,this.edgesHandler.options),$b(e.layout,this.layoutEngine.options),$b(e.interaction,this.selectionHandler.options),$b(e.interaction,this.renderer.options),$b(e.interaction,this.interactionHandler.options),$b(e.manipulation,this.manipulation.options),$b(e.physics,this.physics.options),$b(e.global,this.canvas.options),$b(e.global,this.options),this.configurator.setModuleOptions(e)}e.clickToUse===void 0?this.body.emitter.emit(`activate`):e.clickToUse===!0?this.activator===void 0&&(this.activator=new kx(this.canvas.frame),this.activator.on(`change`,()=>{this.body.emitter.emit(`activate`)})):(this.activator!==void 0&&(this.activator.destroy(),delete this.activator),this.body.emitter.emit(`activate`)),this.canvas.setSize(),this.body.emitter.emit(`startSimulation`)}},Z.prototype._updateVisibleIndices=function(){let e=this.body.nodes,t=this.body.edges;this.body.nodeIndices=[],this.body.edgeIndices=[];for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&!this.clustering._isClusteredNode(t)&&e[t].options.hidden===!1&&this.body.nodeIndices.push(e[t].id);for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let r=t[n],i=e[r.fromId],a=e[r.toId],o=i!==void 0&&a!==void 0;!this.clustering._isClusteredEdge(n)&&r.options.hidden===!1&&o&&i.options.hidden===!1&&a.options.hidden===!1&&this.body.edgeIndices.push(r.id)}},Z.prototype.bindEventListeners=function(){this.body.emitter.on(`_dataChanged`,()=>{this.edgesHandler._updateState(),this.body.emitter.emit(`_dataUpdated`)}),this.body.emitter.on(`_dataUpdated`,()=>{this.clustering._updateState(),this._updateVisibleIndices(),this._updateValueRange(this.body.nodes),this._updateValueRange(this.body.edges),this.body.emitter.emit(`startSimulation`),this.body.emitter.emit(`_requestRedraw`)})},Z.prototype.setData=function(e){if(this.body.emitter.emit(`resetPhysics`),this.body.emitter.emit(`_resetData`),this.selectionHandler.unselectAll(),e&&e.dot&&(e.nodes||e.edges))throw SyntaxError(`Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.`);if(this.setOptions(e&&e.options),e&&e.dot){console.warn(`The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);`);let t=fS(e.dot);this.setData(t);return}else if(e&&e.gephi){console.warn(`The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);`);let t=pS(e.gephi);this.setData(t);return}else this.nodesHandler.setData(e&&e.nodes,!0),this.edgesHandler.setData(e&&e.edges,!0);this.body.emitter.emit(`_dataChanged`),this.body.emitter.emit(`_dataLoaded`),this.body.emitter.emit(`initPhysics`)},Z.prototype.destroy=function(){this.body.emitter.emit(`destroy`),this.body.emitter.off(),this.off(),delete this.groups,delete this.canvas,delete this.selectionHandler,delete this.interactionHandler,delete this.view,delete this.renderer,delete this.physics,delete this.layoutEngine,delete this.clustering,delete this.manipulation,delete this.nodesHandler,delete this.edgesHandler,delete this.configurator,delete this.images;for(let e in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,e)&&delete this.body.nodes[e];for(let e in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,e)&&delete this.body.edges[e];Kb(this.body.container)},Z.prototype._updateValueRange=function(e){let t,n,r,i=0;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let a=e[t].getValue();a!==void 0&&(n=n===void 0?a:Math.min(a,n),r=r===void 0?a:Math.max(a,r),i+=a)}if(n!==void 0&&r!==void 0)for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t].setValueRange(n,r,i)},Z.prototype.isActive=function(){return!this.activator||this.activator.active},Z.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)},Z.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)},Z.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)},Z.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)},Z.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)},Z.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)},Z.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)},Z.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)},Z.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)},Z.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)},Z.prototype.updateClusteredNode=function(){return this.clustering.updateClusteredNode.apply(this.clustering,arguments)},Z.prototype.getClusteredEdges=function(){return this.clustering.getClusteredEdges.apply(this.clustering,arguments)},Z.prototype.getBaseEdge=function(){return this.clustering.getBaseEdge.apply(this.clustering,arguments)},Z.prototype.getBaseEdges=function(){return this.clustering.getBaseEdges.apply(this.clustering,arguments)},Z.prototype.updateEdge=function(){return this.clustering.updateEdge.apply(this.clustering,arguments)},Z.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)},Z.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)},Z.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)},Z.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)},Z.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)},Z.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)},Z.prototype.editNodeMode=function(){return console.warn(`Deprecated: Please use editNode instead of editNodeMode.`),this.manipulation.editNode.apply(this.manipulation,arguments)},Z.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)},Z.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)},Z.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)},Z.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)},Z.prototype.getPosition=function(){return this.nodesHandler.getPosition.apply(this.nodesHandler,arguments)},Z.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)},Z.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)},Z.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)},Z.prototype.getConnectedNodes=function(e){return this.body.nodes[e]===void 0?this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments):this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments)},Z.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)},Z.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)},Z.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)},Z.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)},Z.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)},Z.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)},Z.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodeIds.apply(this.selectionHandler,arguments)},Z.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdgeIds.apply(this.selectionHandler,arguments)},Z.prototype.getNodeAt=function(){let e=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return e!==void 0&&e.id!==void 0?e.id:e},Z.prototype.getEdgeAt=function(){let e=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return e!==void 0&&e.id!==void 0?e.id:e},Z.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)},Z.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)},Z.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.selectionHandler.commitWithoutEmitting.apply(this.selectionHandler),this.redraw()},Z.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)},Z.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)},Z.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)},Z.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)},Z.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)},Z.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)},Z.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)},Z.prototype.getOptionsFromConfigurator=function(){let e={};return this.configurator&&(e=this.configurator.getOptions.apply(this.configurator)),e};var VF=[271,195,140,25,320,50,170,240,0,90,210,300,60,150,30,280];function HF(e){return`hsl(${VF[e%VF.length]}, ${e%3==0?70:e%3==1?85:60}%, 62%)`}function UF(e){return`hsl(${VF[e%VF.length]}, ${e%3==0?70:e%3==1?85:60}%, 42%)`}function WF(e){return`hsl(${VF[e%VF.length]}, 60%, 20%)`}var GF=`hsl(160, 40%, 45%)`,KF=`hsl(160, 40%, 30%)`,qF={fetching:`Fetching graph data…`,building:`Building graph layout…`,done:``},JF=`cluster:filecommunity:`,YF=`cluster:file:`;function XF(e){return`${JF}${e}`}function ZF(e){return`${YF}${e}`}function QF(e){return Number.parseInt(e.replace(JF,``),10)}function $F(e){return e.replace(YF,``)}function eI(e){return e.split(`/`).pop()??e}var tI=`unerr:graph-positions`;function nI(){try{let e=localStorage.getItem(tI);return e?JSON.parse(e):null}catch{return null}}function rI(e){try{localStorage.setItem(tI,JSON.stringify(e))}catch{}}var iI=100;function aI(e,t){let n=e.filter(e=>t.has(e.from)&&t.has(e.to));if(n.length<=iI)return n;let r={calls:3,tests:2,imports:1};return[...n].sort((e,t)=>(r[t.type]??0)-(r[e.type]??0)).slice(0,iI)}function oI(){let e=(0,f.useRef)(null),t=(0,f.useRef)(null),n=(0,f.useRef)(null),r=(0,f.useRef)(null),i=(0,f.useRef)(null),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(null),[l,u]=(0,f.useState)([]),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(`L0`),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(null),[b,x]=(0,f.useState)([{label:`All Clusters`,level:`L0`}]),[S,C]=(0,f.useState)(`fetching`),[T,E]=(0,f.useState)(0),{url:ee,queryKey:te}=Ot(),{data:D,isLoading:ne,isError:re}=N({queryKey:te([`intelligence`,`graph-visual`]),queryFn:()=>O(ee(`/api/intelligence/graph-visual`))});(0,f.useEffect)(()=>{D&&S===`fetching`?C(`building`):ne&&C(`fetching`)},[D,ne,S]),(0,f.useEffect)(()=>{if(!D?.data||!e.current)return;n.current&&=(n.current.destroy(),null);let{nodes:t,edges:a,fileNodes:s,fileEdges:l,fileCommunities:d,positions:f}=D.data,p=D._meta.view_mode;if(t.length===0){C(`done`);return}let m=f&&Object.keys(f.files).length>0?f:nI()??{communities:{},files:{},entities:{}};f&&Object.keys(f.files).length>0&&rI(f);let g=Math.max(...t.map(e=>e.fanIn+e.fanOut),1),v=t.map(e=>{let t=e.fanIn+e.fanOut,n=e.members??0,r=8+t/g*28+(n>0?Math.min(n*2,12):0),i=e.isTest===!0,a=s.find(t=>t.filePath===e.file)?.fileCommunity??0,o=i?GF:HF(a),c=i?KF:UF(a),l=t>g*.1||n>3,u=n>0?` (${n})`:``,d=e.externalOut>0?` ↗${e.externalOut}`:``,f=m.entities[e.id];return{id:e.id,label:l?`${e.label}${u}${d}`:``,title:`${e.label}\n${e.kind}${n>0?` · ${n} members`:``}\n${e.file}\nfan_in: ${e.fanIn} fan_out: ${e.fanOut}\nrisk: ${e.risk}${e.externalOut>0?`\n↗ ${e.externalOut} cross-cluster`:``}`,size:r,shape:i?`diamond`:`dot`,color:{background:o,border:c,highlight:{background:o,border:`#fafafa`},hover:{background:o,border:`#fafafa`}},font:{color:`rgba(250, 250, 250, 0.85)`,size:Math.max(10,r*.7),face:`JetBrains Mono, monospace`},borderWidth:n>0?3:2,borderWidthSelected:3,x:f?.x,y:f?.y,filePath:e.file,fileCommunity:a,_raw:e}}),b=new Map(t.map(e=>[e.id,e])),S=aI(a,new Set(t.map(e=>e.id))).map((e,t)=>{let n=b.get(e.from),r=s.find(e=>e.filePath===n?.file),i=r?HF(r.fileCommunity):`#8B5CF6`;return{id:`e-${t}`,from:e.from,to:e.to,title:e.type,color:{color:i,opacity:.25,highlight:i,hover:i},width:e.type===`calls`?1.5:1,smooth:{type:`continuous`,roundness:.3},arrows:{to:{enabled:!0,scaleFactor:.4}},font:{color:`rgba(250, 250, 250, 0.3)`,size:8,face:`JetBrains Mono, monospace`,strokeWidth:0}}}),w=new $j(v),T=new $j(S);r.current=w,i.current=T;let E=new Z(e.current,{nodes:w,edges:T},{physics:{enabled:!1},interaction:{hover:!0,tooltipDelay:150,zoomView:!0,dragView:!0,multiselect:!1},nodes:{shape:`dot`},edges:{selectionWidth:2}});n.current=E;function ee(){for(let e of s){if(t.filter(t=>t.file===e.filePath).length===0)continue;let n=m.files[e.filePath];E.cluster({joinCondition:t=>t.filePath===e.filePath,clusterNodeProperties:{id:ZF(e.filePath),label:`${e.label}\n(${e.entityCount})`,title:`${e.filePath}\n${e.entityCount} entities\nfan_in: ${e.totalFanIn} fan_out: ${e.totalFanOut}\nrisk: ${e.maxRisk}`,shape:`box`,size:15+Math.min(e.entityCount*3,30),x:n?.x,y:n?.y,color:{background:WF(e.fileCommunity),border:HF(e.fileCommunity),highlight:{background:WF(e.fileCommunity),border:`#fafafa`},hover:{background:WF(e.fileCommunity),border:`#fafafa`}},font:{color:`rgba(250, 250, 250, 0.9)`,size:11,face:`JetBrains Mono, monospace`,multi:!0},borderWidth:2,borderWidthSelected:3,fileCommunity:e.fileCommunity,_fileNode:e},clusterEdgeProperties:{color:{inherit:`both`,opacity:.35}}})}for(let e of d){let t=m.communities[e.id];E.cluster({joinCondition:t=>t.fileCommunity===e.id,clusterNodeProperties:{id:XF(e.id),label:`${e.label}\n(${e.fileCount} files)`,title:`${e.label}\n${e.fileCount} files · ${e.entityCount} entities\nCohesion: ${Math.round(e.cohesion*100)}%`,shape:`dot`,size:25+Math.min(e.fileCount*4,45),x:t?.x,y:t?.y,color:{background:WF(e.id),border:HF(e.id),highlight:{background:WF(e.id),border:`#fafafa`},hover:{background:WF(e.id),border:`#fafafa`}},font:{color:HF(e.id),size:14,face:`Space Grotesk, sans-serif`,bold:{color:`#fafafa`},multi:!0},borderWidth:e.cohesion>.5?3:2,borderWidthSelected:4,shapeProperties:{borderDashes:e.cohesion<.3?[5,5]:!1}},clusterEdgeProperties:{color:{inherit:`both`,opacity:.4},smooth:{type:`continuous`,roundness:.5}}})}}function te(e){let n=e===void 0?s:s.filter(t=>t.fileCommunity===e);for(let r of n){if(t.filter(e=>e.file===r.filePath).length<2)continue;let n=m.files[r.filePath];E.cluster({joinCondition:t=>e!==void 0&&t.fileCommunity!==e?!1:t.filePath===r.filePath,clusterNodeProperties:{id:ZF(r.filePath),label:`${r.label}\n(${r.entityCount})`,title:`${r.filePath}\n${r.entityCount} entities`,shape:`box`,size:15+Math.min(r.entityCount*3,25),x:n?.x,y:n?.y,color:{background:WF(r.fileCommunity),border:HF(r.fileCommunity),highlight:{background:WF(r.fileCommunity),border:`#fafafa`},hover:{background:WF(r.fileCommunity),border:`#fafafa`}},font:{color:`rgba(250, 250, 250, 0.9)`,size:11,face:`JetBrains Mono, monospace`,multi:!0},borderWidth:2,borderWidthSelected:3,fileCommunity:r.fileCommunity,_fileNode:r},clusterEdgeProperties:{color:{inherit:`both`,opacity:.35}}})}}p===`hierarchical`?(ee(),h(`L0`),x([{label:`All Clusters`,level:`L0`}])):p===`file-clusters`?(te(),h(`L1`),x([{label:`All Files`,level:`L1`}])):(h(`L2`),x([{label:`Flat View`,level:`L2`}])),E.setOptions({physics:{enabled:!0,solver:`forceAtlas2Based`,forceAtlas2Based:{gravitationalConstant:-60,centralGravity:.008,springLength:120,springConstant:.06,damping:.8,avoidOverlap:.3},stabilization:!1}}),E.stabilize(80),E.on(`doubleClick`,e=>{let t=e.nodes?.[0];if(t&&E.isCluster(t)){let e=String(t).startsWith(JF),n=String(t).startsWith(YF);if(E.openCluster(t,{releaseFunction:(e,t)=>{let n=Object.keys(t),r=n.length,i=Math.max(80,r*12),a={};return n.forEach((t,n)=>{let o=m.files[t]??m.entities[t];if(o)a[t]={x:e.x+o.x*.5,y:e.y+o.y*.5};else{let o=2*Math.PI*n/r;a[t]={x:e.x+i*Math.cos(o),y:e.y+i*Math.sin(o)}}}),a}}),E.setOptions({physics:{enabled:!0,solver:`forceAtlas2Based`,forceAtlas2Based:{damping:.85,gravitationalConstant:-40},stabilization:{enabled:!1}}}),setTimeout(()=>{E.setOptions({physics:{enabled:!1}})},1500),e){let e=QF(t);h(`L1`),_(e),y(null),x([{label:`All Clusters`,level:`L0`},{label:d.find(t=>t.id===e)?.label||`Cluster ${e}`,level:`L1`,communityId:e}])}else if(n){let e=$F(t);h(`L2`),y(e),x(t=>[...t.slice(0,t.length>1?2:1),{label:eI(e),level:`L2`,file:e}])}setTimeout(()=>{E.fit({animation:{duration:600,easingFunction:`easeInOutQuad`}})},200)}}),E.on(`selectNode`,e=>{let n=e.nodes[0];if(E.isCluster(n)){if(String(n).startsWith(YF)){let e=$F(n),t=s.find(t=>t.filePath===e);t&&(c(t),o(null))}return}let r=t.find(e=>e.id===n);if(r){o(r),c(null);let e=a.filter(e=>e.from===n||e.to===n),i=new Set(e.map(e=>e.from===n?e.to:e.from));u(t.filter(e=>i.has(e.id)).slice(0,20))}}),E.on(`deselectNode`,()=>{o(null),c(null),u([])});let O=!1,ne=()=>{O||(O=!0,E.setOptions({physics:{enabled:!1}}),C(`done`),ie())};E.on(`stabilizationIterationsDone`,ne);let re=setTimeout(ne,3e3);return E.on(`zoom`,()=>ie()),E.on(`dragEnd`,()=>ie()),C(`building`),()=>{clearTimeout(re),E.destroy(),n.current=null,r.current=null,i.current=null}},[D,T]);let ie=(0,f.useCallback)(()=>{let r=t.current,i=n.current;if(!r||!i)return;let a=r.getContext(`2d`);if(!a)return;let o=r.width,s=r.height;a.clearRect(0,0,o,s);let c=i.getPositions(),l=Object.values(c);if(l.length===0)return;let u=1/0,d=-1/0,f=1/0,p=-1/0;for(let e of l)e.x<u&&(u=e.x),e.x>d&&(d=e.x),e.y<f&&(f=e.y),e.y>p&&(p=e.y);let m=d-u||1,h=p-f||1;a.fillStyle=`rgba(139, 92, 246, 0.5)`;for(let e of l){let t=10+(e.x-u)/m*(o-20),n=10+(e.y-f)/h*(s-20);a.beginPath(),a.arc(t,n,1.5,0,Math.PI*2),a.fill()}try{let t=i.getViewPosition(),n=i.getScale(),r=e.current;if(r&&t){let e=r.clientWidth/n,i=r.clientHeight/n,c=10+(t.x-e/2-u)/m*(o-20),l=10+(t.y-i/2-f)/h*(s-20),d=e/m*(o-20),p=i/h*(s-20);a.strokeStyle=`rgba(250, 250, 250, 0.6)`,a.lineWidth=1,a.strokeRect(c,l,d,p)}}catch{}},[]),k=(0,f.useCallback)(e=>{if(!n.current||!D?.data)return;let{fileCommunities:t,fileNodes:r,nodes:i}=D.data;e.level===`L0`?(h(`L0`),_(null),y(null),x([{label:`All Clusters`,level:`L0`}])):e.level===`L1`&&e.communityId!=null&&(h(`L1`),_(e.communityId),y(null),x([{label:`All Clusters`,level:`L0`},{label:e.label,level:`L1`,communityId:e.communityId}])),C(`building`),E(e=>e+1)},[D]);(0,f.useEffect)(()=>{function e(e){if(e.key===`Escape`&&b.length>1){let e=b[b.length-2];k(e)}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b,k]);let A=(0,f.useCallback)(e=>{if(p(e),!n.current||!D?.data||e.length<2)return;let t=e.toLowerCase(),r=D.data.nodes.find(e=>e.label.toLowerCase().includes(t)),i=D.data.fileNodes.find(e=>e.label.toLowerCase().includes(t)||e.filePath.toLowerCase().includes(t)),a=r?.id??(i?ZF(i.filePath):null);if(a&&n.current){let e=n.current.findNode(a);if(e&&e.length>1)for(let t=0;t<e.length-1;t++){let r=e[t];n.current.isCluster(r)&&n.current.openCluster(r)}n.current.selectNodes([a]),n.current.focus(a,{scale:1.5,animation:{duration:600,easingFunction:`easeInOutQuad`}}),r?(o(r),c(null)):i&&(c(i),o(null))}},[D]),ae=(0,f.useCallback)(()=>{if(!e.current)return;let t=e.current.querySelector(`canvas`);if(!t)return;let n=document.createElement(`canvas`);n.width=t.width,n.height=t.height;let r=n.getContext(`2d`);if(!r)return;r.drawImage(t,0,0);let i=document.createElement(`a`);i.download=`unerr-codebase-map.png`,i.href=n.toDataURL(`image/png`),i.click()},[]),j=D?.data?.nodes.length??0;D?.data?.edges.length;let M=D?._meta,oe=M?.file_count??0,se=M?.file_edge_count??0,ce=M?.collapsed_count??0,le=M?.total_entities??0,ue=D?.data?.fileCommunities??[],de=M?.view_mode??`flat`,fe=S!==`done`&&!re;return(0,w.jsxs)(`div`,{className:`flex h-[calc(100vh-73px)] flex-col gap-0 overflow-hidden lg:flex-row`,children:[(0,w.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border-subtle bg-surface/80 px-4 py-2 backdrop-blur`,children:[(0,w.jsx)(`nav`,{className:`flex items-center gap-1 text-xs`,children:b.map((e,t)=>(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t>0&&(0,w.jsx)(`span`,{className:`t-ghost`,children:`›`}),t<b.length-1?(0,w.jsx)(`button`,{type:`button`,onClick:()=>k(e),className:`rounded px-1.5 py-0.5 text-violet-400 transition hover:bg-violet-500/10 hover:text-violet-300`,children:e.label}):(0,w.jsx)(`span`,{className:`px-1.5 py-0.5 text-foreground font-medium`,children:e.label})]},`${e.level}-${e.communityId??e.file??`root`}`))}),(0,w.jsx)(`div`,{className:`mx-2 h-4 w-px bg-border-subtle`}),(0,w.jsx)(`input`,{type:`search`,value:d,onChange:e=>A(e.target.value),placeholder:`Search files & entities...`,className:`w-48 rounded-lg border border-border bg-background px-3 py-1.5 font-mono text-sm text-foreground outline-none ring-violet-500 placeholder:t-tertiary focus:ring-2 focus:border-violet-500`}),(0,w.jsx)(`div`,{className:`flex-1`}),(0,w.jsxs)(`span`,{className:`font-mono text-xs t-tertiary`,children:[oe,` files · `,j,` entities`,de!==`flat`&&(0,w.jsx)(`span`,{className:`ml-2 rounded bg-violet-500/10 px-1.5 py-0.5 text-violet-400`,children:m===`L0`?`Clusters`:m===`L1`?`Files`:`Entities`})]}),b.length>1&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>k(b[b.length-2]),className:`rounded-lg border border-border-subtle el-raised px-3 py-1.5 text-xs font-medium text-foreground transition hover:el-overlay hover:border-violet-500`,title:`Zoom out (Esc)`,children:`↑ Up`}),(0,w.jsx)(`button`,{type:`button`,onClick:ae,className:`rounded-lg border border-border-subtle el-raised px-3 py-1.5 text-xs font-medium text-foreground transition hover:el-overlay hover:border-violet-500`,children:`Export PNG`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>n.current?.fit({animation:!0}),className:`rounded-lg border border-border-subtle el-raised px-3 py-1.5 text-xs font-medium text-foreground transition hover:el-overlay hover:border-violet-500`,children:`Fit`})]}),(0,w.jsxs)(`div`,{className:`relative flex-1 bg-background`,children:[fe&&(0,w.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center pointer-events-none`,children:(0,w.jsxs)(`div`,{className:`flex flex-col items-center gap-4 rounded-xl border border-border-subtle bg-surface-default/95 px-10 py-8 shadow-2xl backdrop-blur-sm`,children:[(0,w.jsxs)(`svg`,{"aria-hidden":`true`,className:`h-12 w-12 animate-spin`,viewBox:`0 0 48 48`,fill:`none`,children:[(0,w.jsx)(`circle`,{cx:`24`,cy:`24`,r:`20`,stroke:`rgba(255,255,255,0.06)`,strokeWidth:`5`}),(0,w.jsx)(`path`,{d:`M24 4 A20 20 0 0 1 41.32 34`,stroke:`#8B5CF6`,strokeWidth:`5`,strokeLinecap:`round`}),(0,w.jsx)(`path`,{d:`M41.32 34 A20 20 0 0 1 14 40.64`,stroke:`#22D3EE`,strokeWidth:`5`,strokeLinecap:`round`}),(0,w.jsx)(`path`,{d:`M14 40.64 A20 20 0 0 1 6.06 17.1`,stroke:`#34D399`,strokeWidth:`5`,strokeLinecap:`round`})]}),(0,w.jsx)(`p`,{className:`font-mono text-sm text-foreground font-medium`,children:qF[S]}),j>0&&(0,w.jsxs)(`p`,{className:`font-mono text-[11px] t-tertiary`,children:[oe,` files · `,j,` entities`]})]})}),re&&(0,w.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-center justify-center`,children:(0,w.jsxs)(`div`,{className:`glass-panel rounded-xl p-8 text-center`,children:[(0,w.jsx)(`p`,{className:`text-error text-sm font-medium`,children:`Graph unavailable`}),(0,w.jsxs)(`p`,{className:`mt-2 t-secondary text-xs`,children:[`Intelligence graph not loaded. Run`,` `,(0,w.jsx)(`code`,{className:`rounded el-substrate px-1.5 py-0.5 font-mono`,children:`unerr`}),` `,`in your project to index.`]})]})}),!ne&&!re&&j===0&&(0,w.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-center justify-center`,children:(0,w.jsxs)(`div`,{className:`glass-panel rounded-xl p-8 text-center`,children:[(0,w.jsx)(`p`,{className:`text-foreground text-sm font-medium`,children:`No entities found`}),(0,w.jsx)(`p`,{className:`mt-2 t-secondary text-xs`,children:`The graph will appear once the project is indexed.`})]})}),(0,w.jsx)(`div`,{ref:e,className:`absolute inset-0`,style:{opacity:S===`done`?1:S===`building`?.4:.2,transition:`opacity 0.8s ease`}}),S===`done`&&(0,w.jsx)(`div`,{className:`absolute bottom-4 left-4 rounded-lg border border-border-subtle bg-surface-default/90 p-1 backdrop-blur-sm`,children:(0,w.jsx)(`canvas`,{ref:t,width:160,height:100,className:`rounded`,style:{background:`rgba(0,0,0,0.3)`}})}),S===`done`&&m===`L0`&&de===`hierarchical`&&(0,w.jsx)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 rounded-lg border border-border-subtle bg-surface-default/90 px-3 py-2 backdrop-blur-sm`,children:(0,w.jsx)(`p`,{className:`font-mono text-[10px] t-secondary`,children:`Double-click a cluster to explore its files`})})]})]}),(0,w.jsx)(`aside`,{className:`w-full shrink-0 overflow-y-auto border-t border-border-subtle glass-panel lg:w-80 lg:border-t-0 lg:border-l`,children:(0,w.jsxs)(`div`,{className:`p-4`,children:[a?(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`section-label text-violet-500`,children:`Selected entity`}),(0,w.jsxs)(`div`,{className:`mt-2 rounded-lg el-raised p-3`,children:[(0,w.jsx)(`div`,{className:`font-mono text-live text-sm font-medium`,children:a.label}),(0,w.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 flex-wrap`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:a.kind}),(a.members??0)>0&&(0,w.jsxs)(`span`,{className:`rounded bg-violet-500/15 px-1.5 py-0.5 font-mono text-[10px] font-medium text-violet-400`,children:[a.members,` members`]}),a.isTest&&(0,w.jsx)(`span`,{className:`rounded bg-emerald-500/15 px-1.5 py-0.5 font-mono text-[10px] font-medium text-emerald-400`,children:`test`})]}),(0,w.jsx)(`div`,{className:`mt-1 truncate t-tertiary text-xs`,children:a.file}),(0,w.jsxs)(`div`,{className:`mt-2 flex gap-3 text-xs`,children:[(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`in`}),` `,(0,w.jsx)(`span`,{className:`font-mono text-live`,children:a.fanIn})]}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`out`}),` `,(0,w.jsx)(`span`,{className:`font-mono text-live`,children:a.fanOut})]}),(0,w.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[10px] font-medium ${a.risk===`critical`?`bg-error/15 text-error`:a.risk===`high`?`bg-warning/15 text-warning`:a.risk===`medium`?`bg-violet-500/15 text-violet-500`:`bg-success/15 text-success`}`,children:a.risk})]})]})]}),(a.externalOut>0||a.externalIn>0)&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`section-label t-secondary`,children:`Cross-cluster`}),(0,w.jsxs)(`div`,{className:`mt-2 flex gap-4 text-xs`,children:[a.externalOut>0&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{className:`text-warning`,children:`↗`}),(0,w.jsx)(`span`,{className:`font-mono text-live`,children:a.externalOut}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`outbound`})]}),a.externalIn>0&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{className:`text-info`,children:`↙`}),(0,w.jsx)(`span`,{className:`font-mono text-live`,children:a.externalIn}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`inbound`})]})]})]}),g!=null&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`section-label t-secondary`,children:`Location`}),(0,w.jsxs)(`div`,{className:`mt-2 text-xs`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full`,style:{backgroundColor:HF(g)}}),(0,w.jsx)(`span`,{className:`text-foreground`,children:ue.find(e=>e.id===g)?.label||`Cluster ${g}`})]}),ue.find(e=>e.id===g)?.cohesion!=null&&(0,w.jsxs)(`div`,{className:`mt-1 t-tertiary`,children:[`Cohesion:`,` `,Math.round((ue.find(e=>e.id===g)?.cohesion??0)*100),`%`]})]})]}),l.length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`h3`,{className:`section-label t-secondary`,children:[`Connected (`,l.length,`)`]}),(0,w.jsx)(`ul`,{className:`mt-2 max-h-48 space-y-1 overflow-auto custom-scrollbar`,children:l.map(e=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(`button`,{type:`button`,onClick:()=>{n.current&&(n.current.selectNodes([e.id]),n.current.focus(e.id,{scale:1.5,animation:{duration:400,easingFunction:`easeInOutQuad`}})),o(e)},className:`w-full rounded px-2 py-1 text-left text-xs transition hover:el-raised`,children:[(0,w.jsx)(`span`,{className:`font-mono text-live`,children:e.label}),(0,w.jsxs)(`span`,{className:`t-tertiary`,children:[` `,`· `,eI(e.file)]})]})},e.id))})]})]}):s?(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`section-label text-violet-500`,children:`Selected file`}),(0,w.jsxs)(`div`,{className:`mt-2 rounded-lg el-raised p-3`,children:[(0,w.jsx)(`div`,{className:`font-mono text-live text-sm font-medium`,children:s.label}),(0,w.jsx)(`div`,{className:`mt-1 truncate t-tertiary text-xs`,children:s.filePath}),(0,w.jsxs)(`div`,{className:`mt-2 flex gap-3 text-xs flex-wrap`,children:[(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`entities`}),` `,(0,w.jsx)(`span`,{className:`font-mono text-live`,children:s.entityCount})]}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`fan_in`}),` `,(0,w.jsx)(`span`,{className:`font-mono text-live`,children:s.totalFanIn})]}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`fan_out`}),` `,(0,w.jsx)(`span`,{className:`font-mono text-live`,children:s.totalFanOut})]}),(0,w.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[10px] font-medium ${s.maxRisk===`high`?`bg-warning/15 text-warning`:s.maxRisk===`medium`?`bg-violet-500/15 text-violet-500`:`bg-success/15 text-success`}`,children:s.maxRisk})]}),(0,w.jsx)(`div`,{className:`mt-2 flex gap-2 flex-wrap`,children:Object.entries(s.kinds).map(([e,t])=>(0,w.jsxs)(`span`,{className:`rounded bg-surface-overlay px-1.5 py-0.5 font-mono text-[10px] t-secondary`,children:[e,`: `,t]},e))})]})]}),(s.externalOut>0||s.externalIn>0)&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`section-label t-secondary`,children:`Cross-cluster edges`}),(0,w.jsxs)(`div`,{className:`mt-2 flex gap-4 text-xs`,children:[s.externalOut>0&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{className:`text-warning`,children:`↗`}),(0,w.jsx)(`span`,{className:`font-mono text-live`,children:s.externalOut}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`outbound`})]}),s.externalIn>0&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{className:`text-info`,children:`↙`}),(0,w.jsx)(`span`,{className:`font-mono text-live`,children:s.externalIn}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`inbound`})]})]})]})]}):(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`section-label text-violet-500`,children:`Inspector`}),(0,w.jsx)(`p`,{className:`mt-3 t-secondary text-xs leading-relaxed`,children:m===`L0`?`Double-click a file cluster to explore its files. Click a node for details.`:m===`L1`?`Double-click a file to see its entities. Click a node for details.`:`Click a node to inspect its connections, risk level, and dependencies.`})]}),(0,w.jsxs)(`div`,{className:`mt-6`,children:[(0,w.jsx)(`h3`,{className:`section-label t-secondary`,children:`File Clusters`}),(0,w.jsxs)(`ul`,{className:`mt-2 max-h-40 space-y-1 overflow-auto custom-scrollbar`,children:[ue.slice(0,16).map(e=>(0,w.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,w.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 rounded-full`,style:{backgroundColor:HF(e.id)}}),(0,w.jsx)(`span`,{className:`truncate text-foreground`,children:e.label}),(0,w.jsxs)(`span`,{className:`ml-auto tabular-nums t-tertiary`,children:[e.fileCount,`f`]}),e.cohesion<.3&&(0,w.jsx)(`span`,{className:`text-warning text-[10px]`,title:`Low cohesion`,children:`!`})]},e.id)),(0,w.jsxs)(`li`,{className:`flex items-center gap-2 text-xs`,children:[(0,w.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 rotate-45 rounded-sm`,style:{backgroundColor:GF}}),(0,w.jsx)(`span`,{className:`text-foreground`,children:`Test files`}),(0,w.jsx)(`span`,{className:`ml-auto t-tertiary`,children:`◇`})]})]})]}),(0,w.jsxs)(`div`,{className:`mt-6 rounded-lg border border-border-subtle el-raised p-3`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`t-secondary`,children:`Files`}),(0,w.jsx)(`div`,{className:`font-mono text-live text-lg tabular-nums`,children:oe})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`t-secondary`,children:`File edges`}),(0,w.jsx)(`div`,{className:`font-mono text-live text-lg tabular-nums`,children:se})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`t-secondary`,children:`Clusters`}),(0,w.jsx)(`div`,{className:`font-mono text-live text-lg tabular-nums`,children:ue.length})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`t-secondary`,children:`Entities`}),(0,w.jsx)(`div`,{className:`font-mono text-live text-lg tabular-nums`,children:le})]})]}),ce>0&&(0,w.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border-subtle t-tertiary text-[10px]`,children:[ce,` child entities (methods, types, constructors) merged into parent nodes`]}),de!==`flat`&&(0,w.jsxs)(`div`,{className:`mt-2 pt-2 border-t border-border-subtle t-tertiary text-[10px]`,children:[`View:`,` `,de===`hierarchical`?`Hierarchical (L0→L1→L2)`:`File clusters`,` `,`· Level: `,m]})]})]})})]})}function sI(e){return e.split(`/`).pop()||e}function cI(e){return e.replace(/_/g,` `)}function lI(e){let t=Date.parse(e);if(!Number.isFinite(t))return``;let n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function uI(e){return e>=20?{label:`high blast radius`,icon:`▲`,text:`text-error`,chip:`bg-error/15 text-error`}:e>=8?{label:`elevated`,icon:`✦`,text:`text-amber-300`,chip:`bg-amber-500/15 text-amber-300`}:{label:`contained`,icon:`✦`,text:`text-cyan-300`,chip:`bg-cyan-500/10 text-cyan-300`}}function dI(){let{url:e,queryKey:t}=Ot(),n=N({queryKey:t([`guard`,`firings`]),queryFn:()=>O(e(`/api/guard/firings`)),refetchInterval:1e4});if(n.isLoading)return(0,w.jsx)(Wt,{});let r=n.data?.data?.sessions??[],i=n.data?.data?.totals;return(0,w.jsxs)(`div`,{className:`mx-auto max-w-4xl px-4 py-6`,children:[(0,w.jsxs)(`header`,{className:`mb-6`,children:[(0,w.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:`Cascade Guard`}),(0,w.jsx)(`p`,{className:`mt-1 text-sm t-secondary`,children:`Edits the agent was about to make to widely-used code — caught before they could silently break the callers that depend on them. Each firing shows the actual callers at risk, so you can check the save yourself.`})]}),i&&(0,w.jsxs)(`div`,{className:`mb-6 flex flex-wrap gap-3`,children:[(0,w.jsx)(fI,{value:i.recent_window,label:`caught in the last ${i.window_days} days`,accent:`text-foreground`}),(0,w.jsx)(fI,{value:i.cascade_firings,label:`breaking-change firings`,accent:`text-amber-300`}),(0,w.jsx)(fI,{value:i.boundary_firings,label:`boundary-breach firings`,accent:`text-violet-300`}),(0,w.jsx)(fI,{value:i.total_firings,label:`recorded all-time (context)`,accent:`t-tertiary`})]}),r.length===0?(0,w.jsx)(pI,{}):(0,w.jsx)(`div`,{className:`space-y-5`,children:r.map(e=>(0,w.jsx)(mI,{session:e},e.session_id))})]})}function fI({value:e,label:t,accent:n}){return(0,w.jsxs)(`div`,{className:`rounded-xl border border-border-subtle bg-white/3 px-4 py-3`,children:[(0,w.jsx)(`p`,{className:`font-mono text-xl font-semibold tabular-nums ${n}`,children:e}),(0,w.jsx)(`p`,{className:`mt-0.5 text-[11px] t-secondary`,children:t})]})}function pI(){return(0,w.jsxs)(`div`,{className:`rounded-xl border border-border-subtle bg-white/3 px-6 py-10 text-center`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium text-emerald-400`,children:`Cascade Guard is active and watching.`}),(0,w.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm t-secondary`,children:`Nothing risky has been caught yet. The guard checks every edit the agent makes to shared code; an empty feed means no breaking change has been attempted — that's the outcome you want.`})]})}function mI({session:e}){return(0,w.jsxs)(`section`,{className:`rounded-xl border border-border-subtle bg-card`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-subtle px-4 py-2.5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`rounded bg-white/5 px-1.5 py-0.5 font-mono text-[11px] text-foreground/80`,children:e.agent}),(0,w.jsxs)(`span`,{className:`font-mono text-[11px] t-tertiary`,children:[`session `,e.session_id.slice(0,8)]})]}),(0,w.jsxs)(`span`,{className:`font-mono text-[11px] tabular-nums t-tertiary`,children:[e.firing_count,` firing`,e.firing_count===1?``:`s`,` ·`,` `,lI(e.last_at)]})]}),(0,w.jsx)(`div`,{className:`divide-y divide-border-subtle`,children:e.prompts.map((e,t)=>(0,w.jsx)(hI,{group:e},e.prompt_ts??`none-${t}`))})]})}function hI({group:e}){return(0,w.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,w.jsx)(`p`,{className:`mb-2 text-[13px] text-foreground/90`,children:e.prompt?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`prompt: `}),(0,w.jsxs)(`span`,{className:`italic`,children:[`"`,e.prompt,`"`]})]}):(0,w.jsx)(`span`,{className:`t-tertiary italic`,children:`No captured prompt`})}),(0,w.jsx)(`div`,{className:`space-y-2`,children:e.firings.map(e=>(0,w.jsx)(gI,{firing:e},e.id))})]})}function gI({firing:e}){let[t,n]=(0,f.useState)(!1),r=e.type===`boundary_violation_flagged`,i=uI(e.max_at_risk),a=e.file_path?sI(e.file_path):`unknown file`;return(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle bg-white/3`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-2 px-3 py-2 text-left`,children:[(0,w.jsx)(`span`,{className:`shrink-0 ${r?`text-violet-300`:i.text}`,children:r?`▦`:i.icon}),(0,w.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-[12px] text-foreground`,children:[r?`Boundary breach`:`Blocked edit`,` · `,a]}),!r&&e.entities[0]&&(0,w.jsxs)(`span`,{className:`ml-1 font-mono text-[12px] t-secondary`,children:[e.entities[0].entity,`()`,e.entities.length>1?` +${e.entities.length-1} more`:``]})]}),(0,w.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0.5 font-mono text-[10px] tabular-nums ${r?`bg-violet-500/15 text-violet-300`:i.chip}`,children:r?`${e.breaches.length} breach${e.breaches.length===1?``:`es`}`:`${e.max_at_risk} callers · ${i.label}`}),(0,w.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] t-tertiary`,children:t?`▾`:`▸`})]}),t&&(0,w.jsx)(`div`,{className:`border-t border-border-subtle px-3 py-2.5`,children:r?e.breaches.map(e=>(0,w.jsxs)(`div`,{className:`mb-2 last:mb-0`,children:[(0,w.jsxs)(`p`,{className:`font-mono text-[11px] text-foreground/80`,children:[sI(e.source_file),` `,(0,w.jsxs)(`span`,{className:`t-tertiary`,children:[`(`,e.source_layer,`)`]}),` `,(0,w.jsxs)(`span`,{className:`text-violet-300`,children:[`→ `,e.target_layer]})]}),(0,w.jsxs)(`p`,{className:`mt-0.5 font-mono text-[11px] t-tertiary`,children:[`imports `,e.specifier]})]},`${e.source_file}→${e.target_layer}:${e.specifier}`)):e.entities.map((e,t)=>(0,w.jsx)(_I,{entity:e},e.entity_key??`${e.entity}-${t}`))})]})}function _I({entity:e}){return(0,w.jsxs)(`div`,{className:`mb-3 last:mb-0`,children:[(0,w.jsxs)(`p`,{className:`font-mono text-[11px] text-foreground/90`,children:[e.entity,`()`,(0,w.jsx)(`span`,{className:`ml-1.5 t-tertiary`,children:cI(e.change_type)})]}),e.callers.length>0?(0,w.jsxs)(`ul`,{className:`mt-1 space-y-0.5`,children:[e.callers.map((e,t)=>(0,w.jsxs)(`li`,{className:`font-mono text-[11px] t-secondary`,children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`├ `}),sI(e.file),`:`,e.entity,e.is_test&&(0,w.jsx)(`span`,{className:`ml-1 rounded bg-white/5 px-1 text-[9px] t-tertiary`,children:`test`})]},`${e.file}:${e.line}-${t}`)),e.callers_truncated>0&&(0,w.jsxs)(`li`,{className:`font-mono text-[11px] t-tertiary`,children:[`└ +`,e.callers_truncated,` more caller`,e.callers_truncated===1?``:`s`]})]}):(0,w.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] t-tertiary`,children:[e.total_at_risk,` caller`,e.total_at_risk===1?``:`s`,` at risk (names not recorded for this firing)`]})]})}var vI=20,yI=15e3;function bI(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function xI(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2])-1,i=Number(t[3]),a=new Date(n,r,i,0,0,0,0),o=new Date(n,r,i+1,0,0,0,0);return{from_ts:a.toISOString(),to_ts:o.toISOString()}}function SI(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=Date.now()-t.getTime();if(n<0)return`just now`;let r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function CI(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}function wI(e){return e.length>10?`${e.slice(0,8)}…`:e}function TI(e){return e==null?`—`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function EI(e,t=900){let[n,r]=(0,f.useState)(e),i=(0,f.useRef)(!1);return(0,f.useEffect)(()=>{if(i.current||e<=0){r(e);return}if(typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches){r(e);return}i.current=!0;let n=0,a=performance.now(),o=i=>{let s=Math.min(1,(i-a)/t);r(e*(1-(1-s)**3)),s<1?n=requestAnimationFrame(o):r(e)};return n=requestAnimationFrame(o),()=>cancelAnimationFrame(n)},[e,t]),n}function DI({value:e,format:t}){let n=EI(e);return(0,w.jsx)(w.Fragment,{children:t(Math.round(n))})}var OI=[{stripe:`border-l-violet-400`,chip:`bg-violet-500/15 text-violet-200`,bg:`bg-violet-500/4`},{stripe:`border-l-cyan-400`,chip:`bg-cyan-500/15 text-cyan-200`,bg:`bg-cyan-500/4`},{stripe:`border-l-emerald-400`,chip:`bg-emerald-500/15 text-emerald-200`,bg:`bg-emerald-500/4`},{stripe:`border-l-amber-400`,chip:`bg-amber-500/15 text-amber-200`,bg:`bg-amber-500/4`},{stripe:`border-l-rose-400`,chip:`bg-rose-500/15 text-rose-200`,bg:`bg-rose-500/4`},{stripe:`border-l-sky-400`,chip:`bg-sky-500/15 text-sky-200`,bg:`bg-sky-500/4`},{stripe:`border-l-fuchsia-400`,chip:`bg-fuchsia-500/15 text-fuchsia-200`,bg:`bg-fuchsia-500/4`},{stripe:`border-l-lime-400`,chip:`bg-lime-500/15 text-lime-200`,bg:`bg-lime-500/4`}];function kI(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return OI[Math.abs(t)%OI.length]}var AI={shell_compression:`Shell compressed`,file_read:`Read trimmed`,fetch_url:`Fetch cleaned`,graph_query:`Graph used`,session_dedup:`Context deduped`,format_encoding:`Response compacted`,smart_truncation:`Smart trim`,behavior_automation:`Automation`,persistent_memory:`Memory`},jI={stale_edit_prevented:`✦`,cascade_guard:`✦`,boundary_violation_flagged:`▦`,incomplete_work_flagged:`◌`,cascade_warning_consumed:`✓`,intervention_halted:`✕`,intervention_warned:`!`,loop_broken:`⟲`,full_read_avoided:`▥`,graph_query_served:`◈`,caller_check_enforced:`⊕`,drift_consumed:`≈`,convention_applied:`◇`,defuddle_selector_skipped:`▤`,fact_recalled:`❝`,fact_stored_user_fed:`✎`,fact_stored_auto:`✎`,fact_capture_abandoned:`∅`,cross_session_resume:`↪`,resume_blockers_surfaced:`⚑`,cache_hit:`◐`,confirmation_expired:`◷`,presence_ambient_marker:`·`,surface2_emitted:`▸`,surface2_missed:`▹`,user_prompt_received:`▶`,shell_compression:`◈`,file_read:`▥`,fetch_url:`↗`,graph_query:`◈`,session_dedup:`≡`,format_encoding:`⊞`,smart_truncation:`▤`,behavior_automation:`⚙`,persistent_memory:`❝`},MI={stale_edit_prevented:`Prevented a broken edit`,cascade_guard:`Protected code that depends on this`,boundary_violation_flagged:`Kept an architecture boundary intact`,incomplete_work_flagged:`Flagged an unfinished refactor`,cascade_warning_consumed:`Agent checked dependent code first`,intervention_halted:`Blocked a bad tool call`,intervention_warned:`Flagged a risky operation`,loop_broken:`Stopped a wasteful retry loop`,full_read_avoided:`Read only the relevant part`,graph_query_served:`Answered instantly from code graph`,caller_check_enforced:`Checked what uses this before editing`,drift_consumed:`Detected file changed on disk`,convention_applied:`Enforced your project's style`,defuddle_selector_skipped:`Handled a web page parsing error`,fact_recalled:`Recalled a rule you taught it`,fact_stored_user_fed:`Remembered your instruction`,fact_stored_auto:`Noticed a codebase pattern`,fact_capture_abandoned:`Skipped an uncertain note`,cross_session_resume:`Continued from last session`,resume_blockers_surfaced:`Brought forward open issues`,cache_hit:`Reused a cached result`,confirmation_expired:`Confirmation timed out`,user_prompt_received:`Prompt received`,presence_ambient_marker:`Running quietly`,surface2_emitted:`Added context to the response`,surface2_missed:`Context was not added this turn`,"tokenflow.shell_compression":`Compressed command output`,"tokenflow.file_read":`Read only what was needed`,"tokenflow.fetch_url":`Cleaned up a web page`,"tokenflow.graph_query":`Used code graph instead of reading files`,"tokenflow.session_dedup":`Skipped info the agent already had`,"tokenflow.format_encoding":`Made the response more compact`,"tokenflow.smart_truncation":`Trimmed repetitive output`,"tokenflow.behavior_automation":`Did a step automatically`,"tokenflow.persistent_memory":`Loaded from memory`};function NI(e,t){let n=typeof t.tool==`string`?t.tool:null,r=typeof t.file_path==`string`?t.file_path.split(`/`).pop():typeof t.file==`string`?t.file.split(`/`).pop():typeof t.path==`string`?t.path.split(`/`).pop():null,i=typeof t.top_content==`string`?t.top_content:typeof t.content==`string`?t.content:typeof t.fact_content==`string`?t.fact_content:null,a=(e,t=80)=>e.length>t?`${e.slice(0,t)}…`:e;switch(e){case`tokenflow.shell_compression`:{let e=typeof t.command==`string`?t.command:null;return e?`Compressed the output of "${a(e,60)}" so the agent sees a concise version`:`Compressed a long command output so the agent doesn't waste tokens reading it`}case`tokenflow.file_read`:{let e=typeof t.total_lines==`number`?t.total_lines:null;return r&&e?`Only sent the relevant part of ${r} (${e}-line file) instead of the whole thing`:r?`Sent only the relevant section of ${r} instead of the entire file`:`Sent only the relevant section instead of the full file`}case`tokenflow.graph_query`:return n?`Answered the ${n} question from the code graph — no file reading needed`:`Answered from the code graph — saved the agent from reading files one by one`;case`tokenflow.format_encoding`:return n?`Made the ${n} response smaller so it uses fewer tokens`:`Made the response smaller so it uses fewer tokens`;case`tokenflow.fetch_url`:return`Stripped navigation, ads, and boilerplate from a web page before sending it to the agent`;case`tokenflow.session_dedup`:return`The agent already had this information — skipped sending it again`;case`tokenflow.smart_truncation`:return`Trimmed repetitive or boilerplate content from a long output`;case`tokenflow.behavior_automation`:return`Performed a maintenance step automatically so the agent didn't have to`;case`tokenflow.persistent_memory`:{let e=typeof t.verdict==`string`?t.verdict:null;return e===`acted_on`?`Loaded a note from memory — the agent used it in its work`:e===`reinforced`?`Re-surfaced a note from memory — it's still relevant`:e===`ignored`?`Loaded a note from memory, but the agent didn't use it this time`:`Loaded stored notes from memory instead of the agent having to re-learn them`}case`stale_edit_prevented`:return r?`Stopped the agent from editing ${r} because the file had changed since it was last read`:`Stopped the agent from editing a file that had been modified — avoided overwriting new changes`;case`cascade_guard`:return r?`Other code depends on ${r} — warned the agent before editing to prevent breakage`:`Warned the agent that other code depends on what it was about to change`;case`boundary_violation_flagged`:{let e=typeof t.violations==`number`?t.violations:null,n=Array.isArray(t.target_layers)?t.target_layers.filter(e=>typeof e==`string`):[];return r&&n.length>0?`${r} was about to import across an architecture boundary into ${n.join(`, `)} — flagged before the layering eroded`:e?`Flagged ${e} import(s) that crossed an architecture boundary meant to stay isolated`:`Flagged an import that crossed an architecture boundary meant to stay isolated`}case`incomplete_work_flagged`:{let e=typeof t.items==`number`?t.items:null,n=typeof t.high_severity==`number`?t.high_severity:0;return n>0?`Flagged ${n} signature change(s) whose callers were never updated this session — they'd break at runtime or compile time`:e?`Flagged ${e} unfinished refactor(s) at session end so they don't surface as breaks later`:`Flagged an unfinished refactor at session end so it doesn't surface as a break later`}case`cascade_warning_consumed`:return`The agent read the dependency warning and adjusted its approach before editing`;case`intervention_halted`:return n?`Blocked the ${n} call because it was going in the wrong direction`:`Blocked a tool call that would have taken the agent off track`;case`intervention_warned`:return n?`Warned the agent that the ${n} call looked risky — it adjusted its approach`:`Warned the agent about a risky operation — it adjusted its approach`;case`loop_broken`:return`The agent was retrying the same thing — unerr broke the loop before it wasted more tokens`;case`full_read_avoided`:return r?`Sent only the relevant part of ${r} instead of the entire file`:`Sent a focused section instead of dumping the full file into context`;case`graph_query_served`:return n?`Answered a ${n} question instantly from the code graph`:`Answered a code question instantly from the code graph — no file reading needed`;case`caller_check_enforced`:return r?`Made the agent check what other code uses ${r} before making changes`:`Made the agent check what other code depends on this before editing`;case`drift_consumed`:return r?`Noticed ${r} was modified on disk and told the agent to re-read it before editing`:`A file was modified on disk — told the agent to re-read it before editing`;case`convention_applied`:return i?`Applied your project rule: "${a(i)}"`:`Applied your project's naming and style conventions to the generated code`;case`fact_recalled`:{let e=typeof t.count==`number`?t.count:1;return i&&e>1?`Recalled ${e} stored notes — top one: "${a(i)}"`:i?`Recalled: "${a(i)}"`:`Recalled ${e} ${e===1?`note`:`notes`} that you taught unerr in a previous session`}case`fact_stored_user_fed`:{let e=typeof t.source_quote==`string`?t.source_quote:null;return e?`You said: "${a(e)}" — saved for future sessions`:i?`Saved for future sessions: "${a(i)}"`:`Saved a rule you told unerr to remember — it will apply in future sessions`}case`fact_stored_auto`:return i?`Noticed a pattern and saved it: "${a(i)}"`:`Noticed a pattern in your codebase and saved it for future use`;case`fact_capture_abandoned`:return`Decided not to save a note — it wasn't clear enough to be reliable`;case`cross_session_resume`:return`Picked up where the last session left off — didn't need to re-learn your codebase`;case`resume_blockers_surfaced`:{let e=typeof t.count==`number`?t.count:1;return`Brought forward ${e} unresolved ${e===1?`issue`:`issues`} from the previous session so nothing gets lost`}case`cache_hit`:return n?`Reused a cached ${n} result — no need to recompute`:`Reused a cached result instead of doing the same work again`;case`confirmation_expired`:return`Asked you a question, but it went unanswered and timed out`;case`presence_ambient_marker`:return`Nothing to report this turn — unerr was running quietly in the background`;case`surface2_emitted`:return`Added relevant notes, conventions, and warnings to the agent's response`;case`surface2_missed`:return`Was supposed to add context to the response but didn't fire this turn`;case`defuddle_selector_skipped`:return`Ran into an issue parsing a web page but recovered gracefully — no data was lost`;default:return``}}var PI={stale_edit_prevented:`catch`,cascade_guard:`catch`,boundary_violation_flagged:`catch`,intervention_halted:`catch`,loop_broken:`catch`,intervention_warned:`guard`,cascade_warning_consumed:`guard`,caller_check_enforced:`guard`,drift_consumed:`guard`,defuddle_selector_skipped:`guard`,surface2_missed:`guard`,incomplete_work_flagged:`guard`,fact_recalled:`remember`,fact_stored_user_fed:`remember`,fact_stored_auto:`remember`,cross_session_resume:`remember`,resume_blockers_surfaced:`remember`,full_read_avoided:`save`,cache_hit:`save`,graph_query_served:`serve`,convention_applied:`serve`,surface2_emitted:`serve`},FI={catch:`text-red-400`,guard:`text-amber-400`,save:`text-emerald-400`,remember:`text-violet-400`,serve:`text-cyan-400`,note:`text-zinc-400`},II={catch:`bg-red-500/10 border-red-500/20`,guard:`bg-amber-500/10 border-amber-500/20`,save:`bg-emerald-500/10 border-emerald-500/20`,remember:`bg-violet-500/10 border-violet-500/20`,serve:`bg-cyan-500/10 border-cyan-500/20`,note:`bg-zinc-500/10 border-zinc-500/20`};function LI(e){return e?e.startsWith(`tokenflow.`)?`save`:PI[e]??`note`:`note`}function RI({totalPrompts:e,totalEvents:t,tokensSaved:n}){return(0,w.jsxs)(`section`,{className:`relative overflow-hidden rounded-2xl border border-border-subtle bg-linear-to-br from-violet-950/40 via-card to-card`,children:[(0,w.jsx)(`div`,{className:`absolute inset-0 bg-linear-to-r from-violet-500/5 to-transparent`}),(0,w.jsxs)(`div`,{className:`relative px-6 py-8 sm:px-8`,children:[(0,w.jsxs)(`div`,{className:`mb-6`,children:[(0,w.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.15em] text-violet-300/70`,children:`Prompts handled`}),(0,w.jsx)(`p`,{className:`mt-1 font-grotesk text-5xl font-bold tabular-nums text-foreground`,children:(0,w.jsx)(DI,{value:e,format:e=>e.toLocaleString()})})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-2`,children:[(0,w.jsxs)(`div`,{className:`rounded-xl border border-border-subtle bg-white/3 px-4 py-3`,children:[(0,w.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-zinc-400`,children:`unerr events`}),(0,w.jsx)(`p`,{className:`mt-1 font-mono text-xl font-semibold tabular-nums text-foreground`,children:(0,w.jsx)(DI,{value:t,format:TI})})]}),(0,w.jsxs)(`div`,{className:`rounded-xl border border-border-subtle bg-white/3 px-4 py-3`,children:[(0,w.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-zinc-400`,children:`Tokens saved`}),(0,w.jsx)(`p`,{className:`mt-1 font-mono text-xl font-semibold tabular-nums text-emerald-400`,children:(0,w.jsx)(DI,{value:n,format:TI})})]})]})]})]})}function zI({date:e,agent:t,sessionId:n,facets:r,onChange:i,onReset:a,isDefault:o}){let s=`block text-[10px] uppercase tracking-[0.12em] t-tertiary`,c=`w-full rounded-md border border-border bg-muted/40 px-2.5 py-1.5 text-xs text-foreground focus:border-violet-500/60 focus:outline-none focus:ring-1 focus:ring-violet-500/40`;return(0,w.jsxs)(`section`,{"aria-label":`Filter logbook`,className:`rounded-xl border border-border-subtle bg-card p-4`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`lb-date`,className:s,children:`Date`}),(0,w.jsx)(`input`,{id:`lb-date`,type:`date`,value:e,max:bI(),onChange:e=>i({date:e.target.value,page:null}),className:`${c} font-mono tabular-nums`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`lb-agent`,className:s,children:`Agent`}),(0,w.jsxs)(`select`,{id:`lb-agent`,value:t,onChange:e=>i({agent:e.target.value||null,page:null}),className:c,children:[(0,w.jsxs)(`option`,{value:``,children:[`All agents`,r?` (${r.total})`:``]}),r?.agents.map(e=>(0,w.jsxs)(`option`,{value:e.name,children:[e.name,` (`,e.count,`)`]},e.name))]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`lb-session`,className:s,children:`Session`}),(0,w.jsxs)(`select`,{id:`lb-session`,value:n,onChange:e=>i({session:e.target.value||null,page:null}),className:c,children:[(0,w.jsx)(`option`,{value:``,children:`Any session`}),r?.sessions.map(e=>(0,w.jsxs)(`option`,{value:e.id,children:[wI(e.id),` · `,e.agent,` · `,CI(e.started_ts),` (`,e.count,`)`]},e.id))]})]})]}),o?null:(0,w.jsx)(`div`,{className:`mt-3 flex items-center justify-end`,children:(0,w.jsx)(`button`,{type:`button`,onClick:a,className:`rounded-md px-2 py-1 text-xs t-secondary hover:bg-muted hover:text-foreground`,children:`Reset to today`})})]})}var BI=new Set([`user_prompt_received`,`presence_ambient_marker`,`surface2_emitted`,`surface2_missed`,`defuddle_selector_skipped`,`confirmation_expired`]);function VI({byType:e}){let t=Object.entries(e).filter(([e,t])=>t>0&&!BI.has(e)).sort(([,e],[,t])=>t-e).slice(0,4);return t.length===0?null:(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(([e,t])=>{let n=MI[e]??e.replace(/^tokenflow\./,``).replace(/_/g,` `),r=LI(e);return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium ${II[r]}`,children:[(0,w.jsx)(`span`,{className:FI[r],children:jI[e.replace(`tokenflow.`,``)]??`·`}),(0,w.jsx)(`span`,{className:`text-foreground/80`,children:t}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:n})]},e)})})}function HI({item:e,isExpanded:t,onToggle:n,isHighestImpact:r}){let i=kI(e.session_id),a=LI(e.summary.featured_event_type),o=e.prompt?.text,s=e.prompt?.classified_as;return(0,w.jsxs)(`div`,{className:`overflow-hidden rounded-xl border transition-all ${t?`border-violet-500/30 bg-card shadow-lg shadow-violet-500/5`:r?`border-violet-500/20 bg-card`:`border-border-subtle bg-card hover:border-border-strong`}`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:n,className:`w-full text-left`,"aria-expanded":t,children:(0,w.jsxs)(`div`,{className:`border-l-2 px-4 py-3.5 sm:px-5 ${i.stripe}`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[o?(0,w.jsxs)(`p`,{className:`line-clamp-2 text-sm font-medium leading-relaxed text-foreground`,children:[`"`,o,`"`]}):(0,w.jsx)(`p`,{className:`text-sm italic t-tertiary`,children:e.prompt?`Prompt (${e.prompt.length} chars) — content not captured`:`Prompt not captured`}),s?(0,w.jsx)(`span`,{className:`mt-1.5 inline-block rounded-full bg-violet-500/10 px-2 py-0.5 text-[10px] font-medium text-violet-300`,children:s}):null]}),(0,w.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,w.jsxs)(`div`,{className:`text-right`,children:[(0,w.jsx)(`span`,{className:`block font-mono text-xs tabular-nums text-foreground`,children:CI(e.ts_start)}),(0,w.jsx)(`span`,{className:`block text-[10px] t-tertiary`,children:SI(e.ts_start)})]}),(0,w.jsx)(`span`,{className:`t-tertiary transition-transform ${t?`rotate-90`:``}`,"aria-hidden":`true`,children:`›`})]})]}),(0,w.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,w.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[11px] ${i.chip}`,title:e.session_id,children:wI(e.session_id)}),e.summary.agents.length>0?(0,w.jsx)(`span`,{className:`font-mono text-[11px] text-foreground/70`,children:e.summary.agents[0]}):null,(0,w.jsxs)(`span`,{className:`font-mono text-[11px] tabular-nums t-tertiary`,children:[`turn `,e.turn]}),(0,w.jsx)(`span`,{className:`hidden sm:inline t-ghost`,children:`·`}),(0,w.jsxs)(`span`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-foreground/70`,children:[e.summary.event_count,` `,e.summary.event_count===1?`event`:`events`]}),e.summary.tool_call_count>0?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`t-ghost`,children:`·`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-cyan-300`,children:[e.summary.tool_call_count,` tool`,` `,e.summary.tool_call_count===1?`call`:`calls`]})]}):null,e.summary.marker_count>0?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`t-ghost`,children:`·`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-violet-300`,children:[e.summary.marker_count,` `,e.summary.marker_count===1?`marker`:`markers`]})]}):null,e.summary.tokens_saved>0?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`t-ghost`,children:`·`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-emerald-400`,children:[TI(e.summary.tokens_saved),` saved`]})]}):null]}),e.summary.featured_verb?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`hidden sm:inline t-ghost`,children:`·`}),(0,w.jsx)(`span`,{className:`text-[11px] ${FI[a]}`,children:e.summary.featured_verb})]}):null]}),(0,w.jsx)(`div`,{className:`mt-2.5`,children:(0,w.jsx)(VI,{byType:e.summary.by_type})})]})}),t?(0,w.jsx)(UI,{sessionId:e.session_id,turn:e.turn}):null]})}function UI({sessionId:e,turn:t}){let{url:n,queryKey:r}=Ot(),[i,a]=(0,f.useState)(`events`),o=N({queryKey:r([`logbook`,`prompt-detail`,e,t]),queryFn:()=>O(n(`/api/logbook/prompt-detail/${e}/${t}`))});if(o.isLoading)return(0,w.jsx)(`div`,{className:`border-t border-border-subtle px-5 py-4`,children:(0,w.jsx)(Wt,{count:3})});let s=o.data?.data;if(!s)return null;let c=s.events??[],l=s.transcript??[],u=s.token_optimization??{total_saved:0,mechanisms:{}},d=s.tool_calls??[],p=s.markers??[],m=[{id:`events`,label:`Events`,count:c.length},...d.length>0?[{id:`tool_calls`,label:`Tool Calls`,count:d.length}]:[],...p.length>0?[{id:`markers`,label:`Markers`,count:p.length}]:[],...s.has_transcript?[{id:`transcript`,label:`Execution Trace`,count:l.length}]:[],...u.total_saved>0?[{id:`tokens`,label:`Token Savings`,count:Object.keys(u.mechanisms).length}]:[]];return(0,w.jsxs)(`div`,{className:`border-t border-border-subtle`,children:[s.attribution&&((s.attribution.recalls?.length??0)>0||(s.attribution.captures?.length??0)>0||(s.attribution.drift?.length??0)>0)?(0,w.jsxs)(`div`,{className:`border-b border-border-subtle bg-violet-500/4 px-5 py-3`,children:[(0,w.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-violet-300/70`,children:`What unerr contributed`}),(0,w.jsxs)(`div`,{className:`mt-2 space-y-1`,children:[s.attribution.recalls?.map((e,t)=>(0,w.jsxs)(`p`,{className:`text-xs text-foreground/80`,children:[(0,w.jsx)(`span`,{className:`text-violet-400`,children:`↳`}),` Recalled: "`,e.content.length>100?`${e.content.slice(0,100)}…`:e.content,`"`,e.scope?(0,w.jsxs)(`span`,{className:`t-tertiary`,children:[` · `,e.scope]}):null]},`recall-${t}`)),s.attribution.captures?.map((e,t)=>(0,w.jsxs)(`p`,{className:`text-xs text-foreground/80`,children:[(0,w.jsx)(`span`,{className:`text-emerald-400`,children:`↳`}),` Remembered: "`,e.content.length>100?`${e.content.slice(0,100)}…`:e.content,`"`]},`capture-${t}`)),s.attribution.drift?.map((e,t)=>(0,w.jsxs)(`p`,{className:`text-xs text-foreground/80`,children:[(0,w.jsx)(`span`,{className:`text-amber-400`,children:`↳`}),` Caught drift on`,` `,(0,w.jsx)(`code`,{className:`rounded bg-muted/80 px-1 py-0.5 font-mono text-[11px]`,children:e.file_path})]},`drift-${t}`))]})]}):null,(0,w.jsxs)(`div`,{className:`flex gap-0 border-b border-border-subtle`,children:[m.map(e=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>a(e.id),className:`px-4 py-2.5 text-xs font-medium transition-colors ${i===e.id?`border-b-2 border-violet-400 text-foreground`:`text-zinc-400 hover:text-foreground`}`,children:[e.label,(0,w.jsx)(`span`,{className:`ml-1.5 rounded-full bg-white/5 px-1.5 py-0.5 font-mono text-[10px] tabular-nums`,children:e.count})]},e.id)),(0,w.jsxs)(`div`,{className:`ml-auto flex items-center gap-2 px-3`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(`activity`,{session:e}),className:`rounded px-2 py-1 text-[10px] text-violet-300 transition-colors hover:bg-violet-500/10 hover:text-violet-200`,children:`Activity →`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>y(`prompt-trace`,{session:e,turn:String(t)}),className:`rounded px-2 py-1 text-[10px] text-violet-300 transition-colors hover:bg-violet-500/10 hover:text-violet-200`,children:`Prompt Trace →`})]})]}),(0,w.jsx)(`div`,{className:`px-5 py-4`,children:i===`events`?(0,w.jsx)(JI,{events:c}):i===`tool_calls`?(0,w.jsx)(QI,{toolCalls:d}):i===`markers`?(0,w.jsx)(eL,{markers:p}):i===`transcript`?(0,w.jsx)(tL,{transcript:l}):i===`tokens`?(0,w.jsx)(nL,{optimization:u}):null})]})}var WI={stale_edit_prevented:`catches`,cascade_guard:`catches`,cascade_warning_consumed:`catches`,intervention_halted:`catches`,intervention_warned:`catches`,loop_broken:`catches`,full_read_avoided:`intelligence`,graph_query_served:`intelligence`,caller_check_enforced:`intelligence`,drift_consumed:`intelligence`,convention_applied:`intelligence`,defuddle_selector_skipped:`intelligence`,fact_recalled:`memory`,fact_stored_user_fed:`memory`,fact_stored_auto:`memory`,cross_session_resume:`memory`,resume_blockers_surfaced:`memory`,fact_capture_abandoned:`other`,cache_hit:`savings`,confirmation_expired:`other`,presence_ambient_marker:`other`,surface2_emitted:`other`,surface2_missed:`other`},GI={catches:{label:`Mistakes prevented`,sublabel:`These would have gone wrong without unerr`,color:`text-red-400`},intelligence:{label:`Smarter answers`,sublabel:`Faster and more accurate than reading files one by one`,color:`text-cyan-400`},memory:{label:`Memory`,sublabel:`Your rules and patterns, carried across sessions`,color:`text-violet-400`},savings:{label:`Tokens saved`,sublabel:`Less wasted context means more room for your actual code`,color:`text-emerald-400`},other:{label:`Other activity`,sublabel:``,color:`text-zinc-400`}};function KI(e){return e.startsWith(`tokenflow.`)?`savings`:WI[e]??`other`}function qI({ev:e,i:t}){let n=LI(e.event_type),r=e.metadata??{},i=typeof r.tokens_saved==`number`?r.tokens_saved:void 0,a=MI[e.event_type]??e.event_type.replace(/^tokenflow\./,``).replace(/_/g,` `),o=NI(e.event_type,r);return(0,w.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg bg-muted/20 px-3 py-2.5`,children:[(0,w.jsx)(`span`,{className:`mt-0.5 shrink-0 text-sm ${FI[n]}`,"aria-hidden":`true`,children:jI[e.event_type.replace(`tokenflow.`,``)]??`·`}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:a}),o?(0,w.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed t-secondary`,children:o}):null,typeof i==`number`&&i>0?(0,w.jsxs)(`p`,{className:`mt-0.5 font-mono text-[11px] tabular-nums text-emerald-400`,children:[`saved `,TI(i),` tokens`]}):null]}),(0,w.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] tabular-nums t-tertiary`,children:CI(e.ts)})]},`${e.ts}-${e.event_type}-${t}`)}function JI({events:e}){if(e.length===0)return(0,w.jsx)(`p`,{className:`py-4 text-center text-sm t-secondary`,children:`No events recorded for this prompt.`});let t=e.filter(e=>e.event_type!==`user_prompt_received`);if(t.length===0)return(0,w.jsx)(`p`,{className:`py-4 text-center text-sm t-secondary`,children:`No unerr actions recorded for this prompt.`});let n=new Map;for(let e of t){let t=KI(e.event_type),r=n.get(t);r?r.push(e):n.set(t,[e])}return n.size<=1||t.length<=3?(0,w.jsx)(`div`,{className:`space-y-2`,children:t.map((e,t)=>(0,w.jsx)(qI,{ev:e,i:t},`${e.ts}-${e.event_type}-${t}`))}):(0,w.jsx)(`div`,{className:`space-y-5`,children:[`catches`,`intelligence`,`memory`,`savings`,`other`].map(e=>{let t=n.get(e);if(!t||t.length===0)return null;let r=GI[e];return(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-baseline gap-2`,children:[(0,w.jsx)(`h4`,{className:`text-[11px] font-semibold uppercase tracking-widest ${r.color}`,children:r.label}),(0,w.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums t-tertiary`,children:t.length}),r.sublabel?(0,w.jsxs)(`span`,{className:`text-[10px] t-ghost`,children:[`— `,r.sublabel]}):null]}),(0,w.jsx)(`div`,{className:`space-y-1.5`,children:t.map((e,t)=>(0,w.jsx)(qI,{ev:e,i:t},`${e.ts}-${e.event_type}-${t}`))})]},e)})})}var YI={search_code:{label:`Search`,color:`text-cyan-300 bg-cyan-500/10`},get_entity:{label:`Read entity`,color:`text-cyan-300 bg-cyan-500/10`},get_references:{label:`References`,color:`text-cyan-300 bg-cyan-500/10`},file_read:{label:`File read`,color:`text-cyan-300 bg-cyan-500/10`},file_outline:{label:`Outline`,color:`text-cyan-300 bg-cyan-500/10`},get_imports:{label:`Imports`,color:`text-cyan-300 bg-cyan-500/10`},get_conventions:{label:`Conventions`,color:`text-emerald-300 bg-emerald-500/10`},get_rules:{label:`Rules`,color:`text-emerald-300 bg-emerald-500/10`},recall_facts:{label:`Recall facts`,color:`text-violet-300 bg-violet-500/10`},unerr_recall_notes:{label:`Recall notes`,color:`text-violet-300 bg-violet-500/10`},unerr_remember:{label:`Remember`,color:`text-violet-300 bg-violet-500/10`},record_fact:{label:`Record fact`,color:`text-violet-300 bg-violet-500/10`},unerr_turn_summary:{label:`Turn summary`,color:`text-zinc-400 bg-white/5`},fetch_url:{label:`Fetch URL`,color:`text-amber-300 bg-amber-500/10`},get_critical_nodes:{label:`Critical nodes`,color:`text-rose-300 bg-rose-500/10`}};function XI(e){let t=[];for(let[n,r]of Object.entries(e)){if(r==null||r===``)continue;let e=typeof r==`string`?r.length>60?`${r.slice(0,60)}…`:r:JSON.stringify(r);t.push(`${n}: ${e}`)}return t.join(`, `)}function ZI(e){if(`count`in e&&typeof e.count==`number`)return`${e.count} result${e.count===1?``:`s`}`;if(`found`in e)return e.found?`found`:`not found`;if(`entity_count`in e&&typeof e.entity_count==`number`)return`${e.entity_count} entities`;let t=Object.keys(e);return t.length===0?null:t.slice(0,3).join(`, `)}function QI({toolCalls:e}){return e.length===0?(0,w.jsx)(`p`,{className:`py-4 text-center text-sm t-secondary`,children:`No tool calls recorded for this session.`}):(0,w.jsx)(`div`,{className:`space-y-1.5`,children:e.map((e,t)=>{let n=YI[e.tool],r=n?.label??e.tool,i=n?.color??`text-zinc-400 bg-white/5`,a=XI(e.args_summary),o=ZI(e.result_summary);return(0,w.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg bg-muted/20 px-3 py-2`,children:[(0,w.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[10px] font-mono tabular-nums t-tertiary`,children:CI(e.ts)}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 font-mono text-[10px] font-medium ${i}`,children:r}),o?(0,w.jsxs)(`span`,{className:`font-mono text-[10px] tabular-nums text-emerald-400/70`,children:[`→ `,o]}):null]}),a?(0,w.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] leading-relaxed t-secondary`,children:a}):null]}),e.correlation_id?(0,w.jsx)(`span`,{className:`shrink-0 rounded bg-white/5 px-1 py-0.5 font-mono text-[9px] t-tertiary`,title:`Correlated with ${e.correlation_id}`,children:`⤴`}):null]},e.id??`${e.ts}-${t}`)})})}var $I={mark_intent:{icon:`◆`,color:`text-violet-400`,label:`Intent`},mark_decision:{icon:`⟡`,color:`text-cyan-400`,label:`Decision`},mark_blocker:{icon:`⚠`,color:`text-amber-400`,label:`Blocker`},mark_resolution:{icon:`✓`,color:`text-emerald-400`,label:`Resolved`}};function eL({markers:e}){return e.length===0?(0,w.jsx)(`p`,{className:`py-4 text-center text-sm t-secondary`,children:`No markers recorded for this session.`}):(0,w.jsx)(`div`,{className:`space-y-2`,children:e.map((e,t)=>{let n=$I[e.type]??{icon:`·`,color:`text-zinc-400`,label:e.type};return(0,w.jsx)(`div`,{className:`rounded-lg border border-border-subtle bg-muted/20 px-4 py-3`,children:(0,w.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,w.jsx)(`span`,{className:`mt-0.5 text-sm ${n.color}`,children:n.icon}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase ${n.color} bg-white/5`,children:n.label}),(0,w.jsx)(`span`,{className:`ml-auto font-mono text-[10px] tabular-nums t-tertiary`,children:CI(e.ts)})]}),(0,w.jsx)(`p`,{className:`mt-1.5 text-sm text-foreground`,children:e.text}),e.alternatives?(0,w.jsxs)(`div`,{className:`mt-2`,children:[(0,w.jsx)(`p`,{className:`text-[10px] font-medium uppercase tracking-wide t-tertiary`,children:`Alternatives considered`}),(0,w.jsx)(`ul`,{className:`mt-1 space-y-0.5`,children:e.alternatives.map((e,t)=>(0,w.jsx)(`li`,{className:`text-xs t-secondary before:mr-1.5 before:content-['–']`,children:e},`alt-${t}`))})]}):null,e.file_path?(0,w.jsx)(`code`,{className:`mt-1 inline-block rounded bg-muted/80 px-1.5 py-0.5 font-mono text-[11px] text-foreground/70`,children:e.file_path}):null,e.blocker_ref?(0,w.jsxs)(`p`,{className:`mt-1 text-[11px] t-secondary`,children:[`Resolves blocker`,` `,(0,w.jsx)(`code`,{className:`rounded bg-muted/80 px-1 py-0.5 font-mono text-[10px]`,children:e.blocker_ref})]}):null]})]})},e.id??`${e.ts}-${t}`)})})}function tL({transcript:e}){return e.length===0?(0,w.jsx)(`p`,{className:`py-4 text-center text-sm t-secondary`,children:`No execution trace available for this prompt.`}):(0,w.jsx)(`div`,{className:`space-y-3`,children:e.map((e,t)=>{let n=e.role===`user`;return(0,w.jsxs)(`div`,{className:`rounded-lg border px-4 py-3 ${n?`border-violet-500/20 bg-violet-500/5`:`border-border-subtle bg-muted/20`}`,children:[(0,w.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase ${n?`bg-violet-500/20 text-violet-300`:`bg-white/5 text-zinc-400`}`,children:e.role}),e.model?(0,w.jsx)(`span`,{className:`font-mono text-[10px] t-tertiary`,children:e.model}):null,(0,w.jsx)(`span`,{className:`ml-auto font-mono text-[10px] tabular-nums t-tertiary`,children:CI(e.ts)})]}),e.text?(0,w.jsx)(`p`,{className:`line-clamp-4 whitespace-pre-wrap text-xs leading-relaxed text-foreground/80`,children:e.text}):null,e.tools&&e.tools.length>0||e.files&&e.files.length>0?(0,w.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[e.tools?.map(e=>(0,w.jsx)(`span`,{className:`rounded-full bg-cyan-500/10 px-2 py-0.5 font-mono text-[10px] text-cyan-300`,children:e},e)),e.files?.slice(0,5).map(e=>(0,w.jsx)(`span`,{className:`rounded-full bg-white/5 px-2 py-0.5 font-mono text-[10px] t-secondary`,title:e,children:e.split(`/`).pop()},e)),e.files&&e.files.length>5?(0,w.jsxs)(`span`,{className:`text-[10px] t-tertiary`,children:[`+`,e.files.length-5,` more`]}):null]}):null,e.tokens_input>0||e.tokens_output>0?(0,w.jsxs)(`div`,{className:`mt-2 flex gap-3 font-mono text-[10px] tabular-nums t-tertiary`,children:[(0,w.jsxs)(`span`,{children:[TI(e.tokens_input),` in`]}),(0,w.jsxs)(`span`,{children:[TI(e.tokens_output),` out`]})]}):null]},`${e.ts}-${e.role}-${t}`)})})}function nL({optimization:e}){let t=Object.entries(e.mechanisms).sort(([,e],[,t])=>t-e);return(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,w.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] t-tertiary`,children:`Total saved`}),(0,w.jsx)(`span`,{className:`font-mono text-2xl font-bold tabular-nums text-emerald-400`,children:TI(e.total_saved)}),(0,w.jsx)(`span`,{className:`text-xs t-tertiary`,children:`tokens`})]}),t.length>0?(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] t-tertiary`,children:`By mechanism`}),t.map(([t,n])=>{let r=e.total_saved>0?n/e.total_saved*100:0;return(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsx)(`span`,{className:`text-xs text-foreground/80`,children:AI[t]??t.replace(/_/g,` `)}),(0,w.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-foreground`,children:[TI(n),` `,(0,w.jsxs)(`span`,{className:`t-tertiary`,children:[`(`,r.toFixed(0),`%)`]})]})]}),(0,w.jsx)(`div`,{className:`h-1.5 rounded-full bg-white/5`,children:(0,w.jsx)(`div`,{className:`h-1.5 rounded-full bg-emerald-500/60 transition-all`,style:{width:`${Math.max(2,r)}%`}})})]},t)})]}):null]})}function rL({page:e,total:t,pageSize:n,onChange:r}){let i=Math.max(1,Math.ceil(t/n));if(i<=1)return null;let a=Math.max(1,Math.min(e,i)),o=(a-1)*n+1,s=Math.min(a*n,t),c=`rounded-md px-2.5 py-1 font-mono text-xs tabular-nums transition-colors`;return(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-border-subtle bg-card px-4 py-3`,children:[(0,w.jsxs)(`span`,{className:`text-xs t-secondary`,children:[`Showing`,` `,(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-foreground`,children:[o,`–`,s]}),` `,`of`,` `,(0,w.jsx)(`span`,{className:`font-mono tabular-nums text-foreground`,children:TI(t)}),` `,`prompts`]}),(0,w.jsxs)(`nav`,{className:`flex items-center gap-1`,"aria-label":`Pagination`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>r(a-1),disabled:a===1,className:`${c} ${a===1?`t-ghost`:`t-secondary hover:bg-muted hover:text-foreground`}`,children:`‹ Prev`}),(0,w.jsxs)(`span`,{className:`px-2 font-mono text-xs tabular-nums text-foreground`,children:[a,` / `,i]}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>r(a+1),disabled:a===i,className:`${c} ${a===i?`t-ghost`:`t-secondary hover:bg-muted hover:text-foreground`}`,children:`Next ›`})]})]})}function iL(){let{url:e,queryKey:t}=Ot(),n=S(`date`),r=S(`agent`),i=S(`session`),a=S(`page`),o=n||bI(),s=r||``,c=i||``,l=Math.max(1,Number(a??1)||1),u=!n&&!r&&!i&&(!a||a===`1`),d=(0,f.useMemo)(()=>xI(o),[o]),[p,m]=(0,f.useState)(null),h=(0,f.useMemo)(()=>{let e=new URLSearchParams;return d&&(e.set(`from_ts`,d.from_ts),e.set(`to_ts`,d.to_ts)),s&&e.set(`agent`,s),c&&e.set(`session_id`,c),e},[d,s,c]),g=N({queryKey:t([`logbook`,`story`,d?.from_ts??``,d?.to_ts??``,s,c]),queryFn:()=>O(e(`/api/logbook/story?${h.toString()}`)),refetchInterval:yI}),_=N({queryKey:t([`logbook`,`facets`,d?.from_ts??``,d?.to_ts??``]),queryFn:()=>{let t=new URLSearchParams;return d&&(t.set(`from_ts`,d.from_ts),t.set(`to_ts`,d.to_ts)),O(e(`/api/logbook/facets?${t.toString()}`))},refetchInterval:yI}),v=N({queryKey:t([`logbook`,`prompt-feed`,d?.from_ts??``,d?.to_ts??``,s,c,l]),queryFn:()=>{let t=new URLSearchParams(h);return t.set(`limit`,String(vI)),t.set(`offset`,String((l-1)*vI)),O(e(`/api/logbook/prompt-feed?${t.toString()}`))},refetchInterval:yI});(0,f.useEffect)(()=>{m(null)},[`${o}|${s}|${c}|${l}`]);let y=g.data?.data,b=_.data?.data,C=v.data?.data??[],T=v.data?.total??0,E=(0,f.useMemo)(()=>{if(C.length===0)return null;let e=C[0];for(let t of C)t.summary.tokens_saved>e.summary.tokens_saved&&(e=t);return`${e.session_id}::${e.turn}`},[C]),ee=e=>{x(e),m(null)},te=()=>{x({date:null,agent:null,session:null,page:null}),m(null)};return g.isLoading&&v.isLoading?(0,w.jsx)(`div`,{className:`space-y-6`,children:(0,w.jsx)(Wt,{count:3})}):(0,w.jsxs)(`div`,{className:`space-y-6`,children:[y?(0,w.jsx)(RI,{totalPrompts:T,totalEvents:y.right_rail.total_events,tokensSaved:y.right_rail.total_tokens_saved}):null,(0,w.jsx)(zI,{date:o,agent:s,sessionId:c,facets:b,onChange:ee,onReset:te,isDefault:u}),(0,w.jsx)(`section`,{"aria-label":`Prompt feed`,children:v.isLoading?(0,w.jsx)(Wt,{count:5}):C.length===0?(0,w.jsxs)(`div`,{className:`flex flex-col items-center gap-2 rounded-xl border border-border-subtle bg-card px-6 py-12 text-center`,children:[(0,w.jsx)(`p`,{className:`text-3xl`,"aria-hidden":`true`,children:`◇`}),(0,w.jsx)(`p`,{className:`text-sm t-secondary`,children:y?.honest_zero?`unerr was quiet — nothing to replay for this view.`:`No prompts match these filters.`}),u?null:(0,w.jsx)(`button`,{type:`button`,onClick:te,className:`mt-1 text-xs text-violet-300 hover:text-violet-200 hover:underline`,children:`Reset to today`})]}):(0,w.jsx)(`div`,{className:`space-y-3`,children:C.map(e=>{let t=`${e.session_id}::${e.turn}`;return(0,w.jsx)(HI,{item:e,isExpanded:p===t,onToggle:()=>m(e=>e===t?null:t),isHighestImpact:t===E},t)})})}),(0,w.jsx)(rL,{page:l,total:T,pageSize:vI,onChange:e=>{x({page:e>1?String(e):null}),m(null),typeof window<`u`&&window.scrollTo({top:0,behavior:`smooth`})}})]})}var aL={"claude-code":{bg:`bg-amber-500/20`,text:`text-amber-400`,label:`Claude Code`},"claude-desktop":{bg:`bg-amber-500/20`,text:`text-amber-400`,label:`Claude Desktop`},cursor:{bg:`bg-blue-500/20`,text:`text-blue-400`,label:`Cursor`},cline:{bg:`bg-emerald-500/20`,text:`text-emerald-400`,label:`Cline`},windsurf:{bg:`bg-cyan-500/20`,text:`text-cyan-400`,label:`Windsurf`},copilot:{bg:`bg-zinc-500/20`,text:`text-zinc-400`,label:`Copilot`},vscode:{bg:`bg-blue-500/20`,text:`text-blue-400`,label:`VS Code`},zed:{bg:`bg-violet-500/20`,text:`text-violet-400`,label:`Zed`},kiro:{bg:`bg-fuchsia-500/20`,text:`text-fuchsia-400`,label:`Kiro`},"gemini-cli":{bg:`bg-cyan-500/20`,text:`text-cyan-400`,label:`Gemini CLI`},codex:{bg:`bg-emerald-500/20`,text:`text-emerald-400`,label:`Codex`},aider:{bg:`bg-rose-500/20`,text:`text-rose-400`,label:`Aider`},opencode:{bg:`bg-violet-500/20`,text:`text-violet-400`,label:`OpenCode`},trae:{bg:`bg-amber-500/20`,text:`text-amber-400`,label:`Trae`},augment:{bg:`bg-emerald-500/20`,text:`text-emerald-400`,label:`Augment`},"github-copilot-cli":{bg:`bg-zinc-500/20`,text:`text-zinc-400`,label:`Copilot CLI`},continue:{bg:`bg-violet-500/20`,text:`text-violet-400`,label:`Continue`},antigravity:{bg:`bg-fuchsia-500/20`,text:`text-fuchsia-400`,label:`Antigravity`}};function oL({name:e}){if(!e)return(0,w.jsx)(`span`,{className:`inline-flex items-center whitespace-nowrap rounded-full bg-white/5 px-2 py-0.5 text-[10px] font-medium t-tertiary ring-1 ring-inset ring-white/10`,children:`unknown`});let t=aL[e.toLowerCase().replace(/\s+/g,`-`)]??{bg:`bg-zinc-500/20`,text:`text-zinc-400`,label:e};return(0,w.jsx)(`span`,{className:`inline-flex items-center whitespace-nowrap rounded-full px-2 py-0.5 ${t.bg} ${t.text} text-[10px] font-medium ring-1 ring-inset ring-white/10`,children:t.label})}function sL({items:e}){return(0,w.jsx)(`nav`,{className:`flex items-center gap-1 text-sm mb-5`,children:e.map((t,n)=>{let r=n===e.length-1;return(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[n>0&&(0,w.jsx)(`span`,{className:`t-ghost select-none`,children:`›`}),r?(0,w.jsx)(`span`,{className:`text-foreground font-medium`,children:t.label}):(0,w.jsx)(`button`,{type:`button`,className:`-mx-0.5 cursor-pointer rounded px-1.5 py-0.5 text-violet-400 transition-colors hover:bg-violet-500/10 hover:text-violet-300`,onClick:t.onClick,children:t.label})]},t.label)})})}var cL={graph_query:{bg:`bg-violet-500/20`,text:`text-violet-300`,bar:`bg-violet-500`,ring:`ring-violet-500/40`},shell_compression:{bg:`bg-cyan-500/20`,text:`text-cyan-400`,bar:`bg-cyan-500`,ring:`ring-cyan-500/40`},format_encoding:{bg:`bg-amber-500/20`,text:`text-amber-400`,bar:`bg-amber-500`,ring:`ring-amber-500/40`},session_dedup:{bg:`bg-emerald-500/20`,text:`text-emerald-400`,bar:`bg-emerald-500`,ring:`ring-emerald-500/40`},smart_truncation:{bg:`bg-blue-500/20`,text:`text-blue-400`,bar:`bg-blue-500`,ring:`ring-blue-500/40`},file_read:{bg:`bg-indigo-500/20`,text:`text-indigo-400`,bar:`bg-indigo-500`,ring:`ring-indigo-500/40`},fetch_url:{bg:`bg-teal-500/20`,text:`text-teal-400`,bar:`bg-teal-500`,ring:`ring-teal-500/40`}},lL=[`graph_query`,`file_read`,`shell_compression`,`format_encoding`,`session_dedup`,`smart_truncation`,`fetch_url`],uL=new Set([`graph_query`,`file_read`]);function dL(e){let t={key:`intelligence`,tokens:0,events:0,entries:[]},n={key:`compression`,tokens:0,events:0,entries:[]};for(let[r,i]of Object.entries(e)){let e=uL.has(r)?t:n;e.tokens+=i.tokens_saved,e.events+=i.event_count,e.entries.push([r,i])}let r=(e,t)=>t[1].tokens_saved-e[1].tokens_saved;return t.entries.sort(r),n.entries.sort(r),{intelligence:t,compression:n,total:t.tokens+n.tokens}}function fL(e){return e.replace(/_/g,` `)}var pL=new Set([`user_prompt_received`,`surface2_emitted`,`surface2_missed`,`surface4a_emitted`,`presence_ambient_marker`,`fact_capture_abandoned`,`confirmation_expired`]),mL={graph_query_served:`Unnecessary file reads prevented`,full_read_avoided:`Large file dumps prevented`,loop_broken:`Retry loops stopped`,cascade_guard:`Breaking changes caught`,boundary_violation_flagged:`Architecture breaches caught`,incomplete_work_flagged:`Unfinished refactors flagged`,drift_consumed:`Stale file edits prevented`,intervention_halted:`Dangerous operations blocked`,intervention_warned:`Risky patterns flagged`,defuddle_selector_skipped:`Web page noise filtered`,fact_recalled:`Re-explanations prevented`,fact_stored_user_fed:`Rules saved for next session`,fact_stored_auto:`Code patterns learned`,stale_edit_prevented:`Overwrites of new changes stopped`,cascade_warning_consumed:`Downstream breaks prevented`,convention_applied:`Style violations prevented`,caller_check_enforced:`Blind edits prevented`,cross_session_resume:`Cold-start sessions prevented`,resume_blockers_surfaced:`Forgotten blockers resurfaced`,cache_hit:`Redundant computations skipped`,auto_doc_generated:`Code auto-documented`,loop_circuit_breaker_fired:`Agent loops stopped`},hL={graph_query_served:`The agent found the answer in one graph query instead of reading 5-15 files. Each lookup saved multiple turns of trial-and-error searching.`,full_read_avoided:`Only the relevant lines were sent instead of the entire file. Without unerr, the agent loads thousands of lines when it only needed a few.`,loop_broken:`The agent was stuck retrying the same failing operation. unerr detected the pattern and broke the cycle before more turns were wasted.`,cascade_guard:`The agent was about to edit code that many other files depend on. unerr flagged the risk so the change didn't silently break downstream code.`,boundary_violation_flagged:`The agent was about to import across an architecture boundary that must stay isolated. unerr flagged the crossing so the layering didn't silently erode.`,incomplete_work_flagged:`A signature changed this session but some of its callers were never updated. unerr flagged them at session end so they don't surface as runtime or compile breaks later.`,drift_consumed:`The file had changed since the agent last read it. unerr caught this so the agent didn't overwrite newer changes with an outdated version.`,intervention_halted:`A risky tool call was stopped before it could run. Without unerr, the operation would have executed unchecked.`,intervention_warned:`unerr spotted a risky pattern and warned the agent before it committed. Without the warning, the agent would have proceeded blindly.`,defuddle_selector_skipped:`Navigation, footers, and ads were stripped from fetched web pages so only the actual content reached the agent.`,fact_recalled:`Notes from your earlier sessions were surfaced at the right moment, so the agent didn't ask you to repeat yourself.`,fact_stored_user_fed:`Rules you told the agent were saved permanently. Next session, the agent will know these without you repeating them.`,fact_stored_auto:`unerr noticed a convention in your codebase and stored it. Future edits will follow this pattern automatically.`,stale_edit_prevented:`The agent tried to edit a file that was modified after it was last read. unerr stopped the edit to prevent overwriting your recent work.`,cascade_warning_consumed:`Code that depends on the edited file was identified and the agent was warned before making changes that would ripple through.`,convention_applied:`Project conventions (naming, imports, structure) were applied automatically, so new code matched your existing style.`,caller_check_enforced:`unerr checked who calls this code before allowing the edit. Without it, changes would land without knowing what else they break.`,cross_session_resume:`Context from your last session was restored, so the agent picked up where it left off instead of starting from scratch.`,resume_blockers_surfaced:`Unresolved problems from a previous session were brought forward so they didn't fall through the cracks.`,cache_hit:`A previously computed answer was served from cache instead of being recomputed, saving time and tokens.`,auto_doc_generated:`Documentation was generated automatically for code the agent wrote or modified.`,loop_circuit_breaker_fired:`The agent was repeating the same failing operation. unerr detected the loop and stopped it.`};function Q(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function gL(e){let t=Date.now()-new Date(e).getTime(),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<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function _L(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function vL(e){return cL[e]??{bg:`bg-zinc-500/20`,text:`text-zinc-400`,bar:`bg-zinc-500`,ring:`ring-zinc-500/40`}}function yL(e){let t=e.detail;if(!t)return e.tool??`token rescue`;if(t.command){let e=String(t.command);return e.length>80?`${e.slice(0,77)}…`:e}return t.optimization?String(t.optimization):t.counterfactual&&t.counterfactual!==`generic file exploration`?String(t.counterfactual):t.format?`${e.tool??`query`} → ${t.format} format`:e.tool??`token rescue`}function bL(e){if(e.length===0)return{label:`Empty turn`,subtitle:``};let t=[...new Set(e.map(e=>e.tool).filter(Boolean))],n=[...new Set(e.map(e=>e.mechanism))],r=e.find(e=>e.detail?.command);if(r){let t=String(r.detail?.command);return{label:t.length>60?`${t.slice(0,57)}…`:t,subtitle:`shell → ${e.length} rescue${e.length>1?`s`:``}`}}let i=e.find(e=>e.detail?.optimization);if(i){let n=String(i.detail?.optimization),r=e.length>1?` +${e.length-1} more`:``;return{label:n,subtitle:t.join(`, `)+r}}if(t.length>0){let r=t.join(` → `),i=e.length,a=n[0]?.replace(/_/g,` `)??``;return{label:r,subtitle:`${i} event${i>1?`s`:``} · ${a}`}}return{label:n.map(e=>e.replace(/_/g,` `)).join(`, `),subtitle:`${e.length} event${e.length>1?`s`:``}`}}function xL({mechanism:e}){let t=vL(e);return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5 ${t.bg} ${t.text} text-[10px] font-medium ring-1 ring-inset ${t.ring}`,children:[(0,w.jsx)(`span`,{className:`h-1 w-1 rounded-full ${t.bar}`,"aria-hidden":!0}),e.replace(/_/g,` `)]})}function SL(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function CL(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function wL({label:e,value:t,accent:n,hint:r,sub:i}){return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4`,title:r,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wider`,children:e}),(0,w.jsx)(`p`,{className:`mt-1 text-2xl font-bold font-mono tabular-nums ${n}`,children:t}),i&&(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-1 leading-snug`,children:i})]})}function TL({trace:e}){let t=e.prompt;return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-l-4 border-violet-500/50`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 mb-2 flex-wrap`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] uppercase tracking-wider`,children:`Prompt`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs font-mono`,children:[`turn `,e.turn]}),(0,w.jsx)(oL,{name:e.agent}),t?.classified_as&&(0,w.jsx)(`span`,{className:`rounded-full bg-violet-500/15 text-violet-300 px-2 py-0.5 text-[10px] font-medium`,children:t.classified_as})]}),t?.prompt?(0,w.jsxs)(`p`,{className:`text-foreground text-lg leading-snug italic`,children:[`"`,t.prompt,`"`]}):t?(0,w.jsxs)(`p`,{className:`t-secondary text-sm`,children:[`Prompt not captured —`,` `,(0,w.jsxs)(`span`,{className:`font-mono`,children:[`set `,(0,w.jsx)(`span`,{className:`text-amber-400`,children:`capture_prompts: true`}),` in .unerr/config.json`]}),` `,`to record verbatim text (`,t.length,` chars this turn).`]}):(0,w.jsx)(`p`,{className:`t-tertiary text-sm`,children:`No prompt captured for this turn (agent does not emit the UserPromptSubmit hook).`})]})}function EL({trace:e}){let t=e.tokens_used;if(e.transcript_available&&t)return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-t-2 border-cyan-500/60`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 flex-wrap`,children:[(0,w.jsx)(`p`,{className:`text-cyan-400 text-[10px] uppercase tracking-wider font-medium`,children:`Tokens used (actual)`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px]`,children:[`from `,e.agent??`agent`,`'s own session log`]})]}),(0,w.jsx)(`p`,{className:`text-3xl font-bold font-mono text-cyan-400 mt-2`,children:SL(t.total)}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 mt-2 t-secondary text-xs font-mono`,children:[(0,w.jsxs)(`span`,{children:[SL(t.input),` in`]}),(0,w.jsxs)(`span`,{children:[SL(t.output),` out`]}),(0,w.jsxs)(`span`,{children:[SL(t.cache_create),` cache-write`]}),(0,w.jsxs)(`span`,{children:[SL(t.cache_read),` cache-read`]})]})]});let n=e.capability?e.flag_on?`No matching transcript was found for this prompt.`:`Reading the agent's own session log is opt-in.`:`${e.agent??`This agent`} has no transcript reader — actual token usage is only available for Claude Code and Cursor.`;return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-t-2 border-zinc-600/60`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wider font-medium`,children:`Tokens used (actual)`}),(0,w.jsx)(`p`,{className:`text-2xl font-bold font-mono t-tertiary mt-2`,children:`—`}),(0,w.jsx)(`p`,{className:`t-secondary text-xs mt-2 leading-snug`,children:n}),e.capability&&!e.flag_on&&(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-1 font-mono leading-snug`,children:`set read_agent_transcripts: true in .unerr/config.json`})]})}var DL={"tokenflow.shell_compression":`Compressed command output`,"tokenflow.file_read":`Delivered targeted file content`,"tokenflow.persistent_memory":`Used stored knowledge`,"tokenflow.format_encoding":`Encoded response compactly`,"tokenflow.response_dedup":`Removed duplicate content`,"tokenflow.context_rot_prevention":`Cleaned stale context`,"tokenflow.instruction_reinforcement":`Reinforced agent instructions`,drift_consumed:`Caught file drift`,stale_edit_prevented:`Prevented stale edit`,cascade_warning_consumed:`Protected dependent code`,convention_consumed:`Applied project conventions`,fact_recalled:`Recalled stored knowledge`,fact_captured:`Learned new project fact`,user_prompt_received:`Received prompt`,presence_ambient_marker:`Active monitoring`,loop_circuit_breaker_fired:`Stopped a loop`,auto_doc_generated:`Auto-documented code`,defuddle_selector_skipped:`Recovered from parse issue`};function OL(e){let t=e.metadata??{},n=typeof t.file_path==`string`?t.file_path:typeof t.file==`string`?t.file:e.entity_key;switch(e.event_type){case`tokenflow.shell_compression`:{let e=typeof t.command==`string`?t.command:null;return e?`Compressed output of "${kL(e,60)}"`:`Compressed a long command output`}case`tokenflow.file_read`:return n?`Delivered only the relevant lines from ${kL(n,50)}`:`Delivered targeted file content`;case`tokenflow.persistent_memory`:return`Used stored project knowledge instead of re-reading files`;case`tokenflow.format_encoding`:return`Encoded the response compactly to save tokens`;case`tokenflow.response_dedup`:return`Removed duplicate information the agent already had`;case`tokenflow.context_rot_prevention`:return`Cleaned stale context that would have confused the agent`;case`tokenflow.instruction_reinforcement`:return`Reinforced agent instructions to keep it on track`;case`drift_consumed`:return n?`Caught that ${kL(n,50)} changed since last read`:`Caught a file change the agent hadn't seen`;case`stale_edit_prevented`:return n?`Stopped the agent from overwriting changes in ${kL(n,50)}`:`Prevented the agent from overwriting new changes`;case`cascade_warning_consumed`:return n?`Warned about code that depends on ${kL(n,50)}`:`Warned about downstream code dependencies`;case`convention_consumed`:return n?`Applied project conventions for ${kL(n,50)}`:`Applied project coding conventions`;case`fact_recalled`:{let e=typeof t.content==`string`?t.content:typeof t.source_quote==`string`?t.source_quote:null;return e?`Recalled: "${kL(e)}"`:`Recalled stored project knowledge`}case`fact_captured`:{let e=typeof t.content==`string`?t.content:typeof t.source_quote==`string`?t.source_quote:null;return e?`Learned: "${kL(e)}"`:`Learned a new project fact`}case`loop_circuit_breaker_fired`:return`Detected and stopped a repetitive agent loop`;default:return DL[e.event_type]??e.event_type.replace(/_/g,` `)}}function kL(e,t=80){return e.length>t?`${e.slice(0,t)}…`:e}var AL={"tokenflow.shell_compression":`📦`,"tokenflow.file_read":`📄`,"tokenflow.persistent_memory":`🧠`,"tokenflow.format_encoding":`🗜️`,"tokenflow.response_dedup":`♻️`,"tokenflow.context_rot_prevention":`🧹`,"tokenflow.instruction_reinforcement":`📋`,drift_consumed:`🔄`,stale_edit_prevented:`🛡️`,cascade_warning_consumed:`⚠️`,convention_consumed:`📐`,fact_recalled:`💡`,fact_captured:`📝`,user_prompt_received:`💬`,presence_ambient_marker:`👁️`,loop_circuit_breaker_fired:`🔴`,auto_doc_generated:`📖`},jL={search_code:{color:`text-cyan-400`,label:`Search`},file_read:{color:`text-blue-400`,label:`Read`},file_outline:{color:`text-blue-400`,label:`Read`},get_entity:{color:`text-blue-400`,label:`Read`},get_references:{color:`text-purple-400`,label:`Graph`},get_imports:{color:`text-purple-400`,label:`Graph`},get_critical_nodes:{color:`text-purple-400`,label:`Graph`},get_conventions:{color:`text-indigo-400`,label:`Conventions`},get_rules:{color:`text-indigo-400`,label:`Conventions`},recall_facts:{color:`text-amber-400`,label:`Memory`},unerr_recall_notes:{color:`text-amber-400`,label:`Memory`},unerr_remember:{color:`text-amber-400`,label:`Memory`},record_fact:{color:`text-amber-400`,label:`Memory`},unerr_turn_summary:{color:`text-emerald-400`,label:`Summary`}},ML={mark_intent:{icon:`🎯`,color:`text-violet-400`,label:`Intent`},mark_decision:{icon:`⚖️`,color:`text-cyan-400`,label:`Decision`},mark_blocker:{icon:`🚧`,color:`text-amber-400`,label:`Blocker`},mark_resolution:{icon:`✅`,color:`text-emerald-400`,label:`Resolution`}};function NL({attribution:e}){let t=e?.recalls??[],n=e?.captures??[],r=e?.drift??[];return t.length+n.length+r.length===0?null:(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:`Memory activity`}),(0,w.jsxs)(`div`,{className:`space-y-2`,children:[t.map((e,t)=>(0,w.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,w.jsx)(`span`,{className:`text-amber-400 shrink-0`,children:`💡`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`text-amber-400 text-xs font-medium`,children:`Recalled`}),(0,w.jsx)(`p`,{className:`t-secondary text-xs mt-0.5 leading-snug`,children:kL(e.content||e.source_quote,120)})]})]},`recall-${t}`)),n.map((e,t)=>(0,w.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,w.jsx)(`span`,{className:`text-emerald-400 shrink-0`,children:`📝`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`text-emerald-400 text-xs font-medium`,children:`Learned`}),(0,w.jsx)(`p`,{className:`t-secondary text-xs mt-0.5 leading-snug`,children:kL(e.content||e.source_quote,120)})]})]},`capture-${t}`)),r.map((e,t)=>(0,w.jsxs)(`div`,{className:`flex items-start gap-2 text-sm`,children:[(0,w.jsx)(`span`,{className:`text-red-400 shrink-0`,children:`🔄`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`text-red-400 text-xs font-medium`,children:`Drift caught`}),(0,w.jsx)(`p`,{className:`font-mono text-xs t-secondary mt-0.5`,children:e.file_path})]})]},`drift-${t}`))]})]})}function PL({events:e}){let t=e.filter(e=>e.event_type!==`user_prompt_received`&&e.event_type!==`presence_ambient_marker`);return t.length===0?null:(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:[`What happened (`,t.length,` event`,t.length===1?``:`s`,`)`]}),(0,w.jsx)(`div`,{className:`space-y-2`,children:t.map((e,t)=>{let n=AL[e.event_type]??`•`,r=e.event_type.startsWith(`tokenflow.`)?e.metadata.tokens_saved:null;return(0,w.jsxs)(`div`,{className:`flex items-start gap-2 group`,children:[(0,w.jsx)(`span`,{className:`shrink-0 text-sm`,children:n}),(0,w.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,w.jsx)(`p`,{className:`text-foreground text-xs leading-snug`,children:OL(e)}),r!=null&&r>0&&(0,w.jsxs)(`span`,{className:`text-emerald-400/70 text-[10px] font-mono`,children:[`saved `,SL(r),` tokens`]})]}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] font-mono shrink-0 opacity-0 group-hover:opacity-100 transition-opacity`,children:new Date(e.ts).toLocaleTimeString()})]},t)})})]})}function FL({toolCalls:e}){let[t,n]=(0,f.useState)(null);return e.length===0?null:(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:[`Agent queries to unerr (`,e.length,`)`]}),(0,w.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>{let r=jL[e.tool]??{color:`t-secondary`,label:`Tool`},i=t===e.id;return(0,w.jsxs)(`div`,{className:`rounded border border-border-subtle/30`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-surface-secondary/50 transition-colors`,onClick:()=>n(i?null:e.id),children:[(0,w.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider ${r.color}`,children:r.label}),(0,w.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e.tool}),(0,w.jsx)(`span`,{className:`flex-1`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:new Date(e.ts).toLocaleTimeString()}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:i?`▾`:`▸`})]}),i&&(0,w.jsxs)(`div`,{className:`px-3 pb-2 space-y-1.5 border-t border-border-subtle/20`,children:[Object.keys(e.args_summary).length>0&&(0,w.jsxs)(`div`,{className:`mt-1.5`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wider mb-0.5`,children:`Args`}),(0,w.jsx)(`pre`,{className:`text-[11px] font-mono t-secondary whitespace-pre-wrap break-all bg-surface-secondary/30 rounded p-1.5`,children:LL(e.args_summary)})]}),Object.keys(e.result_summary).length>0&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wider mb-0.5`,children:`Result`}),(0,w.jsx)(`pre`,{className:`text-[11px] font-mono t-secondary whitespace-pre-wrap break-all bg-surface-secondary/30 rounded p-1.5`,children:LL(e.result_summary)})]})]})]},e.id)})})]})}function IL({markers:e}){return e.length===0?null:(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:[`Session markers (`,e.length,`)`]}),(0,w.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let t=ML[e.type]??{icon:`📌`,color:`t-secondary`,label:e.type};return(0,w.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,w.jsx)(`span`,{className:`shrink-0`,children:t.icon}),(0,w.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,w.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wider ${t.color}`,children:t.label}),(0,w.jsx)(`p`,{className:`text-foreground text-xs leading-snug mt-0.5`,children:e.text}),e.alternatives&&e.alternatives.length>0&&(0,w.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.alternatives.map((e,t)=>(0,w.jsxs)(`span`,{className:`text-[10px] t-tertiary bg-surface-secondary rounded px-1.5 py-0.5`,children:[`alt: `,e]},t))}),e.file_path&&(0,w.jsx)(`p`,{className:`font-mono text-[10px] t-tertiary mt-0.5`,children:e.file_path})]}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] font-mono shrink-0`,children:new Date(e.ts).toLocaleTimeString()})]},e.id)})})]})}function LL(e){let t=[];for(let[n,r]of Object.entries(e)){if(r==null)continue;let e=typeof r==`string`?kL(r,100):typeof r==`number`||typeof r==`boolean`?String(r):JSON.stringify(r).slice(0,100);t.push(`${n}: ${e}`)}return t.join(`
|
|
916
|
+
`)||`(empty)`}function RL(){let{url:e,queryKey:t}=Ot(),n=S(`session`),r=S(`turn`),i=Number(r),a=!!n&&Number.isInteger(i)&&i>=0,o=N({queryKey:t([`prompt-trace`,n,r]),queryFn:()=>O(e(`/api/prompt-trace/${encodeURIComponent(n??``)}/${i}`)),enabled:a,refetchInterval:5e3});if(!a)return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-10 text-center`,children:[(0,w.jsx)(`p`,{className:`t-secondary text-lg`,children:`No prompt selected`}),(0,w.jsxs)(`p`,{className:`t-tertiary mt-2 text-sm`,children:[`Open a prompt trace from`,` `,(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors`,onClick:()=>y(`logbook`),children:`What unerr did`}),` `,`or the Activity timeline.`]})]});let s=[{label:`What unerr did`,onClick:()=>y(`logbook`)},{label:`Prompt · turn ${i}`}];if(o.isLoading)return(0,w.jsxs)(`div`,{children:[(0,w.jsx)(sL,{items:s}),(0,w.jsx)(Wt,{n:4})]});let c=o.data?.data;if(!c)return(0,w.jsxs)(`div`,{children:[(0,w.jsx)(sL,{items:s}),(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-8 text-center`,children:(0,w.jsxs)(`p`,{className:`t-secondary`,children:[`No trace for session `,n?.slice(0,12),` · turn `,i]})})]});let l=c.reasoning,u=c.events??[],d=c.attribution??{recalls:[],captures:[],drift:[]},f=c.tool_calls??[],p=c.markers??[],m=u.length+f.length+p.length;return(0,w.jsxs)(`div`,{className:`space-y-5`,children:[(0,w.jsx)(sL,{items:s}),(0,w.jsx)(TL,{trace:c}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 md:grid-cols-4`,children:[(0,w.jsx)(wL,{label:`Tokens saved`,value:SL(c.tokens_saved),accent:`text-emerald-400`,hint:`Tokens unerr kept out of context this turn.`,sub:c.mechanisms.length>0?`${c.mechanisms.length} mechanism${c.mechanisms.length===1?``:`s`}`:void 0}),(0,w.jsx)(wL,{label:`Noise removed`,value:`${l.noise_removed_pct}%`,accent:`text-violet-400`,hint:`Noise removed from context (graph-backed vs grep/glob).`,sub:l.first_call_resolution_rate>=50?`found first try ✓`:`${l.first_call_resolution_rate}% first-try`}),(0,w.jsx)(wL,{label:`Turns saved`,value:`~${l.turns_saved}`,accent:`text-cyan-400`,hint:`Estimated agent turns saved by unerr's precision.`}),(0,w.jsx)(wL,{label:`Activity`,value:String(m),accent:`text-foreground`,hint:`Total events, tool queries, and markers this turn.`,sub:`${u.length} events · ${f.length} queries · ${p.length} markers`})]}),(0,w.jsx)(EL,{trace:c}),(0,w.jsx)(NL,{attribution:d}),(0,w.jsx)(PL,{events:u}),(0,w.jsx)(FL,{toolCalls:f}),(0,w.jsx)(IL,{markers:p}),c.mechanisms.length>0&&(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:`Savings mechanisms`}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:c.mechanisms.map(e=>(0,w.jsx)(xL,{mechanism:e},e))})]}),(0,w.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:[`Files touched (`,c.files.length,`)`]}),c.files.length===0?(0,w.jsx)(`p`,{className:`t-tertiary text-xs`,children:`No files touched this turn.`}):(0,w.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:c.files.map(e=>(0,w.jsx)(`span`,{className:`inline-flex items-center rounded bg-surface-secondary px-2 py-0.5 font-mono text-[11px] text-foreground`,title:e,children:CL(e)},e))}),c.tools.length>0&&(0,w.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-border-subtle/50`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wider mb-1.5`,children:`Tools used`}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:c.tools.map(e=>(0,w.jsx)(`span`,{className:`font-mono text-[11px] t-secondary`,children:e},e))})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-xs font-medium uppercase tracking-wider mb-3`,children:`Breakages caught`}),c.drift_caught>0?(0,w.jsxs)(`p`,{className:`text-amber-400 font-mono text-2xl font-bold`,children:[c.drift_caught,(0,w.jsxs)(`span`,{className:`t-secondary text-xs font-normal ml-2`,children:[`stale-edit / drift catch`,c.drift_caught===1?``:`es`]})]}):(0,w.jsx)(`p`,{className:`t-tertiary text-xs`,children:`No drift or stale-edit catches this turn.`})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4 flex flex-wrap items-center justify-center gap-x-6 gap-y-2 text-xs`,children:[(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`token-trace`,{session:c.session_id,turn:String(c.turn)}),children:`See token-by-token in Token Trace →`}),(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`reasoning`,{session:c.session_id}),children:`See reasoning detail in Reasoning Trace →`})]})]})}function zL(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var BL={},VL={};function HL(e,t){try{let n=(BL[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in VL?VL[n]:WL(n,n.split(`:`))}catch{if(e in VL)return VL[e];let t=e?.match(UL);return t?WL(e,t.slice(1)):NaN}}var UL=/([+-]\d\d):?(\d\d)?/;function WL(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return VL[e]=n*60+r>0?n*60+r+i:n*60-r-i}var GL=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(HL(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),YL(this,NaN),qL(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-HL(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),qL(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},KL=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!KL.test(e))return;let t=e.replace(KL,`$1UTC`);GL.prototype[t]&&(e.startsWith(`get`)?GL.prototype[e]=function(){return this.internal[t]()}:(GL.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),JL(this),+this},GL.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),qL(this),+this}))});function qL(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-HL(e.timeZone,e)*60))}function JL(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),YL(e)}function YL(e){let t=HL(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);let i=-new Date(+e).getTimezoneOffset(),a=i- -new Date(+r).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=i-n;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=new Date(+e);c.setUTCSeconds(0);let l=i>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(HL(e.timeZone,e)*60))%60;(u||l)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+l));let d=HL(e.timeZone,e),f=d>0?Math.floor(d):Math.ceil(d),p=-new Date(+e).getTimezoneOffset()-f,m=f!==n,h=p-s;if(m&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);let t=HL(e.timeZone,e),n=f-(t>0?Math.floor(t):Math.ceil(t));n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var XL=class e extends GL{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${zL(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},ZL=365.2425,QL=6048e5,$L=864e5,eR=3600*24;eR*7,eR*ZL/12*3;var tR=Symbol.for(`constructDateFrom`);function nR(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&tR in e?e[tR](t):e instanceof Date?new e.constructor(t):new Date(t)}function rR(e,t){return nR(t||e,e)}function iR(e,t,n){let r=rR(e,n?.in);return isNaN(t)?nR(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function aR(e,t,n){let r=rR(e,n?.in);if(isNaN(t))return nR(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=nR(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}var oR={};function sR(){return oR}function cR(e,t){let n=sR(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=rR(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function lR(e,t){return cR(e,{...t,weekStartsOn:1})}function uR(e,t){let n=rR(e,t?.in),r=n.getFullYear(),i=nR(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=lR(i),o=nR(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=lR(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function dR(e){let t=rR(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function fR(e,...t){let n=nR.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function pR(e,t){let n=rR(e,t?.in);return n.setHours(0,0,0,0),n}function mR(e,t,n){let[r,i]=fR(n?.in,e,t),a=pR(r),o=pR(i),s=+a-dR(a),c=+o-dR(o);return Math.round((s-c)/$L)}function hR(e,t){let n=uR(e,t),r=nR(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),lR(r)}function gR(e,t,n){return iR(e,t*7,n)}function _R(e,t,n){return aR(e,t*12,n)}function vR(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=nR.bind(null,e));let t=rR(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),nR(r,n||NaN)}function yR(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=nR.bind(null,e));let t=rR(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),nR(r,n||NaN)}function bR(e,t,n){let[r,i]=fR(n?.in,e,t);return+pR(r)==+pR(i)}function xR(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function SR(e){return!(!xR(e)&&typeof e!=`number`||isNaN(+rR(e)))}function CR(e,t,n){let[r,i]=fR(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function wR(e,t){let n=rR(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function TR(e,t){let[n,r]=fR(e,t.start,t.end);return{start:n,end:r}}function ER(e,t){let{start:n,end:r}=TR(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(nR(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function DR(e,t){let n=rR(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function OR(e,t){let n=rR(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function kR(e,t){let n=rR(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function AR(e,t){let{start:n,end:r}=TR(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(nR(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function jR(e,t){let n=sR(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=rR(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function MR(e,t){return jR(e,{...t,weekStartsOn:1})}var NR={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},PR=(e,t,n)=>{let r,i=NR[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function FR(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var IR={date:FR({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:FR({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:FR({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},LR={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},RR=(e,t,n,r)=>LR[e];function zR(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var BR={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:zR({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:zR({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:zR({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:zR({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:zR({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function VR(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?UR(s,e=>e.test(o)):HR(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function HR(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function UR(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function WR(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var GR={code:`en-US`,formatDistance:PR,formatLong:IR,formatRelative:RR,localize:BR,match:{ordinalNumber:WR({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:VR({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:VR({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:VR({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:VR({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:VR({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function KR(e,t){let n=rR(e,t?.in);return mR(n,kR(n))+1}function qR(e,t){let n=rR(e,t?.in),r=lR(n)-+hR(n);return Math.round(r/QL)+1}function JR(e,t){let n=rR(e,t?.in),r=n.getFullYear(),i=sR(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=nR(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=cR(o,t),c=nR(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=cR(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function YR(e,t){let n=sR(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=JR(e,t),a=nR(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),cR(a,t)}function XR(e,t){let n=rR(e,t?.in),r=cR(n,t)-+YR(n,t);return Math.round(r/QL)+1}function ZR(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var QR={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return ZR(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):ZR(n+1,2)},d(e,t){return ZR(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return ZR(e.getHours()%12||12,t.length)},H(e,t){return ZR(e.getHours(),t.length)},m(e,t){return ZR(e.getMinutes(),t.length)},s(e,t){return ZR(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return ZR(Math.trunc(r*10**(n-3)),t.length)}},$R={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},ez={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return QR.y(e,t)},Y:function(e,t,n,r){let i=JR(e,r),a=i>0?i:1-i;return t===`YY`?ZR(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):ZR(a,t.length)},R:function(e,t){return ZR(uR(e),t.length)},u:function(e,t){return ZR(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return ZR(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return ZR(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return QR.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return ZR(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=XR(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):ZR(i,t.length)},I:function(e,t,n){let r=qR(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):ZR(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):QR.d(e,t)},D:function(e,t,n){let r=KR(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):ZR(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return ZR(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return ZR(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return ZR(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?$R.noon:r===0?$R.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?$R.evening:r>=12?$R.afternoon:r>=4?$R.morning:$R.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return QR.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):QR.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):ZR(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):ZR(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):QR.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):QR.s(e,t)},S:function(e,t){return QR.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return nz(r);case`XXXX`:case`XX`:return rz(r);default:return rz(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return nz(r);case`xxxx`:case`xx`:return rz(r);default:return rz(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+tz(r,`:`);default:return`GMT`+rz(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+tz(r,`:`);default:return`GMT`+rz(r,`:`)}},t:function(e,t,n){return ZR(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return ZR(+e,t.length)}};function tz(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+ZR(a,2)}function nz(e,t){return e%60==0?(e>0?`-`:`+`)+ZR(Math.abs(e)/60,2):rz(e,t)}function rz(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=ZR(Math.trunc(r/60),2),a=ZR(r%60,2);return n+i+t+a}var iz=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},az=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},oz={p:az,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return iz(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,iz(r,t)).replace(`{{time}}`,az(i,t))}},sz=/^D+$/,cz=/^Y+$/,lz=[`D`,`DD`,`YY`,`YYYY`];function uz(e){return sz.test(e)}function dz(e){return cz.test(e)}function fz(e,t,n){let r=pz(e,t,n);if(console.warn(r),lz.includes(e))throw RangeError(r)}function pz(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var mz=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,hz=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,gz=/^'([^]*?)'?$/,_z=/''/g,vz=/[a-zA-Z]/;function yz(e,t,n){let r=sR(),i=n?.locale??r.locale??GR,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=rR(e,n?.in);if(!SR(s))throw RangeError(`Invalid time value`);let c=t.match(hz).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=oz[t];return n(e,i.formatLong)}return e}).join(``).match(mz).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:bz(e)};if(ez[t])return{isToken:!0,value:e};if(t.match(vz))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&dz(a)||!n?.useAdditionalDayOfYearTokens&&uz(a))&&fz(a,t,String(e));let o=ez[a[0]];return o(s,a,i.localize,l)}).join(``)}function bz(e){let t=e.match(gz);return t?t[1].replace(_z,`'`):e}function xz(e,t){let n=rR(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=nR(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function Sz(e,t){return rR(e,t?.in).getMonth()}function Cz(e,t){return rR(e,t?.in).getFullYear()}function wz(e,t){return+rR(e)>+rR(t)}function Tz(e,t){return+rR(e)<+rR(t)}function Ez(e,t,n){let[r,i]=fR(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function Dz(e,t,n){let[r,i]=fR(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function Oz(e,t,n){let r=rR(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=nR(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=xz(o);return r.setMonth(t,Math.min(a,s)),r}function kz(e,t,n){let r=rR(e,n?.in);return isNaN(+r)?nR(n?.in||e,NaN):(r.setFullYear(t),r)}var Az=5,jz=4;function Mz(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,Az*7-1);return t.getMonth(e)===t.getMonth(a)?Az:jz}function Nz(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function Pz(e,t){let n=Nz(e,t),r=Mz(e,t);return t.addDays(n,r*7-1)}var Fz={...GR,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>yz(e,t,{locale:GR,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>yz(e,n,{locale:GR,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>yz(e,t,{locale:GR,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>yz(e,n,{locale:GR,...t}),r(e,`cccc`)}}},Iz=class e{constructor(e,t){this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?XL.tz(this.options.timeZone):new(this.options.Date??Date),this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new XL(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):iR(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):aR(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):gR(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):_R(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):mR(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):CR(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):ER(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):AR(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):Pz(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):MR(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):wR(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):jR(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):OR(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):yz(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):qR(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):Sz(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):Cz(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):XR(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):wz(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):Tz(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):xR(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):bR(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):Ez(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):Dz(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):vR(e),this.min=e=>this.overrides?.min?this.overrides.min(e):yR(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):Oz(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):kz(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):Nz(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):pR(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):lR(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):DR(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):cR(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):kR(e),this.options={locale:Fz,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};Iz.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var Lz=new Iz,Rz=class{constructor(e,t,n=Lz){this.date=e,this.displayMonth=t,this.outside=!!(t&&!n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},zz=class{constructor(e,t){this.date=e,this.weeks=t}},Bz=class{constructor(e,t){this.days=t,this.weekNumber=e}};function Vz(e){return f.createElement(`span`,{...e})}function Hz(e){let{size:t=24,orientation:n=`left`,className:r}=e;return f.createElement(`svg`,{className:r,width:t,height:t,viewBox:`0 0 24 24`},n===`up`&&f.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),n===`down`&&f.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),n===`left`&&f.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),n===`right`&&f.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function Uz(e){let{day:t,modifiers:n,...r}=e;return f.createElement(`td`,{...r})}function Wz(e){let{day:t,modifiers:n,...r}=e,i=f.useRef(null);return f.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),f.createElement(`button`,{ref:i,...r})}var $;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})($||={});var Gz;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(Gz||={});var Kz;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(Kz||={});var qz;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})(qz||={});var Jz=(0,f.createContext)(void 0);function Yz(){let e=(0,f.useContext)(Jz);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function Xz(e){let{options:t,className:n,...r}=e,{classNames:i,components:a}=Yz(),o=[i[$.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===r.value);return f.createElement(`span`,{"data-disabled":r.disabled,className:i[$.DropdownRoot]},f.createElement(a.Select,{className:o,...r},t?.map(({value:e,label:t,disabled:n})=>f.createElement(a.Option,{key:e,value:e,disabled:n},t))),f.createElement(`span`,{className:i[$.CaptionLabel],"aria-hidden":!0},s?.label,f.createElement(a.Chevron,{orientation:`down`,size:18,className:i[$.Chevron]})))}function Zz(e){return f.createElement(`div`,{...e})}function Qz(e){return f.createElement(`div`,{...e})}function $z(e){let{calendarMonth:t,displayIndex:n,...r}=e;return f.createElement(`div`,{...r},e.children)}function eB(e){let{calendarMonth:t,displayIndex:n,...r}=e;return f.createElement(`div`,{...r})}function tB(e){return f.createElement(`table`,{...e})}function nB(e){return f.createElement(`div`,{...e})}function rB(e){let{components:t}=Yz();return f.createElement(t.Dropdown,{...e})}function iB(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=Yz(),u=(0,f.useCallback)(e=>{i&&n?.(e)},[i,n]),d=(0,f.useCallback)(e=>{r&&t?.(e)},[r,t]);return f.createElement(`nav`,{...a},f.createElement(o.PreviousMonthButton,{type:`button`,className:s[$.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:d},f.createElement(o.Chevron,{disabled:r?void 0:!0,className:s[$.Chevron],orientation:`left`})),f.createElement(o.NextMonthButton,{type:`button`,className:s[$.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":l(i),onClick:u},f.createElement(o.Chevron,{disabled:i?void 0:!0,orientation:`right`,className:s[$.Chevron]})))}function aB(e){return f.createElement(`button`,{...e})}function oB(e){return f.createElement(`option`,{...e})}function sB(e){return f.createElement(`button`,{...e})}function cB(e){let{rootRef:t,...n}=e;return f.createElement(`div`,{...n,ref:t})}function lB(e){return f.createElement(`select`,{...e})}function uB(e){let{week:t,...n}=e;return f.createElement(`tr`,{...n})}function dB(e){return f.createElement(`th`,{...e})}function fB(e){return f.createElement(`thead`,{"aria-hidden":!0},f.createElement(`tr`,{...e}))}function pB(e){let{week:t,...n}=e;return f.createElement(`th`,{...n})}function mB(e){return f.createElement(`th`,{...e})}function hB(e){return f.createElement(`tbody`,{...e})}function gB(e){let{components:t}=Yz();return f.createElement(t.Dropdown,{...e})}var _B=s({CaptionLabel:()=>Vz,Chevron:()=>Hz,Day:()=>Uz,DayButton:()=>Wz,Dropdown:()=>Xz,DropdownNav:()=>Zz,Footer:()=>Qz,Month:()=>$z,MonthCaption:()=>eB,MonthGrid:()=>tB,Months:()=>nB,MonthsDropdown:()=>rB,Nav:()=>iB,NextMonthButton:()=>aB,Option:()=>oB,PreviousMonthButton:()=>sB,Root:()=>cB,Select:()=>lB,Week:()=>uB,WeekNumber:()=>pB,WeekNumberHeader:()=>mB,Weekday:()=>dB,Weekdays:()=>fB,Weeks:()=>hB,YearsDropdown:()=>gB});function vB(e,t,n=!1,r=Lz){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function yB(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function bB(e){return!!(e&&typeof e==`object`&&`from`in e)}function xB(e){return!!(e&&typeof e==`object`&&`after`in e)}function SB(e){return!!(e&&typeof e==`object`&&`before`in e)}function CB(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function wB(e,t){return Array.isArray(e)&&e.every(t.isDate)}function TB(e,t,n=Lz){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(wB(t,n))return t.some(t=>i(e,t));if(bB(t))return vB(t,e,!1,n);if(CB(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(yB(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return xB(t)?a(e,t.after)>0:SB(t)?a(t.before,e)>0:typeof t==`function`?t(e):!1})}function EB(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[Gz.focused]:[],[Gz.outside]:[],[Gz.disabled]:[],[Gz.hidden]:[],[Gz.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!!(n&&!f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&TB(e,a,i)),S=!!(o&&TB(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&TB(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[Gz.focused]:!1,[Gz.disabled]:!1,[Gz.hidden]:!1,[Gz.outside]:!1,[Gz.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function DB(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[Gz[r]]?e.push(t[Gz[r]]):t[Kz[r]]&&e.push(t[Kz[r]]),e),[t[$.Day]])}function OB(e){return{..._B,...e}}function kB(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function AB(){let e={};for(let t in $)e[$[t]]=`rdp-${$[t]}`;for(let t in Gz)e[Gz[t]]=`rdp-${Gz[t]}`;for(let t in Kz)e[Kz[t]]=`rdp-${Kz[t]}`;for(let t in qz)e[qz[t]]=`rdp-${qz[t]}`;return e}function jB(e,t,n){return(n??new Iz(t)).formatMonthYear(e)}function MB(e,t,n){return(n??new Iz(t)).format(e,`d`)}function NB(e,t=Lz){return t.format(e,`LLLL`)}function PB(e,t,n){return(n??new Iz(t)).format(e,`cccccc`)}function FB(e,t=Lz){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function IB(){return``}function LB(e,t=Lz){return t.format(e,`yyyy`)}var RB=s({formatCaption:()=>jB,formatDay:()=>MB,formatMonthDropdown:()=>NB,formatWeekNumber:()=>FB,formatWeekNumberHeader:()=>IB,formatWeekdayName:()=>PB,formatYearDropdown:()=>LB});function zB(e){return{...RB,...e}}function BB(e,t,n,r){let i=(r??new Iz(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}function VB(e,t,n){return(n??new Iz(t)).formatMonthYear(e)}function HB(e,t,n,r){let i=(r??new Iz(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function UB(e){return`Choose the Month`}function WB(){return``}var GB=`Go to the Next Month`;function KB(e,t){return GB}function qB(e){return`Go to the Previous Month`}function JB(e,t,n){return(n??new Iz(t)).format(e,`cccc`)}function YB(e,t){return`Week ${e}`}function XB(e){return`Week Number`}function ZB(e){return`Choose the Year`}var QB=s({labelDayButton:()=>BB,labelGrid:()=>VB,labelGridcell:()=>HB,labelMonthDropdown:()=>UB,labelNav:()=>WB,labelNext:()=>KB,labelPrevious:()=>qB,labelWeekNumber:()=>YB,labelWeekNumberHeader:()=>XB,labelWeekday:()=>JB,labelYearDropdown:()=>ZB}),$B=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function eV(e,t){let n=t.locale?.labels??{};return{...QB,...e??{},labelDayButton:$B(BB,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:$B(UB,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:$B(KB,e?.labelNext,n.labelNext),labelPrevious:$B(qB,e?.labelPrevious,n.labelPrevious),labelWeekNumber:$B(YB,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:$B(ZB,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:$B(VB,e?.labelGrid,n.labelGrid),labelGridcell:$B(HB,e?.labelGridcell,n.labelGridcell),labelNav:$B(WB,e?.labelNav,n.labelNav),labelWeekNumberHeader:$B(XB,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:$B(JB,e?.labelWeekday,n.labelWeekday)}}function tV(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function nV(e,t={},n={}){let r={...t?.[$.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function rV(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function iV(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function aV(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new XL(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(XL.tz(e)),newDate:(t,n,r)=>new XL(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new XL(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new XL(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new XL(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new XL(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>XR(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>qR(o(e)),differenceInCalendarDays:(e,t)=>mR(o(e),o(t)),differenceInCalendarMonths:(e,t)=>CR(o(e),o(t))}}var oV=e=>e instanceof HTMLElement?e:null,sV=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],cV=e=>oV(e.querySelector(`[data-animated-month]`)),lV=e=>oV(e.querySelector(`[data-animated-caption]`)),uV=e=>oV(e.querySelector(`[data-animated-weeks]`)),dV=e=>oV(e.querySelector(`[data-animated-nav]`)),fV=e=>oV(e.querySelector(`[data-animated-weekdays]`));function pV(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=(0,f.useRef)(null),s=(0,f.useRef)(r),c=(0,f.useRef)(!1);(0,f.useLayoutEffect)(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[qz.caption_after_enter]:n[qz.caption_before_enter],p=d?n[qz.weeks_after_enter]:n[qz.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(sV(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=cV(e);t&&e.contains(t)&&e.removeChild(t);let n=lV(e);n&&n.classList.remove(f);let r=uV(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?sV(m):[],_=sV(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g?.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=dV(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=lV(i);s&&s.classList.add(f);let l=uV(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=fV(o);m&&(m.style.opacity=`0`);let h=lV(o);h&&(h.classList.add(d?n[qz.caption_before_exit]:n[qz.caption_after_exit]),h.addEventListener(`animationend`,u));let _=uV(o);_&&_.classList.add(d?n[qz.weeks_before_exit]:n[qz.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function mV(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function hV(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function gV(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function _V(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function vV(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new zz(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new Rz(t,m,r);return a?a.days.push(o):e.push(new Bz(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function yV(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,today:u}=t,d=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):!n&&d&&(n=i(c(e.today??u(),-100))),r?r=s(r):!r&&d&&(r=l(e.today??u())),[n&&a(n),r&&a(r)]}function bV(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function xV(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function SV(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function CV(e,t){let[n,r]=(0,f.useState)(e);return[t===void 0?n:t,r]}function wV(e,t){let[n,r]=yV(e,t),{startOfMonth:i,endOfMonth:a}=t,o=_V(e,n,r,t),[s,c]=CV(o,e.month?o:void 0);(0,f.useEffect)(()=>{c(_V(e,n,r,t))},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:p,nextMonth:m}=(0,f.useMemo)(()=>{let i=gV(s,r,{numberOfMonths:e.numberOfMonths},t),o=vV(i,mV(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:SV(o),days:hV(o),previousMonth:xV(s,n,e,t),nextMonth:bV(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:h,onMonthChange:g}=e,_=e=>u.some(t=>t.days.some(t=>t.isEqualTo(e))),v=e=>{if(h)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),c(t),g?.(t)};return{months:l,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:p,nextMonth:m,goToMonth:v,goToDay:e=>{_(e)||v(e.date)}}}var TV;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(TV||={});function EV(e){return!e[Gz.disabled]&&!e[Gz.hidden]&&!e[Gz.outside]}function DV(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);EV(e)&&(e[Gz.focused]&&a<TV.FocusedModifier?(i=o,a=TV.FocusedModifier):r?.isEqualTo(o)&&a<TV.LastFocused?(i=o,a=TV.LastFocused):n(o.date)&&a<TV.Selected?(i=o,a=TV.Selected):e[Gz.today]&&a<TV.Today&&(i=o,a=TV.Today))}return i||=e.find(e=>EV(t(e))),i}function OV(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function kV(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=OV(e,t,n.date,r,i,a,o),l=!!(a.disabled&&TB(c,a.disabled,o)),u=!!(a.hidden&&TB(c,a.hidden,o)),d=new Rz(c,c,o);return!l&&!u?d:kV(e,t,d,r,i,a,o,s+1)}function AV(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,f.useState)(),c=DV(t.days,n,r||(()=>!1),o),[l,u]=(0,f.useState)(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=kV(n,r,l,t.navStart,t.navEnd,e,i);a&&(e.disableNavigation&&!t.days.some(e=>e.isEqualTo(a))||(t.goToDay(a),u(a)))}}}function jV(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=CV(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function MV(e,t,n=0,r=0,i=!1,a=Lz){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s)if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`);if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function NV(e,t,n=Lz){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function PV(e,t,n=Lz){return vB(e,t.from,!1,n)||vB(e,t.to,!1,n)||vB(t,e.from,!1,n)||vB(t,e.to,!1,n)}function FV(e,t,n=Lz){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?vB(e,t,!1,n):wB(t,n)?t.some(t=>vB(e,t,!1,n)):bB(t)?t.from&&t.to?PV(e,{from:t.from,to:t.to},n):!1:CB(t)?NV(e,t.dayOfWeek,n):yB(t)?n.isAfter(t.before,t.after)?PV(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):TB(e.from,t,n)||TB(e.to,t,n):xB(t)||SB(t)?TB(e.from,t,n)||TB(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function IV(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=CV(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:MV(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&FV({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&vB(u,e,!1,t)}}function LV(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=CV(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function RV(e,t){let n=LV(e,t),r=jV(e,t),i=IV(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function zV(e,t){return e instanceof XL&&e.timeZone===t?e:new XL(e,t)}function BV(e,t,n){if(!n)return zV(e,t);let r=zV(e,t),i=new XL(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function VV(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?BV(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?BV(e,t,n):e):bB(e)?{...e,from:e.from?zV(e.from,t):e.from,to:e.to?zV(e.to,t):e.to}:yB(e)?{before:BV(e.before,t,n),after:BV(e.after,t,n)}:xB(e)?{after:BV(e.after,t,n)}:SB(e)?{before:BV(e.before,t,n)}:e}function HV(e,t,n){return e&&(Array.isArray(e)?e.map(e=>VV(e,t,n)):VV(e,t,n))}function UV(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=zV(t.today,n),t.month&&=zV(t.month,n),t.defaultMonth&&=zV(t.defaultMonth,n),t.startMonth&&=zV(t.startMonth,n),t.endMonth&&=zV(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=zV(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>zV(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?zV(t.selected.from,n):t.selected.from,to:t.selected.to?zV(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=HV(t.disabled,n)),t.hidden!==void 0&&(t.hidden=HV(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=HV(t.modifiers?.[r],n)}),t.modifiers=e}let{components:r,formatters:i,labels:a,dateLib:o,locale:s,classNames:c}=(0,f.useMemo)(()=>{let e={...Fz,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?aV(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new Iz({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:OB(t.components),formatters:zB(t.formatters),labels:eV(t.labels,a.options),locale:e,classNames:{...AB(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});let{captionLayout:l,mode:u,navLayout:d,numberOfMonths:p=1,onDayBlur:m,onDayClick:h,onDayFocus:g,onDayKeyDown:_,onDayMouseEnter:v,onDayMouseLeave:y,onNextClick:b,onPrevClick:x,showWeekNumber:S,styles:C}=t,{formatCaption:w,formatDay:T,formatMonthDropdown:E,formatWeekNumber:ee,formatWeekNumberHeader:te,formatWeekdayName:D,formatYearDropdown:O}=i,ne=wV(t,o),{days:re,months:ie,navStart:k,navEnd:A,previousMonth:ae,nextMonth:j,goToMonth:M}=ne,oe=EB(re,t,k,A,o),{isSelected:se,select:ce,selected:le}=RV(t,o)??{},{blur:ue,focused:de,isFocusTarget:fe,moveFocus:pe,setFocused:me}=AV(t,ne,oe,se??(()=>!1),o),{labelDayButton:he,labelGridcell:ge,labelGrid:_e,labelMonthDropdown:ve,labelNav:ye,labelPrevious:be,labelNext:xe,labelWeekday:Se,labelWeekNumber:Ce,labelWeekNumberHeader:we,labelYearDropdown:Te}=a,Ee=(0,f.useMemo)(()=>rV(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),De=u!==void 0||h!==void 0,Oe=(0,f.useCallback)(()=>{ae&&(M(ae),x?.(ae))},[ae,M,x]),ke=(0,f.useCallback)(()=>{j&&(M(j),b?.(j))},[M,j,b]),Ae=(0,f.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),me(e),!t.disabled&&(ce?.(e.date,t,n),h?.(e.date,t,n))},[ce,h,me]),je=(0,f.useCallback)((e,t)=>n=>{me(e),g?.(e.date,t,n)},[g,me]),Me=(0,f.useCallback)((e,t)=>n=>{ue(),m?.(e.date,t,n)},[ue,m]),Ne=(0,f.useCallback)((e,n)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];pe(e,t)}_?.(e.date,n,r)},[pe,_,t.dir]),Pe=(0,f.useCallback)((e,t)=>n=>{v?.(e.date,t,n)},[v]),Fe=(0,f.useCallback)((e,t)=>n=>{y?.(e.date,t,n)},[y]),Ie=(0,f.useCallback)((e,t)=>n=>{let r=Number(n.target.value),i=o.setMonth(o.startOfMonth(e),r);M(o.addMonths(i,-t))},[o,M]),Le=(0,f.useCallback)((e,t)=>n=>{let r=Number(n.target.value),i=o.setYear(o.startOfMonth(e),r);M(o.addMonths(i,-t))},[o,M]),{className:Re,style:ze}=(0,f.useMemo)(()=>({className:[c[$.Root],t.className].filter(Boolean).join(` `),style:{...C?.[$.Root],...t.style}}),[c,t.className,t.style,C]),Be=kB(t),Ve=(0,f.useRef)(null);pV(Ve,!!t.animate,{classNames:c,months:ie,focused:de,dateLib:o});let He={dayPickerProps:t,selected:le,select:ce,isSelected:se,months:ie,nextMonth:j,previousMonth:ae,goToMonth:M,getModifiers:oe,components:r,classNames:c,styles:C,labels:a,formatters:i};return f.createElement(Jz.Provider,{value:He},f.createElement(r.Root,{rootRef:t.animate?Ve:void 0,className:Re,style:ze,dir:t.dir,id:t.id,lang:t.lang??s.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t[`aria-label`],"aria-labelledby":t[`aria-labelledby`],...Be},f.createElement(r.Months,{className:c[$.Months],style:C?.[$.Months]},!t.hideNavigation&&!d&&f.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[$.Nav],style:C?.[$.Nav],"aria-label":ye(),onPreviousClick:Oe,onNextClick:ke,previousMonth:ae,nextMonth:j}),ie.map((e,n)=>{let a=t.reverseMonths?ie.length-1-n:n;return f.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[$.Month],style:C?.[$.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&f.createElement(r.PreviousMonthButton,{type:`button`,className:c[$.PreviousMonthButton],tabIndex:ae?void 0:-1,"aria-disabled":ae?void 0:!0,"aria-label":be(ae),onClick:Oe,"data-animated-button":t.animate?`true`:void 0},f.createElement(r.Chevron,{disabled:ae?void 0:!0,className:c[$.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),f.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[$.MonthCaption],style:C?.[$.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?f.createElement(r.DropdownNav,{className:c[$.Dropdowns],style:C?.[$.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?f.createElement(r.MonthsDropdown,{key:`month`,className:c[$.MonthsDropdown],"aria-label":ve(),disabled:!!t.disableNavigation,onChange:Ie(e.date,a),options:tV(e.date,k,A,i,o),style:C?.[$.Dropdown],value:o.getMonth(e.date)}):f.createElement(`span`,{key:`month`},E(e.date,o)),s=l===`dropdown`||l===`dropdown-years`?f.createElement(r.YearsDropdown,{key:`year`,className:c[$.YearsDropdown],"aria-label":Te(o.options),disabled:!!t.disableNavigation,onChange:Le(e.date,a),options:iV(k,A,i,o,!!t.reverseYears),style:C?.[$.Dropdown],value:o.getYear(e.date)}):f.createElement(`span`,{key:`year`},O(e.date,o));return o.getMonthYearOrder()===`year-first`?[s,n]:[n,s]})(),f.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},w(e.date,o.options,o))):f.createElement(r.CaptionLabel,{className:c[$.CaptionLabel],role:`status`,"aria-live":`polite`},w(e.date,o.options,o))),d===`around`&&!t.hideNavigation&&n===p-1&&f.createElement(r.NextMonthButton,{type:`button`,className:c[$.NextMonthButton],tabIndex:j?void 0:-1,"aria-disabled":j?void 0:!0,"aria-label":xe(j),onClick:ke,"data-animated-button":t.animate?`true`:void 0},f.createElement(r.Chevron,{disabled:j?void 0:!0,className:c[$.Chevron],orientation:t.dir===`rtl`?`left`:`right`})),n===p-1&&d===`after`&&!t.hideNavigation&&f.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[$.Nav],style:C?.[$.Nav],"aria-label":ye(),onPreviousClick:Oe,onNextClick:ke,previousMonth:ae,nextMonth:j}),f.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":_e(e.date,o.options,o)||void 0,className:c[$.MonthGrid],style:C?.[$.MonthGrid]},!t.hideWeekdays&&f.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[$.Weekdays],style:C?.[$.Weekdays]},S&&f.createElement(r.WeekNumberHeader,{"aria-label":we(o.options),className:c[$.WeekNumberHeader],style:C?.[$.WeekNumberHeader],scope:`col`},te()),Ee.map(e=>f.createElement(r.Weekday,{"aria-label":Se(e,o.options,o),className:c[$.Weekday],key:String(e),style:C?.[$.Weekday],scope:`col`},D(e,o.options,o)))),f.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[$.Weeks],style:C?.[$.Weeks]},e.weeks.map(e=>f.createElement(r.Week,{className:c[$.Week],key:e.weekNumber,style:C?.[$.Week],week:e},S&&f.createElement(r.WeekNumber,{week:e,style:C?.[$.WeekNumber],"aria-label":Ce(e.weekNumber,{locale:s}),className:c[$.WeekNumber],scope:`row`,role:`rowheader`},ee(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=oe(e);if(i[Gz.focused]=!i.hidden&&!!de?.isEqualTo(e),i[Kz.selected]=se?.(n)||i.selected,bB(le)){let{from:e,to:t}=le;i[Kz.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[Kz.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[Kz.range_middle]=vB(le,n,!0,o)}let a=nV(i,C,t.modifiersStyles),s=DB(i,c,t.modifiersClassNames),l=!De&&!i.hidden?ge(n,i,o.options,o):void 0;return f.createElement(r.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:i,className:s.join(` `),style:a,role:`gridcell`,"aria-selected":i.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":i.selected||void 0,"data-disabled":i.disabled||void 0,"data-hidden":i.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":i.focused||void 0,"data-today":i.today||void 0},!i.hidden&&De?f.createElement(r.DayButton,{className:c[$.DayButton],style:C?.[$.DayButton],type:`button`,day:e,modifiers:i,disabled:!i.focused&&i.disabled||void 0,"aria-disabled":i.focused&&i.disabled||void 0,tabIndex:fe(e)?0:-1,"aria-label":he(n,i,o.options,o),onClick:Ae(e,i),onBlur:Me(e,i),onFocus:je(e,i),onKeyDown:Ne(e,i),onMouseEnter:Pe(e,i),onMouseLeave:Fe(e,i)},T(n,o.options,o)):!i.hidden&&T(e.date,o.options,o))}))))))})),t.footer&&f.createElement(r.Footer,{className:c[$.Footer],style:C?.[$.Footer],role:`status`,"aria-live":`polite`},t.footer)))}var WV=[{label:`Today`,days:0},{label:`Last 7 days`,days:7},{label:`Last 30 days`,days:30},{label:`Last 90 days`,days:90},{label:`All time`,days:null}];function GV(e){return e.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function KV({fromTs:e,toTs:t,onChange:n}){let[r,i]=(0,f.useState)(!1),a=(0,f.useRef)(null),o=e||t?{from:e?new Date(e):void 0,to:t?new Date(t):void 0}:void 0;(0,f.useEffect)(()=>{if(!r)return;let e=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]);let s=e=>{if(!e){n(``,``);return}n(e.from?new Date(e.from.getFullYear(),e.from.getMonth(),e.from.getDate(),0,0,0).toISOString():``,e.to?new Date(e.to.getFullYear(),e.to.getMonth(),e.to.getDate(),23,59,59).toISOString():``)},c=e=>{if(e===null)n(``,``);else{let t=new Date;n((e===0?new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0):new Date(Date.now()-e*24*60*60*1e3)).toISOString(),t.toISOString())}i(!1)},l=o?.from||o?.to?`${o.from?GV(o.from):`...`} — ${o.to?GV(o.to):`...`}`:`All time`;return(0,w.jsxs)(`div`,{ref:a,className:`relative`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),className:`flex items-center gap-2 bg-surface-secondary border border-border-subtle rounded-lg px-3 py-1.5 text-xs text-foreground hover:border-violet-500/50 transition-colors`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5 t-tertiary shrink-0`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z`})}),(0,w.jsx)(`span`,{className:`font-mono`,children:l}),(e||t)&&(0,w.jsx)(`span`,{className:`t-tertiary hover:text-foreground ml-1 cursor-pointer`,onClick:e=>{e.stopPropagation(),n(``,``)},children:`×`})]}),r&&(0,w.jsxs)(`div`,{className:`absolute top-full mt-1 right-0 z-50 border border-border-subtle rounded-xl shadow-2xl bg-[#18181b] p-4 flex gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-0.5 border-r border-border-subtle pr-4 min-w-[120px]`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] uppercase tracking-wider mb-2 px-2`,children:`Quick select`}),WV.map(e=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>c(e.days),className:`text-left text-xs px-2 py-1.5 rounded-md hover:bg-violet-500/10 hover:text-violet-300 text-foreground transition-colors whitespace-nowrap`,children:e.label},e.label))]}),(0,w.jsx)(`div`,{className:`rdp-dark`,children:(0,w.jsx)(UV,{mode:`range`,selected:o,onSelect:s,disabled:{after:new Date},numberOfMonths:1,showOutsideDays:!0,classNames:{root:`text-foreground text-xs`,months:`flex gap-4`,month_caption:`flex items-center justify-center py-1 mb-1`,caption_label:`text-xs font-medium text-foreground`,nav:`flex items-center`,button_previous:`absolute left-1 top-2.5 h-6 w-6 inline-flex items-center justify-center rounded-md hover:bg-surface-secondary t-tertiary hover:text-foreground transition-colors`,button_next:`absolute right-1 top-2.5 h-6 w-6 inline-flex items-center justify-center rounded-md hover:bg-surface-secondary t-tertiary hover:text-foreground transition-colors`,weekdays:`flex`,weekday:`w-9 text-center t-tertiary text-[10px] font-medium py-1`,week:`flex`,day:`h-9 w-9 text-center`,day_button:`h-8 w-8 rounded-md text-xs inline-flex items-center justify-center transition-colors hover:bg-surface-secondary cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed`,selected:`!bg-violet-500 !text-white font-medium rounded-md`,range_start:`!bg-violet-500 !text-white font-medium rounded-l-md rounded-r-none`,range_end:`!bg-violet-500 !text-white font-medium rounded-r-md rounded-l-none`,range_middle:`!bg-violet-500/20 !text-violet-300 rounded-none`,today:`ring-1 ring-violet-500/50 rounded-md`,outside:`opacity-40`,disabled:`opacity-30 cursor-not-allowed`}})})]})]})}function qV({total:e,limit:t,offset:n,onPageChange:r}){let i=Math.ceil(e/t),a=Math.floor(n/t)+1;return i<=1?null:(0,w.jsxs)(`div`,{className:`flex items-center justify-between px-1 py-2`,children:[(0,w.jsxs)(`span`,{className:`t-tertiary text-xs tabular-nums`,children:[n+1,`–`,Math.min(n+t,e),` of `,e]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`button`,{type:`button`,disabled:a<=1,className:`rounded-md border border-border-subtle bg-white/[0.03] px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:border-border-strong hover:bg-white/[0.07] disabled:cursor-not-allowed disabled:opacity-30 disabled:hover:border-border-subtle disabled:hover:bg-white/[0.03]`,onClick:()=>r(Math.max(0,n-t)),children:`‹ Prev`}),(0,w.jsxs)(`span`,{className:`t-secondary text-xs px-2 font-mono tabular-nums`,children:[a,`/`,i]}),(0,w.jsx)(`button`,{type:`button`,disabled:a>=i,className:`rounded-md border border-border-subtle bg-white/[0.03] px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:border-border-strong hover:bg-white/[0.07] disabled:cursor-not-allowed disabled:opacity-30 disabled:hover:border-border-subtle disabled:hover:bg-white/[0.03]`,onClick:()=>r(n+t),children:`Next ›`})]})]})}function JV(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function YV(e){let t=Date.now()-new Date(e).getTime(),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<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function XV(e){return e>=5?{text:`Exceptional`,color:`text-emerald-400`,bg:`bg-emerald-500/20`}:e>=3?{text:`Strong`,color:`text-emerald-400`,bg:`bg-emerald-500/20`}:e>=2?{text:`Good`,color:`text-cyan-400`,bg:`bg-cyan-500/20`}:e>=1.5?{text:`Improving`,color:`text-amber-400`,bg:`bg-amber-500/20`}:{text:`Building up`,color:`text-zinc-400`,bg:`bg-zinc-500/20`}}function ZV({icon:e,color:t,borderColor:n,title:r,value:i,unit:a,subtitle:o,detail:s,tooltip:c}){return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-t-2 ${n}`,title:c,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,w.jsx)(`span`,{className:`text-lg`,children:e}),(0,w.jsx)(`p`,{className:`${t} text-[10px] uppercase tracking-wider font-medium`,children:r})]}),(0,w.jsxs)(`p`,{className:`text-3xl font-bold font-mono ${t}`,children:[i,a&&(0,w.jsx)(`span`,{className:`text-lg ml-0.5`,children:a})]}),(0,w.jsx)(`p`,{className:`t-secondary text-xs mt-1.5`,children:o}),s&&(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-1 leading-snug`,children:s})]})}function QV({value:e,max:t,label:n}){let r=t&&t>0?Math.min(100,Math.round(e/t*100)):e;return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 ${r>=70?`bg-emerald-500/20`:r>=40?`bg-amber-500/20`:`bg-red-500/20`} ${r>=70?`text-emerald-400`:r>=40?`text-amber-400`:`text-red-400`} text-[10px] font-medium`,title:n,children:[r,`%`]})}function $V({onSelectSession:e}){let{url:t,queryKey:n}=Ot(),r=S(`from`)??``,i=S(`to`)??``,a=S(`session_offset`),o=Number(a)||0,s=(e,t)=>x({from:e||null,to:t||null,session_offset:null}),c=e=>x({session_offset:e>0?String(e):null}),l=r||i?`${r?`&from_ts=${r}`:``}${i?`&to_ts=${i}`:``}`:``,u=N({queryKey:n([`reasoning-quality-global`,r,i]),queryFn:()=>O(t(`/api/reasoning-quality/global?_=1${l}`)),refetchInterval:5e3}),d=N({queryKey:n([`reasoning-quality-sessions`,r,i,o]),queryFn:()=>O(t(`/api/reasoning-quality/sessions?limit=10&offset=${o}${l}`)),refetchInterval:5e3}),f=N({queryKey:n([`reasoning-quality-trend`,r,i]),queryFn:()=>O(t(`/api/reasoning-quality/trend?_=1${l}`)),refetchInterval:1e4});if(u.isLoading)return(0,w.jsx)(Wt,{n:6});let p=u.data?.data,m=d.data?.data??[],h=d.data?.total??0;if(!p||p.total_events===0)return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-10 text-center`,children:[(0,w.jsx)(`p`,{className:`t-secondary text-lg`,children:`No reasoning data yet`}),(0,w.jsx)(`p`,{className:`t-tertiary mt-2 text-sm max-w-md mx-auto`,children:`This page tracks how unerr improves your agent's thinking — not just saving tokens, but making every remaining token count more. Data appears as soon as the agent starts using unerr's tools.`})]});let g=XV(p.reasoning_quality_multiplier);return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsx)(`div`,{className:`flex items-center justify-end gap-3 flex-wrap -mt-2`,children:(0,w.jsx)(KV,{fromTs:r,toTs:i,onChange:(e,t)=>s(e,t)})}),(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-6 border-l-4 border-violet-500/60`,children:(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-4 flex-wrap`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{className:`text-foreground font-semibold text-base`,children:`Is your agent reasoning better?`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-1 max-w-lg leading-relaxed`,children:`unerr doesn't just save tokens — it makes every remaining token count more. By feeding the right code, past learnings, and project conventions at exactly the right moment, your agent makes better decisions with less context.`})]}),(0,w.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,w.jsxs)(`p`,{className:`text-violet-400 font-mono font-bold text-4xl`,children:[p.reasoning_quality_multiplier,`x`]}),(0,w.jsx)(`span`,{className:`inline-flex items-center rounded-full px-2.5 py-0.5 ${g.bg} ${g.color} text-[10px] font-medium mt-1`,children:g.text}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-1`,children:`reasoning improvement`})]})]})}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-4`,children:[(0,w.jsx)(ZV,{icon:`🔍`,color:`text-emerald-400`,borderColor:`border-emerald-500/60`,title:`Cleaner Focus`,value:`${p.noise_removed_pct}%`,subtitle:`of irrelevant code removed before the agent saw it`,detail:`The agent focused on ${JV(p.entities_resolved)} relevant code entities instead of reading entire files`,tooltip:`Signal-to-noise ratio: ${p.signal_to_noise_ratio} · Context density: ${p.context_density} entities per 1K tokens · Attention boost: ${p.attention_multiplier}x`}),(0,w.jsx)(ZV,{icon:`⚡`,color:`text-cyan-400`,borderColor:`border-cyan-500/60`,title:`Found It First Try`,value:`${p.first_call_resolution_rate}%`,subtitle:`of code lookups resolved in a single call`,detail:`Saved ~${JV(p.turns_saved)} wasted turns that would have been spent searching through files`,tooltip:`${JV(p.graph_calls)} graph-backed lookups out of ${JV(p.total_tool_calls)} total tool calls · ${p.exploration_loops_prevented} search loops stopped`}),(0,w.jsx)(ZV,{icon:`🛡️`,color:`text-amber-400`,borderColor:`border-amber-500/60`,title:`Mistakes Prevented`,value:p.prevention_score,subtitle:`risky operations caught before they shipped`,detail:[p.blast_radius_warnings>0?`${p.blast_radius_warnings} high-impact edits flagged`:null,p.convention_injections>0?`${p.convention_injections} style rules applied`:null,p.circuit_breaker_activations>0?`${p.circuit_breaker_activations} agent loops stopped`:null].filter(Boolean).join(` · `),tooltip:`Includes blast-radius warnings (risky edits with many callers), convention injections (project rules applied automatically), and circuit breaker activations (agent retry loops stopped)`}),(0,w.jsx)(ZV,{icon:`🧠`,color:`text-fuchsia-400`,borderColor:`border-fuchsia-500/60`,title:`Lessons Remembered`,value:p.memory_verdicts_total>0?`${p.memory_effectiveness_pct}%`:p.memory_signals_fired>0?`${p.memory_signals_fired}`:`—`,unit:p.memory_verdicts_total>0?``:p.memory_signals_fired>0?` notes`:``,subtitle:p.memory_verdicts_total>0?`of past learnings actually changed the agent's decisions`:p.memory_signals_fired>0?`past learnings surfaced — tracking impact`:`No past learnings surfaced yet`,detail:p.memory_verdicts_total>0?`${p.verdicts_acted_on+p.verdicts_reinforced+p.verdicts_caught} out of ${p.memory_verdicts_total} surfaced notes were load-bearing`:void 0,tooltip:`Each time unerr surfaces a past note, convention, or session resume, it tracks whether the agent actually used it. Load-bearing = the note changed what the agent did.`})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-3`,children:`How unerr improves reasoning`}),(0,w.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-3 text-xs`,children:[(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(`p`,{className:`text-emerald-400 font-medium uppercase tracking-wider text-[10px]`,children:`1. Feeds the right code`}),(0,w.jsxs)(`p`,{className:`t-secondary leading-relaxed`,children:[`Instead of dumping entire files, unerr uses a live code graph to serve only the relevant functions, types, and callers. The agent sees `,p.noise_removed_pct,`% less noise — which research shows directly improves LLM attention and accuracy.`]}),(0,w.jsxs)(`div`,{className:`flex gap-4 pt-1.5 border-t border-border-subtle/50`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Entities served`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm`,children:JV(p.entities_resolved)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Attention boost`}),(0,w.jsxs)(`p`,{className:`text-foreground font-mono text-sm`,children:[p.attention_multiplier,`x`]})]})]})]}),(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(`p`,{className:`text-cyan-400 font-medium uppercase tracking-wider text-[10px]`,children:`2. Frees up context space`}),(0,w.jsx)(`p`,{className:`t-secondary leading-relaxed`,children:`By stripping noise and resolving lookups in one call, unerr frees context window space. That freed space is used for the agent's actual reasoning — longer chains of thought, more alternatives considered, better decisions.`}),(0,w.jsxs)(`div`,{className:`flex gap-4 pt-1.5 border-t border-border-subtle/50`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Graph lookups`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm`,children:JV(p.graph_calls)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Wasted turns prevented`}),(0,w.jsxs)(`p`,{className:`text-foreground font-mono text-sm`,children:[`~`,JV(p.turns_saved)]})]})]})]}),(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(`p`,{className:`text-fuchsia-400 font-medium uppercase tracking-wider text-[10px]`,children:`3. Surfaces past learnings`}),(0,w.jsx)(`p`,{className:`t-secondary leading-relaxed`,children:`Rules you've taught, conventions detected, and decisions from past sessions are surfaced at the exact moment the agent needs them — so the agent doesn't re-derive what it already learned, and doesn't repeat past mistakes.`}),(0,w.jsxs)(`div`,{className:`flex gap-4 pt-1.5 border-t border-border-subtle/50`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Notes surfaced`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm`,children:JV(p.facts_surfaced)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Rules applied`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm`,children:JV(p.conventions_surfaced)})]})]})]})]})]}),(()=>{let e=f.data?.data??[];if(e.length<2)return null;let t=Math.max(...e.map(e=>e.noise_removed_pct),1),n=Math.max(...e.map(e=>e.first_call_resolution_rate),1),r=Math.max(...e.map(e=>e.reasoning_quality_multiplier),1);return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-1`,children:`Reasoning improvement over time`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mb-3`,children:`Each bar is one session. Rising bars mean the agent is getting better at focusing, finding code, and avoiding mistakes.`}),(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,w.jsx)(`span`,{className:`text-emerald-400 text-[10px] uppercase tracking-wider font-medium`,children:`Cleaner focus`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Higher = less noise`})]}),(0,w.jsx)(`div`,{className:`flex gap-[2px]`,style:{height:`48px`},children:e.slice(-40).map(e=>{let n=t>0?Math.max(4,e.noise_removed_pct/t*100):4,r=new Date(e.first_ts).toLocaleDateString([],{month:`short`,day:`numeric`});return(0,w.jsxs)(`div`,{className:`group relative flex-1 min-w-[6px] max-w-[28px] h-full flex items-end`,children:[(0,w.jsx)(`div`,{className:`w-full bg-emerald-500 opacity-70 hover:opacity-100 rounded-t transition-all cursor-pointer`,style:{height:`${n}%`}}),(0,w.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none`,children:(0,w.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-700 rounded-lg px-3 py-2 text-xs whitespace-nowrap shadow-xl`,children:[(0,w.jsx)(`div`,{className:`font-medium text-foreground`,children:r}),(0,w.jsxs)(`div`,{className:`text-emerald-400`,children:[e.noise_removed_pct,`% noise removed`]})]})})]},e.session_id)})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,w.jsx)(`span`,{className:`text-cyan-400 text-[10px] uppercase tracking-wider font-medium`,children:`Found it first try`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Higher = fewer wasted turns`})]}),(0,w.jsx)(`div`,{className:`flex gap-[2px]`,style:{height:`48px`},children:e.slice(-40).map(e=>{let t=n>0?Math.max(4,e.first_call_resolution_rate/n*100):4,r=new Date(e.first_ts).toLocaleDateString([],{month:`short`,day:`numeric`});return(0,w.jsxs)(`div`,{className:`group relative flex-1 min-w-[6px] max-w-[28px] h-full flex items-end`,children:[(0,w.jsx)(`div`,{className:`w-full bg-cyan-500 opacity-70 hover:opacity-100 rounded-t transition-all cursor-pointer`,style:{height:`${t}%`}}),(0,w.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none`,children:(0,w.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-700 rounded-lg px-3 py-2 text-xs whitespace-nowrap shadow-xl`,children:[(0,w.jsx)(`div`,{className:`font-medium text-foreground`,children:r}),(0,w.jsxs)(`div`,{className:`text-cyan-400`,children:[e.first_call_resolution_rate,`% first try`]}),(0,w.jsxs)(`div`,{className:`t-secondary`,children:[`~`,e.turns_saved,` wasted turns prevented`]})]})})]},e.session_id)})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`flex items-center justify-between mb-1`,children:(0,w.jsx)(`span`,{className:`text-violet-400 text-[10px] uppercase tracking-wider font-medium`,children:`Overall reasoning improvement`})}),(0,w.jsx)(`div`,{className:`flex gap-[2px]`,style:{height:`48px`},children:e.slice(-40).map(e=>{let t=r>0?Math.max(4,e.reasoning_quality_multiplier/r*100):4,n=new Date(e.first_ts).toLocaleDateString([],{month:`short`,day:`numeric`});return(0,w.jsxs)(`div`,{className:`group relative flex-1 min-w-[6px] max-w-[28px] h-full flex items-end`,children:[(0,w.jsx)(`div`,{className:`w-full bg-violet-500 opacity-70 hover:opacity-100 rounded-t transition-all cursor-pointer`,style:{height:`${t}%`}}),(0,w.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none`,children:(0,w.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-700 rounded-lg px-3 py-2 text-xs whitespace-nowrap shadow-xl`,children:[(0,w.jsx)(`div`,{className:`font-medium text-foreground`,children:n}),(0,w.jsxs)(`div`,{className:`text-violet-400`,children:[e.reasoning_quality_multiplier,`x improvement`]})]})})]},e.session_id)})})]})]}),e.length>0&&(0,w.jsxs)(`div`,{className:`flex justify-between mt-2 pt-2 border-t border-border-subtle/50`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:new Date(e[Math.max(0,e.length-40)].first_ts).toLocaleDateString([],{month:`short`,day:`numeric`})}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px]`,children:[Math.min(40,e.length),` sessions shown`]}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:new Date(e[e.length-1].first_ts).toLocaleDateString([],{month:`short`,day:`numeric`})})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-4 mt-3 pt-3 border-t border-border-subtle/50`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-sm bg-emerald-500`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Cleaner focus`})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-sm bg-cyan-500`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Found first try`})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-sm bg-violet-500`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Overall improvement`})]})]})]})})(),p.memory_signals_fired>0&&(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-4 flex-wrap mb-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-fuchsia-400 text-xs font-medium uppercase tracking-wider`,children:`Your notes in action`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-1 max-w-lg`,children:`Every time unerr surfaces a past rule, convention, or session note, it tracks whether the agent actually used it. Here's how your accumulated knowledge performed.`})]}),p.memory_verdicts_total>0&&(0,w.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,w.jsxs)(`p`,{className:`text-fuchsia-400 font-mono font-bold text-3xl`,children:[p.memory_effectiveness_pct,`%`]}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wider mt-0.5`,children:`were load-bearing`})]})]}),p.memory_verdicts_total>0&&(()=>{let e=p.memory_verdicts_total,t=t=>t/e*100;return(0,w.jsxs)(`div`,{className:`mb-4`,children:[(0,w.jsx)(`div`,{className:`flex items-center justify-between mb-1.5`,children:(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px]`,children:[e,` note`,e===1?``:`s`,` surfaced and tracked`]})}),(0,w.jsxs)(`div`,{className:`flex h-3 rounded-full overflow-hidden bg-surface-secondary`,children:[p.verdicts_reinforced>0&&(0,w.jsx)(`div`,{className:`bg-emerald-500`,style:{width:`${t(p.verdicts_reinforced)}%`},title:`Confirmed existing rule: ${p.verdicts_reinforced}`}),p.verdicts_acted_on>0&&(0,w.jsx)(`div`,{className:`bg-fuchsia-500`,style:{width:`${t(p.verdicts_acted_on)}%`},title:`Changed the agent's approach: ${p.verdicts_acted_on}`}),p.verdicts_caught>0&&(0,w.jsx)(`div`,{className:`bg-cyan-500`,style:{width:`${t(p.verdicts_caught)}%`},title:`Prevented a mistake: ${p.verdicts_caught}`}),p.verdicts_ignored>0&&(0,w.jsx)(`div`,{className:`bg-zinc-600`,style:{width:`${t(p.verdicts_ignored)}%`},title:`Not used this time: ${p.verdicts_ignored}`}),p.verdicts_corrected>0&&(0,w.jsx)(`div`,{className:`bg-red-500`,style:{width:`${t(p.verdicts_corrected)}%`},title:`Note was outdated and corrected: ${p.verdicts_corrected}`})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-3 mt-2 text-[10px] t-tertiary`,children:[p.verdicts_reinforced>0&&(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm bg-emerald-500 mr-1`}),`Confirmed existing rule (`,p.verdicts_reinforced,`)`]}),p.verdicts_acted_on>0&&(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm bg-fuchsia-500 mr-1`}),`Changed approach (`,p.verdicts_acted_on,`)`]}),p.verdicts_caught>0&&(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm bg-cyan-500 mr-1`}),`Prevented mistake (`,p.verdicts_caught,`)`]}),p.verdicts_ignored>0&&(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm bg-zinc-600 mr-1`}),`Not used (`,p.verdicts_ignored,`)`]}),p.verdicts_corrected>0&&(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm bg-red-500 mr-1`}),`Outdated & corrected (`,p.verdicts_corrected,`)`]})]})]})})(),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 pt-3 border-t border-border-subtle/50`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px]`,children:`Rules you taught`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium mt-0.5`,children:JV(p.facts_recorded)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px]`,children:`Notes recalled`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium mt-0.5`,children:JV(p.facts_recalled)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px]`,children:`Conventions applied`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium mt-0.5`,children:JV(p.conventions_surfaced)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px]`,children:`Sessions resumed`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium mt-0.5`,children:JV(p.resume_hits)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px]`,children:`Anti-patterns warned`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium mt-0.5`,children:JV(p.negative_warnings)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px]`,children:`Total notes surfaced`}),(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium mt-0.5`,children:JV(p.facts_surfaced)})]})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg overflow-hidden`,children:[(0,w.jsxs)(`div`,{className:`px-5 py-3 border-b border-border-subtle flex items-center justify-between`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Sessions`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[h,` session`,h===1?``:`s`]})]}),m.length===0?(0,w.jsx)(`p`,{className:`px-5 py-6 t-secondary text-sm`,children:`No sessions yet.`}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-left text-sm min-w-[800px]`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle t-tertiary text-xs uppercase`,children:[(0,w.jsx)(`th`,{className:`px-5 py-2.5 font-medium`,children:`Session`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:`Agent`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:`Last Active`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-center`,title:`% of noise removed from context`,children:`Focus`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-center`,title:`% of lookups resolved in one call`,children:`First Try`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-center`,title:`Risky operations caught`,children:`Safety`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-center`,title:`% of surfaced notes that changed the outcome`,children:`Memory`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-right`,title:`Wasted turns avoided`,children:`Saved`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-right`,title:`Overall reasoning improvement`,children:`Quality`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 pr-5 font-medium w-16`})]})}),(0,w.jsx)(`tbody`,{children:m.map((t,n)=>(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle hover:bg-surface-secondary transition-colors cursor-pointer group`,onClick:()=>e(t.session_id),children:[(0,w.jsx)(`td`,{className:`px-5 py-3`,children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`font-mono text-xs text-foreground group-hover:text-violet-400 transition-colors`,children:t.session_id.slice(0,12)}),n===0&&o===0&&(0,w.jsx)(`span`,{className:`rounded-full bg-emerald-500/20 text-emerald-400 px-2 py-0.5 text-[10px] font-medium`,children:`latest`})]})}),(0,w.jsx)(`td`,{className:`px-3 py-3`,children:(0,w.jsx)(oL,{name:t.agent_name})}),(0,w.jsx)(`td`,{className:`px-3 py-3 t-secondary text-xs`,children:YV(t.last_ts)}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-center`,children:(0,w.jsx)(QV,{value:t.noise_removed_pct,label:`Noise removed`})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-center`,children:(0,w.jsx)(QV,{value:t.first_call_resolution_rate,label:`First-try resolution`})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-center`,children:(0,w.jsx)(`span`,{className:`text-amber-400 font-mono text-xs font-medium`,children:t.prevention_score})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-center`,children:t.memory_verdicts_total>0?(0,w.jsxs)(`span`,{className:`text-fuchsia-400 font-mono text-xs font-medium`,children:[t.memory_effectiveness_pct,`%`]}):t.memory_signals_fired>0?(0,w.jsxs)(`span`,{className:`t-tertiary font-mono text-xs`,children:[t.memory_signals_fired,` notes`]}):(0,w.jsx)(`span`,{className:`t-tertiary font-mono text-xs`,children:`—`})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,w.jsxs)(`span`,{className:`text-cyan-400 font-mono text-xs`,children:[`~`,t.turns_saved]})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,w.jsxs)(`span`,{className:`text-violet-400 font-mono font-medium text-sm`,children:[t.reasoning_quality_multiplier,`x`]})}),(0,w.jsx)(`td`,{className:`pl-4 py-3 pr-5 text-right w-16`,children:(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-violet-400 opacity-0 group-hover:opacity-100 transition-opacity font-medium whitespace-nowrap`,children:[`View`,` `,(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 5l7 7-7 7`})})]})})]},t.session_id))})]})}),(0,w.jsx)(`div`,{className:`px-5 py-2 border-t border-border-subtle`,children:(0,w.jsx)(qV,{total:h,limit:10,offset:o,onPageChange:c})})]})]})]})}function eH({sessionId:e}){let{url:t,queryKey:n}=Ot(),r=N({queryKey:n([`reasoning-quality-session`,e]),queryFn:()=>O(t(`/api/reasoning-quality/session?session_id=${e}`)),refetchInterval:5e3});if(r.isLoading)return(0,w.jsx)(Wt,{n:6});let i=r.data?.data;if(!i)return(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-8 text-center`,children:(0,w.jsxs)(`p`,{className:`t-secondary`,children:[`No data for session `,e.slice(0,12)]})});let a=i.trajectory??[],o=XV(i.reasoning_quality_multiplier);return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-5 border-l-4 border-violet-500/40`,children:(0,w.jsxs)(`div`,{className:`flex items-start justify-between gap-4 flex-wrap`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`text-foreground text-sm font-medium`,children:`Session reasoning quality`}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mt-1`,children:[`How well the agent reasoned across `,i.total_turns,` turn`,i.total_turns===1?``:`s`,` in this session.`]})]}),(0,w.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,w.jsxs)(`p`,{className:`text-violet-400 font-mono font-bold text-3xl`,children:[i.reasoning_quality_multiplier,`x`]}),(0,w.jsx)(`span`,{className:`inline-flex items-center rounded-full px-2.5 py-0.5 ${o.bg} ${o.color} text-[10px] font-medium mt-1`,children:o.text})]})]})}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 lg:grid-cols-4`,children:[(0,w.jsx)(ZV,{icon:`🔍`,color:`text-emerald-400`,borderColor:`border-emerald-500/60`,title:`Cleaner Focus`,value:`${i.noise_removed_pct}%`,subtitle:`noise removed`,detail:`${JV(i.entities_resolved)} entities served · ${i.attention_multiplier}x attention boost`}),(0,w.jsx)(ZV,{icon:`⚡`,color:`text-cyan-400`,borderColor:`border-cyan-500/60`,title:`Found First Try`,value:`${i.first_call_resolution_rate}%`,subtitle:`one-call resolution`,detail:`~${JV(i.turns_saved)} wasted turns prevented`}),(0,w.jsx)(ZV,{icon:`🛡️`,color:`text-amber-400`,borderColor:`border-amber-500/60`,title:`Mistakes Prevented`,value:i.prevention_score,subtitle:`risky operations caught`,detail:[i.blast_radius_warnings>0?`${i.blast_radius_warnings} high-impact edits flagged`:null,i.convention_injections>0?`${i.convention_injections} style rules applied`:null,i.circuit_breaker_activations>0?`${i.circuit_breaker_activations} loops stopped`:null].filter(Boolean).join(` · `)}),(0,w.jsx)(ZV,{icon:`🧠`,color:`text-fuchsia-400`,borderColor:`border-fuchsia-500/60`,title:`Lessons Remembered`,value:i.memory_verdicts_total>0?`${i.memory_effectiveness_pct}%`:i.memory_signals_fired>0?`${i.memory_signals_fired}`:`—`,unit:i.memory_verdicts_total>0?``:i.memory_signals_fired>0?` notes`:``,subtitle:i.memory_verdicts_total>0?`load-bearing`:i.memory_signals_fired>0?`notes surfaced`:`No notes surfaced`})]}),a.length>0&&(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-1`,children:`How context quality changed through the session`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mb-3`,children:`Each bar is one turn. Without unerr, this line typically drops as context fills up — a rising or flat line means the session stayed clean.`}),(0,w.jsx)(`div`,{className:`flex gap-[3px]`,style:{height:`120px`},children:a.slice(-60).map(e=>(0,w.jsxs)(`div`,{className:`group relative flex-1 min-w-[6px] max-w-[28px] h-full flex items-end`,children:[(0,w.jsx)(`div`,{className:`w-full bg-emerald-500 opacity-70 hover:opacity-100 rounded-t transition-all cursor-pointer`,style:{height:`${Math.max(4,e.cumulative_noise_removed_pct)}%`}}),(0,w.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none`,children:(0,w.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-700 rounded-lg px-3 py-2 text-xs whitespace-nowrap shadow-xl`,children:[(0,w.jsxs)(`div`,{className:`font-medium text-foreground`,children:[`Turn #`,e.turn]}),(0,w.jsxs)(`div`,{className:`text-emerald-400 mt-0.5`,children:[e.cumulative_noise_removed_pct,`% noise removed`]}),(0,w.jsxs)(`div`,{className:`text-cyan-400`,children:[e.graph_calls_this_turn,` graph lookup`,e.graph_calls_this_turn===1?``:`s`]}),e.context_density>0&&(0,w.jsxs)(`div`,{className:`t-secondary`,children:[e.context_density,` entities per 1K tokens`]})]})})]},e.turn))}),(0,w.jsxs)(`div`,{className:`flex justify-between mt-1.5`,children:[(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:[`Turn `,a.length>60?a.length-59:1]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:[`Turn `,a.length]})]}),(0,w.jsx)(`div`,{className:`flex items-center gap-4 mt-3 pt-3 border-t border-border-subtle/50`,children:(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-sm bg-emerald-500`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`Cumulative noise removed`})]})})]}),(0,w.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-3`,children:[(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`text-emerald-400 text-xs font-medium uppercase tracking-wider mb-4`,children:`Focus details`}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,children:`Noise removed`}),(0,w.jsxs)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:[i.noise_removed_pct,`%`]})]}),(0,w.jsx)(`div`,{className:`mt-1.5 h-2 bg-surface-secondary rounded-full overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full bg-emerald-500 rounded-full transition-all`,style:{width:`${Math.max(3,i.noise_removed_pct)}%`}})})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,title:`How many relevant code entities per 1K tokens delivered`,children:`Information density`}),(0,w.jsx)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:i.context_density})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,title:`Estimated improvement in LLM attention from noise removal`,children:`Attention improvement`}),(0,w.jsxs)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:[i.attention_multiplier,`x`]})]}),(0,w.jsxs)(`div`,{className:`pt-2 border-t border-border-subtle/50 space-y-1`,children:[(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`Code entities served`}),(0,w.jsx)(`span`,{className:`t-secondary font-mono text-xs`,children:JV(i.entities_resolved)})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`Tokens via graph`}),(0,w.jsx)(`span`,{className:`t-secondary font-mono text-xs`,children:JV(i.graph_tokens_delivered)})]})]})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`text-cyan-400 text-xs font-medium uppercase tracking-wider mb-4`,children:`Efficiency details`}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,children:`One-call resolution`}),(0,w.jsxs)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:[i.first_call_resolution_rate,`%`]})]}),(0,w.jsx)(`div`,{className:`mt-1.5 h-2 bg-surface-secondary rounded-full overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full bg-cyan-500 rounded-full transition-all`,style:{width:`${Math.max(3,i.first_call_resolution_rate)}%`}})})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,children:`Wasted turns prevented`}),(0,w.jsxs)(`span`,{className:`text-cyan-400 font-mono text-sm font-medium`,children:[`~`,JV(i.turns_saved)]})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,children:`Search loops stopped`}),(0,w.jsx)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:i.exploration_loops_prevented})]}),(0,w.jsxs)(`div`,{className:`pt-2 border-t border-border-subtle/50 space-y-1`,children:[(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`Graph lookups`}),(0,w.jsx)(`span`,{className:`t-secondary font-mono text-xs`,children:JV(i.graph_calls)})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`Total tool calls`}),(0,w.jsx)(`span`,{className:`t-secondary font-mono text-xs`,children:JV(i.total_tool_calls)})]})]})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`text-amber-400 text-xs font-medium uppercase tracking-wider mb-4`,children:`Safety details`}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,title:`High-impact edits where unerr showed all callers before the change`,children:`High-impact edits flagged`}),(0,w.jsx)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:i.blast_radius_warnings})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,title:`Project conventions automatically applied to prevent style violations`,children:`Style rules applied`}),(0,w.jsx)(`span`,{className:`text-foreground font-mono text-sm font-medium`,children:i.convention_injections})]}),(0,w.jsxs)(`div`,{className:`flex justify-between items-baseline`,children:[(0,w.jsx)(`span`,{className:`t-secondary text-xs`,title:`Agent was stuck in a retry loop — unerr broke it`,children:`Agent loops stopped`}),(0,w.jsx)(`span`,{className:`font-mono text-sm font-medium ${i.circuit_breaker_activations>0?`text-red-400`:`text-foreground`}`,children:i.circuit_breaker_activations})]}),(0,w.jsxs)(`div`,{className:`flex justify-between pt-2 border-t border-border-subtle/50`,children:[(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`Total safety score`}),(0,w.jsx)(`span`,{className:`text-amber-400 font-mono text-xs font-medium`,children:i.prevention_score})]})]})]})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4 flex flex-wrap items-center justify-center gap-x-6 gap-y-2 text-xs`,children:[(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`token-trace`,{session:e}),children:`See token savings in Token Trace →`}),(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`logbook`,{session:e}),children:`See full activity log →`})]})]})}function tH(){let e=S(`session`)||null,t=e?{level:`session`,sessionId:e}:{level:`global`},n=()=>x({session:null}),r=e=>x({session:e}),i=[];return t.level===`session`&&i.push({label:`All Sessions`,onClick:n},{label:`Session ${t.sessionId.slice(0,12)}`}),(0,w.jsxs)(`div`,{children:[i.length>0&&(0,w.jsx)(sL,{items:i}),t.level===`global`&&(0,w.jsx)($V,{onSelectSession:r}),t.level===`session`&&(0,w.jsx)(eH,{sessionId:t.sessionId})]})}function nH(e){return e>=1e4?`${(e/1e3).toFixed(1)}k`:e.toLocaleString()}function rH(e){let t=Date.now()-new Date(e).getTime();return t<6e4?`just now`:t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}function iH({breakdown:e,total:t}){if(t===0)return null;let n=e=>`${Math.round(e/t*100)}%`;return(0,w.jsxs)(`div`,{className:`flex h-3 rounded-full overflow-hidden bg-muted`,children:[e.executed>0&&(0,w.jsx)(`div`,{className:`bg-success transition-all`,style:{width:n(e.executed)},title:`Executed: ${e.executed}`}),e.softRefused>0&&(0,w.jsx)(`div`,{className:`bg-warning transition-all`,style:{width:n(e.softRefused)},title:`Soft Refused: ${e.softRefused}`}),e.passthroughDegraded>0&&(0,w.jsx)(`div`,{className:`bg-amber-600 transition-all`,style:{width:n(e.passthroughDegraded)},title:`Passthrough: ${e.passthroughDegraded}`}),e.childError>0&&(0,w.jsx)(`div`,{className:`bg-error transition-all`,style:{width:n(e.childError)},title:`Errors: ${e.childError}`})]})}function aH({session:e}){return(0,w.jsxs)(`div`,{className:`space-y-5`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:[(0,w.jsxs)(`div`,{className:`card p-4`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Calls`}),(0,w.jsx)(`div`,{className:`font-mono text-2xl font-semibold tabular-nums mt-1`,children:nH(e.totalCalls)})]}),(0,w.jsxs)(`div`,{className:`card p-4`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Tokens Saved`}),(0,w.jsx)(`div`,{className:`font-mono text-2xl font-semibold tabular-nums text-live mt-1`,children:nH(e.totalTokensSaved)}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[`of `,nH(e.totalTokensIn),` in`]})]}),(0,w.jsxs)(`div`,{className:`card p-4`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Avg Latency`}),(0,w.jsxs)(`div`,{className:`font-mono text-2xl font-semibold tabular-nums mt-1`,children:[e.avgLatencyMs.toFixed(1),(0,w.jsx)(`span`,{className:`text-sm t-tertiary ml-1`,children:`ms`})]})]}),(0,w.jsxs)(`div`,{className:`card p-4`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Efficiency`}),(0,w.jsxs)(`div`,{className:`font-mono text-2xl font-semibold tabular-nums text-live mt-1`,children:[Math.round(e.efficiency*100),`%`]})]})]}),(0,w.jsxs)(`div`,{className:`card p-4 space-y-3`,children:[(0,w.jsx)(`h4`,{className:`font-semibold`,children:`Outcome Breakdown`}),(0,w.jsx)(iH,{breakdown:e.outcomeBreakdown,total:e.totalCalls}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-4 text-sm`,children:[(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-success`}),`Executed: `,e.outcomeBreakdown.executed]}),(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-warning`}),`Soft Refused: `,e.outcomeBreakdown.softRefused]}),e.outcomeBreakdown.passthroughDegraded>0&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-amber-600`}),`Passthrough: `,e.outcomeBreakdown.passthroughDegraded]}),e.outcomeBreakdown.childError>0&&(0,w.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-error`}),`Errors: `,e.outcomeBreakdown.childError]})]})]}),e.topTools.length>0&&(0,w.jsxs)(`div`,{className:`card`,children:[(0,w.jsx)(`div`,{className:`p-4 border-b border-border-subtle`,children:(0,w.jsx)(`h4`,{className:`font-semibold`,children:`Top Tools`})}),(0,w.jsx)(`div`,{className:`divide-y divide-border-subtle`,children:e.topTools.map(t=>{let n=e.totalCalls>0?Math.round(t.count/e.totalCalls*100):0;return(0,w.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2.5`,children:[(0,w.jsx)(`span`,{className:`font-mono text-sm`,children:t.name}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`div`,{className:`w-24 h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${n}%`}})}),(0,w.jsx)(`span`,{className:`tabular-nums text-sm w-8 text-right`,children:t.count})]})]},t.name)})})]})]})}function oH(){let{url:e,queryKey:t}=Ot(),[n,r]=(0,f.useState)(null),i=N({queryKey:t([`router`,`sessions`]),queryFn:()=>O(e(`/api/router/sessions`)),refetchInterval:1e4});if(i.isLoading)return(0,w.jsx)(Wt,{});let a=i.data?.data?.sessions??[];if(a.length===0)return(0,w.jsxs)(`div`,{className:`card p-8 text-center`,children:[(0,w.jsx)(`div`,{className:`text-4xl mb-4`,children:`📊`}),(0,w.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`No Sessions Yet`}),(0,w.jsx)(`p`,{className:`t-secondary max-w-md mx-auto`,children:`Session metrics will appear here once the router processes tool calls. Make sure the router is enabled and your IDE is connected.`})]});let o=n?a.find(e=>e.sessionId===n)??a[0]:a[0];return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,w.jsxs)(`span`,{className:`t-secondary text-sm`,children:[a.length,` session`,a.length===1?``:`s`]})}),(0,w.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[280px_1fr]`,children:[(0,w.jsx)(`div`,{className:`card divide-y divide-border-subtle overflow-hidden`,children:a.map(e=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>r(e.sessionId),className:`w-full px-4 py-3 text-left transition-colors ${o?.sessionId===e.sessionId?`bg-accent/10 border-l-2 border-accent`:`hover:bg-muted/50 border-l-2 border-transparent`}`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`span`,{className:`font-mono text-xs truncate max-w-[140px]`,children:[e.sessionId.slice(0,12),`…`]}),(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:rH(e.lastCallTs)})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 mt-1 text-xs t-secondary`,children:[(0,w.jsxs)(`span`,{children:[e.totalCalls,` calls`]}),(0,w.jsxs)(`span`,{className:`text-success`,children:[`+`,nH(e.totalTokensSaved),` tok`]})]})]},e.sessionId))}),o&&(0,w.jsx)(aH,{session:o})]})]})}function sH(e){if(!Number.isFinite(e))return`—`;let t=e<0?`-`:``,n=Math.abs(e);if(n<1e3)return`${t}${Math.round(n).toLocaleString()}`;let r=[`K`,`M`,`B`,`T`],i=-1;do n/=1e3,i++;while(n>=999.95&&i<r.length-1);return`${t}${n.toFixed(1).replace(/\.0$/,``)}${r[i]}`}function cH(e){let t=Date.now()-new Date(e).getTime(),n=Math.round(t/1e3);if(n<60)return`${n}s ago`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function lH(e,t=850){let[n,r]=(0,f.useState)(0),i=(0,f.useRef)(0);return(0,f.useEffect)(()=>{let n=i.current,a=performance.now(),o=0,s=c=>{let l=Math.min(1,(c-a)/t),u=1-(1-l)**3;r(n+(e-n)*u),l<1?o=requestAnimationFrame(s):i.current=e};return o=requestAnimationFrame(s),()=>cancelAnimationFrame(o)},[e,t]),n}function uH({value:e}){return(0,w.jsx)(w.Fragment,{children:sH(lH(e))})}function dH({label:e,value:t,accent:n,hint:r}){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:e}),(0,w.jsx)(`span`,{className:`font-mono text-2xl font-semibold tabular-nums ${n}`,children:(0,w.jsx)(uH,{value:t})}),r?(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:r}):null]})}function fH({segments:e}){let t=e.reduce((e,t)=>e+t.value,0)||1;return(0,w.jsx)(`div`,{className:`flex h-2.5 w-full overflow-hidden rounded-full bg-surface-overlay`,children:e.map(e=>e.value>0?(0,w.jsx)(`div`,{className:e.cls,style:{width:`${e.value/t*100}%`},title:`${e.label}: ${e.value}`},e.label):null)})}function pH({outcome:e}){return(0,w.jsx)(`span`,{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${e===`executed`?`bg-success/15 text-success`:e===`soft_refused`?`bg-warning/15 text-warning`:`bg-error/15 text-error`}`,children:e.replace(/_/g,` `)})}function mH(){let{url:e,queryKey:t}=Ot(),n=N({queryKey:t([`router`,`status`]),queryFn:()=>O(e(`/api/router/status`)),refetchInterval:5e3}),r=N({queryKey:t([`router`,`sessions`]),queryFn:()=>O(e(`/api/router/sessions`)),refetchInterval:15e3,enabled:n.data?.data?.enabled===!0}),i=N({queryKey:t([`router`,`recent`]),queryFn:()=>O(e(`/api/router/recent?limit=100`)),refetchInterval:4e3,enabled:n.data?.data?.enabled===!0}),a=r.data?.data?.sessions??[],o=i.data?.data?.records??[],s=(0,f.useMemo)(()=>{let e={calls:0,saved:0,tokensIn:0,refused:0,unlocks:0,latencySum:0,days:new Set};for(let t of a)e.calls+=t.totalCalls,e.saved+=t.totalTokensSaved,e.tokensIn+=t.totalTokensIn,e.refused+=t.softRefuseCount,e.unlocks+=t.unlockCount,e.latencySum+=t.avgLatencyMs*t.totalCalls,e.days.add(t.lastCallTs.slice(0,10));return{...e,avgLatency:e.calls>0?e.latencySum/e.calls:0,sessionCount:a.length,dayCount:e.days.size}},[a]),c=(0,f.useMemo)(()=>{let e=new Map;for(let t of o){let n=t.server??`unerr`,r=e.get(n);r||(r={server:n,calls:0,saved:0,refused:0,latencySum:0,tools:new Set},e.set(n,r)),r.calls++,r.saved+=t.tokensSaved,t.outcome===`soft_refused`&&r.refused++,r.latencySum+=t.latencyMs.total,r.tools.add(t.originalToolName??t.toolName)}return[...e.values()].sort((e,t)=>t.calls-e.calls)},[o]),l=(0,f.useMemo)(()=>{let e=new Map;for(let t of a)for(let n of t.topTools)e.set(n.name,(e.get(n.name)??0)+n.count);let t=[...e.entries()].sort((e,t)=>t[1]-e[1]).slice(0,8).map(([e,t])=>({name:e,count:t}));return{arr:t,max:t[0]?.count??1}},[a]),u=(0,f.useMemo)(()=>{let e=new Map;for(let t of a){let n=t.lastCallTs.slice(0,10),r=e.get(n)??{calls:0,saved:0};r.calls+=t.totalCalls,r.saved+=t.totalTokensSaved,e.set(n,r)}let t=[...e.entries()].sort((e,t)=>e[0].localeCompare(t[0])).slice(-14).map(([e,t])=>({day:e,...t}));return{arr:t,max:Math.max(1,...t.map(e=>e.calls))}},[a]),d=(0,f.useMemo)(()=>{let e={executed:0,softRefused:0,degraded:0,error:0};for(let t of a)e.executed+=t.outcomeBreakdown.executed,e.softRefused+=t.outcomeBreakdown.softRefused,e.degraded+=t.outcomeBreakdown.passthroughDegraded,e.error+=t.outcomeBreakdown.childError;return e},[a]);if(n.isLoading)return(0,w.jsx)(Wt,{});let p=n.data?.data;if(!p)return(0,w.jsx)(Wt,{});if(!p.enabled)return(0,w.jsxs)(`div`,{className:`card p-8 text-center`,children:[(0,w.jsx)(`div`,{className:`mb-4 text-4xl`,children:`⏸`}),(0,w.jsx)(`h2`,{className:`mb-2 text-xl font-semibold`,children:`MCP Router is idle`}),(0,w.jsx)(`p`,{className:`t-secondary mx-auto max-w-md`,children:`The gateway records every tool dispatch the moment your agent connects. If you are seeing this, no session has routed a call yet — run a tool and it will light up.`})]});let m=p.session,h=Math.max(c.length,1),g=s.calls>0?s.calls:m?.totalCalls??0,_=s.saved>0?s.saved:m?.totalTokensSaved??0,v=s.refused>0?s.refused:m?.softRefuseCount??0,y=s.unlocks>0?s.unlocks:m?.unlockCount??0;return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,w.jsx)(`div`,{children:(0,w.jsxs)(`p`,{className:`t-secondary text-sm`,children:[`One endpoint in front of`,` `,(0,w.jsx)(`span`,{className:`font-mono text-foreground-emphasis`,children:h}),` `,`MCP server`,h===1?``:`s`,` ·`,` `,s.dayCount>0?`${s.dayCount}-day`:`live`,` history`]})}),(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-success/15 px-3 py-1 text-sm font-medium text-success`,children:[(0,w.jsx)(`span`,{className:`h-2 w-2 animate-pulse rounded-full bg-success shadow-[0_0_6px_rgba(52,211,153,0.7)]`}),`Routing live`]})]}),(0,w.jsx)(`section`,{className:`glass-panel rounded-xl p-6`,children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 sm:flex-row sm:items-center`,children:[(0,w.jsxs)(`div`,{className:`sm:w-72`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Tool calls routed`}),(0,w.jsx)(`div`,{className:`mt-1 font-mono text-6xl font-semibold leading-none tabular-nums text-foreground-emphasis`,children:(0,w.jsx)(uH,{value:g})}),(0,w.jsx)(`p`,{className:`t-tertiary mt-2 text-xs`,children:`every call your agent made — classified, gated, and forwarded in under 5\xA0ms each`})]}),(0,w.jsxs)(`div`,{className:`grid flex-1 grid-cols-2 gap-x-6 gap-y-5 border-t border-border-subtle pt-5 sm:grid-cols-3 sm:border-l sm:border-t-0 sm:pl-6 sm:pt-0`,children:[(0,w.jsx)(dH,{label:`Tokens saved`,value:_,accent:`text-emerald-400`,hint:`of ${sH(s.tokensIn||(m?.totalTokensIn??0))} seen`}),(0,w.jsx)(dH,{label:`Wasteful calls blocked`,value:v,accent:`text-amber-400`,hint:`soft-refused before forwarding`}),(0,w.jsx)(dH,{label:`Tools unlocked`,value:y,accent:`text-cyan-400`,hint:`surfaced as your pattern earned them`}),(0,w.jsx)(dH,{label:`Avg latency`,value:Math.round(s.avgLatency||0),accent:`text-foreground-emphasis`,hint:`ms per routed call`}),(0,w.jsx)(dH,{label:`Sessions`,value:s.sessionCount,accent:`text-foreground-emphasis`,hint:`over ${s.dayCount} day${s.dayCount===1?``:`s`}`}),(0,w.jsx)(dH,{label:`Servers`,value:h,accent:`text-fuchsia-400`,hint:`on the bus`})]})]})}),(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Servers on the bus`}),(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`last 100 calls`})]}),(0,w.jsxs)(`p`,{className:`t-tertiary mb-4 text-xs`,children:[`Each MCP server routed through this endpoint, with the traffic it drove. Connect more with`,` `,(0,w.jsx)(`code`,{className:`rounded bg-surface-overlay px-1 py-0.5 font-mono text-[11px]`,children:`unerr enable mcp-router`}),` `,`and they appear here automatically.`]}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[c.map(e=>(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle bg-surface-overlay/40 p-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-success shadow-[0_0_4px_rgba(52,211,153,0.6)]`}),(0,w.jsx)(`span`,{className:`font-medium`,children:e.server}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[e.tools.size,` tool`,e.tools.size===1?``:`s`]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-4 text-sm tabular-nums`,children:[(0,w.jsxs)(`span`,{className:`font-mono`,children:[sH(e.calls),` calls`]}),(0,w.jsxs)(`span`,{className:`font-mono text-emerald-400`,children:[`+`,sH(e.saved),` tok`]}),(0,w.jsxs)(`span`,{className:`font-mono t-tertiary`,children:[Math.round(e.latencySum/Math.max(1,e.calls)),`ms`]})]})]}),(0,w.jsx)(`div`,{className:`mt-2`,children:(0,w.jsx)(fH,{segments:[{value:e.calls-e.refused,cls:`bg-success`,label:`executed`},{value:e.refused,cls:`bg-warning`,label:`soft-refused`}]})})]},e.server)),(0,w.jsx)(`div`,{className:`rounded-lg border border-dashed border-border-subtle p-3 text-center`,children:(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:`+ your other MCP servers land here once consolidated`})})]})]}),(0,w.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Routing outcomes`}),(0,w.jsx)(`p`,{className:`t-tertiary mb-4 mt-1 text-xs`,children:`What the gateway did with each call it saw.`}),(()=>{let e=d.executed+d.softRefused+d.degraded+d.error||1,t=t=>Math.round(t/e*100);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(fH,{segments:[{value:d.executed,cls:`bg-success`,label:`executed`},{value:d.softRefused,cls:`bg-warning`,label:`soft-refused`},{value:d.degraded,cls:`bg-cyan-500`,label:`degraded`},{value:d.error,cls:`bg-error`,label:`error`}]}),(0,w.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-x-4 gap-y-2 text-sm`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`Executed`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-success`,children:[d.executed,` · `,t(d.executed),`%`]})]}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`Soft-refused`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums text-warning`,children:[d.softRefused,` ·`,` `,t(d.softRefused),`%`]})]}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`Degraded`}),(0,w.jsx)(`span`,{className:`font-mono tabular-nums t-tertiary`,children:d.degraded})]}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(`span`,{className:`t-secondary`,children:`Errors`}),(0,w.jsx)(`span`,{className:`font-mono tabular-nums t-tertiary`,children:d.error})]})]}),d.softRefused>0&&(0,w.jsxs)(`div`,{className:`mt-4 rounded-lg border border-warning/30 bg-warning/10 p-3 text-sm`,children:[(0,w.jsxs)(`span`,{className:`font-medium text-warning`,children:[d.softRefused,` wasteful call`,d.softRefused===1?``:`s`,` blocked`]}),(0,w.jsxs)(`span`,{className:`t-secondary`,children:[` `,`— the router refused redundant or low-value calls before they spent tokens.`]})]})]})})()]}),(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Most-routed tools`}),(0,w.jsx)(`p`,{className:`t-tertiary mb-4 mt-1 text-xs`,children:`Where your agent's traffic actually goes.`}),(0,w.jsxs)(`div`,{className:`space-y-2.5`,children:[l.arr.map(e=>(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`span`,{className:`w-40 truncate font-mono text-xs`,children:e.name}),(0,w.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-surface-overlay`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full bg-cyan-400/80`,style:{width:`${e.count/l.max*100}%`}})}),(0,w.jsx)(`span`,{className:`w-10 text-right font-mono text-xs tabular-nums t-secondary`,children:e.count})]},e.name)),l.arr.length===0&&(0,w.jsx)(`p`,{className:`t-tertiary text-sm`,children:`No tool calls recorded yet.`})]})]})]}),u.arr.length>1&&(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Routing volume by day`}),(0,w.jsx)(`div`,{className:`mt-4 flex items-end gap-2`,style:{height:96},children:u.arr.map(e=>(0,w.jsxs)(`div`,{className:`group flex flex-1 flex-col items-center justify-end gap-1`,title:`${e.day}: ${e.calls} calls · +${sH(e.saved)} tokens`,children:[(0,w.jsx)(`span`,{className:`font-mono text-[10px] tabular-nums t-tertiary opacity-0 transition-opacity group-hover:opacity-100`,children:e.calls}),(0,w.jsx)(`div`,{className:`w-full rounded-t bg-fuchsia-500/60 transition-all group-hover:bg-fuchsia-400`,style:{height:`${e.calls/u.max*76}px`}}),(0,w.jsx)(`span`,{className:`font-mono text-[10px] t-tertiary`,children:e.day.slice(5)})]},e.day))})]}),o.length>0&&(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-subtle p-4`,children:[(0,w.jsx)(`span`,{className:`section-label`,children:`Live call feed`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[o.length,` most recent`]})]}),(0,w.jsx)(`div`,{className:`max-h-96 overflow-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,w.jsx)(`thead`,{className:`sticky top-0 bg-surface-overlay/80 backdrop-blur`,children:(0,w.jsxs)(`tr`,{className:`t-tertiary`,children:[(0,w.jsx)(`th`,{className:`px-4 py-2 text-left font-medium`,children:`Tool`}),(0,w.jsx)(`th`,{className:`px-4 py-2 text-left font-medium`,children:`Server`}),(0,w.jsx)(`th`,{className:`px-4 py-2 text-left font-medium`,children:`Outcome`}),(0,w.jsx)(`th`,{className:`px-4 py-2 text-right font-medium`,children:`Saved`}),(0,w.jsx)(`th`,{className:`px-4 py-2 text-right font-medium`,children:`Latency`}),(0,w.jsx)(`th`,{className:`px-4 py-2 text-right font-medium`,children:`When`})]})}),(0,w.jsx)(`tbody`,{className:`divide-y divide-border-subtle`,children:o.slice().reverse().map((e,t)=>(0,w.jsxs)(`tr`,{className:`hover:bg-surface-overlay/40`,children:[(0,w.jsxs)(`td`,{className:`px-4 py-2 font-mono text-xs`,children:[e.toolName,e.wasMasked&&(0,w.jsx)(`span`,{className:`ml-1.5 inline-flex items-center rounded-full border border-zinc-700 bg-zinc-800 px-1.5 py-0.5 text-[9px] font-medium text-zinc-400`,children:`masked`})]}),(0,w.jsx)(`td`,{className:`px-4 py-2 t-tertiary text-xs`,children:e.server??`unerr`}),(0,w.jsx)(`td`,{className:`px-4 py-2`,children:(0,w.jsx)(pH,{outcome:e.outcome})}),(0,w.jsx)(`td`,{className:`px-4 py-2 text-right tabular-nums text-emerald-400`,children:e.tokensSaved>0?`+${e.tokensSaved}`:`—`}),(0,w.jsxs)(`td`,{className:`px-4 py-2 text-right tabular-nums t-tertiary`,children:[e.latencyMs.total.toFixed(0),`ms`]}),(0,w.jsx)(`td`,{className:`px-4 py-2 text-right tabular-nums t-tertiary`,children:cH(e.ts)})]},`${e.ts}-${t}`))})]})})]})]})}var hH={page:1,perPage:15,density:`comfortable`},gH=new Set([`comfortable`,`compact`]);function _H(){if(typeof window>`u`)return{...hH};let e=window.location.hash.replace(/^#/,``),t=e.indexOf(`?`);if(t===-1)return{...hH};let n=new URLSearchParams(e.slice(t+1)),r={...hH},i=Number(n.get(`from`));Number.isFinite(i)&&i>0&&(r.from=i);let a=Number(n.get(`to`));Number.isFinite(a)&&a>0&&(r.to=a);let o=n.get(`session`);o&&o.length>0&&(r.session=o);let s=n.get(`agent`);s&&s.length>0&&(r.agent=s);let c=n.get(`type`);c&&c.length>0&&(r.type=c);let l=n.get(`q`);l&&l.length>0&&(r.q=l);let u=Number(n.get(`page`));Number.isInteger(u)&&u>0&&(r.page=u);let d=Number(n.get(`perPage`));Number.isInteger(d)&&d>0&&d<=200&&(r.perPage=d);let f=n.get(`density`);return f&&gH.has(f)&&(r.density=f),r}function vH(e){let t=new URLSearchParams;e.from!==void 0&&t.set(`from`,String(e.from)),e.to!==void 0&&t.set(`to`,String(e.to)),e.session&&t.set(`session`,e.session),e.agent&&t.set(`agent`,e.agent),e.type&&t.set(`type`,e.type),e.q&&t.set(`q`,e.q),e.page!==hH.page&&t.set(`page`,String(e.page)),e.perPage!==hH.perPage&&t.set(`perPage`,String(e.perPage)),e.density!==hH.density&&t.set(`density`,e.density);let n=t.toString();return n.length>0?`?${n}`:``}var yH=``,bH=_H();function xH(){if(typeof window>`u`)return bH;let e=window.location.hash;return e!==yH&&(yH=e,bH=_H()),bH}function SH(e){return typeof window>`u`?()=>{}:(window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e))}function CH(){let e=(0,f.useSyncExternalStore)(SH,xH,xH),t=(0,f.useCallback)(e=>{if(typeof window>`u`)return;let t=`#${window.location.hash.replace(/^#/,``).split(`?`)[0]||`/activity`}${vH(e)}`;window.location.hash!==t&&(window.history.replaceState(null,``,t),window.dispatchEvent(new HashChangeEvent(`hashchange`)))},[]),n=(0,f.useCallback)(n=>{let r={...e,...n},i=`page`in n,a=Object.keys(n).every(e=>e===`density`);!i&&!a&&(r.page=1),t(r)},[e,t]),r=(0,f.useCallback)(()=>{t({...hH})},[t]);return(0,f.useEffect)(()=>{yH=``},[]),{filters:e,setFilters:n,clear:r}}function wH(e){let t=[];return(e.from!==void 0||e.to!==void 0)&&t.push({key:`from`,label:EH(e.from,e.to)}),e.session&&t.push({key:`session`,label:`Session ${e.session.slice(0,8)}`}),e.agent&&t.push({key:`agent`,label:`Agent: ${e.agent}`}),e.type&&t.push({key:`type`,label:TH(e.type)}),e.q&&t.push({key:`q`,label:`“${e.q}”`}),t}function TH(e){switch(e){case`mark_intent`:return`🎯 Goals only`;case`mark_decision`:return`💡 Decisions only`;case`mark_blocker`:return`⚠ Stuck moments only`;case`mark_resolution`:return`✅ Solutions only`;default:return e}}function EH(e,t){return e&&t?`${DH(e)} → ${DH(t)}`:e?`Since ${DH(e)}`:t?`Until ${DH(t)}`:`All time`}function DH(e){return new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function OH(e,t){if(!Number.isFinite(t)||e.length===0)return null;let n=e.find(e=>e.started_at<=t&&t<=e.ended_at);return n?n.turn_id:e.filter(e=>e.started_at<=t).sort((e,t)=>t.started_at-e.started_at)[0]?.turn_id??null}function kH(e,t=Date.now()){if(e===`all`)return{};let n=1440*6e4;if(e===`today`){let e=new Date(t);return e.setHours(0,0,0,0),{from:e.getTime(),to:t}}return e===`7d`?{from:t-7*n,to:t}:e===`30d`?{from:t-30*n,to:t}:{}}var AH=[{value:``,label:`All notes`,emoji:`▣`,color:`text-zinc-300`},{value:`mark_intent`,label:`Goals`,emoji:`🎯`,color:`text-violet-300`},{value:`mark_decision`,label:`Decisions`,emoji:`💡`,color:`text-cyan-300`},{value:`mark_blocker`,label:`Stuck moments`,emoji:`⚠`,color:`text-rose-300`},{value:`mark_resolution`,label:`Solutions`,emoji:`✅`,color:`text-emerald-300`}];function jH(e){return AH.find(t=>t.value===e)??{value:e,label:e,emoji:`•`,color:`text-zinc-300`}}function MH(e){if(!Number.isFinite(e)||e<=0)return`—`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m ${t%60}s`:`${Math.floor(n/60)}h ${n%60}m`}function NH(e){return!Number.isFinite(e)||e<=0?`—`:new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function PH(e){return!Number.isFinite(e)||e<=0?`—`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function FH(e){return!Number.isFinite(e)||e<=0?`—`:new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function IH(e){if(!Number.isFinite(e)||e<=0)return`just now`;let t=Math.round(e/1e3);if(t<60)return`${t}s ago`;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 LH(e){if(!e)return``;let t=new Date(e).getTimezoneOffset()*6e4;return new Date(e-t).toISOString().slice(0,10)}function RH(e,t=!1){if(!e)return;let n=Date.parse(e);if(Number.isFinite(n))return t?n+1440*6e4-1:n}function zH(e){let t={},n=e.match(/What:\s*([^.]+?)(?:\.|$)/i);n&&(t.what=n[1].trim());let r=e.match(/Why:\s*([^.]+?)(?:\.|$)/i);r&&(t.why=r[1].trim());let i=e.match(/How:\s*([^.]+?)(?:\.|$)/i);return i&&(t.how=i[1].trim()),t}function BH(){let{url:e,queryKey:t}=Ot(),{filters:n,setFilters:r,clear:i}=CH(),[a,o]=(0,f.useState)(null),[s,c]=(0,f.useState)(null),{data:l,error:u}=N({queryKey:t([`timeline`,`health`]),queryFn:()=>O(e(`/api/timeline/health`)),staleTime:3e4,retry:!1}),d=!!l?.data?.ok&&!u,p=(0,f.useMemo)(()=>pU(n),[n]),{data:m,isFetching:h}=N({queryKey:t([`timeline`,`turns`,p]),queryFn:()=>O(e(`/api/timeline/turns?${p}`)),staleTime:1e4,enabled:d}),g=m?.data??[],_=m?.total??0,v=Math.max(1,Math.ceil(_/n.perPage)),y=(0,f.useMemo)(()=>{let e=new URLSearchParams;return n.session&&e.set(`session_id`,n.session),n.type&&e.set(`type`,n.type),e.set(`limit`,`500`),e.toString()},[n.session,n.type]),{data:b}=N({queryKey:t([`timeline`,`markers`,y]),queryFn:()=>O(e(`/api/timeline/markers?${y}`)),staleTime:1e4,enabled:d}),C=b?.data??[],T=(0,f.useMemo)(()=>mU(C),[C]),{data:E}=N({queryKey:t([`timeline`,`sessions`]),queryFn:()=>O(e(`/api/timeline/sessions?limit=200`)),staleTime:3e4,enabled:d}),ee=E?.data??[],{data:te}=N({queryKey:t([`timeline`,`agents`]),queryFn:()=>O(e(`/api/timeline/agents`)),staleTime:6e4,enabled:d}),D=te?.data??[],{data:ne}=N({queryKey:t([`timeline`,`heatmap`]),queryFn:()=>O(e(`/api/timeline/heatmap?days=30`)),staleTime:6e4,enabled:d}),{data:re}=N({queryKey:t([`timeline`,`resume`]),queryFn:()=>O(e(`/api/timeline/resume`)),staleTime:15e3,enabled:d}),ie=re?.data??null,{data:k}=N({queryKey:t([`timeline`,`intents`]),queryFn:()=>O(e(`/api/timeline/intents?limit=10`)),staleTime:3e4,enabled:d}),A=k?.data??[],{data:ae}=N({queryKey:t([`facts`,`episodic`]),queryFn:()=>O(e(`/api/facts?type=episodic&limit=50`)),staleTime:3e4,retry:!1}),j=ae?.data??[],M=(0,f.useMemo)(()=>{let e=new Map;for(let t of j){let n=e.get(t.scope)??[];n.push(t),e.set(t.scope,n)}return e},[j]),oe=(0,f.useMemo)(()=>n.agent?ee.filter(e=>e.agent_name===n.agent):ee,[ee,n.agent]);(0,f.useEffect)(()=>{if(!a)return;let e=e=>{e.key===`Escape`&&o(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]);let se=S(`anchor_ts`),ce=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!se||g.length===0||ce.current===se)return;ce.current=se;let e=OH(g,Number(se));e&&o(e),x({anchor_ts:null})},[se,g]);let le=s===null?_<=3:s;if(u||!d)return(0,w.jsx)(VH,{});let ue=wH(n),de=a?g.find(e=>e.turn_id===a)??null:null,fe=a?T.get(a)??[]:[];return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[le&&(0,w.jsx)(HH,{onDismiss:()=>c(!1)}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-6 border-l-4 border-violet-500/60`,children:[(0,w.jsx)(`h2`,{className:`text-foreground font-semibold text-base`,children:`What has your agent been doing?`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-1 max-w-xl leading-relaxed`,children:`A complete timeline of every task your AI agent worked on — what it tried, what decisions it made, and where it got stuck. Think of it as the commit history for your agent's reasoning.`})]}),(0,w.jsx)(UH,{activityCount:_,sessionCount:ee.length,taskCount:A.filter(e=>e.status===`active`).length,unresolvedCount:ie?.open_threads.length??0}),(0,w.jsx)(KH,{filters:n,sessions:oe,agents:D,chips:ue,onChange:r,onClear:i,isFetching:h}),ie&&(0,w.jsx)(ZH,{resume:ie}),(0,w.jsxs)(`div`,{className:`space-y-5`,children:[ne&&ne.data.length>0&&(0,w.jsx)(QH,{buckets:ne.data,filters:n,onDayClick:e=>{r({from:e,to:e+1440*6e4-1})}}),A.length>0&&(0,w.jsx)(tU,{intents:A}),(0,w.jsx)(nU,{turns:g,markersByTurn:T,filters:n,totalTurns:_,totalPages:v,onPageChange:e=>r({page:e}),onTurnClick:e=>o(e),selectedTurnId:a,isFetching:h})]}),de&&(0,w.jsx)(cU,{turn:de,markers:fe,episodicByFile:M,onClose:()=>o(null)})]})}function VH(){return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-l-4 border-amber-500/60`,children:[(0,w.jsx)(`div`,{className:`text-amber-400 text-[10px] uppercase tracking-wider font-medium`,children:`Activity tracking isn't active`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-2 leading-relaxed`,children:`unerr records your agent's activity while it's running. Restart unerr and reload this page to see the timeline.`})]})}function HH({onDismiss:e}){return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-l-4 border-violet-500/60 relative`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:e,className:`absolute top-3 right-3 t-tertiary hover:text-foreground text-xs px-2 py-0.5`,"aria-label":`Dismiss explainer`,children:`✕`}),(0,w.jsx)(`h3`,{className:`text-violet-400 text-[10px] uppercase tracking-wider font-medium`,children:`How to read this page`}),(0,w.jsxs)(`ul`,{className:`t-secondary text-xs space-y-1.5 leading-relaxed mt-2 max-w-2xl`,children:[(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`strong`,{className:`text-foreground`,children:`Each row is one task`}),` your agent worked on — it could be a bug fix, a refactor, a feature, or an exploration. Click any row to see the full details.`]}),(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`strong`,{className:`text-foreground`,children:`Goals, decisions, and problems`}),` `,`are tracked automatically as your agent works, turning raw actions into a readable story.`]}),(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`strong`,{className:`text-foreground`,children:`Use the filters`}),` to narrow down to a specific day, session, agent, or keyword. Share the URL to show someone exactly what your agent did.`]})]}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-3`,children:`The more your agent uses unerr, the richer this timeline becomes — you'll see task titles, decisions made, and problems encountered.`})]})}function UH({activityCount:e,sessionCount:t,taskCount:n,unresolvedCount:r}){return(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,w.jsx)(GH,{label:`Agent actions`,sublabel:`distinct tasks the agent worked on`,value:e,accent:`cyan`}),(0,w.jsx)(GH,{label:`Sessions`,sublabel:`separate conversations with your agent`,value:t,accent:`emerald`}),(0,w.jsx)(GH,{label:`Active tasks`,sublabel:`goals the agent is currently tracking`,value:n,accent:`violet`}),(0,w.jsx)(GH,{label:`Unresolved`,sublabel:r>0?`problems flagged but not yet fixed`:`all clear — nothing stuck`,value:r,accent:r>0?`rose`:`zinc`})]})}var WH={cyan:{border:`border-cyan-500/60`,label:`text-cyan-400`,value:`text-cyan-400`},emerald:{border:`border-emerald-500/60`,label:`text-emerald-400`,value:`text-emerald-400`},violet:{border:`border-violet-500/60`,label:`text-violet-400`,value:`text-violet-400`},rose:{border:`border-rose-500/60`,label:`text-rose-400`,value:`text-rose-400`},zinc:{border:`border-border-subtle`,label:`t-tertiary`,value:`text-foreground`}};function GH({label:e,sublabel:t,value:n,accent:r=`zinc`}){let i=WH[r];return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-t-2 ${i.border}`,title:t,children:[(0,w.jsx)(`p`,{className:`${i.label} text-[10px] uppercase tracking-wider font-medium`,children:e}),(0,w.jsx)(`p`,{className:`text-3xl font-bold font-mono ${i.value} mt-2`,children:n.toLocaleString()}),(0,w.jsx)(`p`,{className:`t-secondary text-xs mt-1`,children:t})]})}function KH({filters:e,sessions:t,agents:n,chips:r,onChange:i,onClear:a,isFetching:o}){let[s,c]=(0,f.useState)(e.q??``);return(0,f.useEffect)(()=>{c(e.q??``)},[e.q]),(0,f.useEffect)(()=>{let t=setTimeout(()=>{(e.q??``)!==s&&i({q:s||void 0})},350);return()=>clearTimeout(t)},[s,e.q,i]),(0,w.jsxs)(`div`,{className:`sticky top-0 z-20 -mx-6 px-6 py-3 bg-background/85 backdrop-blur border-b border-border-subtle space-y-2`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(qH,{value:(0,f.useMemo)(()=>{if(!e.from&&!e.to)return`all`;let t=Date.now(),n=kH(`7d`,t),r=kH(`30d`,t),i=kH(`today`,t);return e.from&&Math.abs(e.from-(n.from??0))<6e4&&e.to&&Math.abs(e.to-(n.to??0))<6e4?`7d`:e.from&&Math.abs(e.from-(r.from??0))<6e4&&e.to&&Math.abs(e.to-(r.to??0))<6e4?`30d`:e.from&&Math.abs(e.from-(i.from??0))<6e4&&e.to&&Math.abs(e.to-(i.to??0))<6e4?`today`:`custom`},[e.from,e.to]),onChange:e=>{if(e===`custom`)return;let t=kH(e);i({from:t.from,to:t.to})}}),(0,w.jsx)(JH,{from:e.from,to:e.to,onChange:(e,t)=>i({from:e,to:t})}),n.length>0&&(0,w.jsxs)(YH,{value:e.agent??``,onChange:e=>i({agent:e||void 0}),ariaLabel:`Filter by AI agent`,children:[(0,w.jsxs)(`option`,{value:``,children:[`All AI agents (`,n.length,`)`]}),n.map(e=>(0,w.jsxs)(`option`,{value:e.agent_name,children:[e.agent_name,` — `,e.session_count,` session`,e.session_count===1?``:`s`]},e.agent_name))]}),(0,w.jsxs)(YH,{value:e.session??``,onChange:e=>i({session:e||void 0}),ariaLabel:`Filter by coding session`,children:[(0,w.jsxs)(`option`,{value:``,children:[`All sessions (`,t.length,`)`]}),t.map(e=>(0,w.jsxs)(`option`,{value:e.session_id,children:[FH(e.last_seen),` — `,e.turn_count,` action`,e.turn_count===1?``:`s`,e.agent_name&&e.agent_name!==`unknown`?` · ${e.agent_name}`:``]},e.session_id))]}),(0,w.jsx)(YH,{value:e.type??``,onChange:e=>i({type:e||void 0}),ariaLabel:`Filter by note type`,children:AH.map(e=>(0,w.jsxs)(`option`,{value:e.value,children:[e.emoji,` `,e.label]},e.value))}),(0,w.jsx)(`input`,{type:`search`,value:s,onChange:e=>c(e.target.value),placeholder:`Search your work…`,className:`flex-1 min-w-[160px] rounded-md border border-border-subtle bg-surface-secondary px-3 py-1.5 text-sm text-foreground placeholder-muted-foreground focus:outline-none focus:ring-1 focus:ring-violet-500`,"aria-label":`Search activity titles`}),(0,w.jsx)(XH,{value:e.density,onChange:e=>i({density:e})}),o&&(0,w.jsx)(`span`,{className:`text-[11px] t-tertiary font-mono`,children:`loading…`})]}),r.length>0&&(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[r.map(e=>(0,w.jsxs)(`button`,{type:`button`,onClick:()=>{e.key===`from`?i({from:void 0,to:void 0}):e.key===`session`?i({session:void 0}):e.key===`agent`?i({agent:void 0}):e.key===`type`?i({type:void 0}):e.key===`q`&&i({q:void 0})},className:`inline-flex items-center gap-1 rounded-full border border-violet-500/40 bg-violet-500/10 px-2 py-0.5 text-[11px] text-violet-300 hover:border-violet-400 hover:bg-violet-500/20`,children:[e.label,(0,w.jsx)(`span`,{"aria-hidden":!0,children:`✕`})]},e.key)),(0,w.jsx)(`button`,{type:`button`,onClick:a,className:`text-[11px] t-tertiary hover:text-foreground underline-offset-2 hover:underline ml-1`,children:`Clear all filters`})]})]})}function qH({value:e,onChange:t}){return(0,w.jsx)(`div`,{className:`inline-flex rounded-md border border-border-subtle overflow-hidden`,children:[{id:`today`,label:`Today`},{id:`7d`,label:`Last 7 days`},{id:`30d`,label:`Last 30 days`},{id:`all`,label:`All time`}].map((n,r)=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>t(n.id),className:`px-2.5 py-1 text-xs transition-colors ${e===n.id?`bg-violet-500/30 text-violet-200`:`bg-surface-secondary t-secondary hover:bg-surface-secondary/70`} ${r>0?`border-l border-border-subtle`:``}`,children:n.label},n.id))})}function JH({from:e,to:t,onChange:n}){return(0,w.jsxs)(`div`,{className:`inline-flex items-center gap-1 text-xs t-secondary`,children:[(0,w.jsx)(`input`,{type:`date`,"aria-label":`From date`,value:LH(e),onChange:e=>n(RH(e.target.value,!1),t),className:`rounded-md border border-border-subtle bg-surface-secondary px-2 py-1 text-foreground`}),(0,w.jsx)(`span`,{children:`→`}),(0,w.jsx)(`input`,{type:`date`,"aria-label":`To date`,value:LH(t),onChange:t=>n(e,RH(t.target.value,!0)),className:`rounded-md border border-border-subtle bg-surface-secondary px-2 py-1 text-foreground`})]})}function YH({value:e,onChange:t,ariaLabel:n,children:r}){return(0,w.jsx)(`select`,{value:e,onChange:e=>t(e.target.value),"aria-label":n,className:`rounded-md border border-border-subtle bg-surface-secondary px-2 py-1 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-violet-500 max-w-[260px]`,children:r})}function XH({value:e,onChange:t}){return(0,w.jsxs)(`div`,{className:`inline-flex rounded-md border border-border-subtle overflow-hidden`,role:`group`,"aria-label":`Row density`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>t(`comfortable`),className:`px-2 py-1 text-[11px] transition-colors ${e===`comfortable`?`bg-violet-500/30 text-violet-200`:`bg-surface-secondary t-secondary hover:bg-surface-secondary/70`}`,title:`Spacious rows`,"aria-pressed":e===`comfortable`,children:`☰`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>t(`compact`),className:`px-2 py-1 text-[11px] border-l border-border-subtle transition-colors ${e===`compact`?`bg-violet-500/30 text-violet-200`:`bg-surface-secondary t-secondary hover:bg-surface-secondary/70`}`,title:`Dense rows`,"aria-pressed":e===`compact`,children:`≡`})]})}function ZH({resume:e}){let t=e.intent&&e.intent.length>0?e.intent:`your last session`;return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-l-4 border-cyan-500/60 flex flex-wrap items-start gap-6`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`div`,{className:`text-cyan-400 text-[10px] uppercase tracking-wider font-medium`,children:`Pick up where you left off`}),(0,w.jsx)(`div`,{className:`text-foreground text-sm font-medium mt-2 truncate`,children:t}),(0,w.jsxs)(`div`,{className:`t-tertiary text-xs mt-1`,children:[`Last active `,IH(e.elapsed_ms),` · session`,` `,(0,w.jsx)(`span`,{className:`font-mono`,children:e.session_id.slice(0,8)})]})]}),e.open_threads.length>0&&(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsxs)(`div`,{className:`text-rose-400 text-[10px] uppercase tracking-wider font-medium`,children:[`Unresolved (`,e.open_threads.length,`)`]}),(0,w.jsx)(`ul`,{className:`space-y-1 mt-2`,children:e.open_threads.slice(0,3).map(e=>(0,w.jsxs)(`li`,{className:`t-secondary text-xs`,children:[(0,w.jsx)(`span`,{className:`text-rose-400`,children:`⚠`}),` `,e.text,e.file_path&&(0,w.jsxs)(`span`,{className:`t-tertiary font-mono ml-1`,children:[`(`,e.file_path,`)`]})]},e.marker_id))})]})]})}function QH({buckets:e,filters:t,onDayClick:n}){let r=Math.max(1,...e.map(e=>e.turns)),i=e.reduce((e,t)=>e+t.turns,0);return(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle bg-surface-secondary/40 px-4 py-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`text-[11px] uppercase tracking-wider t-secondary font-mono`,children:[`Last `,e.length,` days`]}),(0,w.jsxs)(`div`,{className:`text-[11px] t-tertiary mt-0.5`,children:[i.toLocaleString(),` action`,i===1?``:`s`,` tracked — brighter means busier, click any day to zoom in`]})]}),(0,w.jsxs)(`div`,{className:`text-[11px] t-tertiary font-mono`,children:[`peak `,r,`/day`]})]}),(0,w.jsx)(`div`,{className:`flex items-end gap-[3px] pb-1`,children:e.map(e=>(0,w.jsx)($H,{bucket:e,max:r,active:eU(e.ts,t),onClick:()=>n(e.ts)},e.ts))})]})}function $H({bucket:e,max:t,active:n,onClick:r}){let i=e.turns===0?0:e.turns/t,a=e.turns===0?`bg-foreground/10 border border-border-subtle`:i>.75?`bg-violet-400`:i>.5?`bg-violet-500/85`:i>.25?`bg-violet-500/55`:`bg-violet-500/30`,o=n?`ring-2 ring-cyan-400`:``,s=`${PH(e.ts)} — ${e.turns} action${e.turns===1?``:`s`}, ${e.edits} file edit${e.edits===1?``:`s`}, ${e.tools} step${e.tools===1?``:`s`}`;return(0,w.jsx)(`button`,{type:`button`,onClick:r,title:s,className:`h-8 flex-1 min-w-[8px] rounded-sm hover:scale-110 transition-transform ${a} ${o}`,"aria-label":s})}function eU(e,t){return!t.from||!t.to?!1:Math.abs(t.from-e)<6e4&&t.to-t.from<1440*6e4*1.1}function tU({intents:e}){let t=e.filter(e=>e.status!==`dormant`),n=e.filter(e=>e.status===`dormant`).slice(0,3);return t.length===0&&n.length===0?null:(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`div`,{className:`text-violet-400 text-[10px] uppercase tracking-wider font-medium mb-3`,children:`Tasks you've been working on`}),(0,w.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2`,children:t.slice(0,6).map(e=>(0,w.jsxs)(`div`,{className:`rounded border border-violet-500/30 bg-violet-500/10 px-3 py-2`,children:[(0,w.jsx)(`div`,{className:`text-foreground text-sm font-medium truncate`,children:e.title||`(unnamed task)`}),(0,w.jsxs)(`div`,{className:`t-tertiary text-[11px] mt-1`,children:[`Last active `,IH(Date.now()-e.last_active_at),e.source===`agent_marker`?` · from agent's stated goal`:` · detected from code changes`]})]},e.intent_id))}),n.length>0&&(0,w.jsxs)(`div`,{className:`mt-3 t-tertiary text-[11px]`,children:[`Older tasks (`,n.length,`):`,` `,n.map(e=>e.title||`(unnamed)`).join(` · `)]})]})}function nU({turns:e,markersByTurn:t,filters:n,totalTurns:r,totalPages:i,onPageChange:a,onTurnClick:o,selectedTurnId:s,isFetching:c}){let l=n.density===`compact`;return(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5 border-l-4 border-fuchsia-500/60`,children:[(0,w.jsx)(`div`,{className:`text-fuchsia-400 text-[10px] uppercase tracking-wider font-medium`,children:`Patterns unerr noticed`}),(0,w.jsx)(`div`,{className:`t-tertiary text-xs leading-relaxed mt-2 max-w-2xl`,children:`Over time, unerr spots patterns — files your agent keeps coming back to, problems that recur, and conventions it has learned. The more sessions you run, the smarter these insights become.`})]}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between text-xs t-tertiary`,children:[(0,w.jsx)(`span`,{children:r===0?`Nothing matches the current filters yet.`:`Showing ${e.length} of ${r.toLocaleString()} action${r===1?``:`s`}`}),(0,w.jsxs)(`span`,{className:`font-mono`,children:[`page `,n.page,` / `,i]})]}),e.length===0?(0,w.jsx)(rU,{isFetching:c}):(0,w.jsx)(`div`,{className:l?`divide-y divide-border-subtle rounded-lg border border-border-subtle overflow-hidden el-raised`:`space-y-2`,children:e.map(e=>(0,w.jsx)(aU,{turn:e,markers:t.get(e.turn_id)??[],compact:l,active:s===e.turn_id,onClick:()=>o(e.turn_id)},e.turn_id))}),i>1&&(0,w.jsx)(oU,{page:n.page,totalPages:i,onChange:a})]})}function rU({isFetching:e}){return(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-6 text-sm t-secondary`,children:e?(0,w.jsx)(`span`,{children:`Loading…`}):(0,w.jsxs)(w.Fragment,{children:[`No agent actions match these filters yet. Try`,` `,(0,w.jsx)(`span`,{className:`text-foreground`,children:`widening the date range`}),`,`,` `,(0,w.jsx)(`span`,{className:`text-foreground`,children:`clearing the search`}),`, or`,` `,(0,w.jsx)(`span`,{className:`text-foreground`,children:`selecting "All time"`}),`.`]})})}function iU({prompt:e,className:t}){return e?e.prompt?(0,w.jsxs)(`p`,{className:`break-words text-[13px] italic text-foreground/90 ${t??``}`,title:e.prompt,children:[(0,w.jsx)(`span`,{className:`t-tertiary not-italic`,children:`“`}),e.prompt,(0,w.jsx)(`span`,{className:`t-tertiary not-italic`,children:`”`})]}):(0,w.jsxs)(`p`,{className:`text-[11px] t-tertiary ${t??``}`,children:[`(Prompt not captured — enable `,(0,w.jsx)(`code`,{children:`capture_prompts`}),` in your unerr config to see what you asked)`]}):null}function aU({turn:e,markers:t,compact:n,active:r,onClick:i}){let a=t.find(e=>e.type===`mark_intent`),o=t.filter(e=>e.type===`mark_decision`).length,s=t.filter(e=>e.type===`mark_blocker`),c=new Set(t.filter(e=>e.type===`mark_resolution`).map(e=>e.blocker_ref)),l=s.filter(e=>!c.has(e.marker_id)),u=(a?.text??``).length>0?a?.text??``:e.title&&e.title.length>0?e.title:`Agent work — ${e.tool_count} step${e.tool_count===1?``:`s`}, ${e.edit_count} edit${e.edit_count===1?``:`s`}`;return(0,w.jsx)(`div`,{onClick:i,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),i())},role:`button`,tabIndex:0,className:`${n?`flex items-center gap-3 px-3 py-2 hover:bg-surface-secondary transition-colors cursor-pointer`:`el-raised rounded-lg border border-border-subtle hover:border-violet-500/40 transition-colors cursor-pointer`} ${r?n?`bg-violet-500/15`:`border-violet-500/60 bg-violet-500/5`:``}`,children:n?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`text-sm text-foreground truncate flex-1`,children:u}),(0,w.jsxs)(`span`,{className:`text-[11px] t-tertiary font-mono shrink-0`,children:[PH(e.started_at),` `,NH(e.started_at)]}),(0,w.jsxs)(`span`,{className:`text-[11px] t-tertiary shrink-0`,children:[e.tool_count,` step`,e.tool_count===1?``:`s`,` ·`,` `,e.edit_count,` edit`,e.edit_count===1?``:`s`]}),l.length>0&&(0,w.jsxs)(`span`,{className:`text-[10px] font-mono px-1.5 py-0.5 rounded bg-rose-500/15 text-rose-400 border border-rose-500/30 shrink-0`,children:[l.length,` stuck`]})]}):(0,w.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,w.jsx)(iU,{prompt:e.prompt,className:`mb-2 line-clamp-2`}),(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,w.jsx)(`span`,{className:`text-sm text-foreground font-medium truncate`,children:u}),o>0&&(0,w.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-cyan-500/15 text-cyan-400 border border-cyan-500/30 shrink-0`,children:[`💡 `,o,` decision`,o===1?``:`s`]}),l.length>0&&(0,w.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-rose-500/15 text-rose-400 border border-rose-500/30 shrink-0`,children:[`⚠ `,l.length,` stuck`]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-4 text-xs t-tertiary shrink-0`,children:[(0,w.jsxs)(`span`,{children:[PH(e.started_at),` `,NH(e.started_at)]}),(0,w.jsx)(`span`,{children:MH(e.ended_at-e.started_at)}),(0,w.jsxs)(`span`,{children:[e.tool_count,` step`,e.tool_count===1?``:`s`,` ·`,` `,e.file_count,` file`,e.file_count===1?``:`s`,` ·`,` `,e.edit_count,` edit`,e.edit_count===1?``:`s`]})]})]})]})})}function oU({page:e,totalPages:t,onChange:n}){let r=sU(e,t);return(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-2`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(Math.max(1,e-1)),disabled:e<=1,className:`rounded-md border border-border-subtle bg-surface-secondary px-3 py-1 text-xs text-foreground hover:bg-surface-secondary/70 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:`← Newer`}),(0,w.jsx)(`div`,{className:`flex items-center gap-1`,children:r.map(({key:t,value:r})=>r===`…`?(0,w.jsx)(`span`,{className:`px-2 t-tertiary text-xs`,children:`…`},t):(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(r),className:`min-w-[28px] rounded-md px-2 py-1 text-xs border border-border-subtle transition-colors ${r===e?`bg-violet-500/30 text-violet-200`:`bg-surface-secondary t-secondary hover:bg-surface-secondary/70`}`,children:r},t))}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(Math.min(t,e+1)),disabled:e>=t,className:`rounded-md border border-border-subtle bg-surface-secondary px-3 py-1 text-xs text-foreground hover:bg-surface-secondary/70 disabled:opacity-40 disabled:cursor-not-allowed transition-colors`,children:`Older →`})]})}function sU(e,t){if(t<=7)return Array.from({length:t},(e,t)=>({key:`page-${t+1}`,value:t+1}));let n=[...new Set([1,t,e,e-1,e+1,e-2,e+2])].filter(e=>e>=1&&e<=t).sort((e,t)=>e-t),r=[];for(let e=0;e<n.length;e++){let t=n[e];if(e>0&&t-n[e-1]>1){let i=n[e-1];r.push({key:`ellipsis-${i}-${t}`,value:`…`})}r.push({key:`page-${t}`,value:t})}return r}function cU({turn:e,markers:t,episodicByFile:n,onClose:r}){let i=(0,f.useMemo)(()=>[...new Set(t.map(e=>e.file_path).filter(e=>typeof e==`string`&&e.length>0))],[t]),a=(0,f.useMemo)(()=>{let e=[];for(let t of i){let r=n.get(t);r&&e.push(...r)}return e.slice(0,5)},[i,n]);return(0,w.jsx)(`div`,{className:`fixed inset-0 z-30 flex justify-end bg-black/40 backdrop-blur-sm`,onClick:r,onKeyDown:e=>{e.key===`Escape`&&r()},role:`dialog`,"aria-modal":`true`,tabIndex:-1,children:(0,w.jsxs)(`aside`,{className:`h-full w-full max-w-md bg-background border-l border-border-subtle shadow-2xl overflow-y-auto`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`document`,children:[(0,w.jsxs)(`div`,{className:`sticky top-0 bg-background/90 backdrop-blur border-b border-border-subtle p-4 flex items-start justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-[10px] uppercase tracking-wider font-medium`,children:`What happened`}),(0,w.jsx)(`div`,{className:`text-sm text-foreground font-medium mt-1 truncate`,children:e.title||`Agent work`})]}),(0,w.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-md border border-border-subtle bg-surface-secondary px-2 py-1 t-secondary hover:text-foreground hover:bg-surface-secondary/70 transition-colors`,"aria-label":`Close detail panel`,children:`✕`})]}),(0,w.jsxs)(`div`,{className:`p-4 space-y-4`,children:[e.prompt?(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle bg-surface-secondary/40 p-3`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-[10px] uppercase tracking-wider font-medium mb-1.5`,children:`What you asked`}),(0,w.jsx)(iU,{prompt:e.prompt})]}):null,(0,w.jsx)(lU,{turn:e}),(0,w.jsx)(dU,{markers:t}),a.length>0&&(0,w.jsx)(fU,{narratives:a})]})]})})}function lU({turn:e}){let[t,n]=(0,f.useState)(!1);return(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-xs`,children:[(0,w.jsx)(uU,{label:`Started`,value:FH(e.started_at)}),(0,w.jsx)(uU,{label:`Duration`,value:MH(e.ended_at-e.started_at)}),(0,w.jsx)(uU,{label:`Outcome`,value:e.outcome===`unknown`?`—`:e.outcome===`success`?`Completed`:e.outcome})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 text-xs`,children:[(0,w.jsx)(uU,{label:`Steps taken`,value:String(e.tool_count)}),(0,w.jsx)(uU,{label:`Files involved`,value:String(e.file_count)}),(0,w.jsx)(uU,{label:`Edits written`,value:String(e.edit_count)})]}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`text-[10px] t-tertiary hover:text-foreground transition-colors`,children:t?`▾ Hide technical IDs`:`▸ Show technical IDs`}),t&&(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-xs`,children:[(0,w.jsx)(uU,{label:`Action ID`,value:e.turn_id.slice(0,8),mono:!0}),(0,w.jsx)(uU,{label:`Session ID`,value:e.session_id.slice(0,8),mono:!0})]})]})}function uU({label:e,value:t,mono:n}){return(0,w.jsxs)(`div`,{className:`rounded border border-border-subtle bg-surface-secondary px-2 py-1.5`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-[10px] uppercase tracking-wider font-medium`,children:e}),(0,w.jsx)(`div`,{className:`text-foreground mt-0.5 truncate ${n?`font-mono`:``}`,children:t})]})}function dU({markers:e}){if(e.length===0)return(0,w.jsx)(`div`,{className:`t-tertiary text-xs leading-relaxed`,children:`No notes recorded for this action. As your agent uses unerr's workflows, it automatically logs goals, decisions, stuck moments, and solutions — building a readable trail of what happened and why.`});let t=new Map(e.filter(e=>e.type===`mark_blocker`).map(e=>[e.marker_id,e.text]));return(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsxs)(`div`,{className:`t-secondary text-[10px] uppercase tracking-wider font-medium`,children:[`What happened during this action (`,e.length,` note`,e.length===1?``:`s`,`)`]}),e.map(e=>{let n=jH(e.type),r=e.blocker_ref?t.get(e.blocker_ref):void 0;return(0,w.jsxs)(`div`,{className:`rounded border border-border-subtle bg-surface-secondary px-3 py-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`span`,{className:`text-[10px] uppercase ${n.color}`,children:[n.emoji,` `,n.label]}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:NH(e.ts)})]}),(0,w.jsx)(`div`,{className:`text-xs text-foreground mt-1`,children:e.text}),e.file_path&&(0,w.jsx)(`div`,{className:`t-tertiary text-[11px] font-mono mt-1`,children:e.file_path}),e.blocker_ref&&(0,w.jsxs)(`div`,{className:`text-emerald-400 text-[11px] mt-1`,children:[`✅ Fixes: `,r||`issue ${e.blocker_ref.slice(0,8)}`]})]},e.marker_id)})]})}function fU({narratives:e}){return(0,w.jsxs)(`div`,{className:`space-y-2`,children:[(0,w.jsx)(`div`,{className:`t-secondary text-[10px] uppercase tracking-wider font-medium`,children:`What unerr knows about these files`}),e.map(e=>{let t=zH(e.content);return(0,w.jsxs)(`div`,{className:`rounded border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 text-xs`,children:[(0,w.jsx)(`div`,{className:`text-emerald-400 font-mono text-[10px] uppercase mb-1`,children:e.scope}),t.what&&(0,w.jsxs)(`div`,{className:`text-foreground`,children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`What — `}),t.what]}),t.why&&(0,w.jsxs)(`div`,{className:`t-secondary mt-1`,children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`Why — `}),t.why]}),t.how&&(0,w.jsxs)(`div`,{className:`t-secondary mt-1`,children:[(0,w.jsx)(`span`,{className:`t-tertiary`,children:`How — `}),t.how]}),!t.what&&!t.why&&!t.how&&(0,w.jsx)(`div`,{className:`t-secondary`,children:e.content})]},e.fact_id)})]})}function pU(e){let t=new URLSearchParams;return e.from!==void 0&&t.set(`from`,String(e.from)),e.to!==void 0&&t.set(`to`,String(e.to)),e.session&&t.set(`session_id`,e.session),e.q&&t.set(`q`,e.q),t.set(`limit`,String(e.perPage)),t.set(`offset`,String((e.page-1)*e.perPage)),t.toString()}function mU(e){let t=new Map;for(let n of e){let e=t.get(n.turn_id)??[];e.push(n),t.set(n.turn_id,e)}return t}var hU=[{key:`surface2`,label:`Surface-2 lines`},{key:`surface3`,label:`Surface-3 lines`},{key:`mark_intent`,label:`mark_intent calls`},{key:`skill`,label:`Skill invocations`}];function gU(e){return e<60?`${Math.round(e)}s`:e<3600?`${Math.floor(e/60)}m ${Math.round(e%60)}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`}function _U(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function vU(e){switch(e){case`running`:case`ready`:return`bg-emerald-500 shadow-[0_0_8px_rgba(52,211,153,0.5)]`;case`indexing`:return`bg-amber-400 animate-pulse shadow-[0_0_8px_rgba(251,191,36,0.5)]`;default:return`bg-red-500 shadow-[0_0_8px_rgba(248,113,113,0.5)]`}}function yU(e){switch(e){case`running`:case`ready`:return`Operational`;case`indexing`:return`Indexing`;default:return e.charAt(0).toUpperCase()+e.slice(1)}}function bU({value:e}){let[t,n]=(0,f.useState)(!1);return(0,w.jsx)(`button`,{type:`button`,className:`ml-2 inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium t-tertiary hover:text-foreground hover:el-raised transition-all`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-3 w-3 text-emerald-500`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2.5,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})}):(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-3 w-3`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z`})})})}function xU({label:e,value:t,sub:n,color:r=`violet`}){return(0,w.jsxs)(`div`,{className:`glass-card rounded-lg p-4 ring-1 ${{violet:`ring-violet-500/20`,cyan:`ring-cyan-500/20`,emerald:`ring-emerald-500/20`,amber:`ring-amber-500/20`}[r]}`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[11px] uppercase tracking-wide`,children:e}),(0,w.jsx)(`p`,{className:`mt-1 text-2xl font-mono font-bold ${{violet:`text-violet-400`,cyan:`text-cyan-400`,emerald:`text-emerald-400`,amber:`text-amber-400`}[r]}`,children:t}),n&&(0,w.jsx)(`p`,{className:`mt-0.5 t-tertiary text-xs`,children:n})]})}function SU({label:e,value:t,mono:n=!0,copyable:r=!1}){let i=t??`—`;return(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 py-2 border-b border-border-subtle/50 last:border-0`,children:[(0,w.jsx)(`dt`,{className:`t-secondary text-sm shrink-0`,children:e}),(0,w.jsxs)(`dd`,{className:`text-right text-xs text-foreground ${n?`font-mono`:``} flex items-center`,children:[(0,w.jsx)(`span`,{className:`break-all`,children:i}),r&&typeof i==`string`&&(0,w.jsx)(bU,{value:i})]})]})}function CU({name:e}){return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-medium ring-1 ${{audit:`bg-violet-500/15 text-violet-400 ring-violet-500/30`,blame:`bg-cyan-500/15 text-cyan-400 ring-cyan-500/30`,test:`bg-emerald-500/15 text-emerald-400 ring-emerald-500/30`,lint:`bg-amber-500/15 text-amber-400 ring-amber-500/30`,commit:`bg-violet-500/15 text-violet-400 ring-violet-500/30`,"review-pr":`bg-cyan-500/15 text-cyan-400 ring-cyan-500/30`}[e.replace(/^unerr-/,``)]??`bg-violet-500/10 text-violet-400 ring-violet-500/20`}`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-2.5 w-2.5`,fill:`currentColor`,viewBox:`0 0 8 8`,children:(0,w.jsx)(`circle`,{cx:`4`,cy:`4`,r:`3`})}),e]})}function wU({config:e}){let t=Object.entries(e);return t.length===0?(0,w.jsx)(`p`,{className:`t-tertiary text-sm italic`,children:`No configuration entries.`}):(0,w.jsx)(`div`,{className:`space-y-1`,children:t.map(([e,t])=>{let n=typeof t==`object`&&t?JSON.stringify(t,null,2):String(t??`—`),r=typeof t==`object`&&!!t;return(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle/50 p-3 ${r?``:`flex items-baseline justify-between gap-4`}`,children:[(0,w.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e}),r?(0,w.jsx)(`pre`,{className:`mt-2 custom-scrollbar max-h-40 overflow-auto whitespace-pre-wrap rounded-md bg-black/20 p-2.5 font-mono text-xs leading-relaxed t-secondary`,children:n}):(0,w.jsx)(`span`,{className:`font-mono text-xs t-secondary`,children:n})]},e)})})}function TU(e){if(!e)return`never`;let t=Date.now()-e;if(t<6e4)return`just now`;let n=Math.floor(t/6e4);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 EU({update:e}){let t=e.status===`rolled-back`?`bg-red-500`:e.status===`available`||e.status===`pending`?`bg-amber-400`:e.status===`disabled`?`bg-gray-500`:`bg-emerald-500`,n=e.policy===`auto`?`Auto (patch + minor)`:e.policy===`notify`?`Notify only`:`Off`;return(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`h2`,{className:`section-label text-violet-500 flex items-center gap-2`,children:[(0,w.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 rounded-full ${t}`}),`Auto-update`]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[`checked `,TU(e.lastCheckedAt)]})]}),(0,w.jsx)(`p`,{className:`mt-2 text-sm text-foreground`,children:e.line}),(0,w.jsxs)(`dl`,{className:`mt-3`,children:[(0,w.jsx)(SU,{label:`Current version`,value:e.current}),(0,w.jsx)(SU,{label:`Latest`,value:e.latest??`—`}),(0,w.jsx)(SU,{label:`Policy`,value:n,mono:!1}),(0,w.jsx)(SU,{label:`Install`,value:`${e.manager} · ${e.mode===`self_upgradable`?`self-updates`:`notify only`}`,mono:!1}),e.pendingVersion&&(0,w.jsx)(SU,{label:`Staged`,value:`${e.pendingVersion} (applies on next restart)`,mono:!1}),e.upgradeCommand&&(0,w.jsx)(SU,{label:`Upgrade command`,value:e.upgradeCommand,copyable:!0})]}),(0,w.jsx)(DU,{policy:e.policy})]})}function DU({policy:e}){let{url:t,queryKey:n}=Ot(),r=lt(),i=()=>r.invalidateQueries({queryKey:n([`system`,`status`])}),a=wt({mutationFn:e=>O(t(`/api/system/update-mode`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})}),onSuccess:i}),o=wt({mutationFn:()=>O(t(`/api/system/update-check`),{method:`POST`}),onSuccess:i});return(0,w.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,w.jsx)(`div`,{className:`inline-flex rounded-lg border border-white/10 p-0.5`,children:[{value:`auto`,label:`Auto`},{value:`notify`,label:`Notify`},{value:`off`,label:`Off`}].map(t=>{let n=e===t.value;return(0,w.jsx)(`button`,{type:`button`,disabled:a.isPending,onClick:()=>a.mutate(t.value),className:`rounded-md px-3 py-1.5 text-xs transition-colors disabled:opacity-50 ${n?`bg-violet-500/20 text-violet-200`:`text-foreground/70 hover:text-foreground`}`,children:t.label},t.value)})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`button`,{type:`button`,disabled:o.isPending,onClick:()=>o.mutate(),className:`rounded-md border border-white/10 px-3 py-1.5 text-xs text-foreground/80 hover:text-foreground disabled:opacity-50`,children:o.isPending?`Checking…`:`Check for updates now`}),a.isError&&(0,w.jsx)(`span`,{className:`text-xs text-red-400`,children:`Couldn't save — try again.`})]})]})}function OU(){let{url:e,queryKey:t}=Ot(),n=N({queryKey:t([`system`,`status`]),queryFn:()=>O(e(`/api/system/status`)),refetchInterval:5e3}),r=N({queryKey:t([`system`,`config`]),queryFn:()=>O(e(`/api/system/config`))}),i=N({queryKey:t([`logbook`,`compliance`,`settings`]),queryFn:()=>O(e(`/api/logbook/compliance`)),refetchInterval:1e4}),a=n.data?.data,o=r.data?.data,s=i.data?.data,c=s?.runtime_joins;return n.isLoading||r.isLoading?(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsx)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:[1,2,3,4].map(e=>(0,w.jsx)(Ht,{className:`h-24 w-full rounded-lg`},e))}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 lg:flex-row`,children:[(0,w.jsx)(Ht,{className:`h-72 flex-1 rounded-xl`}),(0,w.jsx)(Ht,{className:`h-72 flex-1 rounded-xl`})]})]}):n.isError&&r.isError?(0,w.jsx)(`div`,{className:`flex items-center justify-center py-20`,children:(0,w.jsxs)(`div`,{className:`glass-panel rounded-xl p-8 text-center max-w-md`,children:[(0,w.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-red-500/15`,children:(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-6 w-6 text-red-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z`})})}),(0,w.jsx)(`h3`,{className:`text-foreground font-medium`,children:`Connection Error`}),(0,w.jsx)(`p`,{className:`mt-2 t-secondary text-sm`,children:`Unable to reach the unerr proxy. Ensure the process is running.`})]})}):(0,w.jsxs)(`div`,{className:`space-y-8`,children:[(0,w.jsx)(`div`,{className:`glass-panel rounded-xl p-5`,children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,w.jsx)(`div`,{className:`relative flex h-11 w-11 items-center justify-center rounded-xl bg-violet-500/15 ring-1 ring-violet-500/30`,children:(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-5 w-5 text-violet-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:1.8,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z`})})}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-semibold text-foreground`,children:`Process Instance`}),(0,w.jsx)(`span`,{className:`inline-block h-2.5 w-2.5 rounded-full ${a?vU(a.status):`bg-gray-500`}`}),(0,w.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:a?yU(a.status):`Unknown`})]}),(0,w.jsxs)(`p`,{className:`mt-0.5 t-tertiary text-xs font-mono`,children:[`PID `,a?.pid??`—`,` · `,a?.mode??`—`,` mode · port`,` `,a?.dashboard_port??`—`]})]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[a?.ide&&(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-cyan-500/10 px-3 py-1 text-xs font-medium text-cyan-400 ring-1 ring-cyan-500/20`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-3 w-3`,fill:`currentColor`,viewBox:`0 0 24 24`,children:(0,w.jsx)(`path`,{d:`M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z`})}),a.ide]}),(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-violet-500/10 px-3 py-1 text-xs font-medium text-violet-400 ring-1 ring-violet-500/20`,children:[`Uptime: `,a?gU(a.uptime_s):`—`]})]})]})}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:[(0,w.jsx)(xU,{label:`Graph Entities`,value:a?_U(a.graph.entities):`—`,sub:a?`${_U(a.graph.edges)} edges`:void 0,color:`violet`}),(0,w.jsx)(xU,{label:`Rules Active`,value:a?.graph.rules??`—`,sub:`conventions & patterns`,color:`cyan`}),(0,w.jsx)(xU,{label:`Tool Calls`,value:a?_U(a.session.tool_calls):`—`,sub:`this session`,color:`emerald`}),(0,w.jsx)(xU,{label:`Tokens Saved`,value:a?_U(a.session.tokens_saved):`—`,sub:a?.session.violations_caught?`${a.session.violations_caught} violations caught · on operations unerr handled`:`on operations unerr handled`,color:`amber`})]}),a?.update&&(0,w.jsx)(EU,{update:a.update}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 lg:flex-row`,children:[(0,w.jsxs)(`section`,{className:`flex-1 glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`h2`,{className:`section-label text-violet-500 flex items-center gap-2`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z`})}),`Process Details`]}),n.isError?(0,w.jsx)(`p`,{className:`mt-4 text-error text-sm`,children:`Could not reach proxy.`}):(0,w.jsxs)(`dl`,{className:`mt-4`,children:[(0,w.jsx)(SU,{label:`Status`,value:a?yU(a.status):void 0,mono:!1}),(0,w.jsx)(SU,{label:`Process ID`,value:a?.pid,copyable:!0}),(0,w.jsx)(SU,{label:`Mode`,value:a?.mode}),(0,w.jsx)(SU,{label:`Dashboard Port`,value:a?.dashboard_port}),(0,w.jsx)(SU,{label:`IDE`,value:a?.ide||`None detected`}),(0,w.jsx)(SU,{label:`Uptime`,value:a?gU(a.uptime_s):void 0}),(0,w.jsx)(SU,{label:`Working Directory`,value:a?.cwd,copyable:!0}),(0,w.jsx)(SU,{label:`Session Started`,value:a?.session.started_at?new Date(a.session.started_at).toLocaleString():void 0})]})]}),(0,w.jsxs)(`section`,{className:`flex-1 glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`h2`,{className:`section-label text-cyan-500 flex items-center gap-2`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M13 10V3L4 14h7v7l9-11h-7z`})}),`Installed Skills`]}),(0,w.jsxs)(`p`,{className:`mt-1 t-tertiary text-xs`,children:[`Agent skills installed in this repository via`,` `,(0,w.jsx)(`span`,{className:`font-mono`,children:`unerr install`}),`.`]}),r.isError?(0,w.jsx)(`p`,{className:`mt-4 text-error text-sm`,children:`Could not load config.`}):o?.skills_installed?.length?(0,w.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:o.skills_installed.map(e=>(0,w.jsx)(CU,{name:e},e))}):(0,w.jsxs)(`div`,{className:`mt-6 flex flex-col items-center py-6 text-center`,children:[(0,w.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-amber-500/10 ring-1 ring-amber-500/20`,children:(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-5 w-5 text-amber-400`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})})}),(0,w.jsx)(`p`,{className:`text-sm text-foreground`,children:`No skills installed`}),(0,w.jsxs)(`p`,{className:`mt-1 t-tertiary text-xs max-w-[240px]`,children:[`Run`,` `,(0,w.jsx)(`code`,{className:`font-mono text-violet-400`,children:`unerr install <agent>`}),` `,`to install skills for your IDE.`]})]}),(0,w.jsxs)(`div`,{className:`mt-6 border-t border-border-subtle/50 pt-5`,children:[(0,w.jsxs)(`h3`,{className:`section-label text-violet-500 flex items-center gap-2`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-3.5 w-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01`})}),`Graph Intelligence`]}),(0,w.jsxs)(`div`,{className:`mt-3 grid grid-cols-3 gap-3`,children:[(0,w.jsxs)(`div`,{className:`rounded-lg bg-violet-500/5 p-3 text-center ring-1 ring-violet-500/10`,children:[(0,w.jsx)(`p`,{className:`text-xl font-mono font-bold text-violet-400`,children:a?_U(a.graph.entities):`—`}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Entities`})]}),(0,w.jsxs)(`div`,{className:`rounded-lg bg-cyan-500/5 p-3 text-center ring-1 ring-cyan-500/10`,children:[(0,w.jsx)(`p`,{className:`text-xl font-mono font-bold text-cyan-400`,children:a?_U(a.graph.edges):`—`}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Edges`})]}),(0,w.jsxs)(`div`,{className:`rounded-lg bg-emerald-500/5 p-3 text-center ring-1 ring-emerald-500/10`,children:[(0,w.jsx)(`p`,{className:`text-xl font-mono font-bold text-emerald-400`,children:a?.graph.rules??`—`}),(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Rules`})]})]})]})]})]}),(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`h2`,{className:`section-label text-emerald-500 flex items-center gap-2`,children:[(0,w.jsxs)(`svg`,{"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:[(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z`}),(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 12a3 3 0 11-6 0 3 3 0 016 0z`})]}),`Repository Configuration`]}),(0,w.jsx)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2.5 py-0.5 text-[10px] font-mono text-emerald-400 ring-1 ring-emerald-500/20`,children:`.unerr/config.json`})]}),(0,w.jsxs)(`p`,{className:`mt-1 t-tertiary text-xs`,children:[`Per-repository configuration. Edit`,` `,(0,w.jsx)(`code`,{className:`font-mono text-emerald-400`,children:`.unerr/config.json`}),` `,`directly to modify settings.`]}),(0,w.jsx)(`div`,{className:`mt-4`,children:r.isError?(0,w.jsx)(`p`,{className:`text-error text-sm`,children:`Could not load configuration.`}):(0,w.jsx)(wU,{config:o?.repo_config??{}})})]}),(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`h2`,{className:`section-label text-amber-500 flex items-center gap-2`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M13 7h8m0 0v8m0-8l-8 8-4-4-6 6`})}),`Session Performance`]}),(0,w.jsx)(`p`,{className:`mt-1 t-tertiary text-xs`,children:`Live metrics for the current proxy session. Resets when the process restarts.`}),(0,w.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4 sm:grid-cols-4`,children:[(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle/50 p-3`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Tool Calls`}),(0,w.jsx)(`p`,{className:`mt-1 text-xl font-mono font-bold text-foreground`,children:a?_U(a.session.tool_calls):`—`})]}),(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle/50 p-3`,title:`Counted on operations unerr handled (file reads, web fetches, shell output, dedup). Not whole-turn savings.`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Tokens Saved`}),(0,w.jsx)(`p`,{className:`mt-1 text-xl font-mono font-bold text-foreground`,children:a?_U(a.session.tokens_saved):`—`}),(0,w.jsx)(`p`,{className:`mt-0.5 t-tertiary text-[9px] leading-snug`,children:`on ops unerr handled`})]}),(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle/50 p-3`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Violations`}),(0,w.jsx)(`p`,{className:`mt-1 text-xl font-mono font-bold text-foreground`,children:a?.session.violations_caught??`—`})]}),(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle/50 p-3`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:`Session Start`}),(0,w.jsx)(`p`,{className:`mt-1 text-xs font-mono text-foreground leading-relaxed`,children:a?.session.started_at?new Date(a.session.started_at).toLocaleTimeString():`—`})]})]})]}),(0,w.jsxs)(`section`,{className:`glass-panel rounded-xl p-5`,children:[(0,w.jsxs)(`h2`,{className:`section-label text-cyan-500 flex items-center gap-2`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`h-4 w-4`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`})}),`Directive Compliance`]}),(0,w.jsx)(`p`,{className:`mt-1 t-tertiary text-xs`,children:`How often unerr honored its own protocol directives this install — diagnostics, not your outcomes.`}),i.isError?(0,w.jsx)(`p`,{className:`mt-4 text-error text-sm`,children:`Could not load compliance diagnostics.`}):s?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:hU.map(({key:e,label:t})=>{let n=s[e];return(0,w.jsxs)(`div`,{className:`rounded-lg border border-border-subtle/50 p-3`,children:[(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] uppercase tracking-wide`,children:t}),(0,w.jsxs)(`p`,{className:`mt-1 text-xl font-mono font-bold text-foreground`,children:[Math.round(n.ratio*100),`%`]}),(0,w.jsxs)(`p`,{className:`mt-0.5 t-tertiary text-[11px]`,children:[n.called,` / `,n.required,n.consecutive_misses>0?(0,w.jsxs)(`span`,{className:`ml-1.5 text-amber-400`,children:[`· `,n.consecutive_misses,`× miss streak`]}):null]})]},e)})}),c&&c.total>0?(0,w.jsxs)(`div`,{className:`mt-4 rounded-lg border border-violet-500/30 bg-violet-500/5 px-4 py-3`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,w.jsx)(`span`,{"aria-hidden":`true`,className:`text-fuchsia-400`,children:`⚡`}),(0,w.jsx)(`span`,{className:`font-medium text-foreground`,children:`Cross-tier runtime joins`}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`·`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums t-secondary`,children:[`memory→graph `,c.memory_to_graph]}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`·`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums t-secondary`,children:[`graph→drift `,c.graph_to_drift]}),(0,w.jsx)(`span`,{className:`t-tertiary`,children:`·`}),(0,w.jsxs)(`span`,{className:`font-mono tabular-nums t-secondary`,children:[`three-way `,c.three_way]})]}),(0,w.jsx)(`p`,{className:`mt-1 text-[11px] t-tertiary`,children:`Joins point tools cannot produce — per-repo runtime context.`})]}):null]}):(0,w.jsx)(`div`,{className:`mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[1,2,3,4].map(e=>(0,w.jsx)(Ht,{className:`h-20 w-full rounded-lg`},e))})]})]})}function kU({points:e,height:t=28,className:n=``}){let r=`spark-${(0,f.useId)().replace(/:/g,``)}`;if(!e||e.length<2)return(0,w.jsx)(`div`,{style:{height:t},"aria-hidden":!0,className:n});let i=Math.max(...e),a=Math.min(...e),o=i-a||1,s=e.length>1?100/(e.length-1):100,c=e.map((e,n)=>{let r=n*s,i=t-(e-a)/o*t;return`${r.toFixed(2)},${i.toFixed(2)}`}).join(` `),l=`0,${t} ${c} 100,${t}`;return(0,w.jsxs)(`svg`,{"aria-hidden":!0,role:`img`,viewBox:`0 0 100 ${t}`,preserveAspectRatio:`none`,className:`block w-full ${n}`,style:{height:t},children:[(0,w.jsx)(`title`,{children:`Sparkline trend`}),(0,w.jsx)(`defs`,{children:(0,w.jsxs)(`linearGradient`,{id:r,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,w.jsx)(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:.22}),(0,w.jsx)(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:0})]})}),(0,w.jsx)(`polygon`,{points:l,fill:`url(#${r})`}),(0,w.jsx)(`polyline`,{points:c,fill:`none`,stroke:`currentColor`,strokeWidth:1.25,strokeLinejoin:`round`,strokeLinecap:`round`})]})}var AU={emerald:{stripe:`border-emerald-500/60`,label:`text-emerald-400`,value:`text-emerald-400`,spark:`text-emerald-400`,wash:`from-emerald-500/[0.07]`,glow:`hover:shadow-[0_14px_34px_-16px_rgba(52,211,153,0.45)]`},cyan:{stripe:`border-cyan-500/60`,label:`text-cyan-400`,value:`text-cyan-400`,spark:`text-cyan-400`,wash:`from-cyan-500/[0.07]`,glow:`hover:shadow-[0_14px_34px_-16px_rgba(34,211,238,0.45)]`},violet:{stripe:`border-violet-500/60`,label:`text-violet-400`,value:`text-violet-400`,spark:`text-violet-400`,wash:`from-violet-500/[0.07]`,glow:`hover:shadow-[0_14px_34px_-16px_rgba(139,92,246,0.45)]`},fuchsia:{stripe:`border-fuchsia-500/60`,label:`text-fuchsia-400`,value:`text-fuchsia-400`,spark:`text-fuchsia-400`,wash:`from-fuchsia-500/[0.07]`,glow:`hover:shadow-[0_14px_34px_-16px_rgba(217,70,239,0.45)]`},amber:{stripe:`border-amber-500/60`,label:`text-amber-400`,value:`text-amber-400`,spark:`text-amber-400`,wash:`from-amber-500/[0.07]`,glow:`hover:shadow-[0_14px_34px_-16px_rgba(251,191,36,0.4)]`},rose:{stripe:`border-rose-500/60`,label:`text-rose-400`,value:`text-rose-400`,spark:`text-rose-400`,wash:`from-rose-500/[0.07]`,glow:`hover:shadow-[0_14px_34px_-16px_rgba(251,113,133,0.4)]`}};function jU({label:e,value:t,subtitle:n,accent:r,hint:i,sparklinePoints:a}){let o=AU[r],s=a&&a.length>=2;return(0,w.jsxs)(`div`,{className:`group relative overflow-hidden rounded-lg border-t-2 ${o.stripe} el-raised p-5 transition-all duration-200 hover:-translate-y-0.5 ${o.glow}`,title:i,children:[(0,w.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 bg-gradient-to-b ${o.wash} to-transparent opacity-60 transition-opacity duration-200 group-hover:opacity-100`}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsx)(`p`,{className:`${o.label} text-[10px] uppercase tracking-wider font-medium`,children:e}),(0,w.jsx)(`p`,{className:`text-3xl font-bold font-mono ${o.value} mt-2 tabular-nums tracking-tight`,children:t}),n&&(0,w.jsx)(`p`,{className:`t-secondary text-xs mt-1`,children:n}),s&&(0,w.jsx)(`div`,{className:`mt-3 ${o.spark}`,children:(0,w.jsx)(kU,{points:a,height:28})})]})]})}function MU({text:e}){return(0,w.jsx)(`span`,{title:e,className:`inline-flex h-3.5 w-3.5 items-center justify-center rounded-full border border-border-subtle text-[9px] font-semibold t-tertiary cursor-help select-none`,"aria-label":e,children:`i`})}function NU({mech:e,data:t,tierMax:n}){let r=vL(e),i=Math.max(2,t.tokens_saved/(n||1)*100);return(0,w.jsxs)(`div`,{className:`flex items-center gap-2.5 text-xs`,children:[(0,w.jsx)(`span`,{className:`size-2 shrink-0 rounded-sm ${r.bar}`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`${r.text} w-28 shrink-0 truncate font-medium`,children:fL(e)}),(0,w.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-white/[0.06]`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full ${r.bar} opacity-80`,style:{width:`${i}%`}})}),(0,w.jsx)(`span`,{className:`w-14 shrink-0 text-right font-mono tabular-nums t-secondary`,children:Q(t.tokens_saved)}),(0,w.jsxs)(`span`,{className:`w-9 shrink-0 text-right font-mono tabular-nums t-tertiary`,children:[t.event_count,`×`]})]})}function PU({tier:e,pct:t,perTurn:n,primary:r,title:i,caption:a,proof:o}){let s=e.entries[0]?.[1].tokens_saved??1,c=n>0?e.tokens*n:0;return(0,w.jsxs)(`div`,{className:r?`rounded-lg border border-emerald-500/25 bg-emerald-500/[0.04] p-4`:`rounded-lg border border-border-subtle/60 p-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-end justify-between gap-4`,children:[(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`h4`,{className:`text-base font-semibold ${r?`text-foreground-emphasis`:`text-foreground`}`,children:i}),r&&(0,w.jsx)(`span`,{className:`rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-300`,children:`only unerr`})]}),(0,w.jsx)(`p`,{className:`t-tertiary mt-0.5 text-xs leading-tight`,children:a})]}),(0,w.jsxs)(`div`,{className:`shrink-0 text-right`,children:[(0,w.jsxs)(`div`,{className:`font-mono text-2xl font-bold tabular-nums ${r?`text-emerald-300`:`t-secondary`}`,children:[t,`%`]}),(0,w.jsxs)(`div`,{className:`font-mono text-[11px] tabular-nums t-tertiary`,children:[Q(e.tokens),` tok`,c>0?` · ~${Q(c)} turns`:``]})]})]}),(0,w.jsx)(`div`,{className:`mt-3 overflow-hidden rounded-full bg-white/[0.06] ${r?`h-3`:`h-2`}`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full ${r?`bg-gradient-to-r from-violet-500 to-emerald-400`:`bg-zinc-500/70`}`,style:{width:`${Math.max(2,t)}%`}})}),e.entries.length>0&&(0,w.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:e.entries.map(([e,t])=>(0,w.jsx)(NU,{mech:e,data:t,tierMax:s},e))}),o&&(0,w.jsx)(`p`,{className:`mt-3 border-t border-border-subtle/50 pt-2 text-[11px] leading-snug t-tertiary`,children:o})]})}function FU({byMechanism:e,totalSaved:t}){let{url:n,queryKey:r}=Ot(),i=N({queryKey:r([`token-flow`,`headroom`]),queryFn:()=>O(n(`/api/token-flow/headroom`)),refetchInterval:3e4}).data?.data?.since_install,a=i&&i.total_tokens_saved>0?i.headroom_turns/i.total_tokens_saved:0,o=N({queryKey:r([`token-flow`,`reversibility`]),queryFn:()=>O(n(`/api/token-flow/reversibility`)),refetchInterval:3e4}).data?.data,s=o?.rerequest_saved_tokens??0,c=o?.dropped_low_importance??0,l=o?.query_relevance_pruned??0,u=(o?.cache_hits??0)+(o?.cache_misses??0),d=u>0?Math.round((o?.cache_hits??0)/u*100):0,{intelligence:f,compression:p,total:m}=dL(e),h=m||t||1,g=Math.round(f.tokens/h*100),_=Math.max(0,100-g),v=e.graph_query?.event_count??0,y=e.file_read?.event_count??0,b=v+y>0?`Earned across ${Q(v)} graph lookup${v===1?``:`s`} served and ${Q(y)} targeted read${y===1?``:`s`} — payloads a text-only optimizer would have pulled in full.`:void 0;return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Where your savings come from`}),(0,w.jsx)(MU,{text:`Every saved token is attributed to one of two origins. Understanding-your-code = graph queries and graph-guided reads (file_outline / get_entity served a slice instead of a full file). Compressing-output = trimming the bytes of tool output. The split is exhaustive: the two tiers sum to your total. Turns are estimated from each tier's share of compounded headroom.`})]}),(0,w.jsxs)(`p`,{className:`t-tertiary mb-4 max-w-2xl text-xs leading-snug`,children:[`Trimming tool output saves tokens — every token tool does it. unerr also`,` `,(0,w.jsx)(`span`,{className:`text-foreground`,children:`understands your code`}),`, so it serves the right slice instead of raw bytes. On this install, that's where most of your savings come from.`]}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsx)(PU,{tier:f,pct:g,perTurn:a,primary:!0,title:`Understanding your code`,caption:`graph queries + graph-guided reads — needs a live map of the repo`,proof:b}),(0,w.jsx)(PU,{tier:p,pct:_,perTurn:a,primary:!1,title:`Compressing output`,caption:`trimming tool output — table-stakes for any token tool`})]}),(s>0||c>0||l>0)&&(0,w.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-1 rounded-lg border border-violet-500/20 bg-violet-500/[0.04] px-3 py-2 text-[11px] t-tertiary`,children:[(0,w.jsx)(`span`,{className:`font-medium text-violet-300`,children:`understanding-side wins`}),s>0&&(0,w.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[Q(s),` tok reused (slice pull-back, `,d,`% cache hit)`]}),c>0&&(0,w.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[Q(c),` low-centrality items dropped`]}),l>0&&(0,w.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[Q(l),` chunks query-pruned`]})]}),(0,w.jsx)(`div`,{className:`mt-4 border-t border-border-subtle pt-3`,children:(0,w.jsxs)(`p`,{className:`text-sm leading-snug t-secondary`,children:[(0,w.jsxs)(`span`,{className:`font-semibold text-emerald-300`,children:[g,`%`]}),` of every token unerr saves comes from`,` `,(0,w.jsx)(`span`,{className:`text-foreground-emphasis`,children:`understanding your code`}),` `,`— work that output compression alone can't reach.`]})})]})}var IU={shell_compression:`#06b6d4`,format_encoding:`#f59e0b`,session_dedup:`#10b981`,smart_truncation:`#3b82f6`,file_read:`#6366f1`,fetch_url:`#14b8a6`},LU=`#a1a1aa`;function RU(e){return IU[e]??LU}function zU(e,t){let n=new Date(e);return t===`hour`?n.toLocaleString([],{month:`short`,day:`numeric`,hour:`2-digit`}):n.toLocaleDateString([],{month:`short`,day:`numeric`})}function BU({fromTs:e,toTs:t,bucket:n=`day`}){let{url:r,queryKey:i}=Ot(),[a,o]=(0,f.useState)(null),s=new URLSearchParams;e&&s.set(`from_ts`,e),t&&s.set(`to_ts`,t),s.set(`bucket`,n);let c=N({queryKey:i([`token-flow-series`,e??``,t??``,n]),queryFn:()=>O(r(`/api/token-flow/series?${s.toString()}`)),refetchInterval:3e4}),l=c.data?.data??[],u=(0,f.useMemo)(()=>{let e=new Set;for(let t of l)for(let n of Object.keys(t.by_mechanism))e.add(n);let t=lL.filter(t=>e.has(t)),n=[...e].filter(e=>!lL.includes(e));return[...t,...n]},[l]),d=(0,f.useMemo)(()=>Math.max(0,...l.map(e=>e.total_saved)),[l]);if(c.isLoading)return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-3`,children:`Savings Trend`}),(0,w.jsx)(`div`,{className:`h-48 animate-pulse bg-white/[0.06] rounded`})]});if(l.length===0)return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-1`,children:`Savings Trend`}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mb-3`,children:[`Tokens saved per `,n,`, stacked by mechanism.`]}),(0,w.jsx)(`p`,{className:`t-secondary text-sm py-6 text-center`,children:`No bucketed savings data yet.`})]});let p=Math.max(1,(756-(l.length-1)*2)/Math.max(1,l.length)),m=[0,.25,.5,.75,1].map(e=>Math.round(d*e));return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 mb-1`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Savings Trend`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[l.length,` `,n,l.length===1?``:`s`,` · peak `,Q(d),` tok`]})]}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mb-3 leading-snug`,children:[`Tokens saved per `,n,`, stacked by mechanism. Hover a bar for the breakdown.`]}),(0,w.jsxs)(`div`,{className:`relative`,children:[(0,w.jsxs)(`svg`,{"aria-label":`Savings trend over time`,role:`img`,viewBox:`0 0 800 200`,className:`w-full h-48`,preserveAspectRatio:`none`,onMouseLeave:()=>o(null),children:[(0,w.jsxs)(`title`,{children:[`Tokens saved per `,n,`, stacked by mechanism`]}),m.map((e,t)=>{let n=178-t/4*170;return(0,w.jsxs)(`g`,{children:[(0,w.jsx)(`line`,{x1:36,x2:792,y1:n,y2:n,stroke:`currentColor`,className:`text-border-subtle`,strokeWidth:.5,strokeDasharray:t===0?``:`2 2`}),(0,w.jsx)(`text`,{x:32,y:n+3,textAnchor:`end`,className:`t-tertiary`,style:{fontSize:`9px`},children:Q(e)})]},`ytick-${t}`)}),l.map((e,t)=>{let n=36+t*(p+2),r=178,i=a===t;return(0,w.jsxs)(`g`,{onMouseEnter:()=>o(t),style:{cursor:`pointer`},children:[u.map(t=>{let a=e.by_mechanism[t]??0;if(a<=0)return null;let o=d>0?a/d*170:0;return r-=o,(0,w.jsx)(`rect`,{x:n,y:r,width:p,height:o,fill:RU(t),opacity:i?1:.85},t)}),(0,w.jsx)(`rect`,{x:n,y:8,width:p,height:170,fill:`transparent`})]},e.ts)}),[0,Math.floor(l.length/2),l.length-1].filter((e,t,n)=>n.indexOf(e)===t).map(e=>{let t=l[e];return t?(0,w.jsx)(`text`,{x:36+e*(p+2)+p/2,y:194,textAnchor:`middle`,className:`t-tertiary`,style:{fontSize:`9px`},children:zU(t.ts,n)},t.ts):null})]}),a!==null&&l[a]&&(0,w.jsxs)(`div`,{className:`absolute top-2 right-2 el-raised rounded-md p-3 text-xs shadow-lg max-w-[220px] pointer-events-none`,children:[(0,w.jsx)(`p`,{className:`t-secondary text-[10px] uppercase tracking-wider mb-1`,children:zU(l[a].ts,n)}),(0,w.jsxs)(`p`,{className:`text-success font-mono font-bold tabular-nums mb-2`,children:[Q(l[a].total_saved),` tok`]}),(0,w.jsx)(`div`,{className:`space-y-1`,children:u.map(e=>({mech:e,saved:l[a]?.by_mechanism[e]??0})).filter(e=>e.saved>0).sort((e,t)=>t.saved-e.saved).map(({mech:e,saved:t})=>(0,w.jsxs)(`div`,{className:`flex items-center gap-2 tabular-nums`,children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm shrink-0`,style:{backgroundColor:RU(e)}}),(0,w.jsx)(`span`,{className:`${cL[e]?.text??`text-zinc-400`} flex-1 truncate`,children:e.replace(/_/g,` `)}),(0,w.jsx)(`span`,{className:`font-mono t-secondary`,children:Q(t)})]},e))})]})]}),(0,w.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 mt-3 text-[10px]`,children:u.map(e=>(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,w.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-sm`,style:{backgroundColor:RU(e)}}),(0,w.jsx)(`span`,{className:`${cL[e]?.text??`text-zinc-400`} truncate`,children:e.replace(/_/g,` `)})]},e))})]})}function VU(e,t=900){let[n,r]=(0,f.useState)(e),i=(0,f.useRef)(!1);return(0,f.useEffect)(()=>{if(i.current||e<=0){r(e);return}if(typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches){r(e);return}i.current=!0;let n=0,a=performance.now(),o=i=>{let s=Math.min(1,(i-a)/t);r(e*(1-(1-s)**3)),s<1?n=requestAnimationFrame(o):r(e)};return n=requestAnimationFrame(o),()=>cancelAnimationFrame(n)},[e,t]),n}function HU({value:e,format:t,prefix:n}){let r=VU(e);return(0,w.jsxs)(w.Fragment,{children:[n,t(Math.round(r))]})}function UU({text:e,label:t}){let[n,r]=(0,f.useState)(!1),i=(0,f.useId)();return(0,w.jsxs)(`span`,{className:`relative inline-flex align-middle`,children:[(0,w.jsx)(`button`,{type:`button`,"aria-label":t??`More information`,"aria-describedby":n?i:void 0,className:`inline-flex h-4 w-4 items-center justify-center rounded-full border border-border-subtle font-mono text-[9px] font-bold leading-none t-tertiary transition-colors hover:border-violet-400 hover:text-violet-300 focus-visible:text-violet-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-violet-400`,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),onKeyDown:e=>{e.key===`Escape`&&r(!1)},children:`i`}),n?(0,w.jsx)(`span`,{role:`tooltip`,id:i,className:`absolute left-1/2 top-full z-30 mt-2 w-64 -translate-x-1/2 rounded-lg border border-border-subtle bg-background px-3 py-2 text-left text-[11px] font-normal normal-case leading-snug tracking-normal t-secondary shadow-xl`,children:e}):null]})}function WU({storageKey:e,children:t}){let[n,r]=(0,f.useState)(()=>{try{return localStorage.getItem(e)===`1`}catch{return!1}}),i=(0,f.useCallback)(()=>{r(!0);try{localStorage.setItem(e,`1`)}catch{}},[e]);return n?null:(0,w.jsxs)(`div`,{className:`relative mt-4 rounded-lg border border-violet-500/20 bg-violet-500/4 px-4 py-3`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:i,className:`absolute right-3 top-3 text-[10px] font-medium text-violet-400 hover:text-violet-300 transition-colors`,"aria-label":`Dismiss explanation`,children:`Got it`}),t]})}function GU(e){if(!e)return`unknown`;let t=e.toLowerCase();return t.includes(`cursor`)||t.includes(`copilot`)?`credit`:t.includes(`claude`)||t.includes(`windsurf`)?`window`:`unknown`}function KU({label:e,rawValue:t,subtitle:n,accent:r,hint:i,prefix:a,sparklinePoints:o}){let s=VU(t);return(0,w.jsx)(jU,{label:e,value:`${a??``}${Q(Math.round(s))}`,subtitle:n,accent:r,hint:i,sparklinePoints:o})}function qU({mechanisms:e,totalSaved:t}){let n=Object.entries(e).sort(([,e],[,t])=>t.tokens_saved-e.tokens_saved);if(n.length===0)return(0,w.jsx)(`p`,{className:`t-secondary text-sm py-3`,children:`No mechanism data.`});let r=n[0][1].tokens_saved||1;return(0,w.jsx)(`div`,{className:`space-y-1.5`,children:n.map(([e,t])=>{let n=vL(e),i=Math.max(3,t.tokens_saved/r*100);return(0,w.jsxs)(`div`,{className:`flex items-center gap-3 py-0.5`,children:[(0,w.jsx)(`span`,{className:`${n.text} text-xs font-medium w-36 shrink-0 truncate`,children:e.replace(/_/g,` `)}),(0,w.jsx)(`div`,{className:`flex-1 h-5 rounded bg-white/[0.06] overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full ${n.bar} opacity-80 rounded`,style:{width:`${i}%`}})}),(0,w.jsx)(`span`,{className:`text-success font-mono text-xs w-14 text-right shrink-0`,children:Q(t.tokens_saved)}),(0,w.jsxs)(`span`,{className:`t-tertiary font-mono text-xs w-10 text-right shrink-0`,children:[t.pct_of_total,`%`]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs w-8 text-right shrink-0`,children:[t.event_count,`×`]})]},e)})})}function JU({scope:e,sessionId:t,fromTs:n,toTs:r}){let{url:i,queryKey:a}=Ot(),o=n||r?`${n?`&from_ts=${n}`:``}${r?`&to_ts=${r}`:``}`:``,s=N({queryKey:a([`behavior-events`,e,t??``,n??``,r??``]),queryFn:()=>e===`global`?O(i(`/api/behavior-events/global?_=1${o}`)).then(e=>e.data.counts):O(i(`/api/behavior-events/session?${t?`session_id=${t}`:`_=1`}`)).then(e=>e.data.counts),refetchInterval:5e3}),c=s.data,l=e===`global`?n||r?``:` (all time)`:` (this session)`,u=(0,f.useMemo)(()=>c?Object.entries(c.by_type).filter(([e,t])=>t>0&&!pL.has(e)).sort(([,e],[,t])=>t-e):[],[c]),d=u.reduce((e,[,t])=>e+t,0);return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,w.jsxs)(`h3`,{className:`t-secondary text-sm font-medium`,children:[`Mistakes prevented`,l]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[Q(d),` caught`]})]}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mb-3 leading-snug`,children:`Problems unerr caught before they reached your code — hover any row to see what would have gone wrong without it.`}),s.isLoading?(0,w.jsx)(Ht,{height:120}):u.length===0?(0,w.jsx)(`p`,{className:`t-secondary text-sm py-3`,children:`No issues caught yet — unerr starts tracking as soon as your agent calls a tool.`}):(0,w.jsx)(`div`,{className:`space-y-1.5`,children:u.map(([e,t])=>(0,w.jsxs)(`div`,{className:`flex items-center gap-3 py-1 group cursor-default`,title:hL[e]??e,children:[(0,w.jsx)(`span`,{className:`text-violet-300 text-xs font-medium w-52 shrink-0 truncate`,children:mL[e]??e.replace(/_/g,` `)}),(0,w.jsx)(`div`,{className:`flex-1 h-5 rounded bg-white/[0.06] overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full bg-violet-500 opacity-80 rounded`,style:{width:`${Math.max(3,t/(u[0]?.[1]||1)*100)}%`}})}),(0,w.jsx)(`span`,{className:`text-violet-200 font-mono text-xs w-14 text-right shrink-0`,children:Q(t)})]},e))})]})}function YU(){let{url:e,queryKey:t}=Ot(),n=N({queryKey:t([`overhead-levers`]),queryFn:()=>O(e(`/api/token-flow/overhead-levers`)).then(e=>e.data),refetchInterval:5e3}),r=n.data,i=(0,f.useMemo)(()=>r?Object.entries(r.recon.by_task_size).sort(([,e],[,t])=>t-e):[],[r]),a=i.reduce((e,[,t])=>e+t,0);return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Token-overhead levers`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[r?Q(r.recon.count):`—`,` recon calls`]})]}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mb-3 leading-snug`,children:[`Server-side proof the round-trip-reduction levers fire: one`,` `,(0,w.jsx)(`code`,{children:`unerr recon`}),` call replaces the ~5-call discovery fan-out, the footprint self-selects by task size, and verbose hook banners drop to terse after their first emission. The absolute cache_read/cache_write bill is measured offline (`,(0,w.jsx)(`code`,{children:`scripts/measure-token-baseline.mjs`}),`).`]}),n.isLoading?(0,w.jsx)(Ht,{height:120}):!r||r.recon.count===0&&r.ceremony.suppressed_count===0?(0,w.jsxs)(`p`,{className:`t-secondary text-sm py-3`,children:[`No levers fired yet — run `,(0,w.jsx)(`code`,{children:`unerr recon "<task>"`}),` or edit a file twice to move the counters.`]}):(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,w.jsxs)(`div`,{className:`rounded-lg bg-white/[0.04] px-3 py-2.5`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-xs`,children:`recon calls`}),(0,w.jsx)(`div`,{className:`text-violet-200 font-mono text-lg`,children:Q(r.recon.count)}),(0,w.jsxs)(`div`,{className:`t-tertiary text-xs`,children:[`avg `,r.recon.avg_sections,` sections · ~`,Q(r.recon.avg_tokens),` `,`tok`]})]}),(0,w.jsxs)(`div`,{className:`rounded-lg bg-white/[0.04] px-3 py-2.5`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-xs`,children:`large sweeps`}),(0,w.jsxs)(`div`,{className:`text-violet-200 font-mono text-lg`,children:[r.recon.pct_large_sweep,`%`]}),(0,w.jsxs)(`div`,{className:`t-tertiary text-xs`,children:[r.recon.pct_digest,`% emitted digest`]})]}),(0,w.jsxs)(`div`,{className:`rounded-lg bg-white/[0.04] px-3 py-2.5`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-xs`,children:`banners suppressed`}),(0,w.jsx)(`div`,{className:`text-violet-200 font-mono text-lg`,children:Q(r.ceremony.suppressed_count)}),(0,w.jsx)(`div`,{className:`t-tertiary text-xs`,children:`once per session`})]})]}),i.length>0&&(0,w.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,w.jsx)(`div`,{className:`t-tertiary text-xs mb-1`,children:`Task-size mix`}),i.map(([e,t])=>(0,w.jsxs)(`div`,{className:`flex items-center gap-3 py-0.5`,children:[(0,w.jsx)(`span`,{className:`text-violet-300 text-xs font-medium w-32 shrink-0 truncate`,children:e.replace(/_/g,` `)}),(0,w.jsx)(`div`,{className:`flex-1 h-5 rounded bg-white/[0.06] overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full bg-violet-500 opacity-80 rounded`,style:{width:`${Math.max(3,t/(i[0]?.[1]||1)*100)}%`}})}),(0,w.jsxs)(`span`,{className:`text-violet-200 font-mono text-xs w-20 text-right shrink-0`,children:[Q(t),` (`,a>0?Math.round(t/a*100):0,`%)`]})]},e))]})]})]})}function XU({sessionId:e,turn:t}){let{url:n,queryKey:r}=Ot(),i=N({queryKey:r([`behavior-events-turn`,e,t]),queryFn:()=>O(n(`/api/behavior-events/events?session_id=${e}&turn=${t}&limit=200`)),refetchInterval:5e3});if(i.isLoading)return(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-5`,children:(0,w.jsx)(Ht,{height:80})});let a=(i.data?.data??[]).filter(e=>!pL.has(e.type));return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Mistakes prevented in this turn`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[a.length,` caught`]})]}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mb-3 leading-snug`,children:[`Each row is something unerr caught during turn #`,t,` — hover for details on what would have gone wrong.`]}),a.length===0?(0,w.jsx)(`p`,{className:`t-secondary text-sm py-3`,children:`No issues caught in this turn.`}):(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-left text-xs min-w-[700px]`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle t-tertiary uppercase`,children:[(0,w.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Time`}),(0,w.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`What was prevented`}),(0,w.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Tool`}),(0,w.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`File / Entity`}),(0,w.jsx)(`th`,{className:`px-3 py-2 font-medium text-right`,children:`Size`})]})}),(0,w.jsx)(`tbody`,{children:a.map(e=>(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle/40 hover:bg-white/[0.03]`,title:hL[e.type]??e.type,children:[(0,w.jsx)(`td`,{className:`px-3 py-1.5 font-mono t-tertiary whitespace-nowrap`,children:_L(e.ts)}),(0,w.jsx)(`td`,{className:`px-3 py-1.5`,children:(0,w.jsx)(`span`,{className:`text-violet-300`,children:mL[e.type]??e.type.replace(/_/g,` `)})}),(0,w.jsx)(`td`,{className:`px-3 py-1.5 font-mono t-secondary`,children:e.tool??`—`}),(0,w.jsx)(`td`,{className:`px-3 py-1.5 font-mono t-secondary truncate max-w-[260px]`,children:e.entity_key??`—`}),(0,w.jsx)(`td`,{className:`px-3 py-1.5 font-mono t-secondary text-right`,children:e.response_bytes==null?`—`:Q(e.response_bytes)})]},`${e.session_id}-${e.id}-${e.ts}`))})]})})]})}function ZU({onSelectSession:e}){let{url:t,queryKey:n}=Ot(),r=S(`from`)??``,i=S(`to`)??``,a=S(`session_offset`),o=Number(a)||0,s=(e,t)=>x({from:e||null,to:t||null,session_offset:null}),c=e=>x({session_offset:e>0?String(e):null}),l=r||i?`${r?`&from_ts=${r}`:``}${i?`&to_ts=${i}`:``}`:``,u=N({queryKey:n([`token-flow-global`,r,i]),queryFn:()=>O(t(`/api/token-flow/global?_=1${l}`)),refetchInterval:5e3}),d=N({queryKey:n([`token-flow-sessions`,r,i,o]),queryFn:()=>O(t(`/api/token-flow/sessions?limit=10&offset=${o}${l}`)),refetchInterval:5e3});if(u.isLoading)return(0,w.jsx)(Wt,{n:4});let f=u.data?.data,p=d.data?.data??[],m=d.data?.total??0;return!f||f.event_count===0?(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-10 text-center`,children:[(0,w.jsx)(`p`,{className:`t-secondary text-lg`,children:`No token flow data yet`}),(0,w.jsx)(`p`,{className:`t-tertiary mt-2 text-sm`,children:`Token savings appear here as the agent makes tool calls through unerr.`}),(0,w.jsx)(`p`,{className:`t-tertiary mt-1 text-xs`,children:`Sources: graph queries, shell compression, format encoding, session dedup, smart truncation, file reads, behavior automation.`})]}):(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-end gap-3 flex-wrap -mt-2`,children:[(0,w.jsx)(KV,{fromTs:r,toTs:i,onChange:(e,t)=>s(e,t)}),(0,w.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 rounded-md border border-border-subtle px-3 py-1.5 text-xs font-medium t-secondary transition-colors hover:border-border-strong hover:bg-white/[0.06] hover:text-foreground`,title:`Export all token flow data as CSV`,onClick:()=>{let e=r||i?`${r?`&from_ts=${r}`:``}${i?`&to_ts=${i}`:``}`:``;fetch(t(`/api/token-flow/events?limit=500${e}`)).then(e=>e.json()).then(e=>{let t=e.data??[];if(t.length===0)return;let n=[`timestamp`,`session_id`,`turn`,`mechanism`,`tool`,`tokens_without`,`tokens_with`,`tokens_saved`,`detail`],r=t.map(e=>[e.ts,e.session_id,e.turn,e.mechanism,e.tool??``,e.tokens_without,e.tokens_with,e.tokens_saved,(e.detail??``).toString().replace(/"/g,`""`)].map(e=>`"${e}"`).join(`,`)),i=[n.join(`,`),...r].join(`
|
|
917
|
+
`),a=new Blob([i],{type:`text/csv`}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=`token-economics-${new Date().toISOString().slice(0,10)}.csv`,s.click(),URL.revokeObjectURL(o)})},children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z`})}),`Export CSV`]})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,w.jsx)(KU,{label:`Tokens Saved`,rawValue:f.total_tokens_saved,subtitle:`direct rescue`,accent:`emerald`,hint:`Tokens removed from agent responses before they could weigh down context`}),(0,w.jsx)(KU,{label:`Context Avoided`,rawValue:f.total_context_avoided,subtitle:f.total_tokens_saved>0?`${(f.total_context_avoided/f.total_tokens_saved).toFixed(1)}× compounded`:`carried forward`,accent:`cyan`,hint:`Cumulative token-turns of context pressure prevented — savings compound because each turn's rescue carries forward to all future turns`}),(0,w.jsx)(jU,{label:`Rescue Rate`,value:`${f.efficiency_pct}%`,subtitle:`tokens kept out`,accent:`violet`,hint:`Share of original tokens that unerr rescued (saved ÷ original)`}),(0,w.jsx)(KU,{label:`Sessions`,rawValue:f.total_sessions,subtitle:`${f.total_turns} turn${f.total_turns===1?``:`s`}`,accent:`fuchsia`,hint:`Distinct agent sessions tracked, plus total turns across them`})]}),(0,w.jsx)(FU,{byMechanism:f.by_mechanism,totalSaved:f.total_tokens_saved}),f.avg_context_reduction>0&&(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4 border-l-2 border-cyan-500/60`,children:[(0,w.jsx)(`h3`,{className:`text-foreground text-sm font-medium`,children:`Carry-Forward Savings`}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mt-1 max-w-2xl leading-snug`,children:[`Each turn ran with`,` `,(0,w.jsx)(`span`,{className:`text-cyan-400 font-medium`,children:Q(f.avg_context_reduction)}),` `,`fewer tokens on average across `,f.total_turns,` turn`,f.total_turns===1?``:`s`,`, peaking at`,` `,Q(f.peak_context_reduction),`.`]})]}),(0,w.jsx)(BU,{fromTs:r,toTs:i,bucket:`day`}),(0,w.jsx)(JU,{scope:`global`,fromTs:r,toTs:i}),(0,w.jsx)(YU,{}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg overflow-hidden`,children:[(0,w.jsxs)(`div`,{className:`px-5 py-3 border-b border-border-subtle flex items-center justify-between`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Sessions`}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[m,` session`,m===1?``:`s`]})]}),p.length===0?(0,w.jsx)(`p`,{className:`px-5 py-6 t-secondary text-sm`,children:`No sessions recorded.`}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`divide-y divide-border-subtle`,children:p.map((t,n)=>(t.total_saved>0&&t.avg_context_reduction>0&&Math.round(t.total_saved/(t.total_saved+t.total_turns*(t.avg_context_reduction||1))*100),(0,w.jsxs)(`div`,{className:`group relative cursor-pointer px-5 py-4 transition-all hover:bg-white/3`,onClick:()=>e(t.session_id),children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,w.jsx)(`span`,{className:`font-mono text-xs text-foreground group-hover:text-violet-400 transition-colors shrink-0`,children:t.session_id.slice(0,12)}),n===0&&o===0&&(0,w.jsx)(`span`,{className:`rounded-full bg-emerald-500/20 text-emerald-400 px-2 py-0.5 text-[10px] font-medium shrink-0`,children:`latest`}),(0,w.jsx)(oL,{name:t.agent_name}),(0,w.jsx)(`span`,{className:`t-tertiary text-xs shrink-0`,children:gL(t.last_ts)})]}),(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-violet-400 opacity-0 group-hover:opacity-100 transition-opacity font-medium whitespace-nowrap shrink-0`,children:[`View`,` `,(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 5l7 7-7 7`})})]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-4 mt-2.5 flex-wrap`,children:[(0,w.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,w.jsx)(`span`,{className:`text-emerald-400 font-mono font-semibold text-sm tabular-nums`,children:Q(t.total_saved)}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`saved`})]}),t.avg_context_reduction>0&&(0,w.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,w.jsx)(`span`,{className:`text-cyan-400 font-mono font-semibold text-sm tabular-nums`,children:Q(t.avg_context_reduction)}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:`avg ctx/turn`})]}),(0,w.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,w.jsx)(`span`,{className:`t-secondary font-mono text-xs tabular-nums`,children:t.total_turns}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px]`,children:[`turn`,t.total_turns===1?``:`s`]})]}),(0,w.jsxs)(`span`,{className:`inline-flex items-baseline gap-1.5`,children:[(0,w.jsx)(`span`,{className:`t-secondary font-mono text-xs tabular-nums`,children:t.event_count}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px]`,children:[`event`,t.event_count===1?``:`s`]})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-1 ml-auto`,children:[t.mechanisms.slice(0,4).map(e=>(0,w.jsx)(xL,{mechanism:e},e)),t.mechanisms.length>4&&(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px]`,children:[`+`,t.mechanisms.length-4]})]})]}),(0,w.jsx)(`div`,{className:`h-0 overflow-hidden group-hover:h-auto group-hover:mt-2.5 transition-all`,children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-rose-500/6 border border-rose-500/10 px-3 py-1.5`,children:[(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3 h-3 text-rose-400 shrink-0`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z`})}),(0,w.jsxs)(`span`,{className:`text-rose-300/80 text-[10px]`,children:[`Without unerr: `,Q(t.total_saved),` extra tokens in every subsequent turn's context`,t.avg_context_reduction>0&&` · ${Q(t.avg_context_reduction)} avg context pressure per turn`]})]})})]},t.session_id)))}),(0,w.jsx)(`div`,{className:`px-5 py-2 border-t border-border-subtle`,children:(0,w.jsx)(qV,{total:m,limit:10,offset:o,onPageChange:c})})]})]})]})}function QU({sessionId:e,onSelectTurn:t}){let{url:n,queryKey:r}=Ot(),[i,a]=(0,f.useState)(0),o=N({queryKey:r([`token-flow-session`,e]),queryFn:()=>O(n(`/api/token-flow/session${e?`?session_id=${e}`:``}`)),refetchInterval:5e3}),s=N({queryKey:r([`token-flow-cumulative`,e]),queryFn:()=>O(n(`/api/token-flow/cumulative?session_id=${e}`)),refetchInterval:5e3}),c=N({queryKey:r([`token-flow-events`,e]),queryFn:()=>O(n(`/api/token-flow/events?session_id=${e}`)),refetchInterval:5e3});if(o.isLoading)return(0,w.jsx)(Wt,{n:4});let l=o.data?.data,u=s.data?.data??[],d=c.data?.data??[];if(!l)return(0,w.jsx)(`div`,{className:`el-raised rounded-lg p-8 text-center`,children:(0,w.jsxs)(`p`,{className:`t-secondary`,children:[`No data for session `,e.slice(0,12)]})});let p=new Map;for(let e of d){let t=p.get(e.turn)??[];t.push(e),p.set(e.turn,t)}let m=[...p.entries()].sort(([e],[t])=>t-e),h=m.slice(i*10,(i+1)*10),g=h.reduce((e,[,t])=>{let n=t.reduce((e,t)=>e+t.tokens_saved,0);return Math.max(e,n)},1),_=new Map;for(let e of u)_.set(e.turn,e);return(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,w.jsx)(KU,{label:`Tokens Saved`,rawValue:l.total_tokens_saved,subtitle:`direct rescue`,accent:`emerald`,hint:`Tokens unerr rescued from agent responses this session`}),(0,w.jsx)(KU,{label:`Context Avoided`,rawValue:s.data?.total_context_avoided??0,subtitle:l.total_tokens_saved>0&&(s.data?.total_context_avoided??0)>0?`${((s.data?.total_context_avoided??0)/l.total_tokens_saved).toFixed(1)}× compounded`:`carried forward`,accent:`cyan`,hint:`Cumulative token-turns of context pressure prevented this session`}),(0,w.jsx)(jU,{label:`Rescue Rate`,value:`${l.efficiency_pct}%`,subtitle:`tokens kept out`,accent:`violet`,hint:`Share of original tokens rescued (saved ÷ original)`}),(0,w.jsx)(KU,{label:`Turns`,rawValue:l.total_turns,subtitle:`${l.event_count} event${l.event_count===1?``:`s`}`,accent:`fuchsia`,hint:`Conversation turns in this session`})]}),(s.data?.avg_context_reduction??0)>0&&(()=>{let e=s.data;return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4 border-l-2 border-cyan-500/60`,children:[(0,w.jsx)(`h3`,{className:`text-foreground text-sm font-medium`,children:`Carry-Forward Savings`}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mt-1 max-w-2xl leading-snug`,children:[`Each turn ran with`,` `,(0,w.jsx)(`span`,{className:`text-cyan-400 font-medium`,children:Q(e.avg_context_reduction)}),` `,`fewer tokens on average across `,l.total_turns,` turn`,l.total_turns===1?``:`s`,`, peaking at`,` `,Q(e.peak_context_reduction),`.`]})]})})(),(0,w.jsx)(FU,{byMechanism:l.by_mechanism,totalSaved:l.total_tokens_saved}),(0,w.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-1`,children:`Cumulative Savings`}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mb-3`,children:[`Each bar = cumulative tokens saved through that turn. Showing latest`,` `,Math.min(60,u.length),` of `,u.length,` turns. Hover for details.`]}),u.length===0?(0,w.jsx)(`div`,{className:`h-[140px] flex items-center justify-center`,children:(0,w.jsx)(`p`,{className:`t-tertiary text-xs`,children:`Loading chart data...`})}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`div`,{className:`flex gap-[3px]`,style:{height:`140px`},children:u.slice(-60).map(e=>{let n=u[u.length-1]?.cumulative_tokens_saved||1,r=e.cumulative_tokens_saved/n*100;return(0,w.jsxs)(`div`,{className:`group relative flex-1 min-w-[6px] max-w-[28px] h-full flex items-end`,children:[(0,w.jsx)(`div`,{className:`w-full ${vL(Object.entries(e.mechanisms_this_turn).sort(([,e],[,t])=>t-e)[0]?.[0]??`shell_compression`).bar} opacity-70 hover:opacity-100 rounded-t transition-all cursor-pointer`,style:{height:`${Math.max(4,r)}%`},onClick:()=>t(e.turn)}),(0,w.jsx)(`div`,{className:`absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-20 pointer-events-none`,children:(0,w.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-700 rounded-lg px-3 py-2 text-xs whitespace-nowrap shadow-xl`,children:[(0,w.jsxs)(`div`,{className:`font-medium text-foreground`,children:[`Turn #`,e.turn]}),(0,w.jsx)(`div`,{className:`t-tertiary mt-0.5`,children:e.tools.join(`, `)||`exec`}),(0,w.jsxs)(`div`,{className:`text-success mt-1`,children:[`+`,Q(e.tokens_saved_this_turn),` this turn`]}),(0,w.jsxs)(`div`,{className:`t-secondary`,children:[`Cumulative: `,Q(e.cumulative_tokens_saved)]}),(0,w.jsxs)(`div`,{className:`text-cyan-400 mt-0.5`,children:[`Context avoided: `,Q(e.context_avoided)]}),(0,w.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:Object.keys(e.mechanisms_this_turn).map(e=>(0,w.jsx)(xL,{mechanism:e},e))})]})})]},e.turn)})}),(0,w.jsxs)(`div`,{className:`flex justify-between mt-1.5`,children:[(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:[`T`,u.length>60?u.length-59:1]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px] font-mono`,children:[`T`,u.length]})]}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-3 mt-3 pt-3 border-t border-border-subtle/50`,children:lL.filter(e=>u.some(t=>e in t.mechanisms_this_turn)).map(e=>(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,w.jsx)(`div`,{className:`h-2.5 w-2.5 rounded-sm ${vL(e).bar}`}),(0,w.jsx)(`span`,{className:`t-tertiary text-[10px]`,children:e.replace(/_/g,` `)})]},e))})]})]}),(0,w.jsx)(JU,{scope:`session`,sessionId:e})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg overflow-hidden`,children:[(0,w.jsxs)(`div`,{className:`px-5 py-3 border-b border-border-subtle flex items-center justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Turns`}),(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-0.5`,children:`Click a turn to see all events and mechanisms within it.`})]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[m.length,` turn`,m.length===1?``:`s`]})]}),h.length===0?(0,w.jsx)(`p`,{className:`px-5 py-6 t-secondary text-sm`,children:`No turns recorded.`}):(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-left text-sm min-w-[800px]`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle t-tertiary text-xs uppercase`,children:[(0,w.jsx)(`th`,{className:`px-5 py-2.5 font-medium w-14`,title:`Turn number in the conversation`,children:`Turn`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,title:`Summary of what happened in this turn`,children:`Description`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium w-36`,title:`Relative savings compared to the largest turn — wider bar means more tokens saved`,children:`Savings Bar`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,title:`Types of rescue applied this turn`,children:`Mechanisms`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-right`,title:`Tokens unerr rescued from agent responses this turn (direct savings)`,children:`Saved`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-right`,title:`Cumulative tokens of context avoided at this point — prior savings carry forward, keeping context smaller for this and future turns`,children:`Context Avoided`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 font-medium text-right`,title:`Number of savings events this turn`,children:`Events`}),(0,w.jsx)(`th`,{className:`px-3 py-2.5 pr-5 font-medium w-16`})]})}),(0,w.jsx)(`tbody`,{children:h.map(([e,n])=>{let r=n.reduce((e,t)=>e+t.tokens_saved,0),i=[...new Set(n.map(e=>e.mechanism))],{label:a,subtitle:o}=bL(n),s=_.get(e);return(0,w.jsxs)(`tr`,{className:`group cursor-pointer border-b border-border-subtle transition-colors hover:bg-white/[0.04]`,onClick:()=>t(e),children:[(0,w.jsx)(`td`,{className:`px-5 py-3`,children:(0,w.jsxs)(`span`,{className:`t-tertiary font-mono text-xs group-hover:text-violet-400 transition-colors`,children:[`#`,e]})}),(0,w.jsx)(`td`,{className:`px-3 py-3`,children:(0,w.jsxs)(`div`,{className:`min-w-0 max-w-[260px]`,children:[(0,w.jsx)(`p`,{className:`text-foreground font-mono text-xs truncate group-hover:text-violet-300 transition-colors`,children:a}),o&&(0,w.jsx)(`p`,{className:`t-tertiary text-[10px] mt-0.5 truncate`,children:o})]})}),(0,w.jsx)(`td`,{className:`px-3 py-3`,children:(0,w.jsx)(`div`,{className:`w-32 h-4 relative rounded-sm bg-white/[0.06] overflow-hidden`,children:(()=>{let e=new Map;for(let t of n)e.set(t.mechanism,(e.get(t.mechanism)??0)+t.tokens_saved);let t=0;return[...e.entries()].sort(([,e],[,t])=>t-e).map(([e,n])=>{let r=g>0?n/g*100:0,i=t;return t+=r,(0,w.jsx)(`div`,{className:`absolute inset-y-0 ${vL(e).bar} opacity-80`,style:{left:`${i}%`,width:`${Math.max(1,r)}%`}},e)})})()})}),(0,w.jsx)(`td`,{className:`px-3 py-3`,children:(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:i.map(e=>(0,w.jsx)(xL,{mechanism:e},e))})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,w.jsx)(`span`,{className:`text-success font-mono font-medium text-xs`,children:Q(r)})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right`,children:s?(0,w.jsx)(`span`,{className:`text-cyan-400 font-mono font-medium text-xs`,title:`${Q(s.context_avoided)} tokens of cumulative context avoided at turn #${e}`,children:Q(s.context_avoided)}):(0,w.jsx)(`span`,{className:`t-tertiary font-mono text-xs`,children:`—`})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right`,children:(0,w.jsx)(`span`,{className:`t-tertiary text-xs`,children:n.length})}),(0,w.jsx)(`td`,{className:`pl-4 py-3 pr-5 text-right w-16`,children:(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-violet-400 opacity-0 group-hover:opacity-100 transition-opacity font-medium whitespace-nowrap`,children:[`View`,` `,(0,w.jsx)(`svg`,{"aria-hidden":`true`,className:`w-3.5 h-3.5`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:(0,w.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 5l7 7-7 7`})})]})})]},e)})})]})}),(0,w.jsx)(qV,{total:m.length,limit:10,offset:i*10,onPageChange:e=>a(Math.floor(e/10))})]})]})}function $U({sessionId:e,turn:t}){let{url:n,queryKey:r}=Ot(),i=N({queryKey:r([`token-flow-events`,e,t]),queryFn:()=>O(n(`/api/token-flow/events?session_id=${e}&turn=${t}`))}),a=N({queryKey:r([`token-flow-cumulative`,e]),queryFn:()=>O(n(`/api/token-flow/cumulative?session_id=${e}`))}),o=a.data?.data?.find(e=>e.turn===t),s=a.data?.total_turns??0,c=s>0?s-(a.data?.data?.findIndex(e=>e.turn===t)??0)-1:0,l=i.data?.data??[],[u,d]=(0,f.useState)(0),p=l.slice(u,u+10),m=l.reduce((e,t)=>e+t.tokens_saved,0),h=l.reduce((e,t)=>e+t.tokens_without,0),g=l.reduce((e,t)=>e+t.tokens_with,0),_=[...new Set(l.map(e=>e.tool).filter(Boolean))],v=h>0?Math.round(m/h*100):0,b={};for(let e of l){let t=b[e.mechanism]??{tokens_saved:0,tokens_delivered:0,event_count:0,pct_of_total:0};t.tokens_saved+=e.tokens_saved,t.tokens_delivered+=e.tokens_with,t.event_count++,b[e.mechanism]=t}for(let e of Object.values(b))e.pct_of_total=m>0?Math.round(e.tokens_saved/m*100):0;return i.isLoading?(0,w.jsx)(Wt,{n:4}):(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(()=>{let{label:e,subtitle:t}=bL(l);return(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4 border-l-4 border-violet-500/60`,children:[(0,w.jsx)(`p`,{className:`text-foreground font-mono text-sm font-medium`,children:e}),t&&(0,w.jsx)(`p`,{className:`t-tertiary text-xs mt-0.5`,children:t})]})})(),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-3`,children:[(0,w.jsx)(KU,{label:`Tokens Saved`,rawValue:m,subtitle:_.length>0?_.slice(0,2).join(`, `)+(_.length>2?` +${_.length-2}`:``):`exec`,accent:`emerald`,hint:`Tokens unerr rescued from agent responses this turn`}),(0,w.jsx)(jU,{label:`Rescue Rate`,value:`${v}%`,subtitle:`${Q(h)} → ${Q(g)}`,accent:`violet`,hint:`Share of original tokens rescued this turn (Without − Delivered)`}),(0,w.jsx)(KU,{label:`Context Avoided`,rawValue:o?.context_avoided??0,subtitle:c>0?`carries to ${c} more turn${c===1?``:`s`}`:`carry-forward`,accent:`cyan`,hint:`Cumulative token-turns of context pressure prevented at this point`})]}),Object.keys(b).length>0&&(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-5`,children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium mb-3`,children:`Mechanisms in this Turn`}),(0,w.jsx)(qU,{mechanisms:b,totalSaved:m})]}),(0,w.jsx)(XU,{sessionId:e,turn:t}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg overflow-hidden`,children:[(0,w.jsxs)(`div`,{className:`px-5 py-3 border-b border-border-subtle flex items-center justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h3`,{className:`t-secondary text-sm font-medium`,children:`Events`}),(0,w.jsxs)(`p`,{className:`t-tertiary text-xs mt-0.5`,children:[`Every savings event in turn #`,t,`: tool calls, exec commands, and the mechanism that rescued tokens.`]})]}),(0,w.jsxs)(`span`,{className:`t-tertiary text-xs`,children:[l.length,` event`,l.length===1?``:`s`]})]}),l.length===0?(0,w.jsx)(`p`,{className:`px-5 py-6 t-secondary text-sm`,children:`No events for this turn.`}):(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-left text-sm min-w-[900px]`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle t-tertiary text-xs uppercase`,children:[(0,w.jsx)(`th`,{className:`px-5 py-3 font-medium`,title:`When this savings event occurred`,children:`Time`}),(0,w.jsx)(`th`,{className:`px-3 py-3 font-medium`,title:`Type of rescue applied (e.g. graph query, shell compression)`,children:`Mechanism`}),(0,w.jsx)(`th`,{className:`px-3 py-3 font-medium`,title:`MCP tool that triggered this rescue`,children:`Tool`}),(0,w.jsx)(`th`,{className:`px-3 py-3 font-medium text-right`,title:`Tokens that would have been sent without unerr`,children:`Without`}),(0,w.jsx)(`th`,{className:`px-3 py-3 font-medium text-right`,title:`Tokens actually delivered to the agent after unerr's rescue`,children:`Delivered`}),(0,w.jsx)(`th`,{className:`px-3 py-3 font-medium text-right`,title:`Tokens rescued by this savings event (Without − Delivered)`,children:`Saved`}),(0,w.jsx)(`th`,{className:`px-3 py-3 pr-5 font-medium`,title:`Description of what was rescued`,children:`Detail`})]})}),(0,w.jsx)(`tbody`,{children:p.map(e=>{vL(e.mechanism);let t=e.tokens_without>0?Math.round(e.tokens_saved/e.tokens_without*100):0;return(0,w.jsxs)(`tr`,{className:`border-b border-border-subtle transition-colors hover:bg-white/[0.04]`,children:[(0,w.jsx)(`td`,{className:`t-tertiary px-5 py-3 font-mono text-xs whitespace-nowrap`,children:_L(e.ts)}),(0,w.jsx)(`td`,{className:`px-3 py-3`,children:(0,w.jsx)(xL,{mechanism:e.mechanism})}),(0,w.jsx)(`td`,{className:`t-secondary px-3 py-3 font-mono text-xs whitespace-nowrap`,children:e.tool??`—`}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right font-mono text-xs tabular-nums whitespace-nowrap`,children:Q(e.tokens_without)}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right font-mono text-xs tabular-nums whitespace-nowrap`,children:Q(e.tokens_with)}),(0,w.jsxs)(`td`,{className:`px-3 py-3 text-right whitespace-nowrap`,children:[(0,w.jsx)(`span`,{className:`text-success font-mono font-medium text-xs`,children:Q(e.tokens_saved)}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px] ml-1`,children:[`(`,t,`%)`]})]}),(0,w.jsx)(`td`,{className:`px-3 py-3 pr-5 font-mono text-xs max-w-[400px]`,children:(0,w.jsx)(`span`,{className:`t-secondary break-words leading-relaxed`,children:yL(e)})})]},e.id)})}),(0,w.jsx)(`tfoot`,{children:(0,w.jsxs)(`tr`,{className:`border-t border-border-subtle font-medium bg-white/[0.04]`,children:[(0,w.jsx)(`td`,{className:`px-5 py-3`,colSpan:3,children:(0,w.jsx)(`span`,{className:`t-secondary text-xs uppercase tracking-wider`,children:`Turn Total`})}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right font-mono text-xs tabular-nums`,children:Q(h)}),(0,w.jsx)(`td`,{className:`px-3 py-3 text-right font-mono text-xs tabular-nums`,children:Q(g)}),(0,w.jsxs)(`td`,{className:`px-3 py-3 text-right`,children:[(0,w.jsx)(`span`,{className:`text-success font-mono font-medium text-xs`,children:Q(m)}),(0,w.jsxs)(`span`,{className:`t-tertiary text-[10px] ml-1`,children:[`(`,v,`%)`]})]}),(0,w.jsx)(`td`,{})]})})]})}),(0,w.jsx)(`div`,{className:`px-5 py-2 border-t border-border-subtle`,children:(0,w.jsx)(qV,{total:l.length,limit:10,offset:u,onPageChange:d})})]}),(0,w.jsxs)(`div`,{className:`el-raised rounded-lg p-4 flex flex-wrap items-center justify-center gap-x-6 gap-y-2 text-xs`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`prompt-trace`,{session:e,turn:String(t)}),children:[`Open the prompt trace for turn `,t,` →`]}),(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`logbook`,{session:e}),children:`See this session in What unerr did →`}),(0,w.jsx)(`button`,{type:`button`,className:`text-violet-400 hover:text-violet-300 transition-colors font-medium`,onClick:()=>y(`reasoning`,{session:e}),children:`See reasoning detail →`})]})]})}function eW(){let e=S(`session`)||null,t=S(`turn`),n=t?Number(t):null,r=S(`window`),i=r===`today`||r===`this_week`||r===`since_install`?r:`since_install`,a=e&&Number.isFinite(n)?{level:`turn`,sessionId:e,turn:n}:e?{level:`session`,sessionId:e}:{level:`global`},o=e=>x({window:e}),s=()=>x({session:null,turn:null}),c=e=>x({session:e,turn:null}),l=(e,t)=>x({session:e,turn:String(t)}),u=[];return(a.level===`session`||a.level===`turn`)&&u.push({label:`All Sessions`,onClick:s},{label:`Session ${a.sessionId.slice(0,12)}`,onClick:a.level===`turn`?()=>c(a.sessionId):void 0}),a.level===`turn`&&u.push({label:`Turn #${a.turn}`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(tW,{windowSelected:i,onWindowChange:o,sessionId:a.level===`global`?void 0:a.sessionId}),u.length>0&&(0,w.jsx)(sL,{items:u}),a.level===`global`&&(0,w.jsx)(ZU,{onSelectSession:c}),a.level===`session`&&(0,w.jsx)(QU,{sessionId:a.sessionId,onSelectTurn:e=>l(a.sessionId,e)}),a.level===`turn`&&(0,w.jsx)($U,{sessionId:a.sessionId,turn:a.turn})]})}function tW({windowSelected:e,onWindowChange:t,sessionId:n}){let{url:r,queryKey:i}=Ot(),a=N({queryKey:i([`token-flow`,`headroom`]),queryFn:()=>O(r(`/api/token-flow/headroom`)),refetchInterval:3e4}),o=N({queryKey:i([`token-flow`,`headroom-session`,n??``]),queryFn:()=>n?O(r(`/api/token-flow/headroom/session/${n}`)):Promise.resolve(null),enabled:!!n}),s=a.data?.data,c=o.data?.data,l=s?.[e],u=c?c.total_tokens_saved:l?.total_tokens_saved??0,d=c?c.headroom_compounded:l?.headroom_turns??0,f=c?c.turn_count:l?.turns_observed??0,p=c??s?.since_install,m=p?.turns_to_limit_with??0,h=p?.turns_to_limit_without??0,g=Math.max(0,m-h),_=l?.avg_turn_tokens_without??0,v=Math.max(0,_-(l?.avg_saved_per_turn??0)),y=GU(void 0),b=y===`credit`||y===`unknown`,x=y===`window`||y===`unknown`,S=e=>e===`today`?`Today`:e===`this_week`?`This Week`:`Since Install`;return(0,w.jsxs)(`section`,{className:`mb-6`,children:[(0,w.jsxs)(`div`,{className:`el-raised rounded-xl overflow-hidden`,children:[(0,w.jsxs)(`div`,{className:`relative px-6 pt-6 pb-5`,children:[(0,w.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 bg-linear-to-b from-emerald-500/6 to-transparent`}),(0,w.jsxs)(`div`,{className:`relative flex flex-col sm:flex-row sm:items-end sm:justify-between gap-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`p`,{className:`text-emerald-400 text-[10px] uppercase tracking-wider font-medium flex items-center gap-1.5`,children:[`Tokens Saved`,(0,w.jsx)(UU,{text:`Counts tokens unerr removed from the operations it touched — file reads, web fetches, shell output, dedup. Does not include system prompt, tool schemas, conversation history, reasoning, or native Read/Edit calls.`})]}),(0,w.jsx)(`p`,{className:`text-5xl sm:text-6xl font-bold font-mono text-emerald-400 mt-2 tabular-nums tracking-tighter leading-none`,children:(0,w.jsx)(HU,{value:u,format:Q})}),(0,w.jsxs)(`p`,{className:`t-secondary text-xs mt-2`,children:[`on operations unerr handled`,!n&&(0,w.jsxs)(`span`,{className:`t-tertiary ml-1`,children:[`· `,S(e).toLowerCase()]})]})]}),!n&&(0,w.jsx)(`div`,{className:`flex items-center gap-1`,children:[`today`,`this_week`,`since_install`].map(n=>(0,w.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:`rounded-md px-2.5 py-1 text-xs font-medium transition-all ${e===n?`bg-emerald-500/20 text-emerald-300 shadow-sm`:`bg-surface-secondary t-secondary hover:bg-surface-tertiary hover:text-foreground`}`,children:S(n)},n))})]})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 border-t border-border-subtle divide-x divide-border-subtle`,children:[(0,w.jsxs)(`div`,{className:`px-5 py-4 transition-all ${b?`bg-emerald-500/3`:``}`,children:[(0,w.jsxs)(`p`,{className:`text-emerald-400 text-[10px] uppercase tracking-wider font-medium flex items-center gap-1.5`,children:[`Turns Earned`,(0,w.jsx)(UU,{text:`Extra turns you got for free. Calculated as total tokens saved divided by average tokens per turn. Applies to credit-billed agents — Cursor fast-requests, API metered requests.`})]}),(0,w.jsxs)(`p`,{className:`text-2xl font-bold font-mono text-emerald-400 mt-1.5 tabular-nums`,children:[`+`,(0,w.jsx)(HU,{value:d,format:Q})]}),(0,w.jsxs)(`p`,{className:`t-tertiary text-[11px] mt-1`,children:[`over `,Q(f),` turn`,f===1?``:`s`]}),b&&(0,w.jsx)(`div`,{className:`mt-2 h-0.5 w-8 rounded-full bg-emerald-400/40`})]}),(0,w.jsxs)(`div`,{className:`px-5 py-4 transition-all ${x?`bg-violet-500/3`:``}`,children:[(0,w.jsxs)(`p`,{className:`text-violet-400 text-[10px] uppercase tracking-wider font-medium flex items-center gap-1.5`,children:[`Reach / Session`,(0,w.jsx)(UU,{text:`Per-session ceiling extension: how many more turns each session can reach before context exhaustion. Derived from lifetime average, stable across windows. Applies to window-billed agents — Claude Code 5-hour windows, Copilot Pro caps.`})]}),(0,w.jsxs)(`p`,{className:`text-2xl font-bold font-mono text-violet-400 mt-1.5 tabular-nums`,children:[`+`,(0,w.jsx)(HU,{value:g,format:Q})]}),(0,w.jsxs)(`p`,{className:`t-tertiary text-[11px] mt-1`,children:[`up to turn `,Q(m)]}),x&&(0,w.jsx)(`div`,{className:`mt-2 h-0.5 w-8 rounded-full bg-violet-400/40`})]}),(0,w.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,w.jsxs)(`p`,{className:`text-cyan-400 text-[10px] uppercase tracking-wider font-medium flex items-center gap-1.5`,children:[`Rescue Rate`,(0,w.jsx)(UU,{text:`Share of original tokens that unerr rescued — saved ÷ original. Higher means more compression per operation.`})]}),(0,w.jsx)(`p`,{className:`text-2xl font-bold font-mono text-cyan-400 mt-1.5 tabular-nums`,children:l?`${Math.round(l.avg_saved_per_turn/(l.avg_turn_tokens_without||1)*100)}%`:`—`}),(0,w.jsx)(`p`,{className:`t-tertiary text-[11px] mt-1`,children:`tokens kept out`})]}),(0,w.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,w.jsxs)(`p`,{className:`text-foreground/60 text-[10px] uppercase tracking-wider font-medium flex items-center gap-1.5`,children:[`Avg Turn`,(0,w.jsx)(UU,{text:`Average tokens per turn without unerr vs with unerr. The gap shows how much context pressure unerr removes on every turn.`})]}),(0,w.jsx)(`p`,{className:`text-2xl font-bold font-mono text-foreground mt-1.5 tabular-nums`,children:Q(_)}),(0,w.jsxs)(`p`,{className:`t-tertiary text-[11px] mt-1`,children:[`vs `,Q(v),` with unerr`]})]})]})]}),(0,w.jsx)(WU,{storageKey:`unerr-token-trace-billing-explained`,children:(0,w.jsxs)(`div`,{className:`pr-12`,children:[(0,w.jsx)(`p`,{className:`text-violet-300 text-[11px] font-medium mb-1`,children:`Two metrics, two billing models`}),(0,w.jsxs)(`p`,{className:`t-secondary text-[11px] leading-relaxed`,children:[(0,w.jsx)(`span`,{className:`text-emerald-300 font-medium`,children:`Turns earned`}),` `,`is usage-cumulative — extra prompts within your request quota. Relevant for credit-billed agents (Cursor fast-requests, API requests).`,` `,(0,w.jsx)(`span`,{className:`text-violet-300 font-medium`,children:`Reach/session`}),` `,`is a per-session ceiling — extra turns before context exhaustion. Relevant for window-billed agents (Claude Code 5h windows, Copilot Pro caps). One of the two holds for your agent's billing model.`]})]})})]})}function nW(){let e=_(),t=v(),[n,r]=(0,f.useState)(!1),{data:i,isFetched:a}=N({queryKey:[`pm`,`info`],queryFn:()=>O(`/api/pm`).catch(()=>null),staleTime:6e4,retry:!1}),o=!!i,{data:s}=N({queryKey:[`daemon`,`repos`],queryFn:()=>O(`/api/repos`),refetchInterval:5e3,enabled:o}),c=s?.repos??[];(0,f.useEffect)(()=>{if(!(!a||o))return Mt(Tt,r)},[a,o]);let{data:l=[]}=N({queryKey:[`live-feed`],initialData:[]}),{data:u}=N({queryKey:[`session-snapshot`]}),{data:d}=N({queryKey:[`system`,`status`],queryFn:()=>O(`/api/system/status`).catch(()=>null),staleTime:6e4,enabled:a&&!o}),p=t.repoLabel?c.find(e=>e.label===t.repoLabel):null,h=(0,f.useMemo)(()=>({label:t.repoLabel,path:p?.path??null,status:p?.status??null,apiBase:t.repoLabel?`/api/repo/${t.repoLabel}`:``,isDaemonMode:o}),[t.repoLabel,p,o]),g=o&&(e===`logbook`||e===`overview`)&&!t.repoLabel?`all-repos`:e,y=m(g),b;switch(g){case`all-repos`:b=(0,w.jsx)(Ft,{});break;case`daemon`:b=(0,w.jsx)(Vt,{});break;case`overview`:b=(0,w.jsx)(mn,{});break;case`visual`:b=(0,w.jsx)(oI,{});break;case`graph`:b=(0,w.jsx)(pr,{});break;case`facts`:b=(0,w.jsx)(Sn,{});break;case`logbook`:b=(0,w.jsx)(iL,{});break;case`guard`:b=(0,w.jsx)(dI,{});break;case`token-trace`:b=(0,w.jsx)(eW,{});break;case`reasoning`:b=(0,w.jsx)(tH,{});break;case`prompt-trace`:b=(0,w.jsx)(RL,{});break;case`activity`:b=(0,w.jsx)(BH,{});break;case`router`:b=(0,w.jsx)(mH,{});break;case`router-sessions`:b=(0,w.jsx)(oH,{});break;case`settings`:b=(0,w.jsx)(OU,{});break}return(0,w.jsx)(Et.Provider,{value:h,children:(0,w.jsx)(te,{title:y,activeRoute:g,statusDot:o?void 0:n?`live`:`reconnecting`,repoPath:o?p?.path:d?.data?.cwd,repoLabel:t.repoLabel,isDaemonMode:o,repos:c,authBanner:d?.data?.auth??null,updateBanner:d?.data?.update??null,children:b})})}var rW=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,te());else{var t=n(l);t!==null&&ne(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function ee(){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&&ne(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(ee)};else if(typeof MessageChannel<`u`){var D=new MessageChannel,O=D.port2;D.port1.onmessage=ee,te=function(){O.postMessage(null)}}else te=function(){_(ee,0)};function ne(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,ne(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),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}}}})),iW=o(((e,t)=>{t.exports=rW()})),aW=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.5`})),oW=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=aW()})),sW=o((e=>{var t=iW(),n=d(),r=oW();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 p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),ee=Symbol.for(`react.activity`),te=Symbol.for(`react.memo_cache_sentinel`),D=Symbol.iterator;function O(e){return typeof e!=`object`||!e?null:(e=D&&e[D]||e[`@@iterator`],typeof e==`function`?e:null)}var ne=Symbol.for(`react.client.reference`);function re(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case ee:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?re(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}var ie=Array.isArray,k=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},j=[],M=-1;function oe(e){return{current:e}}function se(e){0>M||(e.current=j[M],j[M]=null,M--)}function ce(e,t){M++,j[M]=e.current,e.current=t}var le=oe(null),ue=oe(null),de=oe(null),fe=oe(null);function pe(e,t){switch(ce(de,t),ce(ue,e),ce(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}se(le),ce(le,e)}function me(){se(le),se(ue),se(de)}function he(e){e.memoizedState!==null&&ce(fe,e);var t=le.current,n=Xd(t,e.type);t!==n&&(ce(ue,e),ce(le,n))}function ge(e){ue.current===e&&(se(le),se(ue)),fe.current===e&&(se(fe),ap._currentValue=ae)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1<e.stack.indexOf(`
|
|
918
918
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
919
919
|
`+_e+e+ve}var be=!1;function xe(e,t){if(!e||be)return``;be=!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(`
|
|
920
920
|
`),l=s.split(`
|
|
@@ -922,8 +922,8 @@ input.vis-configuration.vis-config-range:focus::-ms-fill-upper {
|
|
|
922
922
|
`+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{be=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ye(n):``}function Se(e,t){switch(e.tag){case 26:case 27:case 5:return ye(e.type);case 16:return ye(`Lazy`);case 13:return e.child!==t&&t!==null?ye(`Suspense Fallback`):ye(`Suspense`);case 19:return ye(`SuspenseList`);case 0:case 15:return xe(e.type,!1);case 11:return xe(e.type.render,!1);case 1:return xe(e.type,!0);case 31:return ye(`Activity`);default:return``}}function Ce(e){try{var t=``,n=null;do t+=Se(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
923
923
|
Error generating stack: `+e.message+`
|
|
924
924
|
`+e.stack}}var we=Object.prototype.hasOwnProperty,Te=t.unstable_scheduleCallback,Ee=t.unstable_cancelCallback,De=t.unstable_shouldYield,Oe=t.unstable_requestPaint,ke=t.unstable_now,Ae=t.unstable_getCurrentPriorityLevel,je=t.unstable_ImmediatePriority,Me=t.unstable_UserBlockingPriority,Ne=t.unstable_NormalPriority,Pe=t.unstable_LowPriority,Fe=t.unstable_IdlePriority,Ie=t.log,Le=t.unstable_setDisableYieldValue,Re=null,ze=null;function Be(e){if(typeof Ie==`function`&&Le(e),ze&&typeof ze.setStrictMode==`function`)try{ze.setStrictMode(Re,e)}catch{}}var Ve=Math.clz32?Math.clz32:We,He=Math.log,Ue=Math.LN2;function We(e){return e>>>=0,e===0?32:31-(He(e)/Ue|0)|0}var Ge=256,Ke=262144,qe=4194304;function Je(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 Ye(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=Je(n))):i=Je(o):i=Je(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Je(n))):i=Je(o)):i=Je(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 Xe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ze(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 Qe(){var e=qe;return qe<<=1,!(qe&62914560)&&(qe=4194304),e}function $e(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function et(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tt(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-Ve(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&&nt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function nt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ve(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function rt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ve(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function it(e,t){var n=t&-t;return n=n&42?1:at(n),(n&(e.suspendedLanes|t))===0?n:0}function at(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 ot(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function st(){var e=A.p;return e===0?(e=window.event,e===void 0?32:xp(e.type)):e}function ct(e,t){var n=A.p;try{return A.p=e,t()}finally{A.p=n}}var lt=Math.random().toString(36).slice(2),ut=`__reactFiber$`+lt,dt=`__reactProps$`+lt,ft=`__reactContainer$`+lt,pt=`__reactEvents$`+lt,mt=`__reactListeners$`+lt,ht=`__reactHandles$`+lt,gt=`__reactResources$`+lt,_t=`__reactMarker$`+lt;function vt(e){delete e[ut],delete e[dt],delete e[pt],delete e[mt],delete e[ht]}function yt(e){var t=e[ut];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ft]||n[ut]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=yf(e);e!==null;){if(n=e[ut])return n;e=yf(e)}return t}e=n,n=e.parentNode}return null}function bt(e){if(e=e[ut]||e[ft]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function xt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function St(e){var t=e[gt];return t||=e[gt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Ct(e){e[_t]=!0}var N=new Set,wt={};function Tt(e,t){Et(e,t),Et(e+`Capture`,t)}function Et(e,t){for(wt[e]=t,e=0;e<t.length;e++)N.add(t[e])}var Dt=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]*$`),Ot={},kt={};function At(e){return we.call(kt,e)?!0:we.call(Ot,e)?!1:Dt.test(e)?kt[e]=!0:(Ot[e]=!0,!1)}function jt(e,t,n){if(At(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 Mt(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 Nt(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 Pt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Ft(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function It(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 Lt(e){if(!e._valueTracker){var t=Ft(e)?`checked`:`value`;e._valueTracker=It(e,t,``+e[t])}}function Rt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Ft(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function zt(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 Bt=/[\n"\\]/g;function Vt(e){return e.replace(Bt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Ht(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=``+Pt(t)):e.value!==``+Pt(t)&&(e.value=``+Pt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Wt(e,o,Pt(n)):Wt(e,o,Pt(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=``+Pt(s):e.removeAttribute(`name`)}function Ut(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)){Lt(e);return}n=n==null?``:``+Pt(n),t=t==null?n:``+Pt(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),Lt(e)}function Wt(e,t,n){t===`number`&&zt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Gt(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=``+Pt(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 Kt(e,t,n){if(t!=null&&(t=``+Pt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Pt(n)}function qt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ie(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Pt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Lt(e)}function Jt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yt=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 Xt(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||Yt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Zt(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&&Xt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Xt(e,o,t[o])}function Qt(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 $t=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`]]),en=/^[\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 tn(e){return en.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function nn(){}var rn=null;function an(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var on=null,sn=null;function cn(e){var t=bt(e);if(t&&(e=t.stateNode)){var n=e[dt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Ht(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="`+Vt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[dt]||null;if(!a)throw Error(i(90));Ht(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&&Rt(r)}break a;case`textarea`:Kt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Gt(e,!!n.multiple,t,!1)}}}var ln=!1;function un(e,t,n){if(ln)return e(t,n);ln=!0;try{return e(t)}finally{if(ln=!1,(on!==null||sn!==null)&&(Eu(),on&&(t=on,e=sn,sn=on=null,cn(t),e)))for(t=0;t<e.length;t++)cn(e[t])}}function dn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[dt]||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 fn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),pn=!1;if(fn)try{var mn={};Object.defineProperty(mn,`passive`,{get:function(){pn=!0}}),window.addEventListener(`test`,mn,mn),window.removeEventListener(`test`,mn,mn)}catch{pn=!1}var hn=null,gn=null,_n=null;function vn(){if(_n)return _n;var e,t=gn,n=t.length,r,i=`value`in hn?hn.value:hn.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 _n=i.slice(e,1<r?1-r:void 0)}function yn(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 bn(){return!0}function xn(){return!1}function Sn(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)?bn:xn,this.isPropagationStopped=xn,this}return p(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=bn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=bn)},persist:function(){},isPersistent:bn}),t}var Cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wn=Sn(Cn),Tn=p({},Cn,{view:0,detail:0}),En=Sn(Tn),Dn,On,kn,An=p({},Tn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vn,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!==kn&&(kn&&e.type===`mousemove`?(Dn=e.screenX-kn.screenX,On=e.screenY-kn.screenY):On=Dn=0,kn=e),Dn)},movementY:function(e){return`movementY`in e?e.movementY:On}}),jn=Sn(An),Mn=Sn(p({},An,{dataTransfer:0})),Nn=Sn(p({},Tn,{relatedTarget:0})),Pn=Sn(p({},Cn,{animationName:0,elapsedTime:0,pseudoElement:0})),Fn=Sn(p({},Cn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),In=Sn(p({},Cn,{data:0})),Ln={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Rn={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`},zn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Bn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=zn[e])?!!t[e]:!1}function Vn(){return Bn}var Hn=Sn(p({},Tn,{key:function(e){if(e.key){var t=Ln[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=yn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Rn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vn,charCode:function(e){return e.type===`keypress`?yn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?yn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Un=Sn(p({},An,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Wn=Sn(p({},Tn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vn})),Gn=Sn(p({},Cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Kn=Sn(p({},An,{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})),qn=Sn(p({},Cn,{newState:0,oldState:0})),Jn=[9,13,27,32],Yn=fn&&`CompositionEvent`in window,Xn=null;fn&&`documentMode`in document&&(Xn=document.documentMode);var Zn=fn&&`TextEvent`in window&&!Xn,Qn=fn&&(!Yn||Xn&&8<Xn&&11>=Xn),$n=` `,er=!1;function tr(e,t){switch(e){case`keyup`:return Jn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function nr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var rr=!1;function ir(e,t){switch(e){case`compositionend`:return nr(t);case`keypress`:return t.which===32?(er=!0,$n):null;case`textInput`:return e=t.data,e===$n&&er?null:e;default:return null}}function ar(e,t){if(rr)return e===`compositionend`||!Yn&&tr(e,t)?(e=vn(),_n=gn=hn=null,rr=!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 Qn&&t.locale!==`ko`?null:t.data;default:return null}}var or={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 sr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!or[e.type]:t===`textarea`}function cr(e,t,n,r){on?sn?sn.push(r):sn=[r]:on=r,t=Nd(t,`onChange`),0<t.length&&(n=new wn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var lr=null,ur=null;function dr(e){Ed(e,0)}function fr(e){if(Rt(xt(e)))return e}function pr(e,t){if(e===`change`)return t}var mr=!1;if(fn){var hr;if(fn){var gr=`oninput`in document;if(!gr){var _r=document.createElement(`div`);_r.setAttribute(`oninput`,`return;`),gr=typeof _r.oninput==`function`}hr=gr}else hr=!1;mr=hr&&(!document.documentMode||9<document.documentMode)}function vr(){lr&&(lr.detachEvent(`onpropertychange`,P),ur=lr=null)}function P(e){if(e.propertyName===`value`&&fr(ur)){var t=[];cr(t,ur,e,an(e)),un(dr,t)}}function yr(e,t,n){e===`focusin`?(vr(),lr=t,ur=n,lr.attachEvent(`onpropertychange`,P)):e===`focusout`&&vr()}function br(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return fr(ur)}function xr(e,t){if(e===`click`)return fr(t)}function Sr(e,t){if(e===`input`||e===`change`)return fr(t)}function Cr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var wr=typeof Object.is==`function`?Object.is:Cr;function F(e,t){if(wr(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(!we.call(t,i)||!wr(e[i],t[i]))return!1}return!0}function Tr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Er(e,t){var n=Tr(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=Tr(n)}}function Dr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Or(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=zt(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=zt(e.document)}return t}function kr(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 Ar=fn&&`documentMode`in document&&11>=document.documentMode,jr=null,Mr=null,I=null,Nr=!1;function Pr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Nr||jr==null||jr!==zt(r)||(r=jr,`selectionStart`in r&&kr(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}),I&&F(I,r)||(I=r,r=Nd(Mr,`onSelect`),0<r.length&&(t=new wn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=jr)))}function Fr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ir={animationend:Fr(`Animation`,`AnimationEnd`),animationiteration:Fr(`Animation`,`AnimationIteration`),animationstart:Fr(`Animation`,`AnimationStart`),transitionrun:Fr(`Transition`,`TransitionRun`),transitionstart:Fr(`Transition`,`TransitionStart`),transitioncancel:Fr(`Transition`,`TransitionCancel`),transitionend:Fr(`Transition`,`TransitionEnd`)},Lr={},Rr={};fn&&(Rr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ir.animationend.animation,delete Ir.animationiteration.animation,delete Ir.animationstart.animation),`TransitionEvent`in window||delete Ir.transitionend.transition);function zr(e){if(Lr[e])return Lr[e];if(!Ir[e])return e;var t=Ir[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Rr)return Lr[e]=t[n];return e}var Br=zr(`animationend`),Vr=zr(`animationiteration`),Hr=zr(`animationstart`),Ur=zr(`transitionrun`),Wr=zr(`transitionstart`),Gr=zr(`transitioncancel`),Kr=zr(`transitionend`),qr=new Map,Jr=`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(` `);Jr.push(`scrollEnd`);function Yr(e,t){qr.set(e,t),Tt(t,[e])}var Xr=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)},Zr=[],Qr=0,$r=0;function ei(){for(var e=Qr,t=$r=Qr=0;t<e;){var n=Zr[t];Zr[t++]=null;var r=Zr[t];Zr[t++]=null;var i=Zr[t];Zr[t++]=null;var a=Zr[t];if(Zr[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&&ii(n,i,a)}}function ti(e,t,n,r){Zr[Qr++]=e,Zr[Qr++]=t,Zr[Qr++]=n,Zr[Qr++]=r,$r|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ni(e,t,n,r){return ti(e,t,n,r),ai(e)}function ri(e,t){return ti(e,null,null,t),ai(e)}function ii(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-Ve(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ai(e){if(50<_u)throw _u=0,vu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var oi={};function si(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 ci(e,t,n,r){return new si(e,t,n,r)}function li(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ui(e,t){var n=e.alternate;return n===null?(n=ci(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 di(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 fi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)li(e)&&(s=1);else if(typeof e==`string`)s=Xf(e,n,le.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case ee:return e=ci(31,n,t,a),e.elementType=ee,e.lanes=o,e;case _:return pi(n.children,a,o,t);case v:s=8,a|=24;break;case y:return e=ci(12,n,t,a|2),e.elementType=y,e.lanes=o,e;case C:return e=ci(13,n,t,a),e.elementType=C,e.lanes=o,e;case w:return e=ci(19,n,t,a),e.elementType=w,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case x:s=10;break a;case b:s=9;break a;case S:s=11;break a;case T:s=14;break a;case E:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ci(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function pi(e,t,n,r){return e=ci(7,e,r,t),e.lanes=n,e}function mi(e,t,n){return e=ci(6,e,null,t),e.lanes=n,e}function hi(e){var t=ci(18,null,null,0);return t.stateNode=e,t}function gi(e,t,n){return t=ci(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var _i=new WeakMap;function L(e,t){if(typeof e==`object`&&e){var n=_i.get(e);return n===void 0?(t={value:e,source:t,stack:Ce(t)},_i.set(e,t),t):n}return{value:e,source:t,stack:Ce(t)}}var vi=[],yi=0,bi=null,xi=0,Si=[],Ci=0,wi=null,Ti=1,Ei=``;function Di(e,t){vi[yi++]=xi,vi[yi++]=bi,bi=e,xi=t}function Oi(e,t,n){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,wi=e;var r=Ti;e=Ei;var i=32-Ve(r)-1;r&=~(1<<i),n+=1;var a=32-Ve(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ti=1<<32-Ve(t)+i|n<<i|r,Ei=a+e}else Ti=1<<a|n<<i|r,Ei=e}function ki(e){e.return!==null&&(Di(e,1),Oi(e,1,0))}function Ai(e){for(;e===bi;)bi=vi[--yi],vi[yi]=null,xi=vi[--yi],vi[yi]=null;for(;e===wi;)wi=Si[--Ci],Si[Ci]=null,Ei=Si[--Ci],Si[Ci]=null,Ti=Si[--Ci],Si[Ci]=null}function ji(e,t){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,Ti=t.id,Ei=t.overflow,wi=e}var Mi=null,Ni=null,Pi=!1,Fi=null,Ii=!1,Li=Error(i(519));function Ri(e){throw Wi(L(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Li}function zi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[ut]=e,t[dt]=r,n){case`dialog`:U(`cancel`,t),U(`close`,t);break;case`iframe`:case`object`:case`embed`:U(`load`,t);break;case`video`:case`audio`:for(n=0;n<wd.length;n++)U(wd[n],t);break;case`source`:U(`error`,t);break;case`img`:case`image`:case`link`:U(`error`,t),U(`load`,t);break;case`details`:U(`toggle`,t);break;case`input`:U(`invalid`,t),Ut(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:U(`invalid`,t);break;case`textarea`:U(`invalid`,t),qt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||zd(t.textContent,n)?(r.popover!=null&&(U(`beforetoggle`,t),U(`toggle`,t)),r.onScroll!=null&&U(`scroll`,t),r.onScrollEnd!=null&&U(`scrollend`,t),r.onClick!=null&&(t.onclick=nn),t=!0):t=!1,t||Ri(e,!0)}function Bi(e){for(Mi=e.return;Mi;)switch(Mi.tag){case 5:case 31:case 13:Ii=!1;return;case 27:case 3:Ii=!0;return;default:Mi=Mi.return}}function Vi(e){if(e!==Mi)return!1;if(!Pi)return Bi(e),Pi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Zd(e.type,e.memoizedProps)),n=!n),n&&Ni&&Ri(e),Bi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ni=vf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ni=vf(e)}else t===27?(t=Ni,of(e.type)?(e=_f,_f=null,Ni=e):Ni=t):Ni=Mi?gf(e.stateNode.nextSibling):null;return!0}function Hi(){Ni=Mi=null,Pi=!1}function Ui(){var e=Fi;return e!==null&&(ru===null?ru=e:ru.push.apply(ru,e),Fi=null),e}function Wi(e){Fi===null?Fi=[e]:Fi.push(e)}var Gi=oe(null),Ki=null,qi=null;function Ji(e,t,n){ce(Gi,t._currentValue),t._currentValue=n}function Yi(e){e._currentValue=Gi.current,se(Gi)}function Xi(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 Zi(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),Xi(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),Xi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Qi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;wr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===fe.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[ap]:e.push(ap))}a=a.return}e!==null&&Zi(t,e,n,r),t.flags|=262144}function $i(e){for(e=e.firstContext;e!==null;){if(!wr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ea(e){Ki=e,qi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ta(e){return ra(Ki,e)}function na(e,t){return Ki===null&&ea(e),ra(e,t)}function ra(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},qi===null){if(e===null)throw Error(i(308));qi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else qi=qi.next=t;return n}var ia=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()})}},aa=t.unstable_scheduleCallback,oa=t.unstable_NormalPriority,sa={$$typeof:x,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ca(){return{controller:new ia,data:new Map,refCount:0}}function la(e){e.refCount--,e.refCount===0&&aa(oa,function(){e.controller.abort()})}var ua=null,da=0,fa=0,pa=null;function ma(e,t){if(ua===null){var n=ua=[];da=0,fa=vd(),pa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return da++,t.then(ha,ha),t}function ha(){if(--da===0&&ua!==null){pa!==null&&(pa.status=`fulfilled`);var e=ua;ua=null,fa=0,pa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ga(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 _a=k.S;k.S=function(e,t){ou=ke(),typeof t==`object`&&t&&typeof t.then==`function`&&ma(e,t),_a!==null&&_a(e,t)};var va=oe(null);function ya(){var e=va.current;return e===null?Ul.pooledCache:e}function ba(e,t){t===null?ce(va,va.current):ce(va,t.pool)}function xa(){var e=ya();return e===null?null:{parent:sa._currentValue,pool:e}}var Sa=Error(i(460)),Ca=Error(i(474)),wa=Error(i(542)),Ta={then:function(){}};function Ea(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Da(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(nn,nn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ja(e),e;default:if(typeof t.status==`string`)t.then(nn,nn);else{if(e=Ul,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,ja(e),e}throw ka=t,Sa}}function Oa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ka=e,Sa):e}}var ka=null;function Aa(){if(ka===null)throw Error(i(459));var e=ka;return ka=null,e}function ja(e){if(e===Sa||e===wa)throw Error(i(483))}var Ma=null,Na=0;function Pa(e){var t=Na;return Na+=1,Ma===null&&(Ma=[]),Da(Ma,e,t)}function Fa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ia(e,t){throw t.$$typeof===m?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function La(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=ui(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=mi(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===_?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===E&&Oa(i)===t.type)?(t=a(t,n.props),Fa(t,n),t.return=e,t):(t=fi(n.type,n.key,n.props,null,e.mode,r),Fa(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=gi(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=pi(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=mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case h:return n=fi(t.type,t.key,t.props,null,e.mode,n),Fa(n,t),n.return=e,n;case g:return t=gi(t,e.mode,n),t.return=e,t;case E:return t=Oa(t),f(e,t,n)}if(ie(t)||O(t))return t=pi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Pa(t),n);if(t.$$typeof===x)return f(e,na(e,t),n);Ia(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 h:return n.key===i?l(e,t,n,r):null;case g:return n.key===i?u(e,t,n,r):null;case E:return n=Oa(n),p(e,t,n,r)}if(ie(n)||O(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Pa(n),r);if(n.$$typeof===x)return p(e,t,na(e,n),r);Ia(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 h:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case g:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case E:return r=Oa(r),m(e,t,n,r,i)}if(ie(r)||O(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Pa(r),i);if(r.$$typeof===x)return m(e,t,n,na(t,r),i);Ia(t,r)}return null}function v(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),Pi&&Di(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 Pi&&Di(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)}),Pi&&Di(i,h),l}function y(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),Pi&&Di(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 Pi&&Di(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)}),Pi&&Di(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===_&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case h:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===_){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===E&&Oa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Fa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===_?(c=pi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=fi(o.type,o.key,o.props,null,e.mode,c),Fa(c,o),c.return=e,e=c)}return s(e);case g: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=gi(o,e.mode,c),c.return=e,e=c}return s(e);case E:return o=Oa(o),b(e,r,o,c)}if(ie(o))return v(e,r,o,c);if(O(o)){if(l=O(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Pa(o),c);if(o.$$typeof===x)return b(e,r,na(e,o),c);Ia(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=mi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Na=0;var i=b(e,t,n,r);return Ma=null,i}catch(t){if(t===Sa||t===wa)throw t;var a=ci(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ra=La(!0),za=La(!1),Ba=!1;function Va(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ha(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 Ua(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Wa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Hl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ai(e),ii(e,null,n),t}return ti(e,r,t,n),ai(e)}function Ga(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,rt(e,n)}}function Ka(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 qa=!1;function Ja(){if(qa){var e=pa;if(e!==null)throw e}}function Ya(e,t,n,r){qa=!1;var i=e.updateQueue;Ba=!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,m=f!==s.lane;if(m?(H&f)===f:(r&f)===f){f!==0&&f===fa&&(qa=!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=p({},d,f);break a;case 2:Ba=!0}}f=s.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[f]:m.push(f))}else m={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,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),Zl|=o,e.lanes=o,e.memoizedState=d}}function Xa(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Za(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Xa(n[e],t)}var Qa=oe(null),$a=oe(0);function eo(e,t){e=Yl,ce($a,e),ce(Qa,t),Yl=e|t.baseLanes}function R(){ce($a,Yl),ce(Qa,Qa.current)}function to(){Yl=$a.current,se(Qa),se($a)}var no=oe(null),ro=null;function io(e){var t=e.alternate;ce(lo,lo.current&1),ce(no,e),ro===null&&(t===null||Qa.current!==null||t.memoizedState!==null)&&(ro=e)}function ao(e){ce(lo,lo.current),ce(no,e),ro===null&&(ro=e)}function oo(e){e.tag===22?(ce(lo,lo.current),ce(no,e),ro===null&&(ro=e)):so(e)}function so(){ce(lo,lo.current),ce(no,no.current)}function co(e){se(no),ro===e&&(ro=null),se(lo)}var lo=oe(0);function uo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||pf(n)||mf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var fo=0,z=null,po=null,mo=null,ho=!1,go=!1,_o=!1,vo=0,yo=0,bo=null,xo=0;function So(){throw Error(i(321))}function Co(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wr(e[n],t[n]))return!1;return!0}function wo(e,t,n,r,i,a){return fo=a,z=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,k.H=e===null||e.memoizedState===null?Bs:Vs,_o=!1,a=n(r,i),_o=!1,go&&(a=Eo(t,n,r,i)),To(e),a}function To(e){k.H=zs;var t=po!==null&&po.next!==null;if(fo=0,mo=po=z=null,ho=!1,yo=0,bo=null,t)throw Error(i(300));e===null||ic||(e=e.dependencies,e!==null&&$i(e)&&(ic=!0))}function Eo(e,t,n,r){z=e;var a=0;do{if(go&&(bo=null),yo=0,go=!1,25<=a)throw Error(i(301));if(a+=1,mo=po=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}k.H=Hs,o=t(n,r)}while(go);return o}function Do(){var e=k.H,t=e.useState()[0];return t=typeof t.then==`function`?Po(t):t,e=e.useState()[0],(po===null?null:po.memoizedState)!==e&&(z.flags|=1024),t}function Oo(){var e=vo!==0;return vo=0,e}function ko(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Ao(e){if(ho){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ho=!1}fo=0,mo=po=z=null,go=!1,yo=vo=0,bo=null}function jo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mo===null?z.memoizedState=mo=e:mo=mo.next=e,mo}function Mo(){if(po===null){var e=z.alternate;e=e===null?null:e.memoizedState}else e=po.next;var t=mo===null?z.memoizedState:mo.next;if(t!==null)mo=t,po=e;else{if(e===null)throw z.alternate===null?Error(i(467)):Error(i(310));po=e,e={memoizedState:po.memoizedState,baseState:po.baseState,baseQueue:po.baseQueue,queue:po.queue,next:null},mo===null?z.memoizedState=mo=e:mo=mo.next=e}return mo}function No(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Po(e){var t=yo;return yo+=1,bo===null&&(bo=[]),e=Da(bo,e,t),t=z,(mo===null?t.memoizedState:mo.next)===null&&(t=t.alternate,k.H=t===null||t.memoizedState===null?Bs:Vs),e}function Fo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Po(e);if(e.$$typeof===x)return ta(e)}throw Error(i(438,String(e)))}function Io(e){var t=null,n=z.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=z.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=No(),z.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]=te;return t.index++,n}function Lo(e,t){return typeof t==`function`?t(e):t}function Ro(e){return zo(Mo(),po,e)}function zo(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?(fo&f)===f:(H&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===fa&&(d=!0);else if((fo&p)===p){u=u.next,p===fa&&(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,z.lanes|=p,Zl|=p;f=u.action,_o&&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,z.lanes|=f,Zl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!wr(o,e.memoizedState)&&(ic=!0,d&&(n=pa,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 Bo(e){var t=Mo(),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);wr(o,t.memoizedState)||(ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Vo(e,t,n){var r=z,a=Mo(),o=Pi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!wr((po||a).memoizedState,n);if(s&&(a.memoizedState=n,ic=!0),a=a.queue,fs(Wo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||mo!==null&&mo.memoizedState.tag&1){if(r.flags|=2048,ss(9,{destroy:void 0},Uo.bind(null,r,a,n,t),null),Ul===null)throw Error(i(349));o||fo&127||Ho(r,t,n)}return n}function Ho(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=z.updateQueue,t===null?(t=No(),z.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Uo(e,t,n,r){t.value=n,t.getSnapshot=r,Go(t)&&Ko(e)}function Wo(e,t,n){return n(function(){Go(t)&&Ko(e)})}function Go(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wr(e,n)}catch{return!0}}function Ko(e){var t=ri(e,2);t!==null&&xu(t,e,2)}function qo(e){var t=jo();if(typeof e==`function`){var n=e;if(e=n(),_o){Be(!0);try{n()}finally{Be(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:e},t}function Jo(e,t,n,r){return e.baseState=n,zo(e,po,typeof r==`function`?r:Lo)}function Yo(e,t,n,r,a){if(Is(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)}};k.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Xo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Xo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=k.T,o={};k.T=o;try{var s=n(i,r),c=k.S;c!==null&&c(o,s),Zo(e,t,s)}catch(n){$o(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),k.T=a}}else try{a=n(i,r),Zo(e,t,a)}catch(n){$o(e,t,n)}}function Zo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Qo(e,t,n)},function(n){return $o(e,t,n)}):Qo(e,t,n)}function Qo(e,t,n){t.status=`fulfilled`,t.value=n,es(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Xo(e,n)))}function $o(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,es(t),t=t.next;while(t!==r)}e.action=null}function es(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ts(e,t){return t}function ns(e,t){if(Pi){var n=Ul.formState;if(n!==null){a:{var r=z;if(Pi){if(Ni){b:{for(var i=Ni,a=Ii;i.nodeType!==8;){if(!a){i=null;break b}if(i=gf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ni=gf(i.nextSibling),r=i.data===`F!`;break a}}Ri(r)}r=!1}r&&(t=n[0])}}return n=jo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ts,lastRenderedState:t},n.queue=r,n=Ns.bind(null,z,r),r.dispatch=n,r=qo(!1),a=Fs.bind(null,z,!1,r.queue),r=jo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Yo.bind(null,z,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function rs(e){return is(Mo(),po,e)}function is(e,t,n){if(t=zo(e,t,ts)[0],e=Ro(Lo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Po(t)}catch(e){throw e===Sa?wa:e}else r=t;t=Mo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(z.flags|=2048,ss(9,{destroy:void 0},as.bind(null,i,n),null)),[r,a,e]}function as(e,t){e.action=t}function os(e){var t=Mo(),n=po;if(n!==null)return is(t,n,e);Mo(),t=t.memoizedState,n=Mo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ss(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=z.updateQueue,t===null&&(t=No(),z.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 cs(){return Mo().memoizedState}function ls(e,t,n,r){var i=jo();z.flags|=e,i.memoizedState=ss(1|t,{destroy:void 0},n,r===void 0?null:r)}function us(e,t,n,r){var i=Mo();r=r===void 0?null:r;var a=i.memoizedState.inst;po!==null&&r!==null&&Co(r,po.memoizedState.deps)?i.memoizedState=ss(t,a,n,r):(z.flags|=e,i.memoizedState=ss(1|t,a,n,r))}function ds(e,t){ls(8390656,8,e,t)}function fs(e,t){us(2048,8,e,t)}function ps(e){z.flags|=4;var t=z.updateQueue;if(t===null)t=No(),z.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ms(e){var t=Mo().memoizedState;return ps({ref:t,nextImpl:e}),function(){if(Hl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function hs(e,t){return us(4,2,e,t)}function gs(e,t){return us(4,4,e,t)}function _s(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 vs(e,t,n){n=n==null?null:n.concat([e]),us(4,4,_s.bind(null,t,e),n)}function B(){}function ys(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Co(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function bs(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Co(t,r[1]))return r[0];if(r=e(),_o){Be(!0);try{e()}finally{Be(!1)}}return n.memoizedState=[r,t],r}function xs(e,t,n){return n===void 0||fo&1073741824&&!(H&261930)?e.memoizedState=t:(e.memoizedState=n,e=bu(),z.lanes|=e,Zl|=e,n)}function Ss(e,t,n,r){return wr(n,t)?n:Qa.current===null?!(fo&42)||fo&1073741824&&!(H&261930)?(ic=!0,e.memoizedState=n):(e=bu(),z.lanes|=e,Zl|=e,t):(e=xs(e,n,r),wr(e,t)||(ic=!0),e)}function Cs(e,t,n,r,i){var a=A.p;A.p=a!==0&&8>a?a:8;var o=k.T,s={};k.T=s,Fs(e,!1,t,n);try{var c=i(),l=k.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ps(e,t,ga(c,r),yu(e)):Ps(e,t,r,yu(e))}catch(n){Ps(e,t,{then:function(){},status:`rejected`,reason:n},yu())}finally{A.p=a,o!==null&&s.types!==null&&(o.types=s.types),k.T=o}}function ws(){}function Ts(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Es(e).queue;Cs(e,a,t,ae,n===null?ws:function(){return Ds(e),n(r)})}function Es(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:ae},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ds(e){var t=Es(e);t.next===null&&(t=e.alternate.memoizedState),Ps(e,t.next.queue,{},yu())}function Os(){return ta(ap)}function ks(){return Mo().memoizedState}function As(){return Mo().memoizedState}function js(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=yu();e=Ua(n);var r=Wa(t,e,n);r!==null&&(xu(r,t,n),Ga(r,t,n)),t={cache:ca()},e.payload=t;return}t=t.return}}function Ms(e,t,n){var r=yu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Is(e)?Ls(t,n):(n=ni(e,t,n,r),n!==null&&(xu(n,e,r),Rs(n,t,r)))}function Ns(e,t,n){Ps(e,t,n,yu())}function Ps(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Is(e))Ls(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,wr(s,o))return ti(e,t,i,0),Ul===null&&ei(),!1}catch{}if(n=ni(e,t,i,r),n!==null)return xu(n,e,r),Rs(n,t,r),!0}return!1}function Fs(e,t,n,r){if(r={lane:2,revertLane:vd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Is(e)){if(t)throw Error(i(479))}else t=ni(e,n,r,2),t!==null&&xu(t,e,2)}function Is(e){var t=e.alternate;return e===z||t!==null&&t===z}function Ls(e,t){go=ho=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,rt(e,n)}}var zs={readContext:ta,use:Fo,useCallback:So,useContext:So,useEffect:So,useImperativeHandle:So,useLayoutEffect:So,useInsertionEffect:So,useMemo:So,useReducer:So,useRef:So,useState:So,useDebugValue:So,useDeferredValue:So,useTransition:So,useSyncExternalStore:So,useId:So,useHostTransitionStatus:So,useFormState:So,useActionState:So,useOptimistic:So,useMemoCache:So,useCacheRefresh:So};zs.useEffectEvent=So;var Bs={readContext:ta,use:Fo,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:ta,useEffect:ds,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ls(4194308,4,_s.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ls(4194308,4,e,t)},useInsertionEffect:function(e,t){ls(4,2,e,t)},useMemo:function(e,t){var n=jo();t=t===void 0?null:t;var r=e();if(_o){Be(!0);try{e()}finally{Be(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=jo();if(n!==void 0){var i=n(t);if(_o){Be(!0);try{n(t)}finally{Be(!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=Ms.bind(null,z,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:function(e){e=qo(e);var t=e.queue,n=Ns.bind(null,z,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:B,useDeferredValue:function(e,t){return xs(jo(),e,t)},useTransition:function(){var e=qo(!1);return e=Cs.bind(null,z,e.queue,!0,!1),jo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=z,a=jo();if(Pi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ul===null)throw Error(i(349));H&127||Ho(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ds(Wo.bind(null,r,o,e),[e]),r.flags|=2048,ss(9,{destroy:void 0},Uo.bind(null,r,o,n,t),null),n},useId:function(){var e=jo(),t=Ul.identifierPrefix;if(Pi){var n=Ei,r=Ti;n=(r&~(1<<32-Ve(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=vo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=xo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Os,useFormState:ns,useActionState:ns,useOptimistic:function(e){var t=jo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Fs.bind(null,z,!0,n),n.dispatch=t,[e,t]},useMemoCache:Io,useCacheRefresh:function(){return jo().memoizedState=js.bind(null,z)},useEffectEvent:function(e){var t=jo(),n={impl:e};return t.memoizedState=n,function(){if(Hl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Vs={readContext:ta,use:Fo,useCallback:ys,useContext:ta,useEffect:fs,useImperativeHandle:vs,useInsertionEffect:hs,useLayoutEffect:gs,useMemo:bs,useReducer:Ro,useRef:cs,useState:function(){return Ro(Lo)},useDebugValue:B,useDeferredValue:function(e,t){return Ss(Mo(),po.memoizedState,e,t)},useTransition:function(){var e=Ro(Lo)[0],t=Mo().memoizedState;return[typeof e==`boolean`?e:Po(e),t]},useSyncExternalStore:Vo,useId:ks,useHostTransitionStatus:Os,useFormState:rs,useActionState:rs,useOptimistic:function(e,t){return Jo(Mo(),po,e,t)},useMemoCache:Io,useCacheRefresh:As};Vs.useEffectEvent=ms;var Hs={readContext:ta,use:Fo,useCallback:ys,useContext:ta,useEffect:fs,useImperativeHandle:vs,useInsertionEffect:hs,useLayoutEffect:gs,useMemo:bs,useReducer:Bo,useRef:cs,useState:function(){return Bo(Lo)},useDebugValue:B,useDeferredValue:function(e,t){var n=Mo();return po===null?xs(n,e,t):Ss(n,po.memoizedState,e,t)},useTransition:function(){var e=Bo(Lo)[0],t=Mo().memoizedState;return[typeof e==`boolean`?e:Po(e),t]},useSyncExternalStore:Vo,useId:ks,useHostTransitionStatus:Os,useFormState:os,useActionState:os,useOptimistic:function(e,t){var n=Mo();return po===null?(n.baseState=e,[e,n.queue.dispatch]):Jo(n,po,e,t)},useMemoCache:Io,useCacheRefresh:As};Hs.useEffectEvent=ms;function Us(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:p({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ws={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=yu(),i=Ua(r);i.payload=t,n!=null&&(i.callback=n),t=Wa(e,i,r),t!==null&&(xu(t,e,r),Ga(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=yu(),i=Ua(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Wa(e,i,r),t!==null&&(xu(t,e,r),Ga(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=yu(),r=Ua(n);r.tag=2,t!=null&&(r.callback=t),t=Wa(e,r,n),t!==null&&(xu(t,e,n),Ga(t,e,n))}};function Gs(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?!F(n,r)||!F(i,a):!0}function Ks(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&&Ws.enqueueReplaceState(t,t.state,null)}function qs(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=p({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Js(e){Xr(e)}function Ys(e){console.error(e)}function Xs(e){Xr(e)}function Zs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Qs(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 $s(e,t,n){return n=Ua(n),n.tag=3,n.payload={element:null},n.callback=function(){Zs(e,t)},n}function ec(e){return e=Ua(e),e.tag=3,e}function tc(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(){Qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Qs(t,n,r),typeof i!=`function`&&(lu===null?lu=new Set([this]):lu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function nc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Qi(t,n,a,!0),n=no.current,n!==null){switch(n.tag){case 31:case 13:return ro===null?Nu():n.alternate===null&&Xl===0&&(Xl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ta?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===Ta?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),Nu(),!1}if(Pi)return t=no.current,t===null?(r!==Li&&(t=Error(i(423),{cause:r}),Wi(L(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=L(r,n),a=$s(e.stateNode,r,a),Ka(e,a),Xl!==4&&(Xl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Li&&(e=Error(i(422),{cause:r}),Wi(L(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=L(o,n),nu===null?nu=[o]:nu.push(o),Xl!==4&&(Xl=2),t===null)return!0;r=L(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=$s(n.stateNode,r,e),Ka(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`&&(lu===null||!lu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=ec(a),tc(a,e,n,r),Ka(n,a),!1}n=n.return}while(n!==null);return!1}var rc=Error(i(461)),ic=!1;function ac(e,t,n,r){t.child=e===null?za(t,null,n,r):Ra(t,e.child,n,r)}function oc(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 ea(t),r=wo(e,t,n,o,a,i),s=Oo(),e!==null&&!ic?(ko(e,t,i),Ac(e,t,i)):(Pi&&s&&ki(t),t.flags|=1,ac(e,t,r,i),t.child)}function sc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!li(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,cc(e,t,a,r,i)):(e=fi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!jc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?F:n,n(o,r)&&e.ref===t.ref)return Ac(e,t,i)}return t.flags|=1,e=ui(a,r),e.ref=t.ref,e.return=t,t.child=e}function cc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(F(a,r)&&e.ref===t.ref)if(ic=!1,t.pendingProps=r=a,jc(e,i))e.flags&131072&&(ic=!0);else return t.lanes=e.lanes,Ac(e,t,i)}return gc(e,t,n,r,i)}function lc(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 dc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ba(t,a===null?null:a.cachePool),a===null?R():eo(t,a),oo(t);else return r=t.lanes=536870912,dc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ba(t,null),R(),so(t)):(ba(t,a.cachePool),eo(t,a),so(t),t.memoizedState=null);return ac(e,t,i,n),t.child}function uc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dc(e,t,n,r,i){var a=ya();return a=a===null?null:{parent:sa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ba(t,null),R(),oo(t),e!==null&&Qi(e,t,r,!0),t.childLanes=i,null}function fc(e,t){return t=Tc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function pc(e,t,n){return Ra(t,e.child,null,n),e=fc(t,t.pendingProps),e.flags|=2,co(t),t.memoizedState=null,e}function mc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Pi){if(r.mode===`hidden`)return e=fc(t,r),t.lanes=536870912,uc(null,e);if(ao(t),(e=Ni)?(e=ff(e,Ii),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=hi(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Ri(t);return t.lanes=536870912,null}return fc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(ao(t),a)if(t.flags&256)t.flags&=-257,t=pc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(ic||Qi(e,t,n,!1),a=(n&e.childLanes)!==0,ic||a){if(r=Ul,r!==null&&(s=it(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ri(e,s),xu(r,e,s),rc;Nu(),t=pc(e,t,n)}else e=o.treeContext,Ni=gf(s.nextSibling),Mi=t,Pi=!0,Fi=null,Ii=!1,e!==null&&ji(t,e),t=fc(t,r),t.flags|=4096;return t}return e=ui(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function hc(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 gc(e,t,n,r,i){return ea(t),n=wo(e,t,n,r,void 0,i),r=Oo(),e!==null&&!ic?(ko(e,t,i),Ac(e,t,i)):(Pi&&r&&ki(t),t.flags|=1,ac(e,t,n,i),t.child)}function _c(e,t,n,r,i,a){return ea(t),t.updateQueue=null,n=Eo(t,r,n,i),To(e),r=Oo(),e!==null&&!ic?(ko(e,t,a),Ac(e,t,a)):(Pi&&r&&ki(t),t.flags|=1,ac(e,t,n,a),t.child)}function vc(e,t,n,r,i){if(ea(t),t.stateNode===null){var a=oi,o=n.contextType;typeof o==`object`&&o&&(a=ta(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ws,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Va(t),o=n.contextType,a.context=typeof o==`object`&&o?ta(o):oi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Us(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&&Ws.enqueueReplaceState(a,a.state,null),Ya(t,r,a,i),Ja(),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=qs(n,s);a.props=c;var l=a.context,u=n.contextType;o=oi,typeof u==`object`&&u&&(o=ta(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)&&Ks(t,a,r,o),Ba=!1;var f=t.memoizedState;a.state=f,Ya(t,r,a,i),Ja(),l=t.memoizedState,s||f!==l||Ba?(typeof d==`function`&&(Us(t,n,d,r),l=t.memoizedState),(c=Ba||Gs(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,Ha(e,t),o=t.memoizedProps,u=qs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=oi,typeof l==`object`&&l&&(c=ta(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)&&Ks(t,a,r,c),Ba=!1,f=t.memoizedState,a.state=f,Ya(t,r,a,i),Ja();var p=t.memoizedState;o!==d||f!==p||Ba||e!==null&&e.dependencies!==null&&$i(e.dependencies)?(typeof s==`function`&&(Us(t,n,s,r),p=t.memoizedState),(u=Ba||Gs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&$i(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,hc(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=Ra(t,e.child,null,i),t.child=Ra(t,null,n,i)):ac(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ac(e,t,i),e}function yc(e,t,n,r){return Hi(),t.flags|=256,ac(e,t,n,r),t.child}var bc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xc(e){return{baseLanes:e,cachePool:xa()}}function Sc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=eu),e}function Cc(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:(lo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Pi){if(a?io(t):so(t),(e=Ni)?(e=ff(e,Ii),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=hi(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Ri(t);return mf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(so(t),a=t.mode,c=Tc({mode:`hidden`,children:c},a),r=pi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(null,r)):(io(t),wc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(io(t),t.flags&=-257,t=Ec(e,t,n)):t.memoizedState===null?(so(t),c=r.fallback,a=t.mode,r=Tc({mode:`visible`,children:r.children},a),c=pi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ra(t,e.child,null,n),r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,t=uc(null,r)):(so(t),t.child=e.child,t.flags|=128,t=null);else if(io(t),mf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Wi({value:r,source:null,stack:null}),t=Ec(e,t,n)}else if(ic||Qi(e,t,n,!1),s=(n&e.childLanes)!==0,ic||s){if(s=Ul,s!==null&&(r=it(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ri(e,r),xu(s,e,r),rc;pf(c)||Nu(),t=Ec(e,t,n)}else pf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ni=gf(c.nextSibling),Mi=t,Pi=!0,Fi=null,Ii=!1,e!==null&&ji(t,e),t=wc(t,r.children),t.flags|=4096);return t}return a?(so(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ui(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=pi(c,a,n,null),c.flags|=2):c=ui(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,uc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=xc(n):(a=c.cachePool,a===null?a=xa():(l=sa._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(e.child,r)):(io(t),n=e.child,e=n.sibling,n=ui(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 wc(e,t){return t=Tc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Tc(e,t){return e=ci(22,e,null,t),e.lanes=0,e}function Ec(e,t,n){return Ra(t,e.child,null,n),e=wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Dc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xi(e.return,t,n)}function Oc(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 kc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=lo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,ce(lo,o),ac(e,t,r,n),r=Pi?xi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dc(e,n,t);else if(e.tag===19)Dc(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&&uo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Oc(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&&uo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Oc(t,!0,n,null,a,r);break;case`together`:Oc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Zl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Qi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ui(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ui(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function jc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&$i(e))):!0}function Mc(e,t,n){switch(t.tag){case 3:pe(t,t.stateNode.containerInfo),Ji(t,sa,e.memoizedState.cache),Hi();break;case 27:case 5:he(t);break;case 4:pe(t,t.stateNode.containerInfo);break;case 10:Ji(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,ao(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(io(t),e=Ac(e,t,n),e===null?null:e.sibling):Cc(e,t,n):(io(t),t.flags|=128,null);io(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Qi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return kc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ce(lo,lo.current),r)break;return null;case 22:return t.lanes=0,lc(e,t,n,t.pendingProps);case 24:Ji(t,sa,e.memoizedState.cache)}return Ac(e,t,n)}function Nc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ic=!0;else{if(!jc(e,n)&&!(t.flags&128))return ic=!1,Mc(e,t,n);ic=!!(e.flags&131072)}else ic=!1,Pi&&t.flags&1048576&&Oi(t,xi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Oa(t.elementType),t.type=e,typeof e==`function`)li(e)?(r=qs(e,r),t.tag=1,t=vc(null,t,e,r,n)):(t.tag=0,t=gc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===S){t.tag=11,t=oc(null,t,e,r,n);break a}else if(a===T){t.tag=14,t=sc(null,t,e,r,n);break a}}throw t=re(e)||e,Error(i(306,t,``))}}return t;case 0:return gc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=qs(r,t.pendingProps),vc(e,t,r,a,n);case 3:a:{if(pe(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ha(e,t),Ya(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ji(t,sa,r),r!==o.cache&&Zi(t,[sa],n,!0),Ja(),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=yc(e,t,r,n);break a}else if(r!==a){a=L(Error(i(424)),t),Wi(a),t=yc(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(Ni=gf(e.firstChild),Mi=t,Pi=!0,Fi=null,Ii=!0,n=za(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Hi(),r===a){t=Ac(e,t,n);break a}ac(e,t,r,n)}t=t.child}return t;case 26:return hc(e,t),e===null?(n=If(t.type,null,t.pendingProps,null))?t.memoizedState=n:Pi||(n=t.type,e=t.pendingProps,r=Jd(de.current).createElement(n),r[ut]=t,r[dt]=e,Hd(r,n,e),Ct(r),t.stateNode=r):t.memoizedState=If(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return he(t),e===null&&Pi&&(r=t.stateNode=bf(t.type,t.pendingProps,de.current),Mi=t,Ii=!0,a=Ni,of(t.type)?(_f=a,Ni=gf(r.firstChild)):Ni=a),ac(e,t,t.pendingProps.children,n),hc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Pi&&((a=r=Ni)&&(r=uf(r,t.type,t.pendingProps,Ii),r===null?a=!1:(t.stateNode=r,Mi=t,Ni=gf(r.firstChild),Ii=!1,a=!0)),a||Ri(t)),he(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Zd(a,o)?r=null:s!==null&&Zd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=wo(e,t,Do,null,null,n),ap._currentValue=a),hc(e,t),ac(e,t,r,n),t.child;case 6:return e===null&&Pi&&((e=n=Ni)&&(n=df(n,t.pendingProps,Ii),n===null?e=!1:(t.stateNode=n,Mi=t,Ni=null,e=!0)),e||Ri(t)),null;case 13:return Cc(e,t,n);case 4:return pe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ra(t,null,r,n):ac(e,t,r,n),t.child;case 11:return oc(e,t,t.type,t.pendingProps,n);case 7:return ac(e,t,t.pendingProps,n),t.child;case 8:return ac(e,t,t.pendingProps.children,n),t.child;case 12:return ac(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ji(t,t.type,r.value),ac(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,ea(t),a=ta(a),r=r(a),t.flags|=1,ac(e,t,r,n),t.child;case 14:return sc(e,t,t.type,t.pendingProps,n);case 15:return cc(e,t,t.type,t.pendingProps,n);case 19:return kc(e,t,n);case 31:return mc(e,t,n);case 22:return lc(e,t,n,t.pendingProps);case 24:return ea(t),r=ta(sa),e===null?(a=ya(),a===null&&(a=Ul,o=ca(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Va(t),Ji(t,sa,a)):((e.lanes&n)!==0&&(Ha(e,t),Ya(t,null,null,n),Ja()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ji(t,sa,r),r!==a.cache&&Zi(t,[sa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ji(t,sa,r))),ac(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Pc(e){e.flags|=4}function Fc(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(Au())e.flags|=8192;else throw ka=Ta,Ca}else e.flags&=-16777217}function Ic(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Zf(t))if(Au())e.flags|=8192;else throw ka=Ta,Ca}function Lc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Qe(),e.lanes|=t,tu|=t)}function Rc(e,t){if(!Pi)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 zc(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 Bc(e,t,n){var r=t.pendingProps;switch(Ai(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zc(t),null;case 1:return zc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Yi(sa),me(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Vi(t)?Pc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ui())),zc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Pc(t),o===null?(zc(t),Fc(t,a,null,r,n)):(zc(t),Ic(t,o))):o?o===e.memoizedState?(zc(t),t.flags&=-16777217):(Pc(t),zc(t),Ic(t,o)):(e=e.memoizedProps,e!==r&&Pc(t),zc(t),Fc(t,a,e,r,n)),null;case 27:if(ge(t),n=de.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return zc(t),null}e=le.current,Vi(t)?zi(t,e):(e=bf(a,r,n),t.stateNode=e,Pc(t))}return zc(t),null;case 5:if(ge(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return zc(t),null}if(o=le.current,Vi(t))zi(t,o);else{var s=Jd(de.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[ut]=t,o[dt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Hd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return zc(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=de.current,Vi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Mi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[ut]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||zd(e.nodeValue,n)),e||Ri(t,!0)}else e=Jd(e).createTextNode(r),e[ut]=t,t.stateNode=e}return zc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Vi(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[ut]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),e=!1}else n=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(co(t),t):(co(t),null);if(t.flags&128)throw Error(i(558))}return zc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Vi(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[ut]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),a=!1}else a=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(co(t),t):(co(t),null)}return co(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),Lc(t,t.updateQueue),zc(t),null);case 4:return me(),e===null&&kd(t.stateNode.containerInfo),zc(t),null;case 10:return Yi(t.type),zc(t),null;case 19:if(se(lo),r=t.memoizedState,r===null)return zc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Rc(r,!1);else{if(Xl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=uo(e),o!==null){for(t.flags|=128,Rc(r,!1),e=o.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)di(n,e),n=n.sibling;return ce(lo,lo.current&1|2),Pi&&Di(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ke()>su&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304)}else{if(!a)if(e=uo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Pi)return zc(t),null}else 2*ke()-r.renderingStartTime>su&&n!==536870912&&(t.flags|=128,a=!0,Rc(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?(zc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ke(),e.sibling=null,n=lo.current,ce(lo,a?n&1|2:n&1),Pi&&Di(t,r.treeForkCount),e);case 22:case 23:return co(t),to(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(zc(t),t.subtreeFlags&6&&(t.flags|=8192)):zc(t),n=t.updateQueue,n!==null&&Lc(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&&se(va),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Yi(sa),zc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Vc(e,t){switch(Ai(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yi(sa),me(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ge(t),null;case 31:if(t.memoizedState!==null){if(co(t),t.alternate===null)throw Error(i(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(co(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return se(lo),null;case 4:return me(),null;case 10:return Yi(t.type),null;case 22:case 23:return co(t),to(),e!==null&&se(va),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Yi(sa),null;case 25:return null;default:return null}}function Hc(e,t){switch(Ai(t),t.tag){case 3:Yi(sa),me();break;case 26:case 27:case 5:ge(t);break;case 4:me();break;case 31:t.memoizedState!==null&&co(t);break;case 13:co(t);break;case 19:se(lo);break;case 10:Yi(t.type);break;case 22:case 23:co(t),to(),e!==null&&se(va);break;case 24:Yi(sa)}}function Uc(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){Zu(t,t.return,e)}}function Wc(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){Zu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Zu(t,t.return,e)}}function Gc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Za(t,n)}catch(t){Zu(e,e.return,t)}}}function Kc(e,t,n){n.props=qs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Zu(e,t,n)}}function qc(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){Zu(e,t,n)}}function Jc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Zu(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){Zu(e,t,n)}else n.current=null}function Yc(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){Zu(e,e.return,t)}}function Xc(e,t,n){try{var r=e.stateNode;Ud(r,e.type,n,t),r[dt]=t}catch(t){Zu(e,e.return,t)}}function Zc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&of(e.type)||e.tag===4}function Qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Zc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&of(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $c(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=nn));else if(r!==4&&(r===27&&of(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&of(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function tl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Hd(t,r,n),t[ut]=e,t[dt]=n}catch(t){Zu(e,e.return,t)}}var nl=!1,rl=!1,il=!1,al=typeof WeakSet==`function`?WeakSet:Set,ol=null;function sl(e,t){if(e=e.containerInfo,Kd=mp,e=Or(e),kr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(qd={focusedElem:e,selectionRange:n},mp=!1,ol=t;ol!==null;)if(t=ol,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ol=e;else for(;ol!==null;){switch(t=ol,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=qs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Zu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)lf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:lf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,ol=e;break}ol=t.return}}function cl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Cl(e,n),r&4&&Uc(5,n);break;case 1:if(Cl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Zu(n,n.return,e)}else{var i=qs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Zu(n,n.return,e)}}r&64&&Gc(n),r&512&&qc(n,n.return);break;case 3:if(Cl(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{Za(e,t)}catch(e){Zu(n,n.return,e)}}break;case 27:t===null&&r&4&&tl(n);case 26:case 5:Cl(e,n),t===null&&r&4&&Yc(n),r&512&&qc(n,n.return);break;case 12:Cl(e,n);break;case 31:Cl(e,n),r&4&&ml(e,n);break;case 13:Cl(e,n),r&4&&hl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=td.bind(null,n),hf(e,n))));break;case 22:if(r=n.memoizedState!==null||nl,!r){t=t!==null&&t.memoizedState!==null||rl,i=nl;var a=rl;nl=r,(rl=t)&&!a?Tl(e,n,(n.subtreeFlags&8772)!=0):Cl(e,n),nl=i,rl=a}break;case 30:break;default:Cl(e,n)}}function ll(e){var t=e.alternate;t!==null&&(e.alternate=null,ll(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&vt(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 ul=null,dl=!1;function fl(e,t,n){for(n=n.child;n!==null;)pl(e,t,n),n=n.sibling}function pl(e,t,n){if(ze&&typeof ze.onCommitFiberUnmount==`function`)try{ze.onCommitFiberUnmount(Re,n)}catch{}switch(n.tag){case 26:rl||Jc(n,t),fl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:rl||Jc(n,t);var r=ul,i=dl;of(n.type)&&(ul=n.stateNode,dl=!1),fl(e,t,n),xf(n.stateNode),ul=r,dl=i;break;case 5:rl||Jc(n,t);case 6:if(r=ul,i=dl,ul=null,fl(e,t,n),ul=r,dl=i,ul!==null)if(dl)try{(ul.nodeType===9?ul.body:ul.nodeName===`HTML`?ul.ownerDocument.body:ul).removeChild(n.stateNode)}catch(e){Zu(n,t,e)}else try{ul.removeChild(n.stateNode)}catch(e){Zu(n,t,e)}break;case 18:ul!==null&&(dl?(e=ul,sf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Bp(e)):sf(ul,n.stateNode));break;case 4:r=ul,i=dl,ul=n.stateNode.containerInfo,dl=!0,fl(e,t,n),ul=r,dl=i;break;case 0:case 11:case 14:case 15:Wc(2,n,t),rl||Wc(4,n,t),fl(e,t,n);break;case 1:rl||(Jc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Kc(n,t,r)),fl(e,t,n);break;case 21:fl(e,t,n);break;case 22:rl=(r=rl)||n.memoizedState!==null,fl(e,t,n),rl=r;break;default:fl(e,t,n)}}function ml(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Bp(e)}catch(e){Zu(t,t.return,e)}}}function hl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Bp(e)}catch(e){Zu(t,t.return,e)}}function gl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new al),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new al),t;default:throw Error(i(435,e.tag))}}function _l(e,t){var n=gl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=nd.bind(null,e,t);t.then(r,r)}})}function vl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(of(c.type)){ul=c.stateNode,dl=!1;break a}break;case 5:ul=c.stateNode,dl=!1;break a;case 3:case 4:ul=c.stateNode.containerInfo,dl=!0;break a}c=c.return}if(ul===null)throw Error(i(160));pl(o,s,a),ul=null,dl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)bl(t,e),t=t.sibling}var yl=null;function bl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:vl(t,e),xl(e),r&4&&(Wc(3,e,e.return),Uc(3,e),Wc(5,e,e.return));break;case 1:vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),r&64&&nl&&(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=yl;if(vl(t,e),xl(e),r&512&&(rl||n===null||Jc(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[_t]||o[ut]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Hd(o,r,n),o[ut]=e,Ct(o),r=o;break a;case`link`:var s=Jf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Hd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Jf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Hd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ut]=e,Ct(o),r=o}e.stateNode=r}else Yf(a,e.type,e.stateNode);else e.stateNode=Uf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Xc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Yf(a,e.type,e.stateNode):Uf(a,r,e.memoizedProps))}break;case 27:vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),n!==null&&r&4&&Xc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),e.flags&32){a=e.stateNode;try{Jt(a,``)}catch(t){Zu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Xc(e,a,n===null?a:n.memoizedProps)),r&1024&&(il=!0);break;case 6:if(vl(t,e),xl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Zu(e,e.return,t)}}break;case 3:if(qf=null,a=yl,yl=Cf(t.containerInfo),vl(t,e),yl=a,xl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Bp(t.containerInfo)}catch(t){Zu(e,e.return,t)}il&&(il=!1,Sl(e));break;case 4:r=yl,yl=Cf(e.stateNode.containerInfo),vl(t,e),xl(e),yl=r;break;case 12:vl(t,e),xl(e);break;case 31:vl(t,e),xl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 13:vl(t,e),xl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(au=ke()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=nl,d=rl;if(nl=u||a,rl=d||l,vl(t,e),rl=d,nl=u,xl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||nl||rl||wl(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){Zu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Zu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?cf(m,!0):cf(l.stateNode,!1)}catch(e){Zu(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,_l(e,n))));break;case 19:vl(t,e),xl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 30:break;case 21:break;default:vl(t,e),xl(e)}}function xl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Zc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;el(e,Qc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Jt(o,``),n.flags&=-33),el(e,Qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;$c(e,Qc(e),s);break;default:throw Error(i(161))}}catch(t){Zu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Sl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Sl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Cl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cl(e,t.alternate,t),t=t.sibling}function wl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Wc(4,t,t.return),wl(t);break;case 1:Jc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Kc(t,t.return,n),wl(t);break;case 27:xf(t.stateNode);case 26:case 5:Jc(t,t.return),wl(t);break;case 22:t.memoizedState===null&&wl(t);break;case 30:wl(t);break;default:wl(t)}e=e.sibling}}function Tl(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:Tl(i,a,n),Uc(4,a);break;case 1:if(Tl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Zu(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++)Xa(c[i],s)}catch(e){Zu(r,r.return,e)}}n&&o&64&&Gc(a),qc(a,a.return);break;case 27:tl(a);case 26:case 5:Tl(i,a,n),n&&r===null&&o&4&&Yc(a),qc(a,a.return);break;case 12:Tl(i,a,n);break;case 31:Tl(i,a,n),n&&o&4&&ml(i,a);break;case 13:Tl(i,a,n),n&&o&4&&hl(i,a);break;case 22:a.memoizedState===null&&Tl(i,a,n),qc(a,a.return);break;case 30:break;default:Tl(i,a,n)}t=t.sibling}}function El(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&&la(n))}function Dl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&la(e))}function Ol(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)kl(e,t,n,r),t=t.sibling}function kl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Ol(e,t,n,r),i&2048&&Uc(9,t);break;case 1:Ol(e,t,n,r);break;case 3:Ol(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&&la(e)));break;case 12:if(i&2048){Ol(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){Zu(t,t.return,e)}}else Ol(e,t,n,r);break;case 31:Ol(e,t,n,r);break;case 13:Ol(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Ol(e,t,n,r):(a._visibility|=2,Al(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Ol(e,t,n,r):jl(e,t),i&2048&&El(o,t);break;case 24:Ol(e,t,n,r),i&2048&&Dl(t.alternate,t);break;default:Ol(e,t,n,r)}}function Al(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:Al(a,o,s,c,i),Uc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Al(a,o,s,c,i)):u._visibility&2?Al(a,o,s,c,i):jl(a,o),i&&l&2048&&El(o.alternate,o);break;case 24:Al(a,o,s,c,i),i&&l&2048&&Dl(o.alternate,o);break;default:Al(a,o,s,c,i)}t=t.sibling}}function jl(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:jl(n,r),i&2048&&El(r.alternate,r);break;case 24:jl(n,r),i&2048&&Dl(r.alternate,r);break;default:jl(n,r)}t=t.sibling}}var Ml=8192;function Nl(e,t,n){if(e.subtreeFlags&Ml)for(e=e.child;e!==null;)Pl(e,t,n),e=e.sibling}function Pl(e,t,n){switch(e.tag){case 26:Nl(e,t,n),e.flags&Ml&&e.memoizedState!==null&&Qf(n,yl,e.memoizedState,e.memoizedProps);break;case 5:Nl(e,t,n);break;case 3:case 4:var r=yl;yl=Cf(e.stateNode.containerInfo),Nl(e,t,n),yl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ml,Ml=16777216,Nl(e,t,n),Ml=r):Nl(e,t,n));break;default:Nl(e,t,n)}}function Fl(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 Il(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ol=r,zl(r,e)}Fl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ll(e),e=e.sibling}function Ll(e){switch(e.tag){case 0:case 11:case 15:Il(e),e.flags&2048&&Wc(9,e,e.return);break;case 3:Il(e);break;case 12:Il(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Rl(e)):Il(e);break;default:Il(e)}}function Rl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ol=r,zl(r,e)}Fl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Wc(8,t,t.return),Rl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Rl(t));break;default:Rl(t)}e=e.sibling}}function zl(e,t){for(;ol!==null;){var n=ol;switch(n.tag){case 0:case 11:case 15:Wc(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:la(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ol=r;else a:for(n=e;ol!==null;){r=ol;var i=r.sibling,a=r.return;if(ll(r),r===n){ol=null;break a}if(i!==null){i.return=a,ol=i;break a}ol=a}}}var Bl={getCacheForType:function(e){var t=ta(sa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ta(sa).controller.signal}},Vl=typeof WeakMap==`function`?WeakMap:Map,Hl=0,Ul=null,V=null,H=0,Wl=0,Gl=null,Kl=!1,ql=!1,Jl=!1,Yl=0,Xl=0,Zl=0,Ql=0,$l=0,eu=0,tu=0,nu=null,ru=null,iu=!1,au=0,ou=0,su=1/0,cu=null,lu=null,uu=0,du=null,fu=null,pu=0,mu=0,hu=null,gu=null,_u=0,vu=null;function yu(){return Hl&2&&H!==0?H&-H:k.T===null?st():vd()}function bu(){if(eu===0)if(!(H&536870912)||Pi){var e=Ke;Ke<<=1,!(Ke&3932160)&&(Ke=262144),eu=e}else eu=536870912;return e=no.current,e!==null&&(e.flags|=32),eu}function xu(e,t,n){(e===Ul&&(Wl===2||Wl===9)||e.cancelPendingCommit!==null)&&(Ou(e,0),Tu(e,H,eu,!1)),et(e,n),(!(Hl&2)||e!==Ul)&&(e===Ul&&(!(Hl&2)&&(Ql|=n),Xl===4&&Tu(e,H,eu,!1)),ud(e))}function Su(e,t,n){if(Hl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Xe(e,t),a=r?Iu(e,t):Pu(e,t,!0),o=r;do{if(a===0){ql&&!r&&Tu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!wu(n)){a=Pu(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=nu;var l=c.current.memoizedState.isDehydrated;if(l&&(Ou(c,s).flags|=256),s=Pu(c,s,!1),s!==2){if(Jl&&!l){c.errorRecoveryDisabledLanes|=o,Ql|=o,a=4;break a}o=ru,ru=a,o!==null&&(ru===null?ru=o:ru.push.apply(ru,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Ou(e,0),Tu(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:Tu(r,t,eu,!Kl);break a;case 2:ru=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=au+300-ke(),10<a)){if(Tu(r,t,eu,!Kl),Ye(r,0,!0)!==0)break a;pu=t,r.timeoutHandle=ef(Cu.bind(null,r,n,ru,cu,iu,t,eu,Ql,tu,Kl,o,`Throttled`,-0,0),a);break a}Cu(r,n,ru,cu,iu,t,eu,Ql,tu,Kl,o,null,-0,0)}}break}while(1);ud(e)}function Cu(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:nn},Pl(t,a,d);var m=(a&62914560)===a?au-ke():(a&4194048)===a?ou-ke():0;if(m=ep(d,m),m!==null){pu=a,e.cancelPendingCommit=m(Uu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Tu(e,a,o,!l);return}}Uu(e,t,a,n,r,i,o,s,c)}function wu(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(!wr(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 Tu(e,t,n,r){t&=~$l,t&=~Ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ve(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&nt(e,n,t)}function Eu(){return Hl&6?!0:(dd(0,!1),!1)}function Du(){if(V!==null){if(Wl===0)var e=V.return;else e=V,qi=Ki=null,Ao(e),Ma=null,Na=0,e=V;for(;e!==null;)Hc(e.alternate,e),e=e.return;V=null}}function Ou(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,tf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),pu=0,Du(),Ul=e,V=n=ui(e.current,null),H=t,Wl=0,Gl=null,Kl=!1,ql=Xe(e,t),Jl=!1,tu=eu=$l=Ql=Zl=Xl=0,ru=nu=null,iu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ve(r),a=1<<i;t|=e[i],r&=~a}return Yl=t,ei(),n}function ku(e,t){z=null,k.H=zs,t===Sa||t===wa?(t=Aa(),Wl=3):t===Ca?(t=Aa(),Wl=4):Wl=t===rc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Gl=t,V===null&&(Xl=1,Zs(e,L(t,e.current)))}function Au(){var e=no.current;return e===null?!0:(H&4194048)===H?ro===null:(H&62914560)===H||H&536870912?e===ro:!1}function ju(){var e=k.H;return k.H=zs,e===null?zs:e}function Mu(){var e=k.A;return k.A=Bl,e}function Nu(){Xl=4,Kl||(H&4194048)!==H&&no.current!==null||(ql=!0),!(Zl&134217727)&&!(Ql&134217727)||Ul===null||Tu(Ul,H,eu,!1)}function Pu(e,t,n){var r=Hl;Hl|=2;var i=ju(),a=Mu();(Ul!==e||H!==t)&&(cu=null,Ou(e,t)),t=!1;var o=Xl;a:do try{if(Wl!==0&&V!==null){var s=V,c=Gl;switch(Wl){case 8:Du(),o=6;break a;case 3:case 2:case 9:case 6:no.current===null&&(t=!0);var l=Wl;if(Wl=0,Gl=null,Bu(e,s,c,l),n&&ql){o=0;break a}break;default:l=Wl,Wl=0,Gl=null,Bu(e,s,c,l)}}Fu(),o=Xl;break}catch(t){ku(e,t)}while(1);return t&&e.shellSuspendCounter++,qi=Ki=null,Hl=r,k.H=i,k.A=a,V===null&&(Ul=null,H=0,ei()),o}function Fu(){for(;V!==null;)Ru(V)}function Iu(e,t){var n=Hl;Hl|=2;var r=ju(),a=Mu();Ul!==e||H!==t?(cu=null,su=ke()+500,Ou(e,t)):ql=Xe(e,t);a:do try{if(Wl!==0&&V!==null){t=V;var o=Gl;b:switch(Wl){case 1:Wl=0,Gl=null,Bu(e,t,o,1);break;case 2:case 9:if(Ea(o)){Wl=0,Gl=null,zu(t);break}t=function(){Wl!==2&&Wl!==9||Ul!==e||(Wl=7),ud(e)},o.then(t,t);break a;case 3:Wl=7;break a;case 4:Wl=5;break a;case 7:Ea(o)?(Wl=0,Gl=null,zu(t)):(Wl=0,Gl=null,Bu(e,t,o,7));break;case 5:var s=null;switch(V.tag){case 26:s=V.memoizedState;case 5:case 27:var c=V;if(s?Zf(s):c.stateNode.complete){Wl=0,Gl=null;var l=c.sibling;if(l!==null)V=l;else{var u=c.return;u===null?V=null:(V=u,Vu(u))}break b}}Wl=0,Gl=null,Bu(e,t,o,5);break;case 6:Wl=0,Gl=null,Bu(e,t,o,6);break;case 8:Du(),Xl=6;break a;default:throw Error(i(462))}}Lu();break}catch(t){ku(e,t)}while(1);return qi=Ki=null,k.H=r,k.A=a,Hl=n,V===null?(Ul=null,H=0,ei(),Xl):0}function Lu(){for(;V!==null&&!De();)Ru(V)}function Ru(e){var t=Nc(e.alternate,e,Yl);e.memoizedProps=e.pendingProps,t===null?Vu(e):V=t}function zu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=_c(n,t,t.pendingProps,t.type,void 0,H);break;case 11:t=_c(n,t,t.pendingProps,t.type.render,t.ref,H);break;case 5:Ao(t);default:Hc(n,t),t=V=di(t,Yl),t=Nc(n,t,Yl)}e.memoizedProps=e.pendingProps,t===null?Vu(e):V=t}function Bu(e,t,n,r){qi=Ki=null,Ao(t),Ma=null,Na=0;var i=t.return;try{if(nc(e,i,t,n,H)){Xl=1,Zs(e,L(n,e.current)),V=null;return}}catch(t){if(i!==null)throw V=i,t;Xl=1,Zs(e,L(n,e.current)),V=null;return}t.flags&32768?(Pi||r===1?e=!0:ql||H&536870912?e=!1:(Kl=e=!0,(r===2||r===9||r===3||r===6)&&(r=no.current,r!==null&&r.tag===13&&(r.flags|=16384))),Hu(t,e)):Vu(t)}function Vu(e){var t=e;do{if(t.flags&32768){Hu(t,Kl);return}e=t.return;var n=Bc(t.alternate,t,Yl);if(n!==null){V=n;return}if(t=t.sibling,t!==null){V=t;return}V=t=e}while(t!==null);Xl===0&&(Xl=5)}function Hu(e,t){do{var n=Vc(e.alternate,e);if(n!==null){n.flags&=32767,V=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){V=e;return}V=e=n}while(e!==null);Xl=6,V=null}function Uu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Ju();while(uu!==0);if(Hl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=$r,tt(e,n,o,s,c,l),e===Ul&&(V=Ul=null,H=0),fu=t,du=e,pu=n,mu=o,hu=a,gu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,rd(Ne,function(){return Yu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=k.T,k.T=null,a=A.p,A.p=2,s=Hl,Hl|=4;try{sl(e,t,n)}finally{Hl=s,A.p=a,k.T=r}}uu=1,Wu(),Gu(),Ku()}}function Wu(){if(uu===1){uu=0;var e=du,t=fu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=k.T,k.T=null;var r=A.p;A.p=2;var i=Hl;Hl|=4;try{bl(t,e);var a=qd,o=Or(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Dr(s.ownerDocument.documentElement,s)){if(c!==null&&kr(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 _=Er(s,h),v=Er(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}}mp=!!Kd,qd=Kd=null}finally{Hl=i,A.p=r,k.T=n}}e.current=t,uu=2}}function Gu(){if(uu===2){uu=0;var e=du,t=fu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=k.T,k.T=null;var r=A.p;A.p=2;var i=Hl;Hl|=4;try{cl(e,t.alternate,t)}finally{Hl=i,A.p=r,k.T=n}}uu=3}}function Ku(){if(uu===4||uu===3){uu=0,Oe();var e=du,t=fu,n=pu,r=gu;t.subtreeFlags&10256||t.flags&10256?uu=5:(uu=0,fu=du=null,qu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(lu=null),ot(n),t=t.stateNode,ze&&typeof ze.onCommitFiberRoot==`function`)try{ze.onCommitFiberRoot(Re,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=k.T,i=A.p,A.p=2,k.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{k.T=t,A.p=i}}pu&3&&Ju(),ud(e),i=e.pendingLanes,n&261930&&i&42?e===vu?_u++:(_u=0,vu=e):_u=0,dd(0,!1)}}function qu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,la(t)))}function Ju(){return Wu(),Gu(),Ku(),Yu()}function Yu(){if(uu!==5)return!1;var e=du,t=mu;mu=0;var n=ot(pu),r=k.T,a=A.p;try{A.p=32>n?32:n,k.T=null,n=hu,hu=null;var o=du,s=pu;if(uu=0,fu=du=null,pu=0,Hl&6)throw Error(i(331));var c=Hl;if(Hl|=4,Ll(o.current),kl(o,o.current,s,n),Hl=c,dd(0,!1),ze&&typeof ze.onPostCommitFiberRoot==`function`)try{ze.onPostCommitFiberRoot(Re,o)}catch{}return!0}finally{A.p=a,k.T=r,qu(e,t)}}function Xu(e,t,n){t=L(n,t),t=$s(e.stateNode,t,2),e=Wa(e,t,2),e!==null&&(et(e,2),ud(e))}function Zu(e,t,n){if(e.tag===3)Xu(e,e,n);else for(;t!==null;){if(t.tag===3){Xu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(lu===null||!lu.has(r))){e=L(n,e),n=ec(2),r=Wa(t,n,2),r!==null&&(tc(n,r,t,e),et(r,2),ud(r));break}}t=t.return}}function Qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Vl;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)||(Jl=!0,i.add(n),e=$u.bind(null,e,t,n),t.then(e,e))}function $u(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ul===e&&(H&n)===n&&(Xl===4||Xl===3&&(H&62914560)===H&&300>ke()-au?!(Hl&2)&&Ou(e,0):$l|=n,tu===H&&(tu=0)),ud(e)}function ed(e,t){t===0&&(t=Qe()),e=ri(e,t),e!==null&&(et(e,t),ud(e))}function td(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ed(e,n)}function nd(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),ed(e,n)}function rd(e,t){return Te(e,t)}var id=null,ad=null,od=!1,sd=!1,cd=!1,ld=0;function ud(e){e!==ad&&e.next===null&&(ad===null?id=ad=e:ad=ad.next=e),sd=!0,od||(od=!0,_d())}function dd(e,t){if(!cd&&sd){cd=!0;do for(var n=!1,r=id;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-Ve(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,gd(r,a))}else a=H,a=Ye(r,r===Ul?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Xe(r,a)||(n=!0,gd(r,a));r=r.next}while(n);cd=!1}}function fd(){pd()}function pd(){sd=od=!1;var e=0;ld!==0&&$d()&&(e=ld);for(var t=ke(),n=null,r=id;r!==null;){var i=r.next,a=md(r,t);a===0?(r.next=null,n===null?id=i:n.next=i,i===null&&(ad=n)):(n=r,(e!==0||a&3)&&(sd=!0)),r=i}uu!==0&&uu!==5||dd(e,!1),ld!==0&&(ld=0)}function md(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ve(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ze(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ul,n=H,n=Ye(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Wl===2||Wl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ee(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Xe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ee(r),ot(n)){case 2:case 8:n=Me;break;case 32:n=Ne;break;case 268435456:n=Fe;break;default:n=Ne}return r=hd.bind(null,e),n=Te(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ee(r),e.callbackPriority=2,e.callbackNode=null,2}function hd(e,t){if(uu!==0&&uu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ju()&&e.callbackNode!==n)return null;var r=H;return r=Ye(e,e===Ul?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Su(e,r,t),md(e,ke()),e.callbackNode!=null&&e.callbackNode===n?hd.bind(null,e):null)}function gd(e,t){if(Ju())return null;Su(e,t,!0)}function _d(){rf(function(){Hl&6?Te(je,fd):pd()})}function vd(){if(ld===0){var e=fa;e===0&&(e=Ge,Ge<<=1,!(Ge&261888)&&(Ge=256)),ld=e}return ld}function yd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:tn(``+e)}function bd(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 xd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=yd((i[dt]||null).action),o=r.submitter;o&&(t=(t=o[dt]||null)?yd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new wn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ld!==0){var e=o?bd(i,o):new FormData(i);Ts(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?bd(i,o):new FormData(i),Ts(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Sd=0;Sd<Jr.length;Sd++){var Cd=Jr[Sd];Yr(Cd.toLowerCase(),`on`+(Cd[0].toUpperCase()+Cd.slice(1)))}Yr(Br,`onAnimationEnd`),Yr(Vr,`onAnimationIteration`),Yr(Hr,`onAnimationStart`),Yr(`dblclick`,`onDoubleClick`),Yr(`focusin`,`onFocus`),Yr(`focusout`,`onBlur`),Yr(Ur,`onTransitionRun`),Yr(Wr,`onTransitionStart`),Yr(Gr,`onTransitionCancel`),Yr(Kr,`onTransitionEnd`),Et(`onMouseEnter`,[`mouseout`,`mouseover`]),Et(`onMouseLeave`,[`mouseout`,`mouseover`]),Et(`onPointerEnter`,[`pointerout`,`pointerover`]),Et(`onPointerLeave`,[`pointerout`,`pointerover`]),Tt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Tt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Tt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Tt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Tt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Tt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var wd=`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(` `),Td=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(wd));function Ed(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){Xr(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){Xr(e)}i.currentTarget=null,a=c}}}}function U(e,t){var n=t[pt];n===void 0&&(n=t[pt]=new Set);var r=e+`__bubble`;n.has(r)||(Ad(t,e,2,!1),n.add(r))}function Dd(e,t,n){var r=0;t&&(r|=4),Ad(n,e,r,t)}var Od=`_reactListening`+Math.random().toString(36).slice(2);function kd(e){if(!e[Od]){e[Od]=!0,N.forEach(function(t){t!==`selectionchange`&&(Td.has(t)||Dd(t,!1,e),Dd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Od]||(t[Od]=!0,Dd(`selectionchange`,!1,t))}}function Ad(e,t,n,r){switch(xp(t)){case 2:var i=hp;break;case 8:i=gp;break;default:i=_p}n=i.bind(null,t,n,e),i=void 0,!pn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function jd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=yt(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}un(function(){var r=a,i=an(n),s=[];a:{var c=qr.get(e);if(c!==void 0){var l=wn,u=e;switch(e){case`keypress`:if(yn(n)===0)break a;case`keydown`:case`keyup`:l=Hn;break;case`focusin`:u=`focus`,l=Nn;break;case`focusout`:u=`blur`,l=Nn;break;case`beforeblur`:case`afterblur`:l=Nn;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=jn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Mn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Wn;break;case Br:case Vr:case Hr:l=Pn;break;case Kr:l=Gn;break;case`scroll`:case`scrollend`:l=En;break;case`wheel`:l=Kn;break;case`copy`:case`cut`:case`paste`:l=Fn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Un;break;case`toggle`:case`beforetoggle`:l=qn}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=dn(m,p),g!=null&&d.push(Md(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==rn&&(u=n.relatedTarget||n.fromElement)&&(yt(u)||u[ft]))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?yt(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=jn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Un,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:xt(l),h=u==null?c:xt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,yt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Pd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Fd(s,c,l,d,!1),u!==null&&f!==null&&Fd(s,f,u,d,!0)}}a:{if(c=r?xt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=pr;else if(sr(c))if(mr)v=Sr;else{v=br;var y=yr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Qt(r.elementType)&&(v=pr):v=xr;if(v&&=v(e,r)){cr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Wt(c,`number`,c.value)}switch(y=r?xt(r):window,e){case`focusin`:(sr(y)||y.contentEditable===`true`)&&(jr=y,Mr=r,I=null);break;case`focusout`:I=Mr=jr=null;break;case`mousedown`:Nr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Nr=!1,Pr(s,n,i);break;case`selectionchange`:if(Ar)break;case`keydown`:case`keyup`:Pr(s,n,i)}var b;if(Yn)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 rr?tr(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Qn&&n.locale!==`ko`&&(rr||x!==`onCompositionStart`?x===`onCompositionEnd`&&rr&&(b=vn()):(hn=i,gn=`value`in hn?hn.value:hn.textContent,rr=!0)),y=Nd(r,x),0<y.length&&(x=new In(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=nr(n),b!==null&&(x.data=b)))),(b=Zn?ir(e,n):ar(e,n))&&(x=Nd(r,`onBeforeInput`),0<x.length&&(y=new In(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),xd(s,e,r,n,i)}Ed(s,t)})}function Md(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Nd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=dn(e,n),i!=null&&r.unshift(Md(e,i,a)),i=dn(e,t),i!=null&&r.push(Md(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Pd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Fd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=dn(n,a),l!=null&&o.unshift(Md(n,l,c))):i||(l=dn(n,a),l!=null&&o.push(Md(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Id=/\r\n?/g,Ld=/\u0000|\uFFFD/g;function Rd(e){return(typeof e==`string`?e:``+e).replace(Id,`
|
|
925
|
-
`).replace(Ld,``)}function zd(e,t){return t=Rd(t),Rd(e)===t}function Bd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Jt(e,``+r);break;case`className`:Mt(e,`class`,r);break;case`tabIndex`:Mt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Mt(e,n,r);break;case`style`:Zt(e,r,o);break;case`data`:if(t!==`object`){Mt(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=tn(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Bd(e,t,`name`,a.name,a,null),Bd(e,t,`formEncType`,a.formEncType,a,null),Bd(e,t,`formMethod`,a.formMethod,a,null),Bd(e,t,`formTarget`,a.formTarget,a,null)):(Bd(e,t,`encType`,a.encType,a,null),Bd(e,t,`method`,a.method,a,null),Bd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=tn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`onScroll`:r!=null&&U(`scroll`,e);break;case`onScrollEnd`:r!=null&&U(`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=tn(``+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`:U(`beforetoggle`,e),U(`toggle`,e),jt(e,`popover`,r);break;case`xlinkActuate`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:jt(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=$t.get(n)||n,jt(e,n,r))}}function Vd(e,t,n,r,a,o){switch(n){case`style`:Zt(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`?Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Jt(e,``+r);break;case`onScroll`:r!=null&&U(`scroll`,e);break;case`onScrollEnd`:r!=null&&U(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!wt.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[dt]||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,``):jt(e,n,r)}}}function Hd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:U(`error`,e),U(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Bd(e,t,o,s,n,null)}}a&&Bd(e,t,`srcSet`,n.srcSet,n,null),r&&Bd(e,t,`src`,n.src,n,null);return;case`input`:U(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Bd(e,t,r,d,n,null)}}Ut(e,o,c,l,u,s,a,!1);return;case`select`:for(a in U(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Bd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Gt(e,!!r,n,!0):Gt(e,!!r,t,!1);return;case`textarea`:for(s in U(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Bd(e,t,s,c,n,null)}qt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Bd(e,t,l,r,n,null)}return;case`dialog`:U(`beforetoggle`,e),U(`toggle`,e),U(`cancel`,e),U(`close`,e);break;case`iframe`:case`object`:U(`load`,e);break;case`video`:case`audio`:for(r=0;r<wd.length;r++)U(wd[r],e);break;case`image`:U(`error`,e),U(`load`,e);break;case`details`:U(`toggle`,e);break;case`embed`:case`source`:case`link`:U(`error`,e),U(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Bd(e,t,u,r,n,null)}return;default:if(Qt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Vd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Bd(e,t,c,r,n,null))}function Ud(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Bd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Bd(e,t,p,m,r,f)}}Ht(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Bd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Bd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Gt(e,!!n,n?[]:``,!1):Gt(e,!!n,t,!0)):Gt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Bd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Bd(e,t,s,a,r,o)}Kt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Bd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Bd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Bd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Bd(e,t,u,p,r,m)}return;default:if(Qt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Vd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Vd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Bd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Bd(e,t,f,p,r,m)}function Wd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Gd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Wd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Wd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Kd=null,qd=null;function Jd(e){return e.nodeType===9?e:e.ownerDocument}function Yd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Xd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Zd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Qd=null;function $d(){var e=window.event;return e&&e.type===`popstate`?e===Qd?!1:(Qd=e,!0):(Qd=null,!1)}var ef=typeof setTimeout==`function`?setTimeout:void 0,tf=typeof clearTimeout==`function`?clearTimeout:void 0,nf=typeof Promise==`function`?Promise:void 0,rf=typeof queueMicrotask==`function`?queueMicrotask:nf===void 0?ef:function(e){return nf.resolve(null).then(e).catch(af)};function af(e){setTimeout(function(){throw e})}function of(e){return e===`head`}function sf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Bp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)xf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,xf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[_t]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&xf(e.ownerDocument.body);n=i}while(n);Bp(t)}function cf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function lf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:lf(n),vt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function uf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[_t])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=gf(e.nextSibling),e===null)break}return null}function df(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=gf(e.nextSibling),e===null))return null;return e}function ff(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=gf(e.nextSibling),e===null))return null;return e}function pf(e){return e.data===`$?`||e.data===`$~`}function mf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function hf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function gf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var _f=null;function vf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return gf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function yf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function bf(e,t,n){switch(t=Jd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function xf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);vt(e)}var W=new Map,Sf=new Set;function Cf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var wf=A.d;A.d={f:Tf,r:Ef,D:kf,C:Af,L:jf,m:Mf,X:Pf,S:Nf,M:Ff};function Tf(){var e=wf.f(),t=Eu();return e||t}function Ef(e){var t=bt(e);t!==null&&t.tag===5&&t.type===`form`?Ds(t):wf.r(e)}var Df=typeof document>`u`?null:document;function Of(e,t,n){var r=Df;if(r&&typeof t==`string`&&t){var i=Vt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Sf.has(i)||(Sf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Hd(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function kf(e){wf.D(e),Of(`dns-prefetch`,e,null)}function Af(e,t){wf.C(e,t),Of(`preconnect`,e,t)}function jf(e,t,n){wf.L(e,t,n);var r=Df;if(r&&e&&t){var i=`link[rel="preload"][as="`+Vt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Vt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Vt(n.imageSizes)+`"]`)):i+=`[href="`+Vt(e)+`"]`;var a=i;switch(t){case`style`:a=Lf(e);break;case`script`:a=Vf(e)}W.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),W.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Rf(a))||t===`script`&&r.querySelector(Hf(a))||(t=r.createElement(`link`),Hd(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function Mf(e,t){wf.m(e,t);var n=Df;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Vt(r)+`"][href="`+Vt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Vf(e)}if(!W.has(a)&&(e=p({rel:`modulepreload`,href:e},t),W.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Hf(a)))return}r=n.createElement(`link`),Hd(r,`link`,e),Ct(r),n.head.appendChild(r)}}}function Nf(e,t,n){wf.S(e,t,n);var r=Df;if(r&&e){var i=St(r).hoistableStyles,a=Lf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Rf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=W.get(a))&&Gf(e,n);var c=o=r.createElement(`link`);Ct(c),Hd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Wf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Pf(e,t){wf.X(e,t);var n=Df;if(n&&e){var r=St(n).hoistableScripts,i=Vf(e),a=r.get(i);a||(a=n.querySelector(Hf(i)),a||(e=p({src:e,async:!0},t),(t=W.get(i))&&Kf(e,t),a=n.createElement(`script`),Ct(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Ff(e,t){wf.M(e,t);var n=Df;if(n&&e){var r=St(n).hoistableScripts,i=Vf(e),a=r.get(i);a||(a=n.querySelector(Hf(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=W.get(i))&&Kf(e,t),a=n.createElement(`script`),Ct(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function If(e,t,n,r){var a=(a=de.current)?Cf(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=Lf(n.href),n=St(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=Lf(n.href);var o=St(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(Rf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),W.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},W.set(e,n),o||Bf(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=Vf(n),n=St(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 Lf(e){return`href="`+Vt(e)+`"`}function Rf(e){return`link[rel="stylesheet"][`+e+`]`}function zf(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function Bf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Hd(t,`link`,n),Ct(t),e.head.appendChild(t))}function Vf(e){return`[src="`+Vt(e)+`"]`}function Hf(e){return`script[async]`+e}function Uf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Vt(n.href)+`"]`);if(r)return t.instance=r,Ct(r),r;var a=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ct(r),Hd(r,`style`,a),Wf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Lf(n.href);var o=e.querySelector(Rf(a));if(o)return t.state.loading|=4,t.instance=o,Ct(o),o;r=zf(n),(a=W.get(a))&&Gf(r,a),o=(e.ownerDocument||e).createElement(`link`),Ct(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Hd(o,`link`,r),t.state.loading|=4,Wf(o,n.precedence,e),t.instance=o;case`script`:return o=Vf(n.src),(a=e.querySelector(Hf(o)))?(t.instance=a,Ct(a),a):(r=n,(a=W.get(o))&&(r=p({},n),Kf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Ct(a),Hd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Wf(r,n.precedence,e));return t.instance}function Wf(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 Gf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Kf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var qf=null;function Jf(e,t,n){if(qf===null){var r=new Map,i=qf=new Map;i.set(n,r)}else i=qf,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[_t]||a[ut]||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 Yf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Xf(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 Zf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Qf(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=Lf(r.href),a=t.querySelector(Rf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=tp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ct(a);return}a=t.ownerDocument||t,r=zf(r),(i=W.get(i))&&Gf(r,i),a=a.createElement(`link`),Ct(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Hd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=tp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $f=0;function ep(e,t){return e.stylesheets&&e.count===0&&rp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&rp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$f===0&&($f=62500*Gd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&rp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$f?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function tp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)rp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var np=null;function rp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,np=new Map,t.forEach(ip,e),np=null,tp.call(e))}function ip(e,t){if(!(t.state.loading&4)){var n=np.get(e);if(n)var r=n.get(null);else{n=new Map,np.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=tp.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 ap={$$typeof:x,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function op(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=$e(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$e(0),this.hiddenUpdates=$e(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 sp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new op(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ci(3,null,null,t),e.current=a,a.stateNode=e,t=ca(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Va(a),e}function cp(e){return e?(e=oi,e):oi}function lp(e,t,n,r,i,a){i=cp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ua(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Wa(e,r,t),n!==null&&(xu(n,e,t),Ga(n,e,t))}function up(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function dp(e,t){up(e,t),(e=e.alternate)&&up(e,t)}function fp(e){if(e.tag===13||e.tag===31){var t=ri(e,67108864);t!==null&&xu(t,e,67108864),dp(e,67108864)}}function pp(e){if(e.tag===13||e.tag===31){var t=yu();t=at(t);var n=ri(e,t);n!==null&&xu(n,e,t),dp(e,t)}}var mp=!0;function hp(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=2,_p(e,t,n,r)}finally{A.p=a,k.T=i}}function gp(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=8,_p(e,t,n,r)}finally{A.p=a,k.T=i}}function _p(e,t,n,r){if(mp){var i=vp(r);if(i===null)jd(e,t,r,yp,n),Ap(e,r);else if(Mp(i,e,t,n,r))r.stopPropagation();else if(Ap(e,r),t&4&&-1<kp.indexOf(e)){for(;i!==null;){var a=bt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Je(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ve(o);s.entanglements[1]|=c,o&=~c}ud(a),!(Hl&6)&&(su=ke()+500,dd(0,!1))}}break;case 31:case 13:s=ri(a,2),s!==null&&xu(s,a,2),Eu(),dp(a,2)}if(a=vp(r),a===null&&jd(e,t,r,yp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else jd(e,t,r,null,n)}}function vp(e){return e=an(e),bp(e)}var yp=null;function bp(e){if(yp=null,e=yt(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 yp=e,null}function xp(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(Ae()){case je:return 2;case Me:return 8;case Ne:case Pe:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var Sp=!1,Cp=null,wp=null,Tp=null,Ep=new Map,Dp=new Map,Op=[],kp=`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 Ap(e,t){switch(e){case`focusin`:case`focusout`:Cp=null;break;case`dragenter`:case`dragleave`:wp=null;break;case`mouseover`:case`mouseout`:Tp=null;break;case`pointerover`:case`pointerout`:Ep.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Dp.delete(t.pointerId)}}function jp(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=bt(t),t!==null&&fp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Mp(e,t,n,r,i){switch(t){case`focusin`:return Cp=jp(Cp,e,t,n,r,i),!0;case`dragenter`:return wp=jp(wp,e,t,n,r,i),!0;case`mouseover`:return Tp=jp(Tp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Ep.set(a,jp(Ep.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Dp.set(a,jp(Dp.get(a)||null,e,t,n,r,i)),!0}return!1}function Np(e){var t=yt(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,ct(e.priority,function(){pp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ct(e.priority,function(){pp(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 Pp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=vp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);rn=r,n.target.dispatchEvent(r),rn=null}else return t=bt(n),t!==null&&fp(t),e.blockedOn=n,!1;t.shift()}return!0}function Fp(e,t,n){Pp(e)&&n.delete(t)}function Ip(){Sp=!1,Cp!==null&&Pp(Cp)&&(Cp=null),wp!==null&&Pp(wp)&&(wp=null),Tp!==null&&Pp(Tp)&&(Tp=null),Ep.forEach(Fp),Dp.forEach(Fp)}function Lp(e,n){e.blockedOn===n&&(e.blockedOn=null,Sp||(Sp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ip)))}var Rp=null;function zp(e){Rp!==e&&(Rp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Rp===e&&(Rp=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(bp(r||n)===null)continue;break}var a=bt(n);a!==null&&(e.splice(t,3),t-=3,Ts(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Bp(e){function t(t){return Lp(t,e)}Cp!==null&&Lp(Cp,e),wp!==null&&Lp(wp,e),Tp!==null&&Lp(Tp,e),Ep.forEach(t),Dp.forEach(t);for(var n=0;n<Op.length;n++){var r=Op[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Op.length&&(n=Op[0],n.blockedOn===null);)Np(n),n.blockedOn===null&&Op.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[dt]||null;if(typeof a==`function`)o||zp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[dt]||null)s=o.formAction;else if(bp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),zp(n)}}}function Vp(){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 Hp(e){this._internalRoot=e}Up.prototype.render=Hp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;lp(n,yu(),e,t,null,null)},Up.prototype.unmount=Hp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;lp(e.current,2,null,e,null,null),Eu(),t[ft]=null}};function Up(e){this._internalRoot=e}Up.prototype.unstable_scheduleHydration=function(e){if(e){var t=st();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Op.length&&t!==0&&t<Op[n].priority;n++);Op.splice(n,0,e),n===0&&Np(e)}};var Wp=n.version;if(Wp!==`19.2.5`)throw Error(i(527,Wp,`19.2.5`));A.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 Gp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:k,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Kp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kp.isDisabled&&Kp.supportsFiber)try{Re=Kp.inject(Gp),ze=Kp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Js,s=Ys,c=Xs;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=sp(e,1,!1,null,null,n,r,null,o,s,c,Vp),e[ft]=t.current,kd(e),new Hp(t)}}));(0,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=YU()}))().createRoot)(document.getElementById(`root`)).render((0,w.jsx)(f.StrictMode,{children:(0,w.jsx)(ut,{client:Tt,children:(0,w.jsx)(WU,{})})}));</script>
|
|
926
|
-
<style rel="stylesheet" crossorigin>@import "https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap";.rdp-root{--rdp-accent-color:blue;--rdp-accent-background-color:#f0f0ff;--rdp-day-height:44px;--rdp-day-width:44px;--rdp-day_button-border-radius:100%;--rdp-day_button-border:2px solid transparent;--rdp-day_button-height:42px;--rdp-day_button-width:42px;--rdp-selected-border:2px solid var(--rdp-accent-color);--rdp-disabled-opacity:.5;--rdp-outside-opacity:.75;--rdp-today-color:var(--rdp-accent-color);--rdp-dropdown-gap:.5rem;--rdp-months-gap:2rem;--rdp-nav_button-disabled-opacity:.5;--rdp-nav_button-height:2.25rem;--rdp-nav_button-width:2.25rem;--rdp-nav-height:2.75rem;--rdp-range_middle-background-color:var(--rdp-accent-background-color);--rdp-range_middle-color:inherit;--rdp-range_start-color:white;--rdp-range_start-background:linear-gradient(var(--rdp-gradient-direction), transparent 50%, var(--rdp-range_middle-background-color) 50%);--rdp-range_start-date-background-color:var(--rdp-accent-color);--rdp-range_end-background:linear-gradient(var(--rdp-gradient-direction), var(--rdp-range_middle-background-color) 50%, transparent 50%);--rdp-range_end-color:white;--rdp-range_end-date-background-color:var(--rdp-accent-color);--rdp-week_number-border-radius:100%;--rdp-week_number-border:2px solid transparent;--rdp-week_number-height:var(--rdp-day-height);--rdp-week_number-opacity:.75;--rdp-week_number-width:var(--rdp-day-width);--rdp-weeknumber-text-align:center;--rdp-weekday-opacity:.75;--rdp-weekday-padding:.5rem 0rem;--rdp-weekday-text-align:center;--rdp-gradient-direction:90deg;--rdp-animation_duration:.3s;--rdp-animation_timing:cubic-bezier(.4, 0, .2, 1)}.rdp-root[dir=rtl]{--rdp-gradient-direction:-90deg}.rdp-root[data-broadcast-calendar=true]{--rdp-outside-opacity:unset}.rdp-root{box-sizing:border-box;position:relative}.rdp-root *{box-sizing:border-box}.rdp-day{width:var(--rdp-day-width);height:var(--rdp-day-height);text-align:center}.rdp-day_button{cursor:pointer;font:inherit;color:inherit;width:var(--rdp-day_button-width);height:var(--rdp-day_button-height);border:var(--rdp-day_button-border);border-radius:var(--rdp-day_button-border-radius);background:0 0;justify-content:center;align-items:center;margin:0;padding:0;display:flex}.rdp-day_button:disabled{cursor:revert}.rdp-caption_label{z-index:1;white-space:nowrap;border:0;align-items:center;display:inline-flex;position:relative}.rdp-dropdown:focus-visible~.rdp-caption_label{outline:5px auto highlight;outline:5px auto -webkit-focus-ring-color}.rdp-button_next,.rdp-button_previous{cursor:pointer;font:inherit;color:inherit;appearance:none;width:var(--rdp-nav_button-width);height:var(--rdp-nav_button-height);background:0 0;border:none;justify-content:center;align-items:center;margin:0;padding:0;display:inline-flex;position:relative}.rdp-button_next:disabled,.rdp-button_next[aria-disabled=true],.rdp-button_previous:disabled,.rdp-button_previous[aria-disabled=true]{cursor:revert;opacity:var(--rdp-nav_button-disabled-opacity)}.rdp-chevron{fill:var(--rdp-accent-color);display:inline-block}.rdp-root[dir=rtl] .rdp-nav .rdp-chevron{transform-origin:50%;transform:rotate(180deg)}.rdp-dropdowns{align-items:center;gap:var(--rdp-dropdown-gap);display:inline-flex;position:relative}.rdp-dropdown{z-index:2;opacity:0;appearance:none;width:100%;cursor:inherit;line-height:inherit;border:none;margin:0;padding:0;position:absolute;inset-block:0;inset-inline-start:0}.rdp-dropdown_root{align-items:center;display:inline-flex;position:relative}.rdp-dropdown_root[data-disabled=true] .rdp-chevron{opacity:var(--rdp-disabled-opacity)}.rdp-month_caption{height:var(--rdp-nav-height);align-content:center;font-size:large;font-weight:700;display:flex}.rdp-root[data-nav-layout=around] .rdp-month,.rdp-root[data-nav-layout=after] .rdp-month{position:relative}.rdp-root[data-nav-layout=around] .rdp-month_caption{justify-content:center;margin-inline-start:var(--rdp-nav_button-width);margin-inline-end:var(--rdp-nav_button-width);position:relative}.rdp-root[data-nav-layout=around] .rdp-button_previous{inset-inline-start:0;height:var(--rdp-nav-height);display:inline-flex;position:absolute;top:0}.rdp-root[data-nav-layout=around] .rdp-button_next{inset-inline-end:0;height:var(--rdp-nav-height);justify-content:center;display:inline-flex;position:absolute;top:0}.rdp-months{gap:var(--rdp-months-gap);flex-wrap:wrap;max-width:fit-content;display:flex;position:relative}.rdp-month_grid{border-collapse:collapse}.rdp-nav{height:var(--rdp-nav-height);align-items:center;display:flex;position:absolute;inset-block-start:0;inset-inline-end:0}.rdp-weekday{opacity:var(--rdp-weekday-opacity);padding:var(--rdp-weekday-padding);text-align:var(--rdp-weekday-text-align);text-transform:var(--rdp-weekday-text-transform);font-size:smaller;font-weight:500}.rdp-week_number{opacity:var(--rdp-week_number-opacity);height:var(--rdp-week_number-height);width:var(--rdp-week_number-width);border:var(--rdp-week_number-border);border-radius:var(--rdp-week_number-border-radius);text-align:var(--rdp-weeknumber-text-align);font-size:small;font-weight:400}.rdp-today:not(.rdp-outside){color:var(--rdp-today-color)}.rdp-selected{font-size:large;font-weight:700}.rdp-selected .rdp-day_button{border:var(--rdp-selected-border)}.rdp-outside{opacity:var(--rdp-outside-opacity)}.rdp-disabled:not(.rdp-selected){opacity:var(--rdp-disabled-opacity)}.rdp-hidden{visibility:hidden;color:var(--rdp-range_start-color)}.rdp-range_start{background:var(--rdp-range_start-background)}.rdp-range_start .rdp-day_button{background-color:var(--rdp-range_start-date-background-color);color:var(--rdp-range_start-color)}.rdp-range_middle{background-color:var(--rdp-range_middle-background-color)}.rdp-range_middle .rdp-day_button{border:unset;border-radius:unset;color:var(--rdp-range_middle-color)}.rdp-range_end{background:var(--rdp-range_end-background);color:var(--rdp-range_end-color)}.rdp-range_end .rdp-day_button{color:var(--rdp-range_start-color);background-color:var(--rdp-range_end-date-background-color)}.rdp-range_start.rdp-range_end{background:revert}.rdp-focusable{cursor:pointer}@keyframes rdp-slide_in_left{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes rdp-slide_in_right{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes rdp-slide_out_left{0%{transform:translate(0)}to{transform:translate(-100%)}}@keyframes rdp-slide_out_right{0%{transform:translate(0)}to{transform:translate(100%)}}.rdp-weeks_before_enter{animation:rdp-slide_in_left var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-weeks_before_exit{animation:rdp-slide_out_left var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-weeks_after_enter{animation:rdp-slide_in_right var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-weeks_after_exit{animation:rdp-slide_out_right var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-root[dir=rtl] .rdp-weeks_after_enter{animation:rdp-slide_in_left var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-root[dir=rtl] .rdp-weeks_before_exit{animation:rdp-slide_out_right var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-root[dir=rtl] .rdp-weeks_before_enter{animation:rdp-slide_in_right var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-root[dir=rtl] .rdp-weeks_after_exit{animation:rdp-slide_out_left var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}@keyframes rdp-fade_in{0%{opacity:0}to{opacity:1}}@keyframes rdp-fade_out{0%{opacity:1}to{opacity:0}}.rdp-caption_after_enter{animation:rdp-fade_in var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-caption_after_exit{animation:rdp-fade_out var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-caption_before_enter{animation:rdp-fade_in var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-caption_before_exit{animation:rdp-fade_out var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}@layer components;@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-content:"";--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--font-mono:"JetBrains Mono", "Fira Code", ui-monospace, monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-lime-200:oklch(93.8% .127 124.321);--color-lime-400:oklch(84.1% .238 128.85);--color-lime-500:oklch(76.8% .233 130.85);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-violet-100:oklch(94.3% .029 294.588);--color-violet-200:oklch(89.4% .057 293.283);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-400:oklch(70.2% .183 293.541);--color-violet-500:#8b5cf6;--color-violet-600:#7c3aed;--color-violet-950:oklch(28.3% .141 291.089);--color-purple-400:oklch(71.4% .203 305.504);--color-fuchsia-200:oklch(90.3% .076 319.62);--color-fuchsia-300:oklch(83.3% .145 321.434);--color-fuchsia-400:oklch(74% .238 322.16);--color-fuchsia-500:oklch(66.7% .295 322.15);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-gray-500:oklch(55.1% .027 264.364);--color-zinc-100:oklch(96.7% .001 286.375);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-600:oklch(44.2% .017 285.786);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tighter:-.05em;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:4px;--radius-md:8px;--radius-lg:12px;--radius-xl:16px;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-cloud-white:#fafafa;--color-pure-white:#fff;--color-violet-deep:#8134ce;--color-live:#22d3ee;--color-success:#34d399;--color-warning:#fbbf24;--color-error:#f87171;--color-info:var(--color-violet-500);--color-background:#09090b;--color-foreground:#e8e8ed;--color-foreground-emphasis:#fafafa;--color-card:#18181b;--color-muted:#27272a;--color-muted-foreground:#a1a1aa;--color-accent:var(--color-violet-500);--color-border:#27272a;--color-text-secondary:#a1a1aa;--color-text-tertiary:#7c7c85;--color-text-ghost:#3f3f46;--color-surface-substrate:#0f0f12;--color-surface-default:#18181b;--color-surface-raised:#1c1c22;--color-surface-overlay:#27272a;--color-border-subtle:#1c1c22;--color-border-strong:#3f3f46;--color-sidebar:#09090b;--color-surface:#18181b;--font-grotesk:"Space Grotesk", sans-serif;--radius-full:9999px}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*,:after,:before,::backdrop{border-color:var(--color-border)}::file-selector-button{border-color:var(--color-border)}html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}body{font-family:var(--font-sans);letter-spacing:.01em;background-color:var(--color-background);color:var(--color-foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-feature-settings:"cv02", "cv03", "cv04", "cv11";margin:0;font-size:14px;line-height:1.5}h1{font-family:var(--font-grotesk);letter-spacing:-.02em;color:var(--color-foreground-emphasis);font-size:1.25rem;font-weight:600;line-height:1.3}h2{font-family:var(--font-grotesk);letter-spacing:-.01em;font-size:.875rem;font-weight:600;line-height:1.4}h3{font-family:var(--font-grotesk);letter-spacing:-.01em;font-size:.8125rem;font-weight:500;line-height:1.4}code,pre{font-family:var(--font-mono);letter-spacing:0;font-size:13px;line-height:1.6}::selection{color:var(--color-cloud-white);background:#8b5cf64d}}@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.-top-6{top:calc(var(--spacing) * -6)}.top-0{top:calc(var(--spacing) * 0)}.top-2{top:calc(var(--spacing) * 2)}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-3{top:calc(var(--spacing) * 3)}.top-full{top:100%}.right-0{right:calc(var(--spacing) * 0)}.right-1{right:calc(var(--spacing) * 1)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing) * 0)}.left-1{left:calc(var(--spacing) * 1)}.left-1\/2{left:50%}.left-4{left:calc(var(--spacing) * 4)}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.col-span-full{grid-column:1/-1}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-mx-0\.5{margin-inline:calc(var(--spacing) * -.5)}.-mx-6{margin-inline:calc(var(--spacing) * -6)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-auto{margin-inline:auto}.-mt-2{margin-top:calc(var(--spacing) * -2)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-auto{margin-top:auto}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-\[7\.5rem\]{margin-left:7.5rem}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.h-0{height:calc(var(--spacing) * 0)}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1{height:calc(var(--spacing) * 1)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-48{height:calc(var(--spacing) * 48)}.h-64{height:calc(var(--spacing) * 64)}.h-72{height:calc(var(--spacing) * 72)}.h-\[76px\]{height:76px}.h-\[140px\]{height:140px}.h-\[calc\(100vh-73px\)\]{height:calc(100vh - 73px)}.h-full{height:100%}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[85vh\]{max-height:85vh}.max-h-\[320px\]{max-height:320px}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing) * .5)}.w-1{width:calc(var(--spacing) * 1)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-32{width:calc(var(--spacing) * 32)}.w-36{width:calc(var(--spacing) * 36)}.w-40{width:calc(var(--spacing) * 40)}.w-48{width:calc(var(--spacing) * 48)}.w-52{width:calc(var(--spacing) * 52)}.w-56{width:calc(var(--spacing) * 56)}.w-64{width:calc(var(--spacing) * 64)}.w-72{width:calc(var(--spacing) * 72)}.w-\[76px\]{width:76px}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[28px\]{max-width:28px}.max-w-\[100px\]{max-width:100px}.max-w-\[140px\]{max-width:140px}.max-w-\[160px\]{max-width:160px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[240px\]{max-width:240px}.max-w-\[260px\]{max-width:260px}.max-w-\[280px\]{max-width:280px}.max-w-\[400px\]{max-width:400px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\[6px\]{min-width:6px}.min-w-\[8px\]{min-width:8px}.min-w-\[28px\]{min-width:28px}.min-w-\[120px\]{min-width:120px}.min-w-\[160px\]{min-width:160px}.min-w-\[220px\]{min-width:220px}.min-w-\[700px\]{min-width:700px}.min-w-\[760px\]{min-width:760px}.min-w-\[800px\]{min-width:800px}.min-w-\[900px\]{min-width:900px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-rotate-90{rotate:-90deg}.rotate-45{rotate:45deg}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing) * 0)}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-7{gap:calc(var(--spacing) * 7)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-9{gap:calc(var(--spacing) * 9)}.gap-\[2px\]{gap:2px}.gap-\[3px\]{gap:3px}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-5{column-gap:calc(var(--spacing) * 5)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-1{row-gap:calc(var(--spacing) * 1)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-5{row-gap:calc(var(--spacing) * 5)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border-subtle>:not(:last-child)){border-color:var(--color-border-subtle)}:where(.divide-border-subtle\/60>:not(:last-child)){border-color:#1c1c2299}@supports (color:color-mix(in lab, red, red)){:where(.divide-border-subtle\/60>:not(:last-child)){border-color:color-mix(in oklab, var(--color-border-subtle) 60%, transparent)}}:where(.divide-zinc-800>:not(:last-child)){border-color:var(--color-zinc-800)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:var(--radius-full)}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-2xl{border-top-left-radius:var(--radius-2xl);border-top-right-radius:var(--radius-2xl)}.rounded-l-lg{border-top-left-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.rounded-l-md{border-top-left-radius:var(--radius-md);border-bottom-left-radius:var(--radius-md)}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-b-2xl{border-bottom-right-radius:var(--radius-2xl);border-bottom-left-radius:var(--radius-2xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-accent{border-color:var(--color-accent)}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/20{border-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/30{border-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/40{border-color:color-mix(in oklab, var(--color-amber-500) 40%, transparent)}}.border-amber-500\/60{border-color:#f99c0099}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/60{border-color:color-mix(in oklab, var(--color-amber-500) 60%, transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/30{border-color:color-mix(in oklab, var(--color-blue-500) 30%, transparent)}}.border-border{border-color:var(--color-border)}.border-border-subtle{border-color:var(--color-border-subtle)}.border-border-subtle\/20{border-color:#1c1c2233}@supports (color:color-mix(in lab, red, red)){.border-border-subtle\/20{border-color:color-mix(in oklab, var(--color-border-subtle) 20%, transparent)}}.border-border-subtle\/30{border-color:#1c1c224d}@supports (color:color-mix(in lab, red, red)){.border-border-subtle\/30{border-color:color-mix(in oklab, var(--color-border-subtle) 30%, transparent)}}.border-border-subtle\/40{border-color:#1c1c2266}@supports (color:color-mix(in lab, red, red)){.border-border-subtle\/40{border-color:color-mix(in oklab, var(--color-border-subtle) 40%, transparent)}}.border-border-subtle\/50{border-color:#1c1c2280}@supports (color:color-mix(in lab, red, red)){.border-border-subtle\/50{border-color:color-mix(in oklab, var(--color-border-subtle) 50%, transparent)}}.border-border-subtle\/60{border-color:#1c1c2299}@supports (color:color-mix(in lab, red, red)){.border-border-subtle\/60{border-color:color-mix(in oklab, var(--color-border-subtle) 60%, transparent)}}.border-cyan-500\/20{border-color:#00b7d733}@supports (color:color-mix(in lab, red, red)){.border-cyan-500\/20{border-color:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab, red, red)){.border-cyan-500\/30{border-color:color-mix(in oklab, var(--color-cyan-500) 30%, transparent)}}.border-cyan-500\/60{border-color:#00b7d799}@supports (color:color-mix(in lab, red, red)){.border-cyan-500\/60{border-color:color-mix(in oklab, var(--color-cyan-500) 60%, transparent)}}.border-emerald-500\/20{border-color:#00bb7f33}@supports (color:color-mix(in lab, red, red)){.border-emerald-500\/20{border-color:color-mix(in oklab, var(--color-emerald-500) 20%, transparent)}}.border-emerald-500\/25{border-color:#00bb7f40}@supports (color:color-mix(in lab, red, red)){.border-emerald-500\/25{border-color:color-mix(in oklab, var(--color-emerald-500) 25%, transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab, red, red)){.border-emerald-500\/30{border-color:color-mix(in oklab, var(--color-emerald-500) 30%, transparent)}}.border-emerald-500\/40{border-color:#00bb7f66}@supports (color:color-mix(in lab, red, red)){.border-emerald-500\/40{border-color:color-mix(in oklab, var(--color-emerald-500) 40%, transparent)}}.border-emerald-500\/60{border-color:#00bb7f99}@supports (color:color-mix(in lab, red, red)){.border-emerald-500\/60{border-color:color-mix(in oklab, var(--color-emerald-500) 60%, transparent)}}.border-error\/30{border-color:#f871714d}@supports (color:color-mix(in lab, red, red)){.border-error\/30{border-color:color-mix(in oklab, var(--color-error) 30%, transparent)}}.border-fuchsia-500\/60{border-color:#e12afb99}@supports (color:color-mix(in lab, red, red)){.border-fuchsia-500\/60{border-color:color-mix(in oklab, var(--color-fuchsia-500) 60%, transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab, red, red)){.border-orange-500\/40{border-color:color-mix(in oklab, var(--color-orange-500) 40%, transparent)}}.border-red-500\/10{border-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.border-red-500\/10{border-color:color-mix(in oklab, var(--color-red-500) 10%, transparent)}}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.border-red-500\/20{border-color:color-mix(in oklab, var(--color-red-500) 20%, transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.border-red-500\/30{border-color:color-mix(in oklab, var(--color-red-500) 30%, transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.border-red-500\/40{border-color:color-mix(in oklab, var(--color-red-500) 40%, transparent)}}.border-rose-500\/10{border-color:#ff23571a}@supports (color:color-mix(in lab, red, red)){.border-rose-500\/10{border-color:color-mix(in oklab, var(--color-rose-500) 10%, transparent)}}.border-rose-500\/30{border-color:#ff23574d}@supports (color:color-mix(in lab, red, red)){.border-rose-500\/30{border-color:color-mix(in oklab, var(--color-rose-500) 30%, transparent)}}.border-rose-500\/60{border-color:#ff235799}@supports (color:color-mix(in lab, red, red)){.border-rose-500\/60{border-color:color-mix(in oklab, var(--color-rose-500) 60%, transparent)}}.border-transparent{border-color:#0000}.border-violet-400{border-color:var(--color-violet-400)}.border-violet-400\/40{border-color:#a685ff66}@supports (color:color-mix(in lab, red, red)){.border-violet-400\/40{border-color:color-mix(in oklab, var(--color-violet-400) 40%, transparent)}}.border-violet-500\/20{border-color:#8b5cf633}@supports (color:color-mix(in lab, red, red)){.border-violet-500\/20{border-color:color-mix(in oklab, var(--color-violet-500) 20%, transparent)}}.border-violet-500\/30{border-color:#8b5cf64d}@supports (color:color-mix(in lab, red, red)){.border-violet-500\/30{border-color:color-mix(in oklab, var(--color-violet-500) 30%, transparent)}}.border-violet-500\/40{border-color:#8b5cf666}@supports (color:color-mix(in lab, red, red)){.border-violet-500\/40{border-color:color-mix(in oklab, var(--color-violet-500) 40%, transparent)}}.border-violet-500\/50{border-color:#8b5cf680}@supports (color:color-mix(in lab, red, red)){.border-violet-500\/50{border-color:color-mix(in oklab, var(--color-violet-500) 50%, transparent)}}.border-violet-500\/60{border-color:#8b5cf699}@supports (color:color-mix(in lab, red, red)){.border-violet-500\/60{border-color:color-mix(in oklab, var(--color-violet-500) 60%, transparent)}}.border-warning\/30{border-color:#fbbf244d}@supports (color:color-mix(in lab, red, red)){.border-warning\/30{border-color:color-mix(in oklab, var(--color-warning) 30%, transparent)}}.border-zinc-500\/20{border-color:#71717b33}@supports (color:color-mix(in lab, red, red)){.border-zinc-500\/20{border-color:color-mix(in oklab, var(--color-zinc-500) 20%, transparent)}}.border-zinc-500\/30{border-color:#71717b4d}@supports (color:color-mix(in lab, red, red)){.border-zinc-500\/30{border-color:color-mix(in oklab, var(--color-zinc-500) 30%, transparent)}}.border-zinc-600{border-color:var(--color-zinc-600)}.border-zinc-600\/60{border-color:#52525c99}@supports (color:color-mix(in lab, red, red)){.border-zinc-600\/60{border-color:color-mix(in oklab, var(--color-zinc-600) 60%, transparent)}}.border-zinc-700{border-color:var(--color-zinc-700)}.border-zinc-800{border-color:var(--color-zinc-800)}.border-l-amber-400{border-left-color:var(--color-amber-400)}.border-l-cyan-400{border-left-color:var(--color-cyan-400)}.border-l-emerald-400{border-left-color:var(--color-emerald-400)}.border-l-fuchsia-400{border-left-color:var(--color-fuchsia-400)}.border-l-lime-400{border-left-color:var(--color-lime-400)}.border-l-rose-400{border-left-color:var(--color-rose-400)}.border-l-sky-400{border-left-color:var(--color-sky-400)}.border-l-violet-400{border-left-color:var(--color-violet-400)}.\!bg-violet-500{background-color:var(--color-violet-500)!important}.\!bg-violet-500\/20{background-color:#8b5cf633!important}@supports (color:color-mix(in lab, red, red)){.\!bg-violet-500\/20{background-color:color-mix(in oklab, var(--color-violet-500) 20%, transparent)!important}}.bg-\[\#18181b\]{background-color:#18181b}.bg-accent{background-color:var(--color-accent)}.bg-accent\/10{background-color:#8b5cf61a}@supports (color:color-mix(in lab, red, red)){.bg-accent\/10{background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/4{background-color:#f99c000a}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/4{background-color:color-mix(in oklab, var(--color-amber-500) 4%, transparent)}}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/5{background-color:color-mix(in oklab, var(--color-amber-500) 5%, transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/10{background-color:color-mix(in oklab, var(--color-amber-500) 10%, transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/15{background-color:color-mix(in oklab, var(--color-amber-500) 15%, transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/20{background-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.bg-amber-500\/30{background-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/30{background-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.bg-amber-600{background-color:var(--color-amber-600)}.bg-background{background-color:var(--color-background)}.bg-background\/85{background-color:#09090bd9}@supports (color:color-mix(in lab, red, red)){.bg-background\/85{background-color:color-mix(in oklab, var(--color-background) 85%, transparent)}}.bg-background\/90{background-color:#09090be6}@supports (color:color-mix(in lab, red, red)){.bg-background\/90{background-color:color-mix(in oklab, var(--color-background) 90%, transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab, red, red)){.bg-black\/20{background-color:color-mix(in oklab, var(--color-black) 20%, transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab, red, red)){.bg-black\/40{background-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\/60{background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/5{background-color:color-mix(in oklab, var(--color-blue-500) 5%, transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/20{background-color:color-mix(in oklab, var(--color-blue-500) 20%, transparent)}}.bg-border-subtle{background-color:var(--color-border-subtle)}.bg-card{background-color:var(--color-card)}.bg-cyan-400{background-color:var(--color-cyan-400)}.bg-cyan-400\/80{background-color:#00d2efcc}@supports (color:color-mix(in lab, red, red)){.bg-cyan-400\/80{background-color:color-mix(in oklab, var(--color-cyan-400) 80%, transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/4{background-color:#00b7d70a}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/4{background-color:color-mix(in oklab, var(--color-cyan-500) 4%, transparent)}}.bg-cyan-500\/5{background-color:#00b7d70d}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/5{background-color:color-mix(in oklab, var(--color-cyan-500) 5%, transparent)}}.bg-cyan-500\/10{background-color:#00b7d71a}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/10{background-color:color-mix(in oklab, var(--color-cyan-500) 10%, transparent)}}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/15{background-color:color-mix(in oklab, var(--color-cyan-500) 15%, transparent)}}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/20{background-color:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-400\/40{background-color:#00d29466}@supports (color:color-mix(in lab, red, red)){.bg-emerald-400\/40{background-color:color-mix(in oklab, var(--color-emerald-400) 40%, transparent)}}.bg-emerald-400\/60{background-color:#00d29499}@supports (color:color-mix(in lab, red, red)){.bg-emerald-400\/60{background-color:color-mix(in oklab, var(--color-emerald-400) 60%, transparent)}}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/3{background-color:#00bb7f08}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/3{background-color:color-mix(in oklab, var(--color-emerald-500) 3%, transparent)}}.bg-emerald-500\/4{background-color:#00bb7f0a}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/4{background-color:color-mix(in oklab, var(--color-emerald-500) 4%, transparent)}}.bg-emerald-500\/5{background-color:#00bb7f0d}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/5{background-color:color-mix(in oklab, var(--color-emerald-500) 5%, transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/10{background-color:color-mix(in oklab, var(--color-emerald-500) 10%, transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/15{background-color:color-mix(in oklab, var(--color-emerald-500) 15%, transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/20{background-color:color-mix(in oklab, var(--color-emerald-500) 20%, transparent)}}.bg-emerald-500\/30{background-color:#00bb7f4d}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/30{background-color:color-mix(in oklab, var(--color-emerald-500) 30%, transparent)}}.bg-emerald-500\/60{background-color:#00bb7f99}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/60{background-color:color-mix(in oklab, var(--color-emerald-500) 60%, transparent)}}.bg-emerald-500\/\[0\.04\]{background-color:#00bb7f0a}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/\[0\.04\]{background-color:color-mix(in oklab, var(--color-emerald-500) 4%, transparent)}}.bg-error{background-color:var(--color-error)}.bg-error\/10{background-color:#f871711a}@supports (color:color-mix(in lab, red, red)){.bg-error\/10{background-color:color-mix(in oklab, var(--color-error) 10%, transparent)}}.bg-error\/15{background-color:#f8717126}@supports (color:color-mix(in lab, red, red)){.bg-error\/15{background-color:color-mix(in oklab, var(--color-error) 15%, transparent)}}.bg-foreground\/10{background-color:#e8e8ed1a}@supports (color:color-mix(in lab, red, red)){.bg-foreground\/10{background-color:color-mix(in oklab, var(--color-foreground) 10%, transparent)}}.bg-fuchsia-500{background-color:var(--color-fuchsia-500)}.bg-fuchsia-500\/4{background-color:#e12afb0a}@supports (color:color-mix(in lab, red, red)){.bg-fuchsia-500\/4{background-color:color-mix(in oklab, var(--color-fuchsia-500) 4%, transparent)}}.bg-fuchsia-500\/15{background-color:#e12afb26}@supports (color:color-mix(in lab, red, red)){.bg-fuchsia-500\/15{background-color:color-mix(in oklab, var(--color-fuchsia-500) 15%, transparent)}}.bg-fuchsia-500\/20{background-color:#e12afb33}@supports (color:color-mix(in lab, red, red)){.bg-fuchsia-500\/20{background-color:color-mix(in oklab, var(--color-fuchsia-500) 20%, transparent)}}.bg-fuchsia-500\/60{background-color:#e12afb99}@supports (color:color-mix(in lab, red, red)){.bg-fuchsia-500\/60{background-color:color-mix(in oklab, var(--color-fuchsia-500) 60%, transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-indigo-500{background-color:var(--color-indigo-500)}.bg-indigo-500\/20{background-color:#625fff33}@supports (color:color-mix(in lab, red, red)){.bg-indigo-500\/20{background-color:color-mix(in oklab, var(--color-indigo-500) 20%, transparent)}}.bg-lime-500{background-color:var(--color-lime-500)}.bg-lime-500\/4{background-color:#80cd000a}@supports (color:color-mix(in lab, red, red)){.bg-lime-500\/4{background-color:color-mix(in oklab, var(--color-lime-500) 4%, transparent)}}.bg-lime-500\/15{background-color:#80cd0026}@supports (color:color-mix(in lab, red, red)){.bg-lime-500\/15{background-color:color-mix(in oklab, var(--color-lime-500) 15%, transparent)}}.bg-muted{background-color:var(--color-muted)}.bg-muted-foreground\/10{background-color:#a1a1aa1a}@supports (color:color-mix(in lab, red, red)){.bg-muted-foreground\/10{background-color:color-mix(in oklab, var(--color-muted-foreground) 10%, transparent)}}.bg-muted-foreground\/40{background-color:#a1a1aa66}@supports (color:color-mix(in lab, red, red)){.bg-muted-foreground\/40{background-color:color-mix(in oklab, var(--color-muted-foreground) 40%, transparent)}}.bg-muted\/20{background-color:#27272a33}@supports (color:color-mix(in lab, red, red)){.bg-muted\/20{background-color:color-mix(in oklab, var(--color-muted) 20%, transparent)}}.bg-muted\/40{background-color:#27272a66}@supports (color:color-mix(in lab, red, red)){.bg-muted\/40{background-color:color-mix(in oklab, var(--color-muted) 40%, transparent)}}.bg-muted\/80{background-color:#27272acc}@supports (color:color-mix(in lab, red, red)){.bg-muted\/80{background-color:color-mix(in oklab, var(--color-muted) 80%, transparent)}}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab, red, red)){.bg-orange-500\/20{background-color:color-mix(in oklab, var(--color-orange-500) 20%, transparent)}}.bg-orange-500\/30{background-color:#fe6e004d}@supports (color:color-mix(in lab, red, red)){.bg-orange-500\/30{background-color:color-mix(in oklab, var(--color-orange-500) 30%, transparent)}}.bg-red-400{background-color:var(--color-red-400)}.bg-red-400\/60{background-color:#ff656899}@supports (color:color-mix(in lab, red, red)){.bg-red-400\/60{background-color:color-mix(in oklab, var(--color-red-400) 60%, transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/5{background-color:color-mix(in oklab, var(--color-red-500) 5%, transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/10{background-color:color-mix(in oklab, var(--color-red-500) 10%, transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/15{background-color:color-mix(in oklab, var(--color-red-500) 15%, transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/20{background-color:color-mix(in oklab, var(--color-red-500) 20%, transparent)}}.bg-red-500\/30{background-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/30{background-color:color-mix(in oklab, var(--color-red-500) 30%, transparent)}}.bg-red-500\/50{background-color:#fb2c3680}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/50{background-color:color-mix(in oklab, var(--color-red-500) 50%, transparent)}}.bg-red-500\/60{background-color:#fb2c3699}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/60{background-color:color-mix(in oklab, var(--color-red-500) 60%, transparent)}}.bg-rose-500{background-color:var(--color-rose-500)}.bg-rose-500\/4{background-color:#ff23570a}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/4{background-color:color-mix(in oklab, var(--color-rose-500) 4%, transparent)}}.bg-rose-500\/6{background-color:#ff23570f}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/6{background-color:color-mix(in oklab, var(--color-rose-500) 6%, transparent)}}.bg-rose-500\/10{background-color:#ff23571a}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/10{background-color:color-mix(in oklab, var(--color-rose-500) 10%, transparent)}}.bg-rose-500\/15{background-color:#ff235726}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/15{background-color:color-mix(in oklab, var(--color-rose-500) 15%, transparent)}}.bg-rose-500\/20{background-color:#ff235733}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/20{background-color:color-mix(in oklab, var(--color-rose-500) 20%, transparent)}}.bg-sidebar{background-color:var(--color-sidebar)}.bg-sidebar\/40{background-color:#09090b66}@supports (color:color-mix(in lab, red, red)){.bg-sidebar\/40{background-color:color-mix(in oklab, var(--color-sidebar) 40%, transparent)}}.bg-sky-500{background-color:var(--color-sky-500)}.bg-sky-500\/4{background-color:#00a5ef0a}@supports (color:color-mix(in lab, red, red)){.bg-sky-500\/4{background-color:color-mix(in oklab, var(--color-sky-500) 4%, transparent)}}.bg-sky-500\/15{background-color:#00a5ef26}@supports (color:color-mix(in lab, red, red)){.bg-sky-500\/15{background-color:color-mix(in oklab, var(--color-sky-500) 15%, transparent)}}.bg-success{background-color:var(--color-success)}.bg-success\/10{background-color:#34d3991a}@supports (color:color-mix(in lab, red, red)){.bg-success\/10{background-color:color-mix(in oklab, var(--color-success) 10%, transparent)}}.bg-success\/15{background-color:#34d39926}@supports (color:color-mix(in lab, red, red)){.bg-success\/15{background-color:color-mix(in oklab, var(--color-success) 15%, transparent)}}.bg-surface-default\/90{background-color:#18181be6}@supports (color:color-mix(in lab, red, red)){.bg-surface-default\/90{background-color:color-mix(in oklab, var(--color-surface-default) 90%, transparent)}}.bg-surface-default\/95{background-color:#18181bf2}@supports (color:color-mix(in lab, red, red)){.bg-surface-default\/95{background-color:color-mix(in oklab, var(--color-surface-default) 95%, transparent)}}.bg-surface-overlay{background-color:var(--color-surface-overlay)}.bg-surface-overlay\/40{background-color:#27272a66}@supports (color:color-mix(in lab, red, red)){.bg-surface-overlay\/40{background-color:color-mix(in oklab, var(--color-surface-overlay) 40%, transparent)}}.bg-surface-overlay\/80{background-color:#27272acc}@supports (color:color-mix(in lab, red, red)){.bg-surface-overlay\/80{background-color:color-mix(in oklab, var(--color-surface-overlay) 80%, transparent)}}.bg-surface-overlay\/95{background-color:#27272af2}@supports (color:color-mix(in lab, red, red)){.bg-surface-overlay\/95{background-color:color-mix(in oklab, var(--color-surface-overlay) 95%, transparent)}}.bg-surface-raised{background-color:var(--color-surface-raised)}.bg-surface\/80{background-color:#18181bcc}@supports (color:color-mix(in lab, red, red)){.bg-surface\/80{background-color:color-mix(in oklab, var(--color-surface) 80%, transparent)}}.bg-surface\/95{background-color:#18181bf2}@supports (color:color-mix(in lab, red, red)){.bg-surface\/95{background-color:color-mix(in oklab, var(--color-surface) 95%, transparent)}}.bg-teal-500{background-color:var(--color-teal-500)}.bg-teal-500\/20{background-color:#00baa733}@supports (color:color-mix(in lab, red, red)){.bg-teal-500\/20{background-color:color-mix(in oklab, var(--color-teal-500) 20%, transparent)}}.bg-violet-400{background-color:var(--color-violet-400)}.bg-violet-400\/40{background-color:#a685ff66}@supports (color:color-mix(in lab, red, red)){.bg-violet-400\/40{background-color:color-mix(in oklab, var(--color-violet-400) 40%, transparent)}}.bg-violet-400\/60{background-color:#a685ff99}@supports (color:color-mix(in lab, red, red)){.bg-violet-400\/60{background-color:color-mix(in oklab, var(--color-violet-400) 60%, transparent)}}.bg-violet-500{background-color:var(--color-violet-500)}.bg-violet-500\/3{background-color:#8b5cf608}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/3{background-color:color-mix(in oklab, var(--color-violet-500) 3%, transparent)}}.bg-violet-500\/4{background-color:#8b5cf60a}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/4{background-color:color-mix(in oklab, var(--color-violet-500) 4%, transparent)}}.bg-violet-500\/5{background-color:#8b5cf60d}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/5{background-color:color-mix(in oklab, var(--color-violet-500) 5%, transparent)}}.bg-violet-500\/10{background-color:#8b5cf61a}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/10{background-color:color-mix(in oklab, var(--color-violet-500) 10%, transparent)}}.bg-violet-500\/15{background-color:#8b5cf626}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/15{background-color:color-mix(in oklab, var(--color-violet-500) 15%, transparent)}}.bg-violet-500\/20{background-color:#8b5cf633}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/20{background-color:color-mix(in oklab, var(--color-violet-500) 20%, transparent)}}.bg-violet-500\/25{background-color:#8b5cf640}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/25{background-color:color-mix(in oklab, var(--color-violet-500) 25%, transparent)}}.bg-violet-500\/30{background-color:#8b5cf64d}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/30{background-color:color-mix(in oklab, var(--color-violet-500) 30%, transparent)}}.bg-violet-500\/55{background-color:#8b5cf68c}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/55{background-color:color-mix(in oklab, var(--color-violet-500) 55%, transparent)}}.bg-violet-500\/70{background-color:#8b5cf6b3}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/70{background-color:color-mix(in oklab, var(--color-violet-500) 70%, transparent)}}.bg-violet-500\/85{background-color:#8b5cf6d9}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/85{background-color:color-mix(in oklab, var(--color-violet-500) 85%, transparent)}}.bg-warning{background-color:var(--color-warning)}.bg-warning\/10{background-color:#fbbf241a}@supports (color:color-mix(in lab, red, red)){.bg-warning\/10{background-color:color-mix(in oklab, var(--color-warning) 10%, transparent)}}.bg-warning\/15{background-color:#fbbf2426}@supports (color:color-mix(in lab, red, red)){.bg-warning\/15{background-color:color-mix(in oklab, var(--color-warning) 15%, transparent)}}.bg-white\/3{background-color:#ffffff08}@supports (color:color-mix(in lab, red, red)){.bg-white\/3{background-color:color-mix(in oklab, var(--color-white) 3%, transparent)}}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.bg-white\/5{background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.bg-white\/\[0\.03\]{background-color:#ffffff08}@supports (color:color-mix(in lab, red, red)){.bg-white\/\[0\.03\]{background-color:color-mix(in oklab, var(--color-white) 3%, transparent)}}.bg-white\/\[0\.04\]{background-color:#ffffff0a}@supports (color:color-mix(in lab, red, red)){.bg-white\/\[0\.04\]{background-color:color-mix(in oklab, var(--color-white) 4%, transparent)}}.bg-white\/\[0\.06\]{background-color:#ffffff0f}@supports (color:color-mix(in lab, red, red)){.bg-white\/\[0\.06\]{background-color:color-mix(in oklab, var(--color-white) 6%, transparent)}}.bg-zinc-400{background-color:var(--color-zinc-400)}.bg-zinc-500{background-color:var(--color-zinc-500)}.bg-zinc-500\/10{background-color:#71717b1a}@supports (color:color-mix(in lab, red, red)){.bg-zinc-500\/10{background-color:color-mix(in oklab, var(--color-zinc-500) 10%, transparent)}}.bg-zinc-500\/15{background-color:#71717b26}@supports (color:color-mix(in lab, red, red)){.bg-zinc-500\/15{background-color:color-mix(in oklab, var(--color-zinc-500) 15%, transparent)}}.bg-zinc-500\/20{background-color:#71717b33}@supports (color:color-mix(in lab, red, red)){.bg-zinc-500\/20{background-color:color-mix(in oklab, var(--color-zinc-500) 20%, transparent)}}.bg-zinc-500\/70{background-color:#71717bb3}@supports (color:color-mix(in lab, red, red)){.bg-zinc-500\/70{background-color:color-mix(in oklab, var(--color-zinc-500) 70%, transparent)}}.bg-zinc-600{background-color:var(--color-zinc-600)}.bg-zinc-600\/30{background-color:#52525c4d}@supports (color:color-mix(in lab, red, red)){.bg-zinc-600\/30{background-color:color-mix(in oklab, var(--color-zinc-600) 30%, transparent)}}.bg-zinc-700{background-color:var(--color-zinc-700)}.bg-zinc-700\/30{background-color:#3f3f464d}@supports (color:color-mix(in lab, red, red)){.bg-zinc-700\/30{background-color:color-mix(in oklab, var(--color-zinc-700) 30%, transparent)}}.bg-zinc-700\/50{background-color:#3f3f4680}@supports (color:color-mix(in lab, red, red)){.bg-zinc-700\/50{background-color:color-mix(in oklab, var(--color-zinc-700) 50%, transparent)}}.bg-zinc-800{background-color:var(--color-zinc-800)}.bg-zinc-800\/50{background-color:#27272a80}@supports (color:color-mix(in lab, red, red)){.bg-zinc-800\/50{background-color:color-mix(in oklab, var(--color-zinc-800) 50%, transparent)}}.bg-zinc-800\/60{background-color:#27272a99}@supports (color:color-mix(in lab, red, red)){.bg-zinc-800\/60{background-color:color-mix(in oklab, var(--color-zinc-800) 60%, transparent)}}.bg-zinc-900{background-color:var(--color-zinc-900)}.bg-zinc-900\/50{background-color:#18181b80}@supports (color:color-mix(in lab, red, red)){.bg-zinc-900\/50{background-color:color-mix(in oklab, var(--color-zinc-900) 50%, transparent)}}.bg-linear-to-b{--tw-gradient-position:to bottom}@supports (background-image:linear-gradient(in lab, red, red)){.bg-linear-to-b{--tw-gradient-position:to bottom in oklab}}.bg-linear-to-b{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-linear-to-br{--tw-gradient-position:to bottom right}@supports (background-image:linear-gradient(in lab, red, red)){.bg-linear-to-br{--tw-gradient-position:to bottom right in oklab}}.bg-linear-to-br{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-linear-to-r{--tw-gradient-position:to right}@supports (background-image:linear-gradient(in lab, red, red)){.bg-linear-to-r{--tw-gradient-position:to right in oklab}}.bg-linear-to-r{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-amber-500\/\[0\.07\]{--tw-gradient-from:#f99c0012}@supports (color:color-mix(in lab, red, red)){.from-amber-500\/\[0\.07\]{--tw-gradient-from:color-mix(in oklab, var(--color-amber-500) 7.0%, transparent)}}.from-amber-500\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-500\/\[0\.07\]{--tw-gradient-from:#00b7d712}@supports (color:color-mix(in lab, red, red)){.from-cyan-500\/\[0\.07\]{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-500) 7.0%, transparent)}}.from-cyan-500\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-500\/6{--tw-gradient-from:#00bb7f0f}@supports (color:color-mix(in lab, red, red)){.from-emerald-500\/6{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-500) 6%, transparent)}}.from-emerald-500\/6{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-500\/\[0\.07\]{--tw-gradient-from:#00bb7f12}@supports (color:color-mix(in lab, red, red)){.from-emerald-500\/\[0\.07\]{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-500) 7.0%, transparent)}}.from-emerald-500\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-fuchsia-500\/\[0\.07\]{--tw-gradient-from:#e12afb12}@supports (color:color-mix(in lab, red, red)){.from-fuchsia-500\/\[0\.07\]{--tw-gradient-from:color-mix(in oklab, var(--color-fuchsia-500) 7.0%, transparent)}}.from-fuchsia-500\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-500\/\[0\.07\]{--tw-gradient-from:#ff235712}@supports (color:color-mix(in lab, red, red)){.from-rose-500\/\[0\.07\]{--tw-gradient-from:color-mix(in oklab, var(--color-rose-500) 7.0%, transparent)}}.from-rose-500\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-500{--tw-gradient-from:var(--color-violet-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-500\/5{--tw-gradient-from:#8b5cf60d}@supports (color:color-mix(in lab, red, red)){.from-violet-500\/5{--tw-gradient-from:color-mix(in oklab, var(--color-violet-500) 5%, transparent)}}.from-violet-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-500\/\[0\.07\]{--tw-gradient-from:#8b5cf612}@supports (color:color-mix(in lab, red, red)){.from-violet-500\/\[0\.07\]{--tw-gradient-from:color-mix(in oklab, var(--color-violet-500) 7.0%, transparent)}}.from-violet-500\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-950\/40{--tw-gradient-from:#2f0d6866}@supports (color:color-mix(in lab, red, red)){.from-violet-950\/40{--tw-gradient-from:color-mix(in oklab, var(--color-violet-950) 40%, transparent)}}.from-violet-950\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-card{--tw-gradient-via:var(--color-card);--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-card{--tw-gradient-to:var(--color-card);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-400{--tw-gradient-to:var(--color-emerald-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-3\.5{padding:calc(var(--spacing) * 3.5)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-10{padding:calc(var(--spacing) * 10)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-10{padding-inline:calc(var(--spacing) * 10)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\.5{padding-block:calc(var(--spacing) * 3.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-20{padding-block:calc(var(--spacing) * 20)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-1\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pr-5{padding-right:calc(var(--spacing) * 5)}.pr-12{padding-right:calc(var(--spacing) * 12)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[13px\]{font-size:13px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\[0\.15em\]{--tw-tracking:.15em;letter-spacing:.15em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-tighter{--tw-tracking:var(--tracking-tighter);letter-spacing:var(--tracking-tighter)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.\!text-violet-300{color:var(--color-violet-300)!important}.\!text-white{color:var(--color-white)!important}.text-amber-200{color:var(--color-amber-200)}.text-amber-200\/80{color:#fee685cc}@supports (color:color-mix(in lab, red, red)){.text-amber-200\/80{color:color-mix(in oklab, var(--color-amber-200) 80%, transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-blue-400{color:var(--color-blue-400)}.text-border-subtle{color:var(--color-border-subtle)}.text-cyan-200{color:var(--color-cyan-200)}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-400{color:var(--color-cyan-400)}.text-cyan-500{color:var(--color-cyan-500)}.text-emerald-200{color:var(--color-emerald-200)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-300\/80{color:#5ee9b5cc}@supports (color:color-mix(in lab, red, red)){.text-emerald-300\/80{color:color-mix(in oklab, var(--color-emerald-300) 80%, transparent)}}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/60{color:#00d29499}@supports (color:color-mix(in lab, red, red)){.text-emerald-400\/60{color:color-mix(in oklab, var(--color-emerald-400) 60%, transparent)}}.text-emerald-400\/70{color:#00d294b3}@supports (color:color-mix(in lab, red, red)){.text-emerald-400\/70{color:color-mix(in oklab, var(--color-emerald-400) 70%, transparent)}}.text-emerald-400\/80{color:#00d294cc}@supports (color:color-mix(in lab, red, red)){.text-emerald-400\/80{color:color-mix(in oklab, var(--color-emerald-400) 80%, transparent)}}.text-emerald-500{color:var(--color-emerald-500)}.text-error{color:var(--color-error)}.text-foreground{color:var(--color-foreground)}.text-foreground\/60{color:#e8e8ed99}@supports (color:color-mix(in lab, red, red)){.text-foreground\/60{color:color-mix(in oklab, var(--color-foreground) 60%, transparent)}}.text-foreground\/70{color:#e8e8edb3}@supports (color:color-mix(in lab, red, red)){.text-foreground\/70{color:color-mix(in oklab, var(--color-foreground) 70%, transparent)}}.text-foreground\/80{color:#e8e8edcc}@supports (color:color-mix(in lab, red, red)){.text-foreground\/80{color:color-mix(in oklab, var(--color-foreground) 80%, transparent)}}.text-foreground\/90{color:#e8e8ede6}@supports (color:color-mix(in lab, red, red)){.text-foreground\/90{color:color-mix(in oklab, var(--color-foreground) 90%, transparent)}}.text-fuchsia-200{color:var(--color-fuchsia-200)}.text-fuchsia-300{color:var(--color-fuchsia-300)}.text-fuchsia-400{color:var(--color-fuchsia-400)}.text-indigo-400{color:var(--color-indigo-400)}.text-info{color:var(--color-info)}.text-lime-200{color:var(--color-lime-200)}.text-lime-400{color:var(--color-lime-400)}.text-live{color:var(--color-live)}.text-muted-foreground{color:var(--color-muted-foreground)}.text-orange-300{color:var(--color-orange-300)}.text-orange-400{color:var(--color-orange-400)}.text-purple-400{color:var(--color-purple-400)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-400\/60{color:#ff656899}@supports (color:color-mix(in lab, red, red)){.text-red-400\/60{color:color-mix(in oklab, var(--color-red-400) 60%, transparent)}}.text-red-400\/80{color:#ff6568cc}@supports (color:color-mix(in lab, red, red)){.text-red-400\/80{color:color-mix(in oklab, var(--color-red-400) 80%, transparent)}}.text-rose-200{color:var(--color-rose-200)}.text-rose-300{color:var(--color-rose-300)}.text-rose-300\/80{color:#ffa2aecc}@supports (color:color-mix(in lab, red, red)){.text-rose-300\/80{color:color-mix(in oklab, var(--color-rose-300) 80%, transparent)}}.text-rose-400{color:var(--color-rose-400)}.text-sky-200{color:var(--color-sky-200)}.text-sky-400{color:var(--color-sky-400)}.text-success{color:var(--color-success)}.text-surface-overlay{color:var(--color-surface-overlay)}.text-teal-400{color:var(--color-teal-400)}.text-violet-100{color:var(--color-violet-100)}.text-violet-200{color:var(--color-violet-200)}.text-violet-300{color:var(--color-violet-300)}.text-violet-300\/70{color:#c4b4ffb3}@supports (color:color-mix(in lab, red, red)){.text-violet-300\/70{color:color-mix(in oklab, var(--color-violet-300) 70%, transparent)}}.text-violet-300\/80{color:#c4b4ffcc}@supports (color:color-mix(in lab, red, red)){.text-violet-300\/80{color:color-mix(in oklab, var(--color-violet-300) 80%, transparent)}}.text-violet-400{color:var(--color-violet-400)}.text-violet-400\/60{color:#a685ff99}@supports (color:color-mix(in lab, red, red)){.text-violet-400\/60{color:color-mix(in oklab, var(--color-violet-400) 60%, transparent)}}.text-violet-500{color:var(--color-violet-500)}.text-warning{color:var(--color-warning)}.text-zinc-100{color:var(--color-zinc-100)}.text-zinc-200{color:var(--color-zinc-200)}.text-zinc-300{color:var(--color-zinc-300)}.text-zinc-400{color:var(--color-zinc-400)}.text-zinc-500{color:var(--color-zinc-500)}.text-zinc-600{color:var(--color-zinc-600)}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline-offset-2{text-underline-offset:2px}.placeholder-muted-foreground::placeholder{color:var(--color-muted-foreground)}.opacity-0{opacity:0}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_4px_rgba\(52\,211\,153\,0\.6\)\]{--tw-shadow:0 0 4px var(--tw-shadow-color,#34d39999);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_6px_rgba\(52\,211\,153\,0\.6\)\]{--tw-shadow:0 0 6px var(--tw-shadow-color,#34d39999);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_6px_rgba\(52\,211\,153\,0\.7\)\]{--tw-shadow:0 0 6px var(--tw-shadow-color,#34d399b3);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_8px_rgba\(52\,211\,153\,0\.5\)\]{--tw-shadow:0 0 8px var(--tw-shadow-color,#34d39980);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_8px_rgba\(248\,113\,113\,0\.5\)\]{--tw-shadow:0 0 8px var(--tw-shadow-color,#f8717180);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_8px_rgba\(251\,191\,36\,0\.5\)\]{--tw-shadow:0 0 8px var(--tw-shadow-color,#fbbf2480);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-violet-500\/5{--tw-shadow-color:#8b5cf60d}@supports (color:color-mix(in lab, red, red)){.shadow-violet-500\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-violet-500) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-amber-500\/20{--tw-ring-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.ring-amber-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.ring-amber-500\/30{--tw-ring-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.ring-amber-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.ring-amber-500\/40{--tw-ring-color:#f99c0066}@supports (color:color-mix(in lab, red, red)){.ring-amber-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 40%, transparent)}}.ring-blue-500\/40{--tw-ring-color:#3080ff66}@supports (color:color-mix(in lab, red, red)){.ring-blue-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-blue-500) 40%, transparent)}}.ring-cyan-400{--tw-ring-color:var(--color-cyan-400)}.ring-cyan-500\/10{--tw-ring-color:#00b7d71a}@supports (color:color-mix(in lab, red, red)){.ring-cyan-500\/10{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 10%, transparent)}}.ring-cyan-500\/20{--tw-ring-color:#00b7d733}@supports (color:color-mix(in lab, red, red)){.ring-cyan-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.ring-cyan-500\/25{--tw-ring-color:#00b7d740}@supports (color:color-mix(in lab, red, red)){.ring-cyan-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 25%, transparent)}}.ring-cyan-500\/30{--tw-ring-color:#00b7d74d}@supports (color:color-mix(in lab, red, red)){.ring-cyan-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 30%, transparent)}}.ring-cyan-500\/40{--tw-ring-color:#00b7d766}@supports (color:color-mix(in lab, red, red)){.ring-cyan-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 40%, transparent)}}.ring-emerald-500\/10{--tw-ring-color:#00bb7f1a}@supports (color:color-mix(in lab, red, red)){.ring-emerald-500\/10{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 10%, transparent)}}.ring-emerald-500\/20{--tw-ring-color:#00bb7f33}@supports (color:color-mix(in lab, red, red)){.ring-emerald-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 20%, transparent)}}.ring-emerald-500\/30{--tw-ring-color:#00bb7f4d}@supports (color:color-mix(in lab, red, red)){.ring-emerald-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 30%, transparent)}}.ring-emerald-500\/40{--tw-ring-color:#00bb7f66}@supports (color:color-mix(in lab, red, red)){.ring-emerald-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 40%, transparent)}}.ring-indigo-500\/40{--tw-ring-color:#625fff66}@supports (color:color-mix(in lab, red, red)){.ring-indigo-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 40%, transparent)}}.ring-rose-500\/30{--tw-ring-color:#ff23574d}@supports (color:color-mix(in lab, red, red)){.ring-rose-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 30%, transparent)}}.ring-teal-500\/40{--tw-ring-color:#00baa766}@supports (color:color-mix(in lab, red, red)){.ring-teal-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-teal-500) 40%, transparent)}}.ring-violet-500{--tw-ring-color:var(--color-violet-500)}.ring-violet-500\/10{--tw-ring-color:#8b5cf61a}@supports (color:color-mix(in lab, red, red)){.ring-violet-500\/10{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 10%, transparent)}}.ring-violet-500\/20{--tw-ring-color:#8b5cf633}@supports (color:color-mix(in lab, red, red)){.ring-violet-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 20%, transparent)}}.ring-violet-500\/25{--tw-ring-color:#8b5cf640}@supports (color:color-mix(in lab, red, red)){.ring-violet-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 25%, transparent)}}.ring-violet-500\/30{--tw-ring-color:#8b5cf64d}@supports (color:color-mix(in lab, red, red)){.ring-violet-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 30%, transparent)}}.ring-violet-500\/40{--tw-ring-color:#8b5cf666}@supports (color:color-mix(in lab, red, red)){.ring-violet-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 40%, transparent)}}.ring-violet-500\/50{--tw-ring-color:#8b5cf680}@supports (color:color-mix(in lab, red, red)){.ring-violet-500\/50{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 50%, transparent)}}.ring-white\/10{--tw-ring-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.ring-white\/10{--tw-ring-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.ring-zinc-500\/40{--tw-ring-color:#71717b66}@supports (color:color-mix(in lab, red, red)){.ring-zinc-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-zinc-500) 40%, transparent)}}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.ring-inset{--tw-ring-inset:inset}@media (hover:hover){.group-hover\:mt-2\.5:is(:where(.group):hover *){margin-top:calc(var(--spacing) * 2.5)}.group-hover\:block:is(:where(.group):hover *){display:block}.group-hover\:h-auto:is(:where(.group):hover *){height:auto}.group-hover\:bg-fuchsia-400:is(:where(.group):hover *){background-color:var(--color-fuchsia-400)}.group-hover\:text-violet-300:is(:where(.group):hover *){color:var(--color-violet-300)}.group-hover\:text-violet-400:is(:where(.group):hover *){color:var(--color-violet-400)}.group-hover\:opacity-80:is(:where(.group):hover *){opacity:.8}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\:text-zinc-500::placeholder{color:var(--color-zinc-500)}.before\:mr-1\.5:before{content:var(--tw-content);margin-right:calc(var(--spacing) * 1.5)}.before\:content-\[\'–\'\]:before{--tw-content:"–";content:var(--tw-content)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}@media (hover:hover){.hover\:-translate-y-0\.5:hover{--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-\[1\.01\]:hover{scale:1.01}.hover\:border-border-strong:hover{border-color:var(--color-border-strong)}.hover\:border-violet-400:hover{border-color:var(--color-violet-400)}.hover\:border-violet-500:hover{border-color:var(--color-violet-500)}.hover\:border-violet-500\/40:hover{border-color:#8b5cf666}@supports (color:color-mix(in lab, red, red)){.hover\:border-violet-500\/40:hover{border-color:color-mix(in oklab, var(--color-violet-500) 40%, transparent)}}.hover\:border-violet-500\/50:hover{border-color:#8b5cf680}@supports (color:color-mix(in lab, red, red)){.hover\:border-violet-500\/50:hover{border-color:color-mix(in oklab, var(--color-violet-500) 50%, transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.hover\:bg-emerald-500\/10:hover{background-color:#00bb7f1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-emerald-500\/10:hover{background-color:color-mix(in oklab, var(--color-emerald-500) 10%, transparent)}}.hover\:bg-emerald-500\/20:hover{background-color:#00bb7f33}@supports (color:color-mix(in lab, red, red)){.hover\:bg-emerald-500\/20:hover{background-color:color-mix(in oklab, var(--color-emerald-500) 20%, transparent)}}.hover\:bg-muted:hover{background-color:var(--color-muted)}.hover\:bg-muted\/50:hover{background-color:#27272a80}@supports (color:color-mix(in lab, red, red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab, var(--color-muted) 50%, transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab, var(--color-red-500) 10%, transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab, var(--color-red-500) 20%, transparent)}}.hover\:bg-surface-overlay:hover{background-color:var(--color-surface-overlay)}.hover\:bg-surface-overlay\/30:hover{background-color:#27272a4d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-surface-overlay\/30:hover{background-color:color-mix(in oklab, var(--color-surface-overlay) 30%, transparent)}}.hover\:bg-surface-overlay\/40:hover{background-color:#27272a66}@supports (color:color-mix(in lab, red, red)){.hover\:bg-surface-overlay\/40:hover{background-color:color-mix(in oklab, var(--color-surface-overlay) 40%, transparent)}}.hover\:bg-surface-overlay\/60:hover{background-color:#27272a99}@supports (color:color-mix(in lab, red, red)){.hover\:bg-surface-overlay\/60:hover{background-color:color-mix(in oklab, var(--color-surface-overlay) 60%, transparent)}}.hover\:bg-surface-overlay\/70:hover{background-color:#27272ab3}@supports (color:color-mix(in lab, red, red)){.hover\:bg-surface-overlay\/70:hover{background-color:color-mix(in oklab, var(--color-surface-overlay) 70%, transparent)}}.hover\:bg-violet-500\/10:hover{background-color:#8b5cf61a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-violet-500\/10:hover{background-color:color-mix(in oklab, var(--color-violet-500) 10%, transparent)}}.hover\:bg-violet-500\/20:hover{background-color:#8b5cf633}@supports (color:color-mix(in lab, red, red)){.hover\:bg-violet-500\/20:hover{background-color:color-mix(in oklab, var(--color-violet-500) 20%, transparent)}}.hover\:bg-violet-500\/25:hover{background-color:#8b5cf640}@supports (color:color-mix(in lab, red, red)){.hover\:bg-violet-500\/25:hover{background-color:color-mix(in oklab, var(--color-violet-500) 25%, transparent)}}.hover\:bg-white\/3:hover{background-color:#ffffff08}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/3:hover{background-color:color-mix(in oklab, var(--color-white) 3%, transparent)}}.hover\:bg-white\/\[0\.03\]:hover{background-color:#ffffff08}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/\[0\.03\]:hover{background-color:color-mix(in oklab, var(--color-white) 3%, transparent)}}.hover\:bg-white\/\[0\.04\]:hover{background-color:#ffffff0a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/\[0\.04\]:hover{background-color:color-mix(in oklab, var(--color-white) 4%, transparent)}}.hover\:bg-white\/\[0\.06\]:hover{background-color:#ffffff0f}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/\[0\.06\]:hover{background-color:color-mix(in oklab, var(--color-white) 6%, transparent)}}.hover\:bg-white\/\[0\.07\]:hover{background-color:#ffffff12}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/\[0\.07\]:hover{background-color:color-mix(in oklab, var(--color-white) 7.0%, transparent)}}.hover\:bg-zinc-800:hover{background-color:var(--color-zinc-800)}.hover\:text-cyan-300:hover{color:var(--color-cyan-300)}.hover\:text-emerald-400:hover{color:var(--color-emerald-400)}.hover\:text-foreground:hover{color:var(--color-foreground)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-violet-200:hover{color:var(--color-violet-200)}.hover\:text-violet-300:hover{color:var(--color-violet-300)}.hover\:text-zinc-200:hover{color:var(--color-zinc-200)}.hover\:text-zinc-300:hover{color:var(--color-zinc-300)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-\[0_14px_34px_-16px_rgba\(34\,211\,238\,0\.45\)\]:hover{--tw-shadow:0 14px 34px -16px var(--tw-shadow-color,#22d3ee73);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-\[0_14px_34px_-16px_rgba\(52\,211\,153\,0\.45\)\]:hover{--tw-shadow:0 14px 34px -16px var(--tw-shadow-color,#34d39973);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-\[0_14px_34px_-16px_rgba\(139\,92\,246\,0\.45\)\]:hover{--tw-shadow:0 14px 34px -16px var(--tw-shadow-color,#8b5cf673);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-\[0_14px_34px_-16px_rgba\(217\,70\,239\,0\.45\)\]:hover{--tw-shadow:0 14px 34px -16px var(--tw-shadow-color,#d946ef73);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-\[0_14px_34px_-16px_rgba\(251\,113\,133\,0\.4\)\]:hover{--tw-shadow:0 14px 34px -16px var(--tw-shadow-color,#fb718566);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-\[0_14px_34px_-16px_rgba\(251\,191\,36\,0\.4\)\]:hover{--tw-shadow:0 14px 34px -16px var(--tw-shadow-color,#fbbf2466);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:ring-1:hover{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:ring-cyan-500\/30:hover{--tw-ring-color:#00b7d74d}@supports (color:color-mix(in lab, red, red)){.hover\:ring-cyan-500\/30:hover{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 30%, transparent)}}.hover\:ring-red-500\/30:hover{--tw-ring-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.hover\:ring-red-500\/30:hover{--tw-ring-color:color-mix(in oklab, var(--color-red-500) 30%, transparent)}}.hover\:ring-violet-500\/30:hover{--tw-ring-color:#8b5cf64d}@supports (color:color-mix(in lab, red, red)){.hover\:ring-violet-500\/30:hover{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 30%, transparent)}}}.focus\:border-violet-500:focus{border-color:var(--color-violet-500)}.focus\:border-violet-500\/60:focus{border-color:#8b5cf699}@supports (color:color-mix(in lab, red, red)){.focus\:border-violet-500\/60:focus{border-color:color-mix(in oklab, var(--color-violet-500) 60%, transparent)}}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-violet-500:focus{--tw-ring-color:var(--color-violet-500)}.focus\:ring-violet-500\/40:focus{--tw-ring-color:#8b5cf666}@supports (color:color-mix(in lab, red, red)){.focus\:ring-violet-500\/40:focus{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 40%, transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:text-violet-300:focus-visible{color:var(--color-violet-300)}.focus-visible\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-violet-400:focus-visible{--tw-ring-color:var(--color-violet-400)}.focus-visible\:ring-violet-500:focus-visible{--tw-ring-color:var(--color-violet-500)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media (hover:hover){.disabled\:hover\:border-border-subtle:disabled:hover{border-color:var(--color-border-subtle)}.disabled\:hover\:bg-white\/\[0\.03\]:disabled:hover{background-color:#ffffff08}@supports (color:color-mix(in lab, red, red)){.disabled\:hover\:bg-white\/\[0\.03\]:disabled:hover{background-color:color-mix(in oklab, var(--color-white) 3%, transparent)}}}@media (width>=40rem){.sm\:inline{display:inline}.sm\:w-72{width:calc(var(--spacing) * 72)}.sm\:w-\[15\.5rem\]{width:15.5rem}.sm\:flex-1{flex:1}.sm\:shrink-0{flex-shrink:0}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:items-end{align-items:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-7{gap:calc(var(--spacing) * 7)}.sm\:gap-12{gap:calc(var(--spacing) * 12)}.sm\:self-stretch{align-self:stretch}.sm\:border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.sm\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.sm\:border-border-subtle{border-color:var(--color-border-subtle)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}.sm\:px-8{padding-inline:calc(var(--spacing) * 8)}.sm\:pt-0{padding-top:calc(var(--spacing) * 0)}.sm\:pb-1{padding-bottom:calc(var(--spacing) * 1)}.sm\:pl-6{padding-left:calc(var(--spacing) * 6)}.sm\:pl-7{padding-left:calc(var(--spacing) * 7)}.sm\:pl-10{padding-left:calc(var(--spacing) * 10)}.sm\:text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}}@media (width>=48rem){.md\:sticky{position:sticky}.md\:top-0{top:calc(var(--spacing) * 0)}.md\:h-screen{height:100vh}.md\:w-56{width:calc(var(--spacing) * 56)}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:overflow-y-auto{overflow-y:auto}.md\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.md\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}}@media (width>=64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:w-80{width:calc(var(--spacing) * 80)}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-\[280px_1fr\]{grid-template-columns:280px 1fr}.lg\:flex-row{flex-direction:row}.lg\:items-start{align-items:flex-start}.lg\:border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.lg\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}}@media (width>=80rem){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.glass-panel{background:var(--color-card);border:1px solid var(--color-border)}.glass-card{background:var(--color-card);border:1px solid var(--color-border);transition:all .2s ease-in-out}.glass-card:hover{background:var(--color-surface-raised);border-color:var(--color-border-strong)}.el-substrate{background-color:var(--color-surface-substrate)}.el-surface{background-color:var(--color-surface-default)}.el-raised{background-color:var(--color-surface-raised)}.el-overlay{background-color:var(--color-surface-overlay)}.el-border-subtle{border-color:var(--color-border-subtle)}.el-border-strong{border-color:var(--color-border-strong)}.t-secondary{color:var(--color-text-secondary)}.t-tertiary{color:var(--color-text-tertiary)}.t-ghost{color:var(--color-text-ghost)}.text-foreground-emphasis{color:var(--color-foreground-emphasis)}.glow-accent{box-shadow:0 0 20px #8b5cf626}.glow-live{box-shadow:0 0 16px #22d3ee26}.glow-success{box-shadow:0 0 16px #34d39926}.text-gradient{-webkit-text-fill-color:transparent;background:linear-gradient(135deg,#8b5cf6 0%,#6d28d9 100%);-webkit-background-clip:text;background-clip:text}.card-hover{transition:all .2s ease-out}.card-hover:hover{border-color:var(--color-border-strong);transform:translateY(-1px);box-shadow:0 4px 12px #0003}.font-grotesk{font-family:var(--font-grotesk)}.font-mono{font-family:var(--font-mono)}.custom-scrollbar::-webkit-scrollbar{width:6px;height:6px}.custom-scrollbar::-webkit-scrollbar-track{background:0 0}.custom-scrollbar::-webkit-scrollbar-thumb{background:#ffffff14;border-radius:3px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#ffffff26}.scrollbar-hide::-webkit-scrollbar{display:none}.scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}.section-label{font-family:var(--font-grotesk);text-transform:uppercase;letter-spacing:.08em;color:var(--color-text-secondary);font-size:.6875rem;font-weight:600}.divider-shimmer{background:linear-gradient(90deg,#0000 0%,#ffffff0f 20%,#ffffff1f 50%,#ffffff0f 80%,#0000 100%);height:1px}}@font-face{font-family:JetBrains Mono;src:url(./fonts/jetbrains-mono-latin-400-normal.woff)format("woff");font-weight:400;font-style:normal;font-display:swap}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}
|
|
925
|
+
`).replace(Ld,``)}function zd(e,t){return t=Rd(t),Rd(e)===t}function Bd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Jt(e,``+r);break;case`className`:Mt(e,`class`,r);break;case`tabIndex`:Mt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Mt(e,n,r);break;case`style`:Zt(e,r,o);break;case`data`:if(t!==`object`){Mt(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=tn(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Bd(e,t,`name`,a.name,a,null),Bd(e,t,`formEncType`,a.formEncType,a,null),Bd(e,t,`formMethod`,a.formMethod,a,null),Bd(e,t,`formTarget`,a.formTarget,a,null)):(Bd(e,t,`encType`,a.encType,a,null),Bd(e,t,`method`,a.method,a,null),Bd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=tn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`onScroll`:r!=null&&U(`scroll`,e);break;case`onScrollEnd`:r!=null&&U(`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=tn(``+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`:U(`beforetoggle`,e),U(`toggle`,e),jt(e,`popover`,r);break;case`xlinkActuate`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:jt(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=$t.get(n)||n,jt(e,n,r))}}function Vd(e,t,n,r,a,o){switch(n){case`style`:Zt(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`?Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Jt(e,``+r);break;case`onScroll`:r!=null&&U(`scroll`,e);break;case`onScrollEnd`:r!=null&&U(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!wt.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[dt]||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,``):jt(e,n,r)}}}function Hd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:U(`error`,e),U(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Bd(e,t,o,s,n,null)}}a&&Bd(e,t,`srcSet`,n.srcSet,n,null),r&&Bd(e,t,`src`,n.src,n,null);return;case`input`:U(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Bd(e,t,r,d,n,null)}}Ut(e,o,c,l,u,s,a,!1);return;case`select`:for(a in U(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Bd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Gt(e,!!r,n,!0):Gt(e,!!r,t,!1);return;case`textarea`:for(s in U(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Bd(e,t,s,c,n,null)}qt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Bd(e,t,l,r,n,null)}return;case`dialog`:U(`beforetoggle`,e),U(`toggle`,e),U(`cancel`,e),U(`close`,e);break;case`iframe`:case`object`:U(`load`,e);break;case`video`:case`audio`:for(r=0;r<wd.length;r++)U(wd[r],e);break;case`image`:U(`error`,e),U(`load`,e);break;case`details`:U(`toggle`,e);break;case`embed`:case`source`:case`link`:U(`error`,e),U(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Bd(e,t,u,r,n,null)}return;default:if(Qt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Vd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Bd(e,t,c,r,n,null))}function Ud(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Bd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Bd(e,t,p,m,r,f)}}Ht(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Bd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Bd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Gt(e,!!n,n?[]:``,!1):Gt(e,!!n,t,!0)):Gt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Bd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Bd(e,t,s,a,r,o)}Kt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Bd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Bd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Bd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Bd(e,t,u,p,r,m)}return;default:if(Qt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Vd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Vd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Bd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Bd(e,t,f,p,r,m)}function Wd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Gd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Wd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Wd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Kd=null,qd=null;function Jd(e){return e.nodeType===9?e:e.ownerDocument}function Yd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Xd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Zd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Qd=null;function $d(){var e=window.event;return e&&e.type===`popstate`?e===Qd?!1:(Qd=e,!0):(Qd=null,!1)}var ef=typeof setTimeout==`function`?setTimeout:void 0,tf=typeof clearTimeout==`function`?clearTimeout:void 0,nf=typeof Promise==`function`?Promise:void 0,rf=typeof queueMicrotask==`function`?queueMicrotask:nf===void 0?ef:function(e){return nf.resolve(null).then(e).catch(af)};function af(e){setTimeout(function(){throw e})}function of(e){return e===`head`}function sf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Bp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)xf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,xf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[_t]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&xf(e.ownerDocument.body);n=i}while(n);Bp(t)}function cf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function lf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:lf(n),vt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function uf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[_t])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=gf(e.nextSibling),e===null)break}return null}function df(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=gf(e.nextSibling),e===null))return null;return e}function ff(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=gf(e.nextSibling),e===null))return null;return e}function pf(e){return e.data===`$?`||e.data===`$~`}function mf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function hf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function gf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var _f=null;function vf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return gf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function yf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function bf(e,t,n){switch(t=Jd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function xf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);vt(e)}var W=new Map,Sf=new Set;function Cf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var wf=A.d;A.d={f:Tf,r:Ef,D:kf,C:Af,L:jf,m:Mf,X:Pf,S:Nf,M:Ff};function Tf(){var e=wf.f(),t=Eu();return e||t}function Ef(e){var t=bt(e);t!==null&&t.tag===5&&t.type===`form`?Ds(t):wf.r(e)}var Df=typeof document>`u`?null:document;function Of(e,t,n){var r=Df;if(r&&typeof t==`string`&&t){var i=Vt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Sf.has(i)||(Sf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Hd(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function kf(e){wf.D(e),Of(`dns-prefetch`,e,null)}function Af(e,t){wf.C(e,t),Of(`preconnect`,e,t)}function jf(e,t,n){wf.L(e,t,n);var r=Df;if(r&&e&&t){var i=`link[rel="preload"][as="`+Vt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Vt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Vt(n.imageSizes)+`"]`)):i+=`[href="`+Vt(e)+`"]`;var a=i;switch(t){case`style`:a=Lf(e);break;case`script`:a=Vf(e)}W.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),W.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Rf(a))||t===`script`&&r.querySelector(Hf(a))||(t=r.createElement(`link`),Hd(t,`link`,e),Ct(t),r.head.appendChild(t)))}}function Mf(e,t){wf.m(e,t);var n=Df;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Vt(r)+`"][href="`+Vt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Vf(e)}if(!W.has(a)&&(e=p({rel:`modulepreload`,href:e},t),W.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Hf(a)))return}r=n.createElement(`link`),Hd(r,`link`,e),Ct(r),n.head.appendChild(r)}}}function Nf(e,t,n){wf.S(e,t,n);var r=Df;if(r&&e){var i=St(r).hoistableStyles,a=Lf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Rf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=W.get(a))&&Gf(e,n);var c=o=r.createElement(`link`);Ct(c),Hd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Wf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Pf(e,t){wf.X(e,t);var n=Df;if(n&&e){var r=St(n).hoistableScripts,i=Vf(e),a=r.get(i);a||(a=n.querySelector(Hf(i)),a||(e=p({src:e,async:!0},t),(t=W.get(i))&&Kf(e,t),a=n.createElement(`script`),Ct(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Ff(e,t){wf.M(e,t);var n=Df;if(n&&e){var r=St(n).hoistableScripts,i=Vf(e),a=r.get(i);a||(a=n.querySelector(Hf(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=W.get(i))&&Kf(e,t),a=n.createElement(`script`),Ct(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function If(e,t,n,r){var a=(a=de.current)?Cf(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=Lf(n.href),n=St(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=Lf(n.href);var o=St(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(Rf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),W.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},W.set(e,n),o||Bf(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=Vf(n),n=St(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 Lf(e){return`href="`+Vt(e)+`"`}function Rf(e){return`link[rel="stylesheet"][`+e+`]`}function zf(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function Bf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Hd(t,`link`,n),Ct(t),e.head.appendChild(t))}function Vf(e){return`[src="`+Vt(e)+`"]`}function Hf(e){return`script[async]`+e}function Uf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Vt(n.href)+`"]`);if(r)return t.instance=r,Ct(r),r;var a=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ct(r),Hd(r,`style`,a),Wf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Lf(n.href);var o=e.querySelector(Rf(a));if(o)return t.state.loading|=4,t.instance=o,Ct(o),o;r=zf(n),(a=W.get(a))&&Gf(r,a),o=(e.ownerDocument||e).createElement(`link`),Ct(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Hd(o,`link`,r),t.state.loading|=4,Wf(o,n.precedence,e),t.instance=o;case`script`:return o=Vf(n.src),(a=e.querySelector(Hf(o)))?(t.instance=a,Ct(a),a):(r=n,(a=W.get(o))&&(r=p({},n),Kf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Ct(a),Hd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Wf(r,n.precedence,e));return t.instance}function Wf(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 Gf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Kf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var qf=null;function Jf(e,t,n){if(qf===null){var r=new Map,i=qf=new Map;i.set(n,r)}else i=qf,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[_t]||a[ut]||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 Yf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Xf(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 Zf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Qf(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=Lf(r.href),a=t.querySelector(Rf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=tp.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ct(a);return}a=t.ownerDocument||t,r=zf(r),(i=W.get(i))&&Gf(r,i),a=a.createElement(`link`),Ct(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Hd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=tp.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $f=0;function ep(e,t){return e.stylesheets&&e.count===0&&rp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&rp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$f===0&&($f=62500*Gd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&rp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$f?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function tp(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)rp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var np=null;function rp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,np=new Map,t.forEach(ip,e),np=null,tp.call(e))}function ip(e,t){if(!(t.state.loading&4)){var n=np.get(e);if(n)var r=n.get(null);else{n=new Map,np.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=tp.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 ap={$$typeof:x,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function op(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=$e(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$e(0),this.hiddenUpdates=$e(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 sp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new op(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ci(3,null,null,t),e.current=a,a.stateNode=e,t=ca(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Va(a),e}function cp(e){return e?(e=oi,e):oi}function lp(e,t,n,r,i,a){i=cp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ua(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Wa(e,r,t),n!==null&&(xu(n,e,t),Ga(n,e,t))}function up(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function dp(e,t){up(e,t),(e=e.alternate)&&up(e,t)}function fp(e){if(e.tag===13||e.tag===31){var t=ri(e,67108864);t!==null&&xu(t,e,67108864),dp(e,67108864)}}function pp(e){if(e.tag===13||e.tag===31){var t=yu();t=at(t);var n=ri(e,t);n!==null&&xu(n,e,t),dp(e,t)}}var mp=!0;function hp(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=2,_p(e,t,n,r)}finally{A.p=a,k.T=i}}function gp(e,t,n,r){var i=k.T;k.T=null;var a=A.p;try{A.p=8,_p(e,t,n,r)}finally{A.p=a,k.T=i}}function _p(e,t,n,r){if(mp){var i=vp(r);if(i===null)jd(e,t,r,yp,n),Ap(e,r);else if(Mp(i,e,t,n,r))r.stopPropagation();else if(Ap(e,r),t&4&&-1<kp.indexOf(e)){for(;i!==null;){var a=bt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Je(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ve(o);s.entanglements[1]|=c,o&=~c}ud(a),!(Hl&6)&&(su=ke()+500,dd(0,!1))}}break;case 31:case 13:s=ri(a,2),s!==null&&xu(s,a,2),Eu(),dp(a,2)}if(a=vp(r),a===null&&jd(e,t,r,yp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else jd(e,t,r,null,n)}}function vp(e){return e=an(e),bp(e)}var yp=null;function bp(e){if(yp=null,e=yt(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 yp=e,null}function xp(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(Ae()){case je:return 2;case Me:return 8;case Ne:case Pe:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var Sp=!1,Cp=null,wp=null,Tp=null,Ep=new Map,Dp=new Map,Op=[],kp=`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 Ap(e,t){switch(e){case`focusin`:case`focusout`:Cp=null;break;case`dragenter`:case`dragleave`:wp=null;break;case`mouseover`:case`mouseout`:Tp=null;break;case`pointerover`:case`pointerout`:Ep.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Dp.delete(t.pointerId)}}function jp(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=bt(t),t!==null&&fp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Mp(e,t,n,r,i){switch(t){case`focusin`:return Cp=jp(Cp,e,t,n,r,i),!0;case`dragenter`:return wp=jp(wp,e,t,n,r,i),!0;case`mouseover`:return Tp=jp(Tp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Ep.set(a,jp(Ep.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Dp.set(a,jp(Dp.get(a)||null,e,t,n,r,i)),!0}return!1}function Np(e){var t=yt(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,ct(e.priority,function(){pp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ct(e.priority,function(){pp(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 Pp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=vp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);rn=r,n.target.dispatchEvent(r),rn=null}else return t=bt(n),t!==null&&fp(t),e.blockedOn=n,!1;t.shift()}return!0}function Fp(e,t,n){Pp(e)&&n.delete(t)}function Ip(){Sp=!1,Cp!==null&&Pp(Cp)&&(Cp=null),wp!==null&&Pp(wp)&&(wp=null),Tp!==null&&Pp(Tp)&&(Tp=null),Ep.forEach(Fp),Dp.forEach(Fp)}function Lp(e,n){e.blockedOn===n&&(e.blockedOn=null,Sp||(Sp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ip)))}var Rp=null;function zp(e){Rp!==e&&(Rp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Rp===e&&(Rp=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(bp(r||n)===null)continue;break}var a=bt(n);a!==null&&(e.splice(t,3),t-=3,Ts(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Bp(e){function t(t){return Lp(t,e)}Cp!==null&&Lp(Cp,e),wp!==null&&Lp(wp,e),Tp!==null&&Lp(Tp,e),Ep.forEach(t),Dp.forEach(t);for(var n=0;n<Op.length;n++){var r=Op[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Op.length&&(n=Op[0],n.blockedOn===null);)Np(n),n.blockedOn===null&&Op.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[dt]||null;if(typeof a==`function`)o||zp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[dt]||null)s=o.formAction;else if(bp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),zp(n)}}}function Vp(){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 Hp(e){this._internalRoot=e}Up.prototype.render=Hp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;lp(n,yu(),e,t,null,null)},Up.prototype.unmount=Hp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;lp(e.current,2,null,e,null,null),Eu(),t[ft]=null}};function Up(e){this._internalRoot=e}Up.prototype.unstable_scheduleHydration=function(e){if(e){var t=st();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Op.length&&t!==0&&t<Op[n].priority;n++);Op.splice(n,0,e),n===0&&Np(e)}};var Wp=n.version;if(Wp!==`19.2.5`)throw Error(i(527,Wp,`19.2.5`));A.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 Gp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:k,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Kp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kp.isDisabled&&Kp.supportsFiber)try{Re=Kp.inject(Gp),ze=Kp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Js,s=Ys,c=Xs;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=sp(e,1,!1,null,null,n,r,null,o,s,c,Vp),e[ft]=t.current,kd(e),new Hp(t)}}));(0,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=sW()}))().createRoot)(document.getElementById(`root`)).render((0,w.jsx)(f.StrictMode,{children:(0,w.jsx)(ut,{client:Tt,children:(0,w.jsx)(nW,{})})}));</script>
|
|
926
|
+
<style rel="stylesheet" crossorigin>@import "https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap";.rdp-root{--rdp-accent-color:blue;--rdp-accent-background-color:#f0f0ff;--rdp-day-height:44px;--rdp-day-width:44px;--rdp-day_button-border-radius:100%;--rdp-day_button-border:2px solid transparent;--rdp-day_button-height:42px;--rdp-day_button-width:42px;--rdp-selected-border:2px solid var(--rdp-accent-color);--rdp-disabled-opacity:.5;--rdp-outside-opacity:.75;--rdp-today-color:var(--rdp-accent-color);--rdp-dropdown-gap:.5rem;--rdp-months-gap:2rem;--rdp-nav_button-disabled-opacity:.5;--rdp-nav_button-height:2.25rem;--rdp-nav_button-width:2.25rem;--rdp-nav-height:2.75rem;--rdp-range_middle-background-color:var(--rdp-accent-background-color);--rdp-range_middle-color:inherit;--rdp-range_start-color:white;--rdp-range_start-background:linear-gradient(var(--rdp-gradient-direction), transparent 50%, var(--rdp-range_middle-background-color) 50%);--rdp-range_start-date-background-color:var(--rdp-accent-color);--rdp-range_end-background:linear-gradient(var(--rdp-gradient-direction), var(--rdp-range_middle-background-color) 50%, transparent 50%);--rdp-range_end-color:white;--rdp-range_end-date-background-color:var(--rdp-accent-color);--rdp-week_number-border-radius:100%;--rdp-week_number-border:2px solid transparent;--rdp-week_number-height:var(--rdp-day-height);--rdp-week_number-opacity:.75;--rdp-week_number-width:var(--rdp-day-width);--rdp-weeknumber-text-align:center;--rdp-weekday-opacity:.75;--rdp-weekday-padding:.5rem 0rem;--rdp-weekday-text-align:center;--rdp-gradient-direction:90deg;--rdp-animation_duration:.3s;--rdp-animation_timing:cubic-bezier(.4, 0, .2, 1)}.rdp-root[dir=rtl]{--rdp-gradient-direction:-90deg}.rdp-root[data-broadcast-calendar=true]{--rdp-outside-opacity:unset}.rdp-root{box-sizing:border-box;position:relative}.rdp-root *{box-sizing:border-box}.rdp-day{width:var(--rdp-day-width);height:var(--rdp-day-height);text-align:center}.rdp-day_button{cursor:pointer;font:inherit;color:inherit;width:var(--rdp-day_button-width);height:var(--rdp-day_button-height);border:var(--rdp-day_button-border);border-radius:var(--rdp-day_button-border-radius);background:0 0;justify-content:center;align-items:center;margin:0;padding:0;display:flex}.rdp-day_button:disabled{cursor:revert}.rdp-caption_label{z-index:1;white-space:nowrap;border:0;align-items:center;display:inline-flex;position:relative}.rdp-dropdown:focus-visible~.rdp-caption_label{outline:5px auto highlight;outline:5px auto -webkit-focus-ring-color}.rdp-button_next,.rdp-button_previous{cursor:pointer;font:inherit;color:inherit;appearance:none;width:var(--rdp-nav_button-width);height:var(--rdp-nav_button-height);background:0 0;border:none;justify-content:center;align-items:center;margin:0;padding:0;display:inline-flex;position:relative}.rdp-button_next:disabled,.rdp-button_next[aria-disabled=true],.rdp-button_previous:disabled,.rdp-button_previous[aria-disabled=true]{cursor:revert;opacity:var(--rdp-nav_button-disabled-opacity)}.rdp-chevron{fill:var(--rdp-accent-color);display:inline-block}.rdp-root[dir=rtl] .rdp-nav .rdp-chevron{transform-origin:50%;transform:rotate(180deg)}.rdp-dropdowns{align-items:center;gap:var(--rdp-dropdown-gap);display:inline-flex;position:relative}.rdp-dropdown{z-index:2;opacity:0;appearance:none;width:100%;cursor:inherit;line-height:inherit;border:none;margin:0;padding:0;position:absolute;inset-block:0;inset-inline-start:0}.rdp-dropdown_root{align-items:center;display:inline-flex;position:relative}.rdp-dropdown_root[data-disabled=true] .rdp-chevron{opacity:var(--rdp-disabled-opacity)}.rdp-month_caption{height:var(--rdp-nav-height);align-content:center;font-size:large;font-weight:700;display:flex}.rdp-root[data-nav-layout=around] .rdp-month,.rdp-root[data-nav-layout=after] .rdp-month{position:relative}.rdp-root[data-nav-layout=around] .rdp-month_caption{justify-content:center;margin-inline-start:var(--rdp-nav_button-width);margin-inline-end:var(--rdp-nav_button-width);position:relative}.rdp-root[data-nav-layout=around] .rdp-button_previous{inset-inline-start:0;height:var(--rdp-nav-height);display:inline-flex;position:absolute;top:0}.rdp-root[data-nav-layout=around] .rdp-button_next{inset-inline-end:0;height:var(--rdp-nav-height);justify-content:center;display:inline-flex;position:absolute;top:0}.rdp-months{gap:var(--rdp-months-gap);flex-wrap:wrap;max-width:fit-content;display:flex;position:relative}.rdp-month_grid{border-collapse:collapse}.rdp-nav{height:var(--rdp-nav-height);align-items:center;display:flex;position:absolute;inset-block-start:0;inset-inline-end:0}.rdp-weekday{opacity:var(--rdp-weekday-opacity);padding:var(--rdp-weekday-padding);text-align:var(--rdp-weekday-text-align);text-transform:var(--rdp-weekday-text-transform);font-size:smaller;font-weight:500}.rdp-week_number{opacity:var(--rdp-week_number-opacity);height:var(--rdp-week_number-height);width:var(--rdp-week_number-width);border:var(--rdp-week_number-border);border-radius:var(--rdp-week_number-border-radius);text-align:var(--rdp-weeknumber-text-align);font-size:small;font-weight:400}.rdp-today:not(.rdp-outside){color:var(--rdp-today-color)}.rdp-selected{font-size:large;font-weight:700}.rdp-selected .rdp-day_button{border:var(--rdp-selected-border)}.rdp-outside{opacity:var(--rdp-outside-opacity)}.rdp-disabled:not(.rdp-selected){opacity:var(--rdp-disabled-opacity)}.rdp-hidden{visibility:hidden;color:var(--rdp-range_start-color)}.rdp-range_start{background:var(--rdp-range_start-background)}.rdp-range_start .rdp-day_button{background-color:var(--rdp-range_start-date-background-color);color:var(--rdp-range_start-color)}.rdp-range_middle{background-color:var(--rdp-range_middle-background-color)}.rdp-range_middle .rdp-day_button{border:unset;border-radius:unset;color:var(--rdp-range_middle-color)}.rdp-range_end{background:var(--rdp-range_end-background);color:var(--rdp-range_end-color)}.rdp-range_end .rdp-day_button{color:var(--rdp-range_start-color);background-color:var(--rdp-range_end-date-background-color)}.rdp-range_start.rdp-range_end{background:revert}.rdp-focusable{cursor:pointer}@keyframes rdp-slide_in_left{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes rdp-slide_in_right{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes rdp-slide_out_left{0%{transform:translate(0)}to{transform:translate(-100%)}}@keyframes rdp-slide_out_right{0%{transform:translate(0)}to{transform:translate(100%)}}.rdp-weeks_before_enter{animation:rdp-slide_in_left var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-weeks_before_exit{animation:rdp-slide_out_left var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-weeks_after_enter{animation:rdp-slide_in_right var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-weeks_after_exit{animation:rdp-slide_out_right var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-root[dir=rtl] .rdp-weeks_after_enter{animation:rdp-slide_in_left var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-root[dir=rtl] .rdp-weeks_before_exit{animation:rdp-slide_out_right var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-root[dir=rtl] .rdp-weeks_before_enter{animation:rdp-slide_in_right var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-root[dir=rtl] .rdp-weeks_after_exit{animation:rdp-slide_out_left var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}@keyframes rdp-fade_in{0%{opacity:0}to{opacity:1}}@keyframes rdp-fade_out{0%{opacity:1}to{opacity:0}}.rdp-caption_after_enter{animation:rdp-fade_in var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-caption_after_exit{animation:rdp-fade_out var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-caption_before_enter{animation:rdp-fade_in var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}.rdp-caption_before_exit{animation:rdp-fade_out var(--rdp-animation_duration) var(--rdp-animation_timing) forwards}@layer components;@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-content:"";--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--font-mono:"JetBrains Mono", "Fira Code", ui-monospace, monospace;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-lime-200:oklch(93.8% .127 124.321);--color-lime-400:oklch(84.1% .238 128.85);--color-lime-500:oklch(76.8% .233 130.85);--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-200:oklch(90.1% .058 230.902);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-violet-100:oklch(94.3% .029 294.588);--color-violet-200:oklch(89.4% .057 293.283);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-400:oklch(70.2% .183 293.541);--color-violet-500:#8b5cf6;--color-violet-600:#7c3aed;--color-violet-950:oklch(28.3% .141 291.089);--color-purple-400:oklch(71.4% .203 305.504);--color-fuchsia-200:oklch(90.3% .076 319.62);--color-fuchsia-300:oklch(83.3% .145 321.434);--color-fuchsia-400:oklch(74% .238 322.16);--color-fuchsia-500:oklch(66.7% .295 322.15);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-300:oklch(81% .117 11.638);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-gray-500:oklch(55.1% .027 264.364);--color-zinc-100:oklch(96.7% .001 286.375);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-300:oklch(87.1% .006 286.286);--color-zinc-400:oklch(70.5% .015 286.067);--color-zinc-500:oklch(55.2% .016 285.938);--color-zinc-600:oklch(44.2% .017 285.786);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-800:oklch(27.4% .006 286.033);--color-zinc-900:oklch(21% .006 285.885);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tighter:-.05em;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--tracking-widest:.1em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:4px;--radius-md:8px;--radius-lg:12px;--radius-xl:16px;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-cloud-white:#fafafa;--color-pure-white:#fff;--color-violet-deep:#8134ce;--color-live:#22d3ee;--color-success:#34d399;--color-warning:#fbbf24;--color-error:#f87171;--color-info:var(--color-violet-500);--color-background:#09090b;--color-foreground:#e8e8ed;--color-foreground-emphasis:#fafafa;--color-card:#18181b;--color-muted:#27272a;--color-muted-foreground:#a1a1aa;--color-accent:var(--color-violet-500);--color-border:#27272a;--color-text-secondary:#a1a1aa;--color-text-tertiary:#7c7c85;--color-text-ghost:#3f3f46;--color-surface-substrate:#0f0f12;--color-surface-default:#18181b;--color-surface-raised:#1c1c22;--color-surface-overlay:#27272a;--color-border-subtle:#1c1c22;--color-border-strong:#3f3f46;--color-sidebar:#09090b;--color-surface:#18181b;--font-grotesk:"Space Grotesk", sans-serif;--radius-full:9999px}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*,:after,:before,::backdrop{border-color:var(--color-border)}::file-selector-button{border-color:var(--color-border)}html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}body{font-family:var(--font-sans);letter-spacing:.01em;background-color:var(--color-background);color:var(--color-foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-feature-settings:"cv02", "cv03", "cv04", "cv11";margin:0;font-size:14px;line-height:1.5}h1{font-family:var(--font-grotesk);letter-spacing:-.02em;color:var(--color-foreground-emphasis);font-size:1.25rem;font-weight:600;line-height:1.3}h2{font-family:var(--font-grotesk);letter-spacing:-.01em;font-size:.875rem;font-weight:600;line-height:1.4}h3{font-family:var(--font-grotesk);letter-spacing:-.01em;font-size:.8125rem;font-weight:500;line-height:1.4}code,pre{font-family:var(--font-mono);letter-spacing:0;font-size:13px;line-height:1.6}::selection{color:var(--color-cloud-white);background:#8b5cf64d}}@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.-top-6{top:calc(var(--spacing) * -6)}.top-0{top:calc(var(--spacing) * 0)}.top-2{top:calc(var(--spacing) * 2)}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-3{top:calc(var(--spacing) * 3)}.top-full{top:100%}.right-0{right:calc(var(--spacing) * 0)}.right-1{right:calc(var(--spacing) * 1)}.right-2{right:calc(var(--spacing) * 2)}.right-3{right:calc(var(--spacing) * 3)}.right-4{right:calc(var(--spacing) * 4)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing) * 0)}.left-1{left:calc(var(--spacing) * 1)}.left-1\/2{left:50%}.left-4{left:calc(var(--spacing) * 4)}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.col-span-full{grid-column:1/-1}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-mx-0\.5{margin-inline:calc(var(--spacing) * -.5)}.-mx-6{margin-inline:calc(var(--spacing) * -6)}.mx-1{margin-inline:calc(var(--spacing) * 1)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-auto{margin-inline:auto}.-mt-2{margin-top:calc(var(--spacing) * -2)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mt-auto{margin-top:auto}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-\[7\.5rem\]{margin-left:7.5rem}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-4{-webkit-line-clamp:4;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.h-0{height:calc(var(--spacing) * 0)}.h-0\.5{height:calc(var(--spacing) * .5)}.h-1{height:calc(var(--spacing) * 1)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-48{height:calc(var(--spacing) * 48)}.h-64{height:calc(var(--spacing) * 64)}.h-72{height:calc(var(--spacing) * 72)}.h-\[76px\]{height:76px}.h-\[140px\]{height:140px}.h-\[calc\(100vh-73px\)\]{height:calc(100vh - 73px)}.h-full{height:100%}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-96{max-height:calc(var(--spacing) * 96)}.max-h-\[85vh\]{max-height:85vh}.max-h-\[320px\]{max-height:320px}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-screen{min-height:100vh}.w-0\.5{width:calc(var(--spacing) * .5)}.w-1{width:calc(var(--spacing) * 1)}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-28{width:calc(var(--spacing) * 28)}.w-32{width:calc(var(--spacing) * 32)}.w-36{width:calc(var(--spacing) * 36)}.w-40{width:calc(var(--spacing) * 40)}.w-48{width:calc(var(--spacing) * 48)}.w-52{width:calc(var(--spacing) * 52)}.w-56{width:calc(var(--spacing) * 56)}.w-64{width:calc(var(--spacing) * 64)}.w-72{width:calc(var(--spacing) * 72)}.w-\[76px\]{width:76px}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-\[28px\]{max-width:28px}.max-w-\[100px\]{max-width:100px}.max-w-\[140px\]{max-width:140px}.max-w-\[160px\]{max-width:160px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[240px\]{max-width:240px}.max-w-\[260px\]{max-width:260px}.max-w-\[280px\]{max-width:280px}.max-w-\[400px\]{max-width:400px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\[6px\]{min-width:6px}.min-w-\[8px\]{min-width:8px}.min-w-\[28px\]{min-width:28px}.min-w-\[120px\]{min-width:120px}.min-w-\[160px\]{min-width:160px}.min-w-\[220px\]{min-width:220px}.min-w-\[700px\]{min-width:700px}.min-w-\[760px\]{min-width:760px}.min-w-\[800px\]{min-width:800px}.min-w-\[900px\]{min-width:900px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-rotate-90{rotate:-90deg}.rotate-45{rotate:45deg}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing) * 0)}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-7{gap:calc(var(--spacing) * 7)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-9{gap:calc(var(--spacing) * 9)}.gap-\[2px\]{gap:2px}.gap-\[3px\]{gap:3px}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-5{column-gap:calc(var(--spacing) * 5)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-1{row-gap:calc(var(--spacing) * 1)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-5{row-gap:calc(var(--spacing) * 5)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border-subtle>:not(:last-child)){border-color:var(--color-border-subtle)}:where(.divide-border-subtle\/60>:not(:last-child)){border-color:#1c1c2299}@supports (color:color-mix(in lab, red, red)){:where(.divide-border-subtle\/60>:not(:last-child)){border-color:color-mix(in oklab, var(--color-border-subtle) 60%, transparent)}}:where(.divide-zinc-800>:not(:last-child)){border-color:var(--color-zinc-800)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:var(--radius-full)}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-none{border-radius:0}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-2xl{border-top-left-radius:var(--radius-2xl);border-top-right-radius:var(--radius-2xl)}.rounded-l-lg{border-top-left-radius:var(--radius-lg);border-bottom-left-radius:var(--radius-lg)}.rounded-l-md{border-top-left-radius:var(--radius-md);border-bottom-left-radius:var(--radius-md)}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-b-2xl{border-bottom-right-radius:var(--radius-2xl);border-bottom-left-radius:var(--radius-2xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-accent{border-color:var(--color-accent)}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/20{border-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/30{border-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/40{border-color:color-mix(in oklab, var(--color-amber-500) 40%, transparent)}}.border-amber-500\/60{border-color:#f99c0099}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/60{border-color:color-mix(in oklab, var(--color-amber-500) 60%, transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab, red, red)){.border-blue-500\/30{border-color:color-mix(in oklab, var(--color-blue-500) 30%, transparent)}}.border-border{border-color:var(--color-border)}.border-border-subtle{border-color:var(--color-border-subtle)}.border-border-subtle\/20{border-color:#1c1c2233}@supports (color:color-mix(in lab, red, red)){.border-border-subtle\/20{border-color:color-mix(in oklab, var(--color-border-subtle) 20%, transparent)}}.border-border-subtle\/30{border-color:#1c1c224d}@supports (color:color-mix(in lab, red, red)){.border-border-subtle\/30{border-color:color-mix(in oklab, var(--color-border-subtle) 30%, transparent)}}.border-border-subtle\/40{border-color:#1c1c2266}@supports (color:color-mix(in lab, red, red)){.border-border-subtle\/40{border-color:color-mix(in oklab, var(--color-border-subtle) 40%, transparent)}}.border-border-subtle\/50{border-color:#1c1c2280}@supports (color:color-mix(in lab, red, red)){.border-border-subtle\/50{border-color:color-mix(in oklab, var(--color-border-subtle) 50%, transparent)}}.border-border-subtle\/60{border-color:#1c1c2299}@supports (color:color-mix(in lab, red, red)){.border-border-subtle\/60{border-color:color-mix(in oklab, var(--color-border-subtle) 60%, transparent)}}.border-cyan-500\/20{border-color:#00b7d733}@supports (color:color-mix(in lab, red, red)){.border-cyan-500\/20{border-color:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab, red, red)){.border-cyan-500\/30{border-color:color-mix(in oklab, var(--color-cyan-500) 30%, transparent)}}.border-cyan-500\/60{border-color:#00b7d799}@supports (color:color-mix(in lab, red, red)){.border-cyan-500\/60{border-color:color-mix(in oklab, var(--color-cyan-500) 60%, transparent)}}.border-emerald-500\/20{border-color:#00bb7f33}@supports (color:color-mix(in lab, red, red)){.border-emerald-500\/20{border-color:color-mix(in oklab, var(--color-emerald-500) 20%, transparent)}}.border-emerald-500\/25{border-color:#00bb7f40}@supports (color:color-mix(in lab, red, red)){.border-emerald-500\/25{border-color:color-mix(in oklab, var(--color-emerald-500) 25%, transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab, red, red)){.border-emerald-500\/30{border-color:color-mix(in oklab, var(--color-emerald-500) 30%, transparent)}}.border-emerald-500\/40{border-color:#00bb7f66}@supports (color:color-mix(in lab, red, red)){.border-emerald-500\/40{border-color:color-mix(in oklab, var(--color-emerald-500) 40%, transparent)}}.border-emerald-500\/60{border-color:#00bb7f99}@supports (color:color-mix(in lab, red, red)){.border-emerald-500\/60{border-color:color-mix(in oklab, var(--color-emerald-500) 60%, transparent)}}.border-error\/30{border-color:#f871714d}@supports (color:color-mix(in lab, red, red)){.border-error\/30{border-color:color-mix(in oklab, var(--color-error) 30%, transparent)}}.border-fuchsia-500\/60{border-color:#e12afb99}@supports (color:color-mix(in lab, red, red)){.border-fuchsia-500\/60{border-color:color-mix(in oklab, var(--color-fuchsia-500) 60%, transparent)}}.border-orange-500\/40{border-color:#fe6e0066}@supports (color:color-mix(in lab, red, red)){.border-orange-500\/40{border-color:color-mix(in oklab, var(--color-orange-500) 40%, transparent)}}.border-red-500\/10{border-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.border-red-500\/10{border-color:color-mix(in oklab, var(--color-red-500) 10%, transparent)}}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.border-red-500\/20{border-color:color-mix(in oklab, var(--color-red-500) 20%, transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.border-red-500\/30{border-color:color-mix(in oklab, var(--color-red-500) 30%, transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.border-red-500\/40{border-color:color-mix(in oklab, var(--color-red-500) 40%, transparent)}}.border-rose-500\/10{border-color:#ff23571a}@supports (color:color-mix(in lab, red, red)){.border-rose-500\/10{border-color:color-mix(in oklab, var(--color-rose-500) 10%, transparent)}}.border-rose-500\/30{border-color:#ff23574d}@supports (color:color-mix(in lab, red, red)){.border-rose-500\/30{border-color:color-mix(in oklab, var(--color-rose-500) 30%, transparent)}}.border-rose-500\/60{border-color:#ff235799}@supports (color:color-mix(in lab, red, red)){.border-rose-500\/60{border-color:color-mix(in oklab, var(--color-rose-500) 60%, transparent)}}.border-transparent{border-color:#0000}.border-violet-400{border-color:var(--color-violet-400)}.border-violet-400\/40{border-color:#a685ff66}@supports (color:color-mix(in lab, red, red)){.border-violet-400\/40{border-color:color-mix(in oklab, var(--color-violet-400) 40%, transparent)}}.border-violet-500\/20{border-color:#8b5cf633}@supports (color:color-mix(in lab, red, red)){.border-violet-500\/20{border-color:color-mix(in oklab, var(--color-violet-500) 20%, transparent)}}.border-violet-500\/30{border-color:#8b5cf64d}@supports (color:color-mix(in lab, red, red)){.border-violet-500\/30{border-color:color-mix(in oklab, var(--color-violet-500) 30%, transparent)}}.border-violet-500\/40{border-color:#8b5cf666}@supports (color:color-mix(in lab, red, red)){.border-violet-500\/40{border-color:color-mix(in oklab, var(--color-violet-500) 40%, transparent)}}.border-violet-500\/50{border-color:#8b5cf680}@supports (color:color-mix(in lab, red, red)){.border-violet-500\/50{border-color:color-mix(in oklab, var(--color-violet-500) 50%, transparent)}}.border-violet-500\/60{border-color:#8b5cf699}@supports (color:color-mix(in lab, red, red)){.border-violet-500\/60{border-color:color-mix(in oklab, var(--color-violet-500) 60%, transparent)}}.border-warning\/30{border-color:#fbbf244d}@supports (color:color-mix(in lab, red, red)){.border-warning\/30{border-color:color-mix(in oklab, var(--color-warning) 30%, transparent)}}.border-white\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.border-white\/10{border-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.border-zinc-500\/20{border-color:#71717b33}@supports (color:color-mix(in lab, red, red)){.border-zinc-500\/20{border-color:color-mix(in oklab, var(--color-zinc-500) 20%, transparent)}}.border-zinc-500\/30{border-color:#71717b4d}@supports (color:color-mix(in lab, red, red)){.border-zinc-500\/30{border-color:color-mix(in oklab, var(--color-zinc-500) 30%, transparent)}}.border-zinc-600{border-color:var(--color-zinc-600)}.border-zinc-600\/60{border-color:#52525c99}@supports (color:color-mix(in lab, red, red)){.border-zinc-600\/60{border-color:color-mix(in oklab, var(--color-zinc-600) 60%, transparent)}}.border-zinc-700{border-color:var(--color-zinc-700)}.border-zinc-800{border-color:var(--color-zinc-800)}.border-l-amber-400{border-left-color:var(--color-amber-400)}.border-l-cyan-400{border-left-color:var(--color-cyan-400)}.border-l-emerald-400{border-left-color:var(--color-emerald-400)}.border-l-fuchsia-400{border-left-color:var(--color-fuchsia-400)}.border-l-lime-400{border-left-color:var(--color-lime-400)}.border-l-rose-400{border-left-color:var(--color-rose-400)}.border-l-sky-400{border-left-color:var(--color-sky-400)}.border-l-violet-400{border-left-color:var(--color-violet-400)}.\!bg-violet-500{background-color:var(--color-violet-500)!important}.\!bg-violet-500\/20{background-color:#8b5cf633!important}@supports (color:color-mix(in lab, red, red)){.\!bg-violet-500\/20{background-color:color-mix(in oklab, var(--color-violet-500) 20%, transparent)!important}}.bg-\[\#18181b\]{background-color:#18181b}.bg-accent{background-color:var(--color-accent)}.bg-accent\/10{background-color:#8b5cf61a}@supports (color:color-mix(in lab, red, red)){.bg-accent\/10{background-color:color-mix(in oklab, var(--color-accent) 10%, transparent)}}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/4{background-color:#f99c000a}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/4{background-color:color-mix(in oklab, var(--color-amber-500) 4%, transparent)}}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/5{background-color:color-mix(in oklab, var(--color-amber-500) 5%, transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/10{background-color:color-mix(in oklab, var(--color-amber-500) 10%, transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/15{background-color:color-mix(in oklab, var(--color-amber-500) 15%, transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/20{background-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.bg-amber-500\/30{background-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.bg-amber-500\/30{background-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.bg-amber-600{background-color:var(--color-amber-600)}.bg-background{background-color:var(--color-background)}.bg-background\/85{background-color:#09090bd9}@supports (color:color-mix(in lab, red, red)){.bg-background\/85{background-color:color-mix(in oklab, var(--color-background) 85%, transparent)}}.bg-background\/90{background-color:#09090be6}@supports (color:color-mix(in lab, red, red)){.bg-background\/90{background-color:color-mix(in oklab, var(--color-background) 90%, transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab, red, red)){.bg-black\/20{background-color:color-mix(in oklab, var(--color-black) 20%, transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab, red, red)){.bg-black\/40{background-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\/60{background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/5{background-color:color-mix(in oklab, var(--color-blue-500) 5%, transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\/20{background-color:color-mix(in oklab, var(--color-blue-500) 20%, transparent)}}.bg-border-subtle{background-color:var(--color-border-subtle)}.bg-card{background-color:var(--color-card)}.bg-cyan-400{background-color:var(--color-cyan-400)}.bg-cyan-400\/80{background-color:#00d2efcc}@supports (color:color-mix(in lab, red, red)){.bg-cyan-400\/80{background-color:color-mix(in oklab, var(--color-cyan-400) 80%, transparent)}}.bg-cyan-500{background-color:var(--color-cyan-500)}.bg-cyan-500\/4{background-color:#00b7d70a}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/4{background-color:color-mix(in oklab, var(--color-cyan-500) 4%, transparent)}}.bg-cyan-500\/5{background-color:#00b7d70d}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/5{background-color:color-mix(in oklab, var(--color-cyan-500) 5%, transparent)}}.bg-cyan-500\/10{background-color:#00b7d71a}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/10{background-color:color-mix(in oklab, var(--color-cyan-500) 10%, transparent)}}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/15{background-color:color-mix(in oklab, var(--color-cyan-500) 15%, transparent)}}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab, red, red)){.bg-cyan-500\/20{background-color:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-400\/40{background-color:#00d29466}@supports (color:color-mix(in lab, red, red)){.bg-emerald-400\/40{background-color:color-mix(in oklab, var(--color-emerald-400) 40%, transparent)}}.bg-emerald-400\/60{background-color:#00d29499}@supports (color:color-mix(in lab, red, red)){.bg-emerald-400\/60{background-color:color-mix(in oklab, var(--color-emerald-400) 60%, transparent)}}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/3{background-color:#00bb7f08}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/3{background-color:color-mix(in oklab, var(--color-emerald-500) 3%, transparent)}}.bg-emerald-500\/4{background-color:#00bb7f0a}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/4{background-color:color-mix(in oklab, var(--color-emerald-500) 4%, transparent)}}.bg-emerald-500\/5{background-color:#00bb7f0d}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/5{background-color:color-mix(in oklab, var(--color-emerald-500) 5%, transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/10{background-color:color-mix(in oklab, var(--color-emerald-500) 10%, transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/15{background-color:color-mix(in oklab, var(--color-emerald-500) 15%, transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/20{background-color:color-mix(in oklab, var(--color-emerald-500) 20%, transparent)}}.bg-emerald-500\/30{background-color:#00bb7f4d}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/30{background-color:color-mix(in oklab, var(--color-emerald-500) 30%, transparent)}}.bg-emerald-500\/60{background-color:#00bb7f99}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/60{background-color:color-mix(in oklab, var(--color-emerald-500) 60%, transparent)}}.bg-emerald-500\/\[0\.04\]{background-color:#00bb7f0a}@supports (color:color-mix(in lab, red, red)){.bg-emerald-500\/\[0\.04\]{background-color:color-mix(in oklab, var(--color-emerald-500) 4%, transparent)}}.bg-error{background-color:var(--color-error)}.bg-error\/10{background-color:#f871711a}@supports (color:color-mix(in lab, red, red)){.bg-error\/10{background-color:color-mix(in oklab, var(--color-error) 10%, transparent)}}.bg-error\/15{background-color:#f8717126}@supports (color:color-mix(in lab, red, red)){.bg-error\/15{background-color:color-mix(in oklab, var(--color-error) 15%, transparent)}}.bg-foreground\/10{background-color:#e8e8ed1a}@supports (color:color-mix(in lab, red, red)){.bg-foreground\/10{background-color:color-mix(in oklab, var(--color-foreground) 10%, transparent)}}.bg-fuchsia-500{background-color:var(--color-fuchsia-500)}.bg-fuchsia-500\/4{background-color:#e12afb0a}@supports (color:color-mix(in lab, red, red)){.bg-fuchsia-500\/4{background-color:color-mix(in oklab, var(--color-fuchsia-500) 4%, transparent)}}.bg-fuchsia-500\/15{background-color:#e12afb26}@supports (color:color-mix(in lab, red, red)){.bg-fuchsia-500\/15{background-color:color-mix(in oklab, var(--color-fuchsia-500) 15%, transparent)}}.bg-fuchsia-500\/20{background-color:#e12afb33}@supports (color:color-mix(in lab, red, red)){.bg-fuchsia-500\/20{background-color:color-mix(in oklab, var(--color-fuchsia-500) 20%, transparent)}}.bg-fuchsia-500\/60{background-color:#e12afb99}@supports (color:color-mix(in lab, red, red)){.bg-fuchsia-500\/60{background-color:color-mix(in oklab, var(--color-fuchsia-500) 60%, transparent)}}.bg-gray-500{background-color:var(--color-gray-500)}.bg-indigo-500{background-color:var(--color-indigo-500)}.bg-indigo-500\/20{background-color:#625fff33}@supports (color:color-mix(in lab, red, red)){.bg-indigo-500\/20{background-color:color-mix(in oklab, var(--color-indigo-500) 20%, transparent)}}.bg-lime-500{background-color:var(--color-lime-500)}.bg-lime-500\/4{background-color:#80cd000a}@supports (color:color-mix(in lab, red, red)){.bg-lime-500\/4{background-color:color-mix(in oklab, var(--color-lime-500) 4%, transparent)}}.bg-lime-500\/15{background-color:#80cd0026}@supports (color:color-mix(in lab, red, red)){.bg-lime-500\/15{background-color:color-mix(in oklab, var(--color-lime-500) 15%, transparent)}}.bg-muted{background-color:var(--color-muted)}.bg-muted-foreground\/10{background-color:#a1a1aa1a}@supports (color:color-mix(in lab, red, red)){.bg-muted-foreground\/10{background-color:color-mix(in oklab, var(--color-muted-foreground) 10%, transparent)}}.bg-muted-foreground\/40{background-color:#a1a1aa66}@supports (color:color-mix(in lab, red, red)){.bg-muted-foreground\/40{background-color:color-mix(in oklab, var(--color-muted-foreground) 40%, transparent)}}.bg-muted\/20{background-color:#27272a33}@supports (color:color-mix(in lab, red, red)){.bg-muted\/20{background-color:color-mix(in oklab, var(--color-muted) 20%, transparent)}}.bg-muted\/40{background-color:#27272a66}@supports (color:color-mix(in lab, red, red)){.bg-muted\/40{background-color:color-mix(in oklab, var(--color-muted) 40%, transparent)}}.bg-muted\/80{background-color:#27272acc}@supports (color:color-mix(in lab, red, red)){.bg-muted\/80{background-color:color-mix(in oklab, var(--color-muted) 80%, transparent)}}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab, red, red)){.bg-orange-500\/20{background-color:color-mix(in oklab, var(--color-orange-500) 20%, transparent)}}.bg-orange-500\/30{background-color:#fe6e004d}@supports (color:color-mix(in lab, red, red)){.bg-orange-500\/30{background-color:color-mix(in oklab, var(--color-orange-500) 30%, transparent)}}.bg-red-400{background-color:var(--color-red-400)}.bg-red-400\/60{background-color:#ff656899}@supports (color:color-mix(in lab, red, red)){.bg-red-400\/60{background-color:color-mix(in oklab, var(--color-red-400) 60%, transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/5{background-color:color-mix(in oklab, var(--color-red-500) 5%, transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/10{background-color:color-mix(in oklab, var(--color-red-500) 10%, transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/15{background-color:color-mix(in oklab, var(--color-red-500) 15%, transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/20{background-color:color-mix(in oklab, var(--color-red-500) 20%, transparent)}}.bg-red-500\/30{background-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/30{background-color:color-mix(in oklab, var(--color-red-500) 30%, transparent)}}.bg-red-500\/50{background-color:#fb2c3680}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/50{background-color:color-mix(in oklab, var(--color-red-500) 50%, transparent)}}.bg-red-500\/60{background-color:#fb2c3699}@supports (color:color-mix(in lab, red, red)){.bg-red-500\/60{background-color:color-mix(in oklab, var(--color-red-500) 60%, transparent)}}.bg-rose-500{background-color:var(--color-rose-500)}.bg-rose-500\/4{background-color:#ff23570a}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/4{background-color:color-mix(in oklab, var(--color-rose-500) 4%, transparent)}}.bg-rose-500\/6{background-color:#ff23570f}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/6{background-color:color-mix(in oklab, var(--color-rose-500) 6%, transparent)}}.bg-rose-500\/10{background-color:#ff23571a}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/10{background-color:color-mix(in oklab, var(--color-rose-500) 10%, transparent)}}.bg-rose-500\/15{background-color:#ff235726}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/15{background-color:color-mix(in oklab, var(--color-rose-500) 15%, transparent)}}.bg-rose-500\/20{background-color:#ff235733}@supports (color:color-mix(in lab, red, red)){.bg-rose-500\/20{background-color:color-mix(in oklab, var(--color-rose-500) 20%, transparent)}}.bg-sidebar{background-color:var(--color-sidebar)}.bg-sidebar\/40{background-color:#09090b66}@supports (color:color-mix(in lab, red, red)){.bg-sidebar\/40{background-color:color-mix(in oklab, var(--color-sidebar) 40%, transparent)}}.bg-sky-500{background-color:var(--color-sky-500)}.bg-sky-500\/4{background-color:#00a5ef0a}@supports (color:color-mix(in lab, red, red)){.bg-sky-500\/4{background-color:color-mix(in oklab, var(--color-sky-500) 4%, transparent)}}.bg-sky-500\/15{background-color:#00a5ef26}@supports (color:color-mix(in lab, red, red)){.bg-sky-500\/15{background-color:color-mix(in oklab, var(--color-sky-500) 15%, transparent)}}.bg-success{background-color:var(--color-success)}.bg-success\/10{background-color:#34d3991a}@supports (color:color-mix(in lab, red, red)){.bg-success\/10{background-color:color-mix(in oklab, var(--color-success) 10%, transparent)}}.bg-success\/15{background-color:#34d39926}@supports (color:color-mix(in lab, red, red)){.bg-success\/15{background-color:color-mix(in oklab, var(--color-success) 15%, transparent)}}.bg-surface-default\/90{background-color:#18181be6}@supports (color:color-mix(in lab, red, red)){.bg-surface-default\/90{background-color:color-mix(in oklab, var(--color-surface-default) 90%, transparent)}}.bg-surface-default\/95{background-color:#18181bf2}@supports (color:color-mix(in lab, red, red)){.bg-surface-default\/95{background-color:color-mix(in oklab, var(--color-surface-default) 95%, transparent)}}.bg-surface-overlay{background-color:var(--color-surface-overlay)}.bg-surface-overlay\/40{background-color:#27272a66}@supports (color:color-mix(in lab, red, red)){.bg-surface-overlay\/40{background-color:color-mix(in oklab, var(--color-surface-overlay) 40%, transparent)}}.bg-surface-overlay\/80{background-color:#27272acc}@supports (color:color-mix(in lab, red, red)){.bg-surface-overlay\/80{background-color:color-mix(in oklab, var(--color-surface-overlay) 80%, transparent)}}.bg-surface-overlay\/95{background-color:#27272af2}@supports (color:color-mix(in lab, red, red)){.bg-surface-overlay\/95{background-color:color-mix(in oklab, var(--color-surface-overlay) 95%, transparent)}}.bg-surface-raised{background-color:var(--color-surface-raised)}.bg-surface\/80{background-color:#18181bcc}@supports (color:color-mix(in lab, red, red)){.bg-surface\/80{background-color:color-mix(in oklab, var(--color-surface) 80%, transparent)}}.bg-surface\/95{background-color:#18181bf2}@supports (color:color-mix(in lab, red, red)){.bg-surface\/95{background-color:color-mix(in oklab, var(--color-surface) 95%, transparent)}}.bg-teal-500{background-color:var(--color-teal-500)}.bg-teal-500\/20{background-color:#00baa733}@supports (color:color-mix(in lab, red, red)){.bg-teal-500\/20{background-color:color-mix(in oklab, var(--color-teal-500) 20%, transparent)}}.bg-violet-400{background-color:var(--color-violet-400)}.bg-violet-400\/40{background-color:#a685ff66}@supports (color:color-mix(in lab, red, red)){.bg-violet-400\/40{background-color:color-mix(in oklab, var(--color-violet-400) 40%, transparent)}}.bg-violet-400\/60{background-color:#a685ff99}@supports (color:color-mix(in lab, red, red)){.bg-violet-400\/60{background-color:color-mix(in oklab, var(--color-violet-400) 60%, transparent)}}.bg-violet-500{background-color:var(--color-violet-500)}.bg-violet-500\/3{background-color:#8b5cf608}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/3{background-color:color-mix(in oklab, var(--color-violet-500) 3%, transparent)}}.bg-violet-500\/4{background-color:#8b5cf60a}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/4{background-color:color-mix(in oklab, var(--color-violet-500) 4%, transparent)}}.bg-violet-500\/5{background-color:#8b5cf60d}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/5{background-color:color-mix(in oklab, var(--color-violet-500) 5%, transparent)}}.bg-violet-500\/10{background-color:#8b5cf61a}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/10{background-color:color-mix(in oklab, var(--color-violet-500) 10%, transparent)}}.bg-violet-500\/15{background-color:#8b5cf626}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/15{background-color:color-mix(in oklab, var(--color-violet-500) 15%, transparent)}}.bg-violet-500\/20{background-color:#8b5cf633}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/20{background-color:color-mix(in oklab, var(--color-violet-500) 20%, transparent)}}.bg-violet-500\/25{background-color:#8b5cf640}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/25{background-color:color-mix(in oklab, var(--color-violet-500) 25%, transparent)}}.bg-violet-500\/30{background-color:#8b5cf64d}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/30{background-color:color-mix(in oklab, var(--color-violet-500) 30%, transparent)}}.bg-violet-500\/55{background-color:#8b5cf68c}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/55{background-color:color-mix(in oklab, var(--color-violet-500) 55%, transparent)}}.bg-violet-500\/70{background-color:#8b5cf6b3}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/70{background-color:color-mix(in oklab, var(--color-violet-500) 70%, transparent)}}.bg-violet-500\/85{background-color:#8b5cf6d9}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/85{background-color:color-mix(in oklab, var(--color-violet-500) 85%, transparent)}}.bg-violet-500\/\[0\.04\]{background-color:#8b5cf60a}@supports (color:color-mix(in lab, red, red)){.bg-violet-500\/\[0\.04\]{background-color:color-mix(in oklab, var(--color-violet-500) 4%, transparent)}}.bg-warning{background-color:var(--color-warning)}.bg-warning\/10{background-color:#fbbf241a}@supports (color:color-mix(in lab, red, red)){.bg-warning\/10{background-color:color-mix(in oklab, var(--color-warning) 10%, transparent)}}.bg-warning\/15{background-color:#fbbf2426}@supports (color:color-mix(in lab, red, red)){.bg-warning\/15{background-color:color-mix(in oklab, var(--color-warning) 15%, transparent)}}.bg-white\/3{background-color:#ffffff08}@supports (color:color-mix(in lab, red, red)){.bg-white\/3{background-color:color-mix(in oklab, var(--color-white) 3%, transparent)}}.bg-white\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.bg-white\/5{background-color:color-mix(in oklab, var(--color-white) 5%, transparent)}}.bg-white\/\[0\.03\]{background-color:#ffffff08}@supports (color:color-mix(in lab, red, red)){.bg-white\/\[0\.03\]{background-color:color-mix(in oklab, var(--color-white) 3%, transparent)}}.bg-white\/\[0\.04\]{background-color:#ffffff0a}@supports (color:color-mix(in lab, red, red)){.bg-white\/\[0\.04\]{background-color:color-mix(in oklab, var(--color-white) 4%, transparent)}}.bg-white\/\[0\.06\]{background-color:#ffffff0f}@supports (color:color-mix(in lab, red, red)){.bg-white\/\[0\.06\]{background-color:color-mix(in oklab, var(--color-white) 6%, transparent)}}.bg-zinc-400{background-color:var(--color-zinc-400)}.bg-zinc-500{background-color:var(--color-zinc-500)}.bg-zinc-500\/10{background-color:#71717b1a}@supports (color:color-mix(in lab, red, red)){.bg-zinc-500\/10{background-color:color-mix(in oklab, var(--color-zinc-500) 10%, transparent)}}.bg-zinc-500\/15{background-color:#71717b26}@supports (color:color-mix(in lab, red, red)){.bg-zinc-500\/15{background-color:color-mix(in oklab, var(--color-zinc-500) 15%, transparent)}}.bg-zinc-500\/20{background-color:#71717b33}@supports (color:color-mix(in lab, red, red)){.bg-zinc-500\/20{background-color:color-mix(in oklab, var(--color-zinc-500) 20%, transparent)}}.bg-zinc-500\/70{background-color:#71717bb3}@supports (color:color-mix(in lab, red, red)){.bg-zinc-500\/70{background-color:color-mix(in oklab, var(--color-zinc-500) 70%, transparent)}}.bg-zinc-600{background-color:var(--color-zinc-600)}.bg-zinc-600\/30{background-color:#52525c4d}@supports (color:color-mix(in lab, red, red)){.bg-zinc-600\/30{background-color:color-mix(in oklab, var(--color-zinc-600) 30%, transparent)}}.bg-zinc-700{background-color:var(--color-zinc-700)}.bg-zinc-700\/30{background-color:#3f3f464d}@supports (color:color-mix(in lab, red, red)){.bg-zinc-700\/30{background-color:color-mix(in oklab, var(--color-zinc-700) 30%, transparent)}}.bg-zinc-700\/50{background-color:#3f3f4680}@supports (color:color-mix(in lab, red, red)){.bg-zinc-700\/50{background-color:color-mix(in oklab, var(--color-zinc-700) 50%, transparent)}}.bg-zinc-800{background-color:var(--color-zinc-800)}.bg-zinc-800\/50{background-color:#27272a80}@supports (color:color-mix(in lab, red, red)){.bg-zinc-800\/50{background-color:color-mix(in oklab, var(--color-zinc-800) 50%, transparent)}}.bg-zinc-800\/60{background-color:#27272a99}@supports (color:color-mix(in lab, red, red)){.bg-zinc-800\/60{background-color:color-mix(in oklab, var(--color-zinc-800) 60%, transparent)}}.bg-zinc-900{background-color:var(--color-zinc-900)}.bg-zinc-900\/50{background-color:#18181b80}@supports (color:color-mix(in lab, red, red)){.bg-zinc-900\/50{background-color:color-mix(in oklab, var(--color-zinc-900) 50%, transparent)}}.bg-linear-to-b{--tw-gradient-position:to bottom}@supports (background-image:linear-gradient(in lab, red, red)){.bg-linear-to-b{--tw-gradient-position:to bottom in oklab}}.bg-linear-to-b{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-linear-to-br{--tw-gradient-position:to bottom right}@supports (background-image:linear-gradient(in lab, red, red)){.bg-linear-to-br{--tw-gradient-position:to bottom right in oklab}}.bg-linear-to-br{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-linear-to-r{--tw-gradient-position:to right}@supports (background-image:linear-gradient(in lab, red, red)){.bg-linear-to-r{--tw-gradient-position:to right in oklab}}.bg-linear-to-r{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-amber-500\/\[0\.07\]{--tw-gradient-from:#f99c0012}@supports (color:color-mix(in lab, red, red)){.from-amber-500\/\[0\.07\]{--tw-gradient-from:color-mix(in oklab, var(--color-amber-500) 7.0%, transparent)}}.from-amber-500\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-cyan-500\/\[0\.07\]{--tw-gradient-from:#00b7d712}@supports (color:color-mix(in lab, red, red)){.from-cyan-500\/\[0\.07\]{--tw-gradient-from:color-mix(in oklab, var(--color-cyan-500) 7.0%, transparent)}}.from-cyan-500\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-500\/6{--tw-gradient-from:#00bb7f0f}@supports (color:color-mix(in lab, red, red)){.from-emerald-500\/6{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-500) 6%, transparent)}}.from-emerald-500\/6{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-500\/\[0\.07\]{--tw-gradient-from:#00bb7f12}@supports (color:color-mix(in lab, red, red)){.from-emerald-500\/\[0\.07\]{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-500) 7.0%, transparent)}}.from-emerald-500\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-fuchsia-500\/\[0\.07\]{--tw-gradient-from:#e12afb12}@supports (color:color-mix(in lab, red, red)){.from-fuchsia-500\/\[0\.07\]{--tw-gradient-from:color-mix(in oklab, var(--color-fuchsia-500) 7.0%, transparent)}}.from-fuchsia-500\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-rose-500\/\[0\.07\]{--tw-gradient-from:#ff235712}@supports (color:color-mix(in lab, red, red)){.from-rose-500\/\[0\.07\]{--tw-gradient-from:color-mix(in oklab, var(--color-rose-500) 7.0%, transparent)}}.from-rose-500\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-500{--tw-gradient-from:var(--color-violet-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-500\/5{--tw-gradient-from:#8b5cf60d}@supports (color:color-mix(in lab, red, red)){.from-violet-500\/5{--tw-gradient-from:color-mix(in oklab, var(--color-violet-500) 5%, transparent)}}.from-violet-500\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-500\/\[0\.07\]{--tw-gradient-from:#8b5cf612}@supports (color:color-mix(in lab, red, red)){.from-violet-500\/\[0\.07\]{--tw-gradient-from:color-mix(in oklab, var(--color-violet-500) 7.0%, transparent)}}.from-violet-500\/\[0\.07\]{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-violet-950\/40{--tw-gradient-from:#2f0d6866}@supports (color:color-mix(in lab, red, red)){.from-violet-950\/40{--tw-gradient-from:color-mix(in oklab, var(--color-violet-950) 40%, transparent)}}.from-violet-950\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-card{--tw-gradient-via:var(--color-card);--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-card{--tw-gradient-to:var(--color-card);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-400{--tw-gradient-to:var(--color-emerald-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-3\.5{padding:calc(var(--spacing) * 3.5)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-10{padding:calc(var(--spacing) * 10)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-10{padding-inline:calc(var(--spacing) * 10)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\.5{padding-block:calc(var(--spacing) * 3.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-20{padding-block:calc(var(--spacing) * 20)}.pt-1{padding-top:calc(var(--spacing) * 1)}.pt-1\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-5{padding-top:calc(var(--spacing) * 5)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pt-8{padding-top:calc(var(--spacing) * 8)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pr-5{padding-right:calc(var(--spacing) * 5)}.pr-12{padding-right:calc(var(--spacing) * 12)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.12em\]{--tw-tracking:.12em;letter-spacing:.12em}.tracking-\[0\.15em\]{--tw-tracking:.15em;letter-spacing:.15em}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-tighter{--tw-tracking:var(--tracking-tighter);letter-spacing:var(--tracking-tighter)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.tracking-widest{--tw-tracking:var(--tracking-widest);letter-spacing:var(--tracking-widest)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.\!text-violet-300{color:var(--color-violet-300)!important}.\!text-white{color:var(--color-white)!important}.text-amber-200{color:var(--color-amber-200)}.text-amber-200\/80{color:#fee685cc}@supports (color:color-mix(in lab, red, red)){.text-amber-200\/80{color:color-mix(in oklab, var(--color-amber-200) 80%, transparent)}}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-500{color:var(--color-amber-500)}.text-blue-400{color:var(--color-blue-400)}.text-border-subtle{color:var(--color-border-subtle)}.text-cyan-200{color:var(--color-cyan-200)}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-400{color:var(--color-cyan-400)}.text-cyan-500{color:var(--color-cyan-500)}.text-emerald-200{color:var(--color-emerald-200)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-300\/80{color:#5ee9b5cc}@supports (color:color-mix(in lab, red, red)){.text-emerald-300\/80{color:color-mix(in oklab, var(--color-emerald-300) 80%, transparent)}}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/60{color:#00d29499}@supports (color:color-mix(in lab, red, red)){.text-emerald-400\/60{color:color-mix(in oklab, var(--color-emerald-400) 60%, transparent)}}.text-emerald-400\/70{color:#00d294b3}@supports (color:color-mix(in lab, red, red)){.text-emerald-400\/70{color:color-mix(in oklab, var(--color-emerald-400) 70%, transparent)}}.text-emerald-400\/80{color:#00d294cc}@supports (color:color-mix(in lab, red, red)){.text-emerald-400\/80{color:color-mix(in oklab, var(--color-emerald-400) 80%, transparent)}}.text-emerald-500{color:var(--color-emerald-500)}.text-error{color:var(--color-error)}.text-foreground{color:var(--color-foreground)}.text-foreground\/60{color:#e8e8ed99}@supports (color:color-mix(in lab, red, red)){.text-foreground\/60{color:color-mix(in oklab, var(--color-foreground) 60%, transparent)}}.text-foreground\/70{color:#e8e8edb3}@supports (color:color-mix(in lab, red, red)){.text-foreground\/70{color:color-mix(in oklab, var(--color-foreground) 70%, transparent)}}.text-foreground\/80{color:#e8e8edcc}@supports (color:color-mix(in lab, red, red)){.text-foreground\/80{color:color-mix(in oklab, var(--color-foreground) 80%, transparent)}}.text-foreground\/90{color:#e8e8ede6}@supports (color:color-mix(in lab, red, red)){.text-foreground\/90{color:color-mix(in oklab, var(--color-foreground) 90%, transparent)}}.text-fuchsia-200{color:var(--color-fuchsia-200)}.text-fuchsia-300{color:var(--color-fuchsia-300)}.text-fuchsia-400{color:var(--color-fuchsia-400)}.text-indigo-400{color:var(--color-indigo-400)}.text-info{color:var(--color-info)}.text-lime-200{color:var(--color-lime-200)}.text-lime-400{color:var(--color-lime-400)}.text-live{color:var(--color-live)}.text-muted-foreground{color:var(--color-muted-foreground)}.text-orange-300{color:var(--color-orange-300)}.text-orange-400{color:var(--color-orange-400)}.text-purple-400{color:var(--color-purple-400)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-400\/60{color:#ff656899}@supports (color:color-mix(in lab, red, red)){.text-red-400\/60{color:color-mix(in oklab, var(--color-red-400) 60%, transparent)}}.text-red-400\/80{color:#ff6568cc}@supports (color:color-mix(in lab, red, red)){.text-red-400\/80{color:color-mix(in oklab, var(--color-red-400) 80%, transparent)}}.text-rose-200{color:var(--color-rose-200)}.text-rose-300{color:var(--color-rose-300)}.text-rose-300\/80{color:#ffa2aecc}@supports (color:color-mix(in lab, red, red)){.text-rose-300\/80{color:color-mix(in oklab, var(--color-rose-300) 80%, transparent)}}.text-rose-400{color:var(--color-rose-400)}.text-sky-200{color:var(--color-sky-200)}.text-sky-400{color:var(--color-sky-400)}.text-success{color:var(--color-success)}.text-surface-overlay{color:var(--color-surface-overlay)}.text-teal-400{color:var(--color-teal-400)}.text-violet-100{color:var(--color-violet-100)}.text-violet-200{color:var(--color-violet-200)}.text-violet-300{color:var(--color-violet-300)}.text-violet-300\/70{color:#c4b4ffb3}@supports (color:color-mix(in lab, red, red)){.text-violet-300\/70{color:color-mix(in oklab, var(--color-violet-300) 70%, transparent)}}.text-violet-300\/80{color:#c4b4ffcc}@supports (color:color-mix(in lab, red, red)){.text-violet-300\/80{color:color-mix(in oklab, var(--color-violet-300) 80%, transparent)}}.text-violet-400{color:var(--color-violet-400)}.text-violet-400\/60{color:#a685ff99}@supports (color:color-mix(in lab, red, red)){.text-violet-400\/60{color:color-mix(in oklab, var(--color-violet-400) 60%, transparent)}}.text-violet-500{color:var(--color-violet-500)}.text-warning{color:var(--color-warning)}.text-zinc-100{color:var(--color-zinc-100)}.text-zinc-200{color:var(--color-zinc-200)}.text-zinc-300{color:var(--color-zinc-300)}.text-zinc-400{color:var(--color-zinc-400)}.text-zinc-500{color:var(--color-zinc-500)}.text-zinc-600{color:var(--color-zinc-600)}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline-offset-2{text-underline-offset:2px}.placeholder-muted-foreground::placeholder{color:var(--color-muted-foreground)}.opacity-0{opacity:0}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_4px_rgba\(52\,211\,153\,0\.6\)\]{--tw-shadow:0 0 4px var(--tw-shadow-color,#34d39999);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_6px_rgba\(52\,211\,153\,0\.6\)\]{--tw-shadow:0 0 6px var(--tw-shadow-color,#34d39999);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_6px_rgba\(52\,211\,153\,0\.7\)\]{--tw-shadow:0 0 6px var(--tw-shadow-color,#34d399b3);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_8px_rgba\(52\,211\,153\,0\.5\)\]{--tw-shadow:0 0 8px var(--tw-shadow-color,#34d39980);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_8px_rgba\(248\,113\,113\,0\.5\)\]{--tw-shadow:0 0 8px var(--tw-shadow-color,#f8717180);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_0_8px_rgba\(251\,191\,36\,0\.5\)\]{--tw-shadow:0 0 8px var(--tw-shadow-color,#fbbf2480);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-violet-500\/5{--tw-shadow-color:#8b5cf60d}@supports (color:color-mix(in lab, red, red)){.shadow-violet-500\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-violet-500) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-amber-500\/20{--tw-ring-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.ring-amber-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.ring-amber-500\/30{--tw-ring-color:#f99c004d}@supports (color:color-mix(in lab, red, red)){.ring-amber-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 30%, transparent)}}.ring-amber-500\/40{--tw-ring-color:#f99c0066}@supports (color:color-mix(in lab, red, red)){.ring-amber-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-amber-500) 40%, transparent)}}.ring-blue-500\/40{--tw-ring-color:#3080ff66}@supports (color:color-mix(in lab, red, red)){.ring-blue-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-blue-500) 40%, transparent)}}.ring-cyan-400{--tw-ring-color:var(--color-cyan-400)}.ring-cyan-500\/10{--tw-ring-color:#00b7d71a}@supports (color:color-mix(in lab, red, red)){.ring-cyan-500\/10{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 10%, transparent)}}.ring-cyan-500\/20{--tw-ring-color:#00b7d733}@supports (color:color-mix(in lab, red, red)){.ring-cyan-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 20%, transparent)}}.ring-cyan-500\/25{--tw-ring-color:#00b7d740}@supports (color:color-mix(in lab, red, red)){.ring-cyan-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 25%, transparent)}}.ring-cyan-500\/30{--tw-ring-color:#00b7d74d}@supports (color:color-mix(in lab, red, red)){.ring-cyan-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 30%, transparent)}}.ring-cyan-500\/40{--tw-ring-color:#00b7d766}@supports (color:color-mix(in lab, red, red)){.ring-cyan-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 40%, transparent)}}.ring-emerald-500\/10{--tw-ring-color:#00bb7f1a}@supports (color:color-mix(in lab, red, red)){.ring-emerald-500\/10{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 10%, transparent)}}.ring-emerald-500\/20{--tw-ring-color:#00bb7f33}@supports (color:color-mix(in lab, red, red)){.ring-emerald-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 20%, transparent)}}.ring-emerald-500\/30{--tw-ring-color:#00bb7f4d}@supports (color:color-mix(in lab, red, red)){.ring-emerald-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 30%, transparent)}}.ring-emerald-500\/40{--tw-ring-color:#00bb7f66}@supports (color:color-mix(in lab, red, red)){.ring-emerald-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-emerald-500) 40%, transparent)}}.ring-indigo-500\/40{--tw-ring-color:#625fff66}@supports (color:color-mix(in lab, red, red)){.ring-indigo-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 40%, transparent)}}.ring-rose-500\/30{--tw-ring-color:#ff23574d}@supports (color:color-mix(in lab, red, red)){.ring-rose-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-rose-500) 30%, transparent)}}.ring-teal-500\/40{--tw-ring-color:#00baa766}@supports (color:color-mix(in lab, red, red)){.ring-teal-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-teal-500) 40%, transparent)}}.ring-violet-500{--tw-ring-color:var(--color-violet-500)}.ring-violet-500\/10{--tw-ring-color:#8b5cf61a}@supports (color:color-mix(in lab, red, red)){.ring-violet-500\/10{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 10%, transparent)}}.ring-violet-500\/20{--tw-ring-color:#8b5cf633}@supports (color:color-mix(in lab, red, red)){.ring-violet-500\/20{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 20%, transparent)}}.ring-violet-500\/25{--tw-ring-color:#8b5cf640}@supports (color:color-mix(in lab, red, red)){.ring-violet-500\/25{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 25%, transparent)}}.ring-violet-500\/30{--tw-ring-color:#8b5cf64d}@supports (color:color-mix(in lab, red, red)){.ring-violet-500\/30{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 30%, transparent)}}.ring-violet-500\/40{--tw-ring-color:#8b5cf666}@supports (color:color-mix(in lab, red, red)){.ring-violet-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 40%, transparent)}}.ring-violet-500\/50{--tw-ring-color:#8b5cf680}@supports (color:color-mix(in lab, red, red)){.ring-violet-500\/50{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 50%, transparent)}}.ring-white\/10{--tw-ring-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.ring-white\/10{--tw-ring-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.ring-zinc-500\/40{--tw-ring-color:#71717b66}@supports (color:color-mix(in lab, red, red)){.ring-zinc-500\/40{--tw-ring-color:color-mix(in oklab, var(--color-zinc-500) 40%, transparent)}}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.ring-inset{--tw-ring-inset:inset}@media (hover:hover){.group-hover\:mt-2\.5:is(:where(.group):hover *){margin-top:calc(var(--spacing) * 2.5)}.group-hover\:block:is(:where(.group):hover *){display:block}.group-hover\:h-auto:is(:where(.group):hover *){height:auto}.group-hover\:bg-fuchsia-400:is(:where(.group):hover *){background-color:var(--color-fuchsia-400)}.group-hover\:text-violet-300:is(:where(.group):hover *){color:var(--color-violet-300)}.group-hover\:text-violet-400:is(:where(.group):hover *){color:var(--color-violet-400)}.group-hover\:opacity-80:is(:where(.group):hover *){opacity:.8}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\:text-zinc-500::placeholder{color:var(--color-zinc-500)}.before\:mr-1\.5:before{content:var(--tw-content);margin-right:calc(var(--spacing) * 1.5)}.before\:content-\[\'–\'\]:before{--tw-content:"–";content:var(--tw-content)}.last\:mb-0:last-child{margin-bottom:calc(var(--spacing) * 0)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}@media (hover:hover){.hover\:-translate-y-0\.5:hover{--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:scale-\[1\.01\]:hover{scale:1.01}.hover\:border-border-strong:hover{border-color:var(--color-border-strong)}.hover\:border-violet-400:hover{border-color:var(--color-violet-400)}.hover\:border-violet-500:hover{border-color:var(--color-violet-500)}.hover\:border-violet-500\/40:hover{border-color:#8b5cf666}@supports (color:color-mix(in lab, red, red)){.hover\:border-violet-500\/40:hover{border-color:color-mix(in oklab, var(--color-violet-500) 40%, transparent)}}.hover\:border-violet-500\/50:hover{border-color:#8b5cf680}@supports (color:color-mix(in lab, red, red)){.hover\:border-violet-500\/50:hover{border-color:color-mix(in oklab, var(--color-violet-500) 50%, transparent)}}.hover\:bg-amber-500\/20:hover{background-color:#f99c0033}@supports (color:color-mix(in lab, red, red)){.hover\:bg-amber-500\/20:hover{background-color:color-mix(in oklab, var(--color-amber-500) 20%, transparent)}}.hover\:bg-emerald-500\/10:hover{background-color:#00bb7f1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-emerald-500\/10:hover{background-color:color-mix(in oklab, var(--color-emerald-500) 10%, transparent)}}.hover\:bg-emerald-500\/20:hover{background-color:#00bb7f33}@supports (color:color-mix(in lab, red, red)){.hover\:bg-emerald-500\/20:hover{background-color:color-mix(in oklab, var(--color-emerald-500) 20%, transparent)}}.hover\:bg-muted:hover{background-color:var(--color-muted)}.hover\:bg-muted\/50:hover{background-color:#27272a80}@supports (color:color-mix(in lab, red, red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab, var(--color-muted) 50%, transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab, var(--color-red-500) 10%, transparent)}}.hover\:bg-red-500\/20:hover{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.hover\:bg-red-500\/20:hover{background-color:color-mix(in oklab, var(--color-red-500) 20%, transparent)}}.hover\:bg-surface-overlay:hover{background-color:var(--color-surface-overlay)}.hover\:bg-surface-overlay\/30:hover{background-color:#27272a4d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-surface-overlay\/30:hover{background-color:color-mix(in oklab, var(--color-surface-overlay) 30%, transparent)}}.hover\:bg-surface-overlay\/40:hover{background-color:#27272a66}@supports (color:color-mix(in lab, red, red)){.hover\:bg-surface-overlay\/40:hover{background-color:color-mix(in oklab, var(--color-surface-overlay) 40%, transparent)}}.hover\:bg-surface-overlay\/60:hover{background-color:#27272a99}@supports (color:color-mix(in lab, red, red)){.hover\:bg-surface-overlay\/60:hover{background-color:color-mix(in oklab, var(--color-surface-overlay) 60%, transparent)}}.hover\:bg-surface-overlay\/70:hover{background-color:#27272ab3}@supports (color:color-mix(in lab, red, red)){.hover\:bg-surface-overlay\/70:hover{background-color:color-mix(in oklab, var(--color-surface-overlay) 70%, transparent)}}.hover\:bg-violet-500\/10:hover{background-color:#8b5cf61a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-violet-500\/10:hover{background-color:color-mix(in oklab, var(--color-violet-500) 10%, transparent)}}.hover\:bg-violet-500\/20:hover{background-color:#8b5cf633}@supports (color:color-mix(in lab, red, red)){.hover\:bg-violet-500\/20:hover{background-color:color-mix(in oklab, var(--color-violet-500) 20%, transparent)}}.hover\:bg-violet-500\/25:hover{background-color:#8b5cf640}@supports (color:color-mix(in lab, red, red)){.hover\:bg-violet-500\/25:hover{background-color:color-mix(in oklab, var(--color-violet-500) 25%, transparent)}}.hover\:bg-white\/3:hover{background-color:#ffffff08}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/3:hover{background-color:color-mix(in oklab, var(--color-white) 3%, transparent)}}.hover\:bg-white\/\[0\.03\]:hover{background-color:#ffffff08}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/\[0\.03\]:hover{background-color:color-mix(in oklab, var(--color-white) 3%, transparent)}}.hover\:bg-white\/\[0\.04\]:hover{background-color:#ffffff0a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/\[0\.04\]:hover{background-color:color-mix(in oklab, var(--color-white) 4%, transparent)}}.hover\:bg-white\/\[0\.06\]:hover{background-color:#ffffff0f}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/\[0\.06\]:hover{background-color:color-mix(in oklab, var(--color-white) 6%, transparent)}}.hover\:bg-white\/\[0\.07\]:hover{background-color:#ffffff12}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/\[0\.07\]:hover{background-color:color-mix(in oklab, var(--color-white) 7.0%, transparent)}}.hover\:bg-zinc-800:hover{background-color:var(--color-zinc-800)}.hover\:text-cyan-300:hover{color:var(--color-cyan-300)}.hover\:text-emerald-400:hover{color:var(--color-emerald-400)}.hover\:text-foreground:hover{color:var(--color-foreground)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:text-violet-200:hover{color:var(--color-violet-200)}.hover\:text-violet-300:hover{color:var(--color-violet-300)}.hover\:text-zinc-200:hover{color:var(--color-zinc-200)}.hover\:text-zinc-300:hover{color:var(--color-zinc-300)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-\[0_14px_34px_-16px_rgba\(34\,211\,238\,0\.45\)\]:hover{--tw-shadow:0 14px 34px -16px var(--tw-shadow-color,#22d3ee73);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-\[0_14px_34px_-16px_rgba\(52\,211\,153\,0\.45\)\]:hover{--tw-shadow:0 14px 34px -16px var(--tw-shadow-color,#34d39973);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-\[0_14px_34px_-16px_rgba\(139\,92\,246\,0\.45\)\]:hover{--tw-shadow:0 14px 34px -16px var(--tw-shadow-color,#8b5cf673);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-\[0_14px_34px_-16px_rgba\(217\,70\,239\,0\.45\)\]:hover{--tw-shadow:0 14px 34px -16px var(--tw-shadow-color,#d946ef73);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-\[0_14px_34px_-16px_rgba\(251\,113\,133\,0\.4\)\]:hover{--tw-shadow:0 14px 34px -16px var(--tw-shadow-color,#fb718566);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:shadow-\[0_14px_34px_-16px_rgba\(251\,191\,36\,0\.4\)\]:hover{--tw-shadow:0 14px 34px -16px var(--tw-shadow-color,#fbbf2466);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:ring-1:hover{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\:ring-cyan-500\/30:hover{--tw-ring-color:#00b7d74d}@supports (color:color-mix(in lab, red, red)){.hover\:ring-cyan-500\/30:hover{--tw-ring-color:color-mix(in oklab, var(--color-cyan-500) 30%, transparent)}}.hover\:ring-red-500\/30:hover{--tw-ring-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.hover\:ring-red-500\/30:hover{--tw-ring-color:color-mix(in oklab, var(--color-red-500) 30%, transparent)}}.hover\:ring-violet-500\/30:hover{--tw-ring-color:#8b5cf64d}@supports (color:color-mix(in lab, red, red)){.hover\:ring-violet-500\/30:hover{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 30%, transparent)}}}.focus\:border-violet-500:focus{border-color:var(--color-violet-500)}.focus\:border-violet-500\/60:focus{border-color:#8b5cf699}@supports (color:color-mix(in lab, red, red)){.focus\:border-violet-500\/60:focus{border-color:color-mix(in oklab, var(--color-violet-500) 60%, transparent)}}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-violet-500:focus{--tw-ring-color:var(--color-violet-500)}.focus\:ring-violet-500\/40:focus{--tw-ring-color:#8b5cf666}@supports (color:color-mix(in lab, red, red)){.focus\:ring-violet-500\/40:focus{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 40%, transparent)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:text-violet-300:focus-visible{color:var(--color-violet-300)}.focus-visible\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-violet-400:focus-visible{--tw-ring-color:var(--color-violet-400)}.focus-visible\:ring-violet-500:focus-visible{--tw-ring-color:var(--color-violet-500)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media (hover:hover){.disabled\:hover\:border-border-subtle:disabled:hover{border-color:var(--color-border-subtle)}.disabled\:hover\:bg-white\/\[0\.03\]:disabled:hover{background-color:#ffffff08}@supports (color:color-mix(in lab, red, red)){.disabled\:hover\:bg-white\/\[0\.03\]:disabled:hover{background-color:color-mix(in oklab, var(--color-white) 3%, transparent)}}}@media (width>=40rem){.sm\:inline{display:inline}.sm\:w-72{width:calc(var(--spacing) * 72)}.sm\:w-\[15\.5rem\]{width:15.5rem}.sm\:flex-1{flex:1}.sm\:shrink-0{flex-shrink:0}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:items-end{align-items:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-7{gap:calc(var(--spacing) * 7)}.sm\:gap-12{gap:calc(var(--spacing) * 12)}.sm\:self-stretch{align-self:stretch}.sm\:border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.sm\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.sm\:border-border-subtle{border-color:var(--color-border-subtle)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}.sm\:px-8{padding-inline:calc(var(--spacing) * 8)}.sm\:pt-0{padding-top:calc(var(--spacing) * 0)}.sm\:pb-1{padding-bottom:calc(var(--spacing) * 1)}.sm\:pl-6{padding-left:calc(var(--spacing) * 6)}.sm\:pl-7{padding-left:calc(var(--spacing) * 7)}.sm\:pl-10{padding-left:calc(var(--spacing) * 10)}.sm\:text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}}@media (width>=48rem){.md\:sticky{position:sticky}.md\:top-0{top:calc(var(--spacing) * 0)}.md\:h-screen{height:100vh}.md\:w-56{width:calc(var(--spacing) * 56)}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:overflow-y-auto{overflow-y:auto}.md\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.md\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}}@media (width>=64rem){.lg\:col-span-2{grid-column:span 2/span 2}.lg\:w-80{width:calc(var(--spacing) * 80)}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-\[280px_1fr\]{grid-template-columns:280px 1fr}.lg\:flex-row{flex-direction:row}.lg\:items-start{align-items:flex-start}.lg\:border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.lg\:border-l{border-left-style:var(--tw-border-style);border-left-width:1px}}@media (width>=80rem){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.glass-panel{background:var(--color-card);border:1px solid var(--color-border)}.glass-card{background:var(--color-card);border:1px solid var(--color-border);transition:all .2s ease-in-out}.glass-card:hover{background:var(--color-surface-raised);border-color:var(--color-border-strong)}.el-substrate{background-color:var(--color-surface-substrate)}.el-surface{background-color:var(--color-surface-default)}.el-raised{background-color:var(--color-surface-raised)}.el-overlay{background-color:var(--color-surface-overlay)}.el-border-subtle{border-color:var(--color-border-subtle)}.el-border-strong{border-color:var(--color-border-strong)}.t-secondary{color:var(--color-text-secondary)}.t-tertiary{color:var(--color-text-tertiary)}.t-ghost{color:var(--color-text-ghost)}.text-foreground-emphasis{color:var(--color-foreground-emphasis)}.glow-accent{box-shadow:0 0 20px #8b5cf626}.glow-live{box-shadow:0 0 16px #22d3ee26}.glow-success{box-shadow:0 0 16px #34d39926}.text-gradient{-webkit-text-fill-color:transparent;background:linear-gradient(135deg,#8b5cf6 0%,#6d28d9 100%);-webkit-background-clip:text;background-clip:text}.card-hover{transition:all .2s ease-out}.card-hover:hover{border-color:var(--color-border-strong);transform:translateY(-1px);box-shadow:0 4px 12px #0003}.font-grotesk{font-family:var(--font-grotesk)}.font-mono{font-family:var(--font-mono)}.custom-scrollbar::-webkit-scrollbar{width:6px;height:6px}.custom-scrollbar::-webkit-scrollbar-track{background:0 0}.custom-scrollbar::-webkit-scrollbar-thumb{background:#ffffff14;border-radius:3px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#ffffff26}.scrollbar-hide::-webkit-scrollbar{display:none}.scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}.section-label{font-family:var(--font-grotesk);text-transform:uppercase;letter-spacing:.08em;color:var(--color-text-secondary);font-size:.6875rem;font-weight:600}.divider-shimmer{background:linear-gradient(90deg,#0000 0%,#ffffff0f 20%,#ffffff1f 50%,#ffffff0f 80%,#0000 100%);height:1px}}@font-face{font-family:JetBrains Mono;src:url(./fonts/jetbrains-mono-latin-400-normal.woff)format("woff");font-weight:400;font-style:normal;font-display:swap}@media (prefers-reduced-motion:reduce){*,:before,:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}
|
|
927
927
|
/*$vite$:1*/</style>
|
|
928
928
|
</head>
|
|
929
929
|
<body>
|